Re: LZ: Screen Reversing...


[Prev][Next][Index][Thread]

Re: LZ: Screen Reversing...



On Wed, 2 Oct 1996, Frank  wrote:


> I want to add screen reversing to my etch a sketch thing... i have the code 
> from another program but it is uncommented can someone send me a commented 
> version of screen reversing! (pixel on to pixel off and vice versa)


well.. (writing on-line, so prolly not 100% error-free) 


; ------ clippityclippityclip ------------------


	ld d, 4         ; big loop repeat counter
        ld hl, $FC00    ; display mem address into hl
bigloop:
	ld b, 0         ; counter for small loop repeat (256)
looppoop:
	ld a, (hl)      ; a <- byte in (hl)
	neg             ; a=0-a, so all 1->0 and 0->1
	ld (hl), a      ; store the byt back
	inc hl          ; increase the position in display mem
	djnz looppoop   ; decrease 
	dec d           ; decrease big loop counter (big loop needed, so 
                        ; all the 1024 bytes of dispmem will be handled
	jnz bigloop     ; and if 0 not reached, then jump


; ------ clippityclippityclippyclippy ----------


That oughta do the trick... (not optimized, prolly could a bit, but I 
won't bother...)


   -P


References: