; [ SmallPixel ] [ 57 bytes including the 2 subroutines ] [ AFBCDEHL ] ; by pacHa [ pacHa-@wanadoo.fr ] ; [ some_asm@hotmail.com ] ; ; You can of course use this routine in your own productions, as long ; as you give me credit for my work. ; ; Do not hesitate to e-mail me for bugs, suggestions or comments. ; ; Input : (a,e) as coordinates (from (0,0) to (95,63)) ; The routine has to have been set to draw or ; erase pixel (default is draw). ; Output : The pixel is drawn in GRAPH_MEM. ; de = GRAPH_MEM ; Don't forget to put a line "#define use_set_and_draw" if you want to use the ; subroutines to set the routine to draw or erase pixel. ; old version : 341-439 clock cycles for drawing AND ersasing pixel ; 70 bytes (including the 2 subroutines) ; new version : 206-318 clock cycles for drawing and erasing pixel ; 57 bytes (43+7+7) ; (43 bytes) SmallPixel: ; clocks ld hl,0 ; 10 ld d,0 ; 7 add hl,de ; 11 add hl,de ; 11 add hl,de ; 11 add hl,hl ; 15 add hl,hl ; 15 ld e,a ; 4 srl e ; 8 srl e ; 8 srl e ; 8 add hl,de ; 11 ld de,GRAPH_MEM ; 10 add hl,de ; 11 and %00000111 ; 7 or a ; 4 jp z,SP_no_rotate ; 10/1 ld b,a ; 4 ld a,%10000000 ; 7 SP_loop_rotate: rra ; 4 djnz SP_loop_rotate ; 13/8 SP_end: ;cpl ; 4 \ Erase pixel ;and (hl) ; 7 / nop ; 4 \ Draw pixel (default) or (hl) ; 7 / ld (hl),a ; 7 ret ; 10 SP_no_rotate: ld a,%10000000 ; 7 jp SP_end ; 10 ; TOTAL CLOCKS : 209/321 #ifdef use_set_and_draw ; [ SetDrawPixel ] [ HL ] [ 36 clocks ] [ 7 bytes ] ; Input : none ; Output : the SmallPixel routine is set to _DRAW_ pixel SetDrawPixel: ld hl,$b600 ; 10 ; nop \ or (hl) ld (SP_end),hl ; 16 ret ; 10 ; [ SetErasePixel ] [ HL ] [ 36 clocks ] [ 7 bytes ] ; Input : none ; Output : the SmallPixel routine is set to _ERASE_ pixel SetErasePixel: ld hl,$a62f ; 10 ; cpl \ and (hl) ld (SP_end),hl ; 16 ret ; 10 #endif