; ZXPLOT.ASM ; ZX Spectrum graphics routines using whole screen - J.G.Harston ; -------------------------------------------------------------- ; Replaces the three graphics entries in the Spectrum ROM ; ; GRMOVE - Move to a point, absolute coords ; GRPLOT - Plot a point, absolute coords, replaces CALL &22E5 PLOTSUB ; GRDRAW - Draw a line, relative coords, replaces CALL &24BA DRAWLINE+3 ; ; On entry: BC=plot coordinate, C=X, B=Y ; DE=sign of coordinates, E=SGN(X), D=SGN(Y) ; On exit: AF,BC,DE,HL corrupted ; AF',BC',DE' also corrupted by DRAW ; Size: 90 bytes ; Plot point at BC=(Y,X) ; ---------------------- GRPLOT LD A,&BF SUB B RET C ; Y out of range PUSH BC CALL &22B0 ; Convert to HL/A CALL &22EC ; Plot pixel POP BC ; Move to BC=(Y,X) ; ---------------- GRMOVE LD (23677),BC ; MOVE to (C,B) RET ; Draw line from current point to BC=(Y,X) ; ---------------------------------------- ; Enter here: BC=value of relative coords 0 to 255 ; DE=sign of relative coords, &01/&FF ; GRDRAW LD A,C ; As per ROM code CP B JR NC,GDLXGEY LD L,C PUSH DE XOR A LD E,A JR GDLARGE GDLXGEY OR C RET Z LD L,B LD B,C PUSH DE LD D,0 GDLARGE LD H,B LD A,B RRA GDLOOP ADD A,L JR C,GDLDIAG CP H JR C,GDLHRVT GDLDIAG SUB H LD C,A EXX POP BC PUSH BC JR GDLSTEP GDLHRVT LD C,A PUSH DE EXX POP BC GDLSTEP PUSH HL INC C ; Adjust to set flags LD HL,(23677) ; Get current coords LD A,B ; Add relative coords ADD A,H LD B,A LD A,C ADD A,L LD C,A ; Return absolute coords JR C,GDLRANG JR Z,GDLEXIT GDLPLOT DEC A ; Reverse the adjust LD C,A CALL GRPLOT ; Plot the point, updating COORDS POP HL EXX LD A,C DJNZ GDLOOP POP DE RET GDLRANG JR Z,GDLPLOT GDLEXIT POP HL EXX POP DE RET