Merge branch 'marketideas:master' into master

This commit is contained in:
Lane Roathe 2021-09-11 16:03:32 -07:00 committed by GitHub
commit b1890bc150
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 849 additions and 376 deletions

2
asm.h
View File

@ -1,6 +1,6 @@
#pragma once
#include "app.h"
//
#define OPHANDLER(ACB) std::bind(ACB, this, std::placeholders::_1, std::placeholders::_2)
#define MODE_6502 0

View File

@ -201,7 +201,7 @@ asm php
plx
cmp #' '+1
blt :glabdone
:cpx cpx #$0f
:cpx cpx #lab_size
bge :gliny
sta labstr+1,x
inx
@ -210,9 +210,9 @@ asm php
:sjmp jmp :savlen
:cjmp jmp :comment
:glabdone cpx #$10
:glabdone cpx #lab_size+1
blt :gl2
ldx #$0f
ldx #lab_size
:gl2 stx labstr
cmp #' '
blt :sjmp
@ -394,8 +394,8 @@ asm php
lda 1,s
jsr asmerror
lda passnum
beq :perrpla
* lda passnum
* beq :perrpla
lda listflag
pha
@ -845,13 +845,13 @@ printline php
pea 0
pea 0
_QADrawDec
lda #' '
jsr drawchar
* rep $30
* lda tabs
* and #$ff
* pha
* _QATabToCol
* lda #' '
* jsr drawchar
* rep $30
lda tabs
and #$ff
pha
_QATabToCol
:sp2 sep $30
lda [printptr]
and #$7f
@ -1586,8 +1586,10 @@ initline php
sta lableused
lda objptr
sta lineobjptr
sta pcobjptr
lda objptr+2
sta lineobjptr+2
sta pcobjptr+2
:xit plp
rts
@ -1599,11 +1601,11 @@ inclablect php
and #%11111111
bne :normal
psl #$00
psl #$2000
psl #sym_size*256
lda userid
ora #asmmemid
pha
pea $8004 ;page aligned/locked
pea $8014 ;page aligned/locked/nocross
psl #$00
_NewHandle
plx
@ -1626,7 +1628,7 @@ inclablect php
jmp :rts
:normal lda nextlableptr
clc
adc #32
adc #sym_size
sta nextlableptr
bcc :rts
inc nextlableptr+2
@ -1858,9 +1860,9 @@ domacros php ;enter with $00 in A to s
cmp #$00
bne :nofind
ldx opcode
cpx #$10
cpx #lab_size+1
blt :move
ldx #$0f
ldx #lab_size
:move lda opcode,x
sta labstr,x
dex
@ -1874,7 +1876,7 @@ domacros php ;enter with $00 in A to s
bcc :builtin ;not found so try built in macs
bcc :bad
rep $20
ldy #26
ldy #o_labtype
lda [lableptr],y
and #$8004
cmp #$8004
@ -2319,7 +2321,7 @@ domac1 php
sty macflag
bcc :restore ;notfound
rep $20
ldy #26
ldy #o_labtype
lda [lableptr],y
and #$8004
cmp #$8004
@ -2412,7 +2414,15 @@ addmode php
beq :force16
cmp #'>'
beq :force24
cmp #$27 ; '
beq :skipq
cmp #$22 ; "
beq :skipq
and #$5f
cmp #'A'
beq :a
jmp :index
:force8 lda #amforce8
tsb myvalue
jmp :index
@ -2427,6 +2437,25 @@ addmode php
jmp :index
:square lda #amsquare
tsb myvalue
jmp :index
* 'a' (no modifier) is ignored
:a iny
lda [lineptr],y
cmp #' '+1
jlt :zero
dey
jmp :index
* skip over quoted operand component.
:skipq sta :q
:skipq1 iny
lda [lineptr],y
cmp #' '
blt :badmode
cmp :q
bne :skipq1
:index iny
lda [lineptr],y
cmp #' '+1
@ -2434,7 +2463,13 @@ addmode php
cmp #';'
beq :modexit
cmp #','
bne :index
beq :index1
cmp #$27 ; '
beq :skipq
cmp #$22 ; "
beq :skipq
bra :index
:index1 iny
lda [lineptr],y
and #$5f
@ -2542,6 +2577,7 @@ addmode php
plp
sec
rts
:q ds 2
addmodetbl dfb 6*3
dfb 7*3
@ -3019,12 +3055,12 @@ relcorrect php
lda [lableptr1],y
sta lableptr+2
ldx #$00
ldy #26
ldy #o_labtype
lda [lableptr],y
and #$10
beq :noext
tsb :flags
ldy #22
ldy #o_labprev
lda [lableptr],y
sta :refnum
lda #$8000
@ -3215,7 +3251,7 @@ define ldy #$00
sta fllast
jsr findlable
bcc :p0insert
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #variablebit
bne :p0var
@ -3224,15 +3260,15 @@ define ldy #$00
bit macflag-1
bvs :p0insert
jmp :dup
:p0var ldy #16
:p0var ldy #o_labnum
lda [lableptr],y
sta linelable
ldy #28
ldy #o_labval
lda [lableptr],y
sta varval
lda objptr
sta [lableptr],y
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta varval+2
lda objptr+2
@ -3244,7 +3280,7 @@ define ldy #$00
sta labval+2
jsr insertlable
bcs :err ;error returned in A
ldy #16
ldy #o_labnum
lda [lableptr],y
sta linelable
stz varval
@ -3257,39 +3293,39 @@ define ldy #$00
sta fllast
jsr findlable
bcc :undef ;not found on second pass
ldy #16
ldy #o_labnum
lda [lableptr],y
sta linelable
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #variablebit
bne :p1var
bit #$20.$10.$08.$04.$01.linkerbit ;ext,macvar,macro,
beq :checkmis ; locals, or linkerequ's
jmp :noerr
:p1var ldy #28
:p1var ldy #o_labval
lda [lableptr],y
sta varval
lda objptr
sta [lableptr],y
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta varval+2
lda objptr+2
sta [lableptr],y
jmp :noerr
:checkmis ldy #28
:checkmis ldy #o_labval
lda [lableptr],y
cmp objptr
bne :misal
ldy #30
ldy #o_labval+2
lda [lableptr],y
cmp objptr+2
beq :noerr
:misal ldy #28
:misal ldy #o_labval
lda [lableptr],y ;reset object pointer so we don't
sta objptr ;generate more misalign errors
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta objptr+$2
pea #misalignment
@ -3302,13 +3338,13 @@ define ldy #$00
:xit rep $30
bit linelable
bmi :geterr
ldy #26
ldy #o_labtype
lda [lableptr],y
and #%111111.linkerbit ;no macvars,externals,equates,macros,variables,
bne :geterr ;locals or linkerequ's...
lda globlab
sta oldglob
ldy #16
ldy #o_labnum
lda [lableptr],y
sta globlab
lda #$0080
@ -3382,7 +3418,7 @@ findlable
iny
lda [lableptr1],y
sta lableptr+2
ldy #24
ldy #o_lablocal
lda [lableptr],y
bmi :notfound ;none defined
sta ]pos
@ -3406,12 +3442,12 @@ findlable
sta lableptr+2
stz ]offset
lda [lableptr]
and #$0f
and #label_mask
sta ]len2
sep $20
ldx #$02 ;start at byte 2
txy
]lup1 cpx #$10
]lup1 cpx #lab_size+1
bge :movefound
cpx ]len1
blt :1
@ -3438,13 +3474,13 @@ findlable
cmp ]len2
beq :movefound
:goleft rep $30
ldy #18
ldy #o_lableft
lda [lableptr],y
bmi :nf1
sta ]pos
jmp ]lup
:goright rep $30
ldy #20
ldy #o_labright
lda [lableptr],y
bmi :nf1
sta ]pos
@ -3535,7 +3571,7 @@ insertlable
iny
lda [lableptr1],y
sta lableptr+2
ldy #24
ldy #o_lablocal
lda [lableptr],y
jpl :start
lda globlab
@ -3553,7 +3589,7 @@ insertlable
iny
lda [lableptr1],y
sta lableptr+2
ldy #24
ldy #o_lablocal
lda lablect
sta [lableptr],y ;set local ptr for GLable
jmp :save
@ -3599,7 +3635,7 @@ insertlable
stz ]len2+1
ldx #$02 ;start at byte 2
txy
]lup1 cpx #$10
]lup1 cpx #lab_size+1
jeq :error2
cpx ]len1
blt :1
@ -3622,7 +3658,7 @@ insertlable
lda ]len1
cmp ]len2
bne :goleft
:replace ldy #26 ;offset to equ value
:replace ldy #o_labtype ;offset to equ value
lda labtype
sta [lableptr],y
iny
@ -3636,7 +3672,7 @@ insertlable
sta [lableptr],y
jmp :nosave
:goleft rep $30
ldy #18 ;leftptr
ldy #o_lableft ;leftptr
lda [lableptr],y
bpl :p1
lda lablect
@ -3645,7 +3681,7 @@ insertlable
:p1 sta ]pos
jmp ]lup
:goright rep $30
ldy #20 ;leftptr
ldy #o_labright ;rightptr
lda [lableptr],y
bpl :p2
lda lablect
@ -3700,11 +3736,11 @@ insertlable
clc
adc #labstr
tax ;source low word
lda #31 ;MVN
lda #sym_size-1 ;MVN
phb
:mvn mvn $000000,$000000
plb
ldy #26
ldy #o_labtype
lda [lableptr],y
bpl :and
inc rellabct
@ -3744,7 +3780,7 @@ insertlable
sta ]len2
ldy #$02
tyx ;start at byte 2
]lup1 cpx #$10
]lup1 cpx #lab_size+1
jeq :error2
cpx ]len1
blt :fi1
@ -3768,7 +3804,7 @@ insertlable
cmp ]len2
bne :figoleft
:fireplace rep $30
ldy #26 ;offset to equ value
ldy #o_labtype ;offset to equ value
lda labtype
sta [lableptr],y
iny
@ -3782,10 +3818,10 @@ insertlable
sta [lableptr],y
jmp :nosave
:figoright rep $30
ldy #20
ldy #o_labright
jmp :figo
:figoleft rep $30
ldy #18
ldy #o_lableft
:figo lda lablect
sta [lableptr],y
jmp :save
@ -3853,7 +3889,7 @@ drawlables php
iny
lda [lableptr1],y
sta lableptr+2
ldy #18
ldy #o_lableft
lda #'R'
sta :char
lda [lableptr],y
@ -3865,7 +3901,7 @@ drawlables php
:next1 jsr :print
lda #'R'
sta :char
ldy #20
ldy #o_labright
lda [lableptr],y
bmi :done
pha
@ -3885,7 +3921,7 @@ drawlables php
:print ldy #$00
sty :offset
lda [lableptr],y
and #$0F
and #label_mask
sta :len
sta :bytes
bne :p1
@ -3938,7 +3974,7 @@ drawlables php
cpx :len
blt ]lup
beq ]lup
lda #$14
lda #lab_size+5
sec
sbc :bytes
tax
@ -3950,7 +3986,7 @@ drawlables php
bpl ]lup
lda #'$'
jsr drawchar
ldy #28+2
ldy #o_labval+2
ldx #$03
]lup lda [lableptr],y
and #$FF
@ -3968,7 +4004,7 @@ drawlables php
jsr drawchar
lda :offset
clc
adc #26
adc #o_labtype
tay
lda [lableptr],y
jsr prbytel
@ -3976,14 +4012,14 @@ drawlables php
jsr drawchar
lda :offset
clc
adc #16
adc #o_labnum
tay
lda [lableptr],y
jsr prbytel
lda #$0D
jsr drawchar
ldy #24 ;offset to local labels
ldy #o_lablocal ;offset to local labels
lda [lableptr],y
bmi :rts
pha

