tag:blogger.com,1999:blog-17487316.post2438464056754782343..comments2024-01-13T09:14:12.131+00:00Comments on The life of a Games Programmer: 65816: Cool bitmap stuff...Mikehttp://www.blogger.com/profile/15958965170878448339noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-17487316.post-17626625122489744872008-02-15T12:22:00.000+00:002008-02-15T12:22:00.000+00:00If you want the maximum possible speed out of your...If you want the maximum possible speed out of your blitting loop, you can remap both the direct page and stack pointer and use the PEI instructions to move 16-bits worth of data in only 6 cycles. I don't know the details of your machine, but it may be implemented like this:<BR/><BR/>DoChar macro <BR/> lda charScr+\0 ; get character<BR/> and #$3ff<BR/> asl<BR/> asl<BR/> asl<BR/> ora #$8006 ; OK, since bottom 3 bits are zero<BR/> tcd ; DP=Character address<BR/> pei $06<BR/> pei $04<BR/> pei $02<BR/> pei $00<BR/> endm<BR/><BR/> ; Actual loop....<BR/> <BR/> phd<BR/> lda #31<BR/> sei ; disable interrupts!<BR/> tsc<BR/> sta stkSave<BR/><BR/> lda #$4000+8*32<BR/> tcs<BR/> ldx #loopCount<BR/>BlitLoop:<BR/> DoChar 62<BR/> DoChar 60<BR/> ;<BR/> ; etc..., must draw in reverse order<BR/> ; because of stack mapping<BR/> DoChar 2<BR/> DoChar 0<BR/> <BR/> tsc<BR/> clc<BR/> adc #$200<BR/> tcs<BR/> <BR/> dex<BR/> bne BlipLoop<BR/><BR/> lda stkSave<BR/> tcs<BR/> cliAnonymousnoreply@blogger.com