A2osX/BIN/CC.S.LINK.txt

242 lines
3.8 KiB
Plaintext
Raw Normal View History

2022-06-12 20:42:22 +00:00
NEW
AUTO 3,1
*--------------------------------------
CC.Link >LDYA L.MSG.LINKING
>SYSCALL Puts
ldy #0
lda #1
2022-06-12 20:42:22 +00:00
.1 >STYA ZPPtr1 SymID
2022-06-22 06:26:44 +00:00
>PUSHB.G CC.hScopes
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-06-22 06:26:44 +00:00
>PUSHB.G CC.hScopes
2022-06-12 20:42:22 +00:00
>PUSHW ZPPtr1 SymID
>PUSHW ZPSymBufPtr
>PUSHWI $ffff All
>PUSHWZ from Start
>SYSCALL SListGetData
bcs .99
2022-06-12 20:42:22 +00:00
ldy #SYM.SC
lda (ZPSymBufPtr),y
cmp #SYM.SC.TYPEDEF
bcs .6
2022-06-12 20:42:22 +00:00
ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
dey
ora (ZPSymBufPtr),y
bne .6
jsr CC.Link.Lookup
bcs .9
jsr CC.Link.Update
bcs .99
2022-06-12 20:42:22 +00:00
.6 >LDA.G bTrace
bpl .7
2022-06-22 06:26:44 +00:00
2022-06-12 20:42:22 +00:00
jsr CC.Link.Dump
bcs .99
2022-06-12 20:42:22 +00:00
.7 >LDYA ZPPtr2
jmp .1
.8 clc
rts
2022-06-12 20:42:22 +00:00
.9 jsr CC.Link.Dump
lda #E.FUNDEF
sec
.99 rts
2022-06-12 20:42:22 +00:00
*--------------------------------------
* Input : pData = Symbol
*--------------------------------------
CC.Link.Lookup >LDYA L.CC.SYSCALL
jsr CC.Link.LookupYA
ldx #1
bcc .99
>LDYA L.CC.FPUCALL
jsr CC.Link.LookupYA
ldx #2
bcc .99
>LDA.G LibCount
* sec
beq .99
lda #0
sta ArgIndex
clc
.1 adc #hLibOs
tay
lda (pData),y
>SYSCALL GetMemPtr
jsr CC.Link.LookupYA
bcs .2
ldx ArgIndex
inx
inx
inx
rts
.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
.1 iny
2022-06-12 20:42:22 +00:00
lda (pData),y
bne .1
2022-06-12 20:42:22 +00:00
tya
tax Symbol Len
2022-06-12 20:42:22 +00:00
.2 lda (ZPLookupPtr)
2022-06-12 20:42:22 +00:00
beq .9 Ending 0, not found....
txa Get Back Len
2022-06-12 20:42:22 +00:00
cmp (ZPLookupPtr) Same Len ?
bne .4
tay
.3 lda (ZPLookupPtr),y
2022-06-12 20:42:22 +00:00
dey
cmp (pData),y
bne .4
tya
bne .3
2022-06-12 20:42:22 +00:00
lda (ZPLookupPtr)
tay
iny
lda (ZPLookupPtr),y get fID
clc
rts
2022-06-12 20:42:22 +00:00
.4 lda (ZPLookupPtr)
inc
jsr CC.ZPLookupPtrAddAp1 Skip LEN\Symbol\ID
bra .2
2022-06-12 20:42:22 +00:00
.9 sec
rts
*--------------------------------------
* A=ID X=SYS|FPU|LIB
*--------------------------------------
CC.Link.Update ldy #SYM.Addr
sta (ZPSymBufPtr),y
iny
txa
sta (ZPSymBufPtr),y
2022-06-12 20:42:22 +00:00
2022-06-22 06:26:44 +00:00
>PUSHB.G CC.hScopes
2022-06-12 20:42:22 +00:00
>PUSHW ZPPtr1 SymID
>PUSHW ZPSymBufPtr
2022-06-22 06:26:44 +00:00
>PUSHBI 0
ldy #SYM.DefSize
lda (ZPSymBufPtr),y
>PUSHA
2022-06-12 20:42:22 +00:00
>SYSCALL SListSetData
rts
*--------------------------------------
CC.Link.Dump >PUSHW L.MSG.LINKING2
2022-06-22 06:26:44 +00:00
>PUSHW ZPPtr1 ID
>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
ldy #SYM.DefSize
>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
>PUSHBI 12
2022-06-12 20:42:22 +00:00
>SYSCALL PrintF
rts
*--------------------------------------
2022-08-20 14:37:37 +00:00
CC.Link.CheckMain
>PUSHB.G CC.hScopes
>PUSHW L.CC.MAIN
>SYSCALL SListLookup
bcs .9
>STYA ZPPtr1 SymID
>PUSHB.G CC.hScopes
>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