Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define NULL $00
- define BUFFMAX $FF
- define CPOSL $DD
- define CPOSH $DE
- define SPRX $A0
- define SPRY $B0
- ; Code
- START: LDA #00 ; Entry point
- STA SPRX
- LDA #02
- STA SPRY
- DRAWL: LDA SPRX ; Load sprite coords
- PHA ;
- LDA SPRY ;
- PHA
- JSR spSTART ; Draw sprite
- JSR CLRSCR
- INC SPRX
- JMP DRAWL
- spSTART:PLA ; Setup for RTS
- TAX
- PLA
- TAY
- PLA ; Cursor pos MSB
- STA CPOSH ; Write MSB
- PLA ; Cursor pos LSB
- STA CPOSL ; Write LSB
- TYA ; Load return address
- PHA
- TXA
- PHA
- LDA #00 ; Initalize Registers
- LDX #00
- LDY #00
- spLOOP: LDA spr_arrow, X ; Load pixel
- CMP #BUFFMAX ; Is last byte?
- BEQ spSPREND ; Exit routine
- STA (CPOSL),Y ; Write pixel to screen
- INX ; Next pixel
- INY ; Move cursor right
- CMP #NULL ; Is last pixel in row?
- BNE spLOOP ; Read next pixel in row
- spLINE: LDA CPOSL ; Load cursor pos LSB
- LDY #00 ; Reset cursor X
- CLC ; AdjustAfterAddition?
- ADC #32 ; New line
- STA CPOSL ; Write cursor pos LSB
- BCS spLINE16 ; Check if adjust
- JMP spLOOP ; Next pixel
- spLINE16: LDA CPOSH ; Load cursor pos MSB
- INC A ; Add one
- STA CPOSH ; Write cursor pos MSB
- JMP spLOOP ; Next pixel
- spSPREND: RTS ; Breakpoint
- CLRSCR: LDX #00
- LDA #00
- clrLOOP: STA $0200,X
- INX
- CPX #$FF
- BNE clrLOOP
- RTS
- ; Data
- spr_arrow:
- DCB $11,$11,$11,$11,$11,$00
- DCB $11,$05,$05,$05,$05,$11,$00
- DCB $11,$05,$05,$05,$05,$05,$11,$00
- DCB $11,$05,$05,$05,$05,$05,$05,$11,$00
- DCB $11,$05,$05,$05,$05,$05,$11,$00
- DCB $11,$05,$05,$05,$05,$11,$00
- DCB $11,$11,$11,$11,$11,$00,$FF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement