A2osX/BIN/CC.S.LINK.txt

165 lines
2.6 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 #0
.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 .9
ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
dey
ora (ZPSymBufPtr),y
bne .6
jsr CC.Link.LIBC
bcc .6
2022-06-22 06:26:44 +00:00
2022-06-12 20:42:22 +00:00
jsr CC.Link.Dump
lda #E.FUNDEF
sec
bra .9
.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 .9
.7 >LDYA ZPPtr2
jmp .1
.8 clc
2022-06-22 06:26:44 +00:00
.9 rts
2022-06-12 20:42:22 +00:00
*--------------------------------------
* Input : pData = Symbol
*--------------------------------------
CC.Link.LIBC >LDYA L.CC.LIBC
>STYA ZPLookupPtr
ldy #$ff
2022-06-22 06:26:44 +00:00
2022-06-12 20:42:22 +00:00
.10 iny
lda (pData),y
bne .10
phy Symbol Len
ldx #0
.1 lda (ZPLookupPtr)
beq .9 Ending 0, not found....
pla
pha Get Back Len
cmp (ZPLookupPtr) Same Len ?
bne .4
tay
.2 lda (ZPLookupPtr),y
dey
cmp (pData),y
bne .4
tya
bne .2
lda (ZPLookupPtr)
jsr CC.ZPLookupPtrAddAp1 Skip LEN\Symbol
ldy #2 Skip LEN
lda (ZPLookupPtr),y
pha
dey
lda (ZPLookupPtr),y
ply
jsr CC.SYM.SetAddrYA
plx
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
.4 inx
inx
lda (ZPLookupPtr)
jsr CC.ZPLookupPtrAddAp1 Skip LEN\Symbol
lda (ZPLookupPtr)
jsr CC.ZPLookupPtrAddAp1 Skip LEN\definition
bra .1
.9 plx
sec
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
iny
>PUSHB (ZPSymBufPtr),y SYM.DefSize
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
*--------------------------------------
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.link
LOAD usr/src/bin/cc.s
ASM