I learn now KickAss assembler for C64, but i'm never learnd any asm or 8 bit computing before. I want to print big ascii banner (numbers). I want to store the "$0400" address in the memory and when i'm increased the line number i need to increase it by 36 (because the sceen is 40 char width so i want to jump ti next line), but my problem is this is a 2 byte number so i can't just add to it. This demo is works "fine" except the line increasing because i dont know that.
So what i'm need:
- How can i store a 2 byte memory address in a memory?
- How can i increase the memory address and store back (2 byte)?
- How can i store a value to the new address (2 byte and index registers is just one)?
Thx a lot guys!
BasicUpstart2(main)
*=$1000
currentLine:
.byte 00
main:
printNumber(num5)
rts
num5: .byte $E0, $E0, $E0, $E0, $00 // XXXX(null)
.byte $E0, $20, $20, $20, $00 // X (null)
.byte $E0, $20, $20, $20, $00 // X (null)
.byte $E0, $E0, $E0, $E0, $00 // XXXX(null)
.byte $20, $20, $20, $E0, $00 // X(null)
.byte $20, $20, $20, $E0, $00 // X(null)
.byte $E0, $E0, $E0, $E0, $00 // XXXX(null)
.macro printNumber(numberLabel)
{
ldx #0
lda #0
lda #0
loop:
lda numberLabel,x
beq checkNextline
sta $0400,x
inx
jmp loop
checkNextline:
inx
inc currentLine
lda currentLine
cmp #7
beq done
jmp loop
done:
}
// Expected output:
XXXX
X
X
XXXX
X
X
XXXX
// Current output:
XXXXX X XXXX X XXXXX
(where the X is the $E0 petscii char)
adc
will add the value of the operand, plus 1 if the carry flag is set. – Michael