I've written a small piece of code (add.asm, shown below) in 6502 assembly but are having some problems to get it to run correctly on an apple ii emulator. Using the config file below, and ca65 and ld65, I can get a binary to compile.
Then, using ciderpress, I can put this onto a disk image. However, this is where my problems start. When I edit the file's attributes, making it a binary, Ciderpress changes something called "aux Type (hex)" to D818. I'm unsure why this is (changing this to 6000, where I have said the ram starts in my ld65 config file does not fix the issues I am about to describe).
In Ciderpress, I can view the file add which I have just added to the disk image. It says it starts at location "D818". However, it does not include every line up to "STA ADR1", which is over halfway through the program. When I run this on an appleii emulator the behaviour of the program confirms that only the second half of the code seems to exist.
Can anyone please help me understand what is going on?
add.asm:
CLC ; CLEAR CARRY BIT
CLD ; CLEAR DECIMAL BIT
ADR1 = $6100
ADR2 = $6101
ADR3 = $6102
LDA #01
STA ADR1
LDA #02
STA ADR2
LDA ADR1 ; LOAD CONTENTS OF ADR1 INTO ACCUMULATOR
ADC ADR2 ; ADD CONTENTS OF ADR2 INTO ACCUMULATOR
STA ADR3 ; TRANSFER CONTENT OF ACC TO ADR3
RTS
apple.cfg:
MEMORY {
RAM: start = $6000, size = $8E00, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = ro;
DATA: load = RAM, type = rw;
}