2022-06-12 20:42:22 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.Link >LDYA L.MSG.LINKING
|
|
|
|
|
>SYSCALL Puts
|
|
|
|
|
|
|
|
|
|
ldy #0
|
2022-09-17 11:35:52 +00:00
|
|
|
|
lda #1
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
|
|
|
|
.1 >STYA ZPPtr1 SymID
|
2022-12-07 07:02:29 +00:00
|
|
|
|
* >DEBUG
|
|
|
|
|
>PUSHB.G CC.hSyms
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>PUSHW ZPPtr1 SymID
|
|
|
|
|
>PUSHW pData
|
|
|
|
|
|
|
|
|
|
>SYSCALL SListGetByID
|
|
|
|
|
bcs .8
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>STYA ZPPtr2 NextID
|
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
>PUSHB.G CC.hSyms
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>PUSHW ZPPtr1 SymID
|
|
|
|
|
>PUSHW ZPSymBufPtr
|
2022-12-30 16:29:57 +00:00
|
|
|
|
>PUSHWI 65535 All
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>PUSHWZ from Start
|
|
|
|
|
>SYSCALL SListGetData
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .99
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-12-23 16:50:50 +00:00
|
|
|
|
>LDA.G bVerbose
|
2022-12-07 07:02:29 +00:00
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
jsr CC.Link.Dump
|
|
|
|
|
|
|
|
|
|
.2 ldy #SYM.SC
|
2022-09-11 19:11:32 +00:00
|
|
|
|
lda (ZPSymBufPtr),y
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bne .7 SYM.SC.STATIC
|
2022-09-11 19:11:32 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
ldy #SYM.Addr+1
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
dey
|
|
|
|
|
ora (ZPSymBufPtr),y
|
2022-12-07 07:02:29 +00:00
|
|
|
|
bne .7
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
jsr CC.Link.Lookup
|
|
|
|
|
bcs .9
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
jsr CC.Link.Update
|
|
|
|
|
bcs .99
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
|
|
|
|
.7 >LDYA ZPPtr2
|
|
|
|
|
jmp .1
|
|
|
|
|
|
|
|
|
|
.8 clc
|
2022-09-04 20:12:49 +00:00
|
|
|
|
rts
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-12-23 16:50:50 +00:00
|
|
|
|
.9 >LDA.G bVerbose
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bmi .90
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr CC.Link.Dump
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
.90 lda #E.FUNDEF
|
2022-09-04 20:12:49 +00:00
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2022-06-12 20:42:22 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Input : pData = Symbol
|
|
|
|
|
*--------------------------------------
|
2022-09-04 20:12:49 +00:00
|
|
|
|
CC.Link.Lookup >LDYA L.CC.SYSCALL
|
|
|
|
|
jsr CC.Link.LookupYA
|
|
|
|
|
ldx #1
|
|
|
|
|
bcc .99
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
>LDYA L.CC.FPUCALL
|
|
|
|
|
jsr CC.Link.LookupYA
|
|
|
|
|
ldx #2
|
|
|
|
|
bcc .99
|
|
|
|
|
|
|
|
|
|
>LDA.G LibCount
|
|
|
|
|
* sec
|
|
|
|
|
beq .99
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta ArgIndex
|
|
|
|
|
clc
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.1 adc #hLibOs
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
jsr CC.Link.LookupYA
|
|
|
|
|
bcs .2
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
ldx ArgIndex
|
|
|
|
|
inx
|
|
|
|
|
inx
|
|
|
|
|
inx
|
|
|
|
|
rts
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.2 inc ArgIndex
|
|
|
|
|
lda ArgIndex
|
|
|
|
|
>CMP.G LibCount
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.Link.LookupYA
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>STYA ZPLookupPtr
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.1 iny
|
2022-06-12 20:42:22 +00:00
|
|
|
|
lda (pData),y
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bne .1
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
tya
|
|
|
|
|
tax Symbol Len
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.2 lda (ZPLookupPtr)
|
2022-06-12 20:42:22 +00:00
|
|
|
|
beq .9 Ending 0, not found....
|
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
txa Get Back Len
|
2022-06-12 20:42:22 +00:00
|
|
|
|
cmp (ZPLookupPtr) Same Len ?
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.3 lda (ZPLookupPtr),y
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
cmp (pData),y
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
tya
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bne .3
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
|
|
|
|
lda (ZPLookupPtr)
|
2022-09-04 20:12:49 +00:00
|
|
|
|
tay
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPLookupPtr),y get fID
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.4 lda (ZPLookupPtr)
|
|
|
|
|
inc
|
|
|
|
|
jsr CC.ZPLookupPtrAddAp1 Skip LEN\Symbol\ID
|
|
|
|
|
bra .2
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* A=ID X=SYS|FPU|LIB
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CC.Link.Update ldy #SYM.Addr
|
|
|
|
|
sta (ZPSymBufPtr),y
|
2022-11-02 06:54:30 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
iny
|
|
|
|
|
txa
|
|
|
|
|
sta (ZPSymBufPtr),y
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
>PUSHB.G CC.hSyms
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>PUSHW ZPPtr1 SymID
|
|
|
|
|
>PUSHW ZPSymBufPtr
|
2022-06-22 06:26:44 +00:00
|
|
|
|
>PUSHBI 0
|
2022-12-13 06:55:13 +00:00
|
|
|
|
|
|
|
|
|
ldy #SYM.Q
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
and #SYM.Q.FUNC
|
|
|
|
|
bne .1
|
|
|
|
|
|
2022-06-22 06:26:44 +00:00
|
|
|
|
ldy #SYM.DefSize
|
|
|
|
|
lda (ZPSymBufPtr),y
|
2022-12-13 06:55:13 +00:00
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.1 lda #SYM.F.MAX
|
|
|
|
|
|
|
|
|
|
.2 >PUSHA
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>SYSCALL SListSetData
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-11-02 06:54:30 +00:00
|
|
|
|
CC.Link.Dump ldy #$ff
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bne .1
|
2023-01-21 21:53:55 +00:00
|
|
|
|
|
2022-11-02 06:54:30 +00:00
|
|
|
|
iny
|
|
|
|
|
lda (pData),y
|
|
|
|
|
sta ZPPtr3
|
|
|
|
|
iny
|
|
|
|
|
lda (pData),y
|
|
|
|
|
sta ZPPtr3+1
|
|
|
|
|
|
|
|
|
|
>PUSHW L.MSG.LINKING2
|
|
|
|
|
|
2022-06-22 06:26:44 +00:00
|
|
|
|
>PUSHW ZPPtr1 ID
|
2022-11-02 06:54:30 +00:00
|
|
|
|
>PUSHW ZPPtr3 Scope
|
|
|
|
|
|
2022-06-22 06:26:44 +00:00
|
|
|
|
>PUSHW pData Name
|
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>PUSHB (ZPSymBufPtr) SYM.T
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
>PUSHB (ZPSymBufPtr),y SYM.Q
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
>PUSHB (ZPSymBufPtr),y SYM.SC
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
ldy #SYM.DefSize
|
2022-11-02 06:54:30 +00:00
|
|
|
|
>PUSHB (ZPSymBufPtr),y
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
ldy #SYM.SizeOf+1
|
|
|
|
|
>PUSHB (ZPSymBufPtr),y
|
|
|
|
|
dey
|
|
|
|
|
>PUSHB (ZPSymBufPtr),y
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
ldy #SYM.Addr+1
|
|
|
|
|
>PUSHB (ZPSymBufPtr),y
|
|
|
|
|
dey
|
|
|
|
|
>PUSHB (ZPSymBufPtr),y
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2022-11-02 06:54:30 +00:00
|
|
|
|
>PUSHBI 14
|
2022-06-12 20:42:22 +00:00
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-08-20 14:37:37 +00:00
|
|
|
|
CC.Link.CheckMain
|
2022-12-07 07:02:29 +00:00
|
|
|
|
>PUSHB.G CC.hSyms
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>PUSHW L.CC.MAIN
|
2022-11-02 06:54:30 +00:00
|
|
|
|
>PUSHWI 0 ScopeID
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>SYSCALL SListLookup
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1 SymID
|
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
>PUSHB.G CC.hSyms
|
2022-08-20 14:37:37 +00:00
|
|
|
|
>PUSHW ZPPtr1 SymID
|
|
|
|
|
>PUSHW ZPSymBufPtr
|
|
|
|
|
>PUSHWI 65535 all
|
|
|
|
|
>PUSHWZ From Start
|
|
|
|
|
>SYSCALL SListGetData
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
ldy #SYM.Addr
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
iny
|
|
|
|
|
ora (ZPSymBufPtr),y
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
sta PCC.FH+PCC.FH.MAIN+1
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPSymBufPtr),y
|
|
|
|
|
sta PCC.FH+PCC.FH.MAIN
|
|
|
|
|
|
|
|
|
|
* clc
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 >LDYA L.MSG.NOMAIN
|
|
|
|
|
>SYSCALL puts
|
|
|
|
|
lda #E.CSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
2022-06-12 20:42:22 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/cc.s.link
|
|
|
|
|
LOAD usr/src/bin/cc.s
|
|
|
|
|
ASM
|