Login
Back to forumSee the full topicGo to last reply

Posted By

Csabo
on 2010-11-11
10:59:59
 Re: Assembly and interrupts: my first attempt. Help needed!

When X and Y contain the coordinates like you said, assuming you need the address on a zeropage vector, this is a pretty fast way of getting the address:

dest	= $C0

start
LDX #15
LDY #15
;
TXA
CLC
ADC screen_address_lo,y
STA dest
LDA screen_address_hi,y
ADC #$00
STA dest+1
;
LDY #$00
LDA #$51
STA (dest),y
;
JMP $f445

screen_address_lo
DB $00,$28,$50,$78,$A0,$C8,$F0,$18,$40,$68,$90,$B8,$E0,$08,$30,$58,$80,$A8,$D0,$F8,$20,$48,$70,$98,$C0
screen_address_hi
DB $0C,$0C,$0C,$0C,$0C,$0C,$0C,$0D,$0D,$0D,$0D,$0D,$0D,$0E,$0E,$0E,$0E,$0E,$0E,$0E,$0F,$0F,$0F,$0F,$0F


Though a faster way would be not to calculate the address at all, but rather have it stored. If you want the characters to move from left to right like you had it in the first demo, you could just store the starting position of the row (e.g. $0C00, $0C28, etc) and store the position of the character within that row as a number which goes from 39 to 0. You already have your pointer (which never changes), you just need to index it with Y.



Back to top


Copyright © Plus/4 World Team, 2001-2024