A2osX/BIN/CC.S.CODE.txt

302 lines
5.1 KiB
Plaintext
Raw Normal View History

NEW
AUTO 3,1
2022-06-12 20:42:22 +00:00
*--------------------------------------
CODE.Init stz ZPCCConst
stz ZPCCConst+1
2022-08-20 14:37:37 +00:00
stz bInitCode
2022-06-12 20:42:22 +00:00
>LDYAI PCC.FH.CS
>STYA ZPCCCode
2022-08-20 14:37:37 +00:00
2022-06-12 20:42:22 +00:00
>LDYAI 20 char *ARGV[10]
>STYA ZPCCData
2022-08-20 14:37:37 +00:00
lda #'_'
>STA.G CC.CPSPFX+1
lda #'A'
>STA.G CC.CPSID
iny CC.CPSID+1
sta (pData),y
2022-06-12 20:42:22 +00:00
clc
.9 rts
*--------------------------------------
CODE.Quit >LDA.G CC.hOutFile
beq .8
2022-08-20 14:37:37 +00:00
2022-06-12 20:42:22 +00:00
>SYSCALL FClose
.8 clc
rts
*--------------------------------------
2022-01-30 21:47:08 +00:00
CODE.nAddLocal eor #$FF
inc
2022-08-20 14:37:37 +00:00
CODE.AddLocal jsr CODE.LDAI
bcs .9
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.ADDLOCAL
jmp CODE.EmitPCC
2022-01-30 21:47:08 +00:00
2022-08-20 14:37:37 +00:00
.9 rts
2022-01-30 21:47:08 +00:00
*--------------------------------------
CODE.SetRetValue
jsr CODE.LDXI
2022-06-12 20:42:22 +00:00
bcs .9
2022-08-20 14:37:37 +00:00
>LDYA L.PCC.SetRetValue
jmp CODE.EmitPCC
2022-06-12 20:42:22 +00:00
2022-08-20 14:37:37 +00:00
.9 rts
*--------------------------------------
CODE.PUSHAXI pha
txa
jsr CODE.PUSHI
bcs CODE.LDAXI.RTS
2022-06-12 20:42:22 +00:00
2022-08-20 14:37:37 +00:00
pla
2022-06-12 20:42:22 +00:00
*--------------------------------------
CODE.PUSHI pha
lda #$A9 LDA #imm
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs CODE.LDAXI.RTS
pla
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs CODE.LDAXI.RTS
bra CODE.PUSHA
*--------------------------------------
2022-01-30 21:47:08 +00:00
CODE.LDYAI pha
lda #$A0 LDY #imm
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs CODE.LDAXI.RTS
tya
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs CODE.LDAXI.RTS
lda #$A9 LDA #imm
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs CODE.LDAXI.RTS
pla
2022-01-30 21:47:08 +00:00
jmp CODE.EmitByte
*--------------------------------------
2022-08-20 14:37:37 +00:00
CODE.LDAXI jsr CODE.LDAI
bcc CODE.LDXI
CODE.LDAXI.RTS rts
*--------------------------------------
CODE.LDYI lda #$A0 LDY #imm
jsr CODE.EmitByte
bcs .9
tya
jmp CODE.EmitByte
.9 rts
*--------------------------------------
2022-01-30 21:47:08 +00:00
CODE.LDXI lda #$A2 LDX #imm
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs .9
2022-01-30 21:47:08 +00:00
txa
jmp CODE.EmitByte
2022-08-20 14:37:37 +00:00
.9 rts
2022-01-30 21:47:08 +00:00
*--------------------------------------
CODE.LDAI pha
lda #$A9 LDA #imm
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs .9
2022-01-30 21:47:08 +00:00
pla
jmp CODE.EmitByte
2022-08-20 14:37:37 +00:00
.9 plx
rts
*--------------------------------------
CODE.PUSHYA jsr CODE.PUSHA
2022-08-20 14:37:37 +00:00
lda #$98 TYA
jsr CODE.EmitByte
*--------------------------------------
CODE.PUSHA lda #$C6 DEC zp
jsr CODE.EmitByte
lda #pStack
jsr CODE.EmitByte
2022-01-30 21:47:08 +00:00
lda #$92 STA (zp)
jsr CODE.EmitByte
lda #pStack
jmp CODE.EmitByte
*--------------------------------------
CODE.PULLYA jsr CODE.PULLA
lda #$48 PHA
jsr CODE.EmitByte
jsr CODE.PULLA
lda #$7A PLY
bra CODE.EmitByte
*--------------------------------------
CODE.PULLA lda #$B2 LDA (zp)
jsr CODE.EmitByte
lda #pStack
jsr CODE.EmitByte
*--------------------------------------
CODE.INCPSTACK lda #$E6 INC zp
jsr CODE.EmitByte
lda #pStack
bra CODE.EmitByte
*--------------------------------------
2022-01-30 21:47:08 +00:00
CODE.TOABSYX jsr CODE.EmitByte A=opcode : JMP, JSR .....
txa
2022-01-30 21:47:08 +00:00
jsr CODE.EmitByte
tya
bra CODE.EmitByte
*--------------------------------------
2022-08-20 14:37:37 +00:00
CODE.SYSCALL jsr CODE.LDXI
bcs .9
lda #$20 JSR
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs .9
2022-06-12 20:42:22 +00:00
lda #A2osX.SYSCALL
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs .9
2022-06-12 20:42:22 +00:00
lda /A2osX.SYSCALL
bra CODE.EmitByte
2022-08-20 14:37:37 +00:00
.9 rts
*--------------------------------------
2022-08-20 14:37:37 +00:00
CODE.FPUCALL jsr CODE.LDXI
bcs .9
lda #$20 JSR
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs .9
2022-06-12 20:42:22 +00:00
lda #A2osX.FPUCALL
jsr CODE.EmitByte
2022-08-20 14:37:37 +00:00
bcs .9
2022-06-12 20:42:22 +00:00
lda /A2osX.FPUCALL
bra CODE.EmitByte
2022-08-20 14:37:37 +00:00
.9 rts
*--------------------------------------
CODE.DEBUG >LDYA L.PCC.DEBUG
*--------------------------------------
CODE.EmitPCC >STYA ZPLookupPtr
lda (ZPLookupPtr)
tax
dex
ldy #1
.1 lda (ZPLookupPtr),y
jsr CODE.EmitByte
bcs .9
iny
dex
bne .1
.9 rts
*--------------------------------------
2022-06-12 20:42:22 +00:00
CODE.EmitByte clc if Pass 1...
bit bPass2
bpl .1
phx
phy
tax
2022-08-20 14:37:37 +00:00
2022-06-12 20:42:22 +00:00
>PUSHB.G CC.hOutFile
txa
>PUSHA
>SYSCALL fputc
2022-08-20 14:37:37 +00:00
2022-06-12 20:42:22 +00:00
ply
plx
.1 inc ZPCCCode
bne .8
inc ZPCCCode+1
2022-06-12 20:42:22 +00:00
.8 rts CC/CS from fputc
*--------------------------------------
CODE.EmitDATA clc
bit bPass2
bpl .1
phx
phy
tax
2022-08-20 14:37:37 +00:00
2022-06-12 20:42:22 +00:00
>PUSHB.G CC.hOutFile
txa
>PUSHA
>SYSCALL fputc
ply
plx
.1 inc ZPCCConst
bne .8
inc ZPCCConst+1
.8 rts CC/CS from fputc
*--------------------------------------
CODE.CSSelect clc
bit bPass2
bpl .8
2022-08-20 14:37:37 +00:00
2022-06-12 20:42:22 +00:00
>PUSHB.G CC.hOutFile
2022-08-20 14:37:37 +00:00
>PUSHWZ
2022-06-12 20:42:22 +00:00
lda ZPCCCode+1
sec
sbc #$20
>PUSHA
lda ZPCCCode
>PUSHA
>PUSHBI SEEK.SET
>SYSCALL fseek
.8 rts
*--------------------------------------
CODE.DSSelect clc
bit bPass2
bpl .8
>PUSHB.G CC.hOutFile
2022-08-20 14:37:37 +00:00
>PUSHWZ
2022-06-12 20:42:22 +00:00
lda ZPCCConst
clc
adc PCC.FH+PCC.FH.IDATA
tay
lda ZPCCConst+1
adc PCC.FH+PCC.FH.IDATA+1
sec
sbc #$20
2022-06-22 06:26:44 +00:00
2022-06-12 20:42:22 +00:00
>PUSHYA
>PUSHBI SEEK.SET
>SYSCALL fseek
.8 rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.code
LOAD usr/src/bin/cc.s
ASM