So I'm tinkering around and compiling MS BASIC for different platforms.
https://github.com/mist64/msbasichttp://www.pagetable.com/?p=46When I get to the Apple platform, I get an error. (using ca65)
Code:
.out .sprintf("%s", "inline.s")
.out .sprintf(" INPUTBUFFER: %d", INPUTBUFFER)
INLIN:
.ifdef APPLE
ldx #$DD
INLIN1:
stx $33
jsr L2900
cpx #$EF
bcs L0C32
ldx #$EF
L0C32:
lda #$00
sta INPUTBUFFER,x
ldx #<INPUTBUFFER-1
ldy #>INPUTBUFFER-1
rts
.endif
The output is:
Code:
inline.s
INPUTBUFFER: 512
INPUTBUFFER-1: 511
inline.s(38): Error: Range error (-1 not in [0..255])
In my "defines_apple.s" I have:
Code:
; inputbuffer
INPUTBUFFER := $0200
So since $0200 = 512 decimal, this should be OK. But from the error you can see it is not.
In a previous attempt, I would just add " + 256" to the problem to fix the "-1" error. But I don't really think that is a fix.
I get how +256 causes the value to roll over. But, *WHY* is that needed?
I guess where I'm confused is why it was done like that at all. I wonder how much of that source code is actually from Microsoft vs. a de-compile of a ROM file.
Any information is appreciated.