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

1 line
18 KiB
Plaintext
Executable File
Raw Permalink Blame History

LOAD 'Macros.dump'
INCLUDE 'M16.Profile'
INCLUDE 'SS.equ'
INCLUDE 'Driver.equ'
; INCLUDE 'Heap.aii.i'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
; IMPORT ExEditStart
; IMPORT FileStandard
; IMPORT QuitBit
; IMPORT cr
IMPORT S_ActivateDoc
IMPORT S_AlignCenter
IMPORT S_AlignLeft
IMPORT S_AlignRight
IMPORT S_ChangeCalcMode
IMPORT S_ChangeDefWidth
IMPORT S_ChangeGrid
IMPORT S_ChangeView
IMPORT S_Clear
IMPORT S_Copy
IMPORT S_Cut
IMPORT S_DataProtect
IMPORT S_DeactivateDoc
IMPORT S_Delete
IMPORT S_DisposeDoc
IMPORT S_Fill
IMPORT S_FormatBold
IMPORT S_FormatComma
IMPORT S_FormatDollar
IMPORT S_FormatFixed
IMPORT S_FormatGeneral
IMPORT S_FormatParenNeg
IMPORT S_FormatPercent
IMPORT S_FormatRedNeg
IMPORT S_FormatSciNote
IMPORT S_FormatULine
IMPORT S_Goto
IMPORT S_GrowDoc
IMPORT S_IdleProc
IMPORT S_Insert
IMPORT S_KeyDown
IMPORT S_ListFormulas
IMPORT S_LoadMod
IMPORT S_MakeRoom
IMPORT S_MakeWin
IMPORT S_Message
IMPORT S_ModifyChart
IMPORT S_MouseDown
IMPORT S_MouseInfo
IMPORT S_MouseUp
IMPORT S_Move
IMPORT S_NewChart
IMPORT S_NewDoc
IMPORT S_OpenDoc
IMPORT S_Paste
IMPORT S_PasteFormat
IMPORT S_PasteValues
IMPORT S_PrintChanged
IMPORT S_PrintDoc
IMPORT S_RelockMem
IMPORT S_Recalc
IMPORT S_RestoreColWidth
IMPORT S_SaveDoc
IMPORT S_SelectAll
IMPORT S_SetDecimal
IMPORT S_SetDefaults
IMPORT S_SetTitles
IMPORT S_Sort
IMPORT S_Transpose
IMPORT S_UnloadMod
IMPORT S_UnlockMem
IMPORT S_Undo
IMPORT S_UpdateDoc
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY S_AttrTable
ENTRY S_CancelTxt
ENTRY S_OKTxt
ENTRY S_SfCountTxt
ENTRY S_SfOK
ENTRY S_SfTxtMsg
ENTRY S_WinEnd
;------------------------------------------------------------------------------
; S_Procs
;
EXPORT S_Procs
S_Procs PROC
;Using S_AttrData
DC.L S_AttrTable ;attribute table for module
jml S_OpenDoc ;Open a file
jml S_NewDoc ;Create a New file
jml S_DisposeDoc ;dispose of a window
jml S_SaveDoc ;Save a document
jml S_Undo ;undo in active window
jml S_Cut ;cut in active window
jml S_Copy ;do a copy in a window active or not
jml S_Paste ;Do a Paste in a window active or not
jml S_Clear ;Do a clear in the active window
jml S_ActivateDoc ;make a window active
jml S_DeactivateDoc ;
jml S_UpdateDoc ;Update a window
jml S_MouseDown ;mouse down in active window
jml S_KeyDown ;key down in active window
jml S_MouseInfo ;mouse down in active window bar
jml S_GrowDoc ;document changed size
jml S_IdleProc ;called in MainLoop
jml S_MakeRoom ;release unneeded memory
jml S_PrintChanged ;the print record changed
jml S_PrintDoc ;print the document for the given window
jml S_MouseUp ;mouse up in active window
jml S_Message ;message passing routine
; added Feb 7, 1988
jml S_LoadMod
jml S_UnloadMod
jml S_UnlockMem
jml S_RelockMem
jml S_MakeWin
; added Jun 28, 1988
DC.W 41 ; SS version number (5/19/89)
ENDP
ProfileData ProfileNumber
ProfileCode
;------------------------------------------------------------------------------
; S_AttrData
;
S_AttrData PROC EXPORT
S_Edit6 DC.B ' Paste Format Only\H'
DC.W ExEditStart
DC.B cr
S_Edit7 DC.B ' Paste Values Only\H'
DC.W ExEditStart+1
DC.B cr
S_Edit8 DC.B ' Select All\V*AaH'
DC.W ExEditStart+2
DC.B cr
S_Edit9 DC.B ' Insert\*IiH'
DC.W ExEditStart+3
DC.B cr
S_Edit10 DC.B ' Delete\V*DdH'
DC.W ExEditStart+4
DC.B cr
S_Edit11 DC.B ' Move<76>\*MmH'
DC.W ExEditStart+5
DC.B cr
S_Edit12 DC.B ' Fill\*FfH'
DC.W ExEditStart+6
DC.B cr
S_Edit13 DC.B ' Transpose\*TtH'
DC.W ExEditStart+7
DC.B cr
S_ExEditList DC.L S_Edit6,S_Edit7,S_Edit8,S_Edit9,S_Edit10,S_Edit11
DC.L S_Edit12,S_Edit13,0
;-----------------------------------------------
S_FormatMenu DC.B '> Format \N4'
DC.B cr
DC.B ' Bold\*BbH'
DC.W $401
DC.B cr
DC.B ' Underline\V*UuH'
DC.W $402
DC.B cr
DC.B ' Align Left\H'
DC.W $403
DC.B cr
DC.B ' Align Center\H'
DC.W $404
DC.B cr
DC.B ' Align Right\VH'
DC.W $405
DC.B cr
DC.B ' General\*#3H'
DC.W $406
DC.B cr
DC.B ' Fixed\*.>H'
DC.W $407
DC.B cr
DC.B ' Dollars\*$4H'
DC.W $408
DC.B cr
DC.B ' Percentage\*%5H'
DC.W $409
DC.B cr
DC.B ' Scientific Notation\*EeH'
DC.W $40A
DC.B cr
DC.B ' Set Decimal Places<65>\VH'
DC.W $40B
DC.B cr
DC.B ' Commas\*,<H'
DC.W $40C
DC.B cr
DC.B ' Red negative #''s\*RrH'
DC.W $40D
DC.B cr
DC.B ' Parenthesize neg. #''s\V*(9H'
DC.W $40E
DC.B cr
DC.B ' Set Default Format<61>\H'
DC.W $40F
DC.B cr
DC.B '.'
;-----------------------------------------------
S_OptionsMenu DC.B '> Options \N5'
DC.B cr
DC.B ' Manual Calculation\H'
DC.W $501
DC.B cr
DC.B ' Recalculate\V*=+H'
DC.W $502
DC.B cr
DC.B ' View Formulas\H'
DC.W $503
DC.B cr
DC.B ' List Functions<6E>\V*LlH'
DC.W $504
DC.B cr
DC.B ' Change Default Width<74>\H'
DC.W $505
DC.B cr
DC.B ' Restore Width to Default\VH'
DC.W $506
DC.B cr
DC.B ' Set Titles<65>\H'
DC.W $507
DC.B cr
DC.B ' Hide Cell Lines\H'
DC.W $508
DC.B cr
DC.B '.'
EXPORT S_CalcManStr
EXPORT S_CalcAutoStr
EXPORT S_ViewFormStr
EXPORT S_ViewDataStr
EXPORT S_ShowGridStr
EXPORT S_HideGridStr
S_CalcManStr str 'Manual Calculation'
S_CalcAutoStr str 'Auto Calculation'
S_ViewFormStr str 'View Formulas'
S_ViewDataStr str 'View Data'
S_ShowGridStr str 'Show Cell Lines'
S_HideGridStr str 'Hide Cell Lines'
;-----------------------------------------------
S_DataMenu DC.B '> Data \N6'
DC.B cr
DC.B ' Go to<74>\V*GgH'
DC.W $601
DC.B cr
DC.B ' Sort<72>\H'
DC.W $602
DC.B cr
DC.B ' Protect\V**8H'
DC.W $603
DC.B cr
DC.B ' New Chart<72>\H'
DC.W $604
DC.B cr
DC.B ' Modify Chart<72>\H'
DC.W $605
DC.B cr
DC.B '.'
;-----------------------------------------------
; menus are inserted backwards
;
S_MenuList DC.L S_DataMenu
DC.L S_OptionsMenu
DC.L S_FormatMenu
DC.L 0
;-----------------------------------------------------------
S_ExEditTable DC.L 0,0,0,0,0
DC.L S_PasteFormat
DC.L S_PasteValues
DC.L S_SelectAll
DC.L S_Insert
DC.L S_Delete
DC.L S_Move
DC.L S_Fill
DC.L S_Transpose
S_FormatTable DC.L S_FormatBold
DC.L S_FormatULine
DC.L S_AlignLeft
DC.L S_AlignCenter
DC.L S_AlignRight
DC.L S_FormatGeneral
DC.L S_FormatFixed
DC.L S_FormatDollar
DC.L S_FormatPercent
DC.L S_FormatSciNote
DC.L S_SetDecimal
DC.L S_FormatComma
DC.L S_FormatRedNeg
DC.L S_FormatParenNeg
DC.L S_SetDefaults
S_OptionsTable DC.L S_ChangeCalcMode
DC.L S_Recalc
DC.L S_ChangeView
DC.L S_ListFormulas
DC.L S_ChangeDefWidth
DC.L S_RestoreColWidth
DC.L S_SetTitles
DC.L S_ChangeGrid
S_DataTable DC.L S_Goto
DC.L S_Sort
DC.L S_DataProtect
DC.L S_NewChart
DC.L S_ModifyChart
S_ProcList DC.L 0,0
DC.L S_ExEditTable
DC.L S_FormatTable
DC.L S_OptionsTable
DC.L S_DataTable
;-----------------------------------------------------
S_MenuBitList DS.B 4 ;skips zero and one
DC.W FileStandard
DC.W S_DefaultEdit
DC.W S_FormatStandard
DC.W S_OptionsStandard
DC.W S_DataStandard
;-----------------------------------------------------
S_MLastBList DS.B 4 ;skip menu0 Menu1
DC.W QuitBit<<1
DC.W S_TransposeMI<<1
DC.W S_SetDefFormatMI<<1
DC.W S_GridMI<<1
DC.W S_ModChartMI<<1
;-----------------------------------------------------
; The buttons are for the 'Save' and 'Save as <20>' routines
;
S_Button1 str 'Spreadsheet Format'
S_Button2 str 'As Ascii Text'
EXPORT S_ExTitle
S_ExTitle str ' (SS) '
;-----------------------------------------------------
EXPORT S_AttrTable
S_AttrTable DC.L S_MenuList ;list of applications menus
DC.L S_ProcList ;ptrs to procs for each menu
DC.L S_MenuBitList ;bit descriptions of above
DC.L S_MLastBList ;the last menu bit*2 for each menu
DC.L S_ExEditList ;extra edit items, can be 0
DC.L 0 ;default undo string, can be 0
DC.L S_ExTitle
EXPORT S_Buttons
S_Buttons DC.W 2 ; 2 buttons, put 0 for no buttons
DC.L S_Button1
DC.L S_Button2
ENDP
;-----------------------------------------------------------------------------
; S_CurrentData
;
S_CurrentData PROC EXPORT
EXPORT S_ActiveWindow
EXPORT S_CurWindow
EXPORT S_CurSheet
EXPORT S_CurContRect
EXPORT S_CurSheetInfo
EXPORT S_CurContHt
EXPORT S_CurContWd
EXPORT S_CurRScrl
EXPORT S_CurBscrl
EXPORT S_CurGrow
EXPORT S_CurVPageSize
EXPORT S_CurMaxTLCell
EXPORT S_CurLEHandle
EXPORT S_CurHeap
EXPORT S_CurState
EXPORT S_CurRowBlock
EXPORT S_CurContYPt
EXPORT S_CurContXPt
EXPORT S_CurTLTitle
EXPORT S_CurBRTitle
EXPORT S_CurChartCount
EXPORT S_CurChartList
EXPORT S_CurChangedList
EXPORT S_CurColumnWds
EXPORT S_CurDefColWd
EXPORT S_CurTLCell
EXPORT S_CurTLSelect
EXPORT S_CurBRSelect
EXPORT S_CurBRMost
EXPORT S_CurEditFlag
EXPORT S_CurDefFormat
EXPORT S_CurFormat
EXPORT S_EndCurSheetInfo
EXPORT S_FileRSValue
EXPORT S_FileBSValue
EXPORT S_EndCurState
EXPORT S_CurTwiceVertLines
EXPORT S_CurVertLineHandSize
EXPORT S_CurVertLines
EXPORT S_CurPrinting
EXPORT S_CurEditRect
EXPORT S_ColLabRect
EXPORT S_RowLabRect
EXPORT S_LEDestRect
EXPORT S_LEViewRect
EXPORT S_ClipHandle
EXPORT S_CurCopySize
EXPORT S_StateSize
EXPORT S_SheetSize
EXPORT S_Heap
EXPORT S_LEHandle
S_ActiveWindow DC.L 0
S_CurWindow DC.L 0
S_CurSheet DC.L 0
S_CurContRect DC.W S_EditHeight+2
DC.W 0
S_CurSheetInfo
S_CurContHt DS.B 2
S_CurContWd DS.B 2
S_CurRScrl DS.B 4
S_CurBscrl DS.B 4
S_CurGrow DS.B 4
S_CurVPageSize DS.B 2
S_CurMaxTLCell DS.B 4
S_CurLEHandle DS.B 4
S_CurHeap DS.B 4
S_CurState
;-----------
S_CurRowBlock DS.B 4
S_CurContYPt DS.B 2
S_CurContXPt DS.B 2
S_CurTLTitle DS.B 4
S_CurBRTitle DS.B 4
S_CurChartCount DS.B 2
S_CurChartList DS.B 4
S_CurChangedList DS.B 4
S_Reserved DS.B 4 ; This was S_CurRecalcList
S_CurColumnWds DS.B 4
S_CurDefColWd DS.B 2
S_CurTLCell DS.B 4
S_CurTLSelect DS.B 4
S_CurBRSelect DS.B 4
S_CurBRMost DS.B 4
S_CurEditFlag DS.B 2
S_CurDefFormat DS.B 4
S_CurFormat DS.B 4
;----------
S_EndCurSheetInfo
S_FileRSValue DS.B 2
S_FileBSValue DS.B 2
;----------
S_EndCurState ;
;-----------------------
S_CurTwiceVertLines DC.W 0
S_CurVertLineHandSize DC.L 0
S_CurVertLines DC.L 0
S_CurPrinting DC.W 0
S_CurEditRect DC.W 0,0,S_EditHeight,S_EditWidth
S_ColLabRect DC.W S_EditHeight+2,0,S_EditHeight+S_ColLabelHeight,0
S_RowLabRect DC.W 0,0,0,S_NumLabelWidth
S_LEDestRect DC.W 1,20,12,1000
S_LEViewRect DC.W 1,1,12,1000
S_ClipHandle DS.B 4
S_CurCopySize equ S_EndCurSheetInfo-S_CurWindow
S_StateSize equ S_EndCurState-S_CurState
S_SheetSize equ S_EndCurSheetInfo-S_CurSheetInfo
S_Heap equ S_CurHeap-S_CurSheetInfo
S_LEHandle equ S_CurLEHandle-S_CurSheetInfo
ENDP
;------------------------------------------------------------------------------
; S_ConstantData
;
S_ConstantData PROC EXPORT
EXPORT S_DashMask
EXPORT S_NormalMask
S_DashMask DC.B %00110011
DC.B %11001100
DC.B %00110011
DC.B %11001100
DC.B %00110011
DC.B %11001100
DC.B %00110011
DC.B %11001100
S_NormalMask DC.B %11111111
DC.B %11111111
DC.B %11111111
DC.B %11111111
DC.B %11111111
DC.B %11111111
DC.B %11111111
DC.B %11111111
ENDP
;-------------------------------------------------------------------------;
; S_WindowData
;
; S_ConstData contains constant data used by SS. This includes
; dialog and window templates, icons, etc.
S_WindowData PROC EXPORT
EXPORT S_WindowParms
EXPORT S_WinRect
EXPORT S_WinPlane
EXPORT S_WinEnd
EXPORT S_DefWinRect
EXPORT S_WinColors
EXPORT S_FrameColor
EXPORT S_TitleColor
EXPORT S_TBarColor
EXPORT S_GrowColor
EXPORT S_InfoBarColor
EXPORT S_RScrollTemp
EXPORT S_RSRect
EXPORT S_RSValue
EXPORT S_RSViewSize
EXPORT S_BScrollTemp
EXPORT S_BSRect
EXPORT S_BSValue
EXPORT S_BSViewSize
EXPORT S_BSDataSize
EXPORT S_GrowTemp
EXPORT S_GrowRect
EXPORT S_OKTxt
EXPORT S_CancelTxt
EXPORT S_SetFixDlog
EXPORT S_SfOK
EXPORT S_SfCancel
EXPORT S_SfText
EXPORT S_SfTxtMsg
EXPORT S_SfCount
EXPORT S_SfCountTxt
EXPORT S_SfCountNum
S_DefaultWinTitle STR 'S'
S_WindowParms DC.W S_WinEnd-S_WindowParms ; Parameter block length
DC.W %1100001110000000 ; simple window
S_WinTitlePtr DC.L S_DefaultWinTitle ; Title
DC.L 2 ; RefCon
DC.W 0,0,0,0 ; Full Size (default)
DC.L 0 ; Color table pointer (default)
DC.W 0,0 ; Effective TM origin
DC.W 0,0 ; Data size
DC.W 0,0 ; Max content size (default)
DC.W 0,0 ; # scroll pixels (GUESS)
DC.W 0,0 ; # page pixels (GUESS)
DC.L 0 ; Info bar data (none)
DC.W 0 ; Info bar height (none)
DC.L 0 ; Frame defproc (default)
DC.L 0 ; Info bar defproc (none)
DC.L 0 ; Content defproc
S_WinRect DC.W 28,8,197,633 ; Starting Rectangle
S_WinPlane DC.L $FFFFFFFF ; Starting plane (front)
DC.L 0 ; Address (any)
S_WinEnd
S_DefWinRect DC.W 28,8,197,633
S_WinColors
S_FrameColor DS.B 2
S_TitleColor DS.B 2
S_TBarColor DS.B 2
S_GrowColor DS.B 2
S_InfoBarColor DS.B 2
DS.B 10
S_RScrollTemp
S_RSRect DS.B 8 ; Bounds Rect Ptr
DC.L 0 ; Title
DC.W $0003 ; Vis, Vert. Scroll bar
S_RSValue DC.W 0 ; Starting Value
S_RSViewSize DC.W 0 ; View Size
DC.W S_RDataSize ; Data Size
DC.L $06000000 ; DefProc
DC.L S_RSRefCon ; RefCon
DC.L 0 ; Color Table (default)
S_BScrollTemp
S_BSRect DS.B 8 ; Bounds Rect
DC.L 0 ; Title
DC.W $001C ; Vis, Horiz. Scroll bar
S_BSValue DC.W 0 ; Starting Value
S_BSViewSize DC.W S_BViewSize ; View Size
S_BSDataSize DC.W S_BDataSize-6 ; Data Size
DC.L $06000000 ; DefProc
DC.L S_BSRefCon ; RefCon
DC.L 0 ; Color Table (default)
S_GrowTemp
S_GrowRect DS.B 8 ; Bounds Rect
DC.L 0 ; Title
DC.W $0000 ; Vis, Horiz. Scroll bar
DC.W 0 ; Starting Value
DC.W 0 ; View Size
DC.W 0 ; Data Size
DC.L $08000000 ; DefProc
DC.L S_GrowRefCon ; RefCon
DC.L 0 ; Color Table (default)
;---------------------------------------------------------------------------
; Set Decimal Places Dialog
;
; 1 = OK
; 2 = Cancel
; 4 = 'Fixed decimal places'
; 5 = DigitCount
S_OKTxt STR 'OK'
S_CancelTxt STR 'Cancel'
S_SetFixDlog DC.W 48,185,101,462
DC.W 1
DC.L 0
DC.L S_SfOK,S_SfCancel,S_SfText,S_SfCount
DC.L 0
S_SfOK DC.W 1
DC.W 37,155,50,230
DC.W $000A
DC.L S_OKTxt
DC.W 0
DC.W 0
DC.L 0
S_SfCancel DC.W 2
DC.W 37,40,50,115
DC.W $000A
DC.L S_CancelTxt
DC.W 0
DC.W 0
DC.L 0
S_SfText DC.W 4
DC.W 4,40,17,200
DC.W $800F
DC.L S_SfTxtMsg
DC.W 0
DC.W 0
DC.L 0
S_SfTxtMsg STR 'Fixed decimal places:'
S_SfCount DC.W 5
DC.W 2,210,15,230
DC.W $8011
DC.L S_SfCountTxt
DC.W 1 ; 1 char LE width
DC.W 0
DC.W 0
S_SfCountTxt STR '2'
S_SfCountNum DS.B 2
ENDP
;----------------------------------------------------------------------------
; S_ErrorData
;
S_ErrorData PROC EXPORT
EXPORT S_ErrorBadVersion
EXPORT S_ErrorBadFile
EXPORT S_ErrorProdos
EXPORT S_InvalidCellStr
EXPORT S_CircularityMsg
EXPORT S_PasteFormatMsg
EXPORT S_PasteValueMsg
EXPORT S_NoMoveReasonMsg
EXPORT S_AworksMemError
EXPORT S_TitleTooBigStr
EXPORT S_DepOnMeTreeTooBig
EXPORT S_BadPasteMsg
EXPORT S_BadMoveMsg
EXPORT S_BadTransposeMsg
EXPORT S_BadInsertMsg
EXPORT S_ProtectedCellMsg
EXPORT S_ExtraDataMsg
EXPORT S_RecalcMemError
S_ErrorBadVersion DC.B 61
DC.B 'A newer version of AppleWorks.GS is needed'
DC.B 13
DC.B 'to load this file.'
S_ErrorBadFile str 'This file is not a valid SS file.'
S_ErrorProdos str 'ProDOS Error occured.'
S_InvalidCellStr str 'That is not a valid cell reference.'
S_CircularityMsg str 'Circular references have been introduced.'
S_PasteFormatMsg str 'Please copy a single SpreadSheet cell first.'
S_PasteValueMsg str 'Please copy a portion of a SpreadSheet first.'
S_NoMoveReasonMsg str 'Moving cells onto themselves has no effect.'
S_AworksMemError str 'Not enough memory to load in New column widths.'
S_TitleTooBigStr str 'Titles may not contain more than 35 rows or cols.'
S_DepOnMeTreeTooBig
str 'Cell dependency limit has been exceeded. Cell',13,'values may be incorrect.'
S_BadPasteMsg DC.B 74
DC.B 'This paste cannot be completed. Cells would'
DC.B 13
DC.B 'be pasted off the spreadsheet.'
S_BadMoveMsg DC.B 72
DC.B 'This move cannot be completed. Cells would'
DC.B 13
DC.B 'be moved off the spreadsheet.'
S_BadTransposeMsg DC.B 72
DC.B 'Transpose cannot be completed. Cells would'
DC.B 13
DC.B 'be moved off the spreadsheet.'
S_BadInsertMsg DC.B 88
DC.B 'This insertion cannot be completed. Non-empty'
DC.B 13
DC.B 'cells would be pushed off the spreadsheet.'
S_ProtectedCellMsg DC.B 70
DC.B 'This operation cannot be completed. Protected'
DC.B 13
DC.B 'cells would be modified.'
S_ExtraDataMsg DC.B 71
DC.B 'Proceeding with this operation will Destroy'
DC.B 13
DC.B 'data in non-selected cells.'
S_RecalcMemError DC.B 122
DC.B 'Not enough memory to complete cell calculation.'
DC.B 13
DC.B 'Some cells may not be correct. Closing windows'
DC.B 13
DC.B 'or deleting cells may help.'
ENDP
END