A2osX/BIN/CC.S.SCOPE.txt

156 lines
2.3 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
*--------------------------------------
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
.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
.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
.FIN
lda ScopePtr
beq *
sec
sbc #SCOPE
sta ScopePtr
inc bLocalScope
.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
.FIN
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