View File

@ -257,15 +257,15 @@ macop sep $30
plx
cmp #' '+1
blt :slab
cpx #$0f
cpx #lab_size
bge :siny
sta labstr+1,x
:siny iny
inx
jmp ]l
:slab cpx #$10
:slab cpx #lab_size+1
blt :slab1
ldx #$0f
ldx #lab_size
:slab1 stx labstr
lda #$ff
sta linelable
@ -310,14 +310,14 @@ macop sep $30
pea #symfull
jmp :error
:init ldy #26
:init ldy #o_labtype
lda #$8004
sta [lableptr],y
ldy #28
ldy #o_labval
lda nextlableptr
sta [lableptr],y
tax
ldy #30
ldy #o_labval+2
lda nextlableptr+2
sta [lableptr],y
sta lableptr+2
@ -351,7 +351,7 @@ macop sep $30
sta [lableptr],y
ldy #6
sta [lableptr],y
ldy #26
ldy #o_labtype
sta [lableptr],y
jsr inclablect
bcs :err1
@ -384,7 +384,7 @@ pmcop php
dey
ldx #$00
]lup lda [lineptr],y
cpx #15
cpx #lab_size
bge :c1
sta labstr+1,x
:c1 cmp #' '+1
@ -395,14 +395,14 @@ pmcop php
beq :ok1
inx
iny
cpx #$10
cpx #lab_size+1
blt ]lup
bra :ok
:ok1 iny
:ok txa
cmp #$10
cmp #lab_size+1
blt :ls
lda #$0f
lda #lab_size
:ls sta labstr
sty :y
sep $30
@ -415,7 +415,7 @@ pmcop php
* bcc :builtin ;not found so try built in macs
bcc :sec
rep $30
ldy #26
ldy #o_labtype
lda [lableptr],y
cmp #absolutebit.macrobit
bne :notmac
@ -581,7 +581,7 @@ initmac php
sta macstack+6,x
lda lastlen
sta macstack+8,x
ldy #16
ldy #o_labnum
lda [lableptr],y
sta macstack+10,x
@ -590,10 +590,10 @@ initmac php
sta flen
sta flen+2
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta workspace+2
ldy #28
ldy #o_labval
lda [lableptr],y
sta workspace
ldy #2
@ -667,66 +667,55 @@ getvars
:flush lda (lineptr),y
cmp #' '
jlt :move
beq :finy
cmp #';'
bne :first
jmp :move
:finy iny
jmp :flush
:first cmp #$22
beq :literal
cmp #$27
bne :giny
:literal sta ]lit
:giny sta macvars,x
* jsr :print
dec ]ct
inx
bne :f0
iny
:loop lda (lineptr),y
cmp #' '
bra :flush
:f0
jlt :move
cmp #';'
jeq :move
:first cmp #$22
beq :q
cmp #$27
beq :q
:loop
sta macvars,x
dec ]ct
beq :badvar
iny
inx
lda (lineptr),y
cmp #' '+1
blt :done
beq :checklit
cmp #';'
beq :semi
cmp ]lit
beq :littog
cmp #$27
beq :lit1
cmp #$22
bne :x1
:lit1 sta ]lit
:x1 xba
:sta1 lda ]ct
beq :badvar
xba
beq :q
cmp #$27
beq :q
bra :loop
:q sta ]lit
:qloop
sta macvars,x
* jsr :print
dec ]ct
beq :badvar
iny
inx
dec ]ct
jmp :loop
:checklit xba
lda ]lit
bne :sta1
jmp :done
:littog xba
lda ]lit
bne :loff
xba
sta ]lit
xba
jmp :sta1
:loff stz ]lit
jmp :sta1
lda (lineptr),y
cmp #' '
blt :done
cmp ]lit
beq :loop
bra :qloop
:done sec
ror ]done
:semi xba
lda ]lit
bne :sta1
:next stz macvars,x
* jsr :printcr
:semi stz macvars,x
inx
iny
dec ]ct
@ -904,7 +893,7 @@ expandmac php
blt :cpx
cmp #'>'+1
blt :errbl1 ;"<=>" not allowed either..
:cpx cpx #$0f
:cpx cpx #lab_size
bge :gliny
sta labstr+1,x
inx
@ -917,9 +906,9 @@ expandmac php
:fjmp jmp :flushiny
:sjmp jmp :savlen
:glabdone cpx #$10
:glabdone cpx #lab_size+1
blt :gl2
ldx #$0f
ldx #lab_size
:gl2 stx labstr
cmp #' '
bge :getopcode
@ -1541,10 +1530,10 @@ macinsert
iny
lda [lableptr1],y
sta lableptr+2
ldy #28
ldy #o_labval
lda [lableptr],y
sta ]ptr
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta ]ptr+2
ldy #$04
@ -1553,7 +1542,7 @@ macinsert
ldy #$06
:py2 lda []ptr],y
sta :count
ldy #24
ldy #o_lablocal
lda [lableptr],y
jpl :start
lda macstack+10,x
@ -1562,7 +1551,7 @@ macinsert
jmp :error
:ne3 sta ]pos
sta labprev
ldy #24
ldy #o_lablocal
lda lablect
sta [lableptr],y ;set local ptr for GLable
:save rep $30
@ -1593,7 +1582,7 @@ macinsert
stz ]len2+1
ldx #$02 ;start at byte 2
txy
]lup1 cpx #$10
]lup1 cpx #lab_size+1
jeq :error2
cpx ]len1
blt :1
@ -1616,7 +1605,7 @@ macinsert
lda ]len1
cmp ]len2
bne :goleft
:replace ldy #22 ;offset to equ value
:replace ldy #o_labprev ;offset to equ value
lda [lableptr],y
:rl tay
iny
@ -1659,7 +1648,7 @@ macinsert
sta [macptr],y
jmp :nosave
:goleft rep $30
ldy #18 ;leftptr
ldy #o_lableft ;leftptr
lda [lableptr],y
bpl :p1
lda lablect
@ -1668,7 +1657,7 @@ macinsert
:p1 sta ]pos
jmp ]lup
:goright rep $30
ldy #20 ;leftptr
ldy #o_labright ;rightptr
lda [lableptr],y
bpl :p2
lda lablect
@ -1742,7 +1731,7 @@ macinsert
clc
adc #labstr
tax ;source low word
lda #31 ;MVN
lda #sym_size-1 ;MVN
phb
:mvn mvn $000000,$000000
plb
@ -1798,14 +1787,14 @@ macfind
iny
lda [lableptr1],y
sta lableptr+2
ldy #24
ldy #o_lablocal
lda [lableptr],y
jmi :nf1
sta ]pos
ldy #28
ldy #o_labval
lda [lableptr],y
tax
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta lableptr+2
stx lableptr
@ -1828,12 +1817,12 @@ macfind
sta lableptr+2
stz ]offset
lda [lableptr]
and #$0f
and #label_mask
sta ]len2
sep $20
ldx #$02 ;start at byte 2
txy
]lup1 cpx #$10
]lup1 cpx #lab_size+1
bge :movefound
cpx ]len1
blt :1
@ -1858,13 +1847,13 @@ macfind
cmp ]len2
beq :movefound
:goleft rep $30
ldy #18
ldy #o_lableft
lda [lableptr],y
bmi :nf1
sta ]pos
jmp ]lup
:goright rep $30
ldy #20
ldy #o_labright
lda [lableptr],y
bmi :nf1
sta ]pos
@ -1883,7 +1872,7 @@ macfind
iny
lda [lableptr1],y
sta lableptr+2
ldy #22
ldy #o_labprev
lda [lableptr],y
:lup tay
iny
@ -1903,10 +1892,10 @@ macfind
iny
iny
lda [macptr],y
ldy #30
ldy #o_labval+2
sta [lableptr],y
txa
ldy #28
ldy #o_labval
sta [lableptr],y
plp
sec

