home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
beehive
/
utilitys
/
pudd.arc
/
TOOLS2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-08-11
|
7KB
|
119 lines
{*************************************************************************}
procedure moveto(xpos,ypos:integer); {moves curser to xposition,yposition }
begin
inline ( $0E/$04/ { LD C,4 ;move to x,y }
$2A/xpos/ { LD HL,xpos ;this is x }
$ED/$5B/ypos/ { LD DE,ypos ;this is y }
$EF ); { RST 28H }
{..........................................................................
NOTE:
The valid screen positions are cartesian coordinates in the first
quadrent from (0,0) to (639,239). There are other systems in common
use like (0,0) to (1,1) which will require passing a real value and
converting it to an integer. The IBM uses either 320x200 or 640x200.
These conversions can be done in Pascal before the inline statement.
If anyone converts this stuff to polar coordinates I would like to
see it.
.............................................................................}
end;
{*************************************************************************}
{*************************************************************************}
procedure drawto(xpos,ypos:integer); {.......................draw a line }
{ draws from current position to x,y in current line style }
begin
inline ( $0E/$05/ { LD C,5 ;draw line to x,y }
$2A/xpos/ { LD HL,xpos ;x }
$ED/$5B/ypos/ { LD DE,ypos ;y }
$EF ); { RST 28H }
end;
{*************************************************************************}
{*************************************************************************}
procedure alphamode; {................. returns to the regular mode }
begin
inline ( $0E/$00/ { LD C,0 ;goto alphanumberic mode }
$EF ); { RST 28H }
end;
{*************************************************************************}
{*************************************************************************}
procedure polyline(size:integer; {the number of (x,y) pairs}
listarry:pointlist );
{......This is a single call to the graphics primitives which will draw }
{ lines between as many as 63 points. Each point is given as an integer}
{ pair. The array passed can have a max of 126 integers, or 63 (x,y) }
{ pairs. The size is the number of pairs and must not exceed 63. }
{ Since the procedure is required to rebuild the array at another }
{ location, there is no overall sigifigant time savings. There is, }
{ however, a savings in time for the actual drawing, since it is all }
{ done in one call. }
var point: integer; {....pointer }
loop: integer; {....the looping is done in pascal, pure lasyness}
position: integer; {....passed as integer in machine code stuff }
begin {...............................................polyline }
inline ($21/$00/$FF/ {ld hl,0ff00h put addr of addr in hl }
$5E/ {ld E,(HL) get half of the address }
$23/ {inc HL point to second half }
$56/ {ld D,(HL) get other half }
$EB/ { ex DE,HL switch }
{ ........HL now has the address of the array }
{.now enter the size of the array into the array }
$ED/$5B/size/ {ld DE,(nn) get the size }
$73/ {ld (HL),E .. the low byte }
$23/ {inc HL and }
$72/ {ld (HL),D .. the high byte }
$23/ {inc HL }
$22/point ); {ld (nn),HL store address in pointer }
for loop := 1 to size*2 do
begin
position := listarry[loop];
inline ($2A/point/ {ld HL,(nn) get the pointer }
$ED/$5B/position/ {ld DE,(nn) get the position integer }
$73/ {ld (HL),E load low byte }
$23/ {inc HL mov'in right along }
$72/ {ld (HL),D load high byte }
$23/ {inc HL }
$22/point ); {ld (nn),HL save pointer }
end;
inline ($0E/$03/ {ld C,3 choose function }
$EF ) {rst 28h }
end; {...............................................polyline }
{*************************************************************************}
{**************************************************************************}
{* GetLine will return an 80 byte array which is a direct bit *}
{* representation of the pixels from left to right on the graphic line *}
{* passed as y. *}
{**************************************************************************}
procedure GetLine( y :integer; {...the line number}
var ByteList :ScanLine );
var LocalY :integer;
Pointr :integer;
i,j,k :integer;
begin
LocalY := y;
Pointr := addr(ByteList);
inline($0E/$13/ {ld C,013h function is #19 }
$ED/$6B/Localy/ {ld HL,(nn) get the row }
$EF/ {rst 28h make the call }
$ED/$6B/$00/$FF/ {ld HL,(0FF00h) get the 'from' array }
$ED/$5B/Pointr/ {ld DE,(nn) get the 'to' array }
$01/$50/$00/ {ld BC,80d move 80 bytes }
$ED/$B0);
end;
{**************************************************************************}
dr$Edre LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD LD