mirror of
https://github.com/antoinevignau/source.git
synced 2024-11-19 22:31:52 +00:00
1 line
30 KiB
Plaintext
1 line
30 KiB
Plaintext
|
LOAD 'Macros.dump'
INCLUDE 'M16.Profile'
INCLUDE 'SS.equ'
INCLUDE 'Driver.equ'
INCLUDE 'Heap.aii.i'
INCLUDE 'Eval.aii.i'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT D_AlertBox
IMPORT D_BeachBall
IMPORT D_MainZPage
IMPORT S_CurChangedList
IMPORT S_CurDefFormat
IMPORT S_CurEditFlag
IMPORT S_DepOnMeTreeTooBig
IMPORT S_EvalFormula
IMPORT S_GetCellIndex
IMPORT S_GetCellPtr
IMPORT S_GetCellTableEntry
IMPORT S_GetRealCell
IMPORT S_IsCellCircular
IMPORT S_NewCell
IMPORT S_NormalizeRange
IMPORT S_RedrawCellRange
IMPORT S_RemoveCell
IMPORT S_SetCellIndex
IMPORT S_SetCellTableEntry
IMPORT S_TraverseRange
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY S_AddDepListToRecalc
ENTRY S_CalculateCell
ENTRY S_CheckForCirc
ENTRY S_FirstCallToCheckCircularity
ENTRY S_OrigCell
;-------------------------------------------------------------------------;
; S_AddCellToChangedList( Cell:l)
;
; S_AddCellToChangedList will add a cell to the changed list.
S_AddCellToChangedList PROC EXPORT
;Using S_CurrentData
input Cell:l
local CellPtr:l,DepListPtr:l,LastPtr:l
BEGIN
CellTableEntry equ CellPtr
in Cell:l
out CellTableEntry:l
XCall S_GetCellTableEntry
ora CellTableEntry
jeq Exit
lda CellTableEntry+2
and #S_CellTableFlags
beq realCell
; The cell to Mark changed, is not a real cell.
; We will Mark all cells in its DependOnMe list.
lda CellTableEntry+2
bpl fullList
and #$FFFF-S_CellTableFlags
tax
lda CellTableEntry
Call S_AddCellToChangedList,in=(ax:l)
brl Exit
fullList
and #$FFFF-S_CellTableFlags
sta CellTableEntry+2
H_GetBlockPtr CellTableEntry,DepListPtr
AddLong DepListPtr,[DepListPtr],LastPtr ; size
AddLong DepListPtr,#S_DependList,DepListPtr
loop
Call S_AddCellToChangedList,in=([DepListPtr]:l)
AddLong DepListPtr,#S_DependInc,DepListPtr
CmpLong DepListPtr,LastPtr
blt loop
brl Exit
realCell
H_GetBlockPtr CellTableEntry,CellPtr
MoveWord [CellPtr]:#S_CellNext,a ; chk if in list
ldy #S_CellNext+2
ora [CellPtr],y
bne Exit ; no long refs = 0
MoveLong #S_EndOfList,[CellPtr]:#S_CellPrevious
lda S_CurChangedList
ora S_CurChangedList+2
bne exists
MoveLong #S_EndOfList,[CellPtr]:#S_CellNext
bra fixCurChangedList
exists
MoveLong S_CurChangedList,[CellPtr]:#S_CellNext
in S_CurChangedList:l
out CellPtr:l
XCall S_GetCellPtr
MoveLong Cell,[CellPtr]:#S_CellPrevious
fixCurChangedList
MoveLong Cell,S_CurChangedList
Exit
RETURN
ENDP
;-------------------------------------------------------------------------;
; S_RemoveCellFromChangedList( Cell:l,NextCell:l )
;
; S_RemoveCellFromChangedList will remove a cell from the changed list.
; If the cell is not in the list, this routine will not work.
S_RemoveCellFromChangedList PROC EXPORT
;Using S_CurrentData
input Cell:l,PreviousCell:l,NextCell:l
local CellPtr:l
BEGIN
ProfileIn 3
CmpLong PreviousCell,#S_EndOfList
bne notHead
CmpLong NextCell,#S_EndOfList
beq clearList
MoveLong NextCell,S_CurChangedList
bra fixNext
clearList
stz S_CurChangedList
stz S_CurChangedList+2
bra Exit
notHead
in PreviousCell:l
out CellPtr:l
XCall S_GetCellPtr
MoveLong NextCell,[CellPtr]:#S_CellNext
; Before fixing the NextCell, make sure it is not the EndOfList.
CmpLong NextCell,#S_EndOfList
beq Exit
fixNext
in NextCell:l
out CellPtr:l
XCall S_GetCellPtr
MoveLong PreviousCell,[CellPtr]:#S_CellPrevious
Exit
ProfileOut 3
RETURN
ENDP
;-----------------------------------------------------------------------------
; S_RecalcList
;
S_NumOfRecalcBuckets equ 64
S_RecalcList DS.L S_NumOfRecalcBuckets
;-----------------------------------------------------------------------------
; S_ZeroRecalcList
;
|