View File

@ -694,7 +694,7 @@ writerel php ;must enter
ldy #$00
stz :offset
lda [lableptr]
and #$0F
and #label_mask
bne :stalen
inc :main
jmp :loop
@ -702,7 +702,7 @@ writerel php ;must enter
clc
adc #4
sta :request
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #entrybit.externalbit
jeq :rts
@ -720,7 +720,7 @@ writerel php ;must enter
blt ]lup
rep $30
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #entrybit
bne :ent1
@ -741,7 +741,7 @@ writerel php ;must enter
bpl :value
lda #$20
tsb :len
:value ldy #28
:value ldy #o_labval
lda :len
and #%00011111
tax
@ -757,7 +757,7 @@ writerel php ;must enter
rep $20
and #$80
beq :writeit
ldy #22
ldy #o_labprev
lda [lableptr],y
and #$00ff
ora :buffer+1,x

View File

@ -373,7 +373,7 @@ doflags php
iny
lda [lableptr1],y
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #externalbit
beq :y
@ -391,7 +391,7 @@ doflags php
iny
lda [lableptr1],y
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #externalbit
beq :test
@ -1285,9 +1285,9 @@ getnum php
:xc1 jmp :doxc ;y still on stack!
:pc iny
rep $30
lda lineobjptr
lda pcobjptr
sta val
lda lineobjptr+$2
lda pcobjptr+$2
sta val+$2
lda modeflag
bit #relflag
@ -1323,16 +1323,16 @@ getnum php
* lda evallevel ;don't need to do this here
* bne :lxit ;unless level>256
lda #'}'
:iny cpx #$0f
:iny cpx #lab_size
bge :iny1
sta labstr+1,x
:iny1 iny
inx
jmp ]lup
:lxit txa
cmp #$0f+1
cmp #lab_size+1
blt :lx
lda #$0f
lda #lab_size
:lx sta labstr
sty :next
jsr findlabval
@ -1348,13 +1348,13 @@ getnum php
:errlab lda #undeflable
jmp :errxit
:lfound rep $30
ldy #26
ldy #o_labtype
lda [lableptr],y
pha
ldy #16
ldy #o_labnum
lda [lableptr],y
pha
ldy #26
ldy #o_labtype
lda [lableptr],y
ora #$2000 ;indicate used!
sta [lableptr],y
@ -1374,15 +1374,15 @@ getnum php
beq :labcont
bit #dumflag
bne :labcont
ldy #16
ldy #o_labnum
lda [lableptr],y
sta zrel
:labcont rep $30
:lsta1 ldy #28
:lsta1 ldy #o_labval
lda [lableptr],y
sta val
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta val+2
jmp :lbxit

View File

@ -12,6 +12,7 @@
use ../macros/builtin.macs
use ../macros/qatools.macs
use ../data/qa.equates
use ../data/sym.equates
use asm.macs

View File

