mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 05:32:20 +00:00
34f9969c0c
BASIC.FX: bugfix in PATH, relocation code, Added Toolbox function "printf"
190 lines
3.4 KiB
Plaintext
190 lines
3.4 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
* GP.FIAUXTYPE = ORG
|
||
* GP.MLIRW.DATAPTR = new ORG
|
||
*--------------------------------------
|
||
BSX.RelOfs .BS 2
|
||
BSX.RelStart .BS 2
|
||
BSX.RelEnd .BS 2
|
||
BSX.RelStop .BS 2
|
||
*--------------------------------------
|
||
BSX.Rel lda GP.MLIRW.DATAPTR
|
||
sta ZP.A1L
|
||
sec
|
||
sbc GP.FIAUXTYPE
|
||
sta BSX.RelOfs
|
||
|
||
lda GP.MLIRW.DATAPTR+1
|
||
sta ZP.A1L+1
|
||
sbc GP.FIAUXTYPE+1
|
||
sta BSX.RelOfs+1
|
||
|
||
lda GP.FIAUXTYPE
|
||
sta BSX.RelStart
|
||
lda GP.FIAUXTYPE+1
|
||
sta BSX.RelStart+1
|
||
|
||
ldy #10
|
||
lda (ZP.A1L),y
|
||
sta BSX.RelEnd
|
||
iny
|
||
lda (ZP.A1L),y
|
||
sta BSX.RelEnd+1
|
||
|
||
ldy #8
|
||
lda (ZP.A1L),y
|
||
clc
|
||
adc BSX.RelOfs
|
||
sta BSX.RelStop
|
||
iny
|
||
lda (ZP.A1L),y
|
||
adc BSX.RelOfs+1
|
||
sta BSX.RelStop+1
|
||
|
||
ldy #4
|
||
lda (ZP.A1L),y
|
||
sta GP.AllowedBITS
|
||
iny
|
||
lda (ZP.A1L),y
|
||
sta GP.AllowedBITS+1
|
||
|
||
ldy #2
|
||
jsr BSX.RelAtA1Y relocate CLD JMP CODE.START
|
||
|
||
lda #16 skip header
|
||
jsr BSX.RelSkipA
|
||
|
||
.1 ldy #1
|
||
lda (ZP.A1L),y
|
||
ora (ZP.A1L)
|
||
beq .20
|
||
|
||
dey ldy #0
|
||
|
||
jsr BSX.RelAtA1Y
|
||
lda #2
|
||
jsr BSX.RelSkipA
|
||
bra .1
|
||
|
||
.20 lda #2
|
||
jsr BSX.RelSkipA
|
||
|
||
.2 lda (ZP.A1L)
|
||
lsr
|
||
tax
|
||
lda BSX.65R02,x
|
||
bcs .3
|
||
|
||
lsr
|
||
lsr
|
||
lsr
|
||
lsr
|
||
|
||
.3 and #$0f
|
||
bit #$08
|
||
beq .7
|
||
|
||
and #$07
|
||
pha
|
||
|
||
ldy #1
|
||
jsr BSX.RelAtA1Y
|
||
|
||
lda (ZP.A1L)
|
||
cmp #$20 JSR
|
||
bne .6
|
||
|
||
ldy #1
|
||
lda (ZP.A1L),y
|
||
bne .6
|
||
|
||
iny
|
||
lda (ZP.A1L),y
|
||
cmp #$BF jsr $BF00 ?
|
||
bne .6
|
||
|
||
pla
|
||
lda #6
|
||
pha
|
||
|
||
.6 pla
|
||
|
||
.7 clc
|
||
adc ZP.A1L
|
||
sta ZP.A1L
|
||
bcc .8
|
||
|
||
inc ZP.A1L+1
|
||
|
||
.8 cmp BSX.RelStop
|
||
lda ZP.A1L+1
|
||
sbc BSX.RelStop+1
|
||
bcc .2
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
BSX.RelAtA1Y lda (ZP.A1L),y
|
||
tax
|
||
iny
|
||
|
||
cpx BSX.RelStart
|
||
lda (ZP.A1L),y
|
||
sbc BSX.RelStart+1
|
||
|
||
bcc .9
|
||
|
||
cpx BSX.RelEnd
|
||
lda (ZP.A1L),y
|
||
sbc BSX.RelEnd+1
|
||
bcs .9
|
||
|
||
dey
|
||
lda (ZP.A1L),y
|
||
clc
|
||
adc BSX.RelOfs
|
||
sta (ZP.A1L),y
|
||
iny
|
||
lda (ZP.A1L),y
|
||
adc BSX.RelOfs+1
|
||
sta (ZP.A1L),y
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
BSX.RelSkipA clc
|
||
adc ZP.A1L
|
||
sta ZP.A1L
|
||
bcc .8
|
||
|
||
inc ZP.A1L+1
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
* 65R02 OPCODES
|
||
*--------------------------------------
|
||
* 0.1.2.3.4.5.6.7.8.9.A.B.C.D.E.F
|
||
BSX.65R02 .HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
||
.HS B.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
||
.HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
|
||
.HS 1.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.B.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.2.1.1.B.B.B.3
|
||
.HS 2.2.2.1.2.2.2.2.1.B.1.1.1.B.B.3
|
||
*--------------------------------------
|
||
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/basic.fx/basic.s.xr
|
||
LOAD usr/src/basic.fx/basic.s
|
||
ASM
|