A2osX/BIN/CC.S.LINK.txt

174 lines
2.7 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*--------------------------------------
CC.Link.RTS rts
CC.Link >LDYA L.MSG.LINKING
>SYSCALL Puts
>LDYAI 256
>SYSCALL GetMem
bcs CC.Link.RTS
>STYA ZPSymBufPtr
txa
>STA.G CC.hSymBuf
ldy #0
lda #0
.1 >STYA ZPPtr1 SymID
>PUSHB.G CC.hSymbols
>PUSHW ZPPtr1 SymID
>PUSHW pData
>SYSCALL SListGetByID
bcs .8
>STYA ZPPtr2 NextID
>PUSHB.G CC.hSymbols
>PUSHW ZPPtr1 SymID
>PUSHW ZPSymBufPtr
>PUSHWI $ffff All
>PUSHWZ from Start
>SYSCALL SListGetData
bcs .9
>STYA ZPSymSize
ldy #SYM.Addr+1
lda (ZPSymBufPtr),y
dey
ora (ZPSymBufPtr),y
bne .6
jsr CC.Link.LIBC
bcc .6
jsr CC.Link.Dump
lda #E.FUNDEF
sec
bra .9
.6 >LDA.G bTrace
bpl .7
jsr CC.Link.Dump
bcs .9
.7 >LDYA ZPPtr2
jmp .1
.8 clc
.9 php
pha
jsr CC.SYM.Free
pla
plp
rts
*--------------------------------------
* Input : pData = Symbol
*--------------------------------------
CC.Link.LIBC >LDYA L.CC.LIBC
>STYA ZPLookupPtr
ldy #$ff
.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
>PUSHB.G CC.hSymbols
>PUSHW ZPPtr1 SymID
>PUSHW ZPSymBufPtr
>PUSHW ZPSymSize
>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
>PUSHW pData
>PUSHB (ZPSymBufPtr) SYM.T
ldy #1
>PUSHB (ZPSymBufPtr),y SYM.Q
iny
>PUSHB (ZPSymBufPtr),y SYM.SC
ldy #SYM.SizeOf+1
>PUSHB (ZPSymBufPtr),y
dey
>PUSHB (ZPSymBufPtr),y
ldy #SYM.Addr+1
>PUSHB (ZPSymBufPtr),y
dey
>PUSHB (ZPSymBufPtr),y
>PUSHBI 9
>SYSCALL PrintF
rts
*--------------------------------------
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.link
LOAD usr/src/bin/cc.s
ASM