@ -1043,14 +1043,14 @@ equate php
bpl :normal
jsr findlable
bcc :bl
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #equatebit
beq :normal
ldy #28
ldy #o_labval
lda [lableptr],y
sta :oldval
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta :oldval+2
ldx #$00
@ -1071,13 +1071,13 @@ equate php
bpl :ok
jsr findlable
bcc :bl
ldy #28
ldy #o_labval
lda [lableptr],y
sta :oldval
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta :oldval+2
ldy #16
ldy #o_labnum
sty :foundflag
lda [lableptr],y
jmp :ok
@ -1104,7 +1104,7 @@ equate php
and #%01100000
beq :nomac
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #variablebit
bne :nomac
@ -1129,7 +1129,7 @@ equate php
tyx
sta labstr,x
iny
cpy #16
cpy #lab_size+1
blt ]lup
plp
jmp insertlable
@ -1146,17 +1146,17 @@ equate php
tyx
sta labstr,x
iny
cpy #16
cpy #lab_size+1
blt ]lup
jsr findlable
bcs :macp21
pea #undeflable
jmp :err
:macp21 rep $30
ldy #28
ldy #o_labval
lda [lableptr],y
sta equateval
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta equateval+2
jmp :noerr
@ -1168,14 +1168,14 @@ equate php
sta lableptr
lda :ptr+2
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #variablebit
beq :eval
ldy #28
ldy #o_labval
lda varval
sta [lableptr],y
ldy #30
ldy #o_labval+2
lda varval+2
sta [lableptr],y
:eval ldx #$00
@ -1187,14 +1187,14 @@ equate php
sta lableptr
lda :ptr+2
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
and #variablebit
beq :equval
ldy #28
ldy #o_labval
lda varval
sta [lableptr],y
ldy #30
ldy #o_labval+2
lda varval+2
sta [lableptr],y
ldx #$00
@ -1204,7 +1204,7 @@ equate php
sta lableptr
lda :ptr+2
sta lableptr+2
:entry ldy #26
:entry ldy #o_labtype
lda [lableptr],y
and #$7FFF
ora #equatebit
@ -1220,10 +1220,10 @@ equate php
iny
lda lvalue+2
sta [lableptr],y
:equval ldy #28
:equval ldy #o_labval
lda [lableptr],y
sta equateval
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta equateval+2
:noerr pea $00
@ -1235,11 +1235,11 @@ equate php
lda merrcode
cmp #duplable
bne :epla
ldy #28
ldy #o_labval
lda [lableptr],y
cmp :oldval
bne :epla
ldy #30
ldy #o_labval+2
lda [lableptr],y
cmp :oldval+2
bne :epla
@ -1333,14 +1333,14 @@ equeval php
jsr findlable
bcc :readkey
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #linkerbit
beq :duplicate
ldy #28
ldy #o_labval
lda [lableptr],y
sta lvalue
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta lvalue+2
lda #$00 ;0 here if linker passed value
@ -1397,7 +1397,7 @@ extop
iny
lda [lableptr1],y
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
and #%11111
bne :bad
@ -1409,7 +1409,7 @@ extop
sec
rts
:equ stz :offset
ldy #26 ;point to type
ldy #o_labtype ;point to type
lda [lableptr],y
bit #%1100_0000_0011_1111
bne :bad
@ -1417,7 +1417,7 @@ extop
ora #externalbit
sta [lableptr],y
phy
ldy #22
ldy #o_labprev
lda extcount
sta [lableptr],y
inc extcount
@ -1458,16 +1458,16 @@ extop
beq :insert
cmp #';'
beq :insert
cpx #15
cpx #lab_size
bge :iny
sta labstr+1,x
:iny iny
inx
jmp ]lup
:insert txa
cmp #$10
cmp #lab_size+1
blt :ls
lda #$0f
lda #lab_size
:ls sta labstr
rep $30
sty :ypos
@ -1480,7 +1480,7 @@ extop
dec fllast
jcs :gerr1
stz :offset
ldy #26 ;point to type
ldy #o_labtype ;point to type
lda [lableptr],y
bit #%1100_0000_0011_1111
bne :gerr
@ -1488,7 +1488,7 @@ extop
ora #externalbit
sta [lableptr],y
phy
ldy #22
ldy #o_labprev
lda extcount
sta [lableptr],y
inc extcount
@ -1546,7 +1546,7 @@ exdop
iny
lda [lableptr1],y
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
and #%11111
bne :bad
@ -1558,7 +1558,7 @@ exdop
sec
rts
:equ stz :offset
ldy #26 ;point to type
ldy #o_labtype ;point to type
lda [lableptr],y
bit #%1100_0000_0011_1111
bne :bad
@ -1566,7 +1566,7 @@ exdop
ora #externalbit
sta [lableptr],y
phy
ldy #22
ldy #o_labprev
lda extcount
sta [lableptr],y
inc extcount
@ -1607,16 +1607,16 @@ exdop
beq :insert
cmp #';'
beq :insert
cpx #15
cpx #lab_size
bge :iny
sta labstr+1,x
:iny iny
inx
jmp ]lup
:insert txa
cmp #$10
cmp #lab_size+1
blt :ls
lda #$0f
lda #lab_size
:ls sta labstr
rep $30
sty :ypos
@ -1629,7 +1629,7 @@ exdop
dec fllast
jcs :gerr1
stz :offset
ldy #26 ;point to type
ldy #o_labtype ;point to type
lda [lableptr],y
bit #%1100_0000_0011_1111
bne :gerr
@ -1637,7 +1637,7 @@ exdop
ora #externalbit
sta [lableptr],y
phy
ldy #22
ldy #o_labprev
lda extcount
sta [lableptr],y
inc extcount
@ -1673,8 +1673,6 @@ exdop
entop
]len equ workspace
lda passnum
bne :xit
lda macflag
bit #%01100000
beq :nomac
@ -1684,6 +1682,9 @@ entop
:nomac
lda linelable
bmi :group
* label ent - first pass only.
ldx passnum
bne :xit
asl
asl
tay
@ -1693,7 +1694,7 @@ entop
iny
lda [lableptr1],y
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
and #macvarbit.externalbit.macrobit.variablebit.localbit
bne :bad
@ -1705,13 +1706,13 @@ entop
sec
rts
:equ stz :offset
ldy #26 ;point to type
ldy #o_labtype ;point to type
lda [lableptr],y
and #usedbit.absolutebit.equatebit
ora #entrybit
sta [lableptr],y
phy
ldy #22
ldy #o_labprev
lda entcount
sta [lableptr],y
inc entcount
@ -1762,7 +1763,10 @@ entop
trb orgor
jmp :xit
* ent label[,label] - second pass only.
:group1 rep $30
ldx passnum
beq :xit
sep $20
ldy #$FFFF
]lup iny
@ -1790,29 +1794,26 @@ entop
beq :insert
cmp #';'
beq :insert
cpx #15
cpx #lab_size
bge :iny
sta labstr+1,x
:iny iny
inx
jmp ]lup
:insert txa
cmp #$10
cmp #lab_size+1
blt :ls
lda #$0f
lda #lab_size
:ls sta labstr
rep $30
sty :ypos
lda #$ffff
sta fllast
jsr findlable
bcs :or
jsr insertlable
stz fllast
dec fllast
jcs :gerr1
:or stz :offset
ldy #26 ;point to type
bcc :gerr3
stz :offset
ldy #o_labtype ;point to type
lda [lableptr],y
and #macvarbit.externalbit.macrobit.variablebit.localbit
bne :gerr
@ -1820,7 +1821,7 @@ entop
and #usedbit.absolutebit.equatebit
ora #entrybit ;entry lable
sta [lableptr],y
ldy #22
ldy #o_labprev
lda entcount
sta [lableptr],y
inc entcount
@ -1837,6 +1838,9 @@ entop
:gerr rep $30
lda #badlable
jmp :gerr1
:gerr3 rep $30
lda #undeflable
jmp :gerr1
:gerr2 rep $30
lda #duplable
:gerr1 rep $30
@ -2420,6 +2424,12 @@ dwop php
lda lvalue+$1
jsr putbyte
jsr relcorrect
rep $30
lda objptr
sta pcobjptr
lda objptr+2
sta pcobjptr+2
sep $30
plx
txy
lda (lineptr),y
@ -2471,6 +2481,12 @@ dfbop php
lda lvalue
jsr putbyte
jsr relcorrect
rep $30
lda objptr
sta pcobjptr
lda objptr+2
sta pcobjptr+2
sep $30
plx
txy
lda (lineptr),y
@ -2511,6 +2527,10 @@ ddbop ldx #$00
jsr putbyte
lda passnum
beq :jmp
lda objptr
sta pcobjptr
lda objptr+2
sta pcobjptr+2
lda modeflag
bit #relflag
beq :jmp
@ -2531,11 +2551,11 @@ ddbop ldx #$00
lda [lableptr1],y
sta lableptr+2
stz :offset
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #externalbit
beq :internal
ldy #22
ldy #o_labprev
lda [lableptr],y
and #$00ff
sta noshift+1
@ -2622,6 +2642,12 @@ adrop php
lda lvalue+2
jsr putbyte
jsr relcorrect
rep $30
lda objptr
sta pcobjptr
lda objptr+2
sta pcobjptr+2
sep $30
plx
txy
lda (lineptr),y
@ -2680,6 +2706,12 @@ adrlop php
lda lvalue+$3
jsr putbyte
jsr relcorrect
rep $30
lda objptr
sta pcobjptr
lda objptr+2
sta pcobjptr+2
sep $30
plx
txy
lda (lineptr),y
@ -4525,7 +4557,7 @@ varop lda macflag
dec fllast
bcc :eval
rts
:eval ldy #16
:eval ldy #o_labnum
lda [lableptr],y
sta :label
lda #$ffff
@ -4545,7 +4577,7 @@ varop lda macflag
iny
lda [lableptr1],y
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
and #$7FFF
bit lableused

