home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG094.ARC
/
HIRES5C.I
< prev
next >
Wrap
Text File
|
1979-12-31
|
12KB
|
249 lines
function HiDot (X, Y, F : Integer) : Boolean;
{Modified by R.K.Hallworth of Donvale Christian School for the
Premium using 64x16 screen
Function to alter a pixel anywhere on the screen. Returns TRUE if
successful and FALSE if there is an illegal parameter or if all PCGs have
been used. HiRes must be called prior to the first call to HiDot }
var
Scratch : array [0..15] of Byte; {Scratch for desired PCG}
Temp,Bank, {Temporary storage}
Memory,
Video : Integer; {Address in screen RAM of PCG to be
changed}
PCGAddr :Integer; {address of PCG}
Line, {Line of PCG to be changed}
PCG,PCGByte, {PCG at Mem[Video]}
Mask : Byte; {Mask to be applied to Scratch[Line]
to alter the correct dot}
H : Boolean; {Result of HiDot}
Type
MaskArray=array[0..7] of byte;
const
Masks:MaskArray=(1,2,4,8,16,32,64,128);
begin
Inline(
{First, check that all parameters are legal}
$A7/ { AND A }
$ED/$5B/X/ { LD DE, (X) }
$21/511/ { LD HL, 511 }
$ED/$52/ { SBC HL, DE }
$DA/*+25/ { JP C, FALSE }
$ED/$5B/Y/ { LD DE, (Y) }
$21/>255/ { LD HL, 255 }
$ED/$52/ { SBC HL, DE }
$DA/*+13/ { JP C, FALSE }
$3A/F/ { LD A, (F) }
$D6/3/ { SUB 3 }
$D2/*+5/ { JP NC, FALSE }
$C3/*+6/ { JP NEXT1 }
$97/ { FALSE SUB A }
$C3/*+237/ { JP FINISH }
{Mask to be applied to Scratch[Line]}
$2A/X/ { NEXT1 LD HL, (X) }
$7D/ { LD A, L }
$0E/7/ { LD C, 00000111B }
$A1/ { AND C }
$A9/ { XOR C }
$E5/ { PUSH HL }
$5F/ { LD E,A }
$16/0/ { LD D,0 }
$21/MASKS/ { LD HL,MASKS }
$19/ { ADD HL,DE }
$7E/ { LD A,(HL) }
$E1/ { POP HL }
$32/Mask/ { SAVE LD (Mask), A }
{Calculate X DIV 8 and save on the stack}
$06/$03/ { LD B, 3 }
$CB/$3D/ { XDIV SRL L }
$CB/$3C/ { SRL H }
$D2/*+4/ { JP NC, NOCARRY }
$CB/$FD/ { SET 7, L }
$10/$F5/ { NOCARRY DJNZ XDIV }
$E5/ { PUSH HL }
{Calculate Line in PCG}
$2A/Y/ { LD HL, (Y) }
$3E/15/ { LD A,15 * }
$A5/ { AND A,L * }
$67/ { LD H,A * }
$3E/15/ { LD A, 15 }
$94/ { SUB H }
$32/Line/ { LD (Line), A }
{Invert quotient and "multiply by 64" only X4}
$2A/Y/ { LD HL, (Y) * }
$7D/ { LD A,L * }
$16/240/ { LD D,11110000B * }
$A2/ { AND A,D * }
$AA/ { XOR A,D * }
$6F/ { LD L,A * }
$06/0/ { LD B,0 * }
$29/ { ADD HL, HL }
$29/ { ADD HL, HL }
{POP X DIV 8 off stack, add it, add $F000 and save Video address}
$D1/ { POP DE }
$19/ { ADD HL, DE }
$E5/ { PUSH HL }
$11/$F000/ { LD DE, $F000 }
$19/ { ADD HL, DE }
$22/Video/ { LD (Video), HL }
{Port[ROMLatch] := ScreenRAM;}
$97/ { SUB A }
$D3/11/ { OUT (11), A }
{PCG := Mem[Video]; }
$7E/ { LD A, (HL) }
$32/PCG/ { LD (PCG), A }
{TEST If PCG < 127 }
$6F/ { LD L,A SAVE PCG#}
$D6/127/ { SUB 127 }
$FA/*+21/ { JP M,NONGRAPHIC }
{Do IF PCG>127} {Set PCG RAM}
$F1/ { POP AF CLEAR STACK }
$CB/$BD/ { RES L,7 }
$E5/ { PUSH HL SAVE PCG NO. }
$3E/144/ { LD A,144 }
$D3/28/ { OUT (28),A}
$2A/VIDEO/ { LD HL,(VIDEO)}
$7E/ { LD A,(HL)}
$C6/$80/ { ADD A,128}
$D3/$1C/ { OUT (28),A}
$C3/*+39/ { JP GRAPHIC}
{Do IF PCG < 128} {Find PCG Bank No. }
$D1/ {NONGRAPHIC POP DE}
$D5/ { PUSH DE}
$CB/$22/ { SLA D}
$CB/$7B/ { BIT 7,E}
$CA/*+4/ { JP Z,CONT}
$CB/$C2/ { SET 0,D}
{ ;D=Bank No.}
{Set attribute RAM}
$3E/144/ {CONT: LD A,144 50}
$D3/28/ { OUT (28),A}
$2A/VIDEO/ { LD HL,(VIDEO)}
$7A/ { LD A,D}
$77/ { LD (HL),A}
{Set PCG RAM}
$C6/$80/ { ADD A,128}
$D3/$1C/ { OUT (28),A}
{Calculate PCG_No}
$E1/ { POP HL }
$7D/ { LD A, L }
$E6/127/ { AND 127 }
$6F/ { LD L, A }
$E5/ { PUSH HL }
{Mem[Video]:= PCG_No}
$7D/ { LD A, L }
$C6/128/ { ADD A, 128 }
$2A/Video/ { LD HL, (VIDEO) }
$77/ { LD (HL), A }
{Save PCG address }
$E1/ {Graphic POP HL }
$26/0/ { LD H, 0 }
$29/ { ADD HL, HL }
$29/ { ADD HL, HL }
$29/ { ADD HL, HL }
$29/ { ADD HL, HL }
$11/$F800/ { LD DE, $F800 }
$19/ { ADD HL, DE }
$22/PCGAddr/ { LD (PCGAddr),HL }
{If PCG < 128 }
$3A/PCG/ { LD A,(PCG) }
$6F/ { LD L,A }
$60/ { LD H,B }
$D6/127/ { SUB 127 }
$F2/*+22/ { JP P,NEXT2 }
{Port[ROMLatch] := StandardSet;}
$3E/1/ { LD A, 1 }
$D3/11/ { OUT (11), A }
{Copy the present character into PCG RAM}
$29/ { ADD HL, HL }
$29/ { ADD HL, HL }
$29/ { ADD HL, HL }
$29/ { ADD HL, HL }
$11/$F000/ { LD DE, $F000 }
$19/ { ADD HL, DE }
$ED/$5B/PCGAddr/ { LD DE, (PCGAddr) }
$0E/16/ { LD C, 16 }
$ED/$B0/ { LDIR }
{Port[ROMLatch] := ScreenRAM;}
$97/ { SUB A }
$D3/11/ { OUT (11), A }
{ 114}
{Change Scratch[Line] using Mask. Test to see if it has changed.}
$2A/PCGAddr/ {NEXT2 LD HL, (PCGAddr) }
$ED/$5B/Line/ { LD DE, (Line) }
$16/0/ { LD D, 0 }
$19/ { ADD HL, DE }
$46/ { LD B, (HL) }
$3A/Mask/ { LD A, (Mask) }
$4F/ { LD C, A }
$3A/F/ { LD A, (F) }
$FE/0/ { CP 0 }
$CA/*+12/ { JP Z, ANDMASK }
$FE/1/ { CP 1 }
$CA/*+13/ { JP Z, ORMASK }
$78/ { LD A, B }
$A9/ { XOR C }
$C3/*+14/ { JP CHANGE }
$79/ { ANDMASK LD A, C }
$2F/ { CPL }
$A0/ { AND B }
$C3/*+4/ { JP CHANGED }
$78/ { ORMASK LD A, B }
$B1/ { OR C }
$B8/ { CHANGED CP B }
$CA/*+3/ { JP Z, DONE }
$77/ { CHANGE LD (HL), A }
$3E/1/ { DONE LD A, 1 }
$32/H/ { FINISH LD (H), A }
$3E/128/ { LD A,128 }
$D3/28); { OUT (28),A Set to bank 0 }
HiDot := H
end;