== Fast plotting routine for MODE 1 0 ==
This routine is approx. 6 times faster than Converted from the OS Mode 1 routine GRA PLOT, because it is dpendent to MODE 1 and doesn't perform range checks. It can draw 10500 pixels per second.by [[User:Executioner|The Executioner]]
'''Input:''' DE = ''X (0..319159)'', HL = ''Y (0..199)''
<pre>
ADD HL, HL ;of the raster line
LD A, E ;Lowbyte X to A SRL D ;calculate X\42, because RR E ;4 2 pixel per byte SRL E ADD HL, DE ;+ HL = ScreenaddressCarry is X MOD 2
LD C, %10001000 10101010 ;Bitmask for MODE 1 AND %00000011 ;A = X MOD 4 JR ZNC, NSHIFT ;-> = 0, no shiftSHIFT SRL LD C , %01010101 ;move other bitmask to for right pixel DEC A ;loop counter JR NZ,SHIFT ;-position
NSHIFT ADD HL, DE ;+ HL = Screenaddress LD A, (CMASK) ;get color mask
XOR (HL) ;XOR screenbyte
AND C ;AND bitmask
== Fast plotting routine for MODE 0 1 ==
Converted from This routine is approx. 6 times faster than the above by [[User:Executioner|The Executioner]]OS routine GRA PLOT, because it is dpendent to MODE 1 and doesn't perform range checks. It can draw 10500 pixels per second.
'''Input:''' DE = ''X (0..159319)'', HL = ''Y (0..199)''
<pre>
ADD HL, HL ;of the raster line
LD A, E ;Lowbyte X to A SRL D ;calculate X\24, because RR E ;2 4 pixel per byte SRL E ADD HL, Carry is X MOD 2DE ;+ HL = Screenaddress
LD C, %10101010 10001000 ;Bitmask for MODE 1 AND %00000011 ;A = X MOD 4 JR NCZ, NSHIFT ;-> = 0, no shiftSHIFT LD SRL C, %01010101 ;other move bitmask for right to pixel DEC A ;loop counter JR NZ,SHIFT ;-position
NSHIFT ADD HL, DE ;+ HL = Screenaddress LD A, (CMASK) ;get color mask
XOR (HL) ;XOR screenbyte
AND C ;AND bitmask