View File

@ -79,7 +79,7 @@ absolutebit = %1000_0000_0000_0000
*** Assembly Zpage Equates ***
dum $00
labstr ds 16 ;Lable STR that we are working on
labstr ds lab_size+1 ;Lable STR that we are working on
labnum ds 2 ;REC num of current lable
lableft ds 2 ;B-Tree Structures
labright ds 2
@ -93,7 +93,7 @@ lineptr ds 4
printptr ds 4
linelable ds 2
linehaslab ds 2
linelabtxt ds 16,0
*linelabtxt ds lab_size+1,0
linenum ds 2
totallines ds 2
@ -187,6 +187,7 @@ lvalue ds 4
myvalue ds 4
noshift ds 4
lineobjptr ds 4
pcobjptr ds 4
xreg ds 4 ;variables used by EVAL
yreg ds 4
@ -324,6 +325,8 @@ atable ds 128*2,0
titlestr ds 256,0
linelabtxt ds lab_size+1,0
converttable
hex 00000000000000000000000000000000
hex 00000000000000000000000000000000

15
src/data/sym.equates.S Normal file
View File

@ -0,0 +1,15 @@
dum 0
lab_size equ 31
label_mask equ 31
o_labstr ds lab_size+1 ; 0
o_labnum ds 2 ; 32
o_lableft ds 2 ; 34
o_labright ds 2 ; 36
o_labprev ds 2 ; 38
o_lablocal ds 2 ; 40
o_labtype ds 2 ; 42
o_labval ds 4 ; 44
sym_size equ *
dend

View File

@ -15,6 +15,7 @@ linkerror php
_QASetWindow
_QAIncTotalErrs
lda :errcode
cmp #constraint
jeq :xit
cmp #notresolved
@ -122,6 +123,7 @@ errtbl dw syntax,str1
dw badasmcmd,str2
dw badcmd,str3
dw badlable,str4
dw badlable.$80,str4
dw outofmem,str5
dw undeflable,str6
dw badoperand,str7

View File

@ -367,7 +367,7 @@ doflags php
iny
lda [lableptr1],y
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #externalbit
beq :y
@ -385,7 +385,7 @@ doflags php
iny
lda [lableptr1],y
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #externalbit
beq :test
@ -1244,16 +1244,16 @@ getnum php
* lda evallevel ;don't need to do this here
* bne :lxit ;unless level>256
lda #'}'
:iny cpx #$0f
:iny cpx #lab_size
bge :iny1
sta labstr+1,x
:iny1 iny
inx
jmp ]lup
:lxit txa
cmp #$0f+1
cmp #lab_size+1
blt :lx
lda #$0f
lda #lab_size
:lx sta labstr
sty :next
jsr findlable
@ -1269,12 +1269,12 @@ getnum php
:errlab lda #undeflable
jmp :errxit
:lfound rep $30
ldy #26
ldy #o_labtype
lda [lableptr],y
pha
ldy #16
ldy #o_labnum
lda [lableptr],y
ldy #26
ldy #o_labtype
lda [lableptr],y
ora #linkusedbit ;indicate used!
sta [lableptr],y
@ -1294,16 +1294,16 @@ getnum php
beq :labcont
bit #dumflag
bne :labcont
ldy #16
ldy #o_labnum
lda [lableptr],y
sta zrel
fin
:labcont rep $30
:lsta1 ldy #28
:lsta1 ldy #o_labval
lda [lableptr],y
sta val
ldy #30
ldy #o_labval+2
lda [lableptr],y
sta val+2
:lbxit ldy :next

View File

@ -14,6 +14,7 @@ doexpress = $01
use ../macros/builtin.macs
use ../macros/qatools.macs
use ../data/qa.equates
use ../data/sym.equates
use link.macs
@ -281,16 +282,16 @@ doquicklink php
ply
jcs :sec
:go phx
phy
:go phy
phx
:go1 psl #:quickstr
_QADrawString
lda #$FFFF
sta quicklink
psl #:zero
_QASetObjPath
ply
plx
ply
jsl link
bcc :clc
jmp :sec

View File

@ -106,7 +106,7 @@ srelocsize ds 4
**** DP storage ****
dum $00
zpage ds 4
labstr ds 16 ;Lable STR that we are working on
labstr ds lab_size+1 ;Lable STR that we are working on
labnum ds 2 ;REC num of current lable
lableft ds 2 ;B-Tree Structures
labright ds 2
@ -114,7 +114,7 @@ labprev ds 2
lablocal ds 2 ;REC of Local Lable Tree
labtype ds 2 ;Type of Label
labval ds 4 ;EQU value of Lable
foundlable ds 32 ;lable REC returned from FINDLABLE
*foundlable ds sym_size ;lable REC returned from FINDLABLE
globlab ds 2 ;REC of Current Global Lable
myvalue ds 4
lvalue ds 4
@ -178,6 +178,7 @@ here = *
err */$100
dend
foundlable ds sym_size ;lable REC returned from FINDLABLE
asmpath ds 130,0
rezpath ds 130,0
@ -251,6 +252,9 @@ linksymnum ds 2
linknextlbl ds 4
linkpos ds 4 ; pos / len
linklen ds 2
opmask ds 2 ;EVAL variables
number ds 2
bracevalid ds 2
@ -261,10 +265,10 @@ offset ds 2
*shiftct ds 2
errlable ds 16,0
errlable ds lab_size+1,0
errpos ds 2
newlable ds 18,0
newlable ds lab_size+3,0
segheader
bytecnt ds 4

View File

