0 Members and 1 Guest are viewing this topic.
LD HL,15*12+1+plotSScreen ; this is a constant value LD A,(HL) ; get the pixels already there OR %01000000 ; flip only that particular bit (pixel) LD (HL),A ; store it back BCALL(_GrfBufCpy) ; display to screen
Also, I'd recommend trying to think up ways to make it work without doing one pixel at a time. You can do up to 8 pixels at once, and it's a lot faster. Use it to your advantage.
;===============================DrawPixel;===============================;Inputs:; A is the drawing method:; 0=Pixel Off; 1=Pixel On; All else=Pixel Invert; B is the X coordinate; C is the Y coordinate;=============================== push af ;F5 call GetPixelLoc ;CD**** pop bc ;C1 inc b ;04 djnz PixelOn ;1004;Pixel Off cpl ;2F Inverts A and (hl) ;A6 ld (hl),a ;77 ret ;C9 djnz PixelInvert ;1003PixelOn: or (hl) ;B6 ld (hl),a ;77 ret ;C9PixelInvert: xor (hl) ;AE ld (hl),a ;77 ret ;C9;===============================GetPixelLoc:;===============================;Inputs:; B is X coordinate; C is Y coordinate;Outputs:; HL points to the byte in plotSScreen; A is the mask; B is 0; C is unchanged; DE is C*12 (also BC*12);=============================== ld a,b ;78 ld b,0 ;0600 ld h,b ;60 ld l,c ;69 add hl,hl ;29 add hl,bc ;09 add hl,hl ;29 add hl,hl ;29 ld b,a ;47 ld d,h ;54 ld e,l ;5D rrca ;0F rrca ;0F rrca ;0F and 1Fh ;E61F add 40h ;C640 ld l,a ;6F ld h,93h ;2693 add hl,de ;19 ld a,b ;78 and 7 ;E607 ld b,a ;47 inc b ;04 ld a,1 ;3E01Loop: rrca ;0F djnz Loop ;10FD ret ;C9