[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bored at work....
OK OK. If you want to save some cycles, begin from the last line and DEX BPL VERTLOOP.
Another option would still be the use of absolute addressing: the idea is to:
LDX £0
VERTLOOP
LDA THI,X
ORA $E6 ; another trick for fun, PAGE1 or PAGE2 ???
STA HORZLOOP2+2
STA HORZLOOP+2
LDA TLO,X
STA HORZLOOP2+1
ORA £1
STA HORZLOOP+1
LDY £0
HORZLOOP
LDA $2001,y
HORZLOOP2
STA $2000,y
INY
CPY £40
BNE HORZLOOP
DEX
BPL HORZLOOP
RTS ; just for fun ;-)
I think you will save some cycles.
####
I thought you would have used a screen buffer of 40*20/24 (depending on the size of your tiles) and scroll that buffer internally and then refresh on screen what was necessary by comparing the buffer before scrolling and the new buffer.
Let's try some algorithm:
oldMAPBUFFER <= currentMAPBUFFER
scrollLEFT(currentMAPBUFFER)
for y=0 to 23
for x=0 to 39
if currentMAPBUFFER(x, y) =! oldMAPBUFFER(x, y)
drawTILEONSCREEN(currentMAPBUFFER(x, y))
next x
next y
RTS ; for fun ;-)
Antoine