• Please review our updated Terms and Rules here

Faster TP program!

CP/M User

Veteran Member
Joined
May 2, 2003
Messages
2,986
Location
Back of Burke (Guday!), Australia
Here's a small sample of a BASIC program I found which took it's time calculating. This is the TP 5.5 version, however with some small modifications it will work in TP 3.x (just uncomment the Registers type).

For some reason I can't get the right colour to come out, any ideas?

=== ArryDemo.PAS ===

Program ArryDemo;

uses crt,dos; { Not Req in TP 3}

{$I data.inc}

{type Registers = Record
Case Integer Of
1 : ( AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Integer );
2 : ( AL,AH,BL,BH,CL,CH,DL,DH : Byte );
END;} {Uncomment for TP 3}

var count : byte;

Procedure setmode(sc : byte);
var regs : registers;
begin
regs.ah:=00;
regs.al:=sc;
intr($10,regs);
end;

Procedure SetbordPal(col,mode : byte);
var regs : registers;
begin
regs.ah:=$0B;
regs.bh:=mode;
regs.bl:=col;
intr($10,regs);
end;

Procedure Pixel(Column,Row : Word; col : byte);

{For TP 3, change Word to Integer in previous statement}

var regs : registers;
begin
regs.ah:=$0C;
regs.al:=col;
regs.bh:=0;
regs.cx:=Column;
regs.dx:=Row;
intr($10,regs);
end;

Procedure Box;
var xpos, ypos : word; {Change to Integer in TP3}
begin
for xpos:=0 to 639 do
pixel(xpos,0,1);
for ypos:=0 to 199 do
pixel(639,ypos,1);
for xpos:=639 downto 0 do
pixel(xpos,199,1);
for ypos:=199 downto 0 do
pixel(0,ypos,1);
end;

begin
setmode($6);
setbordpal(0,0);
setbordpal(1,1);
for count:=1 to 150 do
pixel(XPOSarry[count],YPOSarry[count],1);
box;
repeat until keypressed;
setmode(2);
end.

=== End ArryDemo.PAS ===
=== Data.INC ===
const XPOSarry : array[1..150] of integer =(
323,
325,
321,
311,
306,
315,
334,
344,
331,
304,
287,
301,
336,
362,
349,
306,
271,
279,
329,
375,
373,
319,
262,
255,
310,
379,
397,
343,
262,
231,
282,
373,
419,
374,
275,
213,
249,
354,
433,
409,
300,
205,
213,
322,
435,
444,
337,
209,
180,
281,
423,
474,
383,
229,
155,
232,
395,
493,
433,
265,
143,
183,
352,
497,
481,
315,
148,
137,
296,
483,
523,
375,
172,
101,
233,
449,
551,
440,
215,
81,
167,
397,
561,
505,
275,
82,
106,
329,
550,
561,
349,
105,
55,
251,
515,
603,
430,
151,
23,
168,
457,
624,
513,
220,
14,
89,
379,
620,
587,
305,
32,
21,
287,
588,
646,
402,
78,
-28,
187,
529,
683,
503,
150,
-50,
89,
445,
691,
597,
245,
-43,
1,
341,
667,
676,
356,
-2,
-67,
226,
610,
732,
474,
70,
-108,
108,
523,
756,
589,
170,
-116,
-2);

const YPOSarry : array[0..150] of integer =(
100,
101,
99,
97,
97,
101,
106,
105,
99,
92,
92,
100,
110,
112,
102,
89,
85,
95,
112,
119,
108,
88,
78,
88,
110,
125,
117,
92,
73,
78,
105,
128,
127,
100,
71,
68,
95,
128,
136,
110,
73,
60,
83,
124,
144,
124,
80,
53,
69,
115,
148,
138,
92,
51,
55,
101,
148,
151,
107,
55,
43,
84,
142,
162,
125,
63,
34,
65,
130,
169,
144,
78,
30,
46,
113,
169,
163,
98,
33,
29,
91,
163,
178,
121,
43,
16,
67,
150,
188,
145,
60,
10,
42,
130,
191,
169,
83,
10,
20,
104,
186,
190,
110,
19,
2,
75,
173,
205,
141,
37,
-10,
44,
151,
212,
171,
63,
-13,
15,
122,
210,
198,
94,
-6,
-9,
88,
198,
219,
130,
11,
-27,
52,
177,
232,
166,
38,
-34,
17,
146,
234,
200,
72,
-31,
-15,
108,
225,
228,
112,
-17,
-39,
67,
205);
=== End Data.INC ===
 
Back
Top