A2osX/BIN/CC.S.LINK.txt
burniouf 04a83f00f3 SH:new ALIAS cmd, new && operator
MKDIR:completely implemented
LS/RM/MV/CP: combined switches
KERNEL:SList API now handle options to handle several languages/parsers
2022-10-07 21:21:37 +02:00

242 lines
3.8 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 >LDYA L.MSG.LINKING
>SYSCALL Puts
ldy #0
lda #1
.1 >STYA ZPPtr1 SymID
>PUSHB.G CC.hScopes
>PUSHW ZPPtr1 SymID
>PUSHW pData
>SYSCALL SListGetByID
bcs .8
>STYA ZPPtr2 NextID
>PUSHB.G CC.hScopes
>PUSHW ZPPtr1 SymID
>PUSHW ZPSymBufPtr
>PUSHWI $ffff All
>PUSHWZ from Start
>SYSCALL SListGetData
bcs .99
ldy #SYM.SC
lda (ZPSymBufPtr),y
cmp #SYM.SC.TYPEDEF
bcs .6
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
.6 >LDA.G bTrace
bpl .7
jsr CC.Link.Dump
bcs .99
.7 >LDYA ZPPtr2
jmp .1
.8 clc
rts
.9 jsr CC.Link.Dump
lda #E.FUNDEF
sec
.99 rts
*--------------------------------------
* 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
>STYA ZPLookupPtr
ldy #$ff
.1 iny
lda (pData),y
bne .1
tya
tax Symbol Len
.2 lda (ZPLookupPtr)
beq .9 Ending 0, not found....
txa Get Back Len
cmp (ZPLookupPtr) Same Len ?
bne .4
tay
.3 lda (ZPLookupPtr),y
dey
cmp (pData),y
bne .4
tya
bne .3
lda (ZPLookupPtr)
tay
iny
lda (ZPLookupPtr),y get fID
clc
rts
.4 lda (ZPLookupPtr)
inc
jsr CC.ZPLookupPtrAddAp1 Skip LEN\Symbol\ID
bra .2
.9 sec
rts
*--------------------------------------
* A=ID X=SYS|FPU|LIB
*--------------------------------------
CC.Link.Update ldy #SYM.Addr
sta (ZPSymBufPtr),y
iny
txa
sta (ZPSymBufPtr),y
>PUSHB.G CC.hScopes
>PUSHW ZPPtr1 SymID
>PUSHW ZPSymBufPtr
>PUSHBI 0
ldy #SYM.DefSize
lda (ZPSymBufPtr),y
>PUSHA
>SYSCALL SListSetData
rts
*--------------------------------------
CC.Link.Dump >PUSHW L.MSG.LINKING2
>PUSHW ZPPtr1 ID
>PUSHW pData Name
>PUSHB (ZPSymBufPtr) SYM.T
ldy #1
>PUSHB (ZPSymBufPtr),y SYM.Q
iny
>PUSHB (ZPSymBufPtr),y SYM.SC
ldy #SYM.DefSize
>PUSHB (ZPSymBufPtr),y
ldy #SYM.SizeOf+1
>PUSHB (ZPSymBufPtr),y
dey
>PUSHB (ZPSymBufPtr),y
ldy #SYM.Addr+1
>PUSHB (ZPSymBufPtr),y
dey
>PUSHB (ZPSymBufPtr),y
>PUSHBI 12
>SYSCALL PrintF
rts
*--------------------------------------
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
rts
.9 >LDYA L.MSG.NOMAIN
>SYSCALL puts
lda #E.CSYN
sec
.99 rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.link
LOAD usr/src/bin/cc.s
ASM