Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Compile this with:
- ; spasm <blah>.z80 <blah>.8xp -I path/to/Z80-Optimized-Routines
- ; Z80-Optimized-Routines can be found at https://github.com/Zeda/Z80-Optimized-Routines
- ;
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ; Define some vars
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- plotSScreen = 9340h ; a.k.a. the graph screen
- gbuf = plotSScreen ; using plotSScreen as our gbuf
- #define spritetmp 8000h ; needed for the bigsprite routine. 8000h has 256 bytes of scrap ram, we use 4
- #define db .db ; syntax comaptibility
- #define dw .dw ; syntax comaptibility
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ; TI Program header
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- .db $BB, $6D
- .org $9D95
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ; clear the gbuf
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ld hl,gbuf
- xor a ; shortcut to set A to 0
- ld b,a ; now B is 0, but because we are DJNZing, this is basically 256
- clr_loop:
- ld (hl),a
- inc hl
- ld (hl),a
- inc hl
- ld (hl),a
- inc hl
- djnz clr_loop
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ; Loop and draw pixels from (32,32), (31,31) ... (1,1)
- ; Note: this doesn't draw at (0,0)
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ld b,32
- pix_loop:
- push bc
- ld c,b
- call pixelOn
- pop bc
- djnz pix_loop
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ; now draw an XORed sprite at (x,y) = (11, 22) and (90, 47)
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ld bc,11*256 + 22
- call putsprite
- ld bc,90*256 + 47
- call putsprite
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ; finally, copy the gbuf to the LCD
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- jp gbuf_to_lcd_6MHz
- putsprite:
- ; (B,C) is the (X,Y) coordinate of the sprite
- ld hl, 0808h ; (H,L) = (height, width)
- ld de,sprite ; pointer to the sprite
- jp bigsprite_XOR
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ; This is a common subroutine that is required for the bigsprite routines.
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- call_ix:
- jp (ix)
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ; Our sprite data
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- sprite:
- .db %00111100
- .db %01000010
- .db %10000001
- .db %10000001
- .db %10000001
- .db %10000001
- .db %01000010
- .db %00111100
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- ; Includes
- ;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;:;;
- #include "ti8x/gfx/getpixelloc_0x9340.z80"
- #include "ti8x/gfx/pixelOn.z80"
- ;#include "ti8x/gfx/pixelOff.z80"
- ;#include "ti8x/gfx/pixelToggle.z80"
- #include "ti8x/gfx/bigsprite_XOR.z80"
- #include "ti8x/gfx/gbuf_to_lcd_6MHz.z80"
Add Comment
Please, Sign In to add comment