@ -415,15 +415,15 @@ linkline php
cmp #' '
blt :done
beq :lable
cpx #15
cpx #lab_size
bge :nosta
sta newlable+1,x
:nosta inx
jmp ]lup
:lable txa
cmp #15
cmp #lab_size
blt :l1
lda #15
lda #lab_size
:l1 sta newlable
jmp :op
@ -496,12 +496,15 @@ getopcode
blt ]lup
beq ]lup
dex
:done lda #$2020
:done lda #$2020 ;truncate to 3 bytes max
sta opcode+$1,Y
sta opcode+4
tya
and #$1F
sep $20
sta opcode
cmp #4
bcc :3
lda #3
:3 sta opcode
]flush lda linebuff,x
cmp #' '
bne :tya
@ -1008,9 +1011,9 @@ equop bit passnum
lda newlable
and #$ff
beq :badlable
cmp #15
cmp #lab_size
blt :tx1
lda #15
lda #lab_size
:tx1 tax
sep $20
sta labstr
@ -1048,9 +1051,9 @@ equ1op bit passnum
lda newlable
and #$ff
beq :badlable
cmp #15
cmp #lab_size
blt :tx1
lda #15
lda #lab_size
:tx1
tax
sep $20
@ -1089,36 +1092,107 @@ zipop lda passnum
clc
rts ;return error from newsegment
posop ;I don't know what these do
lenop clc ;or how Merlin uses them so....?????
* read label from operand into labstr.
getlabel
stz labstr
sep $20
ldy #0
ldx #0
]flush lda (lineptr),y
and #$7f
cmp #' '
blt :done
bne :first
iny
bra ]flush
:first cmp #';'
beq :done
cmp #'*'
beq :done
cmp #':'+1
blt :bad
cmp #']'
beq :bad
sta labstr+1
inx
]lup iny
lda (lineptr),y
and #$7f
cmp #' '+1
blt :done
cpx #lab_size
bcs ]lup
sta labstr+1,x
inx
bra ]lup
:done txa
sta labstr
rep $30
clc
rts
:bad rep $30
sec
lda #badlable.$80
rts
extop bit passnum
* len label
* set label = length of last lnk
lenop bit passnum
bpl :equ
:rts clc
rts
:equ jsr getlabel
bcc :ok
rts
:ok lda labstr
and #$ff
beq :rts
lda linklen
sta labval
stz labval+2
lda #linkentrybit.linkabsbit
jmp insertlable
* pos label
* set label = current linker offset.
* resets offset to 0 if no label.
posop bit passnum
bpl :equ
clc
rts
:equ lda newlable
and #$ff
bne :equ1
clc
rts
:equ1 clc
rts
do 0
ldx #$00
jsr eval
:equ jsr getlabel
bcc :ok
rts
:ok lda lvalue
sta labval
lda lvalue+2
sta labval+2
lda newlable
:ok lda labstr
and #$ff
beq :badlable
cmp #15
beq :zero
lda linkpos
sta labval
lda linkpos+2
sta labval+2
lda #linkentrybit.linkabsbit
jmp insertlable
:zero stz linkpos
stz linkpos+2
clc
rts
* label ext
* import an absolute label into the local symbol table.
extop bit passnum
bpl :equ
:rts clc
rts
:equ lda newlable
and #$ff
beq :rts
cmp #lab_size
blt :tx1
lda #15
lda #lab_size
:tx1
tax
sep $20
@ -1134,14 +1208,29 @@ extop bit passnum
cmp #']'
beq :badlable
rep $20
lda #linkgeqbit
jsr insertlable
rts
:badlable rep $30
jsr findlable
bcs :found
:badlable rep #$30
lda #badlable.$80
sec
rts
fin
:found
lda foundlable+o_labtype
and #linkentrybit.linkabsbit
cmp #linkentrybit.linkabsbit
bne :badlable
ldy #o_labtype
lda [lableptr],y
ora #linkgeqbit
sta [lableptr],y
clc
rts
geqop bit passnum
bpl :equ
@ -1158,9 +1247,9 @@ geqop bit passnum
lda newlable
and #$ff
beq :badlable
cmp #15
cmp #lab_size
blt :tx1
lda #15
lda #lab_size
:tx1
tax
sep $20
@ -1199,9 +1288,9 @@ kbdop bit passnum
lda newlable
and #$ff
beq :badlable
cmp #15
cmp #lab_size
blt :tx1
lda #15
lda #lab_size
:tx1
tax
sep $20
@ -1481,6 +1570,15 @@ impop sec
lda #$00
adc reloffset+2
sta reloffset+2
lda :aux
sta linklen
clc
adc linkpos
sta linkpos
lda #$00
adc linkpos+2
sta linkpos+2
:l psl :handle
_HUnlock
lda #$00
@ -1541,7 +1639,7 @@ impop sec
and #$7f
cmp #':'
beq :set
cpx #16
cpx #lab_size+1
bge :inx
cmp #'.'
bne :sta
@ -1553,9 +1651,9 @@ impop sec
blt :loop2
beq :loop2
:set txa
cmp #15
cmp #lab_size
blt :set1
lda #15
lda #lab_size
:set1 sta labstr
rep $30
lda reloffset
@ -1565,7 +1663,7 @@ impop sec
lda #linkentrybit
jsr insertlable
bcs :sec
ldy #24
ldy #o_lablocal
lda segnum
sta [lableptr],y
plp
@ -1673,6 +1771,15 @@ lnkop sec
lda #$00
adc reloffset+2
sta reloffset+2
lda :aux
sta linklen
clc
adc linkpos
sta linkpos
lda #$00
adc linkpos+2
sta linkpos+2
bit :errvalid
bpl :l
lda :rel+2
@ -1797,7 +1904,7 @@ lnkop sec
bit :dsvalid
jpl :xit
ldy :dsy
lda :aux
lda :rel
and #$FF
eor #$FF
inc
@ -1817,6 +1924,15 @@ lnkop sec
psl :handle
_GetHandleSize
pll :size
sec
lda :size
sbc :aux
sta :rsize
lda :size+2
sbc #0
sta :rsize+2
lda :more
clc
adc :size
@ -1864,9 +1980,7 @@ lnkop sec
sta :dest+2
psl :src
psl :dest
pea $00
lda :more
pha
psl :rsize
_BlockMove
ldy :aux
ldx #$00
@ -1909,6 +2023,7 @@ lnkop sec
:dest ds 4
:byte ds 2
:temp ds 4
:rsize ds 4
:constrainterr php
rep $30
@ -2062,9 +2177,9 @@ buildentries
:abs ply
lda 1,s
and #%00011111
cmp #15
cmp #lab_size
blt :tx1
lda #15
lda #lab_size
:tx1
tay
tax
@ -2089,7 +2204,7 @@ buildentries
plp
sec
rts
:ok2 ldy #24
:ok2 ldy #o_lablocal
lda segnum
sta [lableptr],y
:next pla
@ -2457,11 +2572,11 @@ relocatefinal
sec
sbc #$8000
clc
adc foundlable+28
adc foundlable+o_labval
sta [tempptr],y
sta omfoff2
lda foundlable+26
and #$0020
lda foundlable+o_labtype
and #linkabsbit.linkgeqbit
jne :clc
lda #$02
sta omfbytes
@ -2540,13 +2655,13 @@ relocatefinal
sec
sbc #$8000
clc
adc foundlable+28
adc foundlable+o_labval
sta omfoff2
xba
sta [tempptr],y
lda foundlable+26
and #$0020
lda foundlable+o_labtype
and #linkabsbit.linkgeqbit
jne :clc
bit interseg
@ -2675,19 +2790,19 @@ relocatefinal
dey
lda :lowbyte
clc
adc foundlable+28
adc foundlable+o_labval
sta omfoff2
sty :omfy
sta [tempptr],y
iny
iny
lda :lowbyte+2
adc foundlable+30
adc foundlable+o_labval+2
sep $20
sta [tempptr],y
rep $20
lda foundlable+26
and #$0020 ;absolute lable?
lda foundlable+o_labtype
and #linkabsbit.linkgeqbit ;absolute lable?
jne :clc
bit interseg
@ -2782,13 +2897,13 @@ relocatefinal
lda [tempptr],y
and #$ff
clc
adc foundlable+28
adc foundlable+o_labval
sta omfoff2
sep $20
sta [tempptr],y
rep $20
lda foundlable+26
and #$0020
lda foundlable+o_labtype
and #linkabsbit.linkgeqbit
jne :clc
bit interseg
@ -2876,14 +2991,14 @@ relocatefinal
sec
sbc #$8000
clc
adc foundlable+28
adc foundlable+o_labval
sta omfoff2
xba
sep $20
sta [tempptr],y
rep $20
lda foundlable+26
and #$0020
lda foundlable+o_labtype
and #linkabsbit.linkgeqbit
jne :clc
bit interseg
@ -3035,30 +3150,35 @@ relocatefinal
clc
adc reloffset
sta omfoff1
lda foundlable+28
lda foundlable+o_labval
clc
adc :lowbyte
sta omfoff2
lda foundlable+30
lda foundlable+o_labval+2
adc :lowbyte+2
sep $20
sta [tempptr],y
rep $20
lda foundlable+26
and #$0020
lda foundlable+o_labtype
and #linkabsbit.linkgeqbit
jne :clc
lda #$f6
lda #$f5
sta omfcode
lda #$08
lda #$07
sta omflength
lda #$01
sta omfbytes
lda #-16
sta omfshift
bit interseg
bpl :ok3
inc omfcode
inc omflength
jsr isegwarning
jsr insertomf
:ok3 jsr insertomf
jmp :clc
:la4 ldy #$03
lda [tempptr1],y
and #$ff
@ -3083,32 +3203,37 @@ relocatefinal
clc
adc reloffset
sta omfoff1
lda foundlable+28
lda foundlable+o_labval
clc
adc :lowbyte
sta :lowbyte
sta omfoff2
lda foundlable+30
lda foundlable+o_labval+2
adc :lowbyte+2
sta :lowbyte+2
lda :lowbyte+1
sta [tempptr],y
lda foundlable+26
and #$0020
lda foundlable+o_labtype
and #linkabsbit.linkgeqbit
jne :clc
lda #$f6
lda #$f5
sta omfcode
lda #$08
lda #$07
sta omflength
lda #$02
sta omfbytes
lda #-8
sta omfshift
bit interseg
bpl :ok4
inc omfcode ; $f6
inc omflength
jsr isegwarning
jsr insertomf
:ok4 jsr insertomf
jmp :clc
:la5 jmp :b1hi
:clc plp
@ -3160,7 +3285,7 @@ getexternal php
jmp ]lup
:notfound rep $20
lda labstr
and #$0f
and #label_mask
tay
ldx #$01
]lup sep $20
@ -3207,9 +3332,9 @@ getexternal php
ldy :offset
lda [tempptr2],y
and #%00011111
cmp #15
cmp #lab_size
blt :tx1
lda #15
lda #lab_size
:tx1
sta :offset
ldx #$00
@ -3234,14 +3359,14 @@ getexternal php
sec
ror :cased
jmp :find
:itsfound ldy #26
:itsfound ldy #o_labtype
lda [lableptr],y
ora #linkentused
sta [lableptr],y
:itsfound2 lda foundlable+26
bit #linkentrybit
:itsfound2 lda foundlable+o_labtype
bit #linkentrybit.linkgeqbit
jeq :notfound
lda foundlable+24 ;get lable's seg number
lda foundlable+o_lablocal ;get lable's seg number
sta extseg
cmp segnum
beq :bit
@ -3252,7 +3377,7 @@ getexternal php
rep $20
:bit bit :zpage
bpl :clc
lda foundlable+29
lda foundlable+o_labval+1
beq :clc
lda #extnotzp
plp
@ -3414,7 +3539,7 @@ ovrop ldy #$00
and #$5f
cmp #'A'
beq :all
cmp #'F'
cmp #'O'
beq :off
cmp #';'
beq :one
@ -3558,6 +3683,9 @@ savop lda #$00
stz :ct
stz rellength
stz rellength+2
stz linklen
stz linkpos
stz linkpos+2
psl #:str
_QADrawString

