;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; ; ; ; Pixel Example ; ; ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; ; This example shows how to use the SmallPixel routine. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; ; by pacHa ^ E-mail [pacHa-@wanadoo.fr] ; ; [some_asm@hotmail.com] ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; ; Controls : arrows - move ; ; [(left)] + [(right)] - quit ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; .include acebeta.inc .db "Pixel example",0 #define use_set_and_draw CALL CLEARLCD ; clear the screen pixX = SH_BUF ; define the 2 coordinates of the point pixY = SH_BUF + 1 ; ld hl,pixX ; initialize the coordinates ld (hl),48 ; inc hl ; ld (hl),32 ; (48,32) ;call SetDrawPixel ; initialize the routine to draw. (Not needed cause it's default) loop: ld hl,pixY ; get the coordinates ld a,(hl) ld e,a dec hl ld a,(hl) call SmallPixel ; and draw the pixel in GRAPH_MEM call CR_GRBCopy ; copy the memory to the screen ld a,$fe ; check for keys out (1),a in a,(1) bit 0,a jr z,down bit 1,a jr z,left bit 2,a jr z,right bit 3,a jr z,up jr loop ; loop again down: ld a,(pixY) cp 63 jr z,loop inc a ld (pixY),a jr loop left: bit 2,a ; is [(right)] down ? ret z ; if it is, quit ld a,(pixX) or a jr z,loop dec a ld (pixX),a jr loop right: bit 1,a ; is [(left)] down ? ret z ; if it is, quit ld a,(pixX) cp 95 jr z,loop inc a ld (pixX),a jr loop up: ld a,(pixY) or a jr z,loop dec a ld (pixY),a jr loop #include "Spixel.inc" ; needed to be able to call SmallPixel