Created
July 29, 2019 23:49
-
-
Save blondie7575/de953b637041c775636a7fef602384ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;; | |
; graphicsVramWriteBlock | |
; PARAM1 : Destination VRAM address in F18A, high 2 bits must be 01 | |
; PARAM2 : Source address in main RAM, must be page-aligned | |
; PARAM3 : Number of bytes to copy | |
; | |
; Write data to F18A's VRAM | |
; | |
; Trashes PARAM2 | |
; | |
graphicsVramWriteBlock: | |
SAVE_AXY | |
; Set up F18A address register | |
lda PARAM1_L | |
sta F18AREG1 | |
lda PARAM1_H | |
sta F18AREG1 | |
ldy #0 | |
ldx PARAM3_H | |
graphicsVramWriteBlockLoop: | |
lda (PARAM2_L),y | |
sta F18AREG0 | |
iny | |
cpy PARAM3_L | |
beq graphicsVramWriteBlockLoopLowDone | |
graphicsVramWriteBlockLoopCont: | |
cpy #0 | |
bne graphicsVramWriteBlockLoop | |
; Finished 256 byte page, so wrap to next one | |
dex | |
inc PARAM2_H ; Advance source pointer in RAM to next page | |
jmp graphicsVramWriteBlockLoop | |
graphicsVramWriteBlockLoopLowDone: | |
; Low byte of counter matched | |
cpx #0 ; If high counter is finished, so are we | |
bne graphicsVramWriteBlockLoopCont | |
graphicsVramWriteBlockDone: | |
RESTORE_AXY | |
rts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment