mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 07:54:37 +00:00
213 lines
3.5 KiB
Plaintext
213 lines
3.5 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
CP.RUN bcs .1 > A6
|
||
|
||
>LDYA J.KEYWORDS,x
|
||
clc
|
||
jmp EmitJsrYA
|
||
|
||
.1 jmp (J.CP-$A4,x)
|
||
*--------------------------------------
|
||
CP.ACODE
|
||
*--------------------------------------
|
||
CP.FCODE
|
||
*--------------------------------------
|
||
CP.DO
|
||
*--------------------------------------
|
||
CP.LOOP
|
||
*--------------------------------------
|
||
CP.pLOOP
|
||
*--------------------------------------
|
||
CP.I
|
||
*--------------------------------------
|
||
CP.LEAVE
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CP.IF jsr EmitTestTRUE
|
||
|
||
jsr EmitPendingJMP to put jmp -> ELSE/ENDIF later
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CP.ELSE jsr CP.PopPtr1 get previous JMP -> ptr1
|
||
|
||
jsr EmitPendingJMP to put jmp -> ENDIF later
|
||
|
||
jsr CP.UpdatePtr1
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CP.ENDIF jsr CP.PopPtr1
|
||
|
||
jsr CP.UpdatePtr1
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CP.BEGIN jsr CP.PushCodePtr
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CP.UNTIL jsr EmitTestFALSE
|
||
|
||
jsr CP.EmitJMPBack
|
||
|
||
jsr CP.EmitPop2
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CP.REPEAT jsr CP.EmitJMPBack
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CP.WHILE jsr EmitTestTRUE
|
||
|
||
jsr CP.EmitJMPBack
|
||
|
||
jsr CP.EmitPop2
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CP.PushCodePtr ldy RP
|
||
|
||
lda ZPCodePtr+1
|
||
sta (pData),y
|
||
dey
|
||
|
||
lda ZPCodePtr
|
||
sta (pData),y
|
||
dey
|
||
|
||
sty RP
|
||
rts
|
||
*--------------------------------------
|
||
CP.EmitJMPBack lda #$4C JMP
|
||
jsr EmitByte
|
||
|
||
ldy RP
|
||
iny
|
||
lda (pData),y
|
||
jsr EmitByte
|
||
|
||
iny
|
||
lda (pData),y
|
||
jmp EmitByte
|
||
*--------------------------------------
|
||
CP.EmitPop2 ldy RP
|
||
|
||
iny
|
||
iny
|
||
sty RP
|
||
|
||
rts
|
||
*--------------------------------------
|
||
CP.PopPtr1 ldy RP
|
||
iny
|
||
lda (pData),y
|
||
sta ZPPtr1
|
||
|
||
iny
|
||
lda (pData),y
|
||
sta ZPPtr1+1
|
||
|
||
sty RP
|
||
|
||
rts
|
||
*--------------------------------------
|
||
CP.UpdatePtr1 lda ZPCodePtr
|
||
sta (ZPPtr1)
|
||
|
||
ldy #1
|
||
lda ZPCodePtr+1
|
||
sta (ZPPtr1),y
|
||
rts
|
||
*--------------------------------------
|
||
EmitPendingJMP lda #$4C JMP
|
||
jsr EmitByte
|
||
|
||
jsr CP.PushCodePtr
|
||
|
||
lda #0
|
||
jsr EmitByte
|
||
jsr EmitByte
|
||
|
||
rts
|
||
*--------------------------------------
|
||
EmitTestTRUE ldx #$10 BPL
|
||
bra EmitTest
|
||
|
||
EmitTestFALSE ldx #$30 BMI
|
||
|
||
EmitTest jsr EmitPullA
|
||
jsr EmitPullA
|
||
|
||
lda #$AA TAX
|
||
jsr EmitByte
|
||
|
||
txa
|
||
jsr EmitByte
|
||
|
||
lda #3 skip JMP abs
|
||
jsr EmitByte
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
EmitPullA lda #$B2 lda (zp)
|
||
jsr EmitByte
|
||
|
||
lda #pStack
|
||
jsr EmitByte
|
||
|
||
lda #$E6 inc zp
|
||
jsr EmitByte
|
||
|
||
lda #pStack
|
||
bra EmitByte
|
||
*--------------------------------------
|
||
EmitPushA pha
|
||
lda #$A9 LDA imm
|
||
jsr EmitByte
|
||
|
||
pla
|
||
jsr EmitByte
|
||
|
||
lda #$C6 DEC zp
|
||
jsr EmitByte
|
||
|
||
lda #pStack
|
||
jsr EmitByte
|
||
|
||
lda #$92 STA (zp)
|
||
jsr EmitByte
|
||
|
||
lda #pStack
|
||
bra EmitByte
|
||
*--------------------------------------
|
||
EmitJsrYA pha
|
||
lda #$20
|
||
jsr EmitByte
|
||
tya
|
||
jsr EmitByte
|
||
pla
|
||
*--------------------------------------
|
||
EmitByte sta (ZPCodePtr)
|
||
inc ZPCodePtr
|
||
bne .8
|
||
inc ZPCodePtr+1
|
||
.8 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/bin/forth.s.cp
|
||
LOAD usr/src/bin/forth.s
|
||
ASM
|