2018-01-10 16:34:57 +00:00
|
|
|
|
NEW
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2018-01-10 16:34:57 +00:00
|
|
|
|
AUTO 4,1
|
2015-10-06 16:14:48 +00:00
|
|
|
|
*---------------------------------------
|
2018-02-01 16:30:18 +00:00
|
|
|
|
SRC.PrintLine jsr SRC.PrintLineOn
|
|
|
|
|
bcs SRC.PrintLine.9
|
|
|
|
|
|
|
|
|
|
SRC.PrintLine.1 jsr SRC.PrintLineOutBuf
|
|
|
|
|
bcs SRC.PrintLine.9
|
2018-01-31 16:20:20 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW ZPLineBuf
|
|
|
|
|
>PUSHW.G SRC.LINENUM
|
|
|
|
|
>LDYA L.MSG.SRCLINE
|
|
|
|
|
>SYSCALL PrintF.YA
|
2018-02-01 16:30:18 +00:00
|
|
|
|
SRC.PrintLine.9 rts
|
2018-01-31 16:20:20 +00:00
|
|
|
|
*---------------------------------------
|
2018-02-01 16:30:18 +00:00
|
|
|
|
SRC.PrintLineOn >LDA.G ASM.LI.ON
|
2018-01-30 16:24:45 +00:00
|
|
|
|
bpl .9
|
|
|
|
|
>LDA.G MAC.bAdd
|
2015-12-17 16:57:35 +00:00
|
|
|
|
bpl .1
|
|
|
|
|
|
2018-01-30 16:24:45 +00:00
|
|
|
|
>LDA.G ASM.LI.MON
|
2015-12-17 16:57:35 +00:00
|
|
|
|
bpl .9
|
|
|
|
|
bmi .8
|
|
|
|
|
|
2018-01-31 16:20:20 +00:00
|
|
|
|
.1
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
SRC.PrintLineOutBuf >LDA.G OUT.Buf
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
clc
|
|
|
|
|
adc #OUT.Buf
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
.1 >PUSHB (pData),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.2 ldy #OUT.PC+1
|
2015-12-17 16:57:35 +00:00
|
|
|
|
>PUSHB (pData),y
|
|
|
|
|
dey
|
|
|
|
|
>PUSHB (pData),y
|
2018-01-31 16:20:20 +00:00
|
|
|
|
|
|
|
|
|
>LDA.G OUT.Buf
|
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
ldy L.MSG.OUT0,x
|
|
|
|
|
lda L.MSG.OUT0+1,x
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2018-01-31 16:20:20 +00:00
|
|
|
|
.9 rts
|
2015-12-17 16:57:35 +00:00
|
|
|
|
*---------------------------------------
|
2018-02-01 16:30:18 +00:00
|
|
|
|
SRC.PrintLineErr >STA.G DIR.Byte Save Error code
|
|
|
|
|
|
|
|
|
|
jsr SRC.PrintLineOn
|
|
|
|
|
bcc .1 Already printed
|
|
|
|
|
|
|
|
|
|
jsr SRC.PrintLine.1
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcs .9
|
2015-12-17 16:57:35 +00:00
|
|
|
|
|
2018-02-01 16:30:18 +00:00
|
|
|
|
.1 >PUSHB.G DIR.Byte
|
|
|
|
|
>LDYA L.MSG.ERROR
|
|
|
|
|
>SYSCALL PrintF.YA
|
|
|
|
|
|
2018-01-23 16:52:22 +00:00
|
|
|
|
ldx ZPLinePtr
|
|
|
|
|
cpx ZPLineBuf
|
2015-12-17 16:57:35 +00:00
|
|
|
|
beq .4
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
|
|
|
|
.3 phx
|
2015-12-17 16:57:35 +00:00
|
|
|
|
lda #'-'
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL PutChar.A
|
2015-12-17 16:57:35 +00:00
|
|
|
|
plx
|
|
|
|
|
bcs .9
|
2018-01-11 16:34:09 +00:00
|
|
|
|
dex
|
2018-01-23 16:52:22 +00:00
|
|
|
|
cpx ZPLineBuf
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bne .3
|
2015-12-17 16:57:35 +00:00
|
|
|
|
|
|
|
|
|
.4 lda #'^'
|
2018-01-11 16:34:09 +00:00
|
|
|
|
phy
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL PutChar.A
|
2018-01-11 16:34:09 +00:00
|
|
|
|
ply
|
2015-12-17 16:57:35 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
.5 lda #13
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL PutChar.A
|
2018-01-11 16:34:09 +00:00
|
|
|
|
lda #10
|
|
|
|
|
>SYSCALL PutChar.A
|
|
|
|
|
|
2015-12-17 16:57:35 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*---------------------------------------
|
2018-01-29 16:48:07 +00:00
|
|
|
|
SRC.ParseLine jsr SRC.GetChar
|
2018-01-23 16:52:22 +00:00
|
|
|
|
bcs .8
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
cmp #'*' Comment?
|
2018-01-23 16:52:22 +00:00
|
|
|
|
beq .8
|
2018-01-11 16:34:09 +00:00
|
|
|
|
cmp #';' Comment?
|
2018-01-23 16:52:22 +00:00
|
|
|
|
beq .8
|
2015-11-20 16:31:14 +00:00
|
|
|
|
|
2018-01-31 16:20:20 +00:00
|
|
|
|
jsr OUT.Reset
|
|
|
|
|
|
2018-01-29 16:48:07 +00:00
|
|
|
|
>LDA.G MAC.bAdd
|
|
|
|
|
bmi SRC.ParseLine.MACRO
|
|
|
|
|
|
|
|
|
|
jmp SRC.ParseLine.LABEL
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
SRC.ParseLine.Macro >LDA.G ASM.PASS If Pass#2, ignore
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
lda (ZPLinePtr)
|
|
|
|
|
cmp #' ' No label, scan to DIR/OP if any
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetNextCharNB
|
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
lda #' ' Store ONE blank
|
|
|
|
|
jsr MAC.AddChar
|
2018-01-30 16:24:45 +00:00
|
|
|
|
bcs .90
|
2018-01-29 16:48:07 +00:00
|
|
|
|
|
|
|
|
|
lda (ZPLinePtr) get back non blank char
|
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.1 jsr MAC.AddChar
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetNextChar
|
2018-01-30 16:24:45 +00:00
|
|
|
|
bcs .80
|
2018-01-29 16:48:07 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
jsr MAC.AddChar
|
2018-01-30 16:24:45 +00:00
|
|
|
|
.90 bcs .99
|
2018-01-29 16:48:07 +00:00
|
|
|
|
|
|
|
|
|
jsr SRC.GetNextCharNB
|
2018-01-30 16:24:45 +00:00
|
|
|
|
bcs .80
|
2018-01-29 16:48:07 +00:00
|
|
|
|
|
|
|
|
|
.2 cmp #'.' Directive ?
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPLinePtr),y
|
|
|
|
|
beq .3
|
|
|
|
|
cmp #'E'
|
|
|
|
|
beq .21
|
|
|
|
|
cmp #'e'
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
.21 iny
|
|
|
|
|
lda (ZPLinePtr),y
|
|
|
|
|
beq .3
|
|
|
|
|
cmp #'M'
|
|
|
|
|
beq .22
|
|
|
|
|
cmp #'m'
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
.22 jsr MAC.Store
|
|
|
|
|
bcs SRC.ParseLine.RTS
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
>STA.G MAC.bAdd
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
2018-01-30 16:24:45 +00:00
|
|
|
|
.80 lda #0
|
|
|
|
|
jmp MAC.AddChar
|
|
|
|
|
|
2018-01-29 16:48:07 +00:00
|
|
|
|
.3 lda (ZPLinePtr)
|
|
|
|
|
|
|
|
|
|
.4 jsr MAC.AddChar
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetNextChar
|
2018-01-30 16:24:45 +00:00
|
|
|
|
bcs .80
|
2018-01-29 16:48:07 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bcs .8
|
|
|
|
|
cmp #' '
|
2018-01-30 16:24:45 +00:00
|
|
|
|
beq .80 Comments...
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
lda #' '
|
|
|
|
|
jsr MAC.AddChar
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
bcs .99
|
2018-01-29 16:48:07 +00:00
|
|
|
|
|
|
|
|
|
.5 jsr MAC.AddChar Store ARG....
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetNextChar
|
2018-01-30 16:24:45 +00:00
|
|
|
|
bcs .80
|
2018-01-29 16:48:07 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
lda #0
|
2018-01-30 16:24:45 +00:00
|
|
|
|
jmp MAC.AddChar End of Line
|
2018-01-29 16:48:07 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.99 lda #ERR.MACRO.TOO.BIG
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
SRC.ParseLine.RTS rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
SRC.ParseLine.LABEL lda #0
|
|
|
|
|
sta (ZPLocalBuf)
|
|
|
|
|
>STA.G SYM.bGlobal
|
|
|
|
|
|
|
|
|
|
jsr SRC.GetChar
|
2018-01-23 16:52:22 +00:00
|
|
|
|
cmp #' ' no label...go scan dir/opcode
|
|
|
|
|
beq SRC.ParseLine.DirOp
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-23 16:52:22 +00:00
|
|
|
|
cmp #'.' local symbol?
|
2018-01-29 07:41:05 +00:00
|
|
|
|
bne .1
|
2018-01-23 16:52:22 +00:00
|
|
|
|
|
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bcs SRC.ParseLine.InvLbl
|
2018-01-22 16:52:04 +00:00
|
|
|
|
jsr SRC.GetDecimal
|
2018-01-23 16:52:22 +00:00
|
|
|
|
bcs SRC.ParseLine.InvLbl
|
2018-01-23 07:31:16 +00:00
|
|
|
|
|
2018-01-22 16:52:04 +00:00
|
|
|
|
lda SRC.ACC+1
|
|
|
|
|
ora SRC.ACC+2
|
|
|
|
|
ora SRC.ACC+3
|
2018-01-23 16:52:22 +00:00
|
|
|
|
bne SRC.ParseLine.InvLbl Max .255
|
2018-01-22 16:52:04 +00:00
|
|
|
|
lda SRC.ACC
|
2018-01-23 16:52:22 +00:00
|
|
|
|
beq SRC.ParseLine.InvLbl .0 is not allowed
|
2018-01-22 16:52:04 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
jsr SYM.AddLocalPC
|
2018-01-29 16:48:07 +00:00
|
|
|
|
bcs SRC.ParseLine.RTS
|
2018-01-29 07:41:05 +00:00
|
|
|
|
bra SRC.ParseLine.DirOp
|
2018-01-29 16:48:07 +00:00
|
|
|
|
|
2018-01-29 07:41:05 +00:00
|
|
|
|
.1 lda #$ff
|
2018-01-24 16:24:06 +00:00
|
|
|
|
>STA.G SYM.bGlobal
|
|
|
|
|
|
|
|
|
|
>LDA.G ASM.PASS
|
2018-01-29 07:41:05 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
jsr SYM.AddGlobalPC Pass #1; try to add global...
|
|
|
|
|
bcc SRC.ParseLine.DirOp yes!!! go scan dir/op
|
|
|
|
|
|
|
|
|
|
jsr SYM.LookupGlobal already defined...get it
|
|
|
|
|
|
|
|
|
|
>LDA.G SYM.Lookup+SYM.F
|
|
|
|
|
bit #SYM.F.RW
|
|
|
|
|
bne .2 R/W, always update...
|
|
|
|
|
|
|
|
|
|
bit #SYM.F.RESOLVED
|
|
|
|
|
bne SRC.ParseLine.Redef
|
|
|
|
|
|
|
|
|
|
.2 jsr SYM.UpdateGlobal
|
2018-01-24 16:24:06 +00:00
|
|
|
|
bra SRC.ParseLine.DirOp
|
|
|
|
|
|
2018-01-29 16:48:07 +00:00
|
|
|
|
.3 jsr SYM.LookupGlobal Pass #2: should be already defined...
|
2018-01-29 07:41:05 +00:00
|
|
|
|
bcs SRC.ParseLine.Undef
|
2018-01-22 07:34:59 +00:00
|
|
|
|
|
2018-01-29 16:48:07 +00:00
|
|
|
|
jsr SYM.UpdateGlobalPC
|
2018-01-29 07:41:05 +00:00
|
|
|
|
|
|
|
|
|
*---------------------------------------
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.ParseLine.DirOp jsr SRC.GetNextCharNB Scan for an Opcode...
|
2018-01-23 07:31:16 +00:00
|
|
|
|
bcs SRC.ParseLine.Ok
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
|
|
|
|
cmp #'.'
|
2015-10-09 15:53:30 +00:00
|
|
|
|
bne .5
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-23 16:52:22 +00:00
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bcs SRC.ParseLine.InvDir
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2015-10-09 15:53:30 +00:00
|
|
|
|
jsr SRC.ParseLine.Dir
|
|
|
|
|
bcs SRC.ParseLine.Err
|
2015-10-06 16:14:48 +00:00
|
|
|
|
bra SRC.ParseLine.Ok
|
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
.5 cmp #'>'
|
|
|
|
|
bne .6
|
|
|
|
|
|
2018-01-29 16:48:07 +00:00
|
|
|
|
jsr SRC.ParseLine.ExecMacro
|
2015-10-28 16:55:12 +00:00
|
|
|
|
bcs SRC.ParseLine.Err
|
|
|
|
|
bra SRC.ParseLine.Ok
|
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.6 jsr SRC.ParseLine.OpCode
|
2015-10-09 15:53:30 +00:00
|
|
|
|
bcs SRC.ParseLine.Err
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-24 16:24:06 +00:00
|
|
|
|
SRC.ParseLine.Ok clc
|
2015-10-06 16:14:48 +00:00
|
|
|
|
rts
|
2015-12-17 16:57:35 +00:00
|
|
|
|
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.ParseLine.InvLbl
|
|
|
|
|
lda #ERR.INV.LABEL
|
2015-10-06 16:14:48 +00:00
|
|
|
|
SRC.ParseLine.Err sec
|
|
|
|
|
rts
|
2015-12-04 16:33:33 +00:00
|
|
|
|
|
2018-01-24 16:24:06 +00:00
|
|
|
|
SRC.ParseLine.Redef lda #ERR.SYMBOL.REDEF
|
2015-11-20 16:31:14 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2018-01-24 16:24:06 +00:00
|
|
|
|
SRC.ParseLine.Undef lda #ERR.UNDEF.SYMBOL
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.ParseLine.InvDir
|
|
|
|
|
lda #ERR.INV.DIR
|
2015-11-20 16:31:14 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-10-09 15:53:30 +00:00
|
|
|
|
*---------------------------------------
|
2015-10-06 16:14:48 +00:00
|
|
|
|
SRC.ParseLine.Dir >LDYA L.T.DIRECTIVES
|
|
|
|
|
jsr SRC.GetKeyword
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2018-01-23 16:52:22 +00:00
|
|
|
|
bcs SRC.ParseLine.InvDir
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
|
|
|
|
jmp (J.DIRECTIVES,x)
|
|
|
|
|
*---------------------------------------
|
2018-01-29 16:48:07 +00:00
|
|
|
|
SRC.ParseLine.ExecMacro
|
2018-01-29 07:41:05 +00:00
|
|
|
|
|
|
|
|
|
|
2015-10-06 16:14:48 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-10-28 16:55:12 +00:00
|
|
|
|
SRC.ParseLine.OpCode
|
2018-01-26 16:19:17 +00:00
|
|
|
|
stz SRC.AM.ID
|
|
|
|
|
|
2018-01-15 06:50:44 +00:00
|
|
|
|
>LDYA ZPOPtr
|
2015-10-28 16:55:12 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
2018-01-26 07:04:29 +00:00
|
|
|
|
.1 lda (ZPPtr1) End Of OpCode List
|
2018-01-12 16:05:44 +00:00
|
|
|
|
ldy #1
|
2018-01-15 06:50:44 +00:00
|
|
|
|
ora (ZPPtr1),y
|
2015-10-28 16:55:12 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
2018-01-15 06:50:44 +00:00
|
|
|
|
lda ZPPtr1
|
2018-01-12 16:05:44 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #2
|
2018-01-15 06:50:44 +00:00
|
|
|
|
sta ZPPtr2
|
|
|
|
|
lda ZPPtr1+1
|
2018-01-12 16:05:44 +00:00
|
|
|
|
adc #0
|
2018-01-15 06:50:44 +00:00
|
|
|
|
sta ZPPtr2+1
|
2018-01-12 16:05:44 +00:00
|
|
|
|
|
2018-01-15 06:50:44 +00:00
|
|
|
|
lda (ZPPtr2)
|
2018-01-11 16:34:09 +00:00
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
ldy #0
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2018-01-26 07:04:29 +00:00
|
|
|
|
.2 lda (ZPLinePtr),y
|
2018-01-26 16:19:17 +00:00
|
|
|
|
beq .7
|
2018-01-26 07:04:29 +00:00
|
|
|
|
|
2018-01-12 16:05:44 +00:00
|
|
|
|
cmp #'a'
|
2018-01-26 07:04:29 +00:00
|
|
|
|
bcc .3
|
2018-01-12 16:05:44 +00:00
|
|
|
|
cmp #'z'+1
|
2018-01-26 07:04:29 +00:00
|
|
|
|
bcs .3
|
2018-01-12 16:05:44 +00:00
|
|
|
|
|
|
|
|
|
eor #$20
|
|
|
|
|
|
2018-01-26 07:04:29 +00:00
|
|
|
|
.3 iny
|
2018-01-15 06:50:44 +00:00
|
|
|
|
cmp (ZPPtr2),y
|
2018-01-26 16:19:17 +00:00
|
|
|
|
bne .7
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
dex
|
2018-01-26 07:04:29 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
lda (ZPLinePtr),y
|
|
|
|
|
beq .8 End of Line, no AM
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
cmp #' ' A space after opcode ?
|
|
|
|
|
bne .7
|
2015-11-27 16:26:11 +00:00
|
|
|
|
|
2018-01-26 07:04:29 +00:00
|
|
|
|
tya
|
2018-01-26 16:19:17 +00:00
|
|
|
|
sec skip OP + ' '
|
2018-01-26 07:04:29 +00:00
|
|
|
|
adc ZPLinePtr
|
|
|
|
|
sta ZPLinePtr
|
|
|
|
|
bcc .5
|
2015-11-27 16:26:11 +00:00
|
|
|
|
|
2018-01-26 07:04:29 +00:00
|
|
|
|
inc ZPLinePtr+1
|
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.5 bra SRC.ParseLine.AM
|
2015-11-20 16:31:14 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.7 lda ZPPtr1
|
2015-10-28 16:55:12 +00:00
|
|
|
|
clc
|
2018-01-15 06:50:44 +00:00
|
|
|
|
adc (ZPPtr1)
|
2015-10-28 16:55:12 +00:00
|
|
|
|
tax
|
2018-01-15 06:50:44 +00:00
|
|
|
|
lda ZPPtr1+1
|
2015-10-28 16:55:12 +00:00
|
|
|
|
ldy #1
|
2018-01-15 06:50:44 +00:00
|
|
|
|
adc (ZPPtr1),y
|
|
|
|
|
stx ZPPtr1
|
|
|
|
|
sta ZPPtr1+1
|
2018-01-26 07:04:29 +00:00
|
|
|
|
bra .1
|
2015-10-28 16:55:12 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.9 lda #ERR.INV.OPCODE
|
2015-10-28 16:55:12 +00:00
|
|
|
|
sec
|
2015-10-30 16:34:59 +00:00
|
|
|
|
.99 rts
|
|
|
|
|
*---------------------------------------
|
2018-01-26 16:19:17 +00:00
|
|
|
|
SRC.ParseLine.AM stz SRC.AM.StrBuf
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.1 jsr SRC.GetChar
|
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
.10 cmp #' ' another space ?
|
2015-10-30 16:34:59 +00:00
|
|
|
|
beq .8 ignore end of line (comment)
|
|
|
|
|
|
|
|
|
|
jsr SRC.IsAMReserved
|
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
inc SRC.AM.StrBuf
|
|
|
|
|
ldx SRC.AM.StrBuf
|
|
|
|
|
sta SRC.AM.StrBuf,x
|
2018-01-26 16:19:17 +00:00
|
|
|
|
bra .7
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2015-12-17 16:57:35 +00:00
|
|
|
|
.2 jsr SRC.IsMODReserved
|
2018-01-26 16:19:17 +00:00
|
|
|
|
bcs .3
|
|
|
|
|
|
2015-12-17 16:57:35 +00:00
|
|
|
|
lda #'#'
|
|
|
|
|
inc SRC.AM.StrBuf
|
|
|
|
|
ldx SRC.AM.StrBuf
|
|
|
|
|
sta SRC.AM.StrBuf,x
|
2018-02-01 16:30:18 +00:00
|
|
|
|
|
|
|
|
|
jsr SRC.GetNextChar
|
|
|
|
|
bcs .9
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.3 jsr SRC.IsLetter Any register?
|
|
|
|
|
bcs .6 no, try something else
|
2018-01-23 07:31:16 +00:00
|
|
|
|
|
2018-02-01 16:30:18 +00:00
|
|
|
|
>LDYA ZPRPtr Check in register table
|
2018-01-26 16:19:17 +00:00
|
|
|
|
jsr SRC.GetKeyword
|
|
|
|
|
bcs .6
|
2018-01-23 07:31:16 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
lda (ZPPtr1) get register len
|
|
|
|
|
tax
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
ldy SRC.AM.StrBuf
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.4 inc ZPPtr1
|
|
|
|
|
bne .5
|
|
|
|
|
inc ZPPtr1+1
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.5 lda (ZPPtr1)
|
2015-10-30 16:34:59 +00:00
|
|
|
|
iny
|
2018-01-26 16:19:17 +00:00
|
|
|
|
sta SRC.AM.StrBuf,y
|
|
|
|
|
dex
|
|
|
|
|
bne .4
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
sty SRC.AM.StrBuf
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
bra .1
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.6 jsr EXP.Eval
|
2015-10-30 16:34:59 +00:00
|
|
|
|
bcs .99
|
2015-12-17 16:57:35 +00:00
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
.73 lda SRC.ACC,x
|
|
|
|
|
bne .72
|
|
|
|
|
dex
|
|
|
|
|
bne .73
|
|
|
|
|
|
|
|
|
|
.72 inx
|
2018-01-26 16:19:17 +00:00
|
|
|
|
lda #'a'
|
2015-12-17 16:57:35 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
ldy SRC.AM.StrBuf
|
|
|
|
|
|
|
|
|
|
.71 iny
|
|
|
|
|
sta SRC.AM.StrBuf,y
|
|
|
|
|
dex
|
|
|
|
|
bne .71
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
sty SRC.AM.StrBuf
|
|
|
|
|
bra .1
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.7 jsr SRC.GetNextChar
|
|
|
|
|
bcc .10
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
2018-01-26 16:19:17 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.9 lda #ERR.INV.AM.SYN
|
2015-10-30 16:34:59 +00:00
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2015-10-28 16:55:12 +00:00
|
|
|
|
*---------------------------------------
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.GetDecimal jsr SRC.GetChar
|
|
|
|
|
beq .99
|
|
|
|
|
|
|
|
|
|
stz SRC.ACC+1
|
2015-10-06 16:14:48 +00:00
|
|
|
|
stz SRC.ACC+2
|
|
|
|
|
stz SRC.ACC+3
|
|
|
|
|
|
|
|
|
|
jsr SRC.IsDigit10
|
|
|
|
|
bcs .99
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2015-10-06 16:14:48 +00:00
|
|
|
|
and #$0F
|
|
|
|
|
sta SRC.ACC
|
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.1 jsr SRC.GetNextChar
|
2018-01-23 07:31:16 +00:00
|
|
|
|
bcs .8
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2015-10-06 16:14:48 +00:00
|
|
|
|
cmp #' '
|
2018-01-11 16:34:09 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2015-11-27 16:26:11 +00:00
|
|
|
|
jsr SRC.IsEXPReserved
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcc .8
|
|
|
|
|
|
2015-11-27 16:26:11 +00:00
|
|
|
|
jsr SRC.IsAMReserved
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcc .8
|
|
|
|
|
|
2015-10-06 16:14:48 +00:00
|
|
|
|
jsr SRC.IsDigit10
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2015-10-06 16:14:48 +00:00
|
|
|
|
and #$0F
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
jsr SRC.ACC10
|
|
|
|
|
pla
|
|
|
|
|
bcs .9
|
2015-11-20 16:31:14 +00:00
|
|
|
|
|
2015-10-06 16:14:48 +00:00
|
|
|
|
adc SRC.ACC
|
|
|
|
|
sta SRC.ACC
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
inc SRC.ACC+1
|
|
|
|
|
bne .1
|
|
|
|
|
inc SRC.ACC+2
|
|
|
|
|
bne .1
|
|
|
|
|
inc SRC.ACC+3
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.9 lda #ERR.VAL.TOO.BIG
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-11-27 16:26:11 +00:00
|
|
|
|
|
2015-10-06 16:14:48 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
.99 lda #ERR.SYNTAX.ERROR
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.GetHex jsr SRC.GetNextChar skip '$'
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
stz SRC.ACC+1
|
2015-10-28 16:55:12 +00:00
|
|
|
|
stz SRC.ACC+2
|
|
|
|
|
stz SRC.ACC+3
|
|
|
|
|
|
|
|
|
|
jsr SRC.IsDigit16
|
|
|
|
|
bcs .99
|
2015-11-20 16:31:14 +00:00
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
sta SRC.ACC
|
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.1 jsr SRC.GetNextChar
|
2018-01-23 07:31:16 +00:00
|
|
|
|
bcs .8
|
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
cmp #' '
|
2018-01-11 16:34:09 +00:00
|
|
|
|
beq .8
|
2015-11-27 16:26:11 +00:00
|
|
|
|
jsr SRC.IsEXPReserved
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcc .8
|
2015-11-27 16:26:11 +00:00
|
|
|
|
jsr SRC.IsAMReserved
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcc .8
|
2015-10-28 16:55:12 +00:00
|
|
|
|
jsr SRC.IsDigit16
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
ldx #4
|
2015-11-20 16:31:14 +00:00
|
|
|
|
.2 asl SRC.ACC
|
2015-10-28 16:55:12 +00:00
|
|
|
|
rol SRC.ACC+1
|
|
|
|
|
rol SRC.ACC+2
|
|
|
|
|
rol SRC.ACC+3
|
|
|
|
|
bcs .9
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
2015-11-20 16:31:14 +00:00
|
|
|
|
ora SRC.ACC
|
|
|
|
|
sta SRC.ACC
|
2015-10-28 16:55:12 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #ERR.VAL.TOO.BIG
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2015-10-30 16:34:59 +00:00
|
|
|
|
.99 lda #ERR.SYNTAX.ERROR
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.GetOctal jsr SRC.GetNextChar skip '&'
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
stz SRC.ACC+1
|
2015-10-30 16:34:59 +00:00
|
|
|
|
stz SRC.ACC+2
|
|
|
|
|
stz SRC.ACC+3
|
|
|
|
|
|
|
|
|
|
jsr SRC.IsDigit8
|
|
|
|
|
bcs .99
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2015-10-30 16:34:59 +00:00
|
|
|
|
and #$0F
|
|
|
|
|
sta SRC.ACC
|
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.1 jsr SRC.GetNextChar
|
2018-01-23 07:31:16 +00:00
|
|
|
|
bcs .8
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2015-10-30 16:34:59 +00:00
|
|
|
|
cmp #' '
|
2018-01-11 16:34:09 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2015-11-27 16:26:11 +00:00
|
|
|
|
jsr SRC.IsEXPReserved
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcc .8
|
|
|
|
|
|
2015-11-27 16:26:11 +00:00
|
|
|
|
jsr SRC.IsAMReserved
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcc .8
|
|
|
|
|
|
2015-10-30 16:34:59 +00:00
|
|
|
|
jsr SRC.IsDigit8
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcs .9
|
2015-10-30 16:34:59 +00:00
|
|
|
|
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
.2 asl
|
|
|
|
|
rol SRC.ACC
|
|
|
|
|
rol SRC.ACC+1
|
|
|
|
|
rol SRC.ACC+2
|
|
|
|
|
rol SRC.ACC+3
|
|
|
|
|
bcs .9
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #ERR.VAL.TOO.BIG
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
.99 lda #ERR.SYNTAX.ERROR
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.GetBinary jsr SRC.GetNextChar skip '%'
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
stz SRC.ACC+1
|
2015-10-28 16:55:12 +00:00
|
|
|
|
stz SRC.ACC+2
|
|
|
|
|
stz SRC.ACC+3
|
|
|
|
|
|
|
|
|
|
cmp #'1'
|
|
|
|
|
beq .10
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
cmp #'0'
|
|
|
|
|
bne .99
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
.10 and #$01
|
|
|
|
|
sta SRC.ACC
|
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.1 jsr SRC.GetNextChar
|
2018-01-23 07:31:16 +00:00
|
|
|
|
bcs .8
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2015-11-27 16:26:11 +00:00
|
|
|
|
cmp #' '
|
2018-01-11 16:34:09 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2015-11-27 16:26:11 +00:00
|
|
|
|
jsr SRC.IsEXPReserved
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcc .8
|
|
|
|
|
|
2015-11-27 16:26:11 +00:00
|
|
|
|
jsr SRC.IsAMReserved
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcc .8
|
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
cmp #'1'
|
|
|
|
|
beq .11
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
cmp #'0'
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
.11 lsr
|
|
|
|
|
|
|
|
|
|
rol SRC.ACC
|
|
|
|
|
rol SRC.ACC+1
|
|
|
|
|
rol SRC.ACC+2
|
|
|
|
|
rol SRC.ACC+3
|
|
|
|
|
bcs .9
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #ERR.VAL.TOO.BIG
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2015-10-06 16:14:48 +00:00
|
|
|
|
.99 lda #ERR.SYNTAX.ERROR
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2018-01-11 16:34:09 +00:00
|
|
|
|
SRC.GetKeyword >STYA ZPPtr1 KeyWord table
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
|
|
|
|
stz SRC.Keyword.ID
|
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.1 lda (ZPPtr1)
|
|
|
|
|
beq .9 End Of table
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
tax KW len
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.2 ldy #0
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.3 lda (ZPLinePtr),y
|
|
|
|
|
beq .5
|
2018-01-15 06:50:44 +00:00
|
|
|
|
|
2018-02-01 16:30:18 +00:00
|
|
|
|
jsr SRC.IsKeywordLetterUC
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcs .5
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
iny
|
|
|
|
|
cmp (ZPPtr1),y
|
|
|
|
|
bne .5
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .3
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
lda (ZPLinePtr),y All chars match...
|
|
|
|
|
beq .4 End of Line ?
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-02-01 16:30:18 +00:00
|
|
|
|
jsr SRC.IsKeywordLetterUC
|
2018-01-11 16:34:09 +00:00
|
|
|
|
bcc .5 Additional letters...
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.4 lda ZPLinePtr
|
|
|
|
|
clc
|
|
|
|
|
adc (ZPPtr1)
|
|
|
|
|
sta ZPLinePtr
|
|
|
|
|
bcc .41
|
|
|
|
|
inc ZPLinePtr+1
|
|
|
|
|
.41 ldx SRC.Keyword.ID
|
2015-10-06 16:14:48 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
|
|
|
|
.5 lda (ZPPtr1)
|
|
|
|
|
sec Add keyword Len+1
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
bcc .6
|
|
|
|
|
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.6 inc SRC.Keyword.ID
|
|
|
|
|
inc SRC.Keyword.ID
|
|
|
|
|
bra .1
|
2015-10-06 16:14:48 +00:00
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-10-30 16:34:59 +00:00
|
|
|
|
SRC.IsAMReserved ldx SRC.AM.RESERVED
|
|
|
|
|
.1 cmp SRC.AM.RESERVED,x
|
|
|
|
|
beq .8
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-12-17 16:57:35 +00:00
|
|
|
|
SRC.IsMODReserved ldx SRC.MOD.RESERVED
|
|
|
|
|
.1 cmp SRC.MOD.RESERVED,x
|
|
|
|
|
beq .8
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2018-01-23 07:31:16 +00:00
|
|
|
|
|
2015-12-17 16:57:35 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-10-30 16:34:59 +00:00
|
|
|
|
SRC.IsEXPReserved ldx SRC.EXP.RESERVED
|
|
|
|
|
.1 cmp SRC.EXP.RESERVED,x
|
2018-02-01 16:30:18 +00:00
|
|
|
|
beq SRC.IsEXPReserved.8
|
2015-10-30 16:34:59 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2018-01-23 07:31:16 +00:00
|
|
|
|
|
2018-02-01 16:30:18 +00:00
|
|
|
|
SRC.IsEXPReserved.8 clc
|
2015-10-30 16:34:59 +00:00
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2018-02-01 16:30:18 +00:00
|
|
|
|
SRC.IsKeywordLetterUC
|
|
|
|
|
cmp #'.'
|
|
|
|
|
beq SRC.IsEXPReserved.8
|
|
|
|
|
|
|
|
|
|
cmp #'_'
|
|
|
|
|
beq SRC.IsEXPReserved.8
|
|
|
|
|
|
|
|
|
|
cmp #'A'
|
2018-01-26 16:19:17 +00:00
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'Z'+1
|
|
|
|
|
bcc .99
|
|
|
|
|
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'z'+1
|
|
|
|
|
|
|
|
|
|
eor #$20
|
|
|
|
|
|
|
|
|
|
rts CC if lowercase
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*---------------------------------------
|
2015-10-06 16:14:48 +00:00
|
|
|
|
SRC.IsLetterOrDigit jsr SRC.IsDigit10
|
|
|
|
|
bcc SRC.IsLetterRTS
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
SRC.IsLetter cmp #'A'
|
|
|
|
|
bcc .9
|
2015-11-13 16:25:31 +00:00
|
|
|
|
cmp #'Z'+1
|
2015-10-06 16:14:48 +00:00
|
|
|
|
bcc SRC.IsLetterRTS
|
|
|
|
|
|
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .9
|
2015-11-13 16:25:31 +00:00
|
|
|
|
cmp #'z'+1
|
2015-10-06 16:14:48 +00:00
|
|
|
|
rts CC if lowercase
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
SRC.IsLetterRTS rts
|
|
|
|
|
*---------------------------------------
|
2015-10-28 16:55:12 +00:00
|
|
|
|
SRC.IsDigit16 jsr SRC.IsDigit10
|
|
|
|
|
bcc .8
|
|
|
|
|
cmp #'A'
|
|
|
|
|
bcc .9
|
2015-11-20 16:31:14 +00:00
|
|
|
|
cmp #'F'+1
|
2015-10-28 16:55:12 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
|
2018-02-01 16:30:18 +00:00
|
|
|
|
cmp #'a'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'f'+1
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
eor #$20
|
|
|
|
|
|
|
|
|
|
.1
|
|
|
|
|
* clc
|
|
|
|
|
sbc #'A'-11 cc so A->10 (11-CC)
|
2015-10-28 16:55:12 +00:00
|
|
|
|
clc
|
2018-02-01 16:30:18 +00:00
|
|
|
|
|
2015-10-28 16:55:12 +00:00
|
|
|
|
.8 and #$0F
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2015-10-06 16:14:48 +00:00
|
|
|
|
SRC.IsDigit10 cmp #'0'
|
|
|
|
|
bcc .9
|
2015-10-28 16:55:12 +00:00
|
|
|
|
cmp #'9'+1
|
2015-10-06 16:14:48 +00:00
|
|
|
|
rts cc if ok, cs if not
|
|
|
|
|
|
2015-10-30 16:34:59 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
SRC.IsDigit8 cmp #'0'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'7'+1
|
|
|
|
|
rts cc if ok, cs if not
|
|
|
|
|
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*---------------------------------------
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.GetNextCharNB jsr SRC.GetNextChar
|
2018-01-23 07:31:16 +00:00
|
|
|
|
bcs .9
|
2018-01-11 16:34:09 +00:00
|
|
|
|
cmp #' '
|
|
|
|
|
beq SRC.GetNextCharNB
|
2018-01-23 07:31:16 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
|
2015-10-06 16:14:48 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*---------------------------------------
|
2018-01-11 16:34:09 +00:00
|
|
|
|
SRC.GetNextCharUC jsr SRC.GetNextChar
|
2015-10-06 16:14:48 +00:00
|
|
|
|
bcs .9
|
2018-01-11 16:34:09 +00:00
|
|
|
|
cmp #'a'
|
2018-01-23 07:31:16 +00:00
|
|
|
|
bcc .8
|
2018-01-11 16:34:09 +00:00
|
|
|
|
cmp #'z'+1
|
2018-01-23 07:31:16 +00:00
|
|
|
|
bcs .8
|
2018-01-11 16:34:09 +00:00
|
|
|
|
eor #$20 to Uppercase
|
2018-01-23 07:31:16 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
2018-01-11 16:34:09 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
SRC.GetNextChar lda (ZPLinePtr)
|
2018-01-23 16:52:22 +00:00
|
|
|
|
beq SRC.GetChar.ERR
|
2018-01-23 07:31:16 +00:00
|
|
|
|
cmp #$0D
|
2018-01-23 16:52:22 +00:00
|
|
|
|
beq SRC.GetChar.ERR
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
|
|
|
|
inc ZPLinePtr
|
2018-01-23 16:52:22 +00:00
|
|
|
|
bne SRC.GetChar
|
2018-01-11 16:34:09 +00:00
|
|
|
|
|
|
|
|
|
inc ZPLinePtr+1
|
|
|
|
|
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.GetChar lda (ZPLinePtr)
|
|
|
|
|
beq SRC.GetChar.ERR
|
2018-01-23 07:31:16 +00:00
|
|
|
|
cmp #$0D
|
2018-01-23 16:52:22 +00:00
|
|
|
|
beq SRC.GetChar.ERR
|
2018-01-23 07:31:16 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2018-01-23 16:52:22 +00:00
|
|
|
|
SRC.GetChar.ERR sec
|
2018-01-23 07:31:16 +00:00
|
|
|
|
rts
|
2015-10-06 16:14:48 +00:00
|
|
|
|
*---------------------------------------
|
|
|
|
|
SRC.ACC10 lda SRC.ACC ACC*2-> ACC & ACCTMP
|
|
|
|
|
asl
|
|
|
|
|
sta SRC.ACC
|
|
|
|
|
sta SRC.ACCTMP
|
|
|
|
|
lda SRC.ACC+1
|
|
|
|
|
rol
|
|
|
|
|
sta SRC.ACC+1
|
|
|
|
|
sta SRC.ACCTMP+1
|
|
|
|
|
lda SRC.ACC+2
|
|
|
|
|
rol
|
|
|
|
|
sta SRC.ACC+2
|
|
|
|
|
sta SRC.ACCTMP+2
|
|
|
|
|
lda SRC.ACC+3
|
|
|
|
|
rol
|
|
|
|
|
sta SRC.ACC+3
|
|
|
|
|
sta SRC.ACCTMP+3
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2015-11-20 16:31:14 +00:00
|
|
|
|
ldx #2
|
|
|
|
|
.1 asl SRC.ACC ACC=ACC*4
|
2015-10-06 16:14:48 +00:00
|
|
|
|
rol SRC.ACC+1
|
|
|
|
|
rol SRC.ACC+2
|
|
|
|
|
rol SRC.ACC+3
|
|
|
|
|
bcs .9
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda SRC.ACC CC from ROL SRC.ACC+3
|
|
|
|
|
adc SRC.ACCTMP
|
|
|
|
|
sta SRC.ACC
|
|
|
|
|
lda SRC.ACC+1
|
|
|
|
|
adc SRC.ACCTMP+1
|
|
|
|
|
sta SRC.ACC+1
|
|
|
|
|
lda SRC.ACC+2
|
|
|
|
|
adc SRC.ACCTMP+2
|
|
|
|
|
sta SRC.ACC+2
|
|
|
|
|
lda SRC.ACC+3
|
|
|
|
|
adc SRC.ACCTMP+3
|
|
|
|
|
sta SRC.ACC+3 CS if overflow
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*---------------------------------------
|
|
|
|
|
MAN
|
2018-01-10 16:34:57 +00:00
|
|
|
|
SAVE /A2OSX.BUILD/BIN/DEV/ASM.S.SRC
|
|
|
|
|
LOAD /A2OSX.BUILD/BIN/DEV/ASM.S
|
2015-10-06 16:14:48 +00:00
|
|
|
|
ASM
|