View File

@ -322,7 +322,7 @@ jumpentry php
lda [segmentptr],y
sta segmentptr+2
stx segmentptr
lda foundlable+24
lda foundlable+o_lablocal
asl
asl
asl
@ -796,7 +796,7 @@ findlable
lda lablect
beq :notfound
lda labstr
and #$000F
and #label_mask
beq :notfound
sta ]len1
lda labstr+$1
@ -821,13 +821,13 @@ findlable
stz ]offset
ldy #$00
lda [lableptr],y
and #$0F
and #label_mask
sta ]len2
sep $20
iny
iny
ldx #$02 ;start at byte 2
]lup1 cpx #$10
]lup1 cpx #lab_size+1
bge :movefound
cpx ]len1
blt :1
@ -852,13 +852,13 @@ findlable
cmp ]len2
beq :movefound
:goleft rep $30
ldy #18 ;leftptr
ldy #o_lableft ;leftptr
lda [lableptr],y
bmi :notfound
sta ]pos
jmp ]lup
:goright rep $30
ldy #20 ;leftptr
ldy #o_labright ;rightptr
lda [lableptr],y
bmi :notfound
sta ]pos
@ -875,7 +875,7 @@ findlable
iny
lda [lableptr1],y
sta lableptr+2
ldy #26
ldy #o_labtype
lda [lableptr],y
bit #linkequbit
beq :ldy
@ -890,7 +890,7 @@ findlable
inx
iny
iny
cpx #32
cpx #sym_size
blt ]lup
:mfplp plp
sec
@ -955,7 +955,7 @@ insertlable
iny
iny
ldx #$02 ;start at byte 2
]lup1 cpx #$10
]lup1 cpx #lab_size+1
jeq :error
cpx ]len1
blt :1
@ -978,7 +978,7 @@ insertlable
lda ]len1
cmp ]len2
bne :goleft
:replace ldy #26 #26
:replace ldy #o_labtype
lda [lableptr],y
bit #linkequbit
beq :duperr
@ -990,7 +990,7 @@ insertlable
]mov lda labstr,x
sta errlable,x
inx
cpx #16
cpx #lab_size+1
blt ]mov
rep $30
lda labtype
@ -1020,11 +1020,11 @@ insertlable
sta foundlable,x
iny
iny
cpy #32
cpy #sym_size
blt ]test
jmp :nosave
:goleft rep $30
ldy #18 ;leftptr
ldy #o_lableft ;leftptr
lda [lableptr],y
bpl :p1
lda lablect
@ -1033,7 +1033,7 @@ insertlable
:p1 sta ]pos
jmp ]lup
:goright rep $30
ldy #20 ;leftptr
ldy #o_labright ;rightptr
lda [lableptr],y
bpl :p2
lda lablect
@ -1075,7 +1075,7 @@ insertlable
sta foundlable,x
inx
inx
cpx #32
cpx #sym_size
blt ]test
jsr inclablect
rts
@ -1083,7 +1083,7 @@ insertlable
drawlabstr php
rep $30
lda labstr
and #$0f
and #label_mask
beq :cr
tay
ldx #$01
@ -1175,7 +1175,7 @@ insertlableasm
iny
iny
ldx #$02 ;start at byte 2
]lup1 cpx #$10
]lup1 cpx #lab_size+1
jeq :error
cpx ]len1
blt :1
@ -1198,7 +1198,7 @@ insertlableasm
lda ]len1
cmp ]len2
bne :goleft
:replace ldy #26 ;offset to equ type
:replace ldy #o_labtype ;offset to equ type
lda labtype
ora #$8008
sta [lasmptr],y
@ -1218,11 +1218,11 @@ insertlableasm
inx
iny
iny
cpx #32
cpx #sym_size
blt ]test
jmp :nosave
:goleft rep $30
ldy #18 ;leftptr
ldy #o_lableft ;leftptr
lda [lasmptr],y
bpl :p1
lda asmlablect
@ -1231,7 +1231,7 @@ insertlableasm
:p1 sta ]pos
jmp ]lup
:goright rep $30
ldy #20 ;leftptr
ldy #o_labright ;rightptr
lda [lasmptr],y
bpl :p2
lda asmlablect
@ -1275,7 +1275,7 @@ insertlableasm
inx
iny
iny
cpx #32
cpx #sym_size
blt ]test
jsr incasmlablect
rts
@ -1336,7 +1336,7 @@ traverse php
iny
lda [lableptr1],y
sta lableptr+2
ldy #18
ldy #o_lableft
lda #'R'
sta :char
lda [lableptr],y
@ -1348,7 +1348,7 @@ traverse php
:next2 jsr :print
lda #'R'
sta :char
ldy #20
ldy #o_labright
lda [lableptr],y
bmi :done
pha
@ -1369,7 +1369,7 @@ traverse php
sta labstr,x
inx
inx
cpx #32
cpx #sym_size
blt ]lup
:jsr jsr $ffff
sep $20
@ -1481,7 +1481,7 @@ move2asm lda linksymhdl
sta labtype
jsr insertlableasm
clrlocals
ldy #26
ldy #o_labtype
lda [lableptr],y
and #linkequvalid!$FFFF
sta [lableptr],y
@ -1596,11 +1596,11 @@ inclablect php
and #%11111111
bne :normal
psl #$00
psl #$2000
psl #sym_size*256 ; $2000
ldal userid
ora #linkmemid
pha
pea $8004 ;page aligned/locked
pea $8014 ;page aligned/locked/nocross
psl #$00
_NewHandle
plx
@ -1625,7 +1625,7 @@ inclablect php
rts
:normal lda nextlableptr
clc
adc #32
adc #sym_size
sta nextlableptr
bcc :rts
inc nextlableptr+2
@ -1644,11 +1644,11 @@ incasmlablect php
and #%11111111
bne :normal
psl #$00
psl #$2000
psl #sym_size*256 ; #$2000
lda userid
ora #linkmemid+$100
pha
pea $8004 ;page aligned/locked
pea $8014 ;page aligned/locked/nocross
psl #$00
_NewHandle
plx
@ -1673,7 +1673,7 @@ incasmlablect php
rts
:normal lda asmnextlable
clc
adc #32
adc #sym_size
sta asmnextlable
bcc :rts
inc asmnextlable+2

View File

@ -154,6 +154,7 @@ QuickASM ENT
_InitCursor ;no longer waiting to startup
~CheckClick #TextName ;do we have a doc to open?
bcs :9
txa
beq :9 ; no- don't open anything

View File

@ -772,22 +772,28 @@ SetCmdHdl
rts
*------------------------------------------------------
* _QAGetWord error
* $0000 -> no error
* $00xx -> no word, a = terminating character (anything less than $20, excluding \t )
* $80xx -> qa tool error
* return value will always be 0,0 if there was an error. can never be 0,0 on success.
*
:getword
REP #$20 ;force 16 bit
]loop
~QAGetWord Ptr;endword;temp ;get a word
plx
ply
beq :0 ;don't modify if no word!
stx endword
sty begword
bcc :1
tax ;real error, or just no word?
bmi :1
tax ; real error or no word?
bpl :0
rts ; carry still set
:0
inc endword ;no word- look for one!
bra ]loop
:1
stx endword
sty begword
SEP #$20
bra :gc ;get first char, uppercase!

39
testdata/3006-pea.S vendored Normal file
View File

@ -0,0 +1,39 @@
* verify pea doesn't have address mode errors with quoted strings
pea ','
pea ';'
pea ' '
pea '['
pea ']'
pea '('
pea ')'
pea #','
pea #';'
pea #' '
pea #'['
pea #']'
pea #'('
pea #')'
pea ","
pea ";"
pea " "
pea "["
pea "]"
pea "("
pea ")"
pea #","
pea #";"
pea #" "
pea #"["
pea #"]"
pea #"("
pea #")"
pea '"'
pea "'"
pea #'"'
pea #"'"

10
testdata/3007-data-star.S vendored Normal file
View File

@ -0,0 +1,10 @@
* merlin (Apple II) updates the value of the * pc after each operand
* of a data statement.
adr *,*
adrl *,*
da *,*
db *,*
ddb *,*
dfb *,*
dw *,*

14
testdata/3008-macro-strings.S vendored Normal file
View File

@ -0,0 +1,14 @@
*
* verify macro operand parsing handles quoted strings.
*
xx mac
asc ]1
eom
xx '"hello"'
xx "'hello'"
xx 'hello'
xx "hello"
xx 'abc',00
xx ff

12
testdata/3009-abs-ent-1.S vendored Normal file
View File

@ -0,0 +1,12 @@
rel
ent const
const equ $123456 ; only 24-bit value saved in rel dictionary.
db const
dw const
adr const
adrl const
ddb const
sav 3009-abs-ent-1.L

11
testdata/3009-abs-ent-2.S vendored Normal file
View File

@ -0,0 +1,11 @@
rel
ext const
db const
dw const
adr const
adrl const
ddb const
sav 3009-abs-ent-2.L

9
testdata/3009-abs-ent-link.S vendored Normal file
View File

@ -0,0 +1,9 @@
* link file
* generated file should not have any OMF relocation records.
ovr all
asm 3009-abs-ent-1.S
asm 3009-abs-ent-2.S
lnk 3009-abs-ent-1.L
lnk 3009-abs-ent-2.L
sav 3009-abs-ent

18
testdata/3010-gequ-link.S vendored Normal file
View File

@ -0,0 +1,18 @@
* link file
* link script gequ symbols are visible to both the assembler and linker
*
*
ovr all
* this geq available at asm-time
gequ1 geq 1
equ1 equ 2
asm 3010-gequ.S
* this geq available at link-time
gequ2 geq 3
lnk 3010-gequ.L
sav 3010-gequ
ent

22
testdata/3010-gequ.S vendored Normal file
View File

@ -0,0 +1,22 @@
rel
xc
xc
* ext gequ1
ext gequ2
lda #gequ1
ldy #equ1
ldx #gequ2
rtl
* verify all sizes work
db gequ2
dw gequ2
ddb gequ2
adr gequ2
adrl gequ2
sav 3010-gequ.L
sym

6
testdata/3012-rel-ds-1.S vendored Normal file
View File

@ -0,0 +1,6 @@
rel
nop
nop
sav 3012-rel-ds-1.L

16
testdata/3012-rel-ds-2.S vendored Normal file
View File

@ -0,0 +1,16 @@
rel
a ent
b ent
c ent
nop
nop
* should generate $100 - 4 bytes of $ff since 2 bytes in first file, 2 bytes above.
* extra ent labels to verify the DS padding algorithm adjusts the relacation records.
ds \,$ff
d ent
sav 3012-rel-ds-2.L

9
testdata/3012-rel-ds-3.S vendored Normal file
View File

@ -0,0 +1,9 @@
rel
ext a,b,c,d
dw a,b,c,d
ds \,$00
sav 3012-rel-ds-3.L

15
testdata/3012-rel-ds-link.S vendored Normal file
View File

@ -0,0 +1,15 @@
*
* test rel DS \ command to verify it uses the current segment offset,
* not the current file offset.
*
ovr all
asm 3012-rel-ds-1.S
asm 3012-rel-ds-2.S
asm 3012-rel-ds-3.S
lnk 3012-rel-ds-1.L
lnk 3012-rel-ds-2.L
lnk 3012-rel-ds-3.L
sav 3012-rel-ds

15
testdata/3013-len-pos-1.S vendored Normal file
View File

@ -0,0 +1,15 @@
rel
ext my_pos_0
ext my_len_1,my_pos_1
ext my_len_2,my_pos_2
lda #my_len_1
lda #my_len_2
ldx #my_pos_1
ldx #my_pos_2
ldy #my_pos_0
rtl
sav 3013-len-pos-1.L

5
testdata/3013-len-pos-2.S vendored Normal file
View File

@ -0,0 +1,5 @@
rel
* make sure ds adjusts len/pos appropriately.
ds \
sav 3013-len-pos-2.L

24
testdata/3013-len-pos-link.S vendored Normal file
View File

@ -0,0 +1,24 @@
ovr all
asm 3013-len-pos-1.S
asm 3013-len-pos-2.S
lnk 3013-len-pos-1.L
len my_len_1
pos my_pos_1
lnk 3013-len-pos-2.L
len my_len_2
pos my_pos_2
pos
pos my_pos_0
sav 3013-len-pos
ent

9
testdata/3014-ext-link.S vendored Normal file
View File

@ -0,0 +1,9 @@
*
* verify ext imports an absolute ent label and can use it in expressions.
*
ovr all
asm 3014-ext.S
lnk 3014-ext.L
extra ext
ds extra ; 128 byte reserved space
sav 3014-ext

11
testdata/3014-ext.S vendored Normal file
View File

@ -0,0 +1,11 @@
rel
dum 0
ds 128
extra equ *
dend
ent extra
rts
sav 3014-ext.L

10
testdata/3015-amacc.S vendored Normal file
View File

@ -0,0 +1,10 @@
*
* explicit a operand (inc a, etc) is dropped.
*
inc a
dec a
lsr a
asl a
rol a
ror a