A2osX/BIN/CC.S.SCOPE.txt

156 lines
2.3 KiB
Plaintext
Raw Normal View History

NEW
AUTO 3,1
*--------------------------------------
SCOPE.New lda ScopePtr
tay
clc
adc #SCOPE
bcs .9
sta ScopePtr
dec bLocalScope
iny
iny #SCOPE.LocalPtr
lda (ScopeStk),y
pha
>LDA.G CC.ScopeID
* clc
adc #1
sta (pData),y
tax
iny
lda (pData),y
adc #0
ldy ScopePtr
iny
sta (ScopeStk),y #SCOPE.ID Hi
txa
dey
sta (ScopeStk),y #SCOPE.ID Lo
iny
iny
pla
sta (ScopeStk),y #SCOPE.LocalPtr
iny
lda #0
sta (ScopeStk),y #SCOPE.FrameSize
2022-12-13 06:55:13 +00:00
.DO _DBG_SCOPE=1
>PUSHW L.MSG.DEBUG.SCIN
jsr SCOPE.Push
lda ScopePtr
>PUSHA
tay
iny
iny
>PUSHB (ScopeStk),y
iny
>PUSHB (ScopeStk),y
>PUSHBI 5
>SYSCALL PrintF
* >DEBUG
2022-12-13 06:55:13 +00:00
.FIN
clc
rts
.9 lda #E.OOH
sec
.99
SCOPE.New.RTS rts
*--------------------------------------
SCOPE.AddLocal lda #'F'
jsr SYM.LookupLabelA
bcs SCOPE.New.RTS
txa
jmp CODE.AddLocal
*--------------------------------------
SCOPE.RemLocal lda #'F' define FRAME SIZE
jsr SYM.NewLabelA
bcs SCOPE.New.RTS
ldy ScopePtr
iny
iny
iny
lda (ScopeStk),y #SCOPE.FrameSize
jmp CODE.RemLocal
*--------------------------------------
SCOPE.Close .DO _DBG_SCOPE=1
>PUSHW L.MSG.DEBUG.SCOUT
jsr SCOPE.Push
lda ScopePtr
>PUSHA
tay
iny
iny
>PUSHB (ScopeStk),y #SCOPE.LocalPtr
iny
>PUSHB (ScopeStk),y #SCOPE.FrameSize
>PUSHBI 5
>SYSCALL PrintF
2022-12-13 06:55:13 +00:00
.FIN
lda ScopePtr
beq *
sec
sbc #SCOPE
sta ScopePtr
inc bLocalScope
2022-12-13 06:55:13 +00:00
.DO _DBG_SCOPE=1
>PUSHW L.MSG.DEBUG.SC
jsr SCOPE.Push
lda ScopePtr
>PUSHA
tay
iny
iny
>PUSHB (ScopeStk),y
iny
>PUSHB (ScopeStk),y
>PUSHBI 5
>SYSCALL PrintF
* >DEBUG
2022-12-13 06:55:13 +00:00
.FIN
2022-12-13 06:55:13 +00:00
clc
.99 rts
*--------------------------------------
SCOPE.Push lda ScopePtr
SCOPE.PushA clc
adc #SCOPE.ID+1
tay
lda (ScopeStk),y
>PUSHA
dey #SCOPE.ID
lda (ScopeStk),y
>PUSHA
rts
*--------------------------------------
MAN
SAVE usr/src/bin/cc.s.scope
LOAD usr/src/bin/cc.s
ASM