antoine-source/appleworksgs/SS/Src/Format.aii
2023-03-04 03:45:20 +01:00

1 line
22 KiB
Plaintext
Executable File

LOAD 'Macros.dump'
INCLUDE 'SS.equ'
INCLUDE 'Driver.equ'
INCLUDE 'Heap.aii.i'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT D_AlertBox
IMPORT D_CloseDialog
IMPORT D_DigitsOnly
IMPORT D_DisableMItems
IMPORT D_EnableMItems
IMPORT D_GetNewModalDialog
IMPORT D_MemoryError
IMPORT X_DialogFromScrap
IMPORT X_DialogToScrap
IMPORT X_GetScrap
IMPORT X_SSScTypes
IMPORT S_ActiveWindow
IMPORT S_BuildSimpleUndo
IMPORT S_CurBRSelect
IMPORT S_CurChartCount
IMPORT S_CurDefFormat
IMPORT S_CurEditFlag
IMPORT S_CurFormat
IMPORT S_CurTLSelect
IMPORT S_CurWindow
IMPORT S_GetCellPtr
IMPORT S_InsertLeftPadCells
IMPORT S_InsertRightPadCells
IMPORT S_PasteFormatMsg
IMPORT S_QTraverse
IMPORT S_RedrawCellRange
IMPORT S_RemovePadCells
IMPORT S_SetFixDlog
IMPORT S_SetUndoOff
IMPORT S_SetUndoOn
IMPORT S_SfCountNum
IMPORT S_SfCountTxt
IMPORT S_SwapIn
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY S_CheckCount
ENTRY S_CheckTraverse
ENTRY S_DoChecks
ENTRY S_DoFormat
ENTRY S_DoFormatChange
ENTRY S_FixAlign
ENTRY S_FormatAndMask1
ENTRY S_FormatAndMask2
ENTRY S_FormatBRCell
ENTRY S_FormatOrMask1
ENTRY S_FormatOrMask2
ENTRY S_FormatPadFlag
ENTRY S_FormatTLCell
ENTRY S_JustifyType
ENTRY S_ToggleFormat
;-------------------------------------------------------------------------;
; S_PasteFormat ()
;
S_PasteFormat PROC EXPORT
;Using X_ClipData
;Using S_AttrData
;Using S_CurrentData
;Using S_FormatData
;Using S_ErrorData
local ScrapHandle:l,ScrapPtr:l,Format:l,SFlag:w
error ErrFlag
BEGIN +b
stz ErrFlag
Call X_GetScrap,in=(#X_SSScTypes:l),out=(SFlag:w,ScrapHandle:l)
bcc chkScrap
cantStart
Call D_MemoryError
brl Quit
chkScrap
beq needScrap
; Got a Scrap ;
MoveLong [ScrapHandle],ScrapPtr
MoveWord [ScrapPtr]:#S_ScrapParseCode,a
bne needScrap
lda #1
CmpWord a,[ScrapPtr]:#S_ScrapRows
bne needScrap
CmpWord a,[ScrapPtr]:#S_ScrapCols
beq goodScrap
needScrap
Call D_AlertBox,in=(#OkBox:w,#S_PasteFormatMsg:l),out=(a:w)
lda SFlag
jeq Quit
brl Exit
goodScrap
Call S_SwapIn,in=(S_ActiveWindow:l)
CmpLong [ScrapPtr]:#S_ScrapSize,#S_ScrapCells
beq useDefault
MoveLong [ScrapPtr]:#S_ScrapCells+S_ScrapFormat,Format
bra doPaste
useDefault
MoveLong S_CurDefFormat,Format
; Determine where to paste format ;
doPaste
lda S_CurEditFlag
and #S_EditingBit
beq notEditing
MoveLong Format,S_CurFormat
brl doChecks
notEditing
AndMask1 equ S_CellType+S_CellInvalid+S_CellError+S_CellJustify
AndMask2 equ S_CellProtect+S_CellCircular
MoveLong S_CurTLSelect,S_FormatTLCell
MoveLong S_CurBRSelect,S_FormatBRCell
in S_CurTLSelect:l,S_CurBRSelect:l
XCall S_BuildSimpleUndo,err=ErrFlag
bcs memError
; Fix alignment ;
lda Format
and #S_CellJustify
sta S_JustifyType
in S_CurTLSelect:l,S_CurBRSelect:l,#S_FixAlign:l
XCall S_QTraverse
bcs memError
; Change all but alignment formatting ;
lda Format
and #$FFFF-AndMask1
sta S_FormatOrMask1
iny
iny
lda Format+2
and #$FFFF-AndMask2
sta S_FormatOrMask2
MoveWord #AndMask1,S_FormatAndMask1
MoveWord #AndMask2,S_FormatAndMask2
MoveWord #S_BoldItem,S_FormatPadFlag
in S_CurTLSelect:l,S_CurBRSelect:l,#S_DoFormat:l
XCall S_QTraverse
bcc redraw
memError
Call D_MemoryError
redraw
Call S_RedrawCellRange,in=(S_FormatTLCell:l,S_FormatBRCell:l)
Call S_SetUndoOn,in=(#S_UndoPasteFormatType:w)
doChecks
Call S_DoChecks
Exit
Tool _DisposeHandle,in=(ScrapHandle:l)
Quit
RETURN
ENDP
; ******************* Alignments ******************
;-------------------------------------------------------------------------;
; S_AlignLeft
;
S_AlignLeft PROC EXPORT
;Using S_CurrentData
;Using S_FormatData
BEGIN +b
Call S_SwapIn,in=(S_ActiveWindow:l)
Call S_SetUndoOff
lda S_CurEditFlag
and #S_EditingBit
beq notEditing
lda S_CurFormat
and #-1-S_CellJustify
; ora #S_CellLeftJustify ; = 0
sta S_CurFormat
bra Exit
notEditing
Tool _SetPort,in=(S_CurWindow:l)
stz S_JustifyType
MoveLong S_CurTLSelect,S_FormatTLCell
MoveLong S_CurBRSelect,S_FormatBRCell
in S_CurTLSelect:l,S_CurBRSelect:l,#S_FixAlign:l
XCall S_QTraverse
bcc redraw
Call D_MemoryError
redraw
Call S_RedrawCellRange,in=(S_FormatTLCell:l,S_FormatBRCell:l)
Exit
jsl S_DoChecks
RETURN
ENDP
;-------------------------------------------------------------------------;
; S_AlignRight
;
S_AlignRight PROC EXPORT
;Using S_CurrentData
;Using S_FormatData
BEGIN +b
Call S_SwapIn,in=(S_ActiveWindow:l)
Call S_SetUndoOff
lda S_CurEditFlag
and #S_EditingBit
beq notEditing
lda S_CurFormat
and #-1-S_CellJustify
ora #S_CellRightJustify
sta S_CurFormat
bra Exit
notEditing
Tool _SetPort,in=(S_CurWindow:l)
MoveWord #S_CellRightJustify,S_JustifyType
MoveLong S_CurTLSelect,S_FormatTLCell
MoveLong S_CurBRSelect,S_FormatBRCell
in S_CurTLSelect:l,S_CurBRSelect:l,#S_FixAlign:l
XCall S_QTraverse
bcc redraw
Call D_MemoryError
redraw
Call S_RedrawCellRange,in=(S_FormatTLCell:l,S_FormatBRCell:l)
Exit
jsl S_DoChecks
RETURN
ENDP
;-------------------------------------------------------------------------;
; S_AlignCenter
;
S_AlignCenter PROC EXPORT
;Using S_CurrentData
;Using S_FormatData
BEGIN +b
Call S_SwapIn,in=(S_ActiveWindow:l)
Call S_SetUndoOff
lda S_CurEditFlag
and #S_EditingBit
beq notEditing
lda S_CurFormat
and #-1-S_CellJustify
ora #S_CellCenterJustify
sta S_CurFormat
bra Exit
notEditing
Tool _SetPort,in=(S_CurWindow:l)
MoveWord #S_CellCenterJustify,S_JustifyType
MoveLong S_CurTLSelect,S_FormatTLCell
MoveLong S_CurBRSelect,S_FormatBRCell
in S_CurTLSelect:l,S_CurBRSelect:l,#S_FixAlign:l
XCall S_QTraverse
bcc redraw
Call D_MemoryError
redraw
Call S_RedrawCellRange,in=(S_FormatTLCell:l,S_FormatBRCell:l)
Exit
jsl S_DoChecks
RETURN
ENDP
;----------------------------------------------------------------------------
;
;
S_FixAlign PROC EXPORT
;Using S_CurrentData
;Using S_FormatData
input Cell:l,CellIndex:l
local CellPtr:l,Format:w
error ErrFlag
BEGIN
stz ErrFlag
H_GetBlockPtr CellIndex,CellPtr
MoveWord [CellPtr]:#S_CellFormat,Format
bmi Exit
; Is it already justified correctly ;
lda Format
and #S_CellJustify
cmp S_JustifyType
jeq Exit
; Set the Justification ;
lda Format
and #-1-S_CellJustify
ora S_JustifyType
MoveWord a,[CellPtr]:#S_CellFormat
; Is the cell of type text ;
and #S_CellType
jne Exit ; text type = 0
; Remove old pad cells ;
in Cell:l
out :l,:l
XCall S_RemovePadCells,err=ErrFlag
pla
plx
cpx S_FormatBRCell+2
blt chkLeft1
stx S_FormatBRCell+2
chkLeft1
pla
plx
cpx S_FormatTLCell+2
bge chkRight2
stx S_FormatTLCell+2
; Insert New pad cells ;
chkRight2
lda ErrFlag
bne Exit
in Cell:l
out ax:l
XCall S_InsertRightPadCells,err=ErrFlag
bcs Exit
cpx S_FormatBRCell+2
blt chkLeft2
stx S_FormatBRCell+2
chkLeft2
in Cell:l
out ax:l
XCall S_InsertLeftPadCells,err=ErrFlag
bcs Exit
cpx S_FormatTLCell+2
bge Exit
stx S_FormatTLCell+2
Exit
RETURN
ENDP
;------------------------------------------------------------------------
; S_FormatData
;
S_FormatData PROC EXPORT
EXPORT S_FormatItem
EXPORT S_FormatPadFlag
EXPORT S_FormatAndMask1
EXPORT S_FormatAndMask2
EXPORT S_FormatOrMask1
EXPORT S_FormatOrMask2
EXPORT S_JustifyType
EXPORT S_FormatTLCell
EXPORT S_FormatBRCell
S_FormatItem DS.B 2
S_FormatPadFlag DC.W 0
S_FormatAndMask1 DS.B 2 ; low word mask
S_FormatAndMask2 DS.B 2 ; high word mask
S_FormatOrMask1 DS.B 2 ; low word mask
S_FormatOrMask2 DS.B 2 ; high word mask
S_JustifyType DS.B 2
S_FormatTLCell DS.B 4
S_FormatBRCell DS.B 4
ENDP
; ;*************** Formatting Options ;************
;-------------------------------------------------------------------------;
; S_FormatBold
; S_FormatULine
; S_FormatComma
; S_FormatRedNeg
; S_FormatParenNeg
; S_DataProtect
;
S_FormatBold PROC EXPORT
;Using S_AttrData
;Using S_CurrentData
;Using S_FormatData
EXPORT S_FormatULine
EXPORT S_FormatComma
EXPORT S_FormatRedNeg
EXPORT S_FormatParenNeg
EXPORT S_DataProtect
MoveWord #S_BoldItem,>S_FormatItem
sta >S_FormatPadFlag
MoveWord #S_CellBold,>S_FormatOrMask1
MoveWord #0,>S_FormatOrMask2
jmp S_ToggleFormat
S_FormatULine
MoveWord #S_UnderlineItem,>S_FormatItem
sta >S_FormatPadFlag
MoveWord #S_CellULine,>S_FormatOrMask1
MoveWord #0,>S_FormatOrMask2
jmp S_ToggleFormat
S_FormatComma
MoveWord #S_CommaItem,>S_FormatItem
MoveWord #S_CellComma,>S_FormatOrMask1
MoveWord #0,>S_FormatOrMask2
jmp S_ToggleFormat
S_FormatRedNeg
MoveWord #S_RedNegItem,>S_FormatItem
MoveWord #S_CellRedNeg,>S_FormatOrMask1
MoveWord #0,>S_FormatOrMask2
jmp S_ToggleFormat
S_FormatParenNeg
MoveWord #S_ParenItem,>S_FormatItem
MoveWord #S_CellParenNeg,>S_FormatOrMask1
MoveWord #0,>S_FormatOrMask2
jmp S_ToggleFormat
S_DataProtect
MoveWord #S_ProtectItem,>S_FormatItem
MoveWord #0,>S_FormatOrMask1
MoveWord #S_CellProtect,>S_FormatOrMask2
jmp S_ToggleFormat
ENDP
;---------------------------------------------------------------------------
;
; S_FormatToggle
;
S_ToggleFormat PROC EXPORT
;Using S_FormatData
pha
lda >S_FormatItem
pha
Tool _GetMItemMark ; in=(:w),out=(a:w)
pla
beq SetIt
ResetIt
lda >S_FormatOrMask1
eor #-1
sta >S_FormatAndMask1
lda >S_FormatOrMask2
eor #-1
sta >S_FormatAndMask2
MoveWord #0,>S_FormatOrMask1
MoveWord a,>S_FormatOrMask2
bra DoTraverse
SetIt
MoveWord #-1,>S_FormatAndMask1
MoveWord a,>S_FormatAndMask2
DoTraverse
jmp S_DoFormatChange
ENDP
; ;****************** Number Format ;******************
;-------------------------------------------------------------------------;
; S_FormatDollar
; S_FormatFixed
; S_FormatPercent
; S_FormatSciNote
; S_FormatGeneral
;
S_FormatDollar PROC EXPORT
;Using S_CurrentData
;Using S_FormatData
EXPORT S_FormatFixed
EXPORT S_FormatPercent
EXPORT S_FormatSciNote
EXPORT S_FormatGeneral
DollarMask1 equ -1-S_CellPercent-S_CellSciNote-S_CellFixed
FixedMask1 equ -1-S_CellPercent-S_CellSciNote-S_CellDollar
PercentMask1 equ -1-S_CellDollar-S_CellSciNote-S_CellFixed
SciNoteMask1 equ -1-S_CellPercent-S_CellDollar-S_CellFixed
GeneralMask1 equ -1-S_CellPercent-S_CellSciNote-S_CellFixed-S_CellDollar
MoveWord #S_CellDollar,>S_FormatOrMask1
MoveWord #0,>S_FormatOrMask2
MoveWord #DollarMask1,>S_FormatAndMask1
MoveWord #-1,>S_FormatAndMask2
jmp S_DoFormatChange
S_FormatFixed
MoveWord #S_CellFixed,>S_FormatOrMask1
MoveWord #0,>S_FormatOrMask2
MoveWord #FixedMask1,>S_FormatAndMask1
MoveWord #-1,>S_FormatAndMask2
jmp S_DoFormatChange
S_FormatPercent
MoveWord #S_CellPercent,>S_FormatOrMask1
MoveWord #0,>S_FormatOrMask2
MoveWord #PercentMask1,>S_FormatAndMask1
MoveWord #-1,>S_FormatAndMask2
jmp S_DoFormatChange
S_FormatSciNote
MoveWord #S_CellSciNote,>S_FormatOrMask1
MoveWord #0,>S_FormatOrMask2
MoveWord #SciNoteMask1,>S_FormatAndMask1
MoveWord #-1,>S_FormatAndMask2
jmp S_DoFormatChange
S_FormatGeneral
MoveWord #0,>S_FormatOrMask1
MoveWord a,>S_FormatOrMask2
MoveWord #GeneralMask1,>S_FormatAndMask1
MoveWord #-1,>S_FormatAndMask2
jmp S_DoFormatChange
ENDP
; ;***********************************************************************
;---------------------------------------------------------------------------
;
; S_SetDecimal
;
S_SetDecimal PROC EXPORT
;Using S_CurrentData
;Using S_WindowData
;Using S_FormatData
local TheDlog:l,Result:w,Text:l
local Topl:l,Botr:l
BEGIN +b
Call S_SwapIn,in=(S_ActiveWindow:l)
stz S_SfCountTxt
lda S_SfCountNum
cmp #-1
beq DoDlog
xba
ora #$3001 ; make it into a string
sta S_SfCountTxt
DoDlog
Call D_GetNewModalDialog,in=(#S_SetFixDlog:l),out=(TheDlog:l)
Call X_DialogFromScrap
Loop
Tool _ModalDialog,in=(#D_DigitsOnly+$80000000:l),out=(Result:w)
cmp #Cancel
beq QuitDlog
cmp #OK
bne Loop
QuitDlog
Tool _GetIText,in=(TheDlog:l,#5:w,!Text:l)
Call X_DialogToScrap
Call D_CloseDialog,in=(TheDlog:l)
CmpWord Result,#OK
bne Exit
lda Text
and #$00FF
beq setMasks ; a = 0 on branch
lda Text+1
and #$000F
setMasks
sta S_FormatOrMask2
MoveWord #-1-S_CellDecPlace,S_FormatAndMask2
stz S_FormatOrMask1
MoveWord #-1,S_FormatAndMask1
Call S_DoFormatChange
Exit
RETURN
ENDP
;---------------------------------------------------------------------------
; S_DoFormatChange
;
;
S_DoFormatChange PROC EXPORT
;Using S_CurrentData
;Using S_FormatData
BEGIN +b
Call S_SwapIn,in=(S_ActiveWindow:l)
Call S_SetUndoOff
lda S_CurEditFlag
and #S_EditingBit
bne Editting
Tool _SetPort,in=(S_CurWindow:l)
MoveLong S_CurTLSelect,S_FormatTLCell
MoveLong S_CurBRSelect,S_FormatBRCell
in S_CurTLSelect:l,S_CurBRSelect:l,#S_DoFormat:l
XCall S_QTraverse
bcc redraw
Call D_MemoryError
redraw
Call S_RedrawCellRange,in=(S_FormatTLCell:l,S_FormatBRCell:l)
bra Exit
Editting
lda S_CurFormat
and S_FormatAndMask1
ora S_FormatOrMask1
sta S_CurFormat
lda S_CurFormat+2
and S_FormatAndMask2
ora S_FormatOrMask2
sta S_CurFormat+2
Exit
Call S_DoChecks
stz S_FormatPadFlag
RETURN
ENDP
;---------------------------------------------------------------------------
;
; S_DoFormat -- traversal routine for above (dollar, percent, etc)
;
S_DoFormat PROC EXPORT
;Using S_AttrData
;Using S_CurrentData
;Using S_FormatData
input Cell:l,CellIndex:l
local CellPtr:l,Format:w,LCol:w,RCol:w
error ErrFlag
BEGIN
stz ErrFlag
H_GetBlockPtr CellIndex,CellPtr
MoveWord [CellPtr]:#S_CellFormat,Format
jmi Exit
and S_FormatAndMask1
ora S_FormatOrMask1
MoveWord a,[CellPtr]:y
iny
iny
lda [CellPtr],y
and S_FormatAndMask2
ora S_FormatOrMask2
sta [CellPtr],y
lda S_FormatPadFlag
jeq Exit
; Check if the cell is text ;
lda Format
and #S_CellType
; cmp #S_CellTypeText ; = 0
jne Exit
CmpWord S_FormatPadFlag,#S_BoldItem
jeq adjustBold
MoveWord Cell+2,LCol
sta RCol
; Check the left side ;
lfLoop
dec LCol
beq lfDone
in LCol:w,Cell:w
out CellPtr:l
XCall S_GetCellPtr
ora CellPtr
beq lfDone
MoveWord [CellPtr]:#S_CellFormat,a
and #S_CellType
cmp #S_CellTypeLeftPad
beq lfLoop
lfDone
inc LCol
; Check the right side ;
rtLoop
inc RCol
cmp #703
beq rtDone
in RCol:w,Cell:w
out CellPtr:l
XCall S_GetCellPtr
ora CellPtr
beq rtDone
MoveWord [CellPtr]:#S_CellFormat,a
and #S_CellType
cmp #S_CellTypeRightPad
beq rtLoop
rtDone
dec RCol
bra fixLeftRight
adjustBold
in Cell:l
out LCol:w,a:w,RCol:w,a:w
XCall S_RemovePadCells,err=ErrFlag
bcs fixLeftRight
in Cell:l
out ax:l
XCall S_InsertLeftPadCells,err=ErrFlag
bcs fixLeftRight
cpx LCol
bge doRightInsert
stx LCol
doRightInsert
in Cell:l
out ax:l
XCall S_InsertRightPadCells,err=ErrFlag
bcs fixLeftRight
cpx RCol
blt fixLeftRight
stx RCol
fixLeftRight
CmpWord RCol,S_FormatBRCell+2
blt chkLeft
sta S_FormatBRCell+2
chkLeft
CmpWord LCol,S_FormatTLCell+2
bge Exit
sta S_FormatTLCell+2
Exit
RETURN
ENDP
;---------------------------------------------------------------------------
;
; S_DoChecks -- general menu checkmarking routine (not just format menu)
;
S_DoChecks PROC EXPORT
;Using S_CurrentData
;Using S_WindowData
;Using S_AttrData
;Using S_FormatData
local TopLeft:l,BottomRight:l,DecPlaces:w
BEGIN +b
lda S_CurEditFlag
and #S_EditingBit
beq DoRange
MoveWord S_CurFormat,S_FormatOrMask1
sta S_FormatAndMask1
MoveWord S_CurFormat+2,S_FormatOrMask2
sta S_FormatAndMask2
bra GotMask
DoRange
Call D_EnableMItems,in=(#S_GotoMI:w,#6:w)
Call D_EnableMItems,in=(#S_DeleteMI:w,#3:w)
Call D_EnableMItems,in=(#S_InsertMI:w,#3:w)
Call D_EnableMItems,in=(#S_MoveMI:w,#3:w)
MoveLong S_CurTLSelect,TopLeft
MoveLong S_CurBRSelect,BottomRight
MoveWord #-1,S_FormatAndMask1
MoveWord #-1,S_FormatAndMask2
stz S_FormatOrMask1
stz S_FormatOrMask2
stz S_CheckCount
in TopLeft:l,BottomRight:l,#S_CheckTraverse:l
XCall S_QTraverse
lda S_CheckCount
bne GotMask
MoveWord S_CurDefFormat,S_FormatOrMask1
sta S_FormatAndMask1
MoveWord S_CurDefFormat+2,S_FormatOrMask2
sta S_FormatAndMask2
GotMask
lda S_FormatAndMask1
and #S_CellBold
bne DoBold
Tool _SetMItemMark,in=(#0:w,#S_BoldItem:w)
bra DidBold
DoBold Tool _SetMItemMark,in=(#18:w,#S_BoldItem:w)
DidBold
lda S_FormatAndMask1
and #S_CellULine
bne DoULine
Tool _SetMItemMark,in=(#0:w,#S_UnderlineItem:w)
bra DidULine
DoULine Tool _SetMItemMark,in=(#18:w,#S_UnderlineItem:w)
DidULine
lda S_FormatOrMask1
and #S_CellCenterJustify+S_CellRightJustify
beq DoAlignLeft
Tool _SetMItemMark,in=(#0:w,#S_AlignLeftItem:w)
bra DidAlignLeft
DoAlignLeft Tool _SetMItemMark,in=(#18:w,#S_AlignLeftItem:w)
DidAlignLeft
lda S_FormatAndMask1
and #S_CellCenterJustify
bne DoAlignCtr
Tool _SetMItemMark,in=(#0:w,#S_AlignCtrItem:w)
bra DidAlignCtr
DoAlignCtr Tool _SetMItemMark,in=(#18:w,#S_AlignCtrItem:w)
DidAlignCtr
lda S_FormatAndMask1
and #S_CellRightJustify
bne DoAlignRight
Tool _SetMItemMark,in=(#0:w,#S_AlignRightItem:w)
bra DidAlignRight
DoAlignRight Tool _SetMItemMark,in=(#18:w,#S_AlignRightItem:w)
DidAlignRight
lda S_FormatAndMask1
and #S_CellRedNeg
bne DoRed
Tool _SetMItemMark,in=(#0:w,#S_RedNegItem:w)
bra DidRed
DoRed Tool _SetMItemMark,in=(#18:w,#S_RedNegItem:w)
DidRed
lda S_FormatAndMask1
and #S_CellParenNeg
bne DoParen
Tool _SetMItemMark,in=(#0:w,#S_ParenItem:w)
bra DidParen
DoParen Tool _SetMItemMark,in=(#18:w,#S_ParenItem:w)
DidParen
lda S_FormatAndMask1
and #S_CellComma
bne DoComma
Tool _SetMItemMark,in=(#0:w,#S_CommaItem:w)
bra DidComma
DoComma Tool _SetMItemMark,in=(#18:w,#S_CommaItem:w)
DidComma
lda S_FormatAndMask1
and #S_CellFixed
bne DoFixed
Tool _SetMItemMark,in=(#0:w,#S_FixedItem:w)
bra DidFixed
DoFixed Tool _SetMItemMark,in=(#18:w,#S_FixedItem:w)
DidFixed
lda S_FormatAndMask1
and #S_CellDollar
bne DoDollar
Tool _SetMItemMark,in=(#0:w,#S_DollarItem:w)
bra DidDollar
DoDollar Tool _SetMItemMark,in=(#18:w,#S_DollarItem:w)
DidDollar
lda S_FormatAndMask1
and #S_CellPercent
bne DoPercent
Tool _SetMItemMark,in=(#0:w,#S_PercentItem:w)
bra DidPercent
DoPercent Tool _SetMItemMark,in=(#18:w,#S_PercentItem:w)
DidPercent
lda S_FormatAndMask1
and #S_CellSciNote
bne DoSciNote
Tool _SetMItemMark,in=(#0:w,#S_SciNoteItem:w)
bra DidSciNote
DoSciNote Tool _SetMItemMark,in=(#18:w,#S_SciNoteItem:w)
DidSciNote
lda S_FormatOrMask1
and #S_CellPercent+S_CellDollar+S_CellSciNote+S_CellFixed
bne NotGeneral
Tool _SetMItemMark,in=(#18:w,#S_GeneralItem:w)
bra DidGeneral
NotGeneral Tool _SetMItemMark,in=(#0:w,#S_GeneralItem:w)
DidGeneral
lda S_FormatAndMask2
and #S_CellProtect
bne DoProtect
Tool _SetMItemMark,in=(#0:w,#S_ProtectItem:w)
bra DidProtect
DoProtect Tool _SetMItemMark,in=(#18:w,#S_ProtectItem:w)
DidProtect
CmpLong S_CurTLSelect,S_CurBRSelect
bne setRangeMItems
Call D_EnableMItems,in=(#S_ListFormulasMI:w,#5:w)
Call D_DisableMItems,in=(#S_SortMI:w,#6:w)
Call D_DisableMItems,in=(#S_FillMI:w,#3:w)
Call D_DisableMItems,in=(#S_TransposeMI:w,#3:w)
bra didMItems
setRangeMItems
Call D_DisableMItems,in=(#S_ListFormulasMI:w,#5:w)
Call D_EnableMItems,in=(#S_SortMI:w,#6:w)
Call D_EnableMItems,in=(#S_FillMI:w,#3:w)
Call D_EnableMItems,in=(#S_TransposeMI:w,#3:w)
didMItems
lda S_FormatOrMask2
and #S_CellDecPlace
sta DecPlaces
lda S_FormatAndMask2
and #S_CellDecPlace
cmp DecPlaces
beq allSameDecPlaces
lda #-1 ; default dec places
allSameDecPlaces
sta S_SfCountNum
lda S_CurChartCount
bne DoEnable
Call D_DisableMItems,in=(#S_ModChartMI:w,#6:w)
bra DidAble
DoEnable
Call D_EnableMItems,in=(#S_ModChartMI:w,#6:w)
DidAble
return
EXPORT S_CheckCount
S_CheckCount
DS.B 2
ENDP
;---------------------------------------------------------------------------
;
; S_CheckTraverse -- traversal routine for DoChecks
;
S_CheckTraverse PROC EXPORT
;Using S_CurrentData
;Using S_FormatData
input Cell:l,CellIndex:l
local CellPtr:l
error ErrFlag
BEGIN
stz ErrFlag
H_GetBlockPtr CellIndex,CellPtr
MoveWord [CellPtr]:#S_CellFormat,a
bmi Exit
ora S_FormatOrMask1
sta S_FormatOrMask1
MoveWord [Cellptr]:y,a
and S_FormatAndMask1
sta S_FormatAndMask1
MoveWord [CellPtr]:#S_CellFormat+2,a
ora S_FormatOrMask2
sta S_FormatOrMask2
MoveWord [CellPtr]:y,a
and S_FormatAndMask2
sta S_FormatAndMask2
MoveWord #1,S_CheckCount
Exit
RETURN
ENDP
END