mirror of
https://github.com/antoinevignau/source.git
synced 2024-11-15 13:05:18 +00:00
1 line
25 KiB
Plaintext
1 line
25 KiB
Plaintext
|
LOAD 'Macros.dump'
INCLUDE 'SS.equ'
INCLUDE 'Driver.equ'
INCLUDE 'Heap.aii.i'
;-----------------------------------------------
;
; Imported addresses
;
;-----------------------------------------------
IMPORT D_AlertBox
IMPORT D_BeachBall
IMPORT D_BitMapChanged
IMPORT D_BitMapPtr
IMPORT D_Close2
IMPORT D_Create2
IMPORT D_GetMark2
IMPORT D_MemoryError
IMPORT D_Open2
IMPORT D_OpenId
IMPORT D_Read2
IMPORT D_ReadLong2
IMPORT D_ReadWord2
IMPORT D_SetRefCon
IMPORT D_SetMark2
IMPORT D_Str1
IMPORT D_StrToStr1
IMPORT D_Write2
IMPORT D_WriteLong2
IMPORT D_WriteWord2
IMPORT X_FormatValue
IMPORT E_ExpandFormula
IMPORT S_AcceptCell
IMPORT S_ActivateScrlBars
IMPORT S_AddCellToChangedList
IMPORT S_BSValue
IMPORT S_CurBRMost
IMPORT S_CurBRSelect
IMPORT S_CurBScrl
IMPORT S_CurChangedList
IMPORT S_CurColumnWds
IMPORT S_CurEditFlag
IMPORT S_CurHeap
IMPORT S_CurMaxTLCell
IMPORT S_CurRScrl
IMPORT S_CurRowBlock
IMPORT S_CurSheet
IMPORT S_CurState
IMPORT S_CurTLCell
IMPORT S_CurTLSelect
IMPORT S_CurWindow
IMPORT S_DisposeRowBlock
IMPORT S_ErrorBadFile
IMPORT S_ErrorBadVersion
IMPORT S_FileBSValue
IMPORT S_FileRSValue
IMPORT S_GetCellIndex
IMPORT S_GetCellPtr
IMPORT S_InsertControls
IMPORT S_LoadCharts
IMPORT S_NewLineEdit
IMPORT S_NewSheet
IMPORT S_NormalizeRange
IMPORT S_QTraverse
IMPORT S_RSValue
IMPORT S_RemoveCell
IMPORT S_SaveCharts
IMPORT S_SetBRMostCell
IMPORT S_SetMaxTLCell
IMPORT S_StateSize
IMPORT S_SwapIn
IMPORT S_SwapOut
;-----------------------------------------------
;
; Forward addresses and entries
;
;-----------------------------------------------
ENTRY S_FileID
ENTRY S_GetFileCell
ENTRY S_LoadCellsIntoSheet
ENTRY S_LoadColWds
ENTRY S_LoadRecalculateList
ENTRY S_ReadInMore
ENTRY S_SaveAsciiCell
ENTRY S_SaveCellAscii
ENTRY S_SaveCellsFromSheet
ENTRY S_SaveColWds
ENTRY S_SaveRecalculateList
ENTRY S_WriteOutMore
; Definition of File Sheet structure
; This is modeled after the scrap structure
; S_FileRows gequ 0
; S_FileCols gequ 2
; S_FileSheetSize gequ 4
; S_FileSheet gequ 8
; S_FileCellLoc gequ 0
; S_FileCellSize gequ 4
; S_FileFormat gequ 6
; S_FileValueSize gequ 10
; S_FileValue gequ 11
;------------------------------------------------------------------------
;
;
S_FileIOData PROC EXPORT
EXPORT S_LoadingFile
EXPORT S_FileBufferSize
EXPORT S_UsedBufferSize
EXPORT S_FilePtr
EXPORT S_FileSize
EXPORT S_SheetSizeAcc
ENTRY S_FileID
S_LoadingFile DC.W 0
S_FileBufferSize DS.W 1
S_UsedBufferSize DS.W 1
S_FilePtr DS.L 1
S_FileSize DS.L 1
S_SheetSizeAcc DS.L 1
S_FileID DS.W 1
ENDP
;-------------------------------------------------------------------------;
; S_OpenDoc ( Window:l )
;
; S_OpenDoc is called to read in SS data from a user specified file.
; Window is the window returned by the previous MakeWin call.
; The file Mark is set just after any driver header information in the file.
; All tool or ProDOS errors should be returned.
S_OpenDoc PROC EXPORT
;Using D_IOData
;Using D_GlobalData
;Using S_CurrentData
;Using S_WindowData
;Using S_ErrorData
;Using S_FileIOData
input FileId:w,Window:l
local CellIndex:l,ChartSize:l
local HeapSize:l,Ptr:l
error ErrorFlag
BEGIN +b
stz ErrorFlag
inc S_LoadingFile
lda #0
Call S_SwapIn,in=(a:w,a:w)
MoveLong Window,S_CurWindow
; Make the fileid global so that all of the sub-routines can use it.
MoveWord FileId,S_FileID
; Get version number. If version number does not match current version
; number then file format is not compatible so warn user.
Call D_ReadWord2,in=(FileId:w),out=(a:w),err=ErrorFlag
bcs doProdosError1
cmp #S_FileVersion1v3 ; release version 1.0v3
beq versionOK ; minor changes (like not writeing, can read 1.0v2
cmp #S_FileVersion1v2 ; release version 1.0v2
beq versionOK ; no change from 1.0v1, except for new functions
cmp #S_FileVersion1v1 ; release versio
|