PR#3 PREFIX /A2OSX.SRC NEW INC 1 AUTO 6 .LIST OFF *--------------------------------------- * Global Symbol Record: (8+ bytes) * 0 : Flags: * b7=Valid Entry * b6=pending * b0=R/W (.SE) * 1-4 : 32 bits Value * 5 : Len * 6-... Name * ...... * Local Symbol Record: (2 bytes) * 2 : Local ID (1->255) * 3 : offset from Global Symbol * ...... * Ending 0 *--------------------------------------- * Global Symbol Index (Sorted) * 0 : hGblock * 1 : Offset in block *--------------------------------------- * Private Symbol Record: (7 bytes) * 0,1 : MacroID * 2 : Private ID (0->255) * 3-6 : Value *--------------------------------------- * Macro Record: ( bytes) *--------------------------------------- SYM.Init lda #0 ldy #SYM.iCurGBlock sta (pData),y dec ldy #SYM.hCurGBlock sta (pData),y jsr SYM.NewGBlock bcs .9 clc .9 rts *--------------------------------------- SYM.Quit ldy #SYM.LastGBlock lda (pData),y bmi .8 .1 clc adc #SYM.hGBlocks tay lda (pData),y >SYSCALL SYS.FreeMemA ldy #SYM.LastGBlock lda (pData),y dec sta (pData),y bpl .1 .8 clc rts *--------------------------------------- SYM.Dump >PUSHW L.MSG.SYMBOLS >LIBCALL hLIBSTR,LIBSTR.PRINTF ldy #SYM.DumpCount lda #20 sta (pData),y jsr SYM.ResetGBlock .1 jsr SYM.GetByteGBlock Get Flags sta SRC.GLabel.Flags bne .10 clc rts .10 ldx #0 .2 jsr SYM.GetByteGBlock sta SRC.GLabel.Value,x inx cpx #4 bne .2 jsr SYM.GetByteGBlock sta SRC.GLabel.Len ldx #0 .3 jsr SYM.GetByteGBlock sta SRC.GLabel.Name,x inx cpx SRC.GLabel.Len bne .3 >PUSHW L.SRC.GLabel.Len lda SRC.GLabel.Value+1 >PUSHA lda SRC.GLabel.Value >PUSHA lda SRC.GLabel.Value+3 >PUSHA lda SRC.GLabel.Value+2 >PUSHA >PUSHW L.MSG.GSYMBOL >LIBCALL hLIBSTR,LIBSTR.PRINTF bcs .9 .4 jsr SYM.GetByteGBlock beq .5 End Locals...proceed next Global pha jsr SYM.GetByteGBlock >PUSHA pla >PUSHA >PUSHW L.MSG.LSYMBOL >LIBCALL hLIBSTR,LIBSTR.PRINTF bcc .4 .5 lda #13 >SYSCALL SYS.CoutA ldy #SYM.DumpCount lda (pData),y dec bne .6 >DEBUG lda #20 .6 sta (pData),y jmp .1 .9 rts *--------------------------------------- SYM.AddPrivate clc rts *--------------------------------------- SYM.LookupPrivate clc rts *--------------------------------------- SYM.AddMacro clc rts *--------------------------------------- SYM.LookupMacro clc rts *--------------------------------------- SYM.UpdateGlobal *--------------------------------------- SYM.FindGlobal jsr SYM.ResetGBlock .1 jsr SYM.GetByteGBlock Get Flags beq .9 sta SRC.FLabel.Flags ldx #0 .2 jsr SYM.GetByteGBlock sta SRC.FLabel.Value,x inx cpx #4 bne .2 jsr SYM.GetByteGBlock sta SRC.FLabel.Len ldx #0 .3 jsr SYM.GetByteGBlock sta SRC.FLabel.Name,x inx cpx SRC.FLabel.Len bne .3 cpx SRC.ELabel.Len bne .5 .4 lda SRC.FLabel.Name-1,x cmp SRC.ELabel.Name-1,x bne .5 dex bne .4 clc rts .5 jsr SYM.GetByteGBlock beq .1 jsr SYM.GetByteGBlock bra .5 .9 sec rts *--------------------------------------- SYM.AddLToGBlock jsr SYM.GetLastGBlock lda SRC.LLabel.ID jsr SYM.AddByteGBlock bcs .9 lda SRC.LLabel.Offset jmp SYM.AddByteGBlock .9 rts *--------------------------------------- SYM.AddGToGBlock jsr SYM.GetLastGBlock ldy #SYM.hCurGBlock 1st Gblock to add? lda (pData),y ldy #SYM.iCurGBlock ora (pData),y beq .10 yes, skip closing previous one lda #0 Close Pending Global/Local jsr SYM.AddByteGBlock bcs .9 .10 ldx #0 .1 lda SRC.GLabel.Flags,x jsr SYM.AddByteGBlock bcs .9 inx cpx #6 bne .1 ldx #0 .2 lda SRC.GLabel.Name,x jsr SYM.AddByteGBlock bcs .9 inx cpx SRC.GLabel.Len bne .2 clc .9 rts *--------------------------------------- SYM.ResetGBlock ldy #SYM.hGBlocks lda (pData),y >SYSCALL SYS.GetMemPtrA >STYA ZPBlockPtr lda #0 ldy #SYM.hCurGBlock sta (pData),y ldy #SYM.iCurGBlock sta (pData),y rts *--------------------------------------- SYM.GetByteGBlock ldy #SYM.iCurGBlock lda (pData),y tay lda (ZPBlockPtr),y pha ldy #SYM.iCurGBlock lda (pData),y inc sta (pData),y bne .1 ldy #SYM.hCurGBlock lda (pData),y inc sta (pData),y jsr SYM.GetGBlockA .1 pla clc rts *--------------------------------------- SYM.GetLastGBlock ldy #SYM.LastGBlock lda (pData),y SYM.GetGBlockA clc adc #SYM.hGBlocks tay lda (pData),y phx >SYSCALL SYS.GetMemPtrA >STYA ZPBlockPtr plx rts *--------------------------------------- SYM.AddByteGBlock pha ldy #SYM.iCurGBlock lda (pData),y tay pla sta (ZPBlockPtr),y tya inc beq SYM.NewGBlock ldy #SYM.iCurGBlock sta (pData),y clc rts *--------------------------------------- SYM.NewGBlock phx >PUSHWI 256 >PUSHBI S.MEM.F.INIT0 >SYSCALL SYS.GetMem bcs .9 >STYA ZPBlockPtr ldy #SYM.LastGBlock lda (pData),y inc sta (pData),y clc adc #SYM.hGBlocks tay txa sta (pData),y lda #0 ldy #SYM.iCurGBlock sta (pData),y clc .9 plx rts *--------------------------------------- MAN SAVE BIN/ASM.S.SYM LOAD BIN/ASM.S ASM