diff --git a/.DS_Store b/.DS_Store index 882177a..3f78d83 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/appleworksgs/Heap/.DS_Store b/appleworksgs/Heap/.DS_Store new file mode 100644 index 0000000..a69bbfd Binary files /dev/null and b/appleworksgs/Heap/.DS_Store differ diff --git a/appleworksgs/Heap/Heap.aii.i b/appleworksgs/Heap/Heap.aii.i new file mode 100755 index 0000000..7c4a262 --- /dev/null +++ b/appleworksgs/Heap/Heap.aii.i @@ -0,0 +1 @@ +; ; Heap.aii.i ; ; Imports and macros for the Heap. ; ; Copyright 1989, Claris Corporation ; ; 5/3/89 Kevin A. Watts from older H_Heap.aii.i and H_Block.aii.i ; ;---------------------------------------------------------------- IF &Type('&__FILE__') = 'UNDEFINED' THEN gblc &__FILE__ &__FILE__ setc '' ENDIF H_TOO_OLD equ -1 H_TOO_NEW equ -2 H_BAD equ -3 IF &__FILE__ 'Heap' THEN IMPORT H_Init IMPORT H_CurrentHeap IMPORT H_SetHeap IMPORT H_UnsetHeap IMPORT H_ResetHeap IMPORT H_NewHeap IMPORT H_DisposeHeap IMPORT H_ReadHeap IMPORT H_WriteHeap ENDIF IF &__FILE__ 'Block' THEN IMPORT H_NewBlock IMPORT H_DisposeBlock IMPORT H_ResizeBlock IMPORT H_CopyBlock IMPORT H_GetBlockPtr IMPORT H_GetBlockSize IMPORT H_TruncHeap ENDIF ;---------------------------------------------------------------- IF &__FILE__ 'Heap' AND &__FILE__ 'Block' THEN MACRO H_Init ; H_Init jsl H_Init ENDM MACRO ; H_SetHeap H_SetHeap &Heap IF &Heap='' THEN AERROR 'Bad usage of: H_SetHeap HeapID' ENDIF MoveLong &Heap,xy jsl H_SetHeap ENDM MACRO ; H_UnsetHeap H_UnsetHeap jsl H_UnsetHeap ENDM MACRO ; H_ResetHeap H_ResetHeap jsl H_ResetHeap ENDM MACRO ; H_NewHeap H_NewHeap &Heap,&err== IF &Heap='' THEN AERROR 'Bad usage of: H_NewHeap HeapID [,err=]' ENDIF jsl H_NewHeap IF &err'' THEN sty &err ENDIF MoveLong ax,&Heap ENDM MACRO ; H_DisposeHeap H_DisposeHeap jsl H_DisposeHeap ENDM MACRO ; H_WriteHeap H_WriteHeap &FileID,&err== IF &FileID='' THEN AERROR 'Bad usage of: H_WriteHeap FileID [,err=]' ENDIF MoveWord &FileID,x jsl H_WriteHeap IF &err'' THEN sty &err ENDIF ENDM MACRO ; H_ReadHeap H_ReadHeap &FileID,&Heap,&err== IF &Heap='' OR &FileID='' THEN AERROR 'Bad usage of: H_ReadHeap FileID, HeapID [,err=]' ENDIF MoveWord &FileID,x jsl H_ReadHeap IF &err'' THEN sty &err ENDIF MoveLong ax,&Heap ENDM MACRO ; H_NewBlock H_NewBlock &Size,&Index,&Ptr,&err== IF &Size='' OR &Index='' THEN AERROR 'Bad usage of: H_NewBlock Size, Index [,Ptr] [,err=]' ENDIF SpaceLong MoveLong &Size,xy jsl H_NewBlock IF &err'' THEN sty &err ENDIF IF &Index='ax' OR &Index='ay' THEN AERROR 'Bad usage of H_NewBlock: Index may not be ax or ay' ENDIF MoveLong ax,&Index IF &Ptr='' THEN pla pla ELSE PullLong &Ptr ENDIF ENDM MACRO ; H_DisposeBlock H_DisposeBlock &Index IF &Index='' THEN AERROR 'Bad usage of: H_DisposeBlock Index' ENDIF MoveLong &Index,xy jsl H_DisposeBlock ENDM MACRO ; H_ResizeBlock H_ResizeBlock &Index,&Size,&Ptr,&err== IF &Index='' OR &Size='' THEN AERROR 'Bad usage of: H_ResizeBlock Index, Size [,Ptr] [,err=]' ENDIF PushLong &Index MoveLong &Size,xy jsl H_ResizeBlock IF &err'' THEN sty &err ENDIF IF &Ptr'' THEN MoveLong ax,&Ptr ENDIF ENDM MACRO ; H_CopyBlock H_CopyBlock &Index,&NewIndex,&NewPtr,&err== IF &Index='' OR &NewIndex='' THEN AERROR 'Bad usage of: H_CopyBlock Index, NewIndex [,NewPtr] [,err=]' ENDIF SpaceLong MoveLong &Index,xy jsl H_CopyBlock IF &err'' THEN sty &err ENDIF IF &NewIndex='ax' OR &NewIndex='ay' THEN AERROR 'Bad usage of H_CopyBlock: NewIndex may not be ax or ay' ENDIF MoveLong ax,&NewIndex IF &NewPtr='' THEN pla pla ELSE PullLong &NewPtr ENDIF ENDM MACRO ; H_GetBlockPtr H_GetBlockPtr &Index,&Ptr IF &Index='' OR &Ptr='' THEN AERROR 'Bad usage of: H_GetBlockPtr Index, Ptr' ENDIF MoveLong &Index,xy jsl H_GetBlockPtr MoveLong ax,&Ptr ENDM MACRO ; H_GetBlockSize H_GetBlockSize &Index,&Size IF &Index='' OR &Size='' THEN AERROR 'Bad usage of: H_GetBlockSize Index, Size' ENDIF MoveLong &Index,xy jsl H_GetBlockSize MoveLong ax,&Size ENDM MACRO ; H_TruncHeap H_TruncHeap jsl H_TruncHeap ENDM ENDIF \ No newline at end of file diff --git a/appleworksgs/Heap/Heap.equ b/appleworksgs/Heap/Heap.equ new file mode 100755 index 0000000..f7c9304 --- /dev/null +++ b/appleworksgs/Heap/Heap.equ @@ -0,0 +1 @@ +; ; Heap.equ ; ; Heap memory managment module equates ; ; Copyright 1989 Claris Corporation ; ; 1-25-89 Begun by Kevin A. Watts ; ;-------------------------------------------------------------- H_MAX_FREE_LIST equ 64 ; maximum data size of blocks in free lists H_BLOCK_GRAN equ 2 ; must be a power of 2 H_N_FREE_LISTS equ (H_MAX_FREE_LIST/H_BLOCK_GRAN+1) H_HeaderRec RECORD 0 ; Structure of a heap header block Header DS.L 1 ; handle to the header block Version DS.L 1 ; heap version # (at offset 4 for compatability) HeaderPtr DS.L 1 ; pointer to the header block NumISegments DS.W 1 ; # of index segments NumDSegments DS.W 1 ; # of data segments FreeIndex DS.L 1 ; index free list head EndIndex DS.W 1 ; offset to never used portion of newest index segment ZHEADER_SHORT_SIZE equ * FreeListArray DS.L 1 ; = HeaderPtr + FreeLists ISegHandleLo DS.L 1 ; = HeaderPtr + ISegHandle ISegHandleHi DS.L 1 ; = HeaderPtr + ISegHandle+2 DSegHandleLo DS.L 1 ; = HeaderPtr + DSegHandle DSegHandleHi DS.L 1 ; = HeaderPtr + DSegHandle+2 ISegPtrLo DS.L 1 ; = HeaderPtr + ISegPtr ISegPtrHi DS.L 1 ; = HeaderPtr + ISegPtr+2 DSegPtrLo DS.L 1 ; = HeaderPtr + DSegPtr DSegPtrHi DS.L 1 ; = HeaderPtr + DSegPtr+2 ZHEADER_SIZE equ * FreeLists DS.W H_N_FREE_LISTS ; free list heads for each block size (segment #s) HANDLE_ARRAY equ * ;Array of index segment handles DS.L H_MaxSegments ;Array of index segment pointers DS.L H_MaxSegments ;Array of data segment handles DS.L H_MaxSegments ;Array of data segment pointers DS.L H_MaxSegments ENDR ; H_HeaderRec ;------------ H_VariablesRec RECORD H_HeaderRec.ZHEADER_SIZE ; Heap variables ; 'Globals' - maintain value across heap calls H_ZPptr DS.L 1 ; Pointer to zero page H_IsLocked DS.W 1 ; Flag - is current heap locked? H_MaxSegments DS.W 1 ; Maximum number each of index & data segments H_HeaderSize DS.W 1 ; Size of heap header H_DSegHOffsetLo DS.W 1 ; Offset to array of handles to data segments H_DSegHOffsetHi DS.W 1 ; " + 2 H_ISegPOffsetLo DS.W 1 ; Offset to array of pointers to index segments H_ISegPOffsetHi DS.W 1 ; " + 2 H_DSegPOffsetLo DS.W 1 ; Offset to array of pointers to data segments H_DSegPOffsetHi DS.W 1 ; " + 2 ; 'Locals' - not assumed to maintain value across heap calls BlockSize DS.W 1 ; = DataSize + H_BLOCK_OVERHEAD CopyHdr DS.W 1 ; Flag to control header copying DP DS.W 1 ; place to store save direct page value DataSize DS.L 1 ; size of data block EndPtr DS.L 1 ; Pointer to end of used portion of index table ErrorFlag DS.W 1 FreeListOffset DS.W 1 ; Offset into an array of free lists HasMoved DS.W 1 ; Flag - has heap header moved? Index DS.L 1 ; an index ISegPtr DS.L 1 ; pointer to an index segment SkipLastResort DS.W 1 ; Flag - skip last resort allocation? MaxFreeSeg DS.W 1 ; segment with most free space MaxFreeSpace DS.W 1 ; free space in MaxFreeSeg NewHeap DS.L 1 ; handle of heap to set Offset DS.W 1 ; block offset within a segment OldIndex DS.L 1 ; an index OldPtr DS.L 1 ; a pointer OldSize DS.L 1 ; size of data block Ptr DS.L 1 ; generic ptr (usually to a data block) SegHandle DS.L 1 ; handle of a data segment Segment DS.W 1 ; a segment number SegPtr DS.L 1 ; pointer to a data segment SegSize DS.W 1 ; segment size VARIABLE_SPACE equ * ; total size of variables ENDR ; H_Globals ---------------------- ;------------ H_ZPSIZE equ H_HeaderRec.ZHEADER_SIZE+H_VariablesRec.VARIABLE_SPACE-H_VariablesRec H_ZPATTR equ attrBank+attrFixed+attrLocked+attrPage IMPORT D_ZeroBlock \ No newline at end of file diff --git a/appleworksgs/Heap/Heap.link b/appleworksgs/Heap/Heap.link new file mode 100755 index 0000000..c372177 --- /dev/null +++ b/appleworksgs/Heap/Heap.link @@ -0,0 +1 @@ + -lseg{Kind} HEAP Source:AWGS:Heap:Obj:Heap.aii.o Source:AWGS:Heap:Obj:Block.aii.o \ No newline at end of file diff --git a/appleworksgs/Heap/Heap.make b/appleworksgs/Heap/Heap.make new file mode 100755 index 0000000..222f882 --- /dev/null +++ b/appleworksgs/Heap/Heap.make @@ -0,0 +1 @@ +# # Heap.make - Makefile for Heap # # Copyright 1989, Claris Corporation. # # This is a sub-makefile, called recursively when ::AppleWorks.make is # executed. # # All modules (including Driver, Scrap, Pict, SS, DB, etc.) # should have similar makefiles in their respective folders. # # This makefile rebuilds the module object files as necessary and creates a # file containing the necessary steps to link the module with the rest of # AppleWorksGS. ::AppleWorks.make combines the link files from the modules # into a script which it executes to create an executable. #-------------------------------------------------------------------------------- # Variables AsmIIGSOptions = -i {HeapIncDir},{AWGS}Driver,{AWGS}Macros -d ErrorCheck=0,Verbose=0,VerboseErrors=0,Debug=0,Profile=0 -d DriverSupport=1,HeapIO=3,Squeezing=1,GrowBlocks=1 -d VariableDSegSize=1,VariableISegSize=0,UseLastResort=0 -d ZeroInit=1,ReadV70=1 Segment = HEAP Module = Heap ModuleDir = {AWGS}{Module}: HeapSrcDir = {AWGS}Heap:Src: HeapIncDir = {AWGS}Heap: HeapObjDir = {AWGS}Heap:Obj: Linkfile = {ModuleDir}{Module}.link Makefile = {ModuleDir}{Module}.make HeapIncludes = {HeapIncDir}Heap.equ {HeapSrcDir}HeapPrivate.equ {HeapSrcDir}Heap.mac {HeapIncDir}Heap.aii.i GlobalMacros = {AWGS}Macros:Macros.Dump {AWGS}Macros:m16.profile Objs = {HeapObjs} HeapObjs = {HeapObjDir}Heap.aii.o {HeapObjDir}Block.aii.o # {HeapObjDir}X_Heap.aii.o # temporary glue routines #-------------------------------------------------------------------------------- # Main target {Linkfile} {Objs} {Makefile} @echo "# Creating {LinkFile} " @echo " -lseg{Kind} {Segment} {Objs} " > {Targ} # Global heap dependencies {HeapObjs} {HeapIncludes} {GlobalMacros} {Makefile} clean @confirm "Delete {Module} objs and linkfile?" @if {status} == 0 then delete {Linkfile} {Objs} @end #-------------------------------------------------------------------------------- # Default rules .aii.o .aii AsmIIGS {DepDir}{Default}.aii -o {TargDir}{Default}.aii.o {AsmIIGSOptions} {HeapObjDir} {HeapSrcDir} \ No newline at end of file diff --git a/appleworksgs/Heap/Src/Block.aii b/appleworksgs/Heap/Src/Block.aii new file mode 100755 index 0000000..f8f420f --- /dev/null +++ b/appleworksgs/Heap/Src/Block.aii @@ -0,0 +1 @@ +; ; Block.aii ; ; Heap block allocation and deallocation routines ; ; Copyright 1989 Claris Corporation ; ; 1/25/89 Begun by Kevin A. Watts ; ;-------------------------------------------------------------- ; Routines: all operate on the current heap ; ; H_NewBlock(Size:xy): Index:ax ; allocate a new block and index ; H_DisposeBlock(Index:xy) ; dispose of a block ; H_ResizeBlock(Index:l,DataSize:xy): Ptr:ax ; resize a block ; H_CopyBlock(OldIndex:xy): Index:ax, Ptr:l ; copy a block ; H_GetBlockPtr(Index:xy): Ptr:ax ; get pointer to block ; H_GetBlockSize(Index:xy): Size:ax ; get size of block ; H_TruncHeap() ; shrink the heap to its minimum size ; ; NewIndex() ; allocate a new index ; DisposeIndex() ; dispose of an index ; NewBlock() ; allocate a new block ; DisposeBlock() ; dispose of a block ; CompactMoveBlock() ; move a block in SqueezeHeap or CompactSegment ; SqueezeHeap(DisposeFlag:x) ; squeeze the heap into as few segments as possible ; CompactSegment() ; compact a data segment ; NewDataSegment() ; create and initialize a new data segment ; VerifyIndex() ; verify the index in Index ;-------------------------------------------------------------- PRINT PUSH PRINT OFF LOAD 'Macros.Dump' gblc &__FILE__ &__FILE__ setc 'Block' include 'Heap.mac' include 'HeapPrivate.equ' include 'm16.profile' include 'Driver.equ' ENTRY H_NewBlock ENTRY H_DisposeBlock ENTRY H_ResizeBlock ENTRY H_CopyBlock ENTRY H_GetBlockPtr ENTRY H_GetBlockSize ENTRY H_TruncHeap ENTRY NewIndex ENTRY DisposeIndex ENTRY NewBlock ENTRY DisposeBlock IF Squeezing THEN ENTRY SqueezeHeap ENDIF ENTRY CompactSegment ENTRY NewDataSegment IF ErrorCheck THEN ENTRY VerifyIndex ENDIF PRINT POP ;;-------------------------------------------------------------- ; H_NewBlock(DataSize:xy): Index:ax, NewBlockPtr:l ; error status returned in y, with x used to indicate ; error in index (-1) or block (0) allocation ; ; Allocate a new block of the specified size in the current heap. ; NewBlockPtr and Index are invalid if any error occurs. ; Zpage variables modified: ; DataSize ; NewIndex() ; NewBlock() ; DisposeIndex() H_NewBlock PROC EXPORT BeginZ NewBlockPtr equ 6 ; stack frame w/offsets: ; 1: return address (3 bytes) ; 4: saved direct page (2 bytes) ; 6: space for returned pointer (4 bytes) MoveLong xy,DataSize ; save the requested block size jsr NewIndex bcs noIndex IF UseLastResort THEN stz SkipLastResort ENDIF jsr NewBlock bcs noBlock sta NewBlockPtr,s txa sta NewBlockPtr+2,s MoveLong Index,ax ;ldy #0 - y = 0 after NewBlock without error ReturnZ noIndex IF VerboseErrors THEN phy Call D_AlertBox,in=(#OkBox:w,#NoIndexMesg:l),out=(a:w) ply sec DEBRK3 ENDIF ldx #-1 ReturnZ noBlock phy jsr DisposeIndex IF VerboseErrors THEN Call D_AlertBox,in=(#OkBox:w,#NoBlockMesg:l),out=(a:w) DEBRK3 ENDIF ply ldx #0 sec ReturnZ IF VerboseErrors THEN NoIndexMesg str 'H_NewBlock: Unable to allocate index' NoBlockMesg str 'H_NewBlock: Unable to allocate block' ENDIF ENDP ;;-------------------------------------------------------------- ; H_DisposeBlock(Index:xy) ; no error status is returned ; ; Dispose of the specified block in the current heap. ; Zpage variables modified: ; Index ; ISegPtr ; DisposeBlock() ; DisposeIndex() H_DisposeBlock PROC EXPORT BeginZ MoveLong xy,Index ; save the index tya beq disposeZeroError IF Profile THEN ProfileIn 9,_H ldx Index ENDIF ; get ptr to index segment lda [H_ISegPtrHi],y sta ISegPtr+2 lda [H_ISegPtrLo],y sta ISegPtr jsr DisposeBlock jsr DisposeIndex ProfileOut 9,_H IF (ErrorCheck = 0) THEN disposeZeroError ENDIF ReturnZ IF ErrorCheck THEN disposeZeroError SpaceWord PushWord #OkBox PushLong #dzMesg jsl D_AlertBox pla DEBRK2 ReturnZ dzMesg str 'H_DisposeBlock: Attempt to dispose of index $00xx!' ENDIF ; ErrorCheck ENDP ;;-------------------------------------------------------------- ; H_ResizeBlock(Index:l,DataSize:xy): Ptr:ax ; error status returned in y ; ; Resize the specified block in the current heap. ; Ptr is valid even if an error occurs ; This routine is a mess. ; Zpage variables modified: ; BlockSize ; DataSize ; DP (also aliased to NextOffset) ; ErrorFlag ; Index ; ISegPtr ; Offset ; OldIndex ; Ptr ; SegPtr ; DisposeBlock() ; NewBlock() ; H_GetBlockPtr() H_ResizeBlock PROC EXPORT NextOffset equ DP BeginZ MoveLong xy,DataSize ProfileIn 10,_H ; remove the input parameter from the stack and restore the return address PullWord DP ; pull the old direct page value php ; push an extra byte onto the stack plx ; pull the return address & extra byte in xy ply PullLong Index phy ; push the return address & extra byte back phx plp ; pull the extra byte off again PushWord DP ; push the old direct page value again IF ErrorCheck THEN MoveLong Index,xy jsr VerifyIndex bcc @1 ReturnZ @1 ENDIF ldy Index+2 ; index segment 0 => zero size (virtual) block bne indexOk ; can't resize block - not a real index IF ErrorCheck THEN Call D_AlertBox,in=(#OkBox:w,#ziMesg:l),out=(a:w) ENDIF lda #0 tax ldy #-1 sec ReturnZ indexOk ; get ptr to index segment lda [H_ISegPtrLo],y sta ISegPtr lda [H_ISegPtrHi],y sta ISegPtr+2 ; get data segment:offset from index ldy Index ; offset within I seg to index lda [ISegPtr],y ; offset within D seg to block sta Offset iny ; adjust to high word iny lda [ISegPtr],y ; data segment ; two cases: Sign bit clear => small block (index contains segment:offset) ; Sign bit set => large block (index contains flag:handle) ; or free index (index contains flag:next_index) JMI resizeHandle ; we now know that BlockSize < H_LARGE_BLOCK_SIZE < 64K IF UseLastResort THEN stz SkipLastResort ENDIF ; get the data segment pointer tay lda [H_DSegPtrLo],y sta SegPtr lda [H_DSegPtrHi],y sta SegPtr+2 ; get current size of block ldy Offset beq zeroBlock ; zero offset => zero size (virtual) block lda [SegPtr],y ; size sta BlockSize ; are we growing or shrinking the block? lda DataSize+2 JNE newAndDispose ; must be growing - the old block is < 64K lda DataSize cmp #H_LARGE_BLOCK_SIZE ; are we growing to a handle? JGE newAndDispose ; yes - old block is < H_LARGE_BLOCK_SIZE cmp BlockSize beq returnPtr ; same size JGE grow ; shrinking the block ; round up the DataSize to multiple of H_BLOCK_GRAN ;lda DataSize IF H_BLOCK_GRAN = 2 THEN ina ELSE clc adc #H_BLOCK_GRAN-1 ENDIF and #-H_BLOCK_GRAN sta DataSize beq shrinkToZero SubWord BlockSize,DataSize,BlockSize ; how much are we shrinking by? beq returnPtr ; - nothing (same size) ; BlockSize is now the difference between the old and new sizes ; shrink the block by storing the new data size ;ldy Offset ; offset to block - already in y lda DataSize sta [SegPtr],y ; create a new free block out of the freed space at the end of the block tya ; offset to block clc adc #H_BLOCK_OVERHEAD ; won't set carry adc DataSize tay ; offset to new free block lda BlockSize ; block size of new free block IF H_BLOCK_OVERHEAD = 2 THEN dea dea ELSE sec sbc #H_BLOCK_OVERHEAD ENDIF sta [SegPtr],y ; data size of new free block disposeNewFreeBlock ; put the new free block onto the appropriate free list ; we fake an index for the block by modifying the old one ; temporarily, and use DisposeBlock MoveWord Offset,OldIndex tya ; offset to new free block ldy Index sta [ISegPtr],y jsr DisposeBlock lda OldIndex ldy Index sta [ISegPtr],y sta Offset returnPtr ; return a pointer to the block ProfileOut 10,_H lda Offset clc adc #H_BLOCK_OVERHEAD adc SegPtr ldx SegPtr+2 bcc @1 inx @1 ldy #0 clc ReturnZ shrinkToZero ; create a zero size (virtual) block jsr DisposeBlock lda #0 ldy Index sta [ISegPtr],y iny iny sta [ISegPtr],y ; DataSize = 0, so we'll fall through here zeroBlock lda DataSize ; are we growing the block? ora DataSize+2 JNE newAndDispose IF Profile THEN ProfileOut 10,_H lda #0 ENDIF ; return 0 pointer to zero size (virtual) block ;lda #0 - a = 0 already tax tay ; no error clc ReturnZ resizeHandle IF ErrorCheck THEN cmp #H_LARGE_BLOCK_FLAG ; H_LARGE_BLOCK_FLAG > H_FREE_INDEX_FLAG blt freeIndex ENDIF ; ErrorCheck lda DataSize ora DataSize+2 beq shrinkToZero ; if the new block will definitely be a handle we'll just resize the ; one we've got, otherwise we'll allocate a new block, copy the data ; and dispose of the handle. We could just shrink the handle, but ; then handles would never go away. IF UseLastResort THEN MoveWord #1,SkipLastResort ENDIF lda DataSize+2 bne resizeH CmpWord DataSize,#H_LARGE_BLOCK_SIZE JLT newAndDispose resizeH PushLong DataSize ldy Index lda [ISegPtr],y sta Ptr iny iny lda [ISegPtr],y and #$00FF sta Ptr+2 pha pei Ptr jsl D_GrowHandle bcc growOk pha ; save error code IF VerboseErrors THEN Call D_AlertBox,in=(#OkBox:w,#NoGrowHandleMesg:l),out=(a:w) DEBRK3 ENDIF ; we failed, but return a pointer to the block anyway MoveLong [Ptr],ax ply ; error code sec ReturnZ growOk ProfileOut 10,_H ; return the data pointer MoveLong [Ptr],ax ldy #0 ; no error clc ReturnZ IF ErrorCheck THEN freeIndex Call D_AlertBox,in=(#OkBox:w,#fiMesg:l),out=(a:w) lda #0 tax ldy #-1 sec DEBRK2 ReturnZ fiMesg str 'H_ResizeBlock: Attempt to resize a free index!' ENDIF ; ErrorCheck grow ; new size > old size IF GrowBlocks THEN ; try to extend the block in place ; a = DataSize ; y = Offset to block ; is this block at the end of the used portion of the segment? tya ; adjust offset to end of block clc adc #H_BLOCK_OVERHEAD adc BlockSize ldy #H_SegEnd cmp [SegPtr],y blt checkNextBlock ; not at end of used portion AddWord Offset,DataSize,a ; offset to new end of block - won't set carry adc #H_BLOCK_OVERHEAD IF VariableDSegSize THEN dea ldy #H_SegSize cmp [SegPtr],y ELSE cmp #H_DSEG_SIZE+1 ENDIF JGE newAndDispose ; block would extend past end of segment ; adjust SegEnd and SegFreeSpace SubWord DataSize,BlockSize,BlockSize IF VariableDSegSize THEN ldy #H_SegEnd ENDIF AddWord a,[SegPtr]:y,[SegPtr]:y ldy #H_SegFreeSpace SubWord [SegPtr]:y,BlockSize,[SegPtr]:y ; extend the block into the unused portion of the segment ldy Offset lda DataSize sta [SegPtr],y brl ReturnPtr checkNextBlock ; just checking 1 block - could check more tay ; a = offset to next block lda [SegPtr],y ; size field bpl newAndDispose ; next block is in use and #$7FFF ; clear sign bit clc adc #H_BLOCK_OVERHEAD adc BlockSize cmp DataSize blt newAndDispose ; extend block into next block sty NextOffset ldy Offset lda DataSize sta [SegPtr],y ; adjust SegFreeSpace ldy NextOffset ; get next block size lda [SegPtr],y and #$7FFF IF H_BLOCK_OVERHEAD = 2 THEN ; add H_BLOCK_OVERHEAD ina ina ELSE clc adc #H_BLOCK_OVERHEAD ENDIF pha ldy #H_SegFreeSpace SubWord [SegPtr]:y,1:s,[SegPtr]:y pla ; remove next block from its free list (if any) ldy NextOffset lda [SegPtr],y and #$7FFF cmp #H_MAX_FREE_LIST+1 ; is this block too large too bge leftover2 ; large to be on a free list? DivByPwr2 a,(H_BLOCK_GRAN/2) ; calculate free list offset bra removeLoopEntry removeLoop ; find this block on its free list IF H_BLOCK_OVERHEAD = 2 THEN ina ina ELSE clc adc #H_BLOCK_OVERHEAD ENDIF removeLoopEntry tay lda [SegPtr],y beq leftover ; reached end of free list cmp NextOffset bne removeLoop ; at block preceding used block in free list tyx IF H_BLOCK_OVERHEAD = 2 THEN ina ina ELSE clc adc #H_BLOCK_OVERHEAD ENDIF tay lda [SegPtr],y ; get link to block following used block txy sta [SegPtr],y ; replace link to used block leftover ; create a new block out of the leftover space ldy NextOffset lda [SegPtr],y ; get amount of leftover space and #$7FFF ; (minus H_BLOCK_OVERHEAD) leftover2 AddWord a,BlockSize,a SubWord a,DataSize,a JMI returnPtr ; no leftover space tax lda Offset ; get offset to new block clc adc #H_BLOCK_OVERHEAD adc DataSize tay MoveWord x,[SegPtr]:y ; store size of new block brl disposeNewFreeBlock ; backwards branch ENDIF newAndDispose ; allocate a new block, copy, and dispose of the old block ; need a new index (temporarily) - first remember the current one MoveLong Index,OldIndex jsr NewIndex bcs errorI jsr NewBlock bcc okNewBlock jsr DisposeIndex ; dispose of the temporary index ldx #0 bra errorB errorI ldx #-1 errorB sty ErrorFlag ldy OldIndex sty Index ldy OldIndex+2 sty Index+2 lda [H_ISegPtrHi],y sta ISegPtr+2 lda [H_ISegPtrLo],y sta ISegPtr ldy Index iny iny lda [ISegPtr],y JMI resizeH ; handle - try D_GrowHandle IF VerboseErrors THEN phx SpaceWord PushWord #OkBox txa beq @1 PushLong #NoIndexMesg bra @2 @1 PushLong #NoBlockMesg @2 jsl D_AlertBox pla plx DEBRK3 ENDIF ; we failed, but return a pointer to the block anyway MoveLong Index,xy jsl H_GetBlockPtr ldy ErrorFlag sec ReturnZ okNewBlock MoveLong ax,Ptr ; save ptr to new block ; here Index => new block, OldIndex => old block ; copy the data ldy OldIndex+2 lda [H_ISegPtrHi],y sta ISegPtr+2 lda [H_ISegPtrLo],y sta ISegPtr ldy OldIndex lda [ISegPtr],y sta Offset iny iny lda [ISegPtr],y ; segment # or flag bpl notHandle and #$00FF ; store handle into OldIndex sta OldIndex+2 lda Offset sta OldIndex ldy #2 ; deref handle lda [OldIndex],y pha lda [OldIndex] pha bra doMove notHandle tay lda [H_DSegPtrLo],y sta SegPtr lda [H_DSegPtrHi],y tax lda Offset clc adc #H_BLOCK_OVERHEAD adc SegPtr bcc @1 inx @1 phx pha doMove PushLong Ptr PushLong DataSize _BlockMove ; dispose of the old block PushLong Index ; save the new Index MoveLong OldIndex,Index jsr DisposeBlock PullLong Index ; restore the new Index ; set the old index to refer to the new block ; ISegPtr refers to the old index segment, SegPtr will refer to the temporary ldy Index+2 lda [H_ISegPtrHi],y sta SegPtr+2 lda [H_ISegPtrLo],y sta SegPtr ldy Index lda [SegPtr],y ldy OldIndex sta [ISegPtr],y ldy Index iny iny lda [SegPtr],y ldy OldIndex iny iny sta [ISegPtr],y ; dispose of the temporary index MoveLong SegPtr,ISegPtr jsr DisposeIndex ; return a pointer to the new block in ax ProfileOut 10,_H MoveLong Ptr,ax ldy #0 ; no error ReturnZ IF VerboseErrors THEN NoGrowHandleMesg str 'H_ResizeBlock: Unable to grow block handle' NoIndexMesg str 'H_ResizeBlock: Unable to get temporary index' NoBlockMesg str 'H_ResizeBlock: Unable to get new block' ENDIF IF ErrorCheck THEN ziMesg str 'H_ResizeBlock: Attempt to resize index $00xx!' ENDIF ENDP ;;-------------------------------------------------------------- ; H_CopyBlock(OldIndex:xy): Index:ax, Ptr:l ; error status returned in y, with x used to indicate ; error in index (FF) or block (0) allocation ; ; Copy a block in the current heap. ; Index and Ptr are invalid if any error occurs. ; Zpage variables modified: ; DataSize ; OldIndex ; Ptr ; H_GetBlockPtr() ; H_GetBlockSize() ; NewIndex() ; NewBlock() H_CopyBlock PROC EXPORT NewBlockPtr equ 6 ; stack frame w/offsets: ; 1: return address (3 bytes) ; 4: saved direct page (2 bytes) ; 6: space for returned pointer (4 bytes) BeginZ MoveLong xy,OldIndex IF ErrorCheck THEN jsr VerifyIndex bcc @1 ReturnZ @1 ENDIF IF Profile THEN ProfileIn 11,_H ldx OldIndex ENDIF jsl H_GetBlockSize MoveLong ax,DataSize jsr NewIndex bcs noIndex IF UseLastResort THEN stz SkipLastResort ENDIF jsr NewBlock bcs noBlock MoveLong ax,Ptr ; ptr to new block ;MoveLong ax,NewBlockPtr:s sta NewBlockPtr,s txa sta NewBlockPtr+2,s MoveLong OldIndex,xy jsl H_GetBlockPtr PushLong ax PushLong Ptr PushLong DataSize _BlockMove ProfileOut 11,_H MoveLong Index,ax ldy #0 ; no error clc ReturnZ noIndex IF VerboseErrors = 0 THEN ldx #-1 ReturnZ ELSE phy PushWord #-1 SpaceWord PushWord #OkBox PushLong #NoIndexMesg bra error ENDIF noBlock phy jsr DisposeIndex IF VerboseErrors = 0 THEN ply ldx #0 ReturnZ ELSE PushWord #0 SpaceWord PushWord #OkBox PushLong #NoBlockMesg error jsl D_AlertBox pla plx ; 0 or -1 ply ; error code ReturnZ ENDIF IF VerboseErrors THEN NoIndexMesg str 'H_CopyBlock: Unable to allocate index' NoBlockMesg str 'H_CopyBlock: Unable to allocate block' ENDIF ENDP ;;-------------------------------------------------------------- ; H_GetBlockPtr(Index:xy): Ptr:ax ; nil pointer returned in case of error ; ; Return a pointer to the specified block in the current heap. ; In case of error or a zero size block, Ptr will be nil. ; Zpage variables modified: ; Offset ; ISegPtr ; SegHandle H_GetBlockPtr PROC EXPORT BeginZ IF ErrorCheck THEN jsr VerifyIndex bcc @9 ReturnZ @9 ENDIF IF Profile THEN phx ProfileIn 12,_H plx ENDIF ; index: y = index segment #, x = offset within index segment tya ; index segment 0 => zero size (virtual) block beq zeroBlock ; get ptr to index segment lda [H_ISegPtrLo],y sta ISegPtr lda [H_ISegPtrHi],y sta ISegPtr+2 ; get data segment:offset from index txy ; offset within I seg to index lda [ISegPtr],y ; offset within D seg to block sta Offset iny ; adjust to high word iny lda [ISegPtr],y ; data segment ; two cases: Sign bit clear => small block (index contains segment:offset) ; Sign bit set => large block (index contains flag:handle) ; or free index (index contains flag:next_index) bmi handleOrFree beq zeroBlock ; data segment 0 => zero size (virtual block) ; case 1: small block ; accumulator contains segment # tay ; add offset to the segment pointer (at [H_DSegPtrLo/Hi],y). ; add H_BLOCK_OVERHEAD yielding ptr to data in block (returned in ax) lda [H_DSegPtrHi],y tax ; x = hi word lda Offset ; really the block offset clc adc #H_BLOCK_OVERHEAD ; this will NOT set carry on a valid heap adc [H_DSegPtrLo],y bcc @1 inx ; inc high word @1 IF Profile THEN PushLong ax ProfileOut 12,_H PullLong ax ENDIF ReturnZ zeroBlock ; a = 0 tax ReturnZ ; case 2: handle or free index handleOrFree IF ErrorCheck THEN cmp #H_LARGE_BLOCK_FLAG ; H_LARGE_BLOCK_FLAG > H_FREE_INDEX_FLAG blt freeIndex ENDIF ; ErrorCheck ; extract the handle from the index and store into SegHandle and #$00FF sta SegHandle+2 lda Offset sta SegHandle ; now dereference to get the data pointer in ax ldy #2 lda [SegHandle],y tax lda [SegHandle] IF Profile THEN PushLong ax ProfileOut 12,_H PullLong ax ENDIF ReturnZ IF ErrorCheck THEN freeIndex SpaceWord PushWord #OkBox PushLong #fiMesg jsl D_AlertBox pla lda #0 tax DEBRK2 ReturnZ fiMesg str 'H_GetBlockPtr: Attempt to dereference a free index!' ENDIF ; ErrorCheck ENDP ;;-------------------------------------------------------------- ; H_GetBlockSize(Index:xy): Size:ax ; zero size returned in case of error ; ; Return the size of the specified block in the current heap. ; Zpage variables modified: ; Offset ; ISegPtr ; SegPtr H_GetBlockSize PROC EXPORT BeginZ IF ErrorCheck THEN jsr VerifyIndex bcc @1 ReturnZ @1 ENDIF IF Profile THEN phx ProfileIn 13,_H plx ENDIF ; index: y = index segment #, x = offset within index segment tya ; index segment 0 => zero size (virtual) block beq zeroBlock ; get ptr to index segment lda [H_ISegPtrLo],y sta ISegPtr lda [H_ISegPtrHi],y sta ISegPtr+2 ; get data segment:offset from index txy ; offset within I seg to index lda [ISegPtr],y ; offset within D seg to block sta Offset iny ; adjust to high word iny lda [ISegPtr],y ; data segment ; two cases: Sign bit clear => small block (index contains segment:offset) ; Sign bit set => large block (index contains flag:handle) ; or free index (index contains flag:next_index) bmi handleOrFree beq zeroBlock ; data segment 0 => zero size (virtual block) ; case 1: small block ; accumulator contains segment # tay ; use offset and the segment pointer (at [H_DSegPtrLo/Hi],y) ; to get the size from the first word of the block. lda [H_DSegPtrLo],y sta SegPtr lda [H_DSegPtrHi],y sta SegPtr+2 ldy Offset lda [SegPtr],y ; size zeroBlock ldx #0 IF Profile THEN PushLong ax ProfileIn 13,_H PullLong ax ENDIF ReturnZ ; case 2: handle or free index handleOrFree IF ErrorCheck THEN cmp #H_LARGE_BLOCK_FLAG ; H_LARGE_BLOCK_FLAG > H_FREE_INDEX_FLAG blt freeIndex ENDIF ; ErrorCheck SpaceLong and #$00FF pha PushWord Offset _GetHandleSize ProfileOut 13,_H PullLong ax ReturnZ IF ErrorCheck THEN freeIndex SpaceWord PushWord #OkBox PushLong #fiMesg jsl D_AlertBox pla lda #0 tax DEBRK2 ReturnZ fiMesg str 'H_GetBlockSize: Attempt to dereference a free index!' ENDIF ; ErrorCheck ENDP ;;-------------------------------------------------------------- ; H_TruncHeap() ; ; shrink the heap to its minimum size ; Zpage variables modified: ; SqueezeHeap() H_TruncHeap PROC EXPORT BeginZ IF Squeezing THEN ldx #1 jsr SqueezeHeap ENDIF ReturnZ ENDP ; ;=====================================================================; ; LOCAL ROUTINES ; ;=====================================================================; ;-------------------------------------------------------------- ; NewIndex() ; ; Allocate a new index. ; ; post: Index will contain the index (segment:offset) ; ISegPtr will point to the index segment used ; return errors in y with carry set ; Zpage variables modified: ; H_EndIndex ; H_FreeIndex ; H_NumISegments ; Index ; ISegPtr NewIndex PROC ENTRY ProfileIn 7,_H ; first, try the free list ldy H_FreeIndex+2 ; segment of free index beq emptyFreeIndexList ; found a free index sty Index+2 lda [H_ISegPtrLo],y sta ISegPtr lda [H_ISegPtrHi],y sta ISegPtr+2 ldy H_FreeIndex ; offset of free index sty Index ; update the free list (the index contains the next free index) lda [ISegPtr],y ; offset to next free index sta H_FreeIndex IF ErrorCheck THEN cmp #H_ISEG_SIZE bge indexFreeListCorrupted and #%11 bne indexFreeListCorrupted ENDIF iny iny lda [ISegPtr],y ; segment to next free index + flag IF ErrorCheck THEN cmp #H_FREE_INDEX_FLAG+$1000 bge indexFreeListCorrupted cmp #H_FREE_INDEX_FLAG bge iflOk indexFreeListCorrupted Call D_AlertBox,in=(#OkBox:w,#iflcMesg:l),out=(a:w) ldy #-1 ; error value in y sec DEBRK2 rts iflOk ENDIF ; ErrorCheck and #$FF ; mask out the free index flag sta H_FreeIndex+2 IF ErrorCheck THEN cmp H_NumISegments bgt indexFreeListCorrupted and #%11 bne indexFreeListCorrupted ENDIF ProfileOut 7,_H ldy #0 clc rts emptyFreeIndexList ; nothing in free list - try end of last index segment ldy H_NumISegments beq newSeg ; no index segments lda H_EndIndex cmp #H_ISEG_SIZE bge newSeg ; no space left in last segment sty Index+2 ; = H_NumISegments sta Index ; = H_EndIndex clc adc #4 sta H_EndIndex lda [H_ISegPtrLo],y sta ISegPtr lda [H_ISegPtrHi],y sta ISegPtr+2 ldy #0 ; no error clc rts newSeg IF ErrorCheck THEN beq @endIndexOk Call D_AlertBox,in=(#OkBox:w,#beiMesg:l),out=(a:w) ldy #-1 ; error value in y sec DEBRK2 rts @endIndexOk ENDIF ; ErrorCheck IF Verbose THEN IF Verbose > 1 THEN Call D_AlertBox,in=(#OkBox:w,#growIndexMesg:l),out=(a:w) ELSE Call D_WordBox,in=(#growIndexMesg:l) ENDIF DEBRK ldy H_NumISegments ENDIF cpy H_MaxSegments ; verify there are < H_MaxSegments blt @1 ldy #memErr ; fake error code rts ; carry set @1 ; allocate the handle for the segment (locked) SpaceLong PushLong #H_ISEG_SIZE PushWord #attrLocked ProfileIn 15,_H jsl D_NeedHandle tay ; error code PullLong SegHandle bcc @2 ProfileOut 7,_H IF Verbose = 1 THEN phy Call D_CloseWordBox ply ENDIF rts ; carry set, error in y @2 ; increment the # of index segments and store the handle in the header AddWord H_NumISegments,#4,H_NumISegments ; result left in a ldy #H_NumISegments sta [H_HeaderPtr],y tay lda SegHandle sta [H_ISegHandleLo],y lda SegHandle+2 sta [H_ISegHandleHi],y ; deref the handle and store the pointer in the header lda [SegHandle] sta ISegPtr sta [H_ISegPtrLo],y IF ZeroInit THEN tax ENDIF ldy #2 lda [SegHandle],y ldy H_NumISegments sta ISegPtr+2 sta [H_ISegPtrHi],y ; initialize the index segment IF ZeroInit THEN pha phx PushWord #H_ISEG_SIZE jsl D_ZeroBlock ENDIF ; return the first index in the new segment ldy H_NumISegments sty Index+2 stz Index MoveWord #4,H_EndIndex IF Verbose = 1 THEN Call D_CloseWordBox ENDIF ProfileOut 7,_H ldy #0 ; no error clc rts IF ErrorCheck THEN iflcMesg str 'NewIndex: Index Free List Corrupted!' beiMesg str 'NewIndex: H_EndIndex > H_ISEG_SIZE!' ENDIF IF Verbose THEN growIndexMesg str 'NewIndex: allocating new index segment' ENDIF ENDP ;;-------------------------------------------------------------- ; DisposeIndex() ; ; Dispose of an index by placing it at the head of the free list ; ; pre: Index = segment & offset of index to dispose ; ISegPtr = ptr to index segment ; Zpage variables modified: ; H_FreeIndex DisposeIndex PROC ENTRY ldy Index+2 beq disposeZeroError IF ErrorCheck THEN ldx Index jsr VerifyIndex bcc @1 rts @1 ENDIF ; copy old free list head into index, and flag index as free lda H_FreeIndex ldy Index sta [ISegPtr],y lda H_FreeIndex+2 ora #H_FREE_INDEX_FLAG iny iny sta [ISegPtr],y ; free list head = index MoveLong Index,H_FreeIndex IF (ErrorCheck = 0) THEN disposeZeroError ENDIF rts IF ErrorCheck THEN disposeZeroError SpaceWord PushWord #OkBox PushLong #dzMesg jsl D_AlertBox pla DEBRK2 rts dzMesg str 'DisposeIndex: Attempt to dispose of index $00xx!' ENDIF ; ErrorCheck ENDP ;;-------------------------------------------------------------- ; NewBlock() ; ; Allocate a new block. ; ; pre: DataSize = data size of block ; Index = segment & offset of index to use ; ISegPtr = ptr to index segment ; ; post: return ptr to block in ax. ; return errors in y with carry set. ; ; Zpage variables modified: ; BlockSize ; DataSize ; FreeListOffset ; ISegPtr (recalc only) ; MaxFreeSeg ; MaxFreeSpace ; Offset ; Ptr ; SegPtr ; Segment ; CompactSegment() ; NewDataSegment() ; SqueezeHeap() NewBlock PROC ENTRY ; if the block size is > H_LARGE_BLOCK_SIZE, allocate a handle for the block ; if the block size is 0, return a 'virtual' block ; otherwise, add H_BLOCK_OVERHEAD to the requested size to obtain the actual block size ProfileIn 8,_H IF ErrorCheck THEN MoveLong Index,xy jsr VerifyIndex bcc @1 rts @1 ENDIF lda DataSize+2 JNE largeBlock lda DataSize bne nonZero ; zero size block - return virtual block at Dseg #0, offset 0 ; a = 0 ldy Index sta [ISegPtr],y iny iny sta [ISegPtr],y ;lda #0 tax tay ; no error clc rts nonZero cmp #H_LARGE_BLOCK_SIZE ; check if too large JGE largeBlock ; round size up to multiple of H_BLOCK_GRAN IF H_BLOCK_GRAN = 2 THEN ina ELSE ;clc already clear since we fell through a bge adc #H_BLOCK_GRAN-1 ENDIF and #-H_BLOCK_GRAN sta DataSize ;clc already clear adc #H_BLOCK_OVERHEAD sta BlockSize cmp #H_MAX_FREE_LIST+H_BLOCK_OVERHEAD+1 ; too big to be on JGE mediumBlock ; a free list? ; calculate the offset into the free list: ; free list offset = data_size / (H_BLOCK_GRAN/2) ; we assume that H_BLOCK_GRAN is a power of 2 IF (H_BLOCK_GRAN 2) THEN ldy DataSize ELSE lda DataSize ; the block size DivByPwr2 a,(H_BLOCK_GRAN/2) ; divide a by H_BLOCK_GRAN/2 tay ENDIF ; get segment # from free list lda [H_FreeListArray],y JEQ mediumBlock ; 0 => this free list is empty sta Segment checkNextSegLoop sty FreeListOffset ; save the free list offset ; get pointer to data segment tay lda [H_DSegPtrLo],y sta SegPtr lda [H_DSegPtrHi],y sta SegPtr+2 ; get offset from data segment free list ldy FreeListOffset lda [SegPtr],y bne gotFreeBlock ; check next segment ;ldy FreeListOffset AddWord Segment,#4,Segment sta [H_FreeListArray],y cmp H_NumDSegments BLE checkNextSegLoop ; free lists empty in all segments - clear head lda #0 sta [H_FreeListArray],y bra mediumBlock gotFreeBlock ; update free list IF ErrorCheck THEN ; check that the offset is valid cmp #DSEG_HDR_SIZE blt corrupt IF VariableDSegSize THEN ldy #H_SegSize cmp [SegPtr],y ELSE cmp #H_DSEG_SIZE ENDIF bge corrupt ENDIF ; a = Offset (to this block) ; save offset to this block in index ldy Index sta [ISegPtr],y sta Offset ; get offset to next free block out of this block IF H_BLOCK_OVERHEAD = 2 THEN ina ina ELSE clc adc #H_BLOCK_OVERHEAD ENDIF tay lda [SegPtr],y ; and store in the free list head ldy FreeListOffset sta [SegPtr],y ; save segment of this block in Index lda Segment ldy Index iny iny sta [ISegPtr],y IF ErrorCheck THEN ; verify that the size in the block is correct for the free list ; it was on ldy Offset lda [SegPtr],y IF GrowBlocks THEN bpl corrupt ; not a free block! and #$7FFF ; clear high bit of size field ENDIF cmp DataSize beq sizeOK corrupt Call D_AlertBox,in=(#OkBox:w,#bbsMesg:l),out=(a:w) ldx #0 ; error in block allocation ldy #-1 ; error value in y sec DEBRK2 rts sizeOK ENDIF bra returnBlock mediumBlock ; allocate a block from the end of a segment stz MaxFreeSpace stz MaxFreeSeg ; search segments in order, beginning with the last segment, ; looking for space at the end of segment ldx H_NumDSegments JEQ newSeg ; no data segments allocLoop txy lda [H_DSegPtrLo],y sta SegPtr lda [H_DSegPtrHi],y sta SegPtr+2 ldy #H_SegEnd lda [SegPtr],y sta Offset clc adc BlockSize bcs nextSeg ; data segments are 64K long IF VariableDSegSize THEN ldy #H_SegSize cmp [SegPtr],y ELSE cmp #H_DSEG_SIZE ENDIF blt foundSpace beq foundSpace nextSeg ; need to check free space and keep track of segment with ; the most, and also the total (for later use in compact) ldy #H_SegFreeSpace lda [SegPtr],y cmp MaxFreeSpace blt @1 sta MaxFreeSpace stx MaxFreeSeg @1 dex ; decrement to previous segment dex dex dex bne allocLoop ; no segment #0 bra compactSeg foundSpace ;found the space we need - allocate the block IF VariableDSegSize THEN ldy #H_SegEnd ENDIF sta [SegPtr],y ; update EndSeg lda Offset ; store offset in low word of index ldy Index sta [ISegPtr],y txa ; x = segment # iny iny sta [ISegPtr],y ; store segment # in high word of index returnBlock ; store data size in block ldy Offset lda DataSize sta [SegPtr],y ; decrement segment free space by block size tyx ; save offset to block in x ldy #H_SegFreeSpace lda [SegPtr],y SubWord a,BlockSize,a sta [SegPtr],y IF (&Type('H_SegNumBlocks') 'UNDEFINED ') AND (ErrorCheck > 1) THEN ; increment # of blocks in segment ldy #H_SegNumBlocks lda [SegPtr],y ina sta [SegPtr],y ENDIF IF Profile THEN phx ProfileOut 8,_H plx ENDIF ; return a pointer to the data pointer of the block ; x = Offset (to this block) txa clc adc #H_BLOCK_OVERHEAD ; won't set carry adc SegPtr ldx SegPtr+2 bcc @1 inx @1 ldy #0 ; no error clc rts compactSeg ; compact the segment with the most free space lda #0 ; make sure the index doesn't reference ldy Index ; any data segment iny iny sta [ISegPtr],y lda MaxFreeSpace IF H_LARGE_BLOCK_SIZE > H_MIN_COMPACT THEN cmp BlockSize ; is there enough free space for the blt newSeg ; block? ENDIF cmp #H_MIN_COMPACT ; is there enough free space to be worth blt newSeg ; compacting? PushLong ISegPtr ; CompactSegment modifies ISegPtr jsr CompactSegment PullLong ISegPtr bcs newSeg ; couldn't compact the segment ; now jump into allocLoop at the iteration for the compacted ; segment to allocate the block - allocLoop WILL succeed, since ; we checked above that BlockSize MaxFreeSpace ldx MaxFreeSeg brl allocLoop ; backwards branch newSeg ; allocate a new segment jsr NewDataSegment ; recalculate ISegPtr in case the index table was moved during the ; call to NewDataSegment (which can happen even if NewDataSegment fails) ldy Index+2 lda [H_ISegPtrHi],y sta ISegPtr+2 lda [H_ISegPtrLo],y sta ISegPtr ; carry from NewDataSegment still good bcs squeeze ; couldn't get a new segment ; error is in ErrorFlag ; now jump into allocLoop at the last iteration to allocate the block ; allocLoop WILL succeed, since BlockSize < H_LARGE_BLOCK_SIZE < SegSize ldx H_NumDSegments brl allocLoop ; backwards branch squeeze ; call SqueezeHeap to try and find more space IF Squeezing THEN PushLong ISegPtr ; SqueezeHeap modifies ISegPtr ldx #0 ; don't dispose of segments jsr SqueezeHeap PullLong ISegPtr lda MaxFreeSpace ; did we find enough space? cmp BlockSize IF UseLastResort THEN blt tryLargeBlock ; no - try finding a handle for the block ; as a last resort ELSE blt noBlock ENDIF ; now jump into allocLoop at the iteration for the compacted ; segment to allocate the block - allocLoop WILL succeed, since ; we checked above that BlockSize MaxFreeSpace ldx MaxFreeSeg brl allocLoop ; backwards branch ELSE ; if we didn't compact but could have, do it now lda H_NumDSegments IF UseLastResort THEN beq tryLargeBlock ; nothing to compact - try largeBlock ELSE beq noBlock ; nothing to compact - failed ENDIF CmpWord MaxFreeSpace,BlockSize IF UseLastResort THEN blt tryLargeBlock ; not enough space even if we compact ELSE blt noBlock ; not enough space even if we compact ENDIF jsr CompactSegment IF UseLastResort THEN bcs tryLargeBlock ; couldn't compact the segment ELSE bcs noBlock ; couldn't compact the segment ENDIF ; now jump into allocLoop at the iteration for the compacted ; segment to allocate the block - allocLoop WILL succeed, since ; we checked above that BlockSize MaxFreeSpace ldx MaxFreeSeg brl allocLoop ; backwards branch ENDIF IF UseLastResort THEN tryLargeBlock lda SkipLastResort bne noBlock ; don't bother if SkipLastResort flag set ; i.e. we came from resizing a handle ENDIF largeBlock ; allocate a handle for a large block IF Verbose THEN IF Verbose > 1 THEN Call D_AlertBox,in=(#OkBox:w,#largeBlockMesg:l),out=(a:w) ELSE Call D_WordBox,in=(#largeBlockMesg:l) ENDIF DEBRK ENDIF SpaceLong PushLong DataSize ProfileIn 15,_H jsl D_NeedHand sta ErrorFlag ; save error IF Profile THEN php ProfileOut 15,_H plp ENDIF ; recalculate ISegPtr in case the index table was moved during the ; call to D_NeedHand (which can happen even if D_NeedHand fails) ldy Index+2 lda [H_ISegPtrHi],y sta ISegPtr+2 lda [H_ISegPtrLo],y sta ISegPtr pla sta Ptr ldy Index sta [ISegPtr],y pla sta Ptr+2 ora #H_LARGE_BLOCK_FLAG iny iny sta [ISegPtr],y bcs noLBlock ; carry has been preserved from D_NeedHand ProfileOut 8,_H IF Verbose = 1 THEN Call D_CloseWordBox ENDIF ; return pointer to block ldy #2 lda [Ptr],y tax lda [Ptr] ldy #0 ; no error clc rts noLBlock IF Verbose = 1 THEN Call D_CloseWordBox ENDIF noBlock lda #0 tax ldy ErrorFlag ; return error in y sec rts IF ErrorCheck THEN bbsMesg str 'NewBlock: corrupt data free list!' ENDIF IF Verbose THEN largeBlockMesg str 'NewBlock: allocating large block' ENDIF ENDP ;;-------------------------------------------------------------- ; DisposeBlock() ; ; Dispose of a block. ; ; pre: Index = segment & offset of index to block to be disposed ; ISegPtr = ptr to index segment ; ; Zpage variables modified: ; DataSize ; FreeListOffset ; Offset ; SegPtr ; Segment DisposeBlock PROC ENTRY IF ErrorCheck THEN MoveLong Index,xy jsr VerifyIndex bcc @1 rts @1 ENDIF ; get data segment:offset from index ldy Index ; index offset lda [ISegPtr],y ; data offset sta Offset iny iny lda [ISegPtr],y ; data segment ; two cases: Sign bit clear => small block (index contains segment:offset) ; Sign bit set => large block (index contains flag:handle) ; or free index (index contains flag:next_index) bmi handleOrFree beq done ; zero segment => zero size (virtual) block ; case 1: small block ; accumulator contains segment # sta Segment tay ; use offset and the segment pointer (at [H_DSegPtrLo/Hi],y) ; to get the size from the first word of the block. lda [H_DSegPtrLo],y sta SegPtr lda [H_DSegPtrHi],y sta SegPtr+2 ldy Offset beq done ; zero offset => zero size (virtual) block lda [SegPtr],y ; data size IF GrowBlocks THEN ora #$8000 ; set high bit of size to flag block as deleted sta [SegPtr],y and #$7FFF ENDIF beq adjustSegment ; zero size real block (created by resizing) cmp #H_MAX_FREE_LIST+1 ; is this block too large bge adjustSegment ; to be on a free list? sta DataSize ; calculate the offset into the free list: ; free list offset = data_size / (H_BLOCK_GRAN/2) ; = (block_size / (H_BLOCK_GRAN/2)) - 2*H_BLOCK_OVERHEAD/H_BLOCK_GRAN ; we assume that H_BLOCK_GRAN is a power of 2 ;lda DataSize ; the data size (already in a) DivByPwr2 a,(H_BLOCK_GRAN/2) ; divide a by H_BLOCK_GRAN/2 sta FreeListOffset ; save the free list offset ; insert block at head of data segment free list IF H_BLOCK_OVERHEAD = 2 THEN iny ; adjust block offset to past overhead iny tyx ; and save in x ELSE tya ; adjust block offset to past overhead clc adc #H_BLOCK_OVERHEAD tax ; and save in x ENDIF ldy FreeListOffset lda [SegPtr],y ; get free list head txy ; restore adjusted offset to block sta [SegPtr],y ; store free list head in disposed block lda Offset ; save block offset in free list head ldy FreeListOffset sta [SegPtr],y ; if seg of block < seg in header block free list, ; or if header block free list is empty, then update ;ldy FreeListOffset ; get free list head lda [H_FreeListArray],y beq updateFreeListHead ; update if empty cmp Segment ; update if > block segment BLE noUpdateFreeListHead updateFreeListHead lda Segment sta [H_FreeListArray],y noUpdateFreeListHead lda DataSize adjustSegment ; a = data size ; increment segment free space by block size ldy #H_SegFreeSpace clc adc #H_BLOCK_OVERHEAD ; won't set carry adc [SegPtr],y sta [SegPtr],y IF (&Type('H_SegNumBlocks') 'UNDEFINED ') AND (ErrorCheck > 1) THEN ; decrement # of blocks in segment ldy #H_SegNumBlocks lda [SegPtr],y dea sta [SegPtr],y ENDIF done rts ; case 2: handle or free index handleOrFree ; a = high word of index = flag + high word of handle IF ErrorCheck THEN cmp #H_LARGE_BLOCK_FLAG ; H_LARGE_BLOCK_FLAG > H_FREE_INDEX_FLAG blt freeIndex ENDIF and #$FF ; mask out flag pha lda Offset ; low word of handle pha _DisposeHandle rts IF ErrorCheck THEN freeIndex Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) DEBRK2 rts ErrorMesg str 'H_DisposeBlock: Attempt to dispose of a free index!' ENDIF ; ErrorCheck ENDP ;;-------------------------------------------------------------- ; CompactMoveBlock ; ; Move a block from one data segment to another ; ; pre: x should contain the offset in the destination data segment. ; [ISegPtr],y should reference the high word of the index of the block ; to be moved. ; The source data segment address should be punched into the code ; wherever !0000 appears, and the data bank should be set accordingly. ; The destination data segment address should be punched into the code ; wherever >000000 appears. ; If the source segment begins within 16 bytes of the end of a bank, ; moveLoop should be puched at address whichLoop+1, otherwise ; check16 should be puched there. ; ; post: x will contain the offset in the destination segment just past the ; end of the block. ; y will contain the offset in the source segment just past the ; end of the block. CompactMoveBlock PROC ENTRY ENTRY loadSize, whichLoop, check16, moveLoop ENTRY l0, s0, l2, s2, l4, s4, l8, s8, l10, s10, l12, s12, l14, s14 ENTRY load, store ; y = offset (from ISegPtr) to high word of index to block to be moved. dey dey lda [ISegPtr],y ; old (src) offset sta Offset ; store the new block offset in the index, ; and store the offset to the end of the block ; in the code to check loop termination txa ; x = new (destination) offset sta [ISegPtr],y ldy Offset clc ; add overhead and block size adc #H_BLOCK_OVERHEAD loadSize adc !0000,y ; - MODIFIED sta >checkEnd+1 ; store in code sec sbc #16 sta >check16+1 ; store 16 less in code ; "jmp moveLoop" if the segment is too close to the end of a bank whichLoop jmp check16 ; - MODIFIED ; now copy the block (16 bytes at a time) moveLoop16 l0 lda !0000,y ; - MODIFIED s0 sta >000000,x l2 lda !0000,y s2 sta >000000,x l4 lda !0000,y s4 sta >000000,x l6 lda !0000,y s6 sta >000000,x l8 lda !0000,y s8 sta >000000,x l10 lda !0000,y s10 sta >000000,x l12 lda !0000,y s12 sta >000000,x l14 lda !0000,y s14 sta >000000,x tya clc adc #16 ; will not set carry tay txa adc #16 tax check16 cpx #0000 ; (new offset to end of block)-16 - MODIFIED blt moveLoop16 ; copy the rest, a word at a time moveLoop load lda !0000,y ; - MODIFIED store sta >000000,x ; - MODIFIED iny iny inx inx checkEnd cpx #0000 ; new offset to end of block - MODIFIED blt moveLoop rts ENDP ;;-------------------------------------------------------------- IF Squeezing THEN ; SqueezeHeap(DisposeSegs:x) ; ; Compact the heap, squeezing blocks into segments ; Returns with the size of largest free block in MaxFreeSpace ; and the corresponding segment in MaxFreeSeg ; Algorithm: ; for each segment from 4 to H_NSegments ; compact segment ; fill segment (until H_SegFreeSpace < H_MIN_SQUEEZE) from higher segments ; if DisposeSegs then dispose of any empty segments ; Zpage variables modified: ; H_NSegments ; DP (aliased to Size) ; EndPtr ; MaxFreeSeg ; MaxFreeSpace ; Offset ; OldPtr ; Ptr ; SegHandle ; SegPtr SqueezeHeap PROC ENTRY Size equ DP txa sta >DisposeSegs ; this space is below, in the code ProfileIn 6,_H stz MaxFreeSpace jsl D_CheckPurge ; verify System Handle is available bcc @9 rts ; oops - it's not available @9 IF Verbose > 1 THEN Call D_AlertBox,in=(#OkBox:w,#SqueezeMesg:l),out=(a:w) DEBRK ENDIF phb ; save data bank lda #4 ; first segment fillSegsLoop cmp H_NumDSegments bge filledSegs sta MaxFreeSeg jsr CompactSegment ; compact this segment. sets up SegPtr jsr FillSeg ; fill leftover space. uses SegPtr AddWord MaxFreeSeg,#4,a bra fillSegsLoop filledSegs bne @1 ; a > H_NSegments (only happens if H_NSegments = 0) sta MaxFreeSeg ; compact last segment jsr CompactSegment @1 ; find segment with most free space - dispose of empty segments (if DisposeSegs) stz MaxFreeSpace MoveWord H_NumDSegments,Segment beq foundMax findMaxLoop tay lda [H_DSegPtrLo],y sta SegPtr lda [H_DSegPtrHi],y sta SegPtr+2 ldy #H_SegFreeSpace lda [SegPtr],y ldy Segment cmp MaxFreeSpace blt @1 sta MaxFreeSpace sty MaxFreeSeg @1 IF VariableDSegSize THEN clc adc #DSEG_HDR_SIZE ldy #H_SegSize cmp [SegPtr],y ELSE cmp #H_DSEG_SIZE-DSEG_HDR_SIZE ENDIF blt nextSeg lda >DisposeSegs beq nextSeg ; dispose of the segment IF VariableDSegSize THEN ldy Segment ENDIF lda [H_DSegHandleHi],y pha lda [H_DSegHandleLo],y pha _DisposeHandle SubWord H_NumDSegments,#4,H_NumDSegments MoveWord a,[H_HeaderPtr]:#H_NumDSegments nextSeg SubWord Segment,#4,Segment bne findMaxLoop foundMax ; zero out the data free lists in the header ldy #2*(H_N_FREE_LISTS-1) ;lda #0 - a already 0 at foundMax zeroHdrFreeListLoop sta [H_FreeListArray],y dey dey bpl zeroHdrFreeListLoop plb ; restore data bank ProfileOut 6,_H clc rts DisposeSegs DS.W 1 IF Verbose THEN SqueezeMesg str 'Squeezing Heap' ENDIF ;------------------------------------------- FillSeg ; fill the segment whose number is in MaxFreeSeg. ; segment must already be compacted. ; while H_SegFreeSpace H_MIN_SQUEEZE ; for each segment from H_NumDSegments down to MaxFreeSeg+4 ; for each block ; if size H_SegFreeSpace ; transfer block ldy #H_SegFreeSpace lda [SegPtr],y cmp #H_MIN_SQUEEZE bge @1 rts @1 sta MaxFreeSpace ; set data bank = code bank to modify CompactMoveBlock code phk plb ; copy SegPtr lda SegPtr+2 sta Ptr+2 lda SegPtr sta Ptr sta store+1 ; store the destination address in lda SegPtr+1 ; the code sta store+2 ; setup the store addresses in moveLoop16 (in CompactMoveBlock) ldx #0 ldy #8 storeLoop lda Ptr+1 sta s0+2,x lda Ptr sta s0+1,x clc adc #2 sta Ptr bcc @1 inc Ptr+2 @1 AddWord x,#s2-s0,x dey bne storeLoop MoveWord [SegPtr]:#H_SegEnd,x ; offset to the end of data ldy H_NumDSegments ; segment to fetch blocks from jsr SetFetchSegment ; sets Segment, data bank ldy H_NumISegments beq filled fillLoop phy ; save index segment # lda [H_ISegPtrHi],y sta ISegPtr+2 lda [H_ISegPtrLo],y sta ISegPtr cpy H_NumISegments bne @1 ldy H_EndIndex bra fillSegLoop @1 ldy #H_ISEG_SIZE fillSegLoop ; loop through index segment backwards dey ; offset to high word of (previous) index dey lda [ISegPtr],y cmp Segment bne nextBlock ; found a block in the fetch segment phy ; is the block small enough to fit in the fill segment? dey dey lda [ISegPtr],y ; offset to block tay lda (OldPtr),y ; data size of block IF H_BLOCK_OVERHEAD = 2 THEN ina ina ELSE clc adc #H_BLOCK_OVERHEAD ENDIF ; a = block size cmp MaxFreeSpace BGT @1 ; too big sta Size ; block size lda 1,s ; restore saved y, leave on stack tay lda MaxFreeSeg ; set the new segment # sta [ISegPtr],y jsr CompactMoveBlock ; move the block ; no attempt is made to put the space freed up by moving the block ; onto a free list, because the segment will be compacted later ldy #H_SegFreeSpace lda [OldPtr],y ; adjust source segment free space clc adc Size sta [OldPtr],y lda MaxFreeSpace ; adjust destination segment free space sec sbc Size sta MaxFreeSpace cmp #H_MIN_SQUEEZE ; is the segment full enough yet? bge @1 ; no - keep going ; yes - done with segment - clean up stack ply ply ; index segment # bra doneFillSeg @1 ply nextBlock dey ; offset to low word of index dey bne fillSegLoop pla ; index segment # SubWord a,#4,y bne fillLoop filled ; try next segment until segment MaxFreeSeg SubWord Segment,#4,a cmp MaxFreeSeg beq doneFillSeg ; done - no more segments to use tay ; segment to fetch from jsr SetFetchSegment ; sets Segment, data bank ldy H_NumISegments bne fillLoop doneFillSeg MoveWord x,[SegPtr]:#H_SegEnd ; save new offset to end of data MoveWord MaxFreeSpace,[SegPtr]:#H_SegFreeSpace ; new free space rts ;------------------------------------------------------ SetFetchSegment phx ; save x sty Segment lda [H_DSegPtrHi],y sta OldPtr+2 lda [H_DSegPtrLo],y sta OldPtr ; set data bank = code bank to modify CompactMoveBlock code phk plb ; store the source address in the code sta loadSize+1 sta load+1 ; make sure we're not too close to the end of a bank ; if we are, we can't use the loop to move 16 bytes at a time cmp #-16 blt @1 lda #moveLoop bra @2 @1 lda #check16 @2 sta whichLoop+1 ; modify the jmp accordingly ; setup the load addresses in moveLoop16 (in CompactMoveBlock) lda OldPtr ldx #0 ldy #8 loadLoop sta l0+1,x ina ina pha AddWord x,#l2-l0,x pla dey bne loadLoop ; set data bank = segment pei OldPtr+1 ; 2nd & 3rd bytes of address plb ; 2nd byte plb ; 3rd byte (bank) plx ; restore x rts ENDP ENDIF ;;-------------------------------------------------------------- ; CompactSegment() ; ; Compact the data segment whose number * 4 is in MaxFreeSeg ; by copying each block into a temporary area (D_SystemHandle) ; and then copying it back again ; Zpage variables modified: ; ISegPtr ; Offset ; OldPtr ; Ptr ; SegPtr CompactSegment PROC ENTRY ProfileIn 14,_H jsl D_CheckPurge ; verify System Handle is available bcc @9 rts ; oops - it's not available @9 IF Verbose THEN IF Verbose > 1 THEN Call D_AlertBox,in=(#OkBox:w,#CompactMesg:l),out=(a:w) ELSE Call D_WordBox,in=(#CompactMesg:l) ENDIF ENDIF ; get SegPtr ldy MaxFreeSeg lda [H_DSegPtrHi],y sta SegPtr+2 lda [H_DSegPtrLo],y sta SegPtr ; check to see if the segment is already compacted ; i.e. if SegSize - SegEnd - SegFreeSpace = 0 IF VariableDSegSize THEN MoveWord [SegPtr]:#H_SegSize,a ELSE lda #H_DSEG_SIZE ENDIF SubWord a,[SegPtr]:#H_SegEnd,a SubWord a,[SegPtr]:#H_SegFreeSpace,a bne @8 clc rts @8 phb ; save data bank ; set the data bank to the code bank to modify code phk plb lda SegPtr sta loadSize+1 ; store the source address in the code sta load+1 ; store the source address in the code ; make sure we're not too close to the end of a bank ; if we are, we can't use the loop to move 16 bytes at a time cmp #-16 blt @1 lda #moveLoop bra @2 @1 lda #check16 @2 sta whichLoop+1 ; modify the jmp accordingly ; setup the load addresses in moveLoop16 (in CompactMoveBlock) lda SegPtr ldx #0 ldy #8 loadLoop sta l0+1,x ina ina sta Ptr AddWord x,#l2-l0,x lda Ptr dey bne loadLoop lda >D_SystemHandle sta OldPtr lda >D_SystemHandle+2 sta OldPtr+2 Deref OldPtr ; leaves result in ax sta Ptr stx Ptr+2 sta store+1 ; store the destination address in lda OldPtr+1 ; the code sta store+2 ; setup the store addresses in moveLoop16 (in CompactMoveBlock) ldx #0 ldy #8 storeLoop lda Ptr+1 sta s0+2,x lda Ptr sta s0+1,x clc adc #2 sta Ptr bcc @1 inc Ptr+2 @1 AddWord x,#s2-s0,x dey bne storeLoop ; set the data bank to the segment pei SegPtr+1 ; 2nd & 3rd bytes of address plb ; 2nd byte plb ; 3rd byte (bank) ; traverse the index table (in reverse order) to find all blocks in the segment ; and move each in turn ldx #DSEG_HDR_SIZE ; initialize new data block offset ldy H_NumISegments beq compacted compactLoop sty Segment lda [H_ISegPtrHi],y sta ISegPtr+2 lda [H_ISegPtrLo],y sta ISegPtr cpy H_NumISegments bne @1 ldy H_EndIndex bra compactSegLoop @1 ldy #H_ISEG_SIZE compactSegLoop ; loop through index segment backwards dey ; offset to high word of (previous) index dey lda [ISegPtr],y cmp MaxFreeSeg bne nextBlock phy jsr CompactMoveBlock ply nextBlock dey ; offset to low word of index dey bne compactSegLoop SubWord Segment,#4,y bne compactLoop compacted ; fix up the segment header txa ; x = offset to next block ldy #H_SegEnd ; = end of used portion of segment sta [SegPtr],y ; SegFreeSpace has not changed ; zero the free list IF (H_SegFreeList = 0) THEN ldy #2*(H_N_FREE_LISTS-1) lda #0 zeroFreeListLoop sta [SegPtr],y dey dey bpl zeroFreeListLoop ELSE ldy #H_SegFreeList ldx #H_N_FREE_LISTS lda #0 zeroFreeListLoop sta [SegPtr],y iny iny dex bne zeroFreeListLoop ENDIF ; now copy the compacted data back to the data segment ; _BlockMove(Ptr+DSEG_HDR_SIZE,SegPtr+DSEG_HDR_SIZE,SegSize-#DSEG_HDR_SIZE) MoveLong OldPtr,ax ; OldPtr = [D_SystemHandle] clc adc #DSEG_HDR_SIZE bcc @1 inx @1 phx pha MoveLong SegPtr,ax clc adc #DSEG_HDR_SIZE bcc @2 inx @2 phx pha IF VariableDSegSize THEN PushWord #0 SubWord [SegPtr]:#H_SegSize,#DSEG_HDR_SIZE,s ELSE PushLong #H_DSEG_SIZE-DSEG_HDR_SIZE ENDIF _BlockMove plb ; restore data bank IF Verbose = 1 THEN Call D_CloseWordBox ENDIF ProfileOut 14,_H clc rts IF Verbose THEN CompactMesg str 'Compacting Heap Segment' ENDIF ENDP ;;-------------------------------------------------------------- ; NewDataSegment() ; ; Create a new data segment and initialize its header ; Returns ErrorFlag and sets carry appropriately ; Zpage variables modified: ; ErrorFlag ; H_NumDSegments ; SegHandle ; SegPtr NewDataSegment PROC ENTRY IF Verbose THEN IF Verbose > 1 THEN Call D_AlertBox,in=(#OkBox:w,#newSegMesg:l),out=(a:w) ELSE Call D_WordBox,in=(#newSegMesg:l) ENDIF DEBRK ENDIF lda H_NumDSegments ; verify there are < H_MaxSegments cmp H_MaxSegments blt @1 rts ; carry set @1 MoveWord #H_DSEG_SIZE,SegSize MoveWord #0,>SecondTry ; in the code, below allocSeg ; allocate the handle for the segment (locked) SpaceLong PushWord #0 PushWord SegSize PushWord #attrLocked ProfileIn 15,_H jsl D_NeedHandle sta ErrorFlag IF Profile THEN php ProfileOut 15,_H plp ENDIF PullLong SegHandle IF VariableDSegSize THEN bcs exit ELSE bcc gotSeg lda >SecondTry ; was this the second try? bne retryFailed ; yes - sec and return ina sta >SecondTry ; try _MaxBlock for a smaller segment SpaceLong _MaxBlock PullLong ax ; x must be 0, else first allocation cmp #H_MIN_DSEG_SIZE ; would have worked bge smallSeg retryFailed sec rts smallSeg sta SegSize bra allocSeg gotSeg ENDIF ; increment the # of segments and store the handle in the header AddWord H_NumDSegments,#4,H_NumDSegments ; result left in a ldy #H_NumDSegments sta [H_HeaderPtr],y tay lda SegHandle sta [H_DSegHandleLo],y lda SegHandle+2 sta [H_DSegHandleHi],y ; deref the handle and store the pointer in the header lda [SegHandle] sta SegPtr sta [H_DSegPtrLo],y IF ZeroInit THEN tax ENDIF ldy #2 lda [SegHandle],y ldy H_NumDSegments sta SegPtr+2 sta [H_DSegPtrHi],y ; initialize the data segment header IF ZeroInit THEN pha phx PushWord SegSize jsl D_ZeroBlock ELSE IF (H_SegFreeList = 0) THEN ldy #2*(H_N_FREE_LISTS-1) lda #0 zeroFreeListLoop sta [SegPtr],y dey dey bpl zeroFreeListLoop ELSE ldy #H_SegFreeList ldx #H_N_FREE_LISTS lda #0 zeroFreeListLoop sta [SegPtr],y iny iny dex bne zeroFreeListLoop ENDIF ENDIF MoveWord #DSEG_HDR_SIZE,[SegPtr]:#H_SegEnd SubWord SegSize,#DSEG_HDR_SIZE,[SegPtr]:#H_SegFreeSpace IF &Type('H_SegSize') 'UNDEFINED ' THEN MoveWord SegSize,[SegPtr]:#H_SegSize ENDIF IF &Type('H_SegNumBlocks') 'UNDEFINED ' THEN MoveWord #0,[SegPtr]:#H_SegNumBlocks ENDIF IF Verbose = 1 THEN Call D_CloseWordBox ENDIF clc exit rts SecondTry DC.W 0 IF Verbose THEN newSegMesg str 'NewBlock: allocating new segment' ENDIF ENDP ;;-------------------------------------------------------------- ; VerifyIndex() ; ; Verify that the index in xy is valid. Put up an alert if it's not. ; IF ErrorCheck THEN VerifyIndex PROC ENTRY cpy H_NumISegments beq @1 bge badindexError cpx #H_ISEG_SIZE bra @2 @1 cpx H_EndIndex @2 bge badIndexError txa and #%11 bne oddIndexError tya beq @3 and #%11 bne oddIndexError @ok clc rts @3 txa beq @ok zeroIndexError SpaceWord PushWord #OkBox PushLong #ziMesg bra error badIndexError SpaceWord PushWord #OkBox PushLong #biMesg bra error oddIndexError SpaceWord PushWord #OkBox PushLong #oiMesg error txa sta >theIndex tya sta >theIndex+2 jsl D_AlertBox pla DEBRK2 sec rts theIndex DS.L 1 ziMesg str 'H_VerifyIndex: Index 00xx' biMesg str 'H_VerifyIndex: Index out of range!' oiMesg str 'H_VerifyIndex: Misaligned Index!' ENDP ENDIF END \ No newline at end of file diff --git a/appleworksgs/Heap/Src/Heap.aii b/appleworksgs/Heap/Src/Heap.aii new file mode 100755 index 0000000..126481b --- /dev/null +++ b/appleworksgs/Heap/Src/Heap.aii @@ -0,0 +1 @@ +; ; Heap.aii ; ; Heap memory managment module ; ; Copyright 1989 Claris Corporation ; ; 1-13-89 Begun by Kevin A. Watts ; ; Heap routines: ; ; H_Init() ; Initialize heap code when loaded. ; H_SegLoaded() ; Called when the heap code is loaded. ; H_SegUnloaded() ; Called when the heap code is unloaded. ; H_CurrentHeap(): HeapID:ax ; Return the ID of the current heap. ; H_SetHeap(HeapID:xy) ; Set the current heap. ; H_UnsetHeap() ; Unset the current heap. ; H_ResetHeap() ; Reset (relock) the current heap. ; H_NewHeap(): HeapID:ax ; Create a new heap, make it current & return its ID. ; H_DisposeHeap() ; Dispose of the current heap. ; H_WriteHeap(FileID:x) ; Write the current heap to disk. ; H_ReadHeap(FileID:x): HeapID:ax ; Read the current heap from disk. ; CalcHeaderPtrs ; Calculate pointers to arrays within the header. ;-------------------------------------------------------------- PRINT PUSH PRINT OFF LOAD 'Macros.Dump' gblc &__FILE__ &__FILE__ setc 'Heap' include 'Heap.mac' include 'HeapPrivate.equ' include 'Heap.aii.i' include 'm16.profile' ; must be after H.equ include 'Driver.equ' IMPORT D_Deref ENTRY H_Init IF DriverSupport = 0 THEN ENTRY H_SegLoaded ENTRY H_SegUnloaded ENDIF IF ErrorCheck THEN ENTRY H_CurrentHeap ENDIF ENTRY H_SetHeap ENTRY H_UnsetHeap ENTRY H_ResetHeap ENTRY H_NewHeap ENTRY H_DisposeHeap ENTRY H_ReadHeap ENTRY H_WriteHeap ENTRY CalcHeaderPtrs PRINT POP ProfileData 16,_H ProfileCode _H ;;-------------------------------------------------------------- ; H_Init() ; no error status returned ; ; Store the address of the heap zero page into the other heap routines ; prologue. ; THIS ROUTINE MUST BE CALLED BEFORE ANY OTHER HEAP ROUTINE IS CALLED!! ; i.e. immediately after the code segment is loaded. ; Zpage variables modified: ; H_ZPptr H_Init PROC EXPORT ProfileInit _H ; get the Zpage address from the driver global IMPORT D_HeapZPage lda >D_HeapZPage phd ; store the Zpage address in the Zpage tcd ; set up the Zpage sta H_ZPptr stz H_ZPptr+2 ; redundant, but so what? ; determine the maximum possible number of data or index segments and thus header size. ; we allow the same # of each type of segment, equal to ; _TotalMem / H_DSEG_SIZE ; H_MaxSegments will be 3 times this (3/4, *4 bytes/segment handle). ; The 3/4 is based upon H_ISEG_SIZE = 1/4 H_DSEG_SIZE, and will allow the heap ; to use 15/16 of _TotalMem. This should be sufficient. SpaceLong _TotalMem pla ; discard low word pla ; # of banks sta H_MaxSegments ; multiply by 3 asl a asl a sec sbc H_MaxSegments MulByPwr2 a,($10000/H_DSEG_SIZE) ; # of banks * (64K/H_DSEG_SIZE) cmp #$1000 ; ensure high nibble unused blt @1 lda #$1000-4 @1 sta H_MaxSegments lda #HANDLE_ARRAY ; offset to **index_seg[] clc adc H_MaxSegments sta H_DSegHOffsetLo ; offset to **data_seg[] tax inx inx stx H_DSegHOffsetHi clc adc H_MaxSegments sta H_ISegPOffsetLo ; offset to *index_seg[] tax inx inx stx H_ISegPOffsetHi clc adc H_MaxSegments sta H_DSegPOffsetLo ; offset to *data_seg[] tax inx inx stx H_DSegPOffsetHi clc adc H_MaxSegments sta H_HeaderSize ; total size of heap header tdc ; load accumulator with Heap Zpage pld ; embed the ZP address in the other routines ; DefineZ will correctly modify any routine using BeginZ as a prologue. ; set data bank to code bank phb phk plb IF ErrorCheck THEN DefineZ H_CurrentHeap ENDIF DefineZ H_SetHeap DefineZ H_UnsetHeap DefineZ H_ResetHeap DefineZ H_NewHeap DefineZ H_DisposeHeap IF HeapIO AND 1 THEN DefineZ H_WriteHeap ENDIF IF HeapIO AND 2 THEN DefineZ H_ReadHeap ENDIF DefineZ H_TruncHeap DefineZ H_NewBlock DefineZ H_DisposeBlock DefineZ H_ResizeBlock DefineZ H_CopyBlock DefineZ H_GetBlockPtr DefineZ H_GetBlockSize plb ; restore data bank rtl ENDP ;;-------------------------------------------------------------- IF DriverSupport = 0 THEN ; H_SegLoaded() ; errors returned in accumulator (via ErrFlag) ; ; Allocate a zero page block for later use and store its address ; in the other routines so they can use it. ; THIS ROUTINE MUST BE CALLED BEFORE ANY OTHER HEAP ROUTINE IS CALLED!! ; ; Eventually, the driver should allocate the zpage for me and store the ; address in a global. Only the code modification portion of this routine ; need remain then. The driver will have to zero the block for me. ; Zpage variables modified: all (zero page cleared) H_SegLoaded PROC EXPORT local Zpage:l ; handle/pointer to Zero page error ErrFlag BEGIN +b Call D_NeedHandle,in=(#H_ZPSIZE:l,#H_ZPATTR:w),out=(Zpage:l),err=ErrFlag bcc @ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit @ok ; Zero the zero page block Call D_ZeroBlock,in=([Zpage]:l,#H_ZPSIZE:w) ; Embed the ZP handle in H_SegUnload so we can dispose of it later MoveWord Zpage+2,H_SegUnloaded+1 MoveWord Zpage,H_SegUnloaded+4 ; Now embed the ZP address in the other routines Deref Zpage ; Zpage = [Zpage] ; lda Zpage ; already there after Deref sta D_HeapZPage jsl H_Init exit return EXPORT D_HeapZPage D_HeapZPage DS.W 1 ErrorMesg str 'H_SegLoaded: Unable to allocate heap Z page' ENDP ;;-------------------------------------------------------------- ; H_SegUnloaded() ; no error status returned ; ; Deallocate the zero page block. ; NO OTHER HEAP ROUTINE (except H_SegLoaded) MAY BE CALLED AFTER THIS ROUTINE!! ; It is assumed that there is no current heap when this routine is called. ; Zpage variables modified: all (Zpage disposed) H_SegUnloaded PROC EXPORT pea 0000 ; Replace with the ZP handle (high word) pea 0000 ; Replace with the ZP handle (low word) _DisposeHandle rtl ENDP ENDIF ; DriverSupport = 0 ;;-------------------------------------------------------------- IF ErrorCheck THEN ; H_CurrentHeap(): HeapID:ax ; ; return the ID of the current heap ; Zpage variables modified: none H_CurrentHeap PROC EXPORT BeginZ MoveLong H_Header,ax ReturnZ ENDIF ; ErrorCheck ;;-------------------------------------------------------------- ; H_SetHeap(HeapID:xy) ; no error status returned ; ; Set the current heap: lock all its handles and copy its header information to the heap ZP. ; Zpage variables modified: ; NewHeap ; H_* ; CopyHdr ; HasMoved ; Offset ; SegHandle H_SetHeap PROC EXPORT BeginZ MoveLong xy,NewHeap ; save heap id (handle) IF Profile THEN ProfileIn 1,_H ldx NewHeap ENDIF ;CmpLong xy,H_Header ; is this already the current heap? cpy H_Header+2 bne @1 cpx H_Header beq @reSet @1 MoveWord #1,CopyHdr lda H_Header ; is there a current heap? ora H_Header+2 beq setHeap jsl H_UnsetHeap ; first unset the current heap bra setHeap @reSet ; trying to reSet the current heap lda H_IsLocked ; if it's already locked, we're done. beq @2 ReturnZ @2 stz CopyHdr setHeap lda NewHeap ora NewHeap+2 bne @notZero StzL H_Header ReturnZ @notZero IF ErrorCheck THEN PushLong NewHeap _CheckHandle bcc handleOk Call D_AlertBox,in=(#OkBox:w,#badHandleMesg:l),out=(a:w) DEBRK2 badHandleMesg str 'H_SetHeap: Bad Heap ID!' handleOk ENDIF ;MoveLong NewHeap,H_Header ; lock the heap header ;PushLong H_Header - combined for optimization lda NewHeap+2 sta H_Header+2 pha lda NewHeap sta H_Header pha _HLock ;MoveLong [H_Header],H_HeaderPtr - deref; leave result in ax ldy #2 lda [H_Header],y sta H_HeaderPtr+2 tax lda [H_Header] sta H_HeaderPtr ; find out if the heap header has moved by comparing the new ; pointer (in ax) to the old one (in the header) ; if it has not moved, we can avoid resetting pointers ; if it has moved, we need to copy the new pointer back to the header stz HasMoved ; ax = H_HeaderPtr ldy #H_HeaderPtr cmp [H_HeaderPtr],y beq @1 sta [H_HeaderPtr],y inc HasMoved @1 txa ldy #H_HeaderPtr+2 cmp [H_HeaderPtr],y beq @2 sta [H_HeaderPtr],y inc HasMoved @2 lda CopyHdr ; copy the header block if necessary beq doneCopy PushLong H_HeaderPtr PushLong H_ZPptr PushWord #0 lda HasMoved beq @3 PushWord #ZHEADER_SHORT_SIZE ; moved - don't copy ptrs; will recalc bra @4 @3 PushWord #ZHEADER_SIZE ; didn't move - copy ptrs @4 _BlockMove doneCopy ; if the heap header has moved since it was last set, ; reset pointers to arrays of data segment handles and pointers ; and to array of free lists lda HasMoved beq @noUpdatePointers jsr CalcHeaderPtrs @noUpdatePointers ; lock and deref the index segments - this loop starts at the end and counts down ldy H_NumISegments ; y = offset to last seg handle beq lockedISegs lockISegLoop ; lock the segment lda [H_ISegHandleHi],y sta SegHandle+2 pha lda [H_ISegHandleLo],y sta SegHandle pha sty Offset _HLock ; should I do a quick lock here? ; deref the locked handle and store the pointer into H_ISegPointers array ldy #2 lda [SegHandle],y ldy Offset sta [H_ISegPtrHi],y lda [SegHandle] sta [H_ISegPtrLo],y SubWord y,#4,y bne lockISegLoop ; there is no seg #0 lockedISegs ; lock and deref the data segments - this loop starts at the end and counts down ldy H_NumDSegments ; y = offset to last seg handle beq lockedDSegs lockDSegLoop ; lock the segment lda [H_DSegHandleHi],y sta SegHandle+2 pha lda [H_DSegHandleLo],y sta SegHandle pha sty Offset _HLock ; should I do a quick lock here? ; deref the locked handle and store the pointer into H_DSegPointers array ldy #2 lda [SegHandle],y ldy Offset sta [H_DSegPtrHi],y lda [SegHandle] sta [H_DSegPtrLo],y SubWord y,#4,y bne lockDSegLoop ; there is no seg #0 lockedDSegs MoveWord #1,H_IsLocked ; flag the heap as locked ProfileOut 1,_H ReturnZ ENDP ;;-------------------------------------------------------------- ; H_UnsetHeap() ; no error status returned ; ; Unset the current heap: copy its header information back from ; the heap ZP and unlock its handles ; ; Prerequisite: H_IsLocked 0, H_Header 0 (these are checked) ; Zpage variables modified: ; Offset ; H_IsLocked H_UnsetHeap PROC EXPORT BeginZ ProfileIn 2,_H ; if the current heap is not locked then there's nothing to do. lda H_IsLocked JEQ exit ; make sure there is a current heap lda H_Header ora H_Header+2 JEQ exit ; copy selected header information back to real header ; H_Header - always maintained ; H_HeaderPtr - always maintained ; H_Version - always maintained (constant) ; H_NumISegments - always maintained ; H_NumDSegments - always maintained MoveLong H_FreeIndex,[H_HeaderPtr]:#H_FreeIndex MoveLong H_EndIndex,[H_HeaderPtr]:#H_EndIndex MoveLong H_ISegHandleLo,[H_HeaderPtr]:#H_ISegHandleLo MoveLong H_ISegHandleHi,[H_HeaderPtr]:#H_ISegHandleHi MoveLong H_DSegHandleLo,[H_HeaderPtr]:#H_DSegHandleLo MoveLong H_DSegHandleHi,[H_HeaderPtr]:#H_DSegHandleHi MoveLong H_ISegPtrLo,[H_HeaderPtr]:#H_ISegPtrLo MoveLong H_ISegPtrHi,[H_HeaderPtr]:#H_ISegPtrHi MoveLong H_DSegPtrLo,[H_HeaderPtr]:#H_DSegPtrLo MoveLong H_DSegPtrHi,[H_HeaderPtr]:#H_DSegPtrHi MoveLong H_FreeListArray,[H_HeaderPtr]:#H_FreeListArray ; unlock the handles ; unlock the index segments - this loop starts at the end and counts down ldy H_NumISegments ; y = offset to last seg handle beq unlockedISegs unlockISegLoop ; unlock the segment lda [H_ISegHandleHi],y pha lda [H_ISegHandleLo],y pha sty Offset _HUnlock ; should I do a quick unlock here? SubWord Offset,#4,y bne unlockISegLoop ; there is no seg #0 unlockedISegs ; unlock the data segments - this loop starts at the end and counts down ldy H_NumDSegments ; y = offset to last seg handle beq unlockedDSegs unlockDSegLoop ; unlock the segment lda [H_DSegHandleHi],y pha lda [H_DSegHandleLo],y pha sty Offset _HUnlock ; should I do a quick unlock here? SubWord Offset,#4,y bne unlockDSegLoop ; there is no seg #0 unlockedDSegs PushLong H_Header ; unlock the heap header _HUnlock stz H_IsLocked ; flag heap as unlocked exit ProfileOut 2,_H ReturnZ ENDP ;;-------------------------------------------------------------- ; H_ResetHeap() ; no error status returned ; ; Reset (actually only relock) the current heap, if necessary ; ; Prerequisite: H_IsLocked = 0, H_Header 0 ; Zpage variables modified: none, H_SetHeap() H_ResetHeap PROC EXPORT BeginZ lda H_IsLocked bne exit lda H_Header ora H_Header+2 beq exit ; make sure the top level call was made by a heap client module ; (SS or DB) ; lda D_TopModule ; cmp ??? ; beq @1 ; cmp ??? ; bne exit ;@1 MoveLong H_Header,xy jsl H_SetHeap exit ReturnZ ENDP ;;-------------------------------------------------------------- ; H_NewHeap(): HeapID:ax ; error status returned in y ; ; Allocate a new heap and return the handle to the heap header as the ID. ; HeapID is invalid if any error occurs. ; Zpage variables modified: ; H_* ; NewHeap ; ErrorFlag H_NewHeap PROC EXPORT BeginZ ProfileIn 4,_H ; unset the current heap, if any lda H_Header ora H_Header+2 beq noCurHeap jsl H_UnsetHeap StzL H_Header noCurHeap ; allocate the header handle ; no index or data segments are allocated yet - that's done by H_NewBlock (NewBlock,NewIndex) ; don't use H_Header for the result until we've successfully allocated the handle SpaceLong PushWord #0 PushWord H_HeaderSize jsl D_NeedHand sta ErrorFlag PullLong NewHeap bcc lockHeader stz H_IsLocked ; no heap, so not locked IF VerboseErrors THEN Call D_AlertBox,in=(#OkBox:w,#NoHeapMesg:l),out=(a:w) DEBRK3 ENDIF lda #0 ; return 0 HeapID tax ldy ErrorFlag ; return error in y sec ReturnZ lockHeader ; lock the header handle ;MoveLong NewHeap,H_Header - combined ;PushLong H_Header - for efficiency lda NewHeap+2 sta H_Header+2 pha lda NewHeap sta H_Header pha _HLock ; copy and deref handles and other header info MoveLong [H_Header],H_HeaderPtr IF H_THIS_VERSION $FFFF THEN ; MoveLong should do this for me stz H_Version+2 MoveWord #H_THIS_VERSION,H_Version ELSE MoveLong #H_THIS_VERSION,H_Version ENDIF StzL H_FreeIndex ; no free indices yet stz H_EndIndex ; no index segment yet ; set pointers to arrays of data segment handles and pointers ; and to array of free lists jsr CalcHeaderPtrs IF ZeroInit THEN ; zero header block PushLong H_HeaderPtr PushWord H_HeaderSize jsl D_ZeroBlock ELSE ; zero out the data free lists in the header ldy #2*(H_N_FREE_LISTS-1) lda #0 zeroFreeListLoop sta [H_FreeListArray],y dey dey bpl zeroFreeListLoop ENDIF ; no index or data segments yet stz H_NumISegments stz H_NumDSegments ; copy the zero page to the header PushLong H_ZPptr PushLong H_HeaderPtr PushLong #ZHEADER_SIZE _BlockMove ProfileOut 4,_H ldy #1 sty H_IsLocked ; flag the heap as locked MoveLong H_Header,ax ; return the heap id dey ; no error (y = 0) clc ReturnZ IF VerboseErrors THEN NoHeapMesg str 'H_NewHeap: Unable to allocate new heap' ENDIF ENDP ;;-------------------------------------------------------------- ; H_DisposeHeap() ; no error status returned ; ; Dispose of the current heap ; ; Prerequisite: H_Header, H_HeaderPtr 0 ; Zpage variables modified: ; Offset ; H_Header ; H_HeaderPtr ; H_IsLocked ; Segment ; SegHandle ; SegPtr H_DisposeHeap PROC EXPORT BeginZ ProfileIn 5,_H ; dispose of all large blocks and index segments ; - we are traversing the index segments backwards ldy H_NumISegments beq disposedIndices disposeIndicesLoop sty Segment lda [H_ISegHandleHi],y ; check that the segment is really there tax ; (x for D_Deref below) ora [H_ISegHandleLo],y ; (might not be if recovering from beq nextISeg ; failed H_ReadHeap) ; don't get ptr from table - won't be there if called from H_ReadHeap lda [H_ISegHandleLo],y ; x was set above jsl D_Deref MoveLong ax,SegPtr CmpWord Segment,H_NumISegments bne @1 ldy H_EndIndex bra disposeLargeLoop @1 ldy #H_ISEG_SIZE disposeLargeLoop ; loop through index segment backwards dey ; offset to high word of (previous) index dey lda [SegPtr],y bpl nextLargeBlock cmp #H_LARGE_BLOCK_FLAG blt nextLargeBlock sty Offset and #$00FF pha dey ; offset to low word of index dey lda [SegPtr],y pha _DisposeHandle ldy Offset nextLargeBlock dey ; offset to low word of index dey bne disposeLargeLoop ; now dispose of the index segment ldy Segment lda [H_ISegHandleHi],y pha lda [H_ISegHandleLo],y pha _DisposeHandle nextISeg SubWord Segment,#4,y bne disposeIndicesLoop disposedIndices ; dispose of the data segments - this loop starts at the end and counts down ldy H_NumDSegments ; y = offset to last seg handle beq disposedDSegs disposeDSegLoop ; unlock the segment sty Segment lda [H_DSegHandleHi],y sta SegHandle+2 lda [H_DSegHandleLo],y sta SegHandle ora SegHandle+2 beq @next ; no handle here PushLong SegHandle _DisposeHandle @next SubWord Segment,#4,y bne disposeDSegLoop ; there is no seg #0 disposedDSegs disposeHdr PushLong H_Header ; dispose of the heap header _DisposeHandle StzL H_Header ; clear the current heap id StzL H_HeaderPtr ; and pointer stz H_IsLocked ; and flag as unlocked ProfileOut 5,_H ReturnZ ENDP ;;-------------------------------------------------------------- ; H_WriteHeap(FileID:x) ; ; Write the current heap to disk. ; Writes to the (currently open) file indicated by FileID. ; Format of heap as written to disk: ; Header - First 4 bytes are 'Heap' ; Index Segment H_NumISegments ; : ; : ; Index Segment 4 ; Data Segment H_NumDSegments ; : ; : ; Data Segment 4 ; Last large block (last in last index segment) ; : ; : ; First large block (first in first index segment) ; Zpage variables modified: ; DP ; Segment ; SegPtr ; Offset H_WriteHeap PROC EXPORT IF HeapIO AND 1 THEN BeginZ phx ; save the FileID ; squeeze heap down to minimum size jsl H_TruncHeap plx stx DP ; save the FileID in DP ; copy selected header information back to real header ; H_Header - always maintained ; H_HeaderPtr - always maintained ; H_Version - always maintained (constant) ; H_NumISegments - always maintained ; H_NumDSegments - always maintained MoveLong H_FreeIndex,[H_HeaderPtr]:#H_FreeIndex MoveWord H_EndIndex,[H_HeaderPtr]:#H_EndIndex ; H_ISegHandleLo - don't care here ; H_ISegHandleHi - don't care here ; H_DSegHandleLo - don't care here ; H_DSegHandleHi - don't care here ; H_ISegPtrLo - don't care here ; H_ISegPtrHi - don't care here ; H_DSegPtrLo - don't care here ; H_DSegPtrHi - don't care here ; H_FreeListArray - don't care here ; punch a fake value into the header to facilitate ; human finding of saved heaps IF H_Header = 0 THEN MoveLong #'paeH',[H_HeaderPtr] ; that's 'Heap' ELSE MoveLong #'paeH',[H_HeaderPtr]:#H_Header ENDIF ; write out header PushWord DP PushLong H_Header jsl D_WriteHandle2 php pha ; restore proper header value IF H_Header = 0 THEN MoveLong H_Header,[H_HeaderPtr] ELSE MoveLong H_Header,[H_HeaderPtr]:#H_Header ENDIF pla plp jcs exit writeDSegs ; write out data segments (first to last) lda H_NumDSegments beq writeISegs lda #0 writeDSegLoop AddWord a,#4,y sty Segment PushWord DP lda [H_DSegHandleHi],y pha lda [H_DSegHandleLo],y pha jsl D_WriteHandle2 bcs exit lda Segment cmp H_NumDSegments blt writeDSegLoop writeISegs ; write out index segments (last to first) lda H_NumISegments beq writeLarge tay writeISegLoop sty Segment PushWord DP lda [H_ISegHandleHi],y pha lda [H_ISegHandleLo],y pha jsl D_WriteHandle2 bcs exit SubWord Segment,#4,y bne writeISegLoop ; write out all large blocks - we are traversing the index segments backwards writeLarge ldy H_NumISegments beq writtenLargeBlocks writeBlockLoop sty Segment lda [H_ISegPtrHi],y sta SegPtr+2 lda [H_ISegPtrLo],y sta SegPtr cpy H_NumISegments bne @1 ldy H_EndIndex bra writeLargeLoop @1 ldy #H_ISEG_SIZE writeLargeLoop ; loop through index segment backwards dey ; offset to high word of (previous) index dey lda [SegPtr],y bpl nextLargeBlock cmp #H_LARGE_BLOCK_FLAG blt nextLargeBlock pei DP sty Offset and #$00FF pha dey ; offset to low word of index dey lda [SegPtr],y pha jsl D_WriteHandle2 bcs exit ldy Offset nextLargeBlock dey ; offset to low word of index dey bne writeLargeLoop SubWord Segment,#4,y bne writeBlockLoop writtenLargeBlocks lda #0 ; no error clc exit ; carry already set if we came here on a error tay ; return errors in y ReturnZ ELSE ldy #-1 sec rtl ENDIF ; HeapIO ENDP ;;-------------------------------------------------------------- ; H_ReadHeap(FileID:x): HeapID:ax ; ; Read a heap from disk, make it the current heap, and return the heap id. ; Reads from the (currently open) file indicated by FileID. ; The old current heap will be unset, even if an error occurs. ; Zpage variables modified: ; H_Header ; H_IsLocked ; H_HeaderPtr ; H_FreeIndex ; H_EndIndex ; H_NumISegments ; H_NumDSegments ; ErrorFlag ; = Version Flag ; DP ; = FileID ; NewHeap ; Ptr ; DataSize ; SegHandle ; SegPtr ; Segment ; OldPtr ; H_SetHeap() ; H_UnsetHeap() ; H_DisposeHeap() ; CalcHeaderPtrs() H_ReadHeap PROC EXPORT IF HeapIO AND 2 THEN BeginZ stx DP ; save the FileID ; unset the current heap, if any lda H_Header ora H_Header+2 beq noCurHeap jsl H_UnsetHeap StzL H_Header stz H_IsLocked noCurHeap ; read in the heap header - update header & Z page SpaceLong PushWord DP jsl D_ReadHandle2 PullLong NewHeap ; don't use H_Header in case H_UnsetHeap is called bcc @headerOk1 tay ; return errors in y sec ReturnZ @headerOk1 ; check header 'signature' MoveLong [NewHeap],Ptr IF H_Header = 0 THEN CmpLong #'paeH',[Ptr] ELSE CmpLong #'paeH',[Ptr]:#H_Header ENDIF beq @headerOk2 lda #H_BAD brl errorHeader @headerOk2 SpaceLong PushLong NewHeap _GetHandleSize PullLong OldSize beq @headerOk3 ; size must be < 1 bank lda #H_BAD brl errorHeader @headerOk3 PushLong [NewHeap] ; update the Z page PushLong H_ZPptr PushLong #ZHEADER_SHORT_SIZE _BlockMove StzL H_Header IF ReadV70 THEN stz ErrorFlag ENDIF CmpLong H_Version,#H_THIS_VERSION ; check version beq @headerVersionOk IF ReadV70 THEN inc ErrorFlag ; not the latest version CmpLong H_Version,#H_VERSION7 beq @headerVersionOk ENDIF blt @oldVersion lda #H_TOO_NEW ; the heap is too new to load brl errorHeader @oldVersion ; the heap is too old to load lda #H_TOO_OLD brl errorHeader @headerVersionOk IF ReadV70 THEN lda ErrorFlag beq @newVersion lda # 0 since DataSize > 0 readBlockLoop sty Segment ; recalculate H_ISegHandleLo (Header may have moved, sigh) ;AddLong [NewHeap],#HANDLE_ARRAY,H_ISegHandleLo MoveLong [NewHeap],ax clc adc #HANDLE_ARRAY sta H_ISegHandleLo txa bcc @2 ina @2 sta H_ISegHandleLo+2 ldy Segment lda [H_ISegHandleLo],y sta SegHandle iny ; not using H_ISegHandleLo because I don't want iny ; to recalculate it lda [H_ISegHandleLo],y sta SegHandle+2 MoveLong [SegHandle],SegPtr ldy Segment cpy H_NumISegments bne @1 ldy H_EndIndex bra readLargeLoop @1 ldy #H_ISEG_SIZE readLargeLoop dey ; offset to high word of (previous) index dey lda [SegPtr],y bpl nextLargeBlock ; not a large block cmp #H_LARGE_BLOCK_FLAG2 blt nextLargeBlock ; not a large block sty Offset SpaceLong PushWord DP jsl D_ReadHandle2 ; could move H_IndexTable - recalc ptr tay ; save error PullLong OldPtr ; handle to large block bcs error ; Index segment may have moved - recalculate SegPtr MoveLong [SegHandle],SegPtr ; store large block handle in index table lda OldPtr+2 ; handle to large block ora #H_LARGE_BLOCK_FLAG ; set flag to H_LARGE_BLOCK_FLAG ldy Offset sta [SegPtr],y dey dey lda OldPtr ; handle to large block sta [SegPtr],y DecL DataSize lda DataSize ora DataSize+2 beq lockHandles ; no more large blocks ldy Offset nextLargeBlock dey ; offset to low word of index dey bne readLargeLoop SubWord Segment,#4,y jne readBlockLoop lockHandles ; lock handles down and fix up pointers MoveLong [NewHeap],H_HeaderPtr IF H_Header = 0 THEN MoveLong NewHeap,[H_HeaderPtr] ; store the heap id (handle) ELSE MoveLong NewHeap,[H_HeaderPtr]:#H_Header ; store the heap id (handle) ENDIF ;StzL [H_HeaderPtr]:#H_HeaderPtr ; force recalc of pointers lda #0 ; within header ldy #H_HeaderPtr sta [H_HeaderPtr],y ldy #H_HeaderPtr+2 sta [H_HeaderPtr],y MoveLong NewHeap,xy jsl H_SetHeap MoveLong H_Header,ax ; return HeapID ldy #0 ; no error clc ReturnZ errorHeader ; error after header loaded pha ; save error code from D_ReadHandle2 PushLong NewHeap _DisposeHandle bra errExit error phy ; save error code from D_ReadHandle2 MoveLong NewHeap,H_Header MoveLong [NewHeap],H_HeaderPtr jsr CalcHeaderPtrs ; make sure ptrs are good for H_DisposeHeap jsl H_DisposeHeap ; dispose of what portions we did read errExit lda #0 ; return 0 HeapID tax ply ; restore error code sec ReturnZ ELSE ldy #-1 sec rtl ENDIF ; HeapIO ENDP ;;-------------------------------------------------------------- ; CalcHeaderPtrs() ; ; Calculate pointers to arrays within the header. ; Zpage variables modified: ; H_ISegHandleLo ; H_ISegHandleHi ; H_DSegHandleLo ; H_DSegHandleHi ; H_ISegPtreLo ; H_ISegPtrHi ; H_DSegPtreLo ; H_DSegPtrHi ; H_FreeListArray CalcHeaderPtrs PROC ENTRY ;MoveLong H_HeaderPtr,xy ldx H_HeaderPtr ldy H_HeaderPtr+2 ; Array of free list heads ;AddLong H_HeaderPtr,#H_FreeLists:w,H_FreeListArray txa clc adc #H_FreeLists sta H_FreeListArray tya bcc @fl ina @fl sta H_FreeListArray+2 ; Array of handles to index segments ;AddLong H_HeaderPtr,#HANDLE_ARRAY:w,H_ISegHandleLo txa clc adc #HANDLE_ARRAY sta H_ISegHandleLo tya bcc @iHlo ina @iHlo sta H_ISegHandleLo+2 ;AddLong H_HeaderPtr,#HANDLE_ARRAY+2:w,H_ISegHandleHi txa clc adc #HANDLE_ARRAY+2 sta H_ISegHandleHi tya bcc @iHhi ina @iHhi sta H_ISegHandleHi+2 ; Array of handles to data segments ;AddLong H_HeaderPtr,H_DSegHOffsetLo:w,H_DSegHandleLo txa clc adc H_DSegHOffsetLo sta H_DSegHandleLo tya bcc @dHlo ina @dHlo sta H_DSegHandleLo+2 ;AddLong H_HeaderPtr,H_DSegHOffsetHi:w,H_DSegHandleHi txa clc adc H_DSegHOffsetHi sta H_DSegHandleHi tya bcc @dHhi ina @dHhi sta H_DSegHandleHi+2 ; Array of pointers to index segments ;AddLong H_HeaderPtr,H_ISegPOffsetLo:w,H_ISegPtrLo txa clc adc H_ISegPOffsetLo sta H_ISegPtrLo tya bcc @iPlo ina @iPlo sta H_ISegPtrLo+2 ;AddLong H_HeaderPtr,H_ISegPOffsetHi:w,H_ISegPtrHi txa clc adc H_ISegPOffsetHi sta H_ISegPtrHi tya bcc @iPhi ina @iPhi sta H_ISegPtrHi+2 ; Array of pointers to data segments ;AddLong H_HeaderPtr,H_DSegPOffsetLo:w,H_DSegPtrLo txa clc adc H_DSegPOffsetLo sta H_DSegPtrLo tya bcc @dPlo ina @dPlo sta H_DSegPtrLo+2 ;AddLong H_HeaderPtr,H_DSegPOffsetHi:w,H_DSegPtrHi txa clc adc H_DSegPOffsetHi sta H_DSegPtrHi tya bcc @dPhi ina @dPhi sta H_DSegPtrHi+2 rts ENDP END \ No newline at end of file diff --git a/appleworksgs/Heap/Src/Heap.mac b/appleworksgs/Heap/Src/Heap.mac new file mode 100755 index 0000000..ddabd91 --- /dev/null +++ b/appleworksgs/Heap/Src/Heap.mac @@ -0,0 +1 @@ +; ; Heap.mac - Heap macros ; ; Copyright 1989, Claris Corporation ; ; 1-13-89 Kevin A. Watts ; 1-17-89 kaw - added Deref ; BeginZ - prologue for use with Zero Page MACRO BeginZ phd lda #0 ; Replace with the address of the zero page tcd ENDM ; ReturnZ - epilog for use with Zero Page MACRO ReturnZ pld rtl ENDM ; DefineZ - modify routine using BeginZ prologue. ; Zero page address must be in accumulator, and data bank must equal code bank MACRO DefineZ &routine sta &routine+2 ENDM ; Deref Ptr - equivalent to "MoveLong [Ptr],Ptr", but this one works. ; Ptr should be a direct page variable ; Regs: a, x, y ; Side-effect: leaves Ptr in ax MACRO Deref &Ptr ldy #2 lda [&Ptr],y tax lda [&Ptr] sta &Ptr stx &Ptr+2 ENDM ; DivByPwr2 Var,Divisor - divide Var by Divisor, ; - where Divisor is a power of 2 MACRO DivByPwr2 &Var,&Divisor LCLA &count &count: SETA &eval( &Divisor ) WHILE &count > 1 DO lsr &Var &count: SETA &count/2 ENDWHILE ENDM ; MulByPwr2 Var,Multiplier - multiply Var by Multiplier, ; - where Multiplier is a power of 2 MACRO MulByPwr2 &Var,&Multiplier LCLA &count &count: SETA &eval( &Multiplier ) WHILE &count > 1 DO asl &Var &count: SETA &count/2 ENDWHILE ENDM \ No newline at end of file diff --git a/appleworksgs/Heap/Src/HeapPrivate.equ b/appleworksgs/Heap/Src/HeapPrivate.equ new file mode 100755 index 0000000..fe3daf3 --- /dev/null +++ b/appleworksgs/Heap/Src/HeapPrivate.equ @@ -0,0 +1 @@ +; ; HeapPrivate.equ ; ; Heap memory managment module equates ; ; Copyright 1989 Claris Corporation ; ; 6/8/89 Kevin A. Watts ; ;-------------------------------------------------------------- ; Conditional assembly flags - now defined in makefile ;ZeroInit equ 1 ; initialize handles to zero? ;ErrorCheck equ 2 ; error checking code? ;Verbose equ 0 ; verbose? (1=WordBox,2=AlertBox) ;VerboseErrors equ 0 ; alerts on normal errors? ;Debug equ 0 ; debugging? ;Profile equ 0 ; profiling? ;Profile equ 's' ; profiling? ;Squeezing equ 1 ; SqueezeHeap? ;GrowBlocks equ 1 ; grow blocks in place? ;HeapIO equ 3 ; 1 = H_WriteHeap, 2 = H_ReadHeap ;DriverSupport equ 1 ; Driver creation of zero page? ;VariableDSegSize equ 1 ; Variable sized data segments? ;VariableISegSize equ 0 ; Variable sized index segments? ;UseLastResort equ 0 ; Use last resort allocation strategy? ; DEBRK - debugging macro MACRO DEBRK IF Debug THEN brk ENDIF ENDM ; DEBRK2 - debugging macro MACRO DEBRK2 IF Debug OR ErrorCheck THEN brk ENDIF ENDM ; DEBRK3 - debugging macro MACRO DEBRK3 IF VerboseErrors THEN ; brk ENDIF ENDM ;-------------------------------------------------------------- H_THIS_VERSION equ $71 H_VERSION7 equ $70 H_ISEG_SIZE equ $1000 ; 4K index segments (1K indices) H_DSEG_SIZE equ $4000 ; 16K data segments H_MIN_COMPACT equ (H_DSEG_SIZE/8) ; free space required before compact H_MIN_SQUEEZE equ 40 ; segments must have this must free space ; to be a candidate for squeezing into H_LARGE_BLOCK_SIZE equ $1000 ; blocks 4K will be allocated as handles H_LARGE_BLOCK_FLAG equ $FF00 H_LARGE_BLOCK_FLAG2 equ $EE00 H_FREE_INDEX_FLAG equ $A000 H_BLOCK_OVERHEAD equ 2 ; size of overhead in each heap block ; verify that certain variables are correct in relation to each other IF (H_LARGE_BLOCK_FLAG H_LARGE_BLOCK_FLAG2) OR (H_LARGE_BLOCK_FLAG2 H_FREE_INDEX_FLAG) OR (H_FREE_INDEX_FLAG < $8000) THEN AERROR 'Must have H_LARGE_BLOCK_FLAG > H_LARGE_BLOCK_FLAG2 > H_FREE_INDEX_FLAG $8000' ENDIF IF (H_LARGE_BLOCK_FLAG MOD $100) 0 THEN AERROR 'H_LARGE_BLOCK_FLAG must have low byte = $00' ENDIF IF (H_LARGE_BLOCK_FLAG2 MOD $100) 0 THEN AERROR 'H_LARGE_BLOCK_FLAG2 must have low byte = $00' ENDIF IF (H_FREE_INDEX_FLAG MOD $1000) 0 THEN AERROR 'H_FREE_INDEX_FLAG must have low 3 nibbles = $000' ENDIF include 'Heap.equ' ; ----------- ; H_HeaderRec equates H_Header equ H_HeaderRec.Header H_Version equ H_HeaderRec.Version H_HeaderPtr equ H_HeaderRec.HeaderPtr H_NumISegments equ H_HeaderRec.NumISegments H_NumDSegments equ H_HeaderRec.NumDSegments H_FreeIndex equ H_HeaderRec.FreeIndex H_EndIndex equ H_HeaderRec.EndIndex ZHEADER_SHORT_SIZE equ H_HeaderRec.ZHEADER_SHORT_SIZE H_FreeListArray equ H_HeaderRec.FreeListArray H_ISegHandleLo equ H_HeaderRec.ISegHandleLo H_ISegHandleHi equ H_HeaderRec.ISegHandleHi H_DSegHandleLo equ H_HeaderRec.DSegHandleLo H_DSegHandleHi equ H_HeaderRec.DSegHandleHi H_ISegPtrLo equ H_HeaderRec.ISegPtrLo H_ISegPtrHi equ H_HeaderRec.ISegPtrHi H_DSegPtrLo equ H_HeaderRec.DSegPtrLo H_DSegPtrHi equ H_HeaderRec.DSegPtrHi ZHEADER_SIZE equ H_HeaderRec.ZHEADER_SIZE H_FreeLists equ H_HeaderRec.FreeLists HANDLE_ARRAY equ H_HeaderRec.HANDLE_ARRAY ;------------ H_SegmentRec RECORD 0 ; Structure of a heap data segment SegFreeList DS.W H_N_FREE_LISTS ; free list heads for each block size SegSize DS.W 1 ; segment size SegEnd DS.W 1 ; offset to never used portion of segment SegFreeSpace DS.W 1 ; total free space in segment SegNumBlocks DS.W 1 ; number of blocks in segment DSEG_HDR_SIZE equ * SegData equ * ENDR ; H_Segment ---------------------- ; N.B. there is code that assumes that H_SegFreeList = 0 H_SegFreeList equ H_SegmentRec.SegFreeList H_SegSize equ H_SegmentRec.SegSize H_SegEnd equ H_SegmentRec.SegEnd H_SegFreeSpace equ H_SegmentRec.SegFreeSpace H_SegNumBlocks equ H_SegmentRec.SegNumBlocks DSEG_HDR_SIZE equ H_SegmentRec.DSEG_HDR_SIZE ; minimum allowable data segment size H_MIN_DSEG_SIZE equ H_LARGE_BLOCK_SIZE+DSEG_HDR_SIZE ;------------ H_BlockRec RECORD 0 ; Structure of a data block BlockSize DS.W 1 ; block size Data equ * ENDR ; H_Block ---------------------- H_BlockSize equ H_BlockRec.BlockSize H_Data equ H_BlockRec.Data ;------------ ; H_VariablesRec equates ; 'Globals' - maintain value across heap calls H_ZPptr equ H_VariablesRec.H_ZPptr H_IsLocked equ H_VariablesRec.H_IsLocked H_MaxSegments equ H_VariablesRec.H_MaxSegments H_HeaderSize equ H_VariablesRec.H_HeaderSize H_DSegHOffsetLo equ H_VariablesRec.H_DSegHOffsetLo H_DSegHOffsetHi equ H_VariablesRec.H_DSegHOffsetHi H_ISegPOffsetLo equ H_VariablesRec.H_ISegPOffsetLo H_ISegPOffsetHi equ H_VariablesRec.H_ISegPOffsetHi H_DSegPOffsetLo equ H_VariablesRec.H_DSegPOffsetLo H_DSegPOffsetHi equ H_VariablesRec.H_DSegPOffsetHi ; 'Locals' - not assumed to maintain value across heap calls BlockSize equ H_VariablesRec.BlockSize CopyHdr equ H_VariablesRec.CopyHdr DP equ H_VariablesRec.DP DataSize equ H_VariablesRec.DataSize EndPtr equ H_VariablesRec.EndPtr ErrorFlag equ H_VariablesRec.ErrorFlag FreeListOffset equ H_VariablesRec.FreeListOffset HasMoved equ H_VariablesRec.HasMoved Index equ H_VariablesRec.Index ISegPtr equ H_VariablesRec.ISegPtr SkipLastResort equ H_VariablesRec.SkipLastResort MaxFreeSeg equ H_VariablesRec.MaxFreeSeg MaxFreeSpace equ H_VariablesRec.MaxFreeSpace NewHeap equ H_VariablesRec.NewHeap Offset equ H_VariablesRec.Offset OldIndex equ H_VariablesRec.OldIndex OldPtr equ H_VariablesRec.OldPtr OldSize equ H_VariablesRec.OldSize Ptr equ H_VariablesRec.Ptr SegHandle equ H_VariablesRec.SegHandle Segment equ H_VariablesRec.Segment SegPtr equ H_VariablesRec.SegPtr SegSize equ H_VariablesRec.SegSize ;------------ IF H_LARGE_BLOCK_SIZE > (H_DSEG_SIZE-DSEG_HDR_SIZE) THEN AERROR 'Must have H_LARGE_BLOCK_SIZE (H_DSEG_SIZE-DSEG_HDR_SIZE)' ENDIF ;-------------------------------------------------------------- ; Driver routines and globals IMPORT D_ReadHandle IMPORT D_WriteHandle IMPORT D_ReadHandle2 IMPORT D_WriteHandle2 IMPORT D_NeedHand IMPORT D_NeedHandle IMPORT D_GrowHandle IMPORT D_GrowLHandle ;IMPORT D_ZeroBlock - done in Heap.equ for Driver:Init.aii IMPORT D_CheckPurge IMPORT D_AlertBox IMPORT D_WordBox IMPORT D_CloseWordBox IMPORT D_SystemHandle IMPORT D_TopModule \ No newline at end of file diff --git a/appleworksgs/Heap/Src/X_Heap.aii b/appleworksgs/Heap/Src/X_Heap.aii new file mode 100755 index 0000000..11796ff --- /dev/null +++ b/appleworksgs/Heap/Src/X_Heap.aii @@ -0,0 +1 @@ +; ; X_Heap.aii - Heap v6 glue routines for backward compatability ; ; Copyright 1989, Claris Corporation ; ; 1-10-89 Kevin A. Watts ; ;-------------------------------------------------------------- ; Heap Routines: ; ; X_NewHeap(HeapIncSize:l,IndexIncSize:l): Heap:l ; X_DisposeHeap(Heap:l) ; X_NeedSpace(Heap:l,FreeSpace:l) ; X_NewBlock( Heap:l,Size:l): Index:l ; X_DisposeBlock(Heap:l,Index:l) ; X_GetBlockSize(Heap:l,Index:l): Size:l ; X_GetBlockPtr(Heap:l,Index:l): Ptr:l ; X_ResizeBlock(Heap:l,Index:l,Size:l) ; X_ReadHeap(): Heap:l ; X_WriteHeap(Heap:l) ; X_TruncHeap(Heap:l) ; X_CopyIndex(Heap:l,Index:l): Copy:l ; ;-------------------------------------------------------------- PRINT PUSH PRINT OFF CheckHeap equ 0 LOAD 'Macros.Dump' include 'Heap.aii.i' include 'Driver.equ' IMPORT D_AlertBox PRINT POP ;;-------------------------------------------------------------------------; ; X_NewHeap ( HeapIncSize:l,IndexIncSize:l): Heap:l ; X_NewHeap PROC EXPORT input HeapIncSize:l,IndexIncSize:l output Heap:l error ErrorFlag BEGIN stz ErrorFlag ; jsl H_SegLoaded H_NewHeap Heap,err=ErrorFlag RETURN ENDP ;;-------------------------------------------------------------------------; ; X_DisposeHeap ( Heap:l ) ; X_DisposeHeap PROC EXPORT input Heap:l BEGIN IF CheckHeap THEN jsl H_CurrentHeap CmpLong ax,Heap beq ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit ErrorMesg str 'X_DisposeHeap: mismatched heap!!' ok ENDIF H_DisposeHeap ; jsl H_SegUnloaded exit RETURN ENDP ;;-------------------------------------------------------------------------; ; X_NeedSpace ( Heap:l, FreeSpace:l ) ; X_NeedSpace PROC EXPORT input Heap:l,FreeSpace:l BEGIN RETURN #0 ENDP ;;-------------------------------------------------------------------------; ; X_NewBlock ( Heap:l,Size:l ): Index:l ; X_NewBlock PROC EXPORT input Heap:l,Size:l output Index:l error ErrorFlag BEGIN IF CheckHeap THEN jsl H_CurrentHeap CmpLong ax,Heap beq ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit ErrorMesg str 'X_NewBlock: mismatched heap!!' ok ENDIF H_NewBlock Size,Index,err=ErrorFlag exit RETURN ENDP ;;-------------------------------------------------------------------------; ; X_DisposeBlock ( Heap:l,Index:l ) ; X_DisposeBlock PROC EXPORT input Heap:l,Index:l BEGIN IF CheckHeap THEN jsl H_CurrentHeap CmpLong ax,Heap beq ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit ErrorMesg str 'X_DisposeBlock: mismatched heap!!' ok ENDIF H_DisposeBlock Index exit RETURN ENDP ;;-------------------------------------------------------------------------; ; X_GetBlockSize ( Heap:l,Index:l ): Size:l ; X_GetBlockSize PROC EXPORT input Heap:l,Index:l output Size:l BEGIN IF CheckHeap THEN jsl H_CurrentHeap CmpLong ax,Heap beq ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit ErrorMesg str 'X_GetBlockSize: mismatched heap!!' ok ENDIF H_GetBlockSize Index,Size exit RETURN ENDP ;;-------------------------------------------------------------------------; ; X_GetBlockPtr ( Heap:l,Index:l ): Ptr:l ; X_GetBlockPtr PROC EXPORT input Heap:l,Index:l output Ptr:l BEGIN IF CheckHeap THEN jsl H_CurrentHeap CmpLong ax,Heap beq ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit ErrorMesg str 'X_GetBlockPtr: mismatched heap!!' ok ENDIF H_GetBlockPtr Index,Ptr exit RETURN ENDP ;;-------------------------------------------------------------------------; ; X_ResizeBlock ( Heap:l,Index:l,NewSize:l ) ; X_ResizeBlock PROC EXPORT input Heap:l,Index:l,NewSize:l local NewPtr:l error ErrorFlag BEGIN IF CheckHeap THEN jsl H_CurrentHeap CmpLong ax,Heap beq ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit ErrorMesg str 'X_ResizeBlock: mismatched heap!!' ok ENDIF H_ResizeBlock Index,NewSize,err=ErrorFlag exit RETURN ENDP ;;-------------------------------------------------------------------------; ; X_WriteHeap ( Heap:long ) ; X_WriteHeap PROC EXPORT input Heap:l error ErrorFlag BEGIN IF CheckHeap THEN jsl H_CurrentHeap CmpLong ax,Heap beq ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit ErrorMesg str 'X_WriteHeap: mismatched heap!!' ok ENDIF H_WriteHeap err=ErrorFlag exit RETURN ENDP ;-------------------------------------------------------------------------; ; X_ReadHeap ( ):Heap:long ; X_ReadHeap PROC EXPORT output Heap:l error ErrorFlag BEGIN H_ReadHeap Heap,err=ErrorFlag exit RETURN ENDP ;-------------------------------------------------------------------------; ; X_TruncHeap ( Heap:l ) ; X_TruncHeap PROC EXPORT input Heap:l BEGIN IF CheckHeap THEN jsl H_CurrentHeap CmpLong ax,Heap beq ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit ErrorMesg str 'X_TruncBlock: mismatched heap!!' ok ENDIF H_TruncHeap exit RETURN ENDP ;;--------------------------------------------------------------------------; ; X_CopyIndex ( Heap:l, Index:l ):CopyIndex:l ; X_CopyIndex PROC EXPORT input Heap:l,Index:l output CopyIndex:l local NewPtr:l error ErrorFlag BEGIN IF CheckHeap THEN jsl H_CurrentHeap CmpLong ax,Heap beq ok Call D_AlertBox,in=(#OkBox:w,#ErrorMesg:l),out=(a:w) bra exit ErrorMesg str 'X_CopyIndex: mismatched heap!!' ok ENDIF H_CopyBlock Index,CopyIndex,err=ErrorFlag exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/Heap/X_Heap.aii.i b/appleworksgs/Heap/X_Heap.aii.i new file mode 100755 index 0000000..75b7e09 --- /dev/null +++ b/appleworksgs/Heap/X_Heap.aii.i @@ -0,0 +1 @@ +; ; X_Heap.aii.i ; ; Imports from X_Heap.aii ; ; Copyright 1989, Claris Corporation ; ; Tuesday, January 31, 1989 6:17:13 PM ; IMPORT X_NewHeap IMPORT X_DisposeHeap IMPORT X_NeedSpace IMPORT X_NewBlock IMPORT X_DisposeBlock IMPORT X_GetBlockSize IMPORT X_GetBlockPtr IMPORT X_ResizeBlock IMPORT X_WriteHeap IMPORT X_ReadHeap IMPORT X_TruncHeap IMPORT X_CopyIndex \ No newline at end of file diff --git a/appleworksgs/IW.CL/.DS_Store b/appleworksgs/IW.CL/.DS_Store new file mode 100644 index 0000000..7174725 Binary files /dev/null and b/appleworksgs/IW.CL/.DS_Store differ diff --git a/appleworksgs/IW.CL/IWCL.make b/appleworksgs/IW.CL/IWCL.make new file mode 100755 index 0000000..8aa56c3 --- /dev/null +++ b/appleworksgs/IW.CL/IWCL.make @@ -0,0 +1 @@ +# # IWCL.make - Makefile for the ImageWriter CL driver # # Copyright 1989, Claris Corporation. # # This makefile only assembles IWCL code. It is NOT intended to be used # as a sub-build to ::AppleWorks.make. # # To build LQ driver instead of regular driver, change the "-d lq=0" to # "-d lq=1" and change Program to "ImageWriter.CLQ" #-------------------------------------------------------------------------------- # Variables AsmIIGSOptions1 = -i {IWCLIncDir},{AWGS}Macros AsmIIGSOptions2 = -d lq=0 Program = ImageWriter.CL IWCLSrcDir = {iwcl}src: IWCLIncDir = {iwcl}src: IWCLObjDir = {iwcl}obj: Makefile = {iwcl}IWCL.make GlobalMacros = {iwcl}src:all.macros {iwcl}src:iw.macros {awgs}macros:m16.stack {awgs}macros:m16.cmp Objs = {IWCLObjDir}iw.o {IWCLObjDir}dialogdata.o {IWCL}{Program} {Objs} @If "`Newer {Objs} {IWCL}{Program}`" LinkIIGS {IWCLObjDir}iw.o {IWCLObjDir}dialogdata.o -o {IWCL}{Program} -t $BB -at $0001 -l > {IWCL}Link.map @End {Objs} {makefile} {IWCLObjDir}iw.o {IWCLSrcDir}iw.asm {IWCLSrcDir}hld.asm {IWCLSrcDir}lld.asm {IWCL}iw.sym {Makefile} ASMIIGS {IWCLSrcDir}iw.asm -o {IWCLObjDir}iw.o {AsmIIGSOptions1} {AsmIIGSOptions2} {IWCLObjDir}dialogdata.o {IWCLSrcDir}dialogdata.asm ASMIIGS {IWCLSrcDir}dialogdata.asm -o {IWCLObjDir}dialogdata.o {AsmIIGSOptions1} {AsmIIGSOptions2} {IWCL}iw.sym {IWCLSrcDir}iw.asm {GlobalMacros} ASMIIGS -c -d DUMPIT {IWCLSrcDir}iw.asm {AsmIIGSOptions1} \ No newline at end of file diff --git a/appleworksgs/IW.CL/Src/all.macros b/appleworksgs/IW.CL/Src/all.macros new file mode 100755 index 0000000..d903427 --- /dev/null +++ b/appleworksgs/IW.CL/Src/all.macros @@ -0,0 +1 @@ + PRINT PUSH PRINT OFF ********************************************************************** * * All.Macros * * This file contains all the tool macros and the utility macros * that we use to build system tools and the ROM. * ********************************************************************** ********************************************************************** * * OUR MACROS * * Macros used by the toolbox group in making system software. * * These include most of the M16.Utility macros by Lou Infeld, * the dummy section macros by Steve Glass and Don Marsh and the * PushPtr macro. * ********************************************************************** ************************************************************************* * * * Apple //GS Utility Macros * * by * * Lou Infeld * * * * Copyright Apple Computer, Inc. 1986-1988 * * All Rights Reserved * * * * Revision History * * ---------------- * * v1.0R1 (04/29/87) -- First Release * * This file is a subset of the old * * 'M16.Utility' * * v2.0R1 (01/22/88) -- First AsmIIGS release * * v2.0R2 (02/11/88) -- "writelin" renamed "writeline" * * v2.0R3 (03/29/88) -- "|" added to pea instrs to avoid Assembler * * warning * * "pushlong" was incorrect if &offset was "s" * * or not specified * * v2.0R4 (04/14/88) -- "writestr" and "writeline" didn't restore * * STRING setting * * v2.0R5 (06/15/88) -- "pushlong" was incorrect for stack relative * * * (Long and Short Removed by SEG) ************************************************************************* ;............................................................... ; ; Pull 3 bytes from stack ; ; pull3 addr -- pulls bytes off stack and stores in 'loc' ;............................................................... MACRO pull3 &addr pull1 &addr pullword &addr+1 MEND ;............................................................... ; ; Pull 1 byte from stack ; ; pull1 loc -- pulls byte off stack and stores in 'loc' ; pull1 loc,x -- pulls byte off stack and stores in 'loc,x' ; pull1 -- pulls byte off stack and leaves in A ;............................................................... MACRO pull1 &addr,® shortm pullword &addr,® longm MEND ;............................................................... ; ; Push 1 byte onto stack ; ; push1 loc -- pushes byte onto stack from 'loc' ; push1 loc,x -- pushes byte onto stack from 'loc,x' ; push1 #n -- pushes constant #n onto stack ; push1 -- pushes byte onto stack (from A) ;............................................................... MACRO push1 &addr,® shortm pushword &addr,® longm MEND ;............................................................... ; ; Push 3 bytes onto stack ; ; push3 addr -- pushes bytes onto stack from 'loc' ; push3 addr,x -- pushes bytes onto stack from 'loc,x' ; push3 #n -- pushes constant #n onto stack ;............................................................... MACRO push3 &addr,® IF ®'' THEN lda &addr+1,® pha phb lda &addr,® sta 1,s ELSEIF &addr[1:1]='#' THEN lda #&addr[2:255]>>8 pha GOTO .a ELSE lda &addr+1 pha .a phb lda &addr sta 1,s ENDIF MEND ;............................................................... ; ; Add 2 byte integers ; ; add loc1,loc2,loc3 - adds 'loc1' to 'loc2' and stores in 'loc3' ; add loc1,loc2 - adds 'loc1' to 'loc2' and leaves in A ; add ,loc2,loc3 - adds A with 'loc2' and stores in 'loc3' ; ; 'loc1' and 'loc2' can be constants ;............................................................... MACRO add &a1,&a2,&a3 IF &a1'' THEN lda &a1 ENDIF clc adc &a2 IF &a3'' THEN sta &a3 ENDIF MEND ;............................................................... ; ; Add 4 byte integers ; ; add4 loc1,loc2,loc3 - adds 'loc1' to 'loc2' and stores in 'loc3' ; add4 ,loc2,loc3 - adds A to 'loc2' and stores in 'loc3' ; ; 'loc1' and 'loc2' can be constants ;............................................................... MACRO add4 &a1,&a2,&a3 IF &a1'' THEN lda &a1 ENDIF clc adc &a2 sta &a3 IF &a1='' THEN lda #0 ELSEIF &a1[1:1]='#' THEN lda #^&a1[2:255] ELSE lda &a1+2 ENDIF IF &a2[1:1]='#' THEN adc #^&a2[2:255] ELSE adc &a2+2 ENDIF sta &a3+2 MEND ;............................................................... ; ; Increment a 4 byte integer ; ; inc4 loc - increments 'loc' ;............................................................... MACRO inc4 &a1 inc &a1 bne @a inc &a1+2 @a MEND ;............................................................... ; ; Subtract 2 byte integers ; ; sub loc1,loc2,loc3 - subtracts 'loc2' from 'loc1' and stores in 'loc3' ; sub loc1,loc2 - subtracts 'loc2' from 'loc1' and leaves in A ; sub ,loc2,loc3 - subtracts 'loc2' from A and stores in 'loc3' ; ; 'loc1' and 'loc2' can be constants ;............................................................... MACRO sub &a1,&a2,&a3 IF &a1'' THEN lda &a1 ENDIF sec sbc &a2 IF &a3'' THEN sta &a3 ENDIF MEND ;............................................................... ; ; Subtract 4 byte integers ; ; sub4 loc1,loc2,loc3 - subtracts 'loc2' from 'loc1' and stores in 'loc3' ; sub4 ,loc2,loc3 - subtracts 'loc2' from A and stores in 'loc3' ;............................................................... MACRO sub4 &a1,&a2,&a3 IF &a1'' THEN lda &a1 ENDIF sec sbc &a2 sta &a3 IF &a1='' THEN lda #0 ELSEIF &a1[1:1]='#' THEN lda #^&a1[2:255] ELSE lda &a1+2 ENDIF IF &a2[1:1]='#' THEN sbc #^&a2[2:255] ELSE sbc &a2+2 ENDIF sta &a3+2 MEND ;............................................................... ; ; Decrement a 4 byte integer ; ; dec4 loc - decrements 'loc' ;............................................................... MACRO dec4 &a1 dec &a1 bpl @a dec &a1+2 @a MEND ;............................................................... ; ; Define string ; ; Generates a Pascal type of string ;............................................................... MACRO str &string lclc &sset &sset SETC &SETTING('STRING') STRING PASCAL dc.B &string STRING &sset MEND ;............................................................... ; ; Define pointer ;............................................................... MACRO dp &pointer dc.L &pointer MEND ;............................................................... ; ; Left Shift 4 bytes ; ; asl4 loc,#n ;n is shift count (pos) ; asl4 loc,lnum ;lnum contains shift count (pos) ; asl4 loc ;X contains shift count (pos) ;............................................................... MACRO asl4 &loc,&num lda &loc+2 IF &num'' THEN ldx &num ENDIF @a asl a asl &loc adc #0 dex bne @a sta &loc+2 MEND ;............................................................... ; ; Right Shift 4 bytes ; ; lsr4 loc,#n ;n is shift count (pos) ; lsr4 loc,lnum ;lnum contains shift count (pos) ; lsr4 loc ;X contains shift count (neg) ;............................................................... MACRO lsr4 &loc,&num IF &num'' THEN lda &num eor #$FFFF clc adc #1 tax ENDIF lda &loc @a lsr a lsr &loc+2 bcc @b ora #$8000 @b inx bne @a sta &loc MEND ;............................................................... ; ; Turn on native mode ; ; The processor is put into 'native' mode. 8 bit or 16 bit ; mode can be specified by using 'short' or 'long' as the ; parameter. If no parameter is specified, 'long' is assumed ;............................................................... MACRO native &mode clc xce IF &mode'' THEN &mode ELSE long ENDIF MEND ;............................................................... ; ; Turn on emulation mode ; ; The processor is put into 'emulation' mode. ;............................................................... MACRO emulation sec xce longa off longi off MEND ;............................................................... ; ; Set Memory & A register to 16 bits ;............................................................... MACRO longm rep #%00100000 longa on MEND ;............................................................... ; ; Set X & Y registers to 16 bits ;............................................................... MACRO longx rep #%00010000 longi on MEND ;............................................................... ; ; Set Memory & A register to 8 bits ;............................................................... MACRO shortm sep #%00100000 longa off MEND ;............................................................... ; ; Set X & Y registers to 8 bits ;............................................................... MACRO shortx sep #%00010000 longi off MEND ;............................................................... ; ; Write string ; ; writestr loc - string at loc 'loc' ; writestr #'ABC' - string='ABC' ; writestr - A,Y has loc of string ;............................................................... MACRO writestr &addr IF &addr'' THEN IF &addr[1:1]='#' THEN bra @b LCLC &sset &sset SETC &SETTING('STRING') STRING PASCAL @a DC.B &addr[2:255] STRING &sset @b pea @a>>16 pea |@a ELSE pea &addr>>16 pea |&addr ENDIF ELSE phy pha ENDIF ldx #$1C0C jsl $E10000 MEND ;............................................................... ; ; Write line (string+CR) ; ; writeline loc - string at loc 'loc' ; writeline #'ABC' - string='ABC' ; writeline 'ABC' - string='ABC' ; writeline - CR only ; ;............................................................... MACRO writeline &addr IF &addr'' THEN IF &addr[1:1]='#' OR &addr[1:1]='''' THEN bra @b LCLC &sset &sset SETC &SETTING('STRING') STRING PASCAL IF &addr[1:1]='#' THEN @a DC.B &addr[2:255] ELSE @a DC.B &addr[1:255] ENDIF STRING &sset @b pea @a>>16 pea |@a ELSE pea &addr>>16 pea |&addr ENDIF ELSE pea @c+1>>16 pea |@c+1 ENDIF ldx #$1A0C @c jsl $E10000 MEND ;............................................................... ; ; Write character ; ; writech - char in A register ; writech #'A' - char='A' ; writech ch,x - char in loc 'ch,x' ;............................................................... MACRO writech &addr,® IF &addr'' THEN IF ®'' THEN lda &addr,® ELSE lda &addr ENDIF ENDIF pha ldx #$180C jsl $E10000 MEND ;............................................................... ; ; Read a char from keyboard ; ; readch addr - char stored in 'addr' ; readch - char left in A register ; ;............................................................... MACRO readch &addr pea 0 pea 1 ldx #$220C jsl $E10000 pla IF &addr'' THEN sta &addr ENDIF MEND ; ; DSect Macros ; ; By Don Marsh and Steven Glass ; 11 Sep 87 ; ; A series of macros to help in making equates. This is ; useful when you want to define a series of equates that ; relate to each other. For example, offsets on the stack, ; locations on direct page, offsets in a record. ; ; Normally you would do something like ; ; lab1 equ 0 ; lab2 equ lab1+4 ; lab3 equ lab2+2 ; etc. ; ; These macros let you do the following ; ; DSECT 0 ; lab1 long ; lab2 word ; lab3 long ; ; The macros do the equating and addition for you. They also make the ; code more readable. ; ; The macro GlobalDSECT makes the equates global rather than ; local. ; ; The macro DSectSize returns the current value of the ; dummy program counter that is being maintained. ; ; The macro DefineStack is like using DSECT 1. ; ; ; DSect &Value ; ; Begin local data section. This defines a dummy PC ; register which can be used in equates to avoid error- ; prone linked equates for setting up direct page or ; stack offsets. The dummy PC begins at &Value and ; is updated by the appropriate amount by the BYTE, ; WORD, LONG, and BLOCK macros. ; MACRO DSect &Value DummyPC SET &Value MEND ; ; DefineStack ; ; This is a specialized data section which defines ; a dummy PC starting at 1 in order to define a ; series of stack offsets using the BYTE, WORD, ; LONG, and BLOCK macros. ; MACRO DefineStack DummyPC SET 1 MEND ; ; &lab byte ; ; Equate the given label with the current dummy ; PC (defined by DSect, GlobalDSect, or ; DefineStack), and update the dummy PC by the ; appropriate amount. ; MACRO &lab BYTE &lab equ DummyPC DummyPC SET DummyPC+1 MEND ; ; &lab word ; ; Equate the given label with the current dummy ; PC (defined by DSect, GlobalDSect, or ; DefineStack), and update the dummy PC by the ; appropriate amount. ; MACRO &lab WORD &lab equ DummyPC DummyPC SET DummyPC+2 MEXIT MEND ; ; &lab long ; ; Equate the given label with the current dummy ; PC (defined by DSect, GlobalDSect, or ; DefineStack), and update the dummy PC by the ; appropriate amount. ; MACRO &lab LONG &lab equ DummyPC DummyPC SET DummyPC+4 MEND ; ; &lab block &size ; ; Equate the given label with the current dummy ; PC (defined by DSect, GlobalDSect, or ; DefineStack), and update the dummy PC by the ; appropriate amount (&size bytes). ; MACRO &lab BLOCK &Value if &lab = '' goto .skiplab &lab equ DummyPC .skiplab DummyPC SET DummyPC+&Value MEND ; ; &lab DSectSize ; ; This macro equates the given label with the ; current dummy PC defined by the DSect, ; GlobalDSect, or DefineStack macros. This is ; useful for determing the size of data sections ; or parts of data sections. ; MACRO &lab DSectSize &lab equ DummyPC MEND ; ; CheckSize &size,&limit ; ; This macro causes an assembler error if ; &size > &limit. Useful in checking the size ; of direct page assignments. ; MACRO CheckSize &size,&limit IF &Eval(&size)<=&Eval(&limit) goto .DONE AError 'Programmer-specified size limit exceeded: ABORT ASSEMBLY!' .DONE MEND MACRO &lab SYSTEMDATE &lab LCLC &Temp &Temp setc &getenv('SystemDate') LCLC &EIB ; declare a temporary var to hold current string setting &EIB SETC &SETTING('STRING') ; put current string setting into temp STRING ASIS ; Set string type to ASIS. if &TEMP='' then DC.B '&SysDate' ; make the string else DC.B '&TEMP' endif STRING &EIB ; restore orig string settings MEND MACRO &lab SYSTEMTIME &lab LCLC &Temp &Temp setc &getenv('SystemTime') LCLC &EIB ; declare a temporary var to hold current string setting &EIB SETC &SETTING('STRING') ; put current string setting into temp STRING ASIS ; Set string type to ASIS. if &TEMP='' then DC.B '&SysTime' ; make the string else DC.B '&TEMP' endif STRING &EIB ; restore orig string settings MEND ;----------------------------------------------------------- ; ; A few last macros ; MACRO &lab PushPtr &addr &lab dc.B $F4 dc.W (&addr)>>16 dc.B $F4 dc.W &addr MEND macro &lab SetMode16 &lab rep #$30 longa on longi on ENDM macro &lab SetMode8 &lab sep #$30 longa off longi off ENDM ; File: M16.ACE ; ; ; Copyright Apple computer, Inc. 1988 ; All Rights Reserved ; ; MACRO &lab _ACEBootInit &lab ldx #$011D jsl $E10000 MEND MACRO &lab _ACEStartUp &lab ldx #$021D jsl $E10000 MEND MACRO &lab _ACEShutDown &lab ldx #$031D jsl $E10000 MEND MACRO &lab _ACEVersion &lab ldx #$041D jsl $E10000 MEND ; MACRO ;&lab _ACEReset ;&lab ldx #$051D ; jsl $E10000 ; MEND MACRO &lab _ACEStatus &lab ldx #$061D jsl $E10000 MEND MACRO &lab _ACEInfo &lab ldx #$071D jsl $E10000 MEND MACRO &lab _ACECompBegin &lab ldx #$0B1D jsl $E10000 MEND MACRO &lab _ACECompress &lab ldx #$091D jsl $E10000 MEND MACRO &lab _ACEExpand &lab ldx #$0A1D jsl $E10000 MEND MACRO &lab _ACEExpBegin &lab ldx #$0C1D jsl $E10000 MEND ; File: M16.ADB ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _ADBBootInit &lab ldx #$0109 jsl $E10000 MEND MACRO &lab _ADBStartUp &lab ldx #$0209 jsl $E10000 MEND MACRO &lab _ADBShutDown &lab ldx #$0309 jsl $E10000 MEND MACRO &lab _ADBVersion &lab ldx #$0409 jsl $E10000 MEND MACRO &lab _ADBReset &lab ldx #$0509 jsl $E10000 MEND MACRO &lab _ADBStatus &lab ldx #$0609 jsl $E10000 MEND MACRO &lab _AbsOff &lab ldx #$1009 jsl $E10000 MEND MACRO &lab _AbsOn &lab ldx #$0F09 jsl $E10000 MEND MACRO &lab _AsyncADBReceive &lab ldx #$0D09 jsl $E10000 MEND MACRO &lab _ClearSRQTable &lab ldx #$1609 jsl $E10000 MEND MACRO &lab _GetAbsScale &lab ldx #$1309 jsl $E10000 MEND MACRO &lab _ReadAbs &lab ldx #$1109 jsl $E10000 MEND MACRO &lab _ReadKeyMicroData &lab ldx #$0A09 jsl $E10000 MEND MACRO &lab _ReadKeyMicroMem &lab ldx #$0B09 jsl $E10000 MEND MACRO &lab _SendInfo &lab ldx #$0909 jsl $E10000 MEND MACRO &lab _SetAbsScale &lab ldx #$1209 jsl $E10000 MEND MACRO &lab _SRQPoll &lab ldx #$1409 jsl $E10000 MEND MACRO &lab _SRQRemove &lab ldx #$1509 jsl $E10000 MEND MACRO &lab _SyncADBReceive &lab ldx #$0E09 jsl $E10000 MEND ; File: M16.Control ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _CtlBootInit &lab ldx #$0110 jsl $E10000 MEND MACRO &lab _CtlStartUp &lab ldx #$0210 jsl $E10000 MEND MACRO &lab _CtlShutDown &lab ldx #$0310 jsl $E10000 MEND MACRO &lab _CtlVersion &lab ldx #$0410 jsl $E10000 MEND MACRO &lab _CtlReset &lab ldx #$0510 jsl $E10000 MEND MACRO &lab _CtlStatus &lab ldx #$0610 jsl $E10000 MEND MACRO &lab _CtlNewRes &lab ldx #$1210 jsl $E10000 MEND MACRO &lab _DisposeControl &lab ldx #$0A10 jsl $E10000 MEND MACRO &lab _DragControl &lab ldx #$1710 jsl $E10000 MEND MACRO &lab _DragRect &lab ldx #$1D10 jsl $E10000 MEND MACRO &lab _DrawControls &lab ldx #$1010 jsl $E10000 MEND MACRO &lab _DrawOneCtl &lab ldx #$2510 jsl $E10000 MEND MACRO &lab _EraseControl &lab ldx #$2410 jsl $E10000 MEND MACRO &lab _FindControl &lab ldx #$1310 jsl $E10000 MEND MACRO &lab _GetCtlAction &lab ldx #$2110 jsl $E10000 MEND MACRO &lab _GetCtlDPage &lab ldx #$1F10 jsl $E10000 MEND MACRO &lab _GetCtlParams &lab ldx #$1C10 jsl $E10000 MEND MACRO &lab _GetCtlRefCon &lab ldx #$2310 jsl $E10000 MEND MACRO &lab _GetCtlTitle &lab ldx #$0D10 jsl $E10000 MEND MACRO &lab _GetCtlValue &lab ldx #$1A10 jsl $E10000 MEND MACRO &lab _GrowSize &lab ldx #$1E10 jsl $E10000 MEND MACRO &lab _HideControl &lab ldx #$0E10 jsl $E10000 MEND MACRO &lab _HiliteControl &lab ldx #$1110 jsl $E10000 MEND MACRO &lab _KillControls &lab ldx #$0B10 jsl $E10000 MEND MACRO &lab _MoveControl &lab ldx #$1610 jsl $E10000 MEND MACRO &lab _NewControl &lab ldx #$0910 jsl $E10000 MEND MACRO &lab _SetCtlAction &lab ldx #$2010 jsl $E10000 MEND MACRO &lab _SetCtlIcons &lab ldx #$1810 jsl $E10000 MEND MACRO &lab _SetCtlParams &lab ldx #$1B10 jsl $E10000 MEND MACRO &lab _SetCtlRefCon &lab ldx #$2210 jsl $E10000 MEND MACRO &lab _SetCtlTitle &lab ldx #$0C10 jsl $E10000 MEND MACRO &lab _SetCtlValue &lab ldx #$1910 jsl $E10000 MEND MACRO &lab _ShowControl &lab ldx #$0F10 jsl $E10000 MEND MACRO &lab _TestControl &lab ldx #$1410 jsl $E10000 MEND MACRO &lab _TrackControl &lab ldx #$1510 jsl $E10000 MEND ; File: M16.Desk ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _DeskBootInit &lab ldx #$0105 jsl $E10000 MEND MACRO &lab _DeskStartUp &lab ldx #$0205 jsl $E10000 MEND MACRO &lab _DeskShutDown &lab ldx #$0305 jsl $E10000 MEND MACRO &lab _DeskVersion &lab ldx #$0405 jsl $E10000 MEND MACRO &lab _DeskReset &lab ldx #$0505 jsl $E10000 MEND MACRO &lab _DeskStatus &lab ldx #$0605 jsl $E10000 MEND MACRO &lab _ChooseCDA &lab ldx #$1105 jsl $E10000 MEND MACRO &lab _CloseAllNDAs &lab ldx #$1D05 jsl $E10000 MEND MACRO &lab _CloseNDA &lab ldx #$1605 jsl $E10000 MEND MACRO &lab _CloseNDAByWinPtr &lab ldx #$1C05 jsl $E10000 MEND MACRO &lab _FixAppleMenu &lab ldx #$1E05 jsl $E10000 MEND MACRO &lab _GetDAStrPtr &lab ldx #$1405 jsl $E10000 MEND MACRO &lab _GetNumNDAs &lab ldx #$1B05 jsl $E10000 MEND MACRO &lab _InstallCDA &lab ldx #$0F05 jsl $E10000 MEND MACRO &lab _InstallNDA &lab ldx #$0E05 jsl $E10000 MEND MACRO &lab _OpenNDA &lab ldx #$1505 jsl $E10000 MEND MACRO &lab _RestAll &lab ldx #$0C05 jsl $E10000 MEND MACRO &lab _RestScrn &lab ldx #$0A05 jsl $E10000 MEND MACRO &lab _SaveAll &lab ldx #$0B05 jsl $E10000 MEND MACRO &lab _SaveScrn &lab ldx #$0905 jsl $E10000 MEND MACRO &lab _SetDAStrPtr &lab ldx #$1305 jsl $E10000 MEND MACRO &lab _SystemClick &lab ldx #$1705 jsl $E10000 MEND MACRO &lab _SystemEdit &lab ldx #$1805 jsl $E10000 MEND MACRO &lab _SystemEvent &lab ldx #$1A05 jsl $E10000 MEND MACRO &lab _SystemTask &lab ldx #$1905 jsl $E10000 MEND MACRO &lab _DialogBootInit &lab ldx #$0115 jsl $E10000 MEND MACRO &lab _DialogStartUp &lab ldx #$0215 jsl $E10000 MEND MACRO &lab _DialogShutDown &lab ldx #$0315 jsl $E10000 MEND MACRO &lab _DialogVersion &lab ldx #$0415 jsl $E10000 MEND MACRO &lab _DialogReset &lab ldx #$0515 jsl $E10000 MEND MACRO &lab _DialogStatus &lab ldx #$0615 jsl $E10000 MEND MACRO &lab _Alert &lab ldx #$1715 jsl $E10000 MEND MACRO &lab _CautionAlert &lab ldx #$1A15 jsl $E10000 MEND MACRO &lab _CloseDialog &lab ldx #$0C15 jsl $E10000 MEND MACRO &lab _DefaultFilter &lab ldx #$3615 jsl $E10000 MEND MACRO &lab _DialogSelect &lab ldx #$1115 jsl $E10000 MEND MACRO &lab _DisableDItem &lab ldx #$3915 jsl $E10000 MEND MACRO &lab _DlgCopy &lab ldx #$1315 jsl $E10000 MEND MACRO &lab _DlgCut &lab ldx #$1215 jsl $E10000 MEND MACRO &lab _DlgDelete &lab ldx #$1515 jsl $E10000 MEND MACRO &lab _DlgPaste &lab ldx #$1415 jsl $E10000 MEND MACRO &lab _DrawDialog &lab ldx #$1615 jsl $E10000 MEND MACRO &lab _EnableDItem &lab ldx #$3A15 jsl $E10000 MEND MACRO &lab _ErrorSound &lab ldx #$0915 jsl $E10000 MEND MACRO &lab _FindDItem &lab ldx #$2415 jsl $E10000 MEND MACRO &lab _GetAlertStage &lab ldx #$3415 jsl $E10000 MEND MACRO &lab _GetControlDItem &lab ldx #$1E15 jsl $E10000 MEND MACRO &lab _GetDefButton &lab ldx #$3715 jsl $E10000 MEND MACRO &lab _GetDItemBox &lab ldx #$2815 jsl $E10000 MEND MACRO &lab _GetDItemType &lab ldx #$2615 jsl $E10000 MEND MACRO &lab _GetDItemValue &lab ldx #$2E15 jsl $E10000 MEND MACRO &lab _GetFirstDItem &lab ldx #$2A15 jsl $E10000 MEND MACRO &lab _GetIText &lab ldx #$1F15 jsl $E10000 MEND MACRO &lab _GetNewDItem &lab ldx #$3315 jsl $E10000 MEND MACRO &lab _GetNewModalDialog &lab ldx #$3215 jsl $E10000 MEND MACRO &lab _GetNextDItem &lab ldx #$2B15 jsl $E10000 MEND MACRO &lab _HideDItem &lab ldx #$2215 jsl $E10000 MEND MACRO &lab _IsDialogEvent &lab ldx #$1015 jsl $E10000 MEND MACRO &lab _ModalDialog &lab ldx #$0F15 jsl $E10000 MEND MACRO &lab _ModalDialog2 &lab ldx #$2C15 jsl $E10000 MEND MACRO &lab _NewDItem &lab ldx #$0D15 jsl $E10000 MEND MACRO &lab _NewModalDialog &lab ldx #$0A15 jsl $E10000 MEND MACRO &lab _NewModelessDialog &lab ldx #$0B15 jsl $E10000 MEND MACRO &lab _NoteAlert &lab ldx #$1915 jsl $E10000 MEND MACRO &lab _ParamText &lab ldx #$1B15 jsl $E10000 MEND MACRO &lab _RemoveDItem &lab ldx #$0E15 jsl $E10000 MEND MACRO &lab _ResetAlertStage &lab ldx #$3515 jsl $E10000 MEND MACRO &lab _SelectIText &lab ldx #$2115 jsl $E10000 MEND MACRO &lab _SelIText &lab ldx #$2115 jsl $E10000 MEND MACRO &lab _SetDAFont &lab ldx #$1C15 jsl $E10000 MEND MACRO &lab _SetDefButton &lab ldx #$3815 jsl $E10000 MEND MACRO &lab _SetDItemBox &lab ldx #$2915 jsl $E10000 MEND MACRO &lab _SetDItemType &lab ldx #$2715 jsl $E10000 MEND MACRO &lab _SetDItemValue &lab ldx #$2F15 jsl $E10000 MEND MACRO &lab _SetIText &lab ldx #$2015 jsl $E10000 MEND MACRO &lab _ShowDItem &lab ldx #$2315 jsl $E10000 MEND MACRO &lab _StopAlert &lab ldx #$1815 jsl $E10000 MEND MACRO &lab _UpdateDialog &lab ldx #$2515 jsl $E10000 MEND ; File: M16.Event ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _EMBootInit &lab ldx #$0106 jsl $E10000 MEND MACRO &lab _EMStartUp &lab ldx #$0206 jsl $E10000 MEND MACRO &lab _EMShutDown &lab ldx #$0306 jsl $E10000 MEND MACRO &lab _EMVersion &lab ldx #$0406 jsl $E10000 MEND MACRO &lab _EMReset &lab ldx #$0506 jsl $E10000 MEND MACRO &lab _EMStatus &lab ldx #$0606 jsl $E10000 MEND MACRO &lab _Button &lab ldx #$0D06 jsl $E10000 MEND MACRO &lab _DoWindows &lab ldx #$0906 jsl $E10000 MEND MACRO &lab _EventAvail &lab ldx #$0B06 jsl $E10000 MEND MACRO &lab _FakeMouse &lab ldx #$1906 jsl $E10000 MEND MACRO &lab _FlushEvents &lab ldx #$1506 jsl $E10000 MEND MACRO &lab _GetCaretTime &lab ldx #$1206 jsl $E10000 MEND MACRO &lab _GetDblTime &lab ldx #$1106 jsl $E10000 MEND MACRO &lab _GetMouse &lab ldx #$0C06 jsl $E10000 MEND MACRO &lab _GetNextEvent &lab ldx #$0A06 jsl $E10000 MEND MACRO &lab _GetOSEvent &lab ldx #$1606 jsl $E10000 MEND MACRO &lab _OSEventAvail &lab ldx #$1706 jsl $E10000 MEND MACRO &lab _PostEvent &lab ldx #$1406 jsl $E10000 MEND MACRO &lab _SetEventMask &lab ldx #$1806 jsl $E10000 MEND MACRO &lab _SetSwitch &lab ldx #$1306 jsl $E10000 MEND MACRO &lab _StillDown &lab ldx #$0E06 jsl $E10000 MEND MACRO &lab _TickCount &lab ldx #$1006 jsl $E10000 MEND MACRO &lab _WaitMouseUp &lab ldx #$0F06 jsl $E10000 MEND ; File: M16.Font ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; ; MACRO &lab _FMBootInit &lab ldx #$011B jsl $E10000 MEND MACRO &lab _FMStartUp &lab ldx #$021B jsl $E10000 MEND MACRO &lab _FMShutDown &lab ldx #$031B jsl $E10000 MEND MACRO &lab _FMVersion &lab ldx #$041B jsl $E10000 MEND MACRO &lab _FMReset &lab ldx #$051B jsl $E10000 MEND MACRO &lab _FMStatus &lab ldx #$061B jsl $E10000 MEND MACRO &lab _AddFamily &lab ldx #$0D1B jsl $E10000 MEND MACRO &lab _AddFontVar &lab ldx #$141B jsl $E10000 MEND MACRO &lab _ChooseFont &lab ldx #$161B jsl $E10000 MEND MACRO &lab _CountFamilies &lab ldx #$091B jsl $E10000 MEND MACRO &lab _CountFonts &lab ldx #$101B jsl $E10000 MEND MACRO &lab _FamNum2ItemID &lab ldx #$1B1B jsl $E10000 MEND MACRO &lab _FindFamily &lab ldx #$0A1B jsl $E10000 MEND MACRO &lab _FindFontStats &lab ldx #$111B jsl $E10000 MEND MACRO &lab _FixFontMenu &lab ldx #$151B jsl $E10000 MEND MACRO &lab _FMGetCurFID &lab ldx #$1A1B jsl $E10000 MEND MACRO &lab _FMGetSysFID &lab ldx #$191B jsl $E10000 MEND MACRO &lab _FMSetSysFont &lab ldx #$181B jsl $E10000 MEND MACRO &lab _GetFamInfo &lab ldx #$0B1B jsl $E10000 MEND MACRO &lab _GetFamNum &lab ldx #$0C1B jsl $E10000 MEND MACRO &lab _InstallFont &lab ldx #$0E1B jsl $E10000 MEND MACRO &lab _InstallWithStats &lab ldx #$1C1B jsl $E10000 MEND MACRO &lab _ItemID2FamNum &lab ldx #$171B jsl $E10000 MEND MACRO &lab _LoadFont &lab ldx #$121B jsl $E10000 MEND MACRO &lab _LoadSysFont &lab ldx #$131B jsl $E10000 MEND MACRO &lab _SetPurgeStat &lab ldx #$0F1B jsl $E10000 MEND ; File: M16.IntMath ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _IMBootInit &lab ldx #$010B jsl $E10000 MEND MACRO &lab _IMStartUp &lab ldx #$020B jsl $E10000 MEND MACRO &lab _IMShutDown &lab ldx #$030B jsl $E10000 MEND MACRO &lab _IMVersion &lab ldx #$040B jsl $E10000 MEND MACRO &lab _IMReset &lab ldx #$050B jsl $E10000 MEND MACRO &lab _IMStatus &lab ldx #$060B jsl $E10000 MEND MACRO &lab _Dec2Int &lab ldx #$280B jsl $E10000 MEND MACRO &lab _Dec2Long &lab ldx #$290B jsl $E10000 MEND MACRO &lab _Fix2Frac &lab ldx #$1C0B jsl $E10000 MEND MACRO &lab _Fix2Long &lab ldx #$1B0B jsl $E10000 MEND MACRO &lab _Fix2X &lab ldx #$1E0B jsl $E10000 MEND MACRO &lab _FixATan2 &lab ldx #$170B jsl $E10000 MEND MACRO &lab _FixDiv &lab ldx #$110B jsl $E10000 MEND MACRO &lab _FixMul &lab ldx #$0F0B jsl $E10000 MEND MACRO &lab _FixRatio &lab ldx #$0E0B jsl $E10000 MEND MACRO &lab _FixRound &lab ldx #$130B jsl $E10000 MEND MACRO &lab _Frac2Fix &lab ldx #$1D0B jsl $E10000 MEND MACRO &lab _Frac2X &lab ldx #$1F0B jsl $E10000 MEND MACRO &lab _FracCos &lab ldx #$150B jsl $E10000 MEND MACRO &lab _FracDiv &lab ldx #$120B jsl $E10000 MEND MACRO &lab _FracMul &lab ldx #$100B jsl $E10000 MEND MACRO &lab _FracSin &lab ldx #$160B jsl $E10000 MEND MACRO &lab _FracSqrt &lab ldx #$140B jsl $E10000 MEND MACRO &lab _Hex2Int &lab ldx #$240B jsl $E10000 MEND MACRO &lab _Hex2Long &lab ldx #$250B jsl $E10000 MEND MACRO &lab _HexIt &lab ldx #$2A0B jsl $E10000 MEND MACRO &lab _HiWord &lab ldx #$180B jsl $E10000 MEND MACRO &lab _Int2Dec &lab ldx #$260B jsl $E10000 MEND MACRO &lab _Int2Hex &lab ldx #$220B jsl $E10000 MEND MACRO &lab _Long2Dec &lab ldx #$270B jsl $E10000 MEND MACRO &lab _Long2Fix &lab ldx #$1A0B jsl $E10000 MEND MACRO &lab _Long2Hex &lab ldx #$230B jsl $E10000 MEND MACRO &lab _LongDivide &lab ldx #$0D0B jsl $E10000 MEND MACRO &lab _LongMul &lab ldx #$0C0B jsl $E10000 MEND MACRO &lab _LoWord &lab ldx #$190B jsl $E10000 MEND MACRO &lab _Multiply &lab ldx #$090B jsl $E10000 MEND MACRO &lab _SDivide &lab ldx #$0A0B jsl $E10000 MEND MACRO &lab _UDivide &lab ldx #$0B0B jsl $E10000 MEND MACRO &lab _X2Fix &lab ldx #$200B jsl $E10000 MEND MACRO &lab _X2Frac &lab ldx #$210B jsl $E10000 MEND ; File: M16.lineEdit ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _LEBootInit &lab ldx #$0114 jsl $E10000 MEND MACRO &lab _LEStartUp &lab ldx #$0214 jsl $E10000 MEND MACRO &lab _LEShutDown &lab ldx #$0314 jsl $E10000 MEND MACRO &lab _LEVersion &lab ldx #$0414 jsl $E10000 MEND MACRO &lab _LEReset &lab ldx #$0514 jsl $E10000 MEND MACRO &lab _LEStatus &lab ldx #$0614 jsl $E10000 MEND MACRO &lab _LEActivate &lab ldx #$0F14 jsl $E10000 MEND MACRO &lab _LEClick &lab ldx #$0D14 jsl $E10000 MEND MACRO &lab _LECopy &lab ldx #$1314 jsl $E10000 MEND MACRO &lab _LECut &lab ldx #$1214 jsl $E10000 MEND MACRO &lab _LEDeactivate &lab ldx #$1014 jsl $E10000 MEND MACRO &lab _LEDelete &lab ldx #$1514 jsl $E10000 MEND MACRO &lab _LEDispose &lab ldx #$0A14 jsl $E10000 MEND MACRO &lab _LEFromScrap &lab ldx #$1914 jsl $E10000 MEND MACRO &lab _LEGetScrapLen &lab ldx #$1C14 jsl $E10000 MEND MACRO &lab _LEGetTextHand &lab ldx #$2214 jsl $E10000 MEND MACRO &lab _LEGetTextLen &lab ldx #$2314 jsl $E10000 MEND MACRO &lab _LEIdle &lab ldx #$0C14 jsl $E10000 MEND MACRO &lab _LEInsert &lab ldx #$1614 jsl $E10000 MEND MACRO &lab _LEKey &lab ldx #$1114 jsl $E10000 MEND MACRO &lab _LENew &lab ldx #$0914 jsl $E10000 MEND MACRO &lab _LEPaste &lab ldx #$1414 jsl $E10000 MEND MACRO &lab _LEScrapHandle &lab ldx #$1B14 jsl $E10000 MEND MACRO &lab _LESetCaret &lab ldx #$1F14 jsl $E10000 MEND MACRO &lab _LESetHilite &lab ldx #$1E14 jsl $E10000 MEND MACRO &lab _LESetJust &lab ldx #$2114 jsl $E10000 MEND MACRO &lab _LESetScrapLen &lab ldx #$1D14 jsl $E10000 MEND MACRO &lab _LESetSelect &lab ldx #$0E14 jsl $E10000 MEND MACRO &lab _LESetText &lab ldx #$0B14 jsl $E10000 MEND MACRO &lab _LETextBox &lab ldx #$1814 jsl $E10000 MEND MACRO &lab _LETextBox2 &lab ldx #$2014 jsl $E10000 MEND MACRO &lab _LEToScrap &lab ldx #$1A14 jsl $E10000 MEND MACRO &lab _LEUpdate &lab ldx #$1714 jsl $E10000 MEND ; File: M16.List ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _ListBootInit &lab ldx #$011C jsl $E10000 MEND MACRO &lab _ListStartup &lab ldx #$021C jsl $E10000 MEND MACRO &lab _ListShutDown &lab ldx #$031C jsl $E10000 MEND MACRO &lab _ListVersion &lab ldx #$041C jsl $E10000 MEND MACRO &lab _ListReset &lab ldx #$051C jsl $E10000 MEND MACRO &lab _ListStatus &lab ldx #$061C jsl $E10000 MEND MACRO &lab _CreateList &lab ldx #$091C jsl $E10000 MEND MACRO &lab _DrawMember &lab ldx #$0C1C jsl $E10000 MEND MACRO &lab _GetListDefProc &lab ldx #$0E1C jsl $E10000 MEND MACRO &lab _NewList &lab ldx #$101C jsl $E10000 MEND MACRO &lab _NextMember &lab ldx #$0B1C jsl $E10000 MEND MACRO &lab _ResetMember &lab ldx #$0F1C jsl $E10000 MEND MACRO &lab _SelectMember &lab ldx #$0D1C jsl $E10000 MEND MACRO &lab _SortList &lab ldx #$0A1C jsl $E10000 MEND ; File: M16.Loader ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; MACRO &lab _LoaderInitialization &lab ldx #$0111 jsl $E10000 MEND MACRO &lab _LoaderInit &lab ldx #$0111 jsl $E10000 MEND MACRO &lab _LoaderStartUp &lab ldx #$0211 jsl $E10000 MEND MACRO &lab _LoaderShutDown &lab ldx #$0311 jsl $E10000 MEND MACRO &lab _LoaderVersion &lab ldx #$0411 jsl $E10000 MEND MACRO &lab _LoaderReset &lab ldx #$0511 jsl $E10000 MEND MACRO &lab _LoaderStatus &lab ldx #$0611 jsl $E10000 MEND MACRO &lab _GetLoadSegInfo &lab ldx #$0F11 jsl $E10000 MEND MACRO &lab _GetPathname &lab ldx #$1111 jsl $E10000 MEND MACRO &lab _GetUserID &lab ldx #$1011 jsl $E10000 MEND MACRO &lab _InitialLoad &lab ldx #$0911 jsl $E10000 MEND MACRO &lab _LGetPathname &lab ldx #$1111 jsl $E10000 MEND MACRO &lab _LoadSegName &lab ldx #$0D11 jsl $E10000 MEND MACRO &lab _LoadSegNum &lab ldx #$0B11 jsl $E10000 MEND MACRO &lab _Restart &lab ldx #$0A11 jsl $E10000 MEND MACRO &lab _UnloadSeg &lab ldx #$0E11 jsl $E10000 MEND MACRO &lab _UnloadSegNum &lab ldx #$0C11 jsl $E10000 MEND MACRO &lab _UserShutDown &lab ldx #$1211 jsl $E10000 MEND ; File: M16.Locator ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; MACRO &lab _TLBootInit &lab ldx #$0101 jsl $E10000 MEND MACRO &lab _TLStartUp &lab ldx #$0201 jsl $E10000 MEND MACRO &lab _TLShutDown &lab ldx #$0301 jsl $E10000 MEND MACRO &lab _TLVersion &lab ldx #$0401 jsl $E10000 MEND MACRO &lab _TLReset &lab ldx #$0501 jsl $E10000 MEND MACRO &lab _TLStatus &lab ldx #$0601 jsl $E10000 MEND MACRO &lab _GetFuncPtr &lab ldx #$0B01 jsl $E10000 MEND MACRO &lab _GetTSPtr &lab ldx #$0901 jsl $E10000 MEND MACRO &lab _GetWAP &lab ldx #$0C01 jsl $E10000 MEND MACRO &lab _LoadOneTool &lab ldx #$0F01 jsl $E10000 MEND MACRO &lab _LoadTools &lab ldx #$0E01 jsl $E10000 MEND MACRO &lab _MessageCenter &lab ldx #$1501 jsl $E10000 MEND MACRO &lab _RestoreTextState &lab ldx #$1401 jsl $E10000 MEND MACRO &lab _SaveTextState &lab ldx #$1301 jsl $E10000 MEND MACRO &lab _SetDefaultTPT &lab ldx #$1601 jsl $E10000 MEND MACRO &lab _SetTSPtr &lab ldx #$0A01 jsl $E10000 MEND MACRO &lab _SetWAP &lab ldx #$0D01 jsl $E10000 MEND MACRO &lab _TLMountVolume &lab ldx #$1101 jsl $E10000 MEND MACRO &lab _TLTextMountVolume &lab ldx #$1201 jsl $E10000 MEND MACRO &lab _UnloadOneTool &lab ldx #$1001 jsl $E10000 MEND ; File: M16.Memory ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; ; MACRO &lab _MMBootInit &lab ldx #$0102 jsl $E10000 MEND MACRO &lab _MMStartUp &lab ldx #$0202 jsl $E10000 MEND MACRO &lab _MMShutDown &lab ldx #$0302 jsl $E10000 MEND MACRO &lab _MMVersion &lab ldx #$0402 jsl $E10000 MEND MACRO &lab _MMReset &lab ldx #$0502 jsl $E10000 MEND MACRO &lab _MMStatus &lab ldx #$0602 jsl $E10000 MEND MACRO &lab _BlockMove &lab ldx #$2B02 jsl $E10000 MEND MACRO &lab _CheckHandle &lab ldx #$1E02 jsl $E10000 MEND MACRO &lab _CompactMem &lab ldx #$1F02 jsl $E10000 MEND MACRO &lab _DisposeAll &lab ldx #$1102 jsl $E10000 MEND MACRO &lab _DisposeHandle &lab ldx #$1002 jsl $E10000 MEND MACRO &lab _FindHandle &lab ldx #$1A02 jsl $E10000 MEND MACRO &lab _FreeMem &lab ldx #$1B02 jsl $E10000 MEND MACRO &lab _GetHandleSize &lab ldx #$1802 jsl $E10000 MEND MACRO &lab _HandToHand &lab ldx #$2A02 jsl $E10000 MEND MACRO &lab _HandToPtr &lab ldx #$2902 jsl $E10000 MEND MACRO &lab _HLock &lab ldx #$2002 jsl $E10000 MEND MACRO &lab _HLockAll &lab ldx #$2102 jsl $E10000 MEND MACRO &lab _HUnlock &lab ldx #$2202 jsl $E10000 MEND MACRO &lab _HUnlockAll &lab ldx #$2302 jsl $E10000 MEND MACRO &lab _MaxBlock &lab ldx #$1C02 jsl $E10000 MEND MACRO &lab _NewHandle &lab ldx #$0902 jsl $E10000 MEND MACRO &lab _PtrToHand &lab ldx #$2802 jsl $E10000 MEND MACRO &lab _PurgeAll &lab ldx #$1302 jsl $E10000 MEND MACRO &lab _PurgeHandle &lab ldx #$1202 jsl $E10000 MEND MACRO &lab _RealFreeMem &lab ldx #$2F02 jsl $E10000 MEND MACRO &lab _ReallocHandle &lab ldx #$0A02 jsl $E10000 MEND MACRO &lab _RestoreHandle &lab ldx #$0B02 jsl $E10000 MEND MACRO &lab _SetHandleSize &lab ldx #$1902 jsl $E10000 MEND MACRO &lab _SetPurge &lab ldx #$2402 jsl $E10000 MEND MACRO &lab _SetPurgeAll &lab ldx #$2502 jsl $E10000 MEND MACRO &lab _TotalMem &lab ldx #$1D02 jsl $E10000 MEND ; File: M16.Menu ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _MenuBootInit &lab ldx #$010F jsl $E10000 MEND MACRO &lab _MenuStartUp &lab ldx #$020F jsl $E10000 MEND MACRO &lab _MenuShutDown &lab ldx #$030F jsl $E10000 MEND MACRO &lab _MenuVersion &lab ldx #$040F jsl $E10000 MEND MACRO &lab _MenuReset &lab ldx #$050F jsl $E10000 MEND MACRO &lab _MenuStatus &lab ldx #$060F jsl $E10000 MEND MACRO &lab _CalcMenuSize &lab ldx #$1C0F jsl $E10000 MEND MACRO &lab _CheckMItem &lab ldx #$320F jsl $E10000 MEND MACRO &lab _CountMItems &lab ldx #$140F jsl $E10000 MEND MACRO &lab _DeleteMenu &lab ldx #$0E0F jsl $E10000 MEND MACRO &lab _DeleteMItem &lab ldx #$100F jsl $E10000 MEND MACRO &lab _DisableMItem &lab ldx #$310F jsl $E10000 MEND MACRO &lab _DisposeMenu &lab ldx #$2E0F jsl $E10000 MEND MACRO &lab _DrawMenuBar &lab ldx #$2A0F jsl $E10000 MEND MACRO &lab _EnableMItem &lab ldx #$300F jsl $E10000 MEND MACRO &lab _FixMenuBar &lab ldx #$130F jsl $E10000 MEND MACRO &lab _FlashMenuBar &lab ldx #$0C0F jsl $E10000 MEND MACRO &lab _GetBarColors &lab ldx #$180F jsl $E10000 MEND MACRO &lab _GetMenuBar &lab ldx #$0A0F jsl $E10000 MEND MACRO &lab _GetMenuFlag &lab ldx #$200F jsl $E10000 MEND MACRO &lab _GetMenuMgrPort &lab ldx #$1B0F jsl $E10000 MEND MACRO &lab _GetMenuTitle &lab ldx #$220F jsl $E10000 MEND MACRO &lab _GetMHandle &lab ldx #$160F jsl $E10000 MEND MACRO &lab _GetMItem &lab ldx #$250F jsl $E10000 MEND MACRO &lab _GetMItemFlag &lab ldx #$270F jsl $E10000 MEND MACRO &lab _GetMItemMark &lab ldx #$340F jsl $E10000 MEND MACRO &lab _GetMItemStyle &lab ldx #$360F jsl $E10000 MEND MACRO &lab _GetMTitleStart &lab ldx #$1A0F jsl $E10000 MEND MACRO &lab _GetMTitleWidth &lab ldx #$1E0F jsl $E10000 MEND MACRO &lab _GetSysBar &lab ldx #$110F jsl $E10000 MEND MACRO &lab _HiliteMenu &lab ldx #$2C0F jsl $E10000 MEND MACRO &lab _InitPalette &lab ldx #$2F0F jsl $E10000 MEND MACRO &lab _InsertMenu &lab ldx #$0D0F jsl $E10000 MEND MACRO &lab _InsertMItem &lab ldx #$0F0F jsl $E10000 MEND MACRO &lab _MenuGlobal &lab ldx #$230F jsl $E10000 MEND MACRO &lab _MenuKey &lab ldx #$090F jsl $E10000 MEND MACRO &lab _MenuNewRes &lab ldx #$290F jsl $E10000 MEND MACRO &lab _MenuRefresh &lab ldx #$0B0F jsl $E10000 MEND MACRO &lab _MenuSelect &lab ldx #$2B0F jsl $E10000 MEND MACRO &lab _NewMenu &lab ldx #$2D0F jsl $E10000 MEND MACRO &lab _NewMenuBar &lab ldx #$150F jsl $E10000 MEND MACRO &lab _SetBarColors &lab ldx #$170F jsl $E10000 MEND MACRO &lab _SetMenuBar &lab ldx #$390F jsl $E10000 MEND MACRO &lab _SetMenuFlag &lab ldx #$1F0F jsl $E10000 MEND MACRO &lab _SetMenuID &lab ldx #$370F jsl $E10000 MEND MACRO &lab _SetMenuTitle &lab ldx #$210F jsl $E10000 MEND MACRO &lab _SetMItem &lab ldx #$240F jsl $E10000 MEND MACRO &lab _SetMItemBlink &lab ldx #$280F jsl $E10000 MEND MACRO &lab _SetMItemFlag &lab ldx #$260F jsl $E10000 MEND MACRO &lab _SetMItemID &lab ldx #$380F jsl $E10000 MEND MACRO &lab _SetMItemMark &lab ldx #$330F jsl $E10000 MEND MACRO &lab _SetMItemName &lab ldx #$3A0F jsl $E10000 MEND MACRO &lab _SetMItemStyle &lab ldx #$350F jsl $E10000 MEND MACRO &lab _SetMTitleStart &lab ldx #$190F jsl $E10000 MEND MACRO &lab _SetMTitleWidth &lab ldx #$1D0F jsl $E10000 MEND MACRO &lab _SetSysBar &lab ldx #$120F jsl $E10000 MEND ; File: M16.Midi ; ; ; Copyright Apple computer, Inc. 1988 ; All Rights Reserved ; ; MACRO &lab _MidiBootInit &lab ldx #$0120 jsl $E10000 MEND MACRO &lab _MidiStartUp &lab ldx #$0220 jsl $E10000 MEND MACRO &lab _MidiShutDown &lab ldx #$0320 jsl $E10000 MEND MACRO &lab _MidiVersion &lab ldx #$0420 jsl $E10000 MEND MACRO &lab _MidiReset &lab ldx #$0520 jsl $E10000 MEND MACRO &lab _MidiStatus &lab ldx #$0620 jsl $E10000 MEND MACRO &lab _MidiClock &lab ldx #$0B20 jsl $E10000 MEND MACRO &lab _MidiControl &lab ldx #$0920 jsl $E10000 MEND MACRO &lab _MidiDevice &lab ldx #$0A20 jsl $E10000 MEND MACRO &lab _MidiInfo &lab ldx #$0C20 jsl $E10000 MEND MACRO &lab _MidiInputPoll &lab jsl $E11DD8 MEND MACRO &lab _MidiReadPacket &lab ldx #$0D20 jsl $E10000 MEND MACRO &lab _MidiWritePacket &lab ldx #$0E20 jsl $E10000 MEND ; File: M16.MiscTool ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _MTBootInit &lab ldx #$0103 jsl $E10000 MEND MACRO &lab _MTStartUp &lab ldx #$0203 jsl $E10000 MEND MACRO &lab _MTShutDown &lab ldx #$0303 jsl $E10000 MEND MACRO &lab _MTVersion &lab ldx #$0403 jsl $E10000 MEND MACRO &lab _MTReset &lab ldx #$0503 jsl $E10000 MEND MACRO &lab _MTStatus &lab ldx #$0603 jsl $E10000 MEND MACRO &lab _ClampMouse &lab ldx #$1C03 jsl $E10000 MEND MACRO &lab _ClearMouse &lab ldx #$1B03 jsl $E10000 MEND MACRO &lab _ClrHeartBeat &lab ldx #$1403 jsl $E10000 MEND MACRO &lab _DeleteID &lab ldx #$2103 jsl $E10000 MEND MACRO &lab _DelHeartBeat &lab ldx #$1303 jsl $E10000 MEND MACRO &lab _FWEntry &lab ldx #$2403 jsl $E10000 MEND MACRO &lab _GetAbsClamp &lab ldx #$2B03 jsl $E10000 MEND MACRO &lab _GetAddr &lab ldx #$1603 jsl $E10000 MEND MACRO &lab _GetIRQEnable &lab ldx #$2903 jsl $E10000 MEND MACRO &lab _GetMouseClamp &lab ldx #$1D03 jsl $E10000 MEND MACRO &lab _GetNewID &lab ldx #$2003 jsl $E10000 MEND MACRO &lab _GetTick &lab ldx #$2503 jsl $E10000 MEND MACRO &lab _GetVector &lab ldx #$1103 jsl $E10000 MEND MACRO &lab _HomeMouse &lab ldx #$1A03 jsl $E10000 MEND MACRO &lab _InitMouse &lab ldx #$1803 jsl $E10000 MEND MACRO &lab _IntSource &lab ldx #$2303 jsl $E10000 MEND MACRO &lab _Munger &lab ldx #$2803 jsl $E10000 MEND MACRO &lab _PackBytes &lab ldx #$2603 jsl $E10000 MEND MACRO &lab _PosMouse &lab ldx #$1E03 jsl $E10000 MEND MACRO &lab _ReadAsciiTime &lab ldx #$0F03 jsl $E10000 MEND MACRO &lab _ReadBParam &lab ldx #$0C03 jsl $E10000 MEND MACRO &lab _ReadBRam &lab ldx #$0A03 jsl $E10000 MEND MACRO &lab _ReadMouse &lab ldx #$1703 jsl $E10000 MEND MACRO &lab _ReadTimeHex &lab ldx #$0D03 jsl $E10000 MEND MACRO &lab _ServeMouse &lab ldx #$1F03 jsl $E10000 MEND MACRO &lab _SetAbsClamp &lab ldx #$2A03 jsl $E10000 MEND MACRO &lab _SetHeartBeat &lab ldx #$1203 jsl $E10000 MEND MACRO &lab _SetMouse &lab ldx #$1903 jsl $E10000 MEND MACRO &lab _SetVector &lab ldx #$1003 jsl $E10000 MEND MACRO &lab _StatusID &lab ldx #$2203 jsl $E10000 MEND MACRO &lab _SysBeep &lab ldx #$2C03 jsl $E10000 MEND MACRO &lab _SysFailMgr &lab ldx #$1503 jsl $E10000 MEND MACRO &lab _UnPackBytes &lab ldx #$2703 jsl $E10000 MEND MACRO &lab _WriteBParam &lab ldx #$0B03 jsl $E10000 MEND MACRO &lab _WriteBRam &lab ldx #$0903 jsl $E10000 MEND MACRO &lab _WriteTimeHex &lab ldx #$0E03 jsl $E10000 MEND ; File: M16.noteseq ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; MACRO &lab _SeqBootInit &lab ldx #$011A jsl $E10000 MEND MACRO &lab _SeqStartUp &lab ldx #$021A jsl $E10000 MEND MACRO &lab _SeqShutDown &lab ldx #$031A jsl $E10000 MEND MACRO &lab _SeqVersion &lab ldx #$041A jsl $E10000 MEND MACRO &lab _SeqReset &lab ldx #$051A jsl $E10000 MEND MACRO &lab _SeqStatus &lab ldx #$061A jsl $E10000 MEND MACRO &lab _ClearIncr &lab ldx #$0A1A jsl $E10000 MEND MACRO &lab _GetLoc &lab ldx #$0C1A jsl $E10000 MEND MACRO &lab _GetTimer &lab ldx #$0B1A jsl $E10000 MEND MACRO &lab _SeqAllNotesOff &lab ldx #$0D1A jsl $E10000 MEND MACRO &lab _SetIncr &lab ldx #$091A jsl $E10000 MEND MACRO &lab _SetInstTable &lab ldx #$121A jsl $E10000 MEND MACRO &lab _SetTrkInfo &lab ldx #$0E1A jsl $E10000 MEND MACRO &lab _StartInts &lab ldx #$131A jsl $E10000 MEND MACRO &lab _StartSeq &lab ldx #$0F1A jsl $E10000 MEND MACRO &lab _StepSeq &lab ldx #$101A jsl $E10000 MEND MACRO &lab _StopInts &lab ldx #$141A jsl $E10000 MEND MACRO &lab _StopSeq &lab ldx #$111A jsl $E10000 MEND ; File: M16.NoteSyn ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; ; MACRO &lab _NSBootInit &lab ldx #$0119 jsl $E10000 MEND MACRO &lab _NSStartUp &lab ldx #$0219 jsl $E10000 MEND MACRO &lab _NSShutDown &lab ldx #$0319 jsl $E10000 MEND MACRO &lab _NSVersion &lab ldx #$0419 jsl $E10000 MEND MACRO &lab _NSReset &lab ldx #$0519 jsl $E10000 MEND MACRO &lab _NSStatus &lab ldx #$0619 jsl $E10000 MEND MACRO &lab _AllocGen &lab ldx #$0919 jsl $E10000 MEND MACRO &lab _DeallocGen &lab ldx #$0A19 jsl $E10000 MEND MACRO &lab _NoteOn &lab ldx #$0B19 jsl $E10000 MEND MACRO &lab _NoteOff &lab ldx #$0C19 jsl $E10000 MEND MACRO &lab _AllNotesOff &lab ldx #$0D19 jsl $E10000 MEND MACRO &lab _NSSetUpdateRate &lab ldx #$0E19 jsl $E10000 MEND MACRO &lab _NSSetUserUpdateRtn &lab ldx #$0F19 jsl $E10000 MEND ; File: M16.Print ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; ; MACRO &lab _PMBootInit &lab ldx #$0113 jsl $E10000 MEND MACRO &lab _PMStartUp &lab ldx #$0213 jsl $E10000 MEND MACRO &lab _PMShutDown &lab ldx #$0313 jsl $E10000 MEND MACRO &lab _PMVersion &lab ldx #$0413 jsl $E10000 MEND MACRO &lab _PMReset &lab ldx #$0513 jsl $E10000 MEND MACRO &lab _PMStatus &lab ldx #$0613 jsl $E10000 MEND MACRO &lab _LLDBitMap &lab ldx #$1C13 jsl $E10000 MEND MACRO &lab _LLDControl &lab ldx #$1B13 jsl $E10000 MEND MACRO &lab _LLDShutDown &lab ldx #$1A13 jsl $E10000 MEND MACRO &lab _LLDStartUp &lab ldx #$1913 jsl $E10000 MEND MACRO &lab _LLDText &lab ldx #$1D13 jsl $E10000 MEND MACRO &lab _PMLoadDriver &lab ldx #$3513 jsl $E10000 MEND MACRO &lab _PMUnloadDriver &lab ldx #$3413 jsl $E10000 MEND MACRO &lab _PMGetPortName &lab ldx #$2913 jsl $E10000 MEND MACRO &lab _PrChoosePrinter &lab ldx #$1613 jsl $E10000 MEND MACRO &lab _PrChooser &lab ldx #$1613 jsl $E10000 MEND MACRO &lab _PrCloseDoc &lab ldx #$0F13 jsl $E10000 MEND MACRO &lab _PrClosePage &lab ldx #$1113 jsl $E10000 MEND MACRO &lab _PrDefault &lab ldx #$0913 jsl $E10000 MEND MACRO &lab _PrDriverVer &lab ldx #$2313 jsl $E10000 MEND MACRO &lab _PrError &lab ldx #$1413 jsl $E10000 MEND MACRO &lab _PrJobDialog &lab ldx #$0C13 jsl $E10000 MEND MACRO &lab _PrOpenDoc &lab ldx #$0E13 jsl $E10000 MEND MACRO &lab _PrOpenPage &lab ldx #$1013 jsl $E10000 MEND MACRO &lab _PrPicFile &lab ldx #$1213 jsl $E10000 MEND MACRO &lab _PrPixelMap &lab ldx #$0D13 jsl $E10000 MEND MACRO &lab _PrPortVer &lab ldx #$2413 jsl $E10000 MEND MACRO &lab _PrSetError &lab ldx #$1513 jsl $E10000 MEND MACRO &lab _PrStlDialog &lab ldx #$0B13 jsl $E10000 MEND MACRO &lab _PrValidate &lab ldx #$0A13 jsl $E10000 MEND ; File: M16.ProDos ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; ; MACRO &lab _CREATE ¶ms &lab jsl $E100A8 DC.W 1 DC.L ¶ms MEND MACRO &lab _DESTROY ¶ms &lab jsl $E100A8 DC.W 2 DC.L ¶ms MEND MACRO &lab _CHANGE_PATH ¶ms &lab jsl $E100A8 DC.W 4 DC.L ¶ms MEND MACRO &lab _SET_FILE_INFO ¶ms &lab jsl $E100A8 DC.W 5 DC.L ¶ms MEND MACRO &lab _GET_FILE_INFO ¶ms &lab jsl $E100A8 DC.W 6 DC.L ¶ms MEND MACRO &lab _VOLUME ¶ms &lab jsl $E100A8 DC.W 8 DC.L ¶ms MEND MACRO &lab _SET_PREFIX ¶ms &lab jsl $E100A8 DC.W 9 DC.L ¶ms MEND MACRO &lab _GET_PREFIX ¶ms &lab jsl $E100A8 DC.W $0A DC.L ¶ms MEND MACRO &lab _CLEAR_BACKUP_BIT ¶ms &lab jsl $E100A8 DC.W $0B DC.L ¶ms MEND MACRO &lab _OPEN ¶ms &lab jsl $E100A8 DC.W $10 DC.L ¶ms MEND MACRO &lab _NEWLINE ¶ms &lab jsl $E100A8 DC.W $11 DC.L ¶ms MEND MACRO &lab _READ ¶ms &lab jsl $E100A8 DC.W $12 DC.L ¶ms MEND MACRO &lab _WRITE ¶ms &lab jsl $E100A8 DC.W $13 DC.L ¶ms MEND MACRO &lab _CLOSE ¶ms &lab jsl $E100A8 DC.W $14 DC.L ¶ms MEND MACRO &lab _FLUSH ¶ms &lab jsl $E100A8 DC.W $15 DC.L ¶ms MEND MACRO &lab _SET_MARK ¶ms &lab jsl $E100A8 DC.W $16 DC.L ¶ms MEND MACRO &lab _GET_MARK ¶ms &lab jsl $E100A8 DC.W $17 DC.L ¶ms MEND MACRO &lab _SET_EOF ¶ms &lab jsl $E100A8 DC.W $18 DC.L ¶ms MEND MACRO &lab _GET_EOF ¶ms &lab jsl $E100A8 DC.W $19 DC.L ¶ms MEND MACRO &lab _SET_LEVEL ¶ms &lab jsl $E100A8 DC.W $1A DC.L ¶ms MEND MACRO &lab _GET_LEVEL ¶ms &lab jsl $E100A8 DC.W $1B DC.L ¶ms MEND MACRO &lab _GET_DIR_ENTRY ¶ms &lab jsl $E100A8 DC.W $1C DC.L ¶ms MEND MACRO &lab _GET_DEV_NUM ¶ms &lab jsl $E100A8 DC.W $20 DC.L ¶ms MEND MACRO &lab _GET_LAST_DEV ¶ms &lab jsl $E100A8 DC.W $21 DC.L ¶ms MEND MACRO &lab _READ_BLOCK ¶ms &lab jsl $E100A8 DC.W $22 DC.L ¶ms MEND MACRO &lab _WRITE_BLOCK ¶ms &lab jsl $E100A8 DC.W $23 DC.L ¶ms MEND MACRO &lab _FORMAT ¶ms &lab jsl $E100A8 DC.W $24 DC.L ¶ms MEND MACRO &lab _ERASE_DISK ¶ms &lab jsl $E100A8 DC.W $25 DC.L ¶ms MEND MACRO &lab _GET_NAME ¶ms &lab jsl $E100A8 DC.W $27 DC.L ¶ms MEND MACRO &lab _GET_PATH_NAME ¶ms &lab jsl $E100A8 DC.W $27 DC.L ¶ms MEND MACRO &lab _GET_BOOT_VOL ¶ms &lab jsl $E100A8 DC.W $28 DC.L ¶ms MEND MACRO &lab _QUIT ¶ms &lab jsl $E100A8 DC.W $29 DC.L ¶ms MEND MACRO &lab _GET_VERSION ¶ms &lab jsl $E100A8 DC.W $2A DC.L ¶ms MEND MACRO &lab _D_INFO ¶ms &lab jsl $E100A8 DC.W $2C DC.L ¶ms MEND MACRO &lab _ALLOC_INTERRUPT ¶ms &lab jsl $E100A8 DC.W $31 DC.L ¶ms MEND MACRO &lab _DEALLOC_INTERRUPT ¶ms &lab jsl $E100A8 DC.W $32 DC.L ¶ms MEND ; File: M16.QDAux ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; ; MACRO &lab _QDAuxBootInit &lab ldx #$0112 jsl $E10000 MEND MACRO &lab _QDAuxStartUp &lab ldx #$0212 jsl $E10000 MEND MACRO &lab _QDAuxShutDown &lab ldx #$0312 jsl $E10000 MEND MACRO &lab _QDAuxVersion &lab ldx #$0412 jsl $E10000 MEND MACRO &lab _QDAuxReset &lab ldx #$0512 jsl $E10000 MEND MACRO &lab _QDAuxStatus &lab ldx #$0612 jsl $E10000 MEND MACRO &lab _CopyPixels &lab ldx #$0912 jsl $E10000 MEND MACRO &lab _DrawIcon &lab ldx #$0B12 jsl $E10000 MEND MACRO &lab _SpecialRect &lab ldx #$0C12 jsl $E10000 MEND MACRO &lab _WaitCursor &lab ldx #$0A12 jsl $E10000 MEND ; File: M16.QuickDraw ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _QDBootInit &lab ldx #$0104 jsl $E10000 MEND MACRO &lab _QDStartUp &lab ldx #$0204 jsl $E10000 MEND MACRO &lab _QDShutDown &lab ldx #$0304 jsl $E10000 MEND MACRO &lab _QDVersion &lab ldx #$0404 jsl $E10000 MEND MACRO &lab _QDReset &lab ldx #$0504 jsl $E10000 MEND MACRO &lab _QDStatus &lab ldx #$0604 jsl $E10000 MEND MACRO &lab _AddPt &lab ldx #$8004 jsl $E10000 MEND MACRO &lab _CharBounds &lab ldx #$AC04 jsl $E10000 MEND MACRO &lab _CharWidth &lab ldx #$A804 jsl $E10000 MEND MACRO &lab _ClearScreen &lab ldx #$1504 jsl $E10000 MEND MACRO &lab _ClipRect &lab ldx #$2604 jsl $E10000 MEND MACRO &lab _ClosePicture &lab ldx #$B904 jsl $E10000 MEND MACRO &lab _ClosePoly &lab ldx #$C204 jsl $E10000 MEND MACRO &lab _ClosePort &lab ldx #$1A04 jsl $E10000 MEND MACRO &lab _CloseRgn &lab ldx #$6E04 jsl $E10000 MEND MACRO &lab _CopyRgn &lab ldx #$6904 jsl $E10000 MEND MACRO &lab _CStringBounds &lab ldx #$AE04 jsl $E10000 MEND MACRO &lab _CStringWidth &lab ldx #$AA04 jsl $E10000 MEND MACRO &lab _DiffRgn &lab ldx #$7304 jsl $E10000 MEND MACRO &lab _DisposeRgn &lab ldx #$6804 jsl $E10000 MEND MACRO &lab _DrawChar &lab ldx #$A404 jsl $E10000 MEND MACRO &lab _DrawCString &lab ldx #$A604 jsl $E10000 MEND MACRO &lab _DrawPicture &lab ldx #$BA04 jsl $E10000 MEND MACRO &lab _DrawString &lab ldx #$A504 jsl $E10000 MEND MACRO &lab _DrawText &lab ldx #$A704 jsl $E10000 MEND MACRO &lab _EmptyRect &lab ldx #$5204 jsl $E10000 MEND MACRO &lab _EmptyRgn &lab ldx #$7804 jsl $E10000 MEND MACRO &lab _EqualPt &lab ldx #$8304 jsl $E10000 MEND MACRO &lab _EqualRect &lab ldx #$5104 jsl $E10000 MEND MACRO &lab _EqualRgn &lab ldx #$7704 jsl $E10000 MEND MACRO &lab _EraseArc &lab ldx #$6404 jsl $E10000 MEND MACRO &lab _EraseOval &lab ldx #$5A04 jsl $E10000 MEND MACRO &lab _ErasePoly &lab ldx #$BE04 jsl $E10000 MEND MACRO &lab _EraseRect &lab ldx #$5504 jsl $E10000 MEND MACRO &lab _EraseRgn &lab ldx #$7B04 jsl $E10000 MEND MACRO &lab _EraseRRect &lab ldx #$5F04 jsl $E10000 MEND MACRO &lab _FillArc &lab ldx #$6604 jsl $E10000 MEND MACRO &lab _FillOval &lab ldx #$5C04 jsl $E10000 MEND MACRO &lab _FillPoly &lab ldx #$C004 jsl $E10000 MEND MACRO &lab _FillRect &lab ldx #$5704 jsl $E10000 MEND MACRO &lab _FillRgn &lab ldx #$7D04 jsl $E10000 MEND MACRO &lab _FillRRect &lab ldx #$6104 jsl $E10000 MEND MACRO &lab _ForceBufDims &lab ldx #$CC04 jsl $E10000 MEND MACRO &lab _FrameArc &lab ldx #$6204 jsl $E10000 MEND MACRO &lab _FrameOval &lab ldx #$5804 jsl $E10000 MEND MACRO &lab _FramePoly &lab ldx #$BC04 jsl $E10000 MEND MACRO &lab _FrameRect &lab ldx #$5304 jsl $E10000 MEND MACRO &lab _FrameRgn &lab ldx #$7904 jsl $E10000 MEND MACRO &lab _FrameRRect &lab ldx #$5D04 jsl $E10000 MEND MACRO &lab _GetAddress &lab ldx #$0904 jsl $E10000 MEND MACRO &lab _GetArcRot &lab ldx #$B104 jsl $E10000 MEND MACRO &lab _GetBackColor &lab ldx #$A304 jsl $E10000 MEND MACRO &lab _GetBackPat &lab ldx #$3504 jsl $E10000 MEND MACRO &lab _GetCharExtra &lab ldx #$D504 jsl $E10000 MEND MACRO &lab _GetClip &lab ldx #$2504 jsl $E10000 MEND MACRO &lab _GetClipHandle &lab ldx #$C704 jsl $E10000 MEND MACRO &lab _GetColorEntry &lab ldx #$1104 jsl $E10000 MEND MACRO &lab _GetColorTable &lab ldx #$0F04 jsl $E10000 MEND MACRO &lab _GetCursorAdr &lab ldx #$8F04 jsl $E10000 MEND MACRO &lab _GetFGSize &lab ldx #$CF04 jsl $E10000 MEND MACRO &lab _GetFont &lab ldx #$9504 jsl $E10000 MEND MACRO &lab _GetFontFlags &lab ldx #$9904 jsl $E10000 MEND MACRO &lab _GetFontGlobals &lab ldx #$9704 jsl $E10000 MEND MACRO &lab _GetFontID &lab ldx #$D104 jsl $E10000 MEND MACRO &lab _GetFontInfo &lab ldx #$9604 jsl $E10000 MEND MACRO &lab _GetFontLore &lab ldx #$D904 jsl $E10000 MEND MACRO &lab _GetForeColor &lab ldx #$A104 jsl $E10000 MEND MACRO &lab _GetGrafProcs &lab ldx #$4504 jsl $E10000 MEND MACRO &lab _GetMasterSCB &lab ldx #$1704 jsl $E10000 MEND MACRO &lab _GetPen &lab ldx #$2904 jsl $E10000 MEND MACRO &lab _GetPenMask &lab ldx #$3304 jsl $E10000 MEND MACRO &lab _GetPenMode &lab ldx #$2F04 jsl $E10000 MEND MACRO &lab _GetPenPat &lab ldx #$3104 jsl $E10000 MEND MACRO &lab _GetPenSize &lab ldx #$2D04 jsl $E10000 MEND MACRO &lab _GetPenState &lab ldx #$2B04 jsl $E10000 MEND MACRO &lab _GetPicSave &lab ldx #$3F04 jsl $E10000 MEND MACRO &lab _GetPixel &lab ldx #$8804 jsl $E10000 MEND MACRO &lab _GetPolySave &lab ldx #$4304 jsl $E10000 MEND MACRO &lab _GetPort &lab ldx #$1C04 jsl $E10000 MEND MACRO &lab _GetPortLoc &lab ldx #$1E04 jsl $E10000 MEND MACRO &lab _GetPortRect &lab ldx #$2004 jsl $E10000 MEND MACRO &lab _GetRgnSave &lab ldx #$4104 jsl $E10000 MEND MACRO &lab _GetROMFont &lab ldx #$D804 jsl $E10000 MEND MACRO &lab _GetSCB &lab ldx #$1304 jsl $E10000 MEND MACRO &lab _GetSpaceExtra &lab ldx #$9F04 jsl $E10000 MEND MACRO &lab _GetStandardSCB &lab ldx #$0C04 jsl $E10000 MEND MACRO &lab _GetSysField &lab ldx #$4904 jsl $E10000 MEND MACRO &lab _GetSysFont &lab ldx #$B304 jsl $E10000 MEND MACRO &lab _GetTextFace &lab ldx #$9B04 jsl $E10000 MEND MACRO &lab _GetTextMode &lab ldx #$9D04 jsl $E10000 MEND MACRO &lab _GetTextSize &lab ldx #$D304 jsl $E10000 MEND MACRO &lab _GetUserField &lab ldx #$4704 jsl $E10000 MEND MACRO &lab _GetVisHandle &lab ldx #$C904 jsl $E10000 MEND MACRO &lab _GetVisRgn &lab ldx #$B504 jsl $E10000 MEND MACRO &lab _GlobalToLocal &lab ldx #$8504 jsl $E10000 MEND MACRO &lab _GrafOff &lab ldx #$0B04 jsl $E10000 MEND MACRO &lab _GrafOn &lab ldx #$0A04 jsl $E10000 MEND MACRO &lab _HideCursor &lab ldx #$9004 jsl $E10000 MEND MACRO &lab _HidePen &lab ldx #$2704 jsl $E10000 MEND MACRO &lab _InflateTextBuffer &lab ldx #$D704 jsl $E10000 MEND MACRO &lab _InitColorTable &lab ldx #$0D04 jsl $E10000 MEND MACRO &lab _InitCursor &lab ldx #$CA04 jsl $E10000 MEND MACRO &lab _InitPort &lab ldx #$1904 jsl $E10000 MEND MACRO &lab _InsetRect &lab ldx #$4C04 jsl $E10000 MEND MACRO &lab _InsetRgn &lab ldx #$7004 jsl $E10000 MEND MACRO &lab _InvertArc &lab ldx #$6504 jsl $E10000 MEND MACRO &lab _InvertOval &lab ldx #$5B04 jsl $E10000 MEND MACRO &lab _InvertPoly &lab ldx #$BF04 jsl $E10000 MEND MACRO &lab _InvertRect &lab ldx #$5604 jsl $E10000 MEND MACRO &lab _InvertRgn &lab ldx #$7C04 jsl $E10000 MEND MACRO &lab _InvertRRect &lab ldx #$6004 jsl $E10000 MEND MACRO &lab _KillPicture &lab ldx #$BB04 jsl $E10000 MEND MACRO &lab _KillPoly &lab ldx #$C304 jsl $E10000 MEND MACRO &lab _Line &lab ldx #$3D04 jsl $E10000 MEND MACRO &lab _LineTo &lab ldx #$3C04 jsl $E10000 MEND MACRO &lab _LocalToGlobal &lab ldx #$8404 jsl $E10000 MEND MACRO &lab _MapPoly &lab ldx #$C504 jsl $E10000 MEND MACRO &lab _MapPt &lab ldx #$8A04 jsl $E10000 MEND MACRO &lab _MapRect &lab ldx #$8B04 jsl $E10000 MEND MACRO &lab _MapRgn &lab ldx #$8C04 jsl $E10000 MEND MACRO &lab _Move &lab ldx #$3B04 jsl $E10000 MEND MACRO &lab _MovePortTo &lab ldx #$2204 jsl $E10000 MEND MACRO &lab _MoveTo &lab ldx #$3A04 jsl $E10000 MEND MACRO &lab _NewRgn &lab ldx #$6704 jsl $E10000 MEND MACRO &lab _NotEmptyRect &lab ldx #$5204 jsl $E10000 MEND MACRO &lab _ObscureCursor &lab ldx #$9204 jsl $E10000 MEND MACRO &lab _OffsetPoly &lab ldx #$C404 jsl $E10000 MEND MACRO &lab _OffsetRect &lab ldx #$4B04 jsl $E10000 MEND MACRO &lab _OffsetRgn &lab ldx #$6F04 jsl $E10000 MEND MACRO &lab _OpenPicture &lab ldx #$B704 jsl $E10000 MEND MACRO &lab _OpenPoly &lab ldx #$C104 jsl $E10000 MEND MACRO &lab _OpenPort &lab ldx #$1804 jsl $E10000 MEND MACRO &lab _OpenRgn &lab ldx #$6D04 jsl $E10000 MEND MACRO &lab _PaintArc &lab ldx #$6304 jsl $E10000 MEND MACRO &lab _PaintOval &lab ldx #$5904 jsl $E10000 MEND MACRO &lab _PaintPixels &lab ldx #$7F04 jsl $E10000 MEND MACRO &lab _PaintPoly &lab ldx #$BD04 jsl $E10000 MEND MACRO &lab _PaintRect &lab ldx #$5404 jsl $E10000 MEND MACRO &lab _PaintRgn &lab ldx #$7A04 jsl $E10000 MEND MACRO &lab _PaintRRect &lab ldx #$5E04 jsl $E10000 MEND MACRO &lab _PenNormal &lab ldx #$3604 jsl $E10000 MEND MACRO &lab _PicComment &lab ldx #$B804 jsl $E10000 MEND MACRO &lab _PPToPort &lab ldx #$D604 jsl $E10000 MEND MACRO &lab _Pt2Rect &lab ldx #$5004 jsl $E10000 MEND MACRO &lab _PtInRect &lab ldx #$4F04 jsl $E10000 MEND MACRO &lab _PtInRgn &lab ldx #$7504 jsl $E10000 MEND MACRO &lab _Random &lab ldx #$8604 jsl $E10000 MEND MACRO &lab _RectInRgn &lab ldx #$7604 jsl $E10000 MEND MACRO &lab _RectRgn &lab ldx #$6C04 jsl $E10000 MEND MACRO &lab _RestoreBufDims &lab ldx #$CE04 jsl $E10000 MEND MACRO &lab _SaveBufDims &lab ldx #$CD04 jsl $E10000 MEND MACRO &lab _ScalePt &lab ldx #$8904 jsl $E10000 MEND MACRO &lab _ScrollRect &lab ldx #$7E04 jsl $E10000 MEND MACRO &lab _SectRect &lab ldx #$4D04 jsl $E10000 MEND MACRO &lab _SectRgn &lab ldx #$7104 jsl $E10000 MEND MACRO &lab _SetAllSCBs &lab ldx #$1404 jsl $E10000 MEND MACRO &lab _SetArcRot &lab ldx #$B004 jsl $E10000 MEND MACRO &lab _SetBackColor &lab ldx #$A204 jsl $E10000 MEND MACRO &lab _SetBackPat &lab ldx #$3404 jsl $E10000 MEND MACRO &lab _SetBufDims &lab ldx #$CB04 jsl $E10000 MEND MACRO &lab _SetCharExtra &lab ldx #$D404 jsl $E10000 MEND MACRO &lab _SetClip &lab ldx #$2404 jsl $E10000 MEND MACRO &lab _SetClipHandle &lab ldx #$C604 jsl $E10000 MEND MACRO &lab _SetColorEntry &lab ldx #$1004 jsl $E10000 MEND MACRO &lab _SetColorTable &lab ldx #$0E04 jsl $E10000 MEND MACRO &lab _SetCursor &lab ldx #$8E04 jsl $E10000 MEND MACRO &lab _SetEmptyRgn &lab ldx #$6A04 jsl $E10000 MEND MACRO &lab _SetFont &lab ldx #$9404 jsl $E10000 MEND MACRO &lab _SetFontFlags &lab ldx #$9804 jsl $E10000 MEND MACRO &lab _SetFontID &lab ldx #$D004 jsl $E10000 MEND MACRO &lab _SetForeColor &lab ldx #$A004 jsl $E10000 MEND MACRO &lab _SetGrafProcs &lab ldx #$4404 jsl $E10000 MEND MACRO &lab _SetIntUse &lab ldx #$B604 jsl $E10000 MEND MACRO &lab _SetMasterSCB &lab ldx #$1604 jsl $E10000 MEND MACRO &lab _SetOrigin &lab ldx #$2304 jsl $E10000 MEND MACRO &lab _SetPenMask &lab ldx #$3204 jsl $E10000 MEND MACRO &lab _SetPenMode &lab ldx #$2E04 jsl $E10000 MEND MACRO &lab _SetPenPat &lab ldx #$3004 jsl $E10000 MEND MACRO &lab _SetPenSize &lab ldx #$2C04 jsl $E10000 MEND MACRO &lab _SetPenState &lab ldx #$2A04 jsl $E10000 MEND MACRO &lab _SetPicSave &lab ldx #$3E04 jsl $E10000 MEND MACRO &lab _SetPolySave &lab ldx #$4204 jsl $E10000 MEND MACRO &lab _SetPort &lab ldx #$1B04 jsl $E10000 MEND MACRO &lab _SetPortLoc &lab ldx #$1D04 jsl $E10000 MEND MACRO &lab _SetPortRect &lab ldx #$1F04 jsl $E10000 MEND MACRO &lab _SetPortSize &lab ldx #$2104 jsl $E10000 MEND MACRO &lab _SetPt &lab ldx #$8204 jsl $E10000 MEND MACRO &lab _SetRandSeed &lab ldx #$8704 jsl $E10000 MEND MACRO &lab _SetRect &lab ldx #$4A04 jsl $E10000 MEND MACRO &lab _SetRectRgn &lab ldx #$6B04 jsl $E10000 MEND MACRO &lab _SetRgnSave &lab ldx #$4004 jsl $E10000 MEND MACRO &lab _SetSCB &lab ldx #$1204 jsl $E10000 MEND MACRO &lab _SetSolidBackPat &lab ldx #$3804 jsl $E10000 MEND MACRO &lab _SetSolidPenPat &lab ldx #$3704 jsl $E10000 MEND MACRO &lab _SetSpaceExtra &lab ldx #$9E04 jsl $E10000 MEND MACRO &lab _SetStdProcs &lab ldx #$8D04 jsl $E10000 MEND MACRO &lab _SetSysField &lab ldx #$4804 jsl $E10000 MEND MACRO &lab _SetSysFont &lab ldx #$B204 jsl $E10000 MEND MACRO &lab _SetTextFace &lab ldx #$9A04 jsl $E10000 MEND MACRO &lab _SetTextMode &lab ldx #$9C04 jsl $E10000 MEND MACRO &lab _SetTextSize &lab ldx #$D204 jsl $E10000 MEND MACRO &lab _SetUserField &lab ldx #$4604 jsl $E10000 MEND MACRO &lab _SetVisHandle &lab ldx #$C804 jsl $E10000 MEND MACRO &lab _SetVisRgn &lab ldx #$B404 jsl $E10000 MEND MACRO &lab _ShowCursor &lab ldx #$9104 jsl $E10000 MEND MACRO &lab _ShowPen &lab ldx #$2804 jsl $E10000 MEND MACRO &lab _SolidPattern &lab ldx #$3904 jsl $E10000 MEND MACRO &lab _StringBounds &lab ldx #$AD04 jsl $E10000 MEND MACRO &lab _StringWidth &lab ldx #$A904 jsl $E10000 MEND MACRO &lab _SubPt &lab ldx #$8104 jsl $E10000 MEND MACRO &lab _TextBounds &lab ldx #$AF04 jsl $E10000 MEND MACRO &lab _TextWidth &lab ldx #$AB04 jsl $E10000 MEND MACRO &lab _UnionRect &lab ldx #$4E04 jsl $E10000 MEND MACRO &lab _UnionRgn &lab ldx #$7204 jsl $E10000 MEND MACRO &lab _XorRgn &lab ldx #$7404 jsl $E10000 MEND ;----------------------------------------------------------- ; FILE: M16.SANE ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; ; ; These macros give assembly language access to 65816 SANE. ; NOTE: To use these macros you must also include E16.SANE in your ; source file. ;----------------------------------------------------------- ; Operation macros: operands should already be on the stack, ; with the destination address on top. Generally the suffix ; X, D, S, C, I, or L determines the format of the source ; operand - extended, double, single, comp, integer or longint. ;----------------------------------------------------------- ; ;----------------------------------------------------------- ; Toolset macros. ;----------------------------------------------------------- ; MACRO &lab _SANEBootInit &lab ldx #$010A jsl $E10000 MEND MACRO &lab _SANEStartup &lab ldx #$020A jsl $E10000 MEND MACRO &lab _SANEShutDown &lab ldx #$030A jsl $E10000 MEND MACRO &lab _SANEVersion &lab ldx #$040A jsl $E10000 MEND MACRO &lab _SANEReset &lab ldx #$050A jsl $E10000 MEND MACRO &lab _SANEStatus &lab ldx #$060A jsl $E10000 MEND MACRO &lab _SANEFP816 &lab ldx #$090A jsl $E10000 MEND MACRO &lab _SANEDecStr816 &lab ldx #$0A0A jsl $E10000 MEND MACRO &lab _SANEElems816 &lab ldx #$0B0A jsl $E10000 MEND ;----------------------------------------------------------- ; Addition. ;----------------------------------------------------------- MACRO &lab FADDX &lab FOPRF FFEXT+FOADD MEND MACRO &lab FADDD &lab FOPRF FFDBL+FOADD MEND MACRO &lab FADDS &lab FOPRF FFSGL+FOADD MEND MACRO &lab FADDC &lab FOPRF FFCOMP+FOADD MEND MACRO &lab FADDI &lab FOPRF FFINT+FOADD MEND MACRO &lab FADDL &lab FOPRF FFLNG+FOADD MEND ;----------------------------------------------------------- ; Subtraction. ;----------------------------------------------------------- MACRO &lab FSUBX &lab FOPRF FFEXT+FOSUB MEND MACRO &lab FSUBD &lab FOPRF FFDBL+FOSUB MEND MACRO &lab FSUBS &lab FOPRF FFSGL+FOSUB MEND MACRO &lab FSUBC &lab FOPRF FFCOMP+FOSUB MEND MACRO &lab FSUBI &lab FOPRF FFINT+FOSUB MEND MACRO &lab FSUBL &lab FOPRF FFLNG+FOSUB MEND ;----------------------------------------------------------- ; Multiplication. ;----------------------------------------------------------- MACRO &lab FMULX &lab FOPRF FFEXT+FOMUL MEND MACRO &lab FMULD &lab FOPRF FFDBL+FOMUL MEND MACRO &lab FMULS &lab FOPRF FFSGL+FOMUL MEND MACRO &lab FMULC &lab FOPRF FFCOMP+FOMUL MEND MACRO &lab FMULI &lab FOPRF FFINT+FOMUL MEND MACRO &lab FMULL &lab FOPRF FFLNG+FOMUL MEND ;----------------------------------------------------------- ; Division. ;----------------------------------------------------------- MACRO &lab FDIVX &lab FOPRF FFEXT+FODIV MEND MACRO &lab FDIVD &lab FOPRF FFDBL+FODIV MEND MACRO &lab FDIVS &lab FOPRF FFSGL+FODIV MEND MACRO &lab FDIVC &lab FOPRF FFCOMP+FODIV MEND MACRO &lab FDIVI &lab FOPRF FFINT+FODIV MEND MACRO &lab FDIVL &lab FOPRF FFLNG+FODIV MEND ;----------------------------------------------------------- ; Square root. ;----------------------------------------------------------- MACRO &lab FSQRTX &lab FOPRF FOSQRT MEND ;----------------------------------------------------------- ; Round to integer, according to the current rounding mode. ;----------------------------------------------------------- MACRO &lab FRINTX &lab FOPRF FORTI MEND ;----------------------------------------------------------- ; Truncate to integer, using round toward zero. ;----------------------------------------------------------- MACRO &lab FTINTX &lab FOPRF FOTTI MEND ;----------------------------------------------------------- ; Remainder. ;----------------------------------------------------------- MACRO &lab FREMX &lab FOPRF FFEXT+FOREM MEND MACRO &lab FREMD &lab FOPRF FFDBL+FOREM MEND MACRO &lab FREMS &lab FOPRF FFSGL+FOREM MEND MACRO &lab FREMC &lab FOPRF FFCOMP+FOREM MEND MACRO &lab FREMI &lab FOPRF FFINT+FOREM MEND MACRO &lab FREML &lab FOPRF FFLNG+FOREM MEND ;----------------------------------------------------------- ; Logb. ;----------------------------------------------------------- MACRO &lab FLOGBX &lab FOPRF FOLOGB MEND ;----------------------------------------------------------- ; Scalb. ;----------------------------------------------------------- MACRO &lab FSCALBX &lab FOPRF FOSCALB MEND ;----------------------------------------------------------- ; Copy-sign. ;----------------------------------------------------------- MACRO &lab FCPYSGNX &lab FOPRF FFEXT+FOCPYSGN MEND MACRO &lab FCPYSGND &lab FOPRF FFDBL+FOCPYSGN MEND MACRO &lab FCPYSGNS &lab FOPRF FFSGL+FOCPYSGN MEND MACRO &lab FCPYSGNC &lab FOPRF FFCOMP+FOCPYSGN MEND MACRO &lab FCPYSGNI &lab FOPRF FFINT+FOCPYSGN MEND MACRO &lab FCPYSGNL &lab FOPRF FFLNG+FOCPYSGN MEND ;----------------------------------------------------------- ; Negate. ;----------------------------------------------------------- MACRO &lab FNEGX &lab FOPRF FONEG MEND ;----------------------------------------------------------- ; Absolute value. ;----------------------------------------------------------- MACRO &lab FABSX &lab FOPRF FOABS MEND ;----------------------------------------------------------- ; Next-after. NOTE: both operands are of the ; the same format, as specified by the usual suffix. ;----------------------------------------------------------- MACRO &lab FNEXTS &lab FOPRF FFSGL+FONEXT MEND MACRO &lab FNEXTD &lab FOPRF FFDBL+FONEXT MEND MACRO &lab FNEXTX &lab FOPRF FFEXT+FONEXT MEND ;----------------------------------------------------------- ; Conversion to extended. ;----------------------------------------------------------- MACRO &lab FX2X &lab FOPRF FFEXT+FOZ2X MEND MACRO &lab FD2X &lab FOPRF FFDBL+FOZ2X MEND MACRO &lab FS2X &lab FOPRF FFSGL+FOZ2X MEND MACRO ; 16-bit integer, by address &lab FI2X &lab FOPRF FFINT+FOZ2X MEND MACRO ; 32-bit integer, by address &lab FL2X &lab FOPRF FFLNG+FOZ2X MEND MACRO &lab FC2X &lab FOPRF FFCOMP+FOZ2X MEND ;----------------------------------------------------------- ; Conversion from extended. ;----------------------------------------------------------- MACRO &lab FX2D &lab FOPRF FFDBL+FOX2Z MEND MACRO &lab FX2S &lab FOPRF FFSGL+FOX2Z MEND MACRO &lab FX2I &lab FOPRF FFINT+FOX2Z MEND MACRO &lab FX2L &lab FOPRF FFLNG+FOX2Z MEND MACRO &lab FX2C &lab FOPRF FFCOMP+FOX2Z MEND ;----------------------------------------------------------- ; Binary to decimal conversion. ;----------------------------------------------------------- MACRO &lab FX2DEC &lab FOPRF FFEXT+FOB2D MEND MACRO &lab FD2DEC &lab FOPRF FFDBL+FOB2D MEND MACRO &lab FS2DEC &lab FOPRF FFSGL+FOB2D MEND MACRO &lab FC2DEC &lab FOPRF FFCOMP+FOB2D MEND MACRO &lab FI2DEC &lab FOPRF FFINT+FOB2D MEND MACRO &lab FL2DEC &lab FOPRF FFLNG+FOB2D MEND ;----------------------------------------------------------- ; Decimal to binary conversion. ;----------------------------------------------------------- MACRO &lab FDEC2X &lab FOPRF FFEXT+FOD2B MEND MACRO &lab FDEC2D &lab FOPRF FFDBL+FOD2B MEND MACRO &lab FDEC2S &lab FOPRF FFSGL+FOD2B MEND MACRO &lab FDEC2C &lab FOPRF FFCOMP+FOD2B MEND MACRO &lab FDEC2I &lab FOPRF FFINT+FOD2B MEND MACRO &lab FDEC2L &lab FOPRF FFLNG+FOD2B MEND ;----------------------------------------------------------- ; Compare, not signaling invalid on unordered. ;----------------------------------------------------------- MACRO &lab FCMPX &lab FOPRF FFEXT+FOCMP MEND MACRO &lab FCMPD &lab FOPRF FFDBL+FOCMP MEND MACRO &lab FCMPS &lab FOPRF FFSGL+FOCMP MEND MACRO &lab FCMPC &lab FOPRF FFCOMP+FOCMP MEND MACRO &lab FCMPI &lab FOPRF FFINT+FOCMP MEND MACRO &lab FCMPL &lab FOPRF FFLNG+FOCMP MEND ;----------------------------------------------------------- ; Compare, signaling invalid on unordered. ;----------------------------------------------------------- MACRO &lab FCPXX &lab FOPRF FFEXT+FOCPX MEND MACRO &lab FCPXD &lab FOPRF FFDBL+FOCPX MEND MACRO &lab FCPXS &lab FOPRF FFSGL+FOCPX MEND MACRO &lab FCPXC &lab FOPRF FFCOMP+FOCPX MEND MACRO &lab FCPXI &lab FOPRF FFINT+FOCPX MEND MACRO &lab FCPXL &lab FOPRF FFLNG+FOCPX MEND ;----------------------------------------------------------- ; The following macros define a set of so-called floating ; branches. They presume that the appropriate compare ; operation, macro FCMPz or FCPXz, precedes. ;---------------------------------------------------------- MACRO ; branch equal &lab FBEQ &N1 &lab BEQ &N1 MEND MACRO ; branch less &lab FBLT &N1 &lab BMI &N1 MEND MACRO ; branch less or equal &lab FBLE &N1 &lab BMI &N1 BEQ &N1 MEND MACRO ; branch greater &lab FBGT &N1 &lab BVS &N1 MEND MACRO ; branch greater or equal &lab FBGE &N1 &lab BVS &N1 BEQ &N1 MEND MACRO ; branch less or unordered &lab FBULT &N1 &lab BMI &N1 BVS *+4 BNE &N1 MEND MACRO ; branch unordered, less, or equal &lab FBULE &N1 &lab BMI &N1 BEQ &N1 BVC &N1 MEND MACRO ; branch unordered or greater &lab FBUGT &N1 &lab BVS &N1 BMI *+4 BNE &N1 MEND MACRO ; branch unordered, greater, or equal &lab FBUGE &N1 &lab BVS &N1 BEQ &N1 BPL &N1 MEND MACRO ; branch unordered &lab FBU &N1 &lab BVS *+6 BMI *+4 BNE &N1 MEND MACRO ; branch ordered &lab FBO &N1 &lab BMI &N1 BVS &N1 BEQ &N1 MEND MACRO ; branch not equal &lab FBNE &N1 &lab BMI &N1 BVS &N1 BNE &N1 MEND MACRO ; branch unordered or equal &lab FBUE &N1 &lab BEQ &N1 BMI *+4 BVC &N1 MEND MACRO ; branch less or greater &lab FBLG &N1 &lab BMI &N1 BVS &N1 MEND MACRO &lab FCLASSS &lab FOPRF FFSGL+FOCLASS MEND MACRO &lab FCLASSD &lab FOPRF FFDBL+FOCLASS MEND MACRO &lab FCLASSX &lab FOPRF FFEXT+FOCLASS MEND MACRO &lab FCLASSC &lab FOPRF FFCOMP+FOCLASS MEND MACRO &lab FCLASSI &lab FOPRF FFINT+FOCLASS MEND MACRO &lab FCLASSL &lab FOPRF FFLNG+FOCLASS MEND ;----------------------------------------------------------- ; The following macros provide branches based on the ; the result of a FCLASSz macro. ;----------------------------------------------------------- MACRO ; branch signaling NaN &lab FBSNAN &N1 &lab TXA ASL A CMP #2*FCSNAN BEQ &N1 MEND MACRO ; branch quiet NaN &lab FBQNAN &N1 &lab TXA ASL A CMP #2*FCQNAN BEQ &N1 MEND MACRO ; branch infinite &lab FBINF &N1 &lab TXA ASL A CMP #2*FCINF BEQ &N1 MEND MACRO ; branch zero &lab FBZERO &N1 &lab TXA ASL A CMP #2*FCZERO BEQ &N1 MEND MACRO ; branch normal &lab FBNORM &N1 &lab TXA ASL A BEQ &N1 MEND MACRO ; branch denormal &lab FBDENORM &N1 &lab TXA ASL A CMP #2*FCDENORM BEQ &N1 MEND MACRO ; branch non-zero num (norm or denorm) &lab FBNZENUM &N1 &lab TXA XBA ASL A BCC &N1 MEND MACRO ; branch number (zero, norm, or denorm) &lab FBNUM &N1 &lab TXA INC A XBA ASL A BCC &N1 MEND MACRO ; branch minus sign &lab FBMINUS &N1 &lab BMI &N1 MEND MACRO ; branch plus sign &lab FBPLUS &N1 &lab BPL &N1 MEND ;----------------------------------------------------------- ; Get and set environment. ;----------------------------------------------------------- MACRO &lab FGETENV &lab FOPRF FOGETENV MEND MACRO &lab FSETENV &lab FOPRF FOSETENV MEND ;----------------------------------------------------------- ; Test and set exception. ;----------------------------------------------------------- MACRO &lab FTESTXCP &lab FOPRF FOTESTXCP MEND MACRO &lab FSETXCP &lab FOPRF FOSETXCP MEND ;---------------------------------------------------------- ; Procedure entry and exit. ;---------------------------------------------------------- MACRO &lab FPROCENTRY &lab FOPRF FOPROCENTRY MEND MACRO &lab FPROCEXIT &lab FOPRF FOPROCEXIT MEND ;----------------------------------------------------------- ; Get and set halt vector. ;----------------------------------------------------------- MACRO &lab FGETHV &lab FOPRF FOGETHV MEND MACRO &lab FSETHV &lab FOPRF FOSETHV MEND ;----------------------------------------------------------- ; Elementary function macros. ;----------------------------------------------------------- MACRO ; natural (base-e) log &lab FLNX &lab FOPRE FOLNX MEND MACRO ; base-2 log &lab FLOG2X &lab FOPRE FOLOG2X MEND MACRO ; ln (1 + x) &lab FLN1X &lab FOPRE FOLN1X MEND MACRO ; log2 (1 + x) &lab FLOG21X &lab FOPRE FOLOG21X MEND MACRO ; base-e exponential &lab FEXPX &lab FOPRE FOEXPX MEND MACRO ; base-2 exponential &lab FEXP2X &lab FOPRE FOEXP2X MEND MACRO ; exp (x) - 1 &lab FEXP1X &lab FOPRE FOEXP1X MEND MACRO ; exp2 (x) - 1 &lab FEXP21X &lab FOPRE FOEXP21X MEND MACRO ; integer exponential &lab FXPWRI &lab FOPRE FOXPWRI MEND MACRO ; general exponential &lab FXPWRY &lab FOPRE FOXPWRY MEND MACRO ; compound &lab FCOMPOUND &lab FOPRE FOCOMPOUND MEND MACRO ; annuity &lab FANNUITY &lab FOPRE FOANNUITY MEND MACRO ; arctangent &lab FATANX &lab FOPRE FOATANX MEND MACRO ; sine &lab FSINX &lab FOPRE FOSINX MEND MACRO ; cosine &lab FCOSX &lab FOPRE FOCOSX MEND MACRO ; tangent &lab FTANX &lab FOPRE FOTANX MEND MACRO ; random number generator &lab FRANDX &lab FOPRE FORANDX MEND ;----------------------------------------------------------- ; Scanner and formatter function macros. ;----------------------------------------------------------- MACRO ; Pascal string to decimal record &lab FPSTR2DEC &lab FOPRD FOPSTR2DEC MEND MACRO ; C string to decimal record &lab FCSTR2DEC &lab FOPRD FOCSTR2DEC MEND MACRO ; decimal record to (Pascal) string &lab FDEC2STR &lab FOPRD FODEC2STR MEND ;----------------------------------------------------------- ; Auxiliary macros. ;----------------------------------------------------------- MACRO ; call FP &lab FOPRF &N1 &lab PEA &N1 LDX #SANEtsNum+256*FPNum JSL $E10000 MEND MACRO ; call DecStr &lab FOPRD &N1 &lab PEA &N1 LDX #SANEtsNum+256*DecStrNum JSL $E10000 MEND MACRO ; call Elems &lab FOPRE &N1 &lab PEA &N1 LDX #SANEtsNum+256*ElemNum JSL $E10000 MEND ; File: M16.Scheduler ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _SchBootInit &lab ldx #$0107 jsl $E10000 MEND MACRO &lab _SchStartUp &lab ldx #$0207 jsl $E10000 MEND MACRO &lab _SchShutDown &lab ldx #$0307 jsl $E10000 MEND MACRO &lab _SchVersion &lab ldx #$0407 jsl $E10000 MEND MACRO &lab _SchReset &lab ldx #$0507 jsl $E10000 MEND MACRO &lab _SchStatus &lab ldx #$0607 jsl $E10000 MEND MACRO &lab _SchAddTask &lab ldx #$0907 jsl $E10000 MEND MACRO &lab _SchFlush &lab ldx #$0A07 jsl $E10000 MEND ; File: M16.Scrap ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _ScrapBootInit &lab ldx #$0116 jsl $E10000 MEND MACRO &lab _ScrapStartUp &lab ldx #$0216 jsl $E10000 MEND MACRO &lab _ScrapShutDown &lab ldx #$0316 jsl $E10000 MEND MACRO &lab _ScrapVersion &lab ldx #$0416 jsl $E10000 MEND MACRO &lab _ScrapReset &lab ldx #$0516 jsl $E10000 MEND MACRO &lab _ScrapStatus &lab ldx #$0616 jsl $E10000 MEND MACRO &lab _GetScrap &lab ldx #$0D16 jsl $E10000 MEND MACRO &lab _GetScrapCount &lab ldx #$1216 jsl $E10000 MEND MACRO &lab _GetScrapHandle &lab ldx #$0E16 jsl $E10000 MEND MACRO &lab _GetScrapPath &lab ldx #$1016 jsl $E10000 MEND MACRO &lab _GetScrapSize &lab ldx #$0F16 jsl $E10000 MEND MACRO &lab _GetScrapState &lab ldx #$1316 jsl $E10000 MEND MACRO &lab _LoadScrap &lab ldx #$0A16 jsl $E10000 MEND MACRO &lab _PutScrap &lab ldx #$0C16 jsl $E10000 MEND MACRO &lab _SetScrapPath &lab ldx #$1116 jsl $E10000 MEND MACRO &lab _UnloadScrap &lab ldx #$0916 jsl $E10000 MEND MACRO &lab _ZeroScrap &lab ldx #$0B16 jsl $E10000 MEND ; File: M16.Sound ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _SoundBootInit &lab ldx #$0108 jsl $E10000 MEND MACRO &lab _SoundStartUp &lab ldx #$0208 jsl $E10000 MEND MACRO &lab _SoundShutDown &lab ldx #$0308 jsl $E10000 MEND MACRO &lab _SoundVersion &lab ldx #$0408 jsl $E10000 MEND MACRO &lab _SoundReset &lab ldx #$0508 jsl $E10000 MEND MACRO &lab _SoundToolStatus &lab ldx #$0608 jsl $E10000 MEND MACRO &lab _FFGeneratorStatus &lab ldx #$1108 jsl $E10000 MEND MACRO &lab _FFSoundDoneStatus &lab ldx #$1408 jsl $E10000 MEND MACRO &lab _FFSoundStatus &lab ldx #$1008 jsl $E10000 MEND MACRO &lab _FFStartSound &lab ldx #$0E08 jsl $E10000 MEND MACRO &lab _FFStopSound &lab ldx #$0F08 jsl $E10000 MEND MACRO &lab _GetSoundVolume &lab ldx #$0C08 jsl $E10000 MEND MACRO &lab _GetTableAddress &lab ldx #$0B08 jsl $E10000 MEND MACRO &lab _ReadRamBlock &lab ldx #$0A08 jsl $E10000 MEND MACRO &lab _SetSoundMIRQV &lab ldx #$1208 jsl $E10000 MEND MACRO &lab _SetSoundVolume &lab ldx #$0D08 jsl $E10000 MEND MACRO &lab _SetUserSoundIRQV &lab ldx #$1308 jsl $E10000 MEND MACRO &lab _WriteRamBlock &lab ldx #$0908 jsl $E10000 MEND ; File: M16.StdFile ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _SFBootInit &lab ldx #$0117 jsl $E10000 MEND MACRO &lab _SFStartUp &lab ldx #$0217 jsl $E10000 MEND MACRO &lab _SFShutDown &lab ldx #$0317 jsl $E10000 MEND MACRO &lab _SFVersion &lab ldx #$0417 jsl $E10000 MEND MACRO &lab _SFReset &lab ldx #$0517 jsl $E10000 MEND MACRO &lab _SFStatus &lab ldx #$0617 jsl $E10000 MEND MACRO &lab _SFAllCaps &lab ldx #$0D17 jsl $E10000 MEND MACRO &lab _SFGetFile &lab ldx #$0917 jsl $E10000 MEND MACRO &lab _SFPGetFile &lab ldx #$0B17 jsl $E10000 MEND MACRO &lab _SFPPutFile &lab ldx #$0C17 jsl $E10000 MEND MACRO &lab _SFPutFile &lab ldx #$0A17 jsl $E10000 MEND ; File: M16.SysCalls ; ; ; Copyright Apple computer, Inc. 1988 ; All Rights Reserved ; ; MACRO &lab _AllocInterrupt_C0 ¶ms &lab jsl $E100A8 dc i2"$0031" dc i4"¶ms" MEND MACRO &lab _BindIntGS ¶ms &lab jsl $E100A8 dc i2"$2031" dc i4"¶ms" MEND MACRO &lab _ChangePath_C0 ¶ms &lab jsl $E100A8 dc i2"$0004" dc i4"¶ms" MEND MACRO &lab _ChangePathGS ¶ms &lab jsl $E100A8 dc i2"$2004" dc i4"¶ms" MEND MACRO &lab _ClearBackupBit_C0 ¶ms &lab jsl $E100A8 dc i2"$000B" dc i4"¶ms" MEND MACRO &lab _ClearBackupBitGS ¶ms &lab jsl $E100A8 dc i2"$200B" dc i4"¶ms" MEND MACRO &lab _Close_C0 ¶ms &lab jsl $E100A8 dc i2"$0014" dc i4"¶ms" MEND MACRO &lab _CloseGS ¶ms &lab jsl $E100A8 dc i2"$2014" dc i4"¶ms" MEND MACRO &lab _Create_C0 ¶ms &lab jsl $E100A8 dc i2"$0001" dc i4"¶ms" MEND MACRO &lab _CreateGS ¶ms &lab jsl $E100A8 dc i2"$2001" dc i4"¶ms" MEND MACRO &lab _DControlGS ¶ms &lab jsl $E100A8 dc i2"$202E" dc i4"¶ms" MEND MACRO &lab _DeallocInterrupt_C0 ¶ms &lab jsl $E100A8 dc i2"$0032" dc i4"¶ms" MEND MACRO &lab _Destroy_C0 ¶ms &lab jsl $E100A8 dc i2"$0002" dc i4"¶ms" MEND MACRO &lab _DestroyGS ¶ms &lab jsl $E100A8 dc i2"$2002" dc i4"¶ms" MEND MACRO &lab _DInfo_C0 ¶ms &lab jsl $E100A8 dc i2"$002C" dc i4"¶ms" MEND MACRO &lab _DInfoGS ¶ms &lab jsl $E100A8 dc i2"$202C" dc i4"¶ms" MEND MACRO &lab _DReadGS ¶ms &lab jsl $E100A8 dc i2"$202F" dc i4"¶ms" MEND MACRO &lab _DStatusGS ¶ms &lab jsl $E100A8 dc i2"$202D" dc i4"¶ms" MEND MACRO &lab _DWriteGS ¶ms &lab jsl $E100A8 dc i2"$2030" dc i4"¶ms" MEND MACRO &lab _EraseDisk_C0 ¶ms &lab jsl $E100A8 dc i2"$0025" dc i4"¶ms" MEND MACRO &lab _EraseDiskGS ¶ms &lab jsl $E100A8 dc i2"$2025" dc i4"¶ms" MEND MACRO &lab _ExpandPathGS ¶ms &lab jsl $E100A8 dc i2"$200E" dc i4"¶ms" MEND MACRO &lab _Flush_C0 ¶ms &lab jsl $E100A8 dc i2"$0015" dc i4"¶ms" MEND MACRO &lab _FlushGS ¶ms &lab jsl $E100A8 dc i2"$2015" dc i4"¶ms" MEND MACRO &lab _Format_C0 ¶ms &lab jsl $E100A8 dc i2"$0024" dc i4"¶ms" MEND MACRO &lab _FormatGS ¶ms &lab jsl $E100A8 dc i2"$2024" dc i4"¶ms" MEND MACRO &lab _GetBootVol_C0 ¶ms &lab jsl $E100A8 dc i2"$0027" dc i4"¶ms" MEND MACRO &lab _GetBootVolGS ¶ms &lab jsl $E100A8 dc i2"$2028" dc i4"¶ms" MEND MACRO &lab _GetDevNumber_C0 ¶ms &lab jsl $E100A8 dc i2"$0020" dc i4"¶ms" MEND MACRO &lab _GetDevNumberGS ¶ms &lab jsl $E100A8 dc i2"$2020" dc i4"¶ms" MEND MACRO &lab _GetDirEntry_C0 ¶ms &lab jsl $E100A8 dc i2"$001C" dc i4"¶ms" MEND MACRO &lab _GetDirEntryGS ¶ms &lab jsl $E100A8 dc i2"$201C" dc i4"¶ms" MEND MACRO &lab _GetEOF_C0 ¶ms &lab jsl $E100A8 dc i2"$0019" dc i4"¶ms" MEND MACRO &lab _GetEOFGS ¶ms &lab jsl $E100A8 dc i2"$2019" dc i4"¶ms" MEND MACRO &lab _GetFileInfo_C0 ¶ms &lab jsl $E100A8 dc i2"$0006" dc i4"¶ms" MEND MACRO &lab _GetFileInfoGS ¶ms &lab jsl $E100A8 dc i2"$2006" dc i4"¶ms" MEND MACRO &lab _GetFSTInfoGS ¶ms &lab jsl $E100A8 dc i2"$202B" dc i4"¶ms" MEND MACRO &lab _GetLastDev_C0 ¶ms &lab jsl $E100A8 dc i2"$0021" dc i4"¶ms" MEND MACRO &lab _GetLevel_C0 ¶ms &lab jsl $E100A8 dc i2"$001B" dc i4"¶ms" MEND MACRO &lab _GetLevelGS ¶ms &lab jsl $E100A8 dc i2"$201B" dc i4"¶ms" MEND MACRO &lab _GetMark_C0 ¶ms &lab jsl $E100A8 dc i2"$0017" dc i4"¶ms" MEND MACRO &lab _GetMarkGS ¶ms &lab jsl $E100A8 dc i2"$2017" dc i4"¶ms" MEND MACRO &lab _Getname_C0 ¶ms &lab jsl $E100A8 dc i2"$0027" dc i4"¶ms" MEND MACRO &lab _GetNameGS ¶ms &lab jsl $E100A8 dc i2"$2027" dc i4"¶ms" MEND MACRO &lab _GetPrefix_C0 ¶ms &lab jsl $E100A8 dc i2"$000A" dc i4"¶ms" MEND MACRO &lab _GetPrefixGS ¶ms &lab jsl $E100A8 dc i2"$200A" dc i4"¶ms" MEND MACRO &lab _GetVersion_C0 ¶ms &lab jsl $E100A8 dc i2"$002A" dc i4"¶ms" MEND MACRO &lab _GetVersionGS ¶ms &lab jsl $E100A8 dc i2"$202A" dc i4"¶ms" MEND MACRO &lab _Newline_C0 ¶ms &lab jsl $E100A8 dc i2"$0011" dc i4"¶ms" MEND MACRO &lab _NewlineGS ¶ms &lab jsl $E100A8 dc i2"$2011" dc i4"¶ms" MEND MACRO &lab _NullGS ¶ms &lab jsl $E100A8 dc i2"$200D" dc i4"¶ms" MEND MACRO &lab _Open_C0 ¶ms &lab jsl $E100A8 dc i2"$0010" dc i4"¶ms" MEND MACRO &lab _OpenGS ¶ms &lab jsl $E100A8 dc i2"$2010" dc i4"¶ms" MEND MACRO &lab _Quit_C0 ¶ms &lab jsl $E100A8 dc i2"$0029" dc i4"¶ms" MEND MACRO &lab _QuitGS ¶ms &lab jsl $E100A8 dc i2"$2029" dc i4"¶ms" MEND MACRO &lab _ReadBlock_C0 ¶ms &lab jsl $E100A8 dc i2"$0022" dc i4"¶ms" MEND MACRO &lab _Read_C0 ¶ms &lab jsl $E100A8 dc i2"$0012" dc i4"¶ms" MEND MACRO &lab _ReadGS ¶ms &lab jsl $E100A8 dc i2"$2012" dc i4"¶ms" MEND MACRO &lab _SetEOF_C0 ¶ms &lab jsl $E100A8 dc i2"$0018" dc i4"¶ms" MEND MACRO &lab _SetEOFGS ¶ms &lab jsl $E100A8 dc i2"$2018" dc i4"¶ms" MEND MACRO &lab _SetFileInfo_C0 ¶ms &lab jsl $E100A8 dc i2"$0005" dc i4"¶ms" MEND MACRO &lab _SetFileInfoGS ¶ms &lab jsl $E100A8 dc i2"$2005" dc i4"¶ms" MEND MACRO &lab _SetLevel_C0 ¶ms &lab jsl $E100A8 dc i2"$001A" dc i4"¶ms" MEND MACRO &lab _SetLevelGS ¶ms &lab jsl $E100A8 dc i2"$201A" dc i4"¶ms" MEND MACRO &lab _SetMark_C0 ¶ms &lab jsl $E100A8 dc i2"$0016" dc i4"¶ms" MEND MACRO &lab _SetMarkGS ¶ms &lab jsl $E100A8 dc i2"$2016" dc i4"¶ms" MEND MACRO &lab _SetPrefix_C0 ¶ms &lab jsl $E100A8 dc i2"$0009" dc i4"¶ms" MEND MACRO &lab _SetPrefixGS ¶ms &lab jsl $E100A8 dc i2"$2009" dc i4"¶ms" MEND MACRO &lab _UnbindIntGS ¶ms &lab jsl $E100A8 dc i2"$2032" dc i4"¶ms" MEND MACRO &lab _Volume_C0 ¶ms &lab jsl $E100A8 dc i2"$0008" dc i4"¶ms" MEND MACRO &lab _VolumeGS ¶ms &lab jsl $E100A8 dc i2"$2008" dc i4"¶ms" MEND MACRO &lab _WriteBlock_C0 ¶ms &lab jsl $E100A8 dc i2"$0023" dc i4"¶ms" MEND MACRO &lab _Write_C0 ¶ms &lab jsl $E100A8 dc i2"$0013" dc i4"¶ms" MEND MACRO &lab _WriteGS ¶ms &lab jsl $E100A8 dc i2"$2013" dc i4"¶ms" MEND ; File: M16.Textool ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _TextBootInit &lab ldx #$010C jsl $E10000 MEND MACRO &lab _TextStartUp &lab ldx #$020C jsl $E10000 MEND MACRO &lab _TextShutDown &lab ldx #$030C jsl $E10000 MEND MACRO &lab _TextVersion &lab ldx #$040C jsl $E10000 MEND MACRO &lab _TextReset &lab ldx #$050C jsl $E10000 MEND MACRO &lab _TextStatus &lab ldx #$060C jsl $E10000 MEND MACRO &lab _CtlTextDev &lab ldx #$160C jsl $E10000 MEND MACRO &lab _ErrWriteBlock &lab ldx #$1F0C jsl $E10000 MEND MACRO &lab _ErrWriteChar &lab ldx #$190C jsl $E10000 MEND MACRO &lab _ErrWriteCString &lab ldx #$210C jsl $E10000 MEND MACRO &lab _ErrWriteLine &lab ldx #$1B0C jsl $E10000 MEND MACRO &lab _ErrWriteString &lab ldx #$1D0C jsl $E10000 MEND MACRO &lab _GetErrGlobals &lab ldx #$0E0C jsl $E10000 MEND MACRO &lab _GetErrorDevice &lab ldx #$140C jsl $E10000 MEND MACRO &lab _GetInGlobals &lab ldx #$0C0C jsl $E10000 MEND MACRO &lab _GetInputDevice &lab ldx #$120C jsl $E10000 MEND MACRO &lab _GetOutGlobals &lab ldx #$0D0C jsl $E10000 MEND MACRO &lab _GetOutputDevice &lab ldx #$130C jsl $E10000 MEND MACRO &lab _InitTextDev &lab ldx #$150C jsl $E10000 MEND MACRO &lab _ReadChar &lab ldx #$220C jsl $E10000 MEND MACRO &lab _ReadLine &lab ldx #$240C jsl $E10000 MEND MACRO &lab _SetErrGlobals &lab ldx #$0B0C jsl $E10000 MEND MACRO &lab _SetErrorDevice &lab ldx #$110C jsl $E10000 MEND MACRO &lab _SetInGlobals &lab ldx #$090C jsl $E10000 MEND MACRO &lab _SetInputDevice &lab ldx #$0F0C jsl $E10000 MEND MACRO &lab _SetOutGlobals &lab ldx #$0A0C jsl $E10000 MEND MACRO &lab _SetOutputDevice &lab ldx #$100C jsl $E10000 MEND MACRO &lab _StatusTextDev &lab ldx #$170C jsl $E10000 MEND MACRO &lab _TextReadBlock &lab ldx #$230C jsl $E10000 MEND MACRO &lab _TextWriteBlock &lab ldx #$1E0C jsl $E10000 MEND MACRO &lab _WriteChar &lab ldx #$180C jsl $E10000 MEND MACRO &lab _WriteCString &lab ldx #$200C jsl $E10000 MEND MACRO &lab _WriteLine &lab ldx #$1A0C jsl $E10000 MEND MACRO &lab _WriteString &lab ldx #$1C0C jsl $E10000 MEND ; File: M16.Window ; ; ; Copyright Apple Computer, Inc. 1986, 1987 ; All Rights Reserved ; ; MACRO &lab _WindBootInit &lab ldx #$010E jsl $E10000 MEND MACRO &lab _WindStartUp &lab ldx #$020E jsl $E10000 MEND MACRO &lab _WindShutDown &lab ldx #$030E jsl $E10000 MEND MACRO &lab _WindVersion &lab ldx #$040E jsl $E10000 MEND MACRO &lab _WindReset &lab ldx #$050E jsl $E10000 MEND MACRO &lab _WindStatus &lab ldx #$060E jsl $E10000 MEND MACRO &lab _BeginUpdate &lab ldx #$1E0E jsl $E10000 MEND MACRO &lab _BringToFront &lab ldx #$240E jsl $E10000 MEND MACRO &lab _CheckUpdate &lab ldx #$0A0E jsl $E10000 MEND MACRO &lab _CloseWindow &lab ldx #$0B0E jsl $E10000 MEND MACRO &lab _Desktop &lab ldx #$0C0E jsl $E10000 MEND MACRO &lab _DragWindow &lab ldx #$1A0E jsl $E10000 MEND MACRO &lab _EndInfoDrawing &lab ldx #$510E jsl $E10000 MEND MACRO &lab _EndUpdate &lab ldx #$1F0E jsl $E10000 MEND MACRO &lab _FindWindow &lab ldx #$170E jsl $E10000 MEND MACRO &lab _FrontWindow &lab ldx #$150E jsl $E10000 MEND MACRO &lab _GetContentDraw &lab ldx #$480E jsl $E10000 MEND MACRO &lab _GetContentOrigin &lab ldx #$3E0E jsl $E10000 MEND MACRO &lab _GetContentRgn &lab ldx #$2F0E jsl $E10000 MEND MACRO &lab _GetDataSize &lab ldx #$400E jsl $E10000 MEND MACRO &lab _GetDefProc &lab ldx #$310E jsl $E10000 MEND MACRO &lab _GetFirstWindow &lab ldx #$520E jsl $E10000 MEND MACRO &lab _GetFrameColor &lab ldx #$100E jsl $E10000 MEND MACRO &lab _GetInfoDraw &lab ldx #$4A0E jsl $E10000 MEND MACRO &lab _GetInfoRefCon &lab ldx #$350E jsl $E10000 MEND MACRO &lab _GetMaxGrow &lab ldx #$420E jsl $E10000 MEND MACRO &lab _GetNextWindow &lab ldx #$2A0E jsl $E10000 MEND MACRO &lab _GetPage &lab ldx #$460E jsl $E10000 MEND MACRO &lab _GetRectInfo &lab ldx #$4F0E jsl $E10000 MEND MACRO &lab _GetScroll &lab ldx #$440E jsl $E10000 MEND MACRO &lab _GetStructRgn &lab ldx #$2E0E jsl $E10000 MEND MACRO &lab _GetSysWFlag &lab ldx #$4C0E jsl $E10000 MEND MACRO &lab _GetUpdateRgn &lab ldx #$300E jsl $E10000 MEND MACRO &lab _GetWControls &lab ldx #$330E jsl $E10000 MEND MACRO &lab _GetWFrame &lab ldx #$2C0E jsl $E10000 MEND MACRO &lab _GetWKind &lab ldx #$2B0E jsl $E10000 MEND MACRO &lab _GetWMgrPort &lab ldx #$200E jsl $E10000 MEND MACRO &lab _GetWRefCon &lab ldx #$290E jsl $E10000 MEND MACRO &lab _GetWTitle &lab ldx #$0E0E jsl $E10000 MEND MACRO &lab _GetZoomRect &lab ldx #$370E jsl $E10000 MEND MACRO &lab _GrowWindow &lab ldx #$1B0E jsl $E10000 MEND MACRO &lab _HideWindow &lab ldx #$120E jsl $E10000 MEND MACRO &lab _HiliteWindow &lab ldx #$220E jsl $E10000 MEND MACRO &lab _InvalRect &lab ldx #$3A0E jsl $E10000 MEND MACRO &lab _InvalRgn &lab ldx #$3B0E jsl $E10000 MEND MACRO &lab _MoveWindow &lab ldx #$190E jsl $E10000 MEND MACRO &lab _NewWindow &lab ldx #$090E jsl $E10000 MEND MACRO &lab _PinRect &lab ldx #$210E jsl $E10000 MEND MACRO &lab _RefreshDesktop &lab ldx #$390E jsl $E10000 MEND MACRO &lab _SelectWindow &lab ldx #$110E jsl $E10000 MEND MACRO &lab _SendBehind &lab ldx #$140E jsl $E10000 MEND MACRO &lab _SetContentDraw &lab ldx #$490E jsl $E10000 MEND MACRO &lab _SetContentOrigin &lab ldx #$3F0E jsl $E10000 MEND MACRO &lab _SetContentOrigin2 &lab ldx #$570E jsl $E10000 MEND MACRO &lab _SetDataSize &lab ldx #$410E jsl $E10000 MEND MACRO &lab _SetDefProc &lab ldx #$320E jsl $E10000 MEND MACRO &lab _SetFrameColor &lab ldx #$0F0E jsl $E10000 MEND MACRO &lab _SetInfoDraw &lab ldx #$160E jsl $E10000 MEND MACRO &lab _SetInfoRefCon &lab ldx #$360E jsl $E10000 MEND MACRO &lab _SetMaxGrow &lab ldx #$430E jsl $E10000 MEND MACRO &lab _SetOriginMask &lab ldx #$340E jsl $E10000 MEND MACRO &lab _SetPage &lab ldx #$470E jsl $E10000 MEND MACRO &lab _SetScroll &lab ldx #$450E jsl $E10000 MEND MACRO &lab _SetSysWindow &lab ldx #$4B0E jsl $E10000 MEND MACRO &lab _SetWFrame &lab ldx #$2D0E jsl $E10000 MEND MACRO &lab _SetWindowIcons &lab ldx #$4E0E jsl $E10000 MEND MACRO &lab _SetWRefCon &lab ldx #$280E jsl $E10000 MEND MACRO &lab _SetWTitle &lab ldx #$0D0E jsl $E10000 MEND MACRO &lab _SetZoomRect &lab ldx #$380E jsl $E10000 MEND MACRO &lab _ShowHide &lab ldx #$230E jsl $E10000 MEND MACRO &lab _ShowWindow &lab ldx #$130E jsl $E10000 MEND MACRO &lab _SizeWindow &lab ldx #$1C0E jsl $E10000 MEND MACRO &lab _StartDrawing &lab ldx #$4D0E jsl $E10000 MEND MACRO &lab _StartInfoDrawing &lab ldx #$500E jsl $E10000 MEND MACRO &lab _TaskMaster &lab ldx #$1D0E jsl $E10000 MEND MACRO &lab _TrackGoAway &lab ldx #$180E jsl $E10000 MEND MACRO &lab _TrackZoom &lab ldx #$260E jsl $E10000 MEND MACRO &lab _ValidRect &lab ldx #$3C0E jsl $E10000 MEND MACRO &lab _ValidRgn &lab ldx #$3D0E jsl $E10000 MEND MACRO &lab _WindDragRect &lab ldx #$530E jsl $E10000 MEND MACRO &lab _WindNewRes &lab ldx #$250E jsl $E10000 MEND MACRO &lab _WindowGlobal &lab ldx #$560E jsl $E10000 MEND MACRO &lab _ZoomWindow &lab ldx #$270E jsl $E10000 MEND MACRO &lab _GetWindowMgrGlobals &lab ldx #$580E jsl $E10000 MEND MACRO &lab _StartFrameDrawing &lab ldx #$5A0E jsl $E10000 MEND MACRO &lab _EndFrameDrawing &lab ldx #$5B0E jsl $E10000 MEND MACRO &lab _DrawInfoBar &lab ldx #$550E jsl $E10000 MEND MACRO &lab _ResizeWindow &lab ldx #$5C0E jsl $E10000 MEND MACRO &lab _AlertWindow &lab ldx #$590E jsl $E10000 MEND ; File: M16.ALIAS ; ; ; Copyright Apple Computer, Inc. 1986 ; All Rights Reserved ; ; Memory Manager Aliases MACRO &lab _DisposHandle &lab ldx #2+256*16 jsl $E10000 MEND ; QuickDraw Aliases MACRO &lab _PenSize &lab ldx #4+256*44 jsl $E10000 MEND MACRO &lab _PenMode &lab ldx #4+256*46 jsl $E10000 MEND MACRO &lab _PenPat &lab ldx #4+256*48 jsl $E10000 MEND MACRO &lab _BackPat &lab ldx #4+256*52 jsl $E10000 MEND MACRO &lab _TextFace &lab ldx #4+256*154 jsl $E10000 MEND MACRO &lab _TextMode &lab ldx #4+256*156 jsl $E10000 MEND MACRO &lab _SpaceExtra &lab ldx #4+256*158 jsl $E10000 MEND MACRO &lab _TextSize &lab ldx #4+256*210 jsl $E10000 MEND MACRO &lab _SysDeath &lab ldx #$1503 jsl $E10000 MEND MACRO &lab _SysDeathMgr &lab ldx #$1503 jsl $E10000 MEND MACRO &lab _SystemDeath &lab ldx #$1503 jsl $E10000 MEND ;.............................................................................. ; ; StyleWare Macros` ; ; Macros...: AddWord, AddLong, SubWord, SubLong ; Author...: Mike Hibbetts, (2.0 conversion Scott Lindsey) ; Date.....: June 30, 1987 ... Oct 22,1988 ; Version..: 2.0 ; ; The following is a short description of the available addressing ; modes that may be used with the math macros in m16.math. ; ; Notes: 'a', 'x', and 'y' denote the 65816 registers. ; 's' denotes that an operand is to be either pulled or pushed. ; ; For programmer based optimization, it should be noted that all zero ; page indirect indexing is done out of the 'y' register, and all other ; indexing is done out of the 'x' register. So, for example, ; ; AddLong Addr:#4,[zp]:#4,>Long ; is better coded as ; ldy #4 ; AddLong Addr:y,[zp]:y,>Long, ; (it saves on 1 'ldx') ; and ; ; SubLong Addr1:#offset1,>Long:#offset2,Addr3 ; is better coded as ; ldy #offset2 ; SubLong Addr1:#offset1,>Long:y,Addr3. ; (it saves on 3 'ldx' and costs 1 'ldy') ; ; All other optimizations have been done internally to the macros. ;............................................................................. ; ; Where ; ; P = { Addr, Addr:#offset, Addr:offset, Addr:x, Addr:y, ; [zp], [zp]:#offset, [zp]:offset, [zp]:y, zp:s ; Long, Long:#offset, Long:offset, Long:x, s }, ; ; Q = { a, x, y, #const } + P, ; ; R = { #const } + P, and ; ; T = { a, x, y } + P, ; ; all ; ; AddWord Q,R,T ; AddLong Q,R,P ; SubWord Q,R,T ; SubLong Q,R,P ; ; are allowed. ; ;----------------------------------------------------------------------------- MACRO &lab AddWord &term1,&term2,&dest &lab ; Arith 2,adc,clc,&term1,&term2,&dest MEND ;---------------------------------------------------------------------------- MACRO &lab AddLong &term1,&term2,&dest &lab ; Arith 4,adc,clc,&term1,&term2,&dest MEND ;---------------------------------------------------------------------------- MACRO &lab SubWord &term1,&term2,&dest &lab ; Arith 2,sbc,sec,&term1,&term2,&dest MEND ;---------------------------------------------------------------------------- MACRO &lab SubLong &term1,&term2,&dest &lab ; Arith 4,sbc,sec,&term1,&term2,&dest MEND ;---------------------------------------------------------------------------- MACRO Arith &length,&op1,&op2,&term1,&term2,&dest lcla &same gbla &Yinc gblc &lastX lclc &lastY lcla &colon lcla &stack1 lcla &pull1 lcla &pull2 lcla &OFFinc lcla &zp1 lcla &zp2 lcla &zp3 gblc &pushed lclc &addr1 lclc &off1 lclc &addr2 lclc &off2 lclc &addr3 lclc &off3 lclc &badreg &badreg SETC 'y' lclc &jump1 lclc &jump2 lclc &jump3 IF &substr(&term1,1,1)'[' GOTO .doterm12 &zp1 seta 1 .doterm12 &colon seta &pos(':',&term1) IF &colon=0 GOTO .no1offset &off1 SETC &substr(&term1,&colon+1,&len(&term1)-&colon) &addr1 SETC &substr(&term1,1,&colon-1) GOTO .doterm21 .no1offset &addr1 SETC &term1 .doterm21 IF &substr(&term2,1,1)'[' GOTO .doterm22 &zp2 seta 1 .doterm22 &colon seta &pos(':',&term2) IF &colon=0 GOTO .no2offset &off2 SETC &substr(&term2,&colon+1,&len(&term2)-&colon) &addr2 SETC &substr(&term2,1,&colon-1) GOTO .dodest1 .no2offset &addr2 SETC &term2 .dodest1 IF &substr(&dest,1,1)'[' GOTO .dodest2 &zp3 seta 1 &badreg SETC 'x' .dodest2 &colon seta &pos(':',&dest) IF &colon=0 GOTO .no3offset &off3 SETC &substr(&dest,&colon+1,&len(&dest)-&colon) &addr3 SETC &substr(&dest,1,&colon-1) IF &off3'y' GOTO .start &badreg SETC 'x' GOTO .start .no3offset &addr3 SETC &dest IF &addr3'y' GOTO .start &badreg SETC 'x' .start IF &zp1 GOTO .loadzp1 IF &len(&off1) GOTO .withoff11 IF &addr1='a' GOTO .loadR1 IF &addr1='x' GOTO .loadx1 IF &addr1='y' GOTO .loady1 IF &addr1='s' GOTO .loads1 lda &addr1 &jump1 SETC '.load2' GOTO .loaded1 ; ----------------- .loadx1 txa GOTO .loadR1 .loady1 tya .loadR1 &jump1 SETC '.loadR2' GOTO .loaded1 ; ----------------- .loads1 IF &off2='s' GOTO .loads12 IF &off3='s' GOTO .loads12 IF &length='2' GOTO .loads11 &stack1 seta 1 .loads11 pla &jump1 SETC '.loads2' GOTO .loaded1 ; ----------------- .loads12 lda 1,s &jump1 SETC '.loads22' &pull1 seta 1 GOTO .loaded1 ; ----------------- .loadzp1 IF &len(&off1) GOTO .loadzpo1 lda &addr1 &jump1 SETC '.loadzp2' GOTO .loaded1 ; ----------------- .loadzpo1 IF &off1='y' GOTO .loadzpy1 &jump1 SETC '.loadzpo2' IF (&off2'y') and (&off3'y') GOTO .loadzpo12 phy &pushed SETC 'y' &jump1 SETC '.loadzpo22' .loadzpo12 ldy &off1 lda &addr1,y &lastY SETC &off1 GOTO .loaded1 ; ------------------ .loadzpy1 lda &addr1,&off1 &jump1 SETC '.loadzpy2' GOTO .loaded1 ; ------------------ .withoff11 IF &off1='x' GOTO .loffx1 IF &off1='y' GOTO .loffy1 IF &off1='s' GOTO .loffs1 &jump1 SETC '.loadoff2' IF (&off2'x') and (&off3'x') GOTO .withoff112 phx &pushed SETC 'x' &jump1 SETC '.loadoff22' .withoff112 ldx &off1 lda &addr1,x &lastX SETC &off1 GOTO .loaded1 ; ----------------- .loffx1 lda &addr1,x &jump1 SETC '.loffx2' GOTO .loaded1 ; ------------------- .loffy1 lda &addr1,y &jump1 SETC '.loffy2' GOTO .loaded1 ; ------------------- .loffs1 lda &addr1,s &jump1 SETC '.loffs2' .loaded1 &op2 IF &zp2 GOTO .addzp1 IF &len(&off2) GOTO .withoff12 IF &addr2='s' GOTO .adds11 &op1 &addr2 &jump2 SETC '.add2' GOTO .added1 ; ----------------- .adds11 STreset &pull2 seta 1 IF &pull1 GOTO .adds12 IF &stack1 GOTO .adds13 &op1 1,s &jump2 SETC '.adds21' GOTO .added1 ; ----------------- .adds12 &op1 1+&length,s &jump2 SETC '.adds22' GOTO .added1 ; ----------------- .adds13 &op1 3,s &jump2 SETC '.adds21' GOTO .added1 ; ----------------- .addzp1 IF &len(&off2) GOTO .addzpo1 &op1 &addr2 &jump2 SETC '.addzp2' GOTO .added1 ; ----------------- .addzpo1 IF &off2='y' GOTO .addzpy1 IF &len(&pushed) GOTO .addzpo12 IF &off3='y' GOTO .addzpo11 IF (&off1'y') or (&length='2') GOTO .addzpo12 .addzpo11 phy &pushed SETC 'y' .addzpo12 DoLoad 1,y,&off2 &op1 &addr2,y &jump2 SETC '.addzpo2' GOTO .added1 ; ------------------ .addzpy1 IF &pushed'y' GOTO .loadzpy12 ply &pushed SETC '' &lastY SETC '' .loadzpy12 &op1 &addr2,&off2 &jump2 SETC '.addzpy2' GOTO .added1 ; ------------------ .withoff12 IF &off2='x' GOTO .aoffx1 IF &off2='y' GOTO .aoffy1 IF &off2='s' GOTO .aoffs1 IF &len(&pushed) GOTO .withoff122 IF &off3='x' GOTO .withoff121 IF (&off1'x') or (&length='2') GOTO .withoff122 .withoff121 phx &pushed SETC 'x' .withoff122 DoLoad 1,x,&off2 &op1 &addr2,x &jump2 SETC '.addoff2' GOTO .added1 ; ----------------- .aoffx1 IF &pushed'x' GOTO .aoffx12 plx &pushed SETC '' &lastX SETC '' .aoffx12 &op1 &addr2,x &jump2 SETC '.aoffx2' GOTO .added1 ; ------------------- .aoffy1 IF &pushed'y' GOTO .aoffy12 ply &pushed SETC '' &lastY SETC '' .aoffy12 &op1 &addr2,y &jump2 SETC '.aoffy2' GOTO .added1 ; ------------------- .aoffs1 STreset &op1 &addr2,s &jump2 SETC '.aoffs2' .added1 IF &zp3 GOTO .storezp1 IF &len(&off3) GOTO .withoff13 IF &addr3='a' GOTO .storeR1 IF &addr3='x' GOTO .storex1 IF &addr3='y' GOTO .storey1 IF &addr3='s' GOTO .stores1 sta &addr3 &jump3 SETC '.store2' GOTO .stored1 ; ------------------ .storex1 tax GOTO .storeR1 .storey1 tay .storeR1 &jump3 SETC '.error1' GOTO .stored1 ; ------------------ .stores1 STreset IF &pull1 or &pull2 GOTO .stores12 IF &stack1 GOTO .stores13 IF &length='2' GOTO .stores111 pha .stores111 pha &jump3 SETC '.stores2' GOTO .stored1 ; ----------------- .stores12 IF &stack1 GOTO .stores14 sta 1,s &jump3 SETC '.stores2' &pull1 seta 0 &pull2 seta 0 GOTO .stored1 ; ----------------- .stores13 pha &jump1 SETC '.loads22' &jump3 SETC '.stores2' GOTO .stored1 ; ----------------- .stores14 sta 3,s &jump3 SETC '.stores2' &pull1 seta 0 &pull2 seta 0 GOTO .stored1 ; ------------------ .storezp1 IF &len(&off3) GOTO .storezpo1 sta &addr3 &jump3 SETC '.storezp2' GOTO .stored1 ; ----------------- .storezpo1 IF &off3='y' GOTO .storezpy1 IF &len(&pushed) or (&length='2') GOTO .storezpo12 IF (&off1'y') and (&off2'y') GOTO .storezpo12 phy &pushed SETC 'y' .storezpo12 DOLoad 1,y,&off3 sta &addr3,y &jump3 SETC '.storezpo2' GOTO .stored1 ; ------------------ .storezpy1 IF &pushed'y' GOTO .storezpy12 ply &pushed SETC '' &lastY SETC '' .storezpy12 sta &addr3,&off3 &jump3 SETC '.storezpy2' GOTO .stored1 ; ------------------ .withoff13 IF &off3='x' GOTO .soffx1 IF &off3='y' GOTO .soffy1 IF &off3='s' GOTO .soffs1 IF &len(&pushed) or (&length='2') GOTO .withoff132 IF (&off1'x') and (&off2'x') GOTO .withoff132 phx &pushed SETC 'x' .withoff132 DoLoad 1,x,&off3 sta &addr3,x &jump3 SETC '.storeoff2' GOTO .stored1 ; ----------------- .soffx1 IF &pushed'x' GOTO .soffx12 plx &pushed SETC '' &lastX SETC '' .soffx12 sta &addr3,x &jump3 SETC '.soffx2' GOTO .stored1 ; ------------------- .soffy1 IF &pushed'y' GOTO .soffy12 ply &pushed SETC '' &lastY SETC '' .soffy12 sta &addr3,y &jump3 SETC '.soffy2' GOTO .stored1 ; ------------------- .soffs1 STreset sta &addr3,s &jump3 SETC '.soffs2' .stored1 IF &length='2' GOTO .stored2 GOTO &jump1 ;-------------------------------------------------------------- .load2 HighByte lda,&addr1 GOTO .loaded2 ; ----------------- .loadR2 lda #0 GOTO .loaded2 ; ----------------- .loads2 STreset pla GOTO .loaded2 ; ----------------- .loads22 STreset lda 3,s GOTO .loaded2 ; ----------------- .loadzp2 IF &len(&pushed) GOTO .loadzp22 IF (&off2'y') and (&off3'y') GOTO .loadzp22 phy &pushed SETC 'y' .loadzp22 Load 1,y,#2 lda &addr1,y GOTO .loaded2 ; ----------------- .loadzpo22 IF &len(&pushed) GOTO .loadzpo2 phy &pushed SETC 'y' .loadzpo2 Load 2,y,&off1 lda &addr1,y GOTO .loaded2 ; ------------------ .loadzpy2 IF &pushed'y' GOTO .loadzpy21 ply &pushed SETC '' &lastY SETC '' .loadzpy21 doY lda &addr1,&off1 GOTO .loaded2 ; ------------------ .loadoff22 IF &len(&pushed) GOTO .loadoff2 phx &pushed SETC 'x' .loadoff2 DoLoad 1,x,&off1 lda &addr1+2,x GOTO .loaded2 ; ----------------- .loffx2 IF &pushed'x' GOTO .loffx21 plx &pushed SETC '' &lastX SETC '' .loffx21 lda &addr1+2,x GOTO .loaded2 ; ------------------- .loffy2 IF &pushed'y' GOTO .loffy21 ply &pushed SETC '' &lastY SETC '' .loffy21 IF &Yinc GOTO .loffy22 lda &addr1+2,y GOTO .loaded2 ; ------------------- .loffy22 lda &addr1,y GOTO .loaded2 ; ------------------- .loffs2 STreset lda &addr1+2,s .loaded2 GOTO &jump2 ;------------------------------ ;------------------------------ .add2 HighByte &op1,&addr2 GOTO .added2 ; ----------------- .adds21 STreset &op1 3,s GOTO .added2 ; ----------------- .adds22 &op1 3+&length,s GOTO .added2 ; ----------------- .addzp2 IF &len(&pushed) or (&off3'y') GOTO .addzp22 phy &pushed SETC 'y' .addzp22 DoLoad 1,y,#2 &op1 &addr2,y GOTO .added2 ; ----------------- .addzpo2 IF &len(&pushed) or (&off3'y') GOTO .addzpo22 phy &pushed SETC 'y' .addzpo22 DoLoad 2,y,&off2 &op1 &addr2,y GOTO .added2 ; ------------------ .addzpy2 IF &pushed'y' GOTO .addzpy22 ply &pushed SETC '' &lastY SETC '' .addzpy22 doY &op1 &addr2,&off2 GOTO .added2 ; ------------------ .addoff2 IF &len(&pushed) or (&off3'x') GOTO .addoff22 phx &pushed SETC 'x' .addoff22 DoLoad 1,x,&off2 &op1 &addr2+2,x GOTO .added2 ; ----------------- .aoffx2 IF &pushed'x' GOTO .aoffx22 plx &pushed SETC '' &lastX SETC '' .aoffx22 &op1 &addr2+2,x GOTO .added2 ; ------------------- .aoffy2 IF &pushed'y' GOTO .aoffy22 ply &pushed SETC '' &lastY SETC '' .aoffy22 IF &Yinc GOTO .aoffy23 &op1 &addr2+2,y GOTO .added2 ; ------------------- .aoffy23 &op1 &addr2,y GOTO .added2 ; ------------------- .aoffs2 STreset &op1 &addr2+2,s .added2 GOTO &jump3 ;------------------------------ ;------------------------------ .error1 MNOTE 'Register cannot hold long integer.',4 GOTO .stored2 ; ------------------ .store2 HighByte sta,&addr3 GOTO .stored2 ; ------------------ .stores2 STreset sta 3,s GOTO .stored2 ; ----------------- .storezp2 DoLoad 1,y,#2 sta &addr3,y GOTO .stored2 ; ----------------- .storezpo2 DoLoad 2,y,&off3 sta &addr3,y GOTO .stored2 ; ------------------ .storezpy2 IF &pushed'y' GOTO .storezpy22 ply &pushed SETC '' &lastY SETC '' .storezpy22 doY sta &addr3,&off3 GOTO .stored2 ; ------------------ .storeoff2 DoLoad 1,x,&off3 sta &addr3+2,x GOTO .stored2 ; ----------------- .soffx2 IF &pushed'x' GOTO .soffx22 plx &pushed SETC '' &lastX SETC '' .soffx22 sta &addr3+2,x GOTO .stored2 ; ------------------- .soffy2 IF &pushed'y' GOTO .soffy22 ply &pushed SETC '' &lastY SETC '' .soffy22 IF &Yinc GOTO .soffy23 sta &addr3+2,y GOTO .stored2 ; ------------------- .soffy23 sta &addr3,y GOTO .stored2 ; ------------------- .soffs2 STreset sta &addr3+2,s .stored2 IF &pull1=0 GOTO .stored210 IF &length='2' GOTO .stored205 pl&badreg .stored205 pl&badreg .stored210 IF &pull2=0 GOTO .stored220 IF &length='2' GOTO .stored215 pl&badreg .stored215 pl&badreg .stored220 MEND ;------------------------------------------------------------------------------ MACRO HighByte &oper,&loc lclc &c lclc &rest IF &substr(&loc,1,1)='#' GOTO .b &oper &loc+2 MEXIT .b &rest SETC &substr(&loc,2,&len(&loc)-1) &oper #^&rest MEND ;-------------------------------------------------------- MACRO DoLoad &half,®,&value IF &half='1' GOTO .c IF &substr(&value,1,1)='#' GOTO .a Check ®,&value IF &same GOTO .e ld® &value in® in® &OFFinc seta 1 MEXIT .e IF &OFFinc GOTO .done in® in® &OFFinc seta 1 MEXIT .a Check ®,&value+2 IF &same GOTO .done ld® &value+2 &OFFinc seta 1 MEXIT .c Check ®,&value IF &same GOTO .done ld® &value .done MEND ;----------------------------------------------------- MACRO doY GBLA &Yinc IF &Yinc GOTO .done &Yinc seta 1 iny iny .done MEND ;------------------------------------------------- MACRO STreset GBLC &pushed GBLC &lastX IF &len(&pushed)=0 GOTO .done IF &pushed='y' GOTO .d plx &pushed SETC '' &lastX SETC '' MEXIT .d ply &pushed SETC '' &lastY SETC '' .done MEND ;------------------------------------------------- MACRO Check ®,&string lcla &search IF ®='y' GOTO .regy IF &len(&lastx)&len(&string) GOTO .nomatchx &search seta &pos(&string,&lastx) IF &search=0 GOTO .nomatchx GOTO .match .regy IF &len(&lasty)&len(&string) GOTO .nomatchy &search ASEARCH &lasty,&string,1 IF &search=0 GOTO .nomatchy .match &same seta 1 MEXIT .nomatchx &same seta 0 &lastX SETC &string MEXIT .nomatchy &same seta 0 &lastY SETC &string MEND ;------------------------------------------------------ ;............................................................... ; ; Addwl - add word quickly to long word in place ;............................................................... MACRO &lab addwl &a1,&a2 &lab ; IF (&a1='a' or &a1='A') GOTO .a lda &a1 .a clc adc &a2 sta &a2 bcc ~b&sysindex inc &a2+2 ~b&sysindex ; mend ;............................................................... ; ; Subwl - sub word quickly to long word in place ;............................................................... MACRO &lab subwl &a1,&a2 &lab ; IF (&a1='a' or &a1='A') GOTO .a lda &a2 .a sec sbc &a1 sta &a2 bcs ~b&sysindex dec &a2+2 ~b&sysindex ; mend ;------------------------------------------------------ MACRO &lab mul2 &lab ; asl a MEND MACRO &lab mul4 ¶m &lab ; asl ¶m asl ¶m MEND MACRO &lab mul8 &lab ; asl a asl a asl a MEND MACRO &lab mul16 &lab ; asl a asl a asl a asl a MEND MACRO &lab mul32 &lab ; asl a asl a asl a asl a asl a MEND MACRO &lab div2 &lab ; lsr a MEND MACRO &lab div4 &op &lab ; lsr &op lsr &op MEND MACRO &lab div8 &lab ; lsr a lsr a lsr a MEND MACRO &lab div16 &lab ; lsr a lsr a lsr a lsr a MEND MACRO &lab div32 &lab ; lsr a lsr a lsr a lsr a lsr a MEND PRINT POP \ No newline at end of file diff --git a/appleworksgs/IW.CL/Src/dialogdata.asm b/appleworksgs/IW.CL/Src/dialogdata.asm new file mode 100755 index 0000000..c8a913b --- /dev/null +++ b/appleworksgs/IW.CL/Src/dialogdata.asm @@ -0,0 +1 @@ + STRING ASIS BLANKS OFF ;--------------------------------------------------------- ; ImageWriter Driver Version 2.2 ; Copyright Apple Computer, Inc. 1986-88 ; All rights reserved. ;--------------------------------------------------------- MACRO &lab str &string EXPORT &lab ; export the label LCLC &EIB ; declare a temporary var to hold current string setting &EIB SETC &SETTING('STRING') ; put current string setting into temp STRING PASCAL ; Set string type to pascal. &lab DC.B &string ; make the string STRING &EIB ; restore orig string settings MEND include 'e16.dialog' US equ 1 FR equ 2 Pays equ US IMPORT ScreenPort DialogData PROC EXPORT IF Pays=US GOTO .US IF Pays=FR GOTO .FR .US SlashStr str '/' namestr str 'ImageWriter' Paperstr str 'Paper:' P1str str 'US Letter' P2str str 'US Legal' p3str str 'A4 Letter' p4str str 'International Fanfold' p5str str 'Computer Paper' VsizeStr str 'Vertical Sizing:' Vsize1Str str 'Normal' VSize2Str str 'Condensed' SpeStr str 'Printer Effects:' Spe1str str '50% Reduction' Spe2str str 'No Gaps Between' GapPageStr str 'Pages' Orientstr str 'Orientation:' Okstr str 'OK' Cancelstr str 'Cancel' ColorStr str 'Color' DarkerStr str 'Darker' releaseStr str 'v2.2.2' ; d3 Qstr str 'Quality:' q1str str 'Better Text' q2str str 'Better Color' q3str str 'Draft' Pagestr str 'Page range:' pr1str str 'All' pr2str str 'From:' pr3str str 'To:' copstr str 'Copies:' PFeedstr str 'Paper Feed:' Pf1str str 'Automatic' Pf2str str 'Manual' Export InfoStrPrep InfoStrPrep DC.B EndInfoStrPrep-InfoStrPrep-1 DC.B 'Preparing Data ...' DC.B $0D EndInfoStrPrep ; EXPORT InfoStrDraft InfoStrDraft DC.B EndInfoStrDraft-InfoStrDraft-1 DC.B 'Printing in Draft mode ...' DC.B $0D EndInfoStrDraft ; EXPORT LowMemMsg LowMemMsg DC.B EndMSL1-LowMemMsg-1 DC.B 'There is not enough memory to print. ' DC.B $0D EndMSL1 ; EXPORT PrintProcess Printprocess ; EXPORT InfoStrPrint InfoStrPrint DC.B EndInfoStrPrint-InfoStrPrint-1 DC.B 'Printing in progress ...' DC.B $0D EndInfoStrPrint ; EXPORT CancelStrPrint CancelStrPrint DC.B EndCancelStrPrint-CancelStrPrint-1 DC.B '(Type ',$11,'. to cancel.)' ; EndCancelStrPrint ; GOTO .suite .FR SlashStr str '/' namestr str 'ImageWriter' Paperstr str 'Papier:' P1str str 'Lettre US' EXPORT P2str P2str DC.B 8 DC.B 'L' DC.B $8E DC.B 'gal US' p3str str 'Continu International' p4str str 'Format A4' p5str str 'Papier Informatique' VsizeStr str 'Vertical Sizing:' Vsize1Str str 'Normal' VSize2Str str 'Condensed' SpeStr str 'Printer Effects' Spe1str str 'Reduction 50 %' Spe2str str 'Pas de saut' GapPageStr str 'de page' Orientstr str 'Orientation' Okstr str 'OK' Cancelstr str 'Annuler' ColorStr str 'Couleur' releaseStr str ' vF1-2.2' EXPORT Qstr Qstr DC.B 8 DC.B 'Qualit' DC.B $8E DC.B ':' q1str str 'Superieure' ? q2str str 'Normale' ? q3str str 'Brouillon' Pagestr str 'Pages :' pr1str str 'Toutes' pr2str str 'De :' EXPORT pr3str pr3str DC.B 1 DC.B $88 copstr str 'Copies :' PFeedstr str 'Chargement :' Pf1str str 'Automatique' Pf2str str 'Manuel' EXPORT InfoStrPrep InfoStrPrep DC.B EndInfoStrPrep-InfoStrPrep-1 DC.B 'Preparation de l' 'impression ...',h'0D' EndInfoStrPrep ; EXPORT InfoStrDraft InfoStrDraft DC.B EndInfoStrDraft-InfoStrDraft-1 DC.B 'Impression en mode brouillon ...' DC.B $0D EndInfoStrDraft ; EXPORT PrintProcess Printprocess ; EXPORT InfoStrPrint InfoStrPrint DC.B EndInfoStrPrint-InfoStrPrint-1 DC.B 'Impression en cours ...' DC.B $0D EndInfoStrPrint ; .suite EXPORT PaperOutStr PaperOutStr DC.B EndPaperOutStr-PaperOutStr-1 DC.B 'The ImageWriter is out of paper.' DC.B $0D EndPaperOutStr ; EXPORT CoverOpenStr CoverOpenStr DC.B EndCoverOpenStr-CoverOpenStr-1 DC.B 'The cover of the ImageWriter is open.' DC.B $0D EndCoverOpenStr ; EXPORT PaperjamStr PaperjamStr DC.B EndPaperjamStr-PaperjamStr-1 DC.B 'The paper is jammed in the ImageWriter.' DC.B $0D EndPaperjamStr ; EXPORT OffLineStr OffLineStr DC.B EndOffLineStr-OffLineStr-1 DC.B 'The select switch is off on the ImageWriter.' DC.B $0D EndOffLineStr ; EXPORT ButtonState buttonstate DS.B 30 EXPORT EventRecord EXPORT EvtWhat EXPORT EvtMsg EXPORT EvtWhen EXPORT EvtWhere EXPORT EvtY EXPORT EvtX EXPORT EvtMods eventrecord evtwhat DS.B 2 evtmsg DS.B 4 evtwhen DS.B 4 evtwhere evty DS.B 2 evtx DS.B 2 evtmods DS.B 2 nullevent equ 0 mousedown equ 1 mouseup equ 2 keydown equ 3 autokey equ 5 updtevt equ 6 activevt equ 8 switchevt equ 9 deskaccevt equ 10 deviceevt equ 11 vr equ 8 hr equ 10 StyleUPLy equ 0 StyleUPLx equ 0 StyleLWRy equ 145 StyleLWRx equ 300 EXPORT StyleRect StyleRect DC.W 20,170,165,470 EXPORT l1 l1 DC.W styleuply+15,styleuplx+6 EXPORT l2 l2 DC.W styleuply+15,stylelwrx-6 EXPORT P1rect P1rect DC.W styleUply+26-vr,styleUplx+72-5-hr,styleuply+28,styleUplx+250 EXPORT P2rect P2rect DC.W styleUply+37-vr,styleUplx+72-5-hr,styleuply+39,styleUplx+250 EXPORT P3rect P3rect DC.W styleUply+48-vr,styleUplx+72-5-hr,styleuply+50,styleUplx+250 EXPORT P4rect P4rect DC.W styleUply+59-vr,styleUplx+72-5-hr,styleuply+61,styleUplx+250 EXPORT P5rect P5rect DC.W styleUply+70-vr,styleUplx+72-5-hr,styleuply+72,styleUplx+250 EXPORT v1rect v1rect DC.W styleUply+85-vr,styleUplx+25-hr,styleuply+87,styleUplx+150 EXPORT v2rect v2rect DC.W styleUply+98-vr,styleUplx+25-hr,styleuply+100,styleUplx+150 EXPORT s1rect s1rect DC.W styleUply+85-vr,styleUplx+158-hr,styleuply+87,styleUplx+310 EXPORT s2rect s2rect DC.W styleUply+98-vr,styleUplx+158-hr,styleuply+100,styleUplx+310 EXPORT o1rect o1rect DC.W styleuply+114,styleuplx+10,styleuply+143,styleuplx+40 EXPORT o2rect o2rect DC.W styleuply+114,styleuplx+47,styleuply+143,styleuplx+77 ;---------------------------------------- ; ; Job Dialogs Template ; ;---------------------------------------- EXPORT JobDTemplate JobDTemplate ; DC.W 20,170,165,470 ;dialogs rectangle DC.W 1 ;visible DC.L 0 ;Refcon DC.L JDIT1 ;Job dialogs item 1 template DC.L JDIT2 ;Job dialogs item 2 template DC.L JDIT3 ;Job dialogs item 3 template DC.L JDIT4 ;Job dialogs item 4 template DC.L JDIT5 ;Job dialogs item 5 template DC.L JDIT6 ;Job dialogs item 6 template DC.L JDIT7 ;Job dialogs item 7 template DC.L JDIT8 ;Job dialogs item 8 template DC.L JDIT9 ;Job dialogs item 9 template DC.L JDIT10 ;Job dialogs item 10 template DC.L JDIT11 ;Job dialogs item 11 template DC.L JDIT12 ;Job dialogs item 12 template DC.L JDIT13 ;Job dialogs item 13 template DC.L JDIT14 ;Job dialogs item 14 template DC.L 0 ;NIL pointer (terminator) ;---------------------------------------- ; ; Job Dialog items list ; ;---------------------------------------- ; ;Create the OK item ; JDIT1 ; DC.W 1 ;OK button (default for CR) EXPORT okrect okrect DC.W StyleLwry-5-13,stylelwrx-65,StyleLwry-5,stylelwrx-9 DC.W ButtonItem DC.L okstr DC.W 0 DC.W 0 DC.L 0 ; ;Create CANCLE item ; JDIT2 ; DC.W 2 ;CANCLE button EXPORT Cancelrect Cancelrect DC.W StyleLwry-5-13,stylelwrx-145,StyleLwry-5,stylelwrx-75 DC.W ButtonItem DC.L cancelstr DC.W 0 DC.W 0 DC.L 0 ; ;Create radio item BEST quality ; JDIT3 ; DC.W 3 ;BEST quality EXPORT q1Rect q1Rect DC.W styleUply+26-vr,styleUplx+100-5-hr,styleUply+28,styleUplx+200-5 DC.W RadioItem DC.L Q1str EXPORT JDRB0 JDRB0 DC.W 0 DC.W 1 DC.L 0 ; ;Create radio item FASTER ; JDIT4 ; DC.W 4 ;FASTER quality EXPORT q2Rect q2Rect DC.W styleUply+37-vr,styleUplx+100-5-hr,styleUply+39,styleUplx+200-5 DC.W RadioItem DC.L Q2str EXPORT JDRB1 JDRB1 DC.W 0 DC.W 1 DC.L 0 ; ;Create radio button item DRAFT ; JDIT5 ; DC.W 5 ;DRAFT quality EXPORT q3Rect q3Rect DC.W styleUply+48-vr,styleUplx+100-5-hr,styleUply+50,styleUplx+200-5 DC.W RadioItem DC.L Q3str EXPORT JDRB2 JDRB2 DC.W 0 DC.W $1 DC.L 0 ; ;Create page range radio item ALL ; JDIT6 ; DC.W 6 ;page range - ALL EXPORT Pr1rect Pr1rect DC.W styleUply+70-vr,styleUplx+100-5-hr,styleUply+72,styleUplx+200-5 DC.W RadioItem DC.L pr1str EXPORT JDRB3 JDRB3 DC.W 0 DC.W $2 DC.L 0 ; ;Create page range (From:__ To:__) radio button item ; JDIT7 ; DC.W 7 ;page range - from-to EXPORT Pr2Rect Pr2Rect DC.W styleUply+84-vr,StyleUplx+100-5-hr,styleUply+86,125 DC.W RadioItem DC.L pr2str EXPORT JDRB4 JDRB4 DC.W 0 DC.W $2 DC.L 0 ; ;Create AUTOMATIC paper feed radio button item ; JDIT8 ; DC.W 8 ;AUTOMATIC paper feed IF Pays=FR GOTO .FRPF1 EXPORT pf1rect pf1rect DC.W styleUply+112-vr,StyleUplx+100-5-hr,styleUply+114,StyleUplx+180 GOTO .FRXPF1 .FRPF1 EXPORT pf1rect pf1rect DC.W styleUply+112-vr,StyleUplx+105-5-hr,styleUply+114,StyleUplx+185 .FRXPF1 DC.W RadioItem DC.L pf1str EXPORT JDRB5 JDRB5 DC.W 0 DC.W $3 DC.L 0 ; ;Create HAND FEED paper feed radio button item ; JDIT9 ; DC.W 9 ;HAND FEED IF Pays=FR GOTO .FRPF2 EXPORT pf2rect pf2rect DC.W styleUply+112-vr,StyleUplx+200-5-hr,styleUply+114,StyleUplx+300 GOTO .FRXPF2 .FRPF2 EXPORT pf2rect pf2rect DC.W styleUply+112-vr,StyleUplx+220-5-hr,styleUply+114,StyleUplx+310 .FRXPF2 DC.W RadioItem DC.L pf2str EXPORT JDRB6 JDRB6 DC.W 0 DC.W 3 DC.L 0 * Draw the 3 edit lines ; ;Create the COPIES: edit line item ; JDIT10 ; DC.W 10 EXPORT CopieRect CopieRect DC.W 87,60,87+15,60+40 DC.W EditLine DC.L DefaultCopie DC.W 4 DC.W 0 DC.L 0 ; ;Create the TO: edit line item ; JDIT11 ; DC.W 11 EXPORT ToRect ToRect DC.W 73,230,73+15,230+40 DC.W EditLine DC.L DefaultTo DC.W 4 DC.W 0 DC.L 0 ; ;Create the FROM edit line item ; JDIT12 ; DC.W 12 EXPORT FromRect FromRect DC.W 73,150,73+15,150+40 DC.W EditLine DC.L DefaultFrom DC.W 4 DC.W 0 DC.L 0 ; ;Create the COLOR check box item ; JDIT13 ; DC.W 13 EXPORT ColorRect ColorRect DC.W StyleLwry-5-12-13,StyleUPLx+6,StyleLwry-5-12,StyleUPLx+6+100 DC.W CheckItem DC.L ColorStr EXPORT JDRB10 JDRB10 DC.W 0 DC.W 0 DC.L 0 ; ;Create the COLOR check box item ; JDIT14 ; DC.W 14 EXPORT DarkerRect DarkerRect DC.W StyleLwry-5-13,StyleUPLx+6,StyleLwry-5,StyleUPLx+6+100 DC.W CheckItem DC.L DarkerStr EXPORT JDRB11 JDRB11 DC.W 0 DC.W 0 DC.L 0 ;---------------------------------------- EXPORT Istrnum Istrnum DC.W 6 EXPORT Istrlist Istrlist DC.L releasestr DC.L paperstr DC.L vsizestr DC.L spestr DC.L gappagestr DC.L Orientstr EXPORT namepos namepos DC.W styleUPLy+13,StyleUplx+6 EXPORT IPosList Iposlist ; EXPORT releasepos releasepos DC.W styleUPLy+13,Stylelwrx-65 ;use -50 for final release w/o "d1" version number EXPORT Paperpos Paperpos DC.W styleUply+26,StyleUplx+6 EXPORT VSizepos VSizepos DC.W styleUply+73,StyleUplx+6 EXPORT Spepos Spepos DC.W styleUply+73,StyleUplx+135 EXPORT gappagepos gappagepos DC.W styleUply+108,StyleUplx+190 EXPORT Orientpos Orientpos DC.W styleUply+110,StyleUplx+6 EXPORT Astrnum Astrnum DC.W 9 EXPORT Astrlist Astrlist DC.L p1str DC.L p2str DC.L p3str DC.L p4str DC.L p5str DC.L Vsize1str DC.L Vsize2str DC.L spe1str DC.L spe2str EXPORT ARectlist ARectlist DC.L p1Rect DC.L p2Rect DC.L p3Rect DC.L p4Rect DC.L p5Rect DC.L v1Rect DC.L v2Rect DC.L s1Rect DC.L s2Rect DC.L OkRect DC.L CancelRect DC.L Okstr DC.L Cancelstr EXPORT PtrList ptrList DS.B 4*14 Aposlist ; EXPORT P1Pos P1Pos DC.W styleUply+26,styleUplx+72 EXPORT P2Pos P2Pos DC.W styleUply+37,styleUplx+72 EXPORT P3Pos P3Pos DC.W styleUply+48,styleUplx+72 EXPORT P4Pos P4Pos DC.W styleUply+59,styleUplx+72 EXPORT P5Pos P5Pos DC.W styleUply+70,styleUplx+72 EXPORT Vsize1Pos Vsize1Pos DC.W styleUply+85,styleUplx+20 EXPORT Vsize2Pos Vsize2Pos DC.W styleUply+98,styleUplx+20 EXPORT Spe1Pos Spe1Pos DC.W styleUply+85,styleUplx+162 EXPORT Spe2Pos Spe2Pos DC.W styleUply+98,styleUplx+162 EXPORT OKpos OKpos DC.W styleUPLy+18,Stylelwrx-50 EXPORT Cancelpos Cancelpos DC.W styleUPLy+38,Stylelwrx-60 EXPORT JArectlist JArectlist DC.L q1rect 0 DC.L q2rect 1 DC.L q3rect 2 DC.L pr1rect 3 DC.L pr2rect 4 DC.L pf1rect 5 DC.L pf2rect 6 EXPORT Jistrnum Jistrnum DC.W 6 EXPORT Jistrlist Jistrlist DC.L releasestr DC.L Qstr DC.L pagestr DC.L pr3str DC.L copstr DC.L pFeedstr EXPORT JAstrnum JAstrnum DC.W 7 EXPORT JAstrlist JAstrlist DC.L Q1str DC.L Q2str DC.L Q3str DC.L pr1str DC.L pr2str DC.L pf1str DC.L pf2str EXPORT Jnamepos Jnamepos DC.W styleUPLy+13,StyleUplx+6 EXPORT JIPosList JIposlist ; EXPORT Jreleasepos Jreleasepos DC.W styleUPLy+13,Stylelwrx-65 ;use -50 for final release w/o "d1" version number EXPORT Jqpos Jqpos DC.W styleUply+26,StyleUplx+6 EXPORT JPagePos JPagePos DC.W styleUply+59,styleUplx+6 EXPORT Jpr3Pos Jpr3Pos DC.W styleUply+84,styleUplx+200 EXPORT JcopPos JcopPos DC.W styleUply+98,styleUplx+6 EXPORT JPfeedPos JPfeedPos DC.W styleUply+112,styleUplx+6 EXPORT DefaultFrom DefaultFrom DC.B 0 DC.B ' ' EXPORT DefaultTo DefaultTo DC.B 0 DC.B ' ' EXPORT DefaultCopie DefaultCopie str '1' EXPORT pixel320 pixel320 DC.W 26 EXPORT pixel640 pixel640 DC.W 52 EXPORT PixelWidth pixelwidth DS.B 2 EXPORT PP_portrait PP_portrait ; DC.L portrait_p DC.L screenport DC.L portrait_r DC.L dstbitr1 DC.W 0 DC.L 0 EXPORT dstbitr1 dstbitr1 DC.W styleuply+116,styleuplx+12,styleuply+141,styleuplx+38+26 EXPORT dstbitf1 dstbitf1 DC.W styleuply+115,styleuplx+10,styleuply+143,styleuplx+40+26 EXPORT portrait_p portrait_p DC.W $80 DC.L portrait_bit DC.W 13 DC.W 0,0,25,52 EXPORT portrait_r portrait_r DC.W 0,0,25,52 EXPORT PP_Landsc PP_landsc ; DC.L landsc_p DC.L screenport DC.L landsc_r DC.L dstbitr2 DC.W 0 DC.L 0 EXPORT dstbitr2 dstbitr2 DC.W styleuply+116,styleuplx+49+26,styleuply+141,styleuplx+75+52 EXPORT dstbitf2 dstbitf2 DC.W styleuply+115,styleuplx+47+26,styleuply+143,styleuplx+77+52 EXPORT landsc_p landsc_p DC.W $80 DC.L landsc_bit DC.W 13 DC.W 0,0,25,52 EXPORT landsc_r landsc_r DC.W 0,0,25,52 EXPORt Portrait_Bit portrait_bit ; DC.B $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $FF,$F0,$00,$00,$00,$00,$00,$00,$0F,$FF,$FF,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$F0,$0F,$FF,$0F,$0F,$FF,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$0F,$F0,$FF,$0F,$F0,$FF,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$0F,$F0,$FF,$00,$00,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$F0,$0F,$FF,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$F0,$0F,$F0,$0F,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$0F,$FF,$FF,$F0,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$0F,$0F,$F0,$F0,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$0F,$0F,$F0,$F0,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$0F,$0F,$F0,$F0,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$0F,$0F,$F0,$F0,$FF,$FF,$0F,$FF,$FF ; EXPORT Dummy1 ;Dummy1 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $0F,$0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$F0,$F0 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$F0 DC.B $0F,$0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$F0,$F0 DC.B $0F,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$F0,$00 DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $0F,$0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF EXPORT Landsc_Bit landsc_bit ; DC.B $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $FF,$F0,$00,$00,$00,$00,$00,$00,$0F,$FF,$FF,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$00,$FF,$FF,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$0F,$0F,$FF,$FF,$FF DC.B $FF,$F0,$00,$00,$00,$00,$FF,$FF,$0F,$F0,$FF,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$FF,$0F,$FF,$00,$00,$0F,$FF,$FF DC.B $FF,$F0,$00,$00,$00,$FF,$0F,$00,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$FF,$F0,$FF,$0F,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$FF,$F0,$FF,$0F,$FF,$0F,$FF,$FF DC.B $FF,$F0,$00,$00,$00,$FF,$0F,$00,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$FF,$0F,$FF,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$0F,$FF,$FF DC.B $FF,$F0,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$0F,$FF,$FF ; EXPORT Dummy2 ;Dummy2 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $0F,$0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$F0,$F0 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$F0 DC.B $0F,$0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$F0,$F0 DC.B $0F,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$F0,$00 DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $0F,$0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$FF * Data for the info dialogs 640 EXPORT infoWidth320 infoWidth320 DC.W 300 EXPORT infowidth640 infowidth640 DC.W 600 EXPORT InfoDPort infoDPort DS.B 4 EXPORT InfoStrRect InfoStrRect DC.W 10,20,20,500 EXPORT AbortRect AbortRect DC.W 90,150,150,490 EXPORT AboutDPort AbortDPort DS.B 4 EXPORT IfCancelled IfCancelled DS.B 2 EXPORT StyleWidth Stylewidth DS.B 2 EXPORT DeadLoc deadloc DS.B 32 EXPORT CopieFinalValue CopieFinalValue DS.B 6 EXPORT FromFinalValue FromFinalValue DS.B 6 EXPORT ToFinalValue ToFinalValue DS.B 6 EXPORT InfoWindow InfoWindow ; EXPORT WinDef640 WinDef640 ; DC.W EndWDef640-WinDef640 DC.W %0010000000100000 ; wFrame DC.L 0 ; wTitle EXPORT HdlDoc640 HdlDoc640 DC.L 0 ; wRefCon DC.W 0,0,0,0 ; wZoom DC.L 0 ; wColor DC.W 0 ; wYOrigin,wXOrigin DC.W 0 DC.W 0 ; wDataH,wDataW DC.W 0 DC.W 0 ; wMaxH,wMaxW DC.W 0 DC.W 0 ; wScrollVer,wScrollHor DC.W 0 DC.W 0 ; wPageVer,wPageHor DC.W 0 DC.L 0 ; wInfoRefCon DC.W 0 ; wInfoHeight DC.L 0 ; wFrameDefProc DC.L 0 ; wInfoDefProc DC.L 0 ; wContDefProc EXPORT InfoRect InfoRect DC.W 30,40,60,600 DC.L $FFFFFFFF ; wPlane DC.L 0 ; wStorage EndWDef640 ; EXPORT InfoStrPos,CancelStrPos InfoStrPos DC.W 12,20 CancelStrPos DC.W 25,20 EXPORT EraseInfoRect EraseInfoRect DC.W 0,00,30,640 EXPORT InfoStrBuffer InfoStrBuffer DS.B 100 ;------------------------------------------------------------ ; ; data used by manual feed alert box ; ;------------------------------------------------------------ ; ; 640 mode ; EXPORT alerttemp640 alerttemp640 DC.W 30,40,75,600 ; bounds rect DC.W 1301 ; id DC.B $80 DC.B $80 DC.B $80 DC.B $80 DC.L item1_640 ; Continue DC.L item2_640 ; Cancel DC.L item3_640 ; text DC.L 0000 EXPORT item1_640 item1_640 DC.W 1 ; id DC.W 8,440,8+13,530 ; bounds rect for button DC.W ButtonItem ; type DC.L But1 ; item descriptor - "Continue" DC.W 00 ; item value DC.W 0 ; item flag DC.L 0 ; item color EXPORT item2_640 item2_640 DC.W 2 ; id DC.W 27,440,27+13,530 ; bounds rect for button DC.W ButtonItem ; type DC.L But2 ; item descriptor - "Cancel" DC.W 00 ; item value DC.W 0 ; item flag DC.L 0 ; item color EXPORT Msg1_640 Msg1_640 DC.B $0D DC.B 'Please insert the next sheet of paper into the' DC.B $0D DC.B 'ImageWriter, then click continue.' Len_Msg1_640 equ *-Msg1_640 EXPORT item3_640 item3_640 DC.W 3 ; id DC.W 3,35,43,400 ; bounds rect for text DC.W ItemDisable+LongStatText ; type DC.L Msg1_640 ; item descriptor DC.W Len_Msg1_640 ; item value DC.W 0 ; item flag DC.L 0 ; item color But1 str 'Continue' But2 str 'Cancel' ;------------------------------------------------------------ ; ; 320 mode ; EXPORT alerttemp320 alerttemp320 DC.W 30,10,95,310 ; bounds rect DC.W 1301 ; id DC.B $80 DC.B $80 DC.B $80 DC.B $80 DC.L item1_320 ; Continue DC.L item2_320 ; Cancel DC.L item3_320 ; text DC.L 0000 EXPORT item1_320 item1_320 DC.W 1 ; id DC.W 27,215,27+13,285 ; bounds rect for button DC.W ButtonItem ; type DC.L But1 ; item descriptor - "Continue" DC.W 00 ; item value DC.W 0 ; item flag DC.L 0 ; item color EXPORT item2_320 item2_320 DC.W 2 ; id DC.W 45,215,45+13,285 ; bounds rect for button DC.W ButtonItem ; type DC.L But2 ; item descriptor - "Cancel" DC.W 00 ; item value DC.W 0 ; item flag DC.L 0 ; item color EXPORT Msg1_320 Msg1_320 DC.B $0D DC.B 'Please insert the next' DC.B $0D DC.B 'sheet of paper into the' DC.B $0D DC.B 'ImageWriter, then click' DC.B $0D DC.B 'Continue.' Len_Msg1_320 equ *-Msg1_320 EXPORT item3_320 item3_320 DC.W 3 ; id DC.W 3,15,63,225 ; bounds rect for text DC.W ItemDisable+LongStatText ; type DC.L Msg1_320 ; item descriptor DC.W Len_Msg1_320 ; item value DC.W 0 ; item flag DC.L 0 ; item color ENDP END \ No newline at end of file diff --git a/appleworksgs/IW.CL/Src/hld.asm b/appleworksgs/IW.CL/Src/hld.asm new file mode 100755 index 0000000..39995f4 --- /dev/null +++ b/appleworksgs/IW.CL/Src/hld.asm @@ -0,0 +1 @@ +* high level * NOTE: All vector entries (PrOpenPage, etc...) get their data bank passed in A. * This means that they can phd, tcd correctly. Be careful what you do * at the beginning of one of these routines! MSL ; DynamicExits ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; Dynamic Exits ; ; ; Each dynamic exit takes 2 RTS and moves them some number of bytes up the ; stack. ; ;------------------------------------------------------------------------------ ;----------------------------------------------------------------------------- DynamicExits PROC EXPORT EXPORT exit20 exit20 tax lda 5,s sta 25,s lda 3,s sta 23,s lda 1,s sta 21,s tsc clc adc #20 tcs txa brl exit0 EXPORT Exit16 Exit16 tax lda 5,s sta 21,s lda 3,s sta 19,s lda 1,s sta 17,s tsc clc adc #16 tcs txa brl Exit0 EXPORT Exit14 Exit14 tax lda 5,s sta 19,s lda 3,s sta 17,s lda 1,s sta 15,s tsc clc adc #14 tcs txa brl Exit0 EXPORT Exit12 Exit12 tax lda 5,s sta 17,s lda 3,s sta 15,s lda 1,s sta 13,s tsc clc adc #12 tcs txa bra Exit0 EXPORT Exit10 Exit10 tax lda 5,s sta 15,s lda 3,s sta 13,s lda 1,s sta 11,s pla pla pla pla pla txa brl exit0 EXPORT Exit8 Exit8 tax lda 5,s sta 13,s lda 3,s sta 11,s lda 1,s sta 9,s pla pla pla pla txa brl Exit0 EXPORT Exit6 Exit6 tax lda 5,s sta 11,s lda 3,s sta 9,s lda 1,s sta 7,s pla pla pla txa brl Exit0 EXPORT Exit4 Exit4 tax lda 5,s sta 9,s lda 3,s sta 7,s lda 1,s sta 5,s pla pla txa brl Exit0 EXPORT Exit2 Exit2 tax lda 5,s sta 7,s lda 3,s sta 5,s lda 1,s sta 3,s pla txa EXPORT Exit0 Exit0 cmp #1 rtl ENDP ;----------------------------------------------------------- ; ; PortOffset ; ; This is the offset to fields in the grafport. ; DSECT 0 o_PortSCB WORD o_ImageRef LONG o_Width WORD o_BoundsRect BLOCK 8 o_PortRect BLOCK 8 o_ClipRgn LONG o_VisRgn LONG o_BkPat BLOCK 32 o_PnLoc BLOCK 4 o_PnSize BLOCK 4 o_PnMode WORD o_PnPat BLOCK 32 o_PnMask BLOCK 8 o_PnVis WORD EXPORT o_FontID EXPORT o_ChExtra o_Font LONG o_FontID LONG o_FontFlags WORD o_TxSize WORD o_TxFace WORD o_TxMode WORD o_SpExtra LONG o_ChExtra LONG o_FGColor WORD o_BGColor WORD o_PicSave LONG o_RgnSave LONG o_PolySave LONG o_GrafProcs LONG o_ArcRot WORD o_UserField LONG o_SysField LONG PortSize DSectSize ; ZP Equates ;------------------------------------------------------------------------------ ; ; Global and Zero Page Equates ; ;------------------------------------------------------------------------------ Temp1 equ 0 Temp values to dereference easily Temp2 equ temp1+4 4 hPicList equ temp2+4 a pPicList equ hPicList+4 e Ourport equ pPicList+4 12 hOurport equ OurPort+2 14 hNewPic equ hOurport+4 18 ourStatus equ hNewPic+4 1c hStatus equ ourStatus+2 1e hport equ hStatus+4 22 UserId equ hPort+4 26 hscreenport equ userId+2 28 pscreenport equ hscreenport+4 2c hprbuf equ pscreenport+4 30 pprbuf equ hprbuf+4 34 bandheight equ pprbuf+4 38 OldGraphProcs equ bandheight+2 3A PZ_PrStatus equ $C0 PZ_pPrPort equ PZ_PrStatus+4 PZ_hPrint equ PZ_pPrPort+4 TPrintsize equ 140 StatRecSize equ 28 oPrintDefault equ 0*5 oPrValidate equ 1*5 oPrStlDialog equ 2*5 oPrJobDialog equ 3*5 oPrDrvrVer equ 4*5 oPrOpenDoc equ 5*5 oPrCloseDoc equ 6*5 oPrOpenPage equ 7*5 oPrClosePage equ 8*5 oPrPicfile equ 9*5 oPrControl equ 10*5 oPrError equ 11*5 oPrSetError equ 12*5 oPrChanged equ 13*5 oPrPixelMap equ 14*5 * Error Codes noErr equ 0 iIOAbort equ -27 iMemFullErr equ -108 iPrAbort equ 128 ; PrtRecord.equ ***************************** * * * PrtRecordEqu * * * * Current Rev: Nov. 1987 * * * ***************************** Top equ 0 Left equ 2 Bottom equ 4 Right equ 6 * offset for the TPrint record length = 140 bytes iPrVersion equ 0 Integer Printing manager version number prInfo equ 2 subrecord Printer Info Subrecord rPaper equ 16 Rect prStl equ 24 SubRecord prInfoPT equ 42 SubRecord prXInfo equ 56 SubRecord prJob equ 80 SubRecord printx equ 100 Array[1..19] of integer (38 bytes) * prInfo subrecord length = 14 bytes idev equ 0 Integer iVRes equ 2 Integer iHRes equ 4 Integer rPage equ 6 Rect * iDev values bDevCitoh equ 1 image writer bDevLaser equ 3 Laser writer * TPrJob subrecord length = 20 bytes iFstPage equ 0 Integer iLstPage equ 2 Integer iCopies equ 4 Integer bjDocLoop equ 6 Signed byte fFromUsr equ 7 signed byte pIdleProc equ 8 Long address pFileName equ 12 Long address iFileVol equ 16 Integer ??? Unit number ??? bFileVers equ 18 signed byte bJobX equ 19 signed byte internal * bjDocLoop values bDraftLoop equ 0 bSpoolLoop equ 128 * TPrStl subrecord info length = 18 bytes wDev equ 0 Integer iPageV equ 2 nombres de points par page iPageH equ 4 bPort equ 6 Refnum feed equ 8 PaperType equ 10 CRwidth equ 12 * valeur du feed feedcut equ 0 feedfanFold equ 1 * values linked to wDev f0 equ 1 hires f1 equ 2 portrait f2 equ 4 double vertical density f3 equ 8 2x zoom f4 equ 16 scroll f5 equ 32 color/bw f6 equ 64 Gap f7 equ 128 Darker * TprXInfo subrecord info length = 24 bytes iRowBytes equ 0 Integer iBandV equ 2 Integer iBandH equ 4 Integer iDevBytes equ 6 Integer ibands equ 8 Integer bPatScale equ 10 byte bULThick equ 11 byte bULOffset equ 12 byte bULShadow equ 13 byte scan equ 14 tscan bXInfoX equ 16 reserved SCBList equ 18 pointer to a list of modes. scanTB equ 0 scanBT equ 1 scanLR equ 2 scanRL equ 3 * TPrStatus record length = 28 bytes iTotPages equ 0 iCurpage equ 2 iTotCopies equ 4 iCurCopy equ 6 iTotBands equ 8 iCurBand equ 10 fPgDirty equ 12 fImaging equ 14 ShPrint equ 16 pPrPort equ 20 hPic equ 24 ; PrtRecord.Dflt ;Default print record ***************************** * * * PrtRecordDflt * * * * Current Rev: Nov 1987 * * * ***************************** PrtRecordDflt PROC EXPORT Export hPrint_test hPrint_test DC.L pPrint_test Export pPrint_test pPrint_test DC.L Print_test EXPORT PRINT_TEST Print_test * offset for the TPrint record length = 140 bytes DC.B $02,$02 *iPrVersion equ 0 *prInfo equ 2 subrecord Printer Info Subrecord * prInfo subrecord length = 14 bytes DC.W 1 *idev equ 0 DC.W 72 *iVRes equ 2 DC.W 80 *iHRes equ 4 DC.W 0,0,396,640 *rPage $$$$$ equ 6 DC.W -36,-20,752,660 *rPaper equ 16 * *prStl equ 24 SubRecord * TPrStl subrecord info length = 18 bytes ; ; wDev is set initially to be normal quality, portrait, normal vertical ; density, no reduction, B/W, and with gap. ; DC.W f1+f2+f3+f6 wDev equ 0 DC.W 1320 iPageV equ 2 DC.W 1020 iPageH equ 4 DC.W 0 bPort equ 6 DC.W 1 feed equ 8 DC.W 0 PaperType equ 10 DC.W 960 CRwidth equ 12 DC.W 0 reserved DC.W 0 *prInfoPT equ 42 SubRecord DC.W 0 *idev equ 0 DC.W 72 *iVRes equ 2 DC.W 80 *iHRes equ 4 DC.W 0,0,396,640 *rPage equ 6 *prXInfo equ 56 SubRecord DC.W 80 iRowBytes equ 0 DC.W 32 iBandV equ 2 DC.W 640 iBandH equ 4 DC.W 10240 iDevBytes equ 6 DC.W 12 ibands equ 8 DC.B 0 bPatScale equ 10 DC.B 1 bULThick equ 11 DC.B 1 bULOffset equ 12 DC.B 1 bULShadow equ 13 DC.B 0 scan equ 14 DC.B 0 bXInfoX equ 16 DCB.B 8,0 reserved *prJob equ 80 SubRecord * TPrJob subrecord length = 20 bytes DC.W 1 iFstPage equ 0 DC.W 9999 iLstPage equ 2 DC.W 1 iCopies equ 4 DC.B $80 bjDocLoop equ 6 DC.B 1 fFromUsr equ 7 DC.L 0 pIdleProc equ 8 DC.L 0 pFileName equ 12 DC.W 0 iFileVol equ 16 DC.B 0 bFileVers equ 18 DC.B 0 bJobX equ 19 *printx equ 100 Array[1..19] of integer (38 bytes) DC.W 0 plus two reserved bytes DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W 0 *TPrintsize equ 140 Export Gap Gap DC.W 0 DC.W 60 Export Vres Vres DC.W 36 DC.W 72 Export Hres Hres DC.W 40 DC.W 80 Export PaperVsize PaperVsize DC.W 1320 DC.W 1680 DC.W 1400 DC.W 1440 Export PaperHsize PaperHsize DC.W 1020 DC.W 1020 DC.W 990 DC.W 990 Export CarriageWidth CarriageWidth DC.W 960 DC.W 960 DC.W 960 DC.W 960 * US Letter/640 portrait gap: 36 80 0 0 378 640 -9 -20 387 660 * US Letter/640 landscape gap: 40 72 0 0 320 756 -10 -18 330 774 ENDP ; Maindata ***************************** * * * MainData * * * * Current Rev: Nov. 1987 * * * ***************************** MainData PROC EXPORT Export EndTime,DrawTime,PortTime,TmpTime,StartTime StartTime DS.B 4 EndTime DS.B 4 DrawTime DS.B 4 PortTime DS.B 4 TmpTime DS.B 4 Export ZeroPage ZeroPage DS.B 2 Export iPrErr iPrErr DS.B 2 Export iPageNum iPageNum DS.B 2 Export PicListCount PicListCount DS.B 2 ; count of pages used in piclist Export iDocPage iDocPage DS.B 2 Export Method Method DS.B 2 Export hPrint hprint DS.B 140 TPrintsize Export rBand rBand DS.B 8 rect Export LinesLeftOnPage LinesLeftOnPage DS.B 2 ; # of lines left to be printed Export LinesPerPage LinesPerPage DS.B 2 ; total # of lines on each page Export resolution resolution DS.B 2 Export MainUserID MainUserID DS.B 2 Export BandPort BandPort DS.B portsize Export ScreenPort ScreenPort DS.B portsize Export OurStatusRecord OurStatusRecord DS.B StatRecSize ; ; flag to indicated if status or progress messages can be displayed, set to ; false by PrPixelMap since it doesn't put up a window ; EXPORT NoShowMessage NoShowMessage DS.B 2 EXPORT PStatus PStatus DS.B 2 ; printer status: 0 = OK EXPORT CursorAd CursorAd DS.B 4 Export BandLoc BandLoc DS.B 20 Export RectSize1 RectSize1 DC.W 0,0,$10,$10 Export RectSize2 RectSize2 DC.W 0,0,$20,$20 Export SizingRect SizingRect DS.B 8 Export hugeRect hugeRect DC.W 0,0,16382,16382 * you'd better not to be outside this hugeRect !!! Export PPParms PPParms DC.L BandPort DC.L ScreenPort DC.L BandLoc+8 DC.L destpoint DC.W 0 ; PenCopy DC.W 0 ; maskhandle DC.W 0 Export destpoint destpoint DC.W 0,0,32,320 home Export Pt1 Pt1 DC.W 20,25 Export Pt2 Pt2 DC.W 110,60 Export Pt3 Pt3 DC.W 5,210 if LQ=1 goto .notimagewriter EXPORT Printer_name Printer_name str '=' str 'ImageWriter' str '*' goto .notlq .notimagewriter EXPORT Printer_name Printer_name str '=' str 'LQ' str '*' .notlq Export TESTRECT TESTRECT DC.W 15,20,100,200 Export white white DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff DC.W $ffff Export gris gris DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 DC.W $8888 Export DeadLoc2 DeadLoc2 DS.B 32 Export LLD_PaperRect LLD_PaperRect DS.B 8 ENDP ; ErrorCalls.ASM ;_PrError, _PrSetError ;***************************************************************************** ;***************************************************************************** ; ; NAME: PrError ; ; PURPOSE: High level printer routine "_PrError" which returns last error ; that has occured (iPrErr). ; ; PASSED: (None) ; ; RETURNED: LastError WORD, last error that occured. ; ;***************************************************************************** ;***************************************************************************** PrError PROC EXPORT DefineStack * iPrErr * parameters * error value Error_DPage word 0 Error_BReg byte 0 Error_rtl1 block 3 Error_rtl2 block 3 Error_Value word 0 phd tcd phb phk plb lda iPrErr ;get the error value sta Error_Value,s ;return it on the stack lda #0 plb pld jmp exit0 EJECT ;***************************************************************************** ;***************************************************************************** ; ; NAME: PrSetError ; ; PURPOSE: High level printer routine "_PrSetError" which sets the error ; value (iPrErr). ; ; PASSED: ErrorNumber WORD, error number to be saved. ; ; RETURNED: (NONE) ; ;***************************************************************************** ;***************************************************************************** EXPORT PrSetError PrSetError * parameters * error value DefineStack SetError_DPage word 0 SetError_BReg byte 0 SetError_rtl1 block 3 SetError_rtl2 block 3 SetError_value word 0 phd tcd phb phk plb lda SetError_value,s ;get the passed error value sta iPrErr ;save it at iPrErr cmp #$0080 bne NoCancel lda DraftFlag beq NoCancel pea 0 pea 0 _SetGrafProcs stz DraftFlag NoCancel lda #0 plb pld jmp exit2 ENDP EJECT ;***************************************************************************** ;***************************************************************************** ; ; NAME: PrChanged ; ; PURPOSE: This routine calls the port driver with the name and type ; of this printer (IMAGEWRITER). ; ; PASSED: ; ; RETURNED: (NONE) ; ;***************************************************************************** ;***************************************************************************** PrChanged PROC EXPORT phd phb phk plb tcd PushPtr Printer_Name _PrDevPrChanged plb pld jmp exit0 ENDP ; DraftProcs ;****************************************************************************** ;****************************************************************************** ;** ** ;** ** ;** I M M E D I A T E M O D E P R O C S. ** ;** ** ;** ** ;****************************************************************************** ;****************************************************************************** Draftprocs PROC EXPORT ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; Standard Pixel Procedure (Prints Pixel Maps) ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ EXPORT Pixel Pixel ;---------------------------------------------------------------------- ; ; QuickDraw II's zeropage equates ; QdPort equ $24 SrcPixelMapRef equ $CE ; ptr to src pixel map SrcWidth equ $D2 ; width of src pixel map SrcBounds equ $D4 ; bounds rect of src pixel map SrcRect equ $DC DestRect equ $1C DrawVerb equ $38 TextPtr equ $da textLength equ $d8 chartodraw equ $d6 phb phk plb lda iPrErr beq Continue exitnow brl ExitPixel ;---------------------------------------------------------------------- ; ; Gets information about the source pixel map from QD's zero page. ; Continue ; lda [QdPort] ; SCB sta pixelLoc lda srcPixelMapRef ; pointer to the pixel map sta pixelLoc+2 lda srcPixelMapRef+2 sta pixelLoc+4 lda SrcWidth ; width of pixel map sta pixelLoc+6 ldx #6 ; bounds rect moveBounds lda srcBounds,x sta PixelLoc+8,x dex dex bpl moveBounds PushWord #0 ; Result PushWord #0 ; bank address of zero page tdc ; transfer direct page into acc clc adc #srcBounds ; get actual address of srcBounds pha PushWord #0 ; bank address of zero page tdc ; transfer direct page into acc clc adc #srcRect ; get actual address of srcRect pha PushLong #PixelRect ; intersected rect goes here _SectRect pla beq ExitPixel ; if false, no intersection ;--------------------------------------------------------------- ; ; Look at the source rect. If its upper/left corner is 0,0 ; then no adjustment is necessary. If it is not 0,0, we must ; adjust the pointer to the pixel map so that it points to ; the first pixel in the source rect. ; ; Note that this scheme does not work with source rects that ; do not have the first pixel to draw as the first pixel in ; a byte. ; lda PixelRect sec sbc PixelLoc+8 beq NoAdjustmentY pha ; space for result pha pha ; Top of src rect PushWord PixelLoc+6 ; width _Multiply pla clc adc PixelLoc+2 sta PixelLoc+2 pla adc PixelLoc+4 sta PixelLoc+4 NoAdjustmentY ; lda PixelRect+2 sec sbc PixelLoc+10 beq NoAdjustmentX lsr a bit PixelLoc-1 bpl ModeWas320 lsr a ModeWas320 clc adc PixelLoc+2 sta PixelLoc+2 bcc NoCarryHere inc PixelLoc+4 NoCarryHere ; NoAdjustmentX ; lda PixelRect sta PixelLoc+8 lda PixelRect+2 sta PixelLoc+10 lda PixelRect+4 sta PixelLoc+12 lda PixelRect+6 sta PixelLoc+14 ;------------------------------------------------------------ ; ; Call LLDBitMap using the adjusted (if necessary) values in ; PixelLoc and PixelRect. ; pushptr PixelLoc ; source Loc info pushptr PixelRect ; source rect pushword MainUserID lda hprint+prstl+wdev and #f7 jsl LLDBitmap lda #0 ExitPixel clc plb rtl PixelLoc DS.B 16 ; changed from 8 to 16 by Suki 6/1/87 PixelRect DS.B 8 ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; _StdText Procedure (Prints Standard Text) ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ EXPORT DraftText DraftText phb ;save data bank reg. on stack phk ;get program bank reg. plb ;use as data bank reg. PushPtr PenPos _GetPen ;current pen pos. -> PenPos * here we move the printer head to penpos asl PenPos lda hPrint+prStl+wdev and #f2 ; condensed? beq By2Only ; yes, skip the next multiply asl PenPos * I think PenPos is in 144 th/inch vertically. By2Only PushLong PenPos pushword MainUserID jsl LLDSetPenPos PushWord #0 ;space for textwidth ; ;(for call to _TextWidth) lda DrawVerb ;get the DrawVerb beq DoCar ;if DrawVerb=0 then DoCar cmp #1 beq dotext2 ;if DrawVerb=1 then DoText2 ; ;We get here if it's a "C" string (DrawVerb=2) ; DoCstring ; ; Cstrings are handled differently sep #$20 ; since the string is terminated longa off ; by a 0 and no length is kept ;Search down through string looking for terminator to calculate length ldy #0 KeepLooking lda [TextPtr],y beq TheEnd iny bra KeepLooking TheEnd rep #$20 longa on lda TextPtr+2 pha ;push the pointer to string lda Textptr pha phy ;push the length of string bra common ; ;We get here if it's just one character (DrawVerb=0) ; DoCar ; pushword #0 tdc clc adc #chartodraw ;calculate addr. of char. pha ;push addr. of character Pushword #1 ;push length of one char. bra common ; ;We get here if it's a string of text (DrawVerb=1) ; DoText2 ; lda TextPtr+2 pha ;push pointer to the string lda Textptr pha lda textLength pha ;push the strings length common lda 5,s ; Dup the last 3 words on the pha ; stack to be used with TextWidth lda 5,s pha lda 5,s pha * here we send the text on the printer pushword MainUserID ;----------------------------------------------------------------------- ; ; The stack should look like this at this point: ; ... ; 00 (result space) -- ; TextPtr | parameters for TextWidth ; length -- ; TextPtr -- ; length | parameters for PrText ; UserID -- ; sp -> jsl LLDText ;print the text _TextWidth ;get the texts width (DH) Pushword #0 ;set (DV)=0 _move ;move current pen location ExitText lda #0 ;return with no errors clc plb ;restore data bank rtl PenPos DS.B 4 ENDP ; ; Metrics ;_PrDefault, _PrValidate, _PrStlDialog ; ;_PrJobDialog metrics PROC EXPORT ;***************************************************************************** ;***************************************************************************** ; ; NAME: PrDefault ; ; PURPOSE: High level printer routine "_PrDefault" which fills the fields ; of the specified print record with default values for this ; particular printer. ; ; PASSED: PrintRecordHandle LONG, Handle to print record. ; ; RETURNED: (None) ; ;***************************************************************************** ;***************************************************************************** EXPORT PrDefault PrDefault EXPORT PrintDefault ;alias for PrDefault PrintDefault * parameters * hprint DefineStack Default_DPage word 0 Default_BReg byte 0 Default_rtl1 block 3 Default_rtl2 block 3 Default_hprint long 0 phd tcd phb phk plb sta ZeroPage ;See if user passed a valid handle lda Default_hPrint,s ora Default_hPrint+2,s bne notNIL ; ;We arrive here if an invalid handle, we must flag as an error ; lda #NoPrintRecord bra Exit notNil ; * read the handle ; ;Copy the default print record "Print_test" to internal hprint buffer ; ; ; Transfer the print record to the internal print record, ; this is necessary because CiXmetrics expects the print ; record in hprint ; pushptr Print_test pushptr hprint pushlong #TPrintsize _blockmove jsr CiXmetrics ;set metrics from defaults ; ;Dereference the "PrintRecordHandle" that was passed to Temp1 ; lda Default_hPrint,s sta temp1 lda Default_hPrint+2,s sta Temp1+2 pushlong #hprint ; moves good values into pushlong Temp1 ; application's print record pushlong #TPrintSize _PtrToHand bcs Exit ; memory manager error lda #$0000 exit plb pld jmp exit4 EJECT ;***************************************************************************** ;***************************************************************************** ; ; NAME: PrValidate ; ; PURPOSE: High level printer routine "_PrValidate" which checks the ; specified print record for compatibility with the printer. ; If the print record is valid, it returns FALSE, and if it ; is invalid, it returns TRUE and adjusts the print record ; values to the defaults. ; ; PASSED: PrintRecordHandle LONG, Handle to the print record. ; ; RETURNED: ChangeFlag WORD, Boolean. ; ;***************************************************************************** ;***************************************************************************** EXPORT PrValidate PrValidate * parameters * results * hPrint DefineStack Validate_DPage word 0 ;Saved D-Page Validate_BReg byte 0 ;Saved B-Reg. Validate_rtl1 block 3 Validate_rtl2 block 3 Validate_hPrint long 0 ;Passed print record handle Validate_Result word 0 ;returned changeflag phd ;save the d page reg. tcd phb phk plb lda #False ; assume no change to print sta Validate_Result,s ; record at start lda Validate_hPrint,s ; get the handle off the stack sta temp1 ; and put into a temp location lda Validate_hPrint+2,s sta Temp1+2 ;------------------------------------------------------------ ; ; Transfer the print record to the internal print record, ; this is necessary because CiXmetrics expects the print ; record in hprint ; PushLong Temp1 PushLong #hprint PushLong #TPrintSize _HandToPtr bcs ErrorExit ; memory manager error ;----------------------------------------------------------------- ; ; Test if correct printer type ( 1 = imagewriter 3 = Laserwriter ) ; and correct version number ; lda hprint+prInfo+idev cmp #1 ; this is ImageWriter driver bne WrongType lda hprint+iPrVersion ; check if correct version xba ; swap since hi-lo bytes are cmp #VersionNb ; swapped during lda beq GoodType WrongType pushptr Print_test ; move default values in pushptr hprint pushlong #TPrintSize _blockmove lda #True ; set result to reflect a sta Validate_Result,s ; change in print record GoodType ; jsr CiXmetrics pushlong #hprint pushlong Temp1 pushlong #TPrintSize _PtrToHand bcs ErrorExit ; memory manager error lda #0 ErrorExit plb pld jmp exit4 EJECT ;***************************************************************************** ;***************************************************************************** ; ; NAME: PrStlDialog ; ; PURPOSE: High level printer routine "_PrStlDialog", which performs a ; style dialog with the user. The initial settings are taken ; from the print record. If the user confirms the dialog, the ; results are saved in the print record and "_PrValidate" is ; called and the routine returns TRUE. If not, the print record ; is left unchanged and returns FALSE. ; ; PASSED: PrintRecordHandle LONG, Handle to the print record. ; ; RETURNED: ConfirmFlag WORD, Boolean. ; ;***************************************************************************** ;***************************************************************************** * buttonstate for Style * +0 US Letter Default * +2*1 US Legal * +2*2 Computer Paper * +2*3 A4 Letter * +2*4 International Fanfold * +2*5 Condensed Vsizing * +2*6 50% reduction * +2*7 No Gaps Between Pages * +2*8 Portrait * +2*9 Landscape * +2*10 Normal Vsizing EXPORT PrStlDialog PrStlDialog * parameters * results * hPrint DefineStack StlDialog_DPage word 0 StlDialog_BReg byte 0 StlDialog_rtl1 block 3 StlDialog_rtl2 block 3 StlDialog_hPrint long 0 ;PrintRecordHandle StlDialog_result word 0 ;ConfirmFlag results phd tcd phb phk plb sta ZeroPage ;Copy the passed "PrintRecordHandle" to PZ_hprint and lock it lda StlDialog_hPrint,s sta PZ_hprint lda StlDialog_hPrint+2,s sta PZ_hprint+2 pushlong PZ_hprint _hlock _error ; ; call PrValidate to check if printer type is same ; PushWord #0 PushLong PZ_hprint _PrValidate ;validate the print record plx bcc MoveOn brl ErrorExit1 ; memory manager error ; MoveOn lda [PZ_hprint] tax ldy #2 lda [PZ_hprint],y sta PZ_hprint+2 ;dereferences stx PZ_hprint ; ;Copy the passed print record data to the internal print record "hprint". ; ldy #TPrintsize-2 pair slooph lda [PZ_hprint],y sta hprint,y dey dey bpl slooph ; ;Clear all the button states ; lda #$0000 ldx #26 clrbtn sta buttonstate,x dex dex bpl clrbtn ; ;Validate paper type and sets the appropriate button state ; lda hprint+prStl+PaperType cmp #4 blt valid ;We get here if the paper type is invalid (default to zero) stz hprint+prStl+PaperType lda #0 Valid ; what if the prtrecord asl a ; never did go through tax ; prdefault ;This sets the appropriate button state lda #$ffff sta buttonstate,x ; et voila pour le papier ; ;This initilizes the portrait/landscape buttonstate ; lda hprint+prstl+wdev and #f1 ;check for portrait mode beq do9 dec buttonstate+2*8 ;set portrait bra over9 do9 dec buttonstate+2*9 ;set landscape over9 ; ; ;This initilizes the 50% reduction buttonstate ; lda hprint+prstl+wdev and #f3 ;check for 50% reduction bne over6 dec buttonstate+2*6 ;set 50% reduction over6 ; ; ;This initilizes the no GAP buttonstate ; lda hprint+prstl+wdev and #f6 ;check for no GAP bne over7 dec buttonstate+2*7 ;set for no GAP over7 ; lda hprint+prstl+wdev and #f2 2Vsize beq do5 dec buttonstate+2*10 bra over5 do5 dec buttonstate+2*5 over5 ; ;------------------------------------------------------------------------------ ;Now call "StyleDialog" to do the actual dialog work ;------------------------------------------------------------------------------ jsr styledialog sta StlDialog_result,s ;save results on stack bne okStyle ;branch if confirmed dialog brl outStyle ;branch if canceled dialog ; ;We get here if the user confirmed and we can update the print record ; okStyle ; * +0 US Letter Default * +2*1 US Legal * +2*2 International Fanfold * +2*3 A4 Letter * +2*4 Computer Paper ; ;Now figure out which paper size was selected ; ldx #0 lda buttonstate+2*0 ;see if US Letter bmi NewPaperSize inx lda buttonstate+2*1 ;see if US legal bmi NewPaperSize inx lda buttonstate+2*2 ;see if Internationl Fanfold bmi NewPaperSize inx NewPaperSize stx hprint+prStl+PaperType ;now set paper type ; ;Now see about vertical sizing ; lda #f2 2Vsize tsb hprint+prstl+wdev bit buttonstate+2*5 bpl no2 trb hprint+prstl+wdev no2 ; ; ;Now see if GAP or NO GAP was selected ; lda #f6 Gap tsb hprint+prstl+wdev bit buttonstate+2*7 bpl no6 trb hprint+prstl+wdev no6 ; ; ;Now see if 50% reduction was selected ; lda #f3 2x zoom tsb hprint+prstl+wdev bit buttonstate+2*6 bpl no3 trb hprint+prstl+wdev no3 ; ; ;Now see which of portrait/landscape was selected ; lda #f1 portrait tsb hprint+prstl+wdev bit buttonstate+2*9 bpl no1 trb hprint+prstl+wdev no1 ; Jsr CiXmetrics ;go calculate the metrics ; ;Now copy the internal print record to the users ; ldy #TPrintsize-2 pair slooph2 lda hprint,y sta [PZ_hprint],y dey dey bpl slooph2 ; ;We get here when we are done or the user canceled the dialog ; OutStyle lda #0 ErrorExit1 plb pld jmp exit4 EJECT ;***************************************************************************** ;***************************************************************************** ; ; NAME: PrJobDialog ; ; PURPOSE: High level printer routine "_PrStlDialog", which performs a ; job dialog with the user. The initial settings are taken ; from the print record. If the user confirms the dialog, the ; results are saved in the print record and "_PrValidate" is ; called and the routine returns TRUE. If not, the print record ; is left unchanged and returns FALSE. ; ; PASSED: PrintRecordHandle LONG, Handle to the print record. ; ; RETURNED: ConfirmFlag WORD, Boolean. ; ;***************************************************************************** ;***************************************************************************** * buttonstate for JobDialog * +0 best * +2*1 faster * +2*2 Draft * +2*3 all pages * +2*4 from pages * +2*5 paper auto * +2*6 paper hand * +2*7 value for From * +2*8 Value for To * +2*9 value for Copies * +2*10 color/bw * +2*11 darker EXPORT PrJobDialog PrJobDialog * prarmeters * results * hPrint DefineStack JobDialog_DPage word 0 JobDialog_BReg byte 0 JobDialog_rtl1 block 3 JobDialog_rtl2 block 3 JobDialog_hPrint long 0 ;passed PrintRecordHandle JobDialog_result word 0 ;returned ConfirmFlag ;First save registers and setup environment phd tcd phb phk plb sta ZeroPage ; ;Make a copy of the passed print record handle at "PZ_hprint" and lock it ; lda JobDialog_hPrint,s sta PZ_hprint lda JobDialog_hPrint+2,s sta PZ_hprint+2 pushlong PZ_hprint _hlock ;lock the handle _error ; ; call PrValidate to check if printer type is same ; PushWord #0 PushLong PZ_hprint _PrValidate plx bcc OnWard brl ErrorExit2 ;memory manager error ; ;Dereferences the handle at "PZ_hprint" ; Onward lda [PZ_hprint] tax ldy #2 lda [PZ_hprint],y sta PZ_hprint+2 dereference stx PZ_hprint ; ;This copies the passed print record data to the internal print record "hprint" ; ldy #TPrintsize-2 pair looph lda [PZ_hprint],y sta hprint,y dey dey bpl looph ; ;This initializes all the buttonstates to zero ; lda #$0000 ldx #28 clrbtn2 sta buttonstate,x dex dex bpl clrbtn2 ; ;This sets the correct buttonstate for print quality; BEST, FASTER, DRAFT ; lda #$80 and hprint+prJob+bjDocLoop bne BetOrFast dec buttonstate+2*2 ;set DRAFT bra jover1 ;We get here if it could be BEST or FASTER BetOrFast ; lda hprint+prstl+wdev and #f0 beq jover0 dec buttonstate+2*0 ;set BEST bra jover1 jover0 dec buttonstate+2*1 ;set FAST jover1 ; ; ;This sets the correct buttonstate for paper feed; AUTOMATIC, HAND FEED ; lda hprint+prStl+feed cmp #feedfanfold beq doauto dec buttonstate+2*6 ;set HAND FEED bra doHand doauto dec buttonstate+2*5 ;set AUTOMATIC doHand ; ; ;This sets the COLOR/BW buttonstate ; lda hprint+prstl+wdev and #f5 beq jover10 dec buttonstate+2*10 ;set COLOR jover10 ; ;This sets the Darker buttonstate ; lda hprint+prstl+wdev and #f7 beq jover11 dec buttonstate+2*11 ;set Darker jover11 ; ; ;This always initilizes the page range to ALL ; dec buttonstate+2*3 always all ; ;This sets FROM=1, COPIES=1 and TO=999 ; lda #1 sta buttonstate+2*7 ;init. FROM to 1 sta buttonstate+2*9 ;init. COPIES to 1 lda #999 sta buttonstate+2*8 ;init TO to 999 ;------------------------------------------------------------------------------ ;Now call "JobDialog" to do the actual dialog work ;------------------------------------------------------------------------------ jsr jobdialog sta JobDialog_result,s ;save results bne okJob ;branch if OK brl outJoB ;branch if CANCEL okJob ; * we need to update the quality values: * * prstl.wdev f0 * prXinfo.idevbytes will be calculated by CiXmetrics * ; ;This sets up the COLOR/BW bit appropriately ; lda #f5 trb hprint+prstl+wdev ;clear the COLOR/BW bit bit buttonstate+2*10 bpl no4 tsb hprint+prstl+wdev ;set to COLOR no4 ; ; ;This sets up the Darker bit appropriately ; lda #f7 trb hprint+prstl+wdev ;clear the Darker bit bit buttonstate+2*11 bpl no7 tsb hprint+prstl+wdev ;set to Darker no7; ; ;This sets up the BEST bit appropriately ; lda #f0 trb hprint+prstl+wdev ;clear the BEST bit bit buttonstate+2*0 bpl no0 tsb hprint+prstl+wdev ;set the BEST bit no0 ; ; ;This sets up the DRAFT bit appropriately ; lda #$80 tsb hprint+prJob+bjDocLoop ;clears the DRAFT bit bit buttonstate+2*2 bpl notdraft trb hprint+prJob+bjDocLoop ;sets the DRAFT bit notdraft ; * then the paper range * PrJob.ifstpage, iLst page, iCopies * if all then first := 1 ; last := 9999 ; icopies := 1 * else user value ; ;This copies FROM, TO, and COPIES ; lda Buttonstate+2*7 sta hprint+prjob+ifstpage lda Buttonstate+2*8 sta hprint+prjob+ilstpage lda Buttonstate+2*9 sta hprint+prjob+iCopies * then the paperfeeding * prStl.feed := feedfanfold (A) or feedcut ; ;This sets paper feed ; lda #feedfanfold sta hprint+prStl+Feed ;assume AUTOMATIC lda buttonstate+2*5 ;get buttonstate from dialog bmi no5_2 ;branch if assumption was correct lda #feedcut ;else its HAND FEED sta hprint+prStl+Feed no5_2 ; jsr CiXmetrics ;go calculate the metrics ; ;Now copy the internal print record to the users data area ; ldy #TPrintsize-2 pair looph2 lda hprint,y sta [PZ_hprint],y dey dey bpl looph2 ; ;We get here when we are done or the user canceled the dialog ; OutJob lda #0 ErrorExit2 plb pld Jmp exit4 EJECT ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; NAME: CiXmetrics ; ; PURPOSE: Calculates metrics of page ; ; PASSED: (None) ; ; RETURNED: (None) ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ EXPORT CiXmetrics CiXmetrics ; ;NOTE: print resolution is calculated in 120 dots per inch. ; * first find out the resolution stz resolution ;init. to zero (assume 320) pha _GetMasterSCB pla sta DeadLoc2 and #$80 beq r320 inc resolution ;we get here if its 640 r320 ; * Landscape (f1) { 0=landscape ; 1=Portrait } * PaperType (0,1,2,3) { 0= Us Letter; 1= US Legal; 2= A4 Letter; 3= int'l fold} * CarriageWidth (0,1,2,3) same * Resolution (0,1) { 0=320 ; 1=640 } * Gap (0,1) * if 50% (f3) then all resolution are twice as big * newVmargin: Landscape(Gap,f6:(PaperHsize,PaperType - CarriageWidth,paperType)) * mul Landscape(Vres:Hres) div 240 * newHmargin: Landscape((PaperHsize,PaperType - CarriageWidth,paperType):Gap,f6) * mul Landscape(Hres:Vres),resolution div 240 * NewPaperVsize: Landscape(PaperVsize:CarriageWidth),PaperType * Mul Landscape(Vres:Hres) div 120 - 2*newVmargin * * NewPaperHsize: Landscape(CarriageWidth:PaperVsize),PaperType * Mul Landscape(Hres:Vres),resolution div 120 * rPage := 0,0,NewPaperVsize,NewPaperHsize * rPaper := -newVmargin,-newHmargin,NewPaperVsize+newVmargin, * NewPaperHsize+newHmargin * go for it ;------------------------------------------------------------------------------ ; ;Calculates TOP, LEFT, BOTTOM, RIGHT for papers rectangle "rPaper" ; ;------------------------------------------------------------------------------ * newVmargin: Landscape(Gap,f6:(PaperHsize,PaperType - CarriageWidth,paperType)) * mul Landscape(Vres:Hres) div 240 lda resolution asl a ;times two tax ;use as index lda Hres,X ;get horz. resolution sta hprint+prInfo+iHRes ;init horz. pixel resolution ;???????????????????????????lda Vres,X (because its the same value) lda Vres sta hprint+prInfo+iVres ;init. vertical pixel resolution stz TableIndex ;init index ; ;First see which mode (portrait or landscape) ; lda #f1 ;see if landscape and hprint+prstl+wDev bne Portt ;branch if portrait ;We get here if landscape (set index to landscape table entries) lda #IntLandVals-IntPortVals ;set index to landscape values sta TableIndex ;----------------------------------------------------------------------- ;This wasn't being done at all. *BugFix* MSL 10/15/88 ; ;Now fix the resolutions, swapping and halving or doubling each as needed. ; lda hprint+prInfo+iHRes ; horz. pixel resolution lsr a tay lda hprint+prInfo+iVres ; vertical pixel resolution asl a sta hprint+prInfo+iHRes sty hprint+prInfo+iVres ;Now take paper type and multiply by 10 because each entry is 10 bytes long Portt ; lda hprint+prStl+PaperType ;get paper size type asl a ;first mult. by 8 (10 byte table) asl a asl a clc adc hprint+prStl+PaperType ;times 9 adc hprint+prStl+PaperType ;times 10 adc TableIndex ;add in initial table index tax ;we now have the correct index ; ;Now move the initial paper values from the table ; ldy #0 ;init loop counter MvIntVals ; lda IntPortVals,X ;get initial values from table sta Hprint+rPaper+Top,Y ;set "rPaper" values inx inx iny iny cpy #8 bne MvIntVals lda IntPortVals,X ;get initial assocaiated GAP value sta TableIndex ;save the GAP value at TableIndex ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Now see if 320 or 640 mode (because table were designed for 640 mode) lda resolution bne Rez640 ;branch if 640 (no modification needed) ;With 320 mode, we need to modify clc ; do a signed divide by 2 because left may be lda HPrint+rPaper+Left ; negative in portrait mode. bpl @1 sec @1 ror HPrint+rPaper+Left lsr Hprint+rPaper+Right ; (right never negative so can do unsigned div) Rez640 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Now see if GAP lda #f6 and hprint+prstl+wDev beq noGap1 ; ;We Get here if GAP ; lda TableIndex ;get the GAP value bmi LandGAP ;if negative, its landscape GAP ;We get here if portrait GAP eor #$ffff ;first we must make negative ina sta Hprint+rPaper+Top ;set "rPaper" TOP to GAP clc adc Hprint+rPaper+Bottom sta Hprint+rPaper+Bottom ;set "rPaper" BOTTOM with GAP bra noGap1 ;We get here if landscape GAP LandGAP ; sta Hprint+rPaper+Left ;set "rPaper" LEFT to GAP clc adc Hprint+rPaper+Right sta Hprint+rPaper+Right ;Adjusted "rPaper" Right with GAP noGap1 ; ; ;Now see if 50% reduction (twice the resolution) was selected ; lda #f3 and hprint+prStl+wDev bne notHalf1 ;branch if no 50% reduction selected ;We get here if 50% reduction (multiply TOP, LEFT, BOTTOM, RIGHT by two) ldx #0 HalfResLoop ; asl Hprint+rPaper+Top,X ;multiply by two inx ;go to next value inx cpx #8 bne HalfResLoop asl hprint+prInfo+iHRes ;multiply horz. pixel resolution by 2 asl hprint+prInfo+iVRes ;multiply vertical pixel resolution by 2 notHalf1 ; ; ;Now see if condensed vertical resolution was selected ; lda #f2 and hprint+prstl+wDev bne NormVSize ;branch if normal vertical size ;We get here when condensed vertical size was selected asl Hprint+rPaper+Bottom asl Hprint+rPaper+Top asl hprint+prInfo+iVRes ;update rPage vRes NormVSize ; ;------------------------------------------------------------------------------ ; ;Calculate the page rectangle "rPage" ; ;------------------------------------------------------------------------------ ; ; update hprint+prInfo+rPage for now, prInfoPT will be updated later ; stz hprint+prInfo+rPage+Top ;init TOP to zero stz hprint+prInfo+rPage+Left ;init LEFT to zero lda hprint+rPaper+Bottom clc adc hprint+rPaper+Top sta hprint+prInfo+rPage+Bottom ;set BOTTOM lda hprint+rPaper+Right clc adc hprint+rPaper+Left sta hprint+prInfo+rPage+Right ;set RIGHT ; ;Now copy the new calculated PrInfo subrecord to PrInfoPT subrecord ; * Update the PrInfoPT record also ldy #12 UpdatePT lda hprint+PrInfo,y sta hprint+PrInfoPT,y dey dey bpl UpdatePT ; ;Now determine physical papers resolution ; lda hprint+prStl+PaperType asl a tax lda PaperVsize,x sta hprint+PrStl+iPageV ;set pages vertical res. lda PaperHsize,x sta hPrint+PrStl+iPageH ;set pages horz. resolution lda CarriageWidth,x sta hPrint+PrStl+CRwidth ;set carriage width resolution rts TableIndex DS.B 2 ;temporary ;NOTE: The Initial and Normal horz. resolution is 80 dots per inch. ; The Initial and Normal vertical resolution is 36 dots per inch. ; The carriage is only 8 inches wide (therefore there are 1/4" margins.) ; ;NOTE: All values are relative to the carriages 0,0 value. ;------------------------------------------------------------------------------ ; Initial Portrait rPaper values ;------------------------------------------------------------------------------ IntPortVals ; ; ;US normal 8.5" x 11" ; DC.W 0 ;Top DC.W -20 ;Left (-1/4" offset from carriage zero) DC.W 396 ;Bottom (11" times 36 dpi) DC.W 660 ;Right (8" x 80 + 1/4" * 80) DC.W 9 ;GAP top and bottom (1/4" x 36) ; ;US Legal 8.5" x 14" ; DC.W 0 ;Top DC.W -20 ;Left (-1/4" offset from carriage zero) DC.W 504 ;Bottom (14" times 36 dpi) DC.W 660 ;Right (8" x 80 + 1/4" * 80) DC.W 9 ;GAP top and bottom (1/4" x 36) ; ;A4 Letter 8.25" (210mm) x 11 2/3" (297mm) NOTE: 25.4mm/inch ; DC.W 0 ;Top DC.W -10 ;Left (-1/8" offset from carriage zero) DC.W 420 ;Bottom (11.6667" times 36 dpi) DC.W 650 ;Right (8.25 x 80) DC.W 9 ;GAP top and bottom (1/4" x 36) ; ;International FanFold 8.25 (210mm) x 12" ; DC.W 0 ;Top DC.W -10 ;Left (-1/8" offset from carriage zero) DC.W 432 ;Bottom (12" times 36) DC.W 650 ;Right (8.25 x 80) DC.W 9 ;GAP top and bottom (1/4" x 36dpi) ;------------------------------------------------------------------------------ ; Initial Landscape rPage values ;------------------------------------------------------------------------------ ;NOTE: Normal and Initial vertical (in actuality horz. carriage) is 40 dpi. ; Normal and Initial Horz. (in actuality vertical) is 72 dpi. ; GAP must be negative for landscape (simplified programming). IntLandVals ; ; ;US normal 8.5" x 11" ; DC.W -10 ;Top (1/4" x 40 offset from carriage 0) DC.W 0 ;Left DC.W 330 ;Bottom (8" x 40 + 1/4 * 40) DC.W 792 ;Right (11" x 72) DC.W -18 ;GAP (1/4" x 72) (neg. flags landscape) ; ;US LEGAL 8.5" x 14" ; DC.W -10 ;Top (1/4" x 40 offset from carriage 0) DC.W 0 ;Left DC.W 330 ;Bottom (8" x 40 + 1/4 * 40) DC.W 1008 ;Right (14" x 72) DC.W -18 ;GAP (1/4" x 72) (neg. flags landscape) ; ;A4 Letter 8.25 x 11 2/3" ; DC.W -5 ;Top (1/8" x 40 offset from carriage 0) DC.W 0 ;Left DC.W 325 ;Bottom (8 * 40 + 1/8 *40) DC.W 840 ;Right (11.* 72 + 2/3 * 72) DC.W -18 ;GAP (1/4" x 72) (neg. flags landscape) ; ;International FanFold 8.25 (210mm) x 12" ; DC.W -5 ;Top (1/8" x 40 offset from carriage 0) DC.W 0 ;Left DC.W 325 ;Bottom (8 * 40 +1/8 * 40) DC.W 864 ;Right (12 * 72) DC.W -18 ;GAP (1/4" x 72) (neg. flags landscape) ENDP ; DocPage.Calls ;_PrOpenDoc, _PrCloseDoc, _PrOpenPage ; ;_PrClosePage ***************************** * * * DocPage.calls * * * * Current Rev: Nov. 1987 * * * ***************************** ;------------------------------------------------------------------------------ ; ; NAME: PrDrvrVer ; ; PURPOSE: Returns version # of currently installed driver ; ; PASSED: WORD Space for result ; ; RETURNED: WORD Driver Version ; ;------------------------------------------------------------------------------ PrDrvrVer PROC EXPORT DefineStack DVerOrigD Word 0 DVerOrigB Byte 0 DVer_Rtl1 Block 3 DVer_Rtl2 Block 3 Version Word 0 phd tcd phb phk plb lda #VersionNb sta Version,s lda #0 plb pld jmp exit0 ENDP ;****************************************************************************** ;****************************************************************************** ; ; NAME: PrOpenDoc ; ; PURPOSE: High level printer routine "_PrOpenDoc" which opens the document ; ; PASSED: (Space for Result) POINTER ; PrintRecordHandle HANDLE, to print record ; PrinterPortPtr POINTER, to GrafPort, (zero indicates ; to allocate new GrafPort). ; ; RETURNED: PrintrPortPtrRet POINTER, pointer to Grafport if ; PrinterPortPtr was zero. ; ;****************************************************************************** ;****************************************************************************** Export PrOpenDoc PrOpenDoc PROC DefineStack OrigD word 0 OrigB byte 0 rtl1 block 3 rtl2 block 3 UsersPortPtr long 0 UsersPrintRecH long 0 ResultPtr long 0 pha ; save value of d ; ;First see if the port is ON ; pha _DevIsItSafe ;see if port is working pla bne Yes ;branch if safe ; ;We get here when the port is not on and we can't proceed ; lda #PortNotOn ;get error no. sta >iPrErr ;save it plx jmp Exit8 ; ;We arrive here when the port is ON ; Yes ; pla ;------------------------------------------------------------ ; ; save the registers and set direct page and data bank ; phd tcd phb phk plb ;------------------------------------------------------------ ; ; Get the current cursor record's address and turn on the watch cursor. ; PushLong #0 ; space for the address _GetCursorAdr pla sta CursorAd pla sta CursorAd+2 _WaitCursor stz DraftFlag ;------------------------------------------------------------ ; ; Don't Verify the print record! *Hack* MSL 10/15/88 ; ; pha ; space for result ; lda UsersPrintRecH+4,s ; pha ; lda UsersPrintRecH+4,s ; pha ; _PrValidate ; pla ; dont care about the result ;------------------------------------------------------------ ; ; Clear the error code. Move the user id. Copy the users ; print record to our print record. ; stz iPrErr ; zero error stz PStatus ; and printer status lda UserId ; move user id sta MainUserID lda UsersPrintRecH+2,s ; copy the print record pha ; using HandToPtr lda UsersPrintRecH+2,s pha PushLong #hprint PushLong #Tprintsize _HandToPtr ;------------------------------------------------------------ ; ; Lets look at the print method and set the variable ; "METHOD". Method will be zero for draft printing and ; $8000 for spool printing. ; lda hprint+prJob+bjDocLoop and #$80 xba sta method ;set the method ;------------------------------------------------------------ ; ; Put up the dialog that says preparing data (or draft ; printing. ; stz NoShowMessage ; enable message display jsr OpenInfoPrepare ;------------------------------------------------------------ ; ; Now we decide whether to use our own port or the user's ; port. lda #false ; start by assuming it sta ourport ; is the user's port. lda UsersPortPtr,s ; if port ptr is non zero ora UsersPortPtr+2,s ; we use theirs bne Portexist ;------------------------------------------------------------ ; ; Damn, the user wants us to do all his work for him/her. ; We get a handle for a port. ; lda #PortSize ; size of handle ldx #%1000000000011000 ; attributes jsr OurGetHandle ;get a handle of port size bcc @1 sta iPrErr jsr CloseInfo brl errorExitDoc @1 sta temp1 ;save handle at tem1 stx temp1+2 lda [Temp1] sta UsersPortPtr,s ;dereference handle at UsersPortPtr ldy #2 lda [Temp1],y sta UsersPortPtr+2,s lda #true ;set OURPORT true (remember) sta ourport PortExist ; ;------------------------------------------------------------ ; ; Put copies of the port pointer everywhere. ; lda UsersPortPtr,s ;get port pointer sta ResultPtr,s ;save to be passed back sta hOurPort sta PZ_pPrPort lda UsersPortPtr+2,s sta ResultPtr+2,s sta hOurPort+2 sta PZ_pPrPort+2 ;------------------------------------------------------------ ; ; Open the grafport. ; pei PZ_pPrPort+2 pei PZ_pPrPort _OpenPort ;open the grafport ;------------------------------------------------------------ ; ; Initialize these page number varibles. ; stz iPageNum ; init page num stz iDocPage ; init. document pages stz PicListCount ; page count of hPicList ;------------------------------------------------------------ ; ; Look at the printing method. If it is deferred, get a handle ; to enough memory to contain list of pictures for the number ; of pages asked by the application to be printed. ; lda method bpl draftOpenDoc ;branch if immediate mode (draft) ;------------------------------------------------------------------------------ ; ; DEFERRED Mode Code ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------- ; ; We'll begin with a piclist for 20 pages. In PrOpenPage, we'll ; check if this is enough, if not, we get more in 20 page increments ; lda #20*4 ; start with 20 pages worth ldx #%0000000000000000 ; nothing special jsr OurGetHandle ;get a handle bcc @1 sta iPrErr ; clean up the port we jsr CloseInfo ; allocated. pei PZ_pPrPort+2 pei PZ_pPrPort _ClosePort ;close the graf port lda #0 ;zero out what we give back. sta UsersPortPtr,s sta UsersPortPtr+2,s lda ourPort ;see if ours cmp #true bne @2 ;branch if not ours pha ; first find the handle to pha ; memory that port is in. pei PZ_pPrPort+2 pei PZ_pPrPort _FindHandle ; find the handle to pointer _DisposeHandle ; then dispose it. @2 bra errorExitDoc @1 sta hPicList ;save it at hPicList stx hPicList+2 ; ;We get here with no errors and its time to exit PrOpenDoc ; lda #0 exitOpenDoc sta iPrErr ; Added by Suki 5/25/88 errorExitDoc plb pld jmp Exit8 ;------------------------------------------------------------------------------ ; ; IMMEDIATE Mode Code ; ;------------------------------------------------------------------------------ draftOpenDoc ; jsr startLLD ; start up the LLD bra ExitOpenDoc ENDP EJECT ;****************************************************************************** ;****************************************************************************** ; ; NAME: PrCloseDoc ; ; PURPOSE: High level printer routine "_PrCloseDoc" which closes the doc. ; ; PASSED: PrinterGrafPortPtr POINTER, to printer graf port. ; ; RETURNED: (NONE) ; ;****************************************************************************** ;****************************************************************************** PrCloseDoc PROC EXPORT DEFINESTACK OrigD word 0 OrigB byte 0 rtl1 block 3 rtl2 block 3 PortPtr long 0 pha lda >iPrErr ;see if any errors beq Continue ;branch if no erros cmp #PortNotOn ;see if port-not-on error bne Continue ;branch if not plx jmp Exit4 ; ;Save registers and setup environment ; Continue ; pla phd tcd phb phk plb ;------------------------------------------------------------ ; ; Close the port. ; lda PortPtr+2,s pha lda PortPtr+2,s pha _ClosePort ;close the graf port ;------------------------------------------------------------ ; ; If the port is our's (created in PrOpenDoc), we must get rid of the memory we ; allocated for it. ; lda ourPort ;see if ours cmp #true bne userport ;branch if not ours pha ; first find the handle to pha ; memory that port is in. lda PortPtr+4+2,s pha lda PortPtr+4+2,s pha _FindHandle ; find the handle to pointer _DisposeHandle ; then dispose it. userport ; ;------------------------------------------------------------ ; ; If we are doing immediate (draf)t printing, we need to shut down. ; lda method bpl CloseDocDraft ;branch if immediate mode ;------------------------------------------------------------------------------ ; ; DEFERRED Mode ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------ ; ; We're done. ; NoErrorExit ; lda #0 pha jsr CloseInfo ; get rid of info dialog box pla ;restore registers plb pld jmp Exit4 ;------------------------------------------------------------------------------ ; ; IMMEDIATE Mode ; ;------------------------------------------------------------------------------ CloseDocDraft ; pushword UserID jsl LLDShutDown PushLong CursorAd _Setcursor bra NoErrorExit ENDP EJECT ;****************************************************************************** ;****************************************************************************** ; ; NAME: PrOpenPage ; ; PURPOSE: High level printer routine "_PrOpenPage" which opens the page ; ; PASSED: GrafPortPtr POINTER, to grafport ; PageFramePtr POINTER, to scaling parameter (zero if ; none.) ; ; RETURNED: (NONE) ; ;****************************************************************************** ;****************************************************************************** PrOpenPage PROC EXPORT DefineStack OrigD word 0 OrigB byte 0 rtl1 block 3 rtl2 block 3 PageFramePtr long 0 PortPtr long 0 pha lda >iPrErr ;see if any errors beq SallRight ;branch if none plx jmp Exit8 SallRight ; pla ;save registers and setup environment phd tcd phb phk plb ;------------------------------------------------------------ ; ; First we set the port to the port that is passed. ; lda PortPtr+2,s pha lda PortPtr+2,s pha _Initport ;------------------------------------------------------------ ; ; Zero the bounds rect. This prevents any drawing: even ; if user makes the pen visible. ; lda #0 ldy #o_BoundsRect ZeroLoop sta [PZ_pPrPort],y iny iny cpy #o_BoundsRect+8 bcc ZeroLoop ;------------------------------------------------------------ ; ; Now we bump the page counter and look at the method. If it ; is draft printing then do something, else we open a picture. ; inc iDocPage ;increment the document page lda method ;get the printing method bmi spoolPage ;branch if deferred brl OpenPageDraft ;branch if immediate ;------------------------------------------------------------------------------ ; ; DEFERRED Mode ; ;------------------------------------------------------------------------------ spoolPage stz hNewPic ; start by zeroing handle to stz hNewPic+2 ; picture. lda iDocPage ; look at page number. cmp hprint+prjob+ifstpage ; are we in range? blt exitnow ; no, get out now dea cmp hprint+prjob+ilstpage ; yes-start a picture blt continue ; ;We get here when we are out of page range ; exitnow brl NoErrorExit continue ; ;----------------------------------------------------------- ; ; Lets look at the page frame pointer that was passed. If it is NIL, ; we replace it with a pointer to rPage. ; lda PageFramePtr,s ;get passed pointer ora PageFramePtr+2,s bne UserHasFramePtr ;branch if NIl lda #hprint+prInfoPT+rpage sta PageFramePtr,s lda #^hprint+prInfoPT+rpage sta PageFramePtr+2,s UserHasFramePtr ; pha pha lda PageFramePtr+4+2,s ;get PageFramePointer from stack pha lda PageFramePtr+4+2,s pha _openpicture ;open a picture ;------------------------------------------------------------ ; ; We leave result of open picture on stack until we deref ; the pic list below. ; ; ; Bump the picture list counter to reflect current page ; inc PicListCount ;------------------------------------------------------------ ; ; PicListCount is used to test if hPicList is large to enough ; to hold the number of pages in the document. It counts from ; 1 to 20, since we increase memory 20 pages at a time. This ; variable is initialised in PrOpenDoc. ; lda PicListCount cmp #21 ; run out of allocated memory? blt EnoughMem ; not yet pha ; space for size pha PushLong hPicList _GetHandleSize ; get current block size pla ; current size clc adc #20*4 ; increase it by another 20 pages pha ; new size PushLong hPicList _SetHandleSize ; set new block size ; MEMERR! EnoughMem lda [hPicList] ; deref the pic list sta pPicList ldy #2 lda [hPicList],y sta pPicList+2 lda iPagenum ; use iPageNum as index into asl a ; pic list asl a tay pla ; now put picture handle into sta [pPicList],y ; pic list sta hNewPic ; and in hNewPic iny iny pla ; (high word too) sta [pPicList],y sta hNewPic+2 ;---------------------------------------------------------- ; ; Set the cliprgn and visrgn to the sizing Framing rect ; lda PageFramePtr+2,s pha lda PageFramePtr+2,s pha _cliprect pushlong #0 ; and the vis rect! _getcliphandle _setvisrgn ;----------------------------------------------------------- ; ; Lets set the port rect to this frameing rect too. ; lda PageFramePtr+2,s pha lda PageFramePtr+2,s pha _SetPortRect ;------------------------------------------------------------ ; ; Bump the page number ; inc ipagenum ;------------------------------------------------------------ ; ; We are done. ; NoErrorExit ; lda #0 plb pld jmp Exit8 ;------------------------------------------------------------------------------ ; ; IMMEDIATE Mode ; ;------------------------------------------------------------------------------ OpenPageDraft ; ;----------------------------------------------------------- ; ; If this is a page that will be printed, then we install ; printing procs. ; lda iDocPage ; look at page number. cmp hprint+prjob+ifstpage ; are we in range? blt NoErrorExit ; no, get out now dea cmp hprint+prjob+ilstpage ; yes-start a picture bge NoErrorExit lda #1 ; so we know to zap the graphprocs sta DraftFlag ; on a draft-mode cancel. PushLong #ProcsTable ; put std procs in table _SetStdProcs lda #iPrErr ;see if any errors beq Continue ;branch if none cmp #PortNotOn ;see if port-not-on error bne Continue ;branch if none plx jmp Exit4 Continue ; ;save registers and setup environment pla phd tcd phb phk plb ;------------------------------------------------------------ ; ; Look at method and go to correct routine. ; lda method ;look at method bpl ClosePageDraft ;branch if immediate mode ;------------------------------------------------------------------------------ ; ; DEFERRED Mode ; ;------------------------------------------------------------------------------ lda hNewPic ; if there is no picture then ora hNewPic+2 ; we are done. beq NoErrorExit ;branch if no picture lda PortPtr+2,s pha lda PortPtr+2,s pha _SetPort ;set the graf port ; Check for Picture error. If one has happened, don't close the picture, because this ; can blast the clip rgn under System 5.0. tool _GetPicSave,out=(ax:l) cpx #$FFFF bne @closeit tool _SetPicSave,in=(#0:l) bra @picErr @closeIt _ClosePicture ;close the picture bcc NoErrorExit @picErr lda #$0201 sta >iPrErr bra errorExit NoErrorExit lda #0 errorExit plb pld jmp Exit4 ;------------------------------------------------------------------------------ ; ; IMMEDIATE Mode ; ;------------------------------------------------------------------------------ ClosePageDraft ; ;------------------------------------------------------------ ; ; For draft printing we make LLD new page call. (unless ; we've reached the end of the pages to print. ; lda iDocPage cmp hprint+prjob+ifstpage blt exitclosenow dea cmp hprint+prjob+ilstpage bge exitclosenow jsl newpage exitclosenow bra NoErrorExit ENDP EJECT ;------------------------------------------------------------------------------ * * NAME: OurGetHandle * * PURPOSE: Gets a handle to memory. * * PASSED: (A-reg.) size passed in a-reg. * (X-reg.) attributes passed in x-register. * * RETURNED: A Handle is returned in A & X registers unless there is a * memory manager error (carry set) in which case the error ; number returns in the A-reg. * ;------------------------------------------------------------------------------ OurGetHandle PROC EXPORT pha pha pea 0 pha amount requested. PushWord UserID your ID phx attributes pea 0 pea 0 _NewHandle result on the stack bcs AnError pla plx rts ;We get here if an error occured trying to get a handle AnError plx plx rts ENDP ;------------------------------------------------------------ ; ; CalcBandSize ; ; This code was ripped out of CiXMetrics to be called seperately. MSL ; CalcBandSize PROC EXPORT * now calculate iBandV ,iBandH ,iRowBytes and iDevBytes * iBandV= landscape(32,hprint+prInfo+rPage+Bottom'*2 if best or 50%') * iBandH= landscape(hprint+prInfo+rPage+Right'*2 if best or 50%',32) * iRowBytes= iBandH div (2:4),resolution * iDevBytes = iBandV * iRowBytes ; ;This calculates the print bands vertical resolution ; * iBandV= landscape(32,hprint+prInfo+rPage+Bottom'*2 if best or 50%') lda #f1 and hprint+prstl+wDev bne Port5 ;branch if portrait lda hprint+prInfo+rPage+Bottom ;get bottom pha lda #f3 ;see if 50% and hprint+prstl+wDev bne testbest ;branch if not 50% pla asl a bra Land5 testbest ; lda #f0 ;see if BEST and hprint+prstl+wDev beq notbest ;branch if not BEST pla asl a bra Land5 notbest ; pla bra Land5 Port5 lda bandheight Land5 ; sta Hprint+PrXinfo+iBandV ;set the print bands vert. res. ; ;This calculates the print bands horizontal resolution ; * iBandH= landscape(hprint+prInfo+rPage+Right'*2 if best or 50%',32) lda #f1 and hprint+prstl+wDev beq Land6 ;branch if landscape lda hprint+prInfo+rPage+Right ;get right pha lda #f3 ;see if 50% and hprint+prstl+wDev bne testbest2 ;branch if not best pla ;;;;;;;;;;;;;;;;;;;;;;;;;;; asl a ;;;;;;;;;;;;;;;;;;;;;;;;;;; bra Port6 testbest2 ; lda #f0 ;see if BEST and hprint+prstl+wDev beq notbest2 ;branch if not BEST pla asl a bra Port6 notbest2 ; pla bra Port6 Land6 lda bandheight Port6 ; sta Hprint+PrXinfo+iBandH ;set the print bands Horz. res. ; ;This calculates the print bands bytes/row ; * iRowBytes= iBandH div (2:4),resolution lda Hprint+PrXinfo+iBandH lsr a ldx resolution beq done lsr a done sta Hprint+PrXinfo+iRowBytes ;set the bytes/row ; ;This calculates the total number of bytes (bytes per row times number of bands) ; * iDevBytes = iBandV * iRowBytes PushLong #0 lda Hprint+PrXinfo+iBandV pha lda Hprint+PrXinfo+iRowBytes pha _Multiply pla sta Hprint+PrXinfo+iDevBytes ;set the total no. of bytes pla beq DidCBandSize ; if'n its more than a bank, lsr bandheight ; 1/2 it & keep trying... brl CalcBandSize DidCBandSize rts ENDP ; JobDialog ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; NAME: JobDialog ; ; PURPOSE: Does most of the work for "_PrJobDialog" ; ; PASSED: (None) ; ; RETURNED: (None) ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ * buttonstate for JobDialog * +0 best * +2*1 faster * +2*2 Draft * +2*3 all pages * +2*4 from pages * +2*5 paper auto * +2*6 paper hand * +2*7 value for From * +2*8 Value for To * +2*9 value for Copies * +2*10 color/bw * +2*11 darker JobDialog PROC EXPORT ; ;Get the pointer to the current grafport ; PushLong #0 _getport ; ;Get the master SCB ; pha _GetMasterSCB ;get the SCB pla sta DeadLoc ;save it ; ;Calculate the dialog boxes width ; lda StyleRect+6 sec sbc StyleRect+2 sta Stylewidth ; ;This calculates the dialog boxes LEFT and RIGHT (depending on 320 or 640 mode) lda deadloc ;get saved SCB and #$80 ;look at mode ($0=320, $80=640) beq loc320 lda #640 ;get 640 bne loc640 loc320 ; lda #320 ;get 320 loc640 ; sec sbc StyleWidth lsr a sta StyleRect+2 ;adjust job dialogs LEFT sta JobDTemplate+2 ;DAN H. adjust template clc adc StyleWidth sta StyleRect+6 ;adjust job dialogs RIGHT sta JobDTemplate+6 ;DAN H. adjust template ; ;This inits. the button item states ; ldy #2*6 ;init. buttonstate index ldx #6*24 ;init. JDRB template index IBitemState ; stz JDRB0,x ;init. state to off lda buttonstate,y ;get button state bpl IsOff1 lda #1 sta JDRB0,x ;set state to on IsOff1 ; txa ;get y-index sec sbc #24 ;move to next item template tax dey dey bpl IBitemState ;Do COLOR check box differently stz JDRB10 ;init. to off lda buttonstate+2*10 ;get buttonstate for color bpl over10 ;branch if off lda #$ffff ;set to selected sta JDRB10 over10 ; stz JDRB11 ;init. to off lda buttonstate+2*11 ;get buttonstate for color bpl over11 ;branch if off lda #$ffff ;set to selected sta JDRB11 over11 ; ; ;This starts the modal dialog ; PushLong #0 Pushptr JobDTemplate ;The dialogs template _GetNewModalDialog ;creates a new modal dialog pla sta pScreenport ;save the dialogs handle pla sta pScreenport+2 ; ;Set the dialog as the current port and set the origin to zero ; pushlong pscreenport _Setport pushlong #0 _setOrigin ; ; draw the upper line ; pushlong l1 _moveto pushlong l2 _lineto ; * let's draw the inactive strings (printers name/ports name) ; PushLong namepos ;move to where to put printer name _moveto PushLong #0 _PmGetPrinterName ;get the printer types name _DrawString ;draw it PushPtr SlashStr _DrawString ;draw a "/" PushLong #0 _PmGetPortName ;get the ports name _DrawString ;draw it ;------------------------------------------------------------------------------ ;This draws the inactive strings using tables ;------------------------------------------------------------------------------ lda JIstrnum ;get number of strings to draw dea asl a asl a tax ;use as an index strloop phx ;save index lda JIposlist+2,x ;get position to draw at pha lda JIposlist,x pha _moveto ;move to the position plx phx lda JIstrlist+2,x ;get address of text to draw pha lda JIstrlist,x pha _drawstring ;draw the text plx dex dex dex dex bpl strloop ;loop for all strings in table ;------------------------------------------------------------------------------ ; ; This is the modal dialog loop ; ;------------------------------------------------------------------------------ loopModal ; PushWord #0 PushLong #JobFilter+$80000000 ;use filter proc. and standard _modalDialog pla beq loopModal ;loop until a response from user cmp #15 ;see if valid item selected bge loopModal ;branch if invalid ; ;Convert item selected and vector to appropriate routine to handle it ; asl a ;convert itme to index tax jmp (Action-2,x) ;vector to routine to handle item Action ; DC.W S_OkEvent ;1 DC.W S_Cancelevent ;2 (Cancel button) DC.W S_Qual ;3 DC.W S_Qual ;4 DC.W S_Qual ;5 DC.W S_Page ;6 (ALL radio button) DC.W S_Page ;7 (FROM radio button) DC.W S_Copie ;8 DC.W S_Copie ;9 DC.W S_Copies ;10 DC.W S_To ;11 (TO line edit box) DC.W S_From ;12 (FROM line edit box) DC.W S_Color ;13 (Color check box) DC.W S_Darker ;14 (Darker check box) ; ;We vector here on OK button ; S_okEvent ; pushword #0 Pushlong pScreenPort Pushword #13 _GetDItemValue pla sta buttonstate+2*10 pushword #0 Pushlong pScreenPort Pushword #14 _GetDItemValue pla sta buttonstate+2*11 PushLong pscreenport PushWord #10 PushPtr CopieFinalValue _GetIText pushword #0 pushptr CopieFinalValue+1 lda CopieFinalValue and #$07 pha pushword #0 _Dec2int pla sta Buttonstate+2*9 lda buttonstate+2*3 ; check if all is on, if so, do not bmi nopageupdate ; update 'from' & 'to' in buttonstate PushLong pscreenport PushWord #12 PushPtr FromFinalValue _GetIText lda FromFinalValue and #7 beq nofrom pushword #0 pushptr FromFinalValue+1 lda FromFinalValue and #$07 pha pushword #0 _Dec2int pla sta Buttonstate+2*7 nofrom ; PushLong pscreenport PushWord #11 PushPtr ToFinalValue _GetIText lda ToFinalValue and #$07 beq nopageupdate pushword #0 pushptr ToFinalValue+1 lda ToFinalValue and #$07 pha pushword #0 _Dec2int pla sta Buttonstate+2*8 nopageupdate ; lda #$ffff sta IfCancelled brl fin ; ;We vector here on CANCEL button ; S_CancelEvent ; lda #0 sta IfCancelled ;set if cancelled brl fin ; ;We vector here on a print quality radio button selection ; S_Qual ; sec sbc #6 tax lda buttonState,x Give me the item bmi PaperDone phx * clear the current one ldx #0 searchmore lda buttonState,x bmi clearit inx inx cpx #3*2 bne searchmore bra PaperDone clearit lda #0 sta buttonState,x txa lsr a clc adc #3 tax pushword #0 Pushlong pScreenPort phx _SetDItemValue * Mark the new one plx phx lda #$FFFF sta buttonstate,x pla lsr a clc adc #3 tax pushword #1 Pushlong pScreenPort phx _SetDItemValue PaperDone brl LoopModal ; ;We vector here on page button ; S_Page ; tay sec sbc #6 tax lda buttonState,x Give me the item bmi PaperDone cpx #2*3 * button n 4 beq doall S_Page2 ; cpy #16 ;value has been doubled by now bge ToBox ;"To or From" clicked, dont select text Pushlong pScreenPort PushWord #12 ;id of From edit item box PushWord #0 ;start PushWord #4 ;stop _SelectIText ;select the FROM edit item box * do from to. ToBox pushword #1 Pushlong pScreenPort Pushword #7 _SetDItemValue ;ON with FROM radio button pushword #0 Pushlong pScreenPort Pushword #6 _SetDItemValue ;OFF with ALL radio button lda #0 ldx #2*3 sta buttonstate,x inx inx dea sta buttonstate,x brl LoopModal doAll ; pushword #0 Pushlong pScreenPort Pushword #7 _SetDItemValue pushword #1 Pushlong pScreenPort Pushword #6 _SetDItemValue lda #$ffff ldx #2*3 sta buttonstate,x inx inx ina sta buttonstate,x CopieDone brl LoopModal ; ;We vector here on a paper feed radio button (AUTOMATIC, HAND FEED) S_Copie ; sec sbc #6 tax lda buttonState,x Give me the item bmi CopieDone cpx #2*5 * button n 6 beq doAuto ;We get here when its a HAND FEED pushword #1 Pushlong pScreenPort Pushword #9 _SetDItemValue pushword #0 Pushlong pScreenPort Pushword #8 _SetDItemValue lda #0 ldx #2*5 sta buttonstate,x inx inx dea sta buttonstate,x brl LoopModal ;We arrive here when its an AUTOMATIC doAuto ; pushword #1 Pushlong pScreenPort Pushword #8 _SetDItemValue pushword #0 Pushlong pScreenPort Pushword #9 _SetDItemValue lda #$ffff ldx #2*5 sta buttonstate,x inx inx ina sta buttonstate,x brl LoopModal ; ;We vector here on COLOR check box selection ; S_Color ; pushword #0 Pushlong pScreenPort Pushword #13 _GetDItemValue pla eor #$ffff pha Pushlong pScreenPort Pushword #13 _SetDItemValue Brl LoopModal S_Darker ; pushword #0 Pushlong pScreenPort Pushword #14 _GetDItemValue pla eor #$ffff pha Pushlong pScreenPort Pushword #14 _SetDItemValue Brl LoopModal ; ;We vector here on a COPIES edit item ; S_Copies ; brl LoopModal ; ;We vector here on a FROM or TWO edit item selection ; S_To ; S_From ; tay lda #14 brl S_Page2 ; ;We go here when the user is done and has selected either OK or CANCEL ; IMPORT DraftModeQuality fin PushWord #0 PushWord #0 PushPtr EventRecord _getNextEvent pla lda evtmods and #$0900 sta DraftModeQuality pushlong pscreenport _CloseDialog _setport lda IfCancelled rts ENDP ; JobFilter ;------------------------------------------------------------------------------ ; ; NAME: JobFilter ; ; PURPOSE: _PrJobDialog's filter procedure. ; ; PASSED: Result WORD, (space for result) ; TheDialog LONG, pointer to the dialog's grafport ; Event LONG, pointer to the event ; ItemHit LONG, pointer to the item hit ; ; RETURNED: IgnoreFlag WORD, boolean, TRUE if event is to be ; ignored, FALSE if calling routine ; should handle event. ; ;------------------------------------------------------------------------------ Export Jobfilter Jobfilter PROC inButtDwn equ 1 KeyDown equ 3 AutoKey equ 5 ItemHit equ 7 Event equ ItemHit+4 TheDialog equ Event+4 Result equ TheDialog+4 TabKey equ 9 ReturnKey equ 13 deleteKey equ 127 phd phb phk plb tsc tcd lda #0 sta result ;init. result to true ; ;Copy the event record ; ldy #14 copyEvent lda [Event],y sta EventRecord,y dey dey bpl CopyEvent lda ZeroPage tcd ;get zero page lda EvtWhat ;see what type of event cmp #KeyDown ;do KeyDown events beq dokey cmp #AutoKey ;do AutoKey events beq dokey brl notDown ;all other events pass thru. ; ;We get here when we have either a KeyDown or AutoKey events ; Dokey ; lda evtmsg cmp #TabKey ;do tab key beq KeyAllowed cmp #returnKey ;do return key beq KeyAllowed cmp #DeleteKey ;do delete key beq KeyAllowed cmp #$30 blt notallowed cmp #$3a bge notallowed bra KeyAllowed ; ;We get here when we get an event that we don't want ; notallowed ; lda #-1 sta result,s ;set results for false KeyAllowed ; notDown ; plb pld lda 0,s sta 12,s lda 2,s sta 14,s pla pla pla pla pla pla rtl ENDP ; StyleDialog ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; NAME: StyleDialog ; ; PURPOSE: Does most of the work for "_PrStlDialog" ; ; PASSED: (None) ; ; RETURNED: (A-reg.)=0 OK, =$ffff CANCEL ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ * buttonstate for Style * +0 US Letter * +2*1 US Legal * +2*2 A4 Letter * +2*3 International Fanfold * +2*4 Reserved for Computer Paper * +2*5 Reserved for Tall Adjusted * +2*6 Reserved for 50% reduction * +2*7 No Gaps Between Pages * +2*8 Portrait * +2*9 Landscape Export StyleDialog StyleDialog PROC ; ;Get the pointer to the current grafport ; pushlong #0 _getport ;get the current port ; ;Get the master SCB ; pha _GetMasterSCB ;get the SCB pla sta DeadLoc ;save SCB ; ;Calculate the dialogs boxs width ; lda StyleRect+6 sec sbc StyleRect+2 sta Stylewidth ;save width of dialog box ; ;This calculates the dialog boxes LEFT and RIGHT (depending on 320 or 640 mode) ; lda deadloc ;get saved SCB and #$80 ;look at mode (0=320, 1=640) sta landsc_p sta portrait_p beq loc320 ;branch if 320 mode lda #640 ;get 640 bne loc640 loc320 ; lda #320 ;get 320 loc640 ; sec sbc StyleWidth lsr a sta StyleRect+2 ;adjust style dialogs LEFT clc adc StyleWidth sta StyleRect+6 ;adjust style dialogs RIGHT ; ;This sets the appropriate pixel width for the portrait/landscape image ; * update the bitmap for 320/640 lda deadloc ;get save SCB and #$80 ;look at mode bit beq w320 ;branch if 320 lda pixel640 ;get the pixel width for 640 bne ww w320 lda pixel320 ;get the pixel width for 320 ww sta pixelwidth ;set the pixel width sta portrait_p+14 ;set the portriat sta landsc_p+14 ;set the landscape sta portrait_r+6 ;set the portriat rectangle sta landsc_r+6 ;set the landscape rectangle clc adc dstbitr1+2 sta dstbitr1+6 ; ;Adjust the left and right of the destination rectangle? ; lda pixelwidth clc adc #4 adc dstbitf1+2 sta dstbitf1+6 ; ;???????????? ; lda pixelwidth clc adc dstbitr2+2 sta dstbitr2+6 lda pixelwidth clc adc #4 adc dstbitf2+2 sta dstbitf2+6 ; ;This starts the modal dialog ; PushLong #0 Pushptr StyleRect ;stylerect defines the dialog box Pushword #1 PushLong #0 _NewModalDialog ;get a new modal dialog pla sta pScreenport ;save the dialog boxes handle pla sta pScreenport+2 ; ;Set the dialog as the current port and set the origin to 0 ; pushlong pScreenport _Setport ;set the current port to the dialog pushlong #0 _setOrigin ;set the origin to zero ; * draw the upper line ; pushlong l1 _moveto pushlong l2 _lineto ; *let's draw the inactive strings (printers name/ports name) ; PushLong namepos ;move to where to put printer name _moveto PushLong #0 _PmGetPrinterName ;get the printer types name _DrawString ;draw it PushPtr SlashStr _DrawString ;draw a "/" char. PushLong #0 _PmGetPortName ;get the ports name _DrawString ;draw it ;------------------------------------------------------------------------------ ;This draws the inactive strings using tables ;------------------------------------------------------------------------------ lda Istrnum ;get number of strings to draw dea asl a asl a tax ;use as an index strloop phx ;save index lda Iposlist+2,x ;get position to draw at pha lda Iposlist,x pha _moveto ;move to position plx phx lda Istrlist+2,x ;get address of text to draw pha lda Istrlist,x pha _drawstring ;draw the text plx dex ;adjust index to next string dex dex dex bpl strloop ;loop for all strings in table ; * create the OK Item ; PushLong pScreenPort Pushword #1 ;OK button (default for CR) Pushptr OKrect Pushword #ButtonItem Pushptr okstr PushWord #0 PushWord #0 PushLong #0 _newDItem ; ;Create the CANCEL button ; PushLong pScreenPort Pushword #2 cancel Pushptr cancelrect Pushword #ButtonItem Pushptr cancelstr PushWord #0 PushWord #0 PushLong #0 _newDItem ; ;* create the radio items ; lda #0 Radioloop pha asl a asl a tax ;X-reg. points to correct item in list PushLong pScreenport ;dialogs port lda 5,s ;get the current item count off stack clc adc #3 ;start at 3 (1 is ok, 2 is cancel) pha ;push the Id lda ArectList+2,x ;push the items bounds rectangle pha lda ArectList,x pha cpx #7*4 ;special case out type of item blt rad pushword #CheckItem ;we get here for a check item bra com rad ; pushword #radioItem ;we get here for a radio item com ; lda AstrList+2,x ;push the items descriptor pha lda AstrList,x pha PushWord #0 ;Items value cpx #5*4 ; If done with paper radio button blt Family0 ; then change family # to 1 for PushWord #1 ; VSize radio buttons bra Next Family0 PushWord #0 ;Items flag Next PushLong #0 ;Items color _newDItem ;Create the new item pla ;get the saved counter cmp #3 bne nojump ;do first four items inc a ;skip 50% reduction nojump ; inc a ;goto NO GAPS cmp AStrNum bne Radioloop ; ;* draw the bitmaps for portrait/landscape ; pushlong #0 _getport pla sta PP_portrait+4 sta PP_Landsc+4 pla sta PP_portrait+6 sta PP_Landsc+6 Pushptr PP_portrait _paintPixels ;paint portrait Pushptr PP_Landsc _paintPixels ;paint landscape pushptr dstbitf1 _framerect ;frame portrait pushptr dstbitf2 _framerect ;frame landscape ; ;Now determine invert the current selected mode for portriat/landscape ; lda buttonstate+2*8 ;get portraits button state bpl startLands ;branch if not selected ; ;we get here if portriat ; Pushptr dstbitf1 _invertRect ;invert the portrait image pushptr dstbitf1 _framerect ;frame the portrait image bra startport ; ;We get here if landscape ; startLands ; Pushptr dstbitf2 _invertRect ;invert the landscape image pushptr dstbitf2 _framerect ;frame the landscape image ; ;This gets the pointers to the control items ; startPort ; lda #1 GetptrLoop pha tay pushlong #0 pushlong pScreenPort Phy _GetControlDItem lda 5,s asl a asl a tax pla sta ptrList,x ;save the pointer in list pla sta ptrList+2,x pla ina cmp #11+1 bne GetptrLoop ; ;This activates the radio buttons ; lda #3 looop pha asl a tax lda buttonstate-6,x bpl forgetthisone pla pha asl a asl a tax ldy #1 jsr SetButtonValue forgetthisone pla ina cmp #8 bne looop ; items 8 - 11 are not as normal lda buttonstate+2*10 ; Normal Vsize bpl Onto9 ; Not selected ldx #8*4 ; item #8 is the oddest ldy #1 ; ON jsr SetButtonValue Onto9 lda #9 ; Items 9 - 11 loop1 pha ; offset to buttonstate are asl a ; different than that of 3 - 7 tax lda buttonstate-8,x bpl SkipIt pla pha asl a asl a tax ldy #1 jsr SetbuttonValue SkipIt pla ina cmp #12 bne loop1 ;------------------------------------------------------------------------------ ; ;This is the modal dialog loop ; ;------------------------------------------------------------------------------ loopModal ; PushWord #0 PushLong #StyleFilter+$80000000 ;handles portrait/lands. images _modalDialog pla beq loopModal ;loop until a response cmp #12 ;see if valid item bge loopModal ;branch if not ; ;Now vector to correct routine to handle the item ; asl a ;convert item number to index tax jmp (Action-2,x) ;vector to routine to handle item Action ; DC.W S_OkEvent 1 DC.W S_Cancelevent 2 DC.W S_Paper 3 - US Letter DC.W S_Paper 4 - US Legal DC.W S_Paper 5 - A4 Letter DC.W S_Paper 6 - International fanfold DC.W S_Paper 7 - Reserved for computer paper DC.W S_Vsize 8 - Normal VSize DC.W S_Vsize 9 - Condensed VSize DC.W S_Spe 10 - 50% DC.W S_Spe 11 - No Gap ; ;We vector here on OK button ; S_okEvent ; lda #$ffff sta IfCancelled ;clear if cancled flag brl fin ; ;We vector here on CANCEL button ; S_CancelEvent ; lda #0 sta IfCancelled ;set if cancled flag brl fin ; ;We vector here on a paper radio button selection ; S_paper ; sec sbc #6 tax lda buttonState,x Give me the item bmi PaperDone phx * clear the current one ldx #0 searchmore lda buttonState,x bmi clearit inx inx cpx #5*2 bne searchmore bra PaperDone clearit lda #0 sta buttonState,x txa lsr a clc adc #3 asl a asl a tax ldy #0 jsr SetButtonValue * Mark the new one plx phx lda #$FFFF sta buttonstate,x pla lsr a clc adc #3 asl a asl a tax ldy #1 jsr SetButtonValue PaperDone brl LoopModal ; ; We vector here on a special size selection ; S_VSize cmp #16 ; is it 2 x 8? beq SetNormal ; yes, user picked normal lda #0 ; user picked condensed - 9 sta buttonstate+2*10 ; normal off dec a sta buttonstate+2*5 ; condensed on ldx #9*4 ; offset for condensed ldy #1 ; ctrl value in y, we want ON now jsr SetButtonValue ldx #8*4 ; offset for normal ldy #0 ; now we want OFF jsr SetButtonValue brl LoopModal SetNormal ; lda #0 ; user picked normal - 8 sta buttonstate+2*5 ; condensed on dec a sta buttonstate+2*10 ; normal off ldx #9*4 ; offset for condensed ldy #0 ; ctrl value in y, we want OFF now jsr SetButtonValue ldx #8*4 ; offset for normal ldy #1 ; now we want ON jsr SetButtonValue brl LoopModal S_Spe ; pha sec sbc #8 tax lda buttonState,x Give me the item eor #$ffff sta buttonstate,x pla asl a tax phx pushword #0 lda PtrList+2,x pha lda PtrList,x pha _GetCtlValue pla plx and #1 eor #1 tay jsr SetbuttonValue brl LoopModal ; ;We go here when the user has selected OK or CANCEL ; fin pushlong pscreenport _CloseDialog ;close the dialog box _setport ;set back to the previous port lda IfCancelled ;get the OK/CANCEL flag rts EJECT ;------------------------------------------------------------------------------ ; ; NAME: SetButtonValue ; ; PURPOSE: Sets the control value to the value passed in Y-reg. ; ; PASSED: (Y-reg.) 0 = clear, 1= set ; (X-reg.) offset to the table of handles ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ EXPORT SetButtonValue SetButtonValue phy lda PtrList+2,x ; get handle to control pha lda PtrList,x pha _SetCtlValue ; set it rts ENDP ; StyleFilter ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; NAME: StyleFilter ; ; PURPOSE: Filter procedure for "StyleDialog" to detect when a button down ; event has occured on one of the portrait/landscape picture ; bitmaps. ; ; PASSED: Result WORD, (space for result) ; TheDialog LONG, pointer to the dialog's grafport ; Event LONG, pointer to the event ; ItemHit LONG, pointer to the item hit ; ; RETURNED: IgnoreFlag WORD, boolean, TRUE if event is to be ; ignored, FALSE if calling routine ; should handle event. ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ Stylefilter PROC EXPORT inButtDwn equ 1 ItemHit equ 7 Event equ ItemHit+4 TheDialog equ Event+4 Result equ TheDialog+4 ;Save registers and setup environment phd phb phk plb tsc tcd lda #0 sta result ;init result to true ;Copy Event record ldy #14 copyEvent lda [Event],y sta EventRecord,y dey dey bpl CopyEvent lda ZeroPage tcd ;Now see what kind of event it was lda EvtWhat ;get kind of event cmp #inButtDwn ;see if it was a button down beq down brl notDown ;exit if not ; ;We get here when we have a button down event ; Down ; ;Now see if it was in one of the bitmap images PushLong pScreenPort _setPort PushWord #0 PushWord #0 _setOrigin pushptr EvtWhere _globaltolocal pha pushptr EvtWhere Pushptr dstbitf1 _ptInrect ;see if it is in the portrait bitmap pla beq NotIn1 ;branch if not ; ;We get here if it was a button down event in the portrait bitmap image ; ldx #2*8 lda buttonstate,x ;get the current state bpl invertthem ;branch if changed brl notdown ;branch if no change ; ;We now test for in the landscape bitmap image ; NotIn1 ; pha ;for result pushptr EvtWhere Pushptr dstbitf2 _ptInrect pla ;get result beq NotDown ;branch if not in landscape bitmap ; ;We get here if it was a button down event in the landscape bitmap image ; ldx #2*9 lda buttonstate,x ;look at the current state bpl invertthem ;branch if changed brl notdown ;branch if no change ; ;We get here when we need to change the portrait/landscape images ; invertThem ; ldx #2*8 lda buttonstate,x ;get the current portrait state eor #$ffff sta buttonstate,x ;invert it inx inx lda buttonstate,x ;get the current landscape state eor #$ffff sta buttonstate,x ;invert it Pushptr dstbitf1 _invertRect ;invert portrait image pushptr dstbitf1 _framerect ;frame portrait image Pushptr dstbitf2 _invertRect ;invert landscape image pushptr dstbitf2 _framerect ;frame landscape image ; ;We get here when we are done or it wasn't a button down event ; notDown ; plb pld lda 0,s sta 12,s lda 2,s sta 14,s pla pla pla pla pla pla rtl ENDP EJECT ; InfoDialogs ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; INFORMATION DIALOG ROUTINES ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ InfoDialogs PROC EXPORT ;StatText equ 15 ;ButtonItem equ 10 ;------------------------------------------------------------------------------ ; ; NAME: OpenInfoPrepare ; ; PURPOSE: Brings up window which indicates what is about to happen. ; IMMEDIATE MODE: "Printing in Draft mode ..." ; DEFERRED MODE: "Preparing Data ..." ; ; PASSED: NONE ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ EXPORT OpenInfoPrepare OpenInfoPrepare PushLong #0 _getport ;get current port and save it pha _GetMasterSCB ; check mode from SCB pla and #$80 ;see which mode beq loc320 ;branch if 320 mode ; ;We get here if its 640 mode ; lda infowidth640 sta StyleWidth ;set the style width for 640 lda #640 ;get 640 bne loc640 ;branch ; ;We get here if its 320 mode ; loc320 ; lda infowidth320 sta StyleWidth ;set the style width for 320 lda #320 ;get 320 ; ;Remember: (A-reg. is 320 or 640 depending on mode) ; loc640 ; sec sbc StyleWidth lsr a sta InfoRect+2 ;set left clc adc StyleWidth sta InfoRect+6 ;set right PushLong #0 PushPtr InfoWindow _NewWindow ;bring up a new window pla sta infoDPort ;save it pla sta infoDPort+2 pushlong infoDPort _setPort ;set it as current port Pushlong InfoStrPos ;move to strings starting position _moveto lda method ;get method (immediate, deferred) bpl draftStr ;branch if immediate ;------------------------------------------------------------------------------ ; Deferred Mode ;------------------------------------------------------------------------------ pushptr InfoStrPrep ;get string "Preparing Data ..." bra DrawIt ;------------------------------------------------------------------------------ ; Immediate Mode ;------------------------------------------------------------------------------ draftStr ; pushptr InfoStrDraft ;get string "Printing in Draft mode ..." DrawIt _drawString ;draw the string in the window _setPort ;restore the old port rts Eject ;------------------------------------------------------------------------------ ; ; NAME: CloseInfo ; ; PURPOSE: Closes the info window. ; ; PASSED: NONE ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ EXPORT CloseInfo CloseInfo PushLong infoDPort _closeWindow rts ENDP Eject ;------------------------------------------------------------------------------ ; ; NAME: OpenInfoPrinting ; ; PURPOSE: Prepares and draws the opening info window ; ; PASSED: NONE ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ OpenInfoPrinting PROC Export ;StatText equ 15 ;ButtonItem equ 10 ByteOffset equ 5 ; since bitOffset is 40 ColorRibbon equ $0080 SheetFeeder equ $0040 PaperOut equ $0020 CoverOpen equ $0010 OffLine equ $0008 ShtFdrEmpty equ $0044 PaperJam equ $0004 PrinterFault equ $0002 HeadMoving equ $0001 PrinterBusy equ $8000 pha _GetMasterSCB ; check mode pla and #$80 beq loc320 ;branch if 320 mode ;We arrive here if its 640 mode lda infowidth640 sta StyleWidth ;set the width lda #640 bra loc640 ;We arrive here if its 320 mode loc320 ; lda infowidth320 sta StyleWidth ;set the width lda #320 loc640 ; sec sbc StyleWidth lsr a sta InfoRect+2 ;set left clc adc StyleWidth sta InfoRect+6 ;set right PushLong #0 PushPtr InfoWindow _NewWindow ;bring up the window pla sta infoDPort pla sta infoDPort+2 lda #PrintProcess ; go draw the string ldx #^PrintProcess jsr ShowString jsr GetStatus rts EJECT ;------------------------------------------------------------------------------ ; ; NAME: GetStatus ; ; PURPOSE: Checks for new status and displays the approapriate status message. ; ; PASSED: NONE ; ; RETURNED: NONE ; ; status buffer structure: ; bytes 0-3 : system stuff ; byte 4 : length byte of string ; byte 5 : status bits ; 0: color $0080 ; 1: sheetfeeder $0040 ; 2: out of paper $0020 ; 3: cover open $0010 ; 4: printer off line $0008 ; 5: paper jam $0004 ; 6: printer fault $0002 ; 7: print head is moving $0001 ; byte 6 : more status bits ; 0: printer is busy $8000 ; ; Special note: ShtFdrEmpty equ $0044 ; If a sheetfeeder is installed, it send back "paper jam" when it is out of paper ; not the usual "out of paper" error. ; ;------------------------------------------------------------------------------ EXPORT GetStatus GetStatus lda NoShowMessage ; do we need to do a status? beq @1 brl ExitShowStatus ; non zero says no @1 Jsr StatusPrinter ;see if its time to status device bcc doit rts doit ldx #byteOffset ; pick up the status bytes lda InfoStrBuffer,x tay ; save for further use and #PaperOut ; mask out other bits beq PaperNotOut PaperOutMsg dec PStatus lda #PaperOutStr ; set up for the appropriate ldx #^PaperOutStr ; string bra ShowString ; go and display it PaperNotOut tya and #CoverOpen beq CoverNotOpen dec PStatus lda #CoverOpenStr ldx #^CoverOpenStr bra ShowString CoverNotOpen tya and #PaperJam beq PaperNotJam tya and #ShtFdrEmpty cmp #PaperJam bne PaperOutMsg dec PStatus lda #PaperJamStr ldx #^PaperJamStr bra ShowString PaperNotJam tya and #OffLine beq NoProblem dec PStatus lda #OffLineStr ldx #^OffLineStr bra ShowString NoProblem stz PStatus lda #PrintProcess ldx #^PrintProcess EXPORT ShowString ShowString sta StringAddr ; store address in local variable stx StringAddr+2 PushLong #0 _getport ;get current port PushLong infoDPort _setPort ;set to info. dialog port PushPtr EraseInfoRect _eraseRect ;erase whats already there Pushlong InfoStrPos _moveto ;move to where to draw text PushLong StringAddr _drawString ;draw the text from InfoStrBuffer Pushlong CancelStrPos ;Message telling user how to cancel. _moveto ; PushLong #CancelStrPrint ; MSL 1/13/89 _drawString _setPort ;restore the port ExitShowStatus rts StringAddr DS.B 4 ;------------------------------------------------------------------------------ ; ; NAME: StatusPrinter ; ; PURPOSE: Gets the status from the device ; ; PASSED: NONE ; ; RETURNED: (Carry Flag) CLEAR= device was statused, SET=device not statused? ; ;------------------------------------------------------------------------------ EXPORT StatusPrinter StatusPrinter ; PushLong #0 ; _TickCount ;get the system tick count ; plx ; pla ; cmp newdate+2 ; beq testlower ; blt ExitStatus ;testLower txa ; cmp NewDate ; blt ExitStatus ; PushLong #0 ; _TickCount ; pla ; clc ; adc #60*5 ; sta NewDate ; pla ; adc #0 ; sta NewDate+2 ; ;We get here when its time to restatus the device ; ldx #4 lda #0 ; zero out the length and byte 5 sta InfoStrBuffer,x LoopStatus PushPtr InfoStrBuffer _PrDevStatus ;get the status of the device ldx #5 lda InfoStrBuffer,x ; the printer tends to randomly and #$00FF ; return $FF cmp #$00FF beq LoopStatus clc ;clear carry Rts ExitStatus sec ;set carry Rts NewDate DS.B 4 ENDP ; PrPicFile ***************************** * * * PrPicFile * * * * Current Rev: Nov. 1987 * * * ***************************** ;------------------------------------------------------------------------------ * * NAME: PrPicFile * * PURPOSE: To print a picture file * * PASSED: Users Print Record LONG Handle to print record * PortPtr LONG Pointer to graf port * PRStatus LONG Pointer to status record * * RETURNED: NONE * * NOTE:PortPtr cannot be same one returned by OpenDOC if we * allocated it ourselves. * * PortPtr can be zero. * ****************************************************************** PrPicFile PROC EXPORT DefineStack OrigD word 0 OrigB byte 0 rtl1 block 3 rtl2 block 3 UsersStatusPtr long 0 UsersPortPtr long 0 UsersPrintRecH long 0 * we need to get memory for everything. * * If the application gave us pPrPort, we will use it, * otherwise we will use our. ; brk 42 **PROFILE ; pha ; tool _GetTick,out=(>StartTime:l) ; pla pha lda >iPrErr ;see if any errors beq Continue ;branch if no errors cmp #PortNotOn ;see if port was not on bne Continue plx jmp Exit12 Continue ; pla phd tcd phb ;save bank reg phk plb ;use our bank ;-------------------------------------------------------------- ; ; Look at the error code again. If it is zero we go and print. ; if it is none zero, we do not allocate anything for printing ; and we dispose of things already allocated. ; lda iPrErr beq GoAheadAndMakeMyDay jmp PortDone GoAheadAndMakeMyDay ; lda method bmi spoolPrt brl NoErrorExit ; in draft printing we do nothing. spoolprt ; jsr OpenInfoPrinting ; put up dialog ;------------------------------------------------------------ ; ; Bring inputs to zero page. ; lda UsersStatusPtr,s sta PZ_PrStatus lda UsersStatusPtr+2,s sta PZ_PrStatus+2 lda UsersPrintRecH,s sta PZ_hPrint lda UsersPrintRecH+2,s sta PZ_hPrint+2 lda UsersPortPtr,s sta PZ_pPrPort lda UsersPortPtr+2,s sta PZ_pPrPort+2 ;------------------------------------------------------------ ; ; Look at port pointer. If it is nil, get our own. ; lda #false sta ourport lda PZ_pPrPort ora PZ_pPrPort+2 bne userPort lda #true sta ourport lda #PortSize ldx #%1000000000011000 ; locked and dont cross bank jsr OurGetHandle bcc @1 sta iPrErr brl NoPort @1 sta PZ_pPrPort stx PZ_pPrPort+2 lda [PZ_pPrPort] tax ldy #2 lda [PZ_pPrPort],y sta PZ_pPrPort+2 stx PZ_pPrPort userPort ; pei PZ_pPrPort+2 pei PZ_pPrPort _OpenPort ;------------------------------------------------------------ ; ; Now look at status record pointer ; lda #false sta ourStatus lda PZ_PrStatus ora PZ_PrStatus+2 bne userStatus lda #OurStatusRecord sta PZ_PrStatus lda #^OurStatusRecord sta PZ_PrStatus+2 lda #true sta ourStatus UserStatus ; ;------------------------------------------------------------ ; ; Initialize the status record ; ldy #StatRecSize-2 ; first zero it lda #0 ZeroLoop sta [PZ_PrStatus],y dey dey bpl ZeroLoop lda PZ_PrStatus ; put pointer to port in status rec ldy #pPrPort sta [PZ_PrStatus],y iny iny lda PZ_PrStatus+2 sta [PZ_PrStatus],y lda PZ_hPrint ; put handle to print record ldy #shPrint ; into status record. sta [PZ_PrStatus],y iny iny lda PZ_hPrint+2 sta [PZ_PrStatus],y ;------------------------------------------------------------ ; ; Transfer the print record to the internal print record. ; PushLong PZ_HPrint PushLong #HPrint PushLong #TPrintSize _HandToPtr ;------------------------------------------------------------ ; ; Get memory for the print buffer. Mangled for speed. MSL ; ;------------------------------------------------------------ ; ; First, get a 64K buffer to be safe with quickdraw. MSL ; ; Test for the pathological case. If we can't get 64K for quickdraw and ; 40K for ourselves (104K contiguous) chances are good that we'll crash during ; printing. ; ; So, after we find our 104K, we give it back, then reserve the 64K for QD. ; Finally, we start trying to find our buffer, starting at 60K. ; This absotively, posilutely insures that we will have at least a 20K buffer if ; we try to print, and we should be able to just squeeze by in the worst case... ; ; Admittedly, it is possible. ; ; OK, OK... or *not* contiguous! bra DoBufCalc ; pha ; pha ; pea 1 ; pea $A000 ; PushWord UserID your ID ; pea $C000 ; pea 0 ; pea 0 ; _NewHandle result on the stack!!! ; bcc DoBufCalc ; sta iPrErr ; pushlong #LowMemMsg ; jsl ShowErr ; pla Clean up stack. ; pla ; brl DoClosePort NoBandMem _DisposeHandle Clean up stack. bra NoMemMsg NoBandNoDispose pla pla NoMemMsg lda #$0201 sta iPrErr pushlong #LowMemMsg jsl ShowErr brl DoClosePort DoBufCalc ; _DisposeHandle ; it was there, ... yea... pha ; Lock down 64K saved for QD. pha pea 1 pea 0 PushWord UserID your ID pea $C000 pea 0 pea 0 _NewHandle result on the stack!!! bcs NoBandNoDispose lda #$C0 ; try for a 60K buffer (max) first. sta bandheight jsr CalcBandSize lda hprint+prXInfo+iDevBytes ldx #%1000000000011000 ; locked and dont cross bank jsr OurGetHandle bcc GotBandBuf lda #$100 ; Now try 128=40K, 64=20K, 32=10K sta bandheight PrBufCalcLoop lsr bandheight lda bandheight cmp #$20 blt NoBandMem ; if it gets less than height of 32 (10K buffer), give up. ; things are *probably* hopeless... jsr CalcBandSize lda hprint+prXInfo+iDevBytes ldx #%1000000000011000 ; locked and dont cross bank jsr OurGetHandle bcs PrBufCalcLoop GotBandBuf sta hprbuf stx hprbuf+2 lda [hprbuf] sta pPrBuf ldy #2 lda [hprbuf],y sta pPrBuf+2 _DisposeHandle Clean up stack (old 64K buf for QD). MSL ;------------------------------------------------------------ ; ; lit la valeur dans le buffer de la picture. ; (initialize the page number field of status record?) ; [Read the picture buffer value] lda ipagenum ldy #itotpages sta [PZ_PrStatus],y jsr PrPrintit parameters are shared in zero page ;------------------------------------------------------------ ; ; maintenant libere les buffers si ce sont les notres ; Or (now free the buffers that we own.) ; [if they are ours] pushlong hprbuf _disposehandle ;------------------------------------------------------------ ; ; Close the port. ; DoClosePort pushLong PZ_pPrPort _closePort lda ourport cmp #true bne portdone pha pha PushLong PZ_pPrPort _FindHandle _disposehandle NoPort jsr CloseInfo ; get rid of window dialog Portdone ; ;---------------------------------------------------------- ; ; Kill each of the pictures in the piclist, using ifstpage ; ilstpage as start and end points. ; lda [hPicList] ; first deref the pic list sta pPiclist ldy #2 lda [hPicList],y sta pPicList+2 ldx #0 ; start at 0 KillNextPic cpx iPageNum ; check against total pages bcs KillPicList ; no more if >= pagenum txa asl a ; mult by 4 asl a tay ; use as index into table lda [pPicList],y sta hnewPic iny iny lda [pPicList],y sta hNewPic+2 phx ; save counter PushLong hNewPic ; Dispose of this picture _KillPicture plx ; get X back inx ; bump count bra KillNextPic ;------------------------------------------------------------------ ; ; Now we can get rid of the picList itself ; KillPicList PushLong hPicList _DisposeHandle PushLong CursorAd _SetCursor NoErrorExit ; ; tool _GetTick,out=(>EndTime:l) **PROFILE ; sublong >EndTime,>StartTime,>EndTime ; brk 42 lda iPrErr this will be the normal exit plb pld jmp exit12 ENDP EJECT ;------------------------------------------------------------------------------ * * NAME: PrPixelMap * * PURPOSE: Prints out the pixel map * * PASSED: SrcLocPtr LONG, ptr to source LocInfo * SrcRectPtr LONG, ptr to source rect * ColorFlag WORD, 0 = B/W, else Color * * RETUNED: NONE * ;------------------------------------------------------------------------------ PrPixelMap PROC EXPORT DefineStack OrigD word 0 OrigB byte 0 rtl1 block 3 rtl2 block 3 ColorFlag word 0 SrcRectPtr long 0 SrcLocPtr long 0 pha ; save value of d pha _DevIsItSafe pla bne Yes lda #PortNotOn sta >iPrErr plx jmp Exit8 Yes ; pla ;------------------------------------------------------------ ; ; save the registers and set direct page and data bank ; phd tcd phb phk plb ;------------------------------------------------------------ ; ; Get the current port's pointer and leave it on the stack ; for restoring just before returning. ; pha pha _GetPort ;------------------------------------------------------------ ; ; Get the current cursor record's address and turn on the watch cursor. ; PushLong #0 ; space for the address _GetCursorAdr pla sta CursorAd pla sta CursorAd+2 _WaitCursor ;------------------------------------------------------------ ; ; Clear the error code and disallow status display ; stz iPrErr ; zero error lda #True sta NoShowMessage ;------------------------------------------------------------ ; ; Get new handle for print record. This is necessary because ; StartLLD uses the values in the print record to set up ; parameter such as page rectangle, color and quality for ; the printer. ; lda #TPrintSize ; size of handle ldx #%1000000000011000 ; attributes jsr OurGetHandle bcc @1 sta iPrErr brl NoPrintRec @1 sta PrintRecord stx PrintRecord+2 PushLong PrintRecord _PrDefault ;------------------------------------------------------------ ; ; Check if the application asked for color. If so, set bit ; 5 of wdev in prStl of the print record. ; lda ColorFlag+4,s beq BlackWhite lda hprint+prStl+wDev ora #f5 sta hprint+prStl+wDev BlackWhite ; ;------------------------------------------------------------ ; ; Get a handle for a grafport. ; lda #PortSize ; size of handle ldx #%1000000000011000 ; attributes jsr OurGetHandle bcc @1 sta iPrErr brl NoPort @1 sta temp1 stx temp1+2 lda [Temp1] sta PZ_pPrPort ldy #2 lda [Temp1],y sta PZ_pPrPort+2 ;------------------------------------------------------------ ; ; Open the grafport. ; pei PZ_pPrPort+2 pei PZ_pPrPort _OpenPort ;----------------------------------------------------------- ; ; Start up the low level driver ; jsr startLLD bcc Continue ; error checking added sta iPrErr ; by Suki 5/25/88 brl ErrorExit ;------------------------------------------------------------ ; ; Get source bitmap information off the stack into local area ; Continue lda SrcLocPtr+4,s sta temp1 ; temp1 has Ptr to SrcLoc lda SrcLocPtr+2+4,s sta temp1+2 ldy #14 MoveLoc lda [temp1],y sta LocalLoc,y dey dey bpl MoveLoc lda temp1 clc adc #8 sta LocalBoundsPtr ; this ptr used for intersection call lda temp1+2 adc #0 sta LocalBoundsPtr+2 lda SrcRectPtr+4,s sta temp2 ; temp2 is ptr to source rect lda SrcRectPtr+2+4,s sta temp2+2 PushWord #0 ; Result PushLong LocalBoundsPtr PushLong temp2 PushLong #LocalRect ; intesected rect goes here _SectRect pla beq NoIntersection ; if false, no intersection ;--------------------------------------------------------------- ; ; Look at the source rect. If its upper/left corner is 0,0 ; then no adjustment is necessary. If it is not 0,0, we must ; adjust the pointer to the pixel map so that it points to ; the first pixel in the source rect. ; ; Note that this scheme does not work with source rects that ; do not have the first pixel to draw as the first pixel in ; a byte. ; lda LocalRect sec sbc LocalLoc+8 beq NoAdjustmentY pha ; space for result pha pha ; Top of src rect PushWord LocalLoc+6 ; width _Multiply pla clc adc LocalLoc+2 sta LocalLoc+2 pla adc LocalLoc+4 sta LocalLoc+4 NoAdjustmentY ; lda LocalRect+2 sec sbc LocalLoc+10 beq NoAdjustmentX lsr a bit LocalLoc-1 bpl ModeWas320 lsr a ModeWas320 clc adc LocalLoc+2 sta LocalLoc+2 bcc NoCarryHere inc LocalLoc+4 NoCarryHere ; NoAdjustmentX ; lda LocalRect sta LocalLoc+8 lda LocalRect+2 sta LocalLoc+10 lda LocalRect+4 sta LocalLoc+12 lda LocalRect+6 sta LocalLoc+14 ;------------------------------------------------------------ ; ; Call LLDBitMap using the adjusted (if necessary) values in ; LocalLoc and LocalRect. ; PushLong #LocalLoc PushLong #LocalRect PushWord UserID lda hprint+prstl+wdev and #f7 jsl LLDBitMap jsl NewPage ; spit out paper when we're done ;------------------------------------------------------------ ; ; Close the grafport. ; NoIntersection ; ;------------------------------------------------------------ ; ; We need to shut down low level driver. ; pushword UserID jsl LLDShutDown ErrorExit pei PZ_pPrPort+2 pei PZ_pPrPort _ClosePort ;------------------------------------------------------------ ; ; Get rid of the memory we allocated for grafport and print ; record. ; pha ; first find the handle to pha ; memory that port is in. pei PZ_pPrPort+2 pei PZ_pPrPort _FindHandle _DisposeHandle ; then dispose it. NoPort PushLong PrintRecord _DisposeHandle NoPrintRec ;------------------------------------------------------------ ; ; Turn off the watch cursor. PushLong CursorAd _SetCursor ;------------------------------------------------------------ ; ; Restore the user's last current port, the pointer to it was ; left on the stack at the beginning of this routine. ; _SetPort ;------------------------------------------------------------ ; ; We are done. ; lda iPrErr plb pld jmp Exit10 PrintRecord DS.B 4 LocalBoundsPtr DS.B 4 LocalLoc DS.B 16 LocalRect DS.B 8 ENDP EJECT ; PrPrintIt ;------------------------------------------------------------------------------ * * NAME: PrPrintIt * * PURPOSE: Prints one document (an internal routine called by PrPicFile.) * (All parameters are passed via zero page and in memory.) * * PASSED: NONE * * RETURNED: NONE * ;------------------------------------------------------------------------------ PrPrintit PROC EXPORT ;---------------------------------------------------------- ; ; We look at the idle proc in the print record. ; If it is NIL then we put a pointer to our IDLE proc ; in its place. ; lda hPrint+PrJob+pIdleProc ora hPrint+PrJob+pIdleProc+2 bne useridle lda #TmpTime:l) **PROFILE PushLong hNewPic PushLong #SizingRect _drawpicture ; tool _GetTick,out=(>EndTime:l) **PROFILE ; sublong >EndTime,>TmpTime,>TmpTime ; addlong >TmpTime,>DrawTime,>DrawTime ;----------------------------------------------------------- ; ; Gather and show status of printer ; jsr GetStatus jsl CallIdleProc ;---------------------------------------------------------- ; ; Print it. ; pushptr bandport PushLong #rBand pushword UserID lda hprint+prstl+wdev and #f7 jsl LLDBitmap ;----------------------------------------------------------- ; ; Gather and show status of printer ; ; jsr GetStatus ; jsl CallIdleProc ;---------------------------------------------------------- ; ; Close the band port. ; PushPtr BandPort _ClosePort ;---------------------------------------------------------- ; ; Clear the imaging flag. ; lda #false ldy #fImaging sta [PZ_PrStatus],y ;---------------------------------------------------------- ; ; Calculate the next band position. Different for ; portrait vs landscape. ; lda hPrint+prStl+wDev and #f1 bne addv ; Landscape lda rBand+left clc adc hPrint+PrXInfo+iBandH sta rBand+left lda rBand+right clc adc hPrint+PrXInfo+iBandH sta rBand+right bra Added ; Portrait addV ; lda rBand+Bottom sta rBand+Top added ; ;---------------------------------------------------------- ; ; See if we are done. ; ldy #iCurband ; bump cur band and put back lda [PZ_PrStatus],y inc a sta [PZ_PrStatus],y ; dec a ; dec by one ; ldy #iTotBands ; and compare to total bands ; cmp [PZ_PrStatus],y ; bcs noMoreBands ; greater or equal and we are done. lda linesleftonpage beq nomoreBands bmi nomoreBands brl NewBand ; else new band nomoreBands ; jsr detectnewmode bcc alldone brl newmode alldone ; ;---------------------------------------------------------- ; ; Check if printing with gap or no gap, don't send form feed ; if no gap is chosen lda hPrint+prStl+wDev and #f6 beq NoFormFeed ; 0 is no gap jsl newpage ;---------------------------------------------------------- ; ; Bump page count ; NoFormFeed ldy #iCurPage ; bump curpage lda [PZ_PrStatus],y inc a sta [PZ_PrStatus],y ; and put back dec a ldy #iTotPages ; look at total pages cmp [PZ_PrStatus],y ; compare to curpage bcs NoMorePages brl XnewPage NoMorePages ; ;---------------------------------------------------------- ; ; Bump copy count. ; ldy #iCurCopy lda [PZ_PrStatus],y inc a sta [PZ_PrStatus],y dec a ldy #iTotCopies cmp [PZ_PrStatus],y bcs NoMoreCopies brl newCopy nomoreCopies ; ;---------------------------------------------------------- ; ; This is where we go if idle proc gets tells us to quit. ; EXPORT EndOfPrinting EndOfPrinting pushword UserID jsl LLDShutDown Exit rts Export hNewPalette hNewPalette DC.L paletteData paletteData DS.B $20 Page_Remain DS.B 2 BandModeNum DS.B 2 nextbottom DS.B 2 newSCB DS.B 2 oldSCB DS.B 2 PageBandNum DS.B 2 EXPORT CurLLDMode CurLLDMode DS.B 2 EJECT ;------------------------------------------------------------------------------ ; ; NAME: CalcModeRemain ; ; PURPOSE: Calculate the mode that remains ; ; PASSED: NONE ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ *= set up a new band remain for the current mode. * update also the page remain by the difference. EXPORT CalcModeRemain CalcModeRemain lda newscb ;get the new scan control byte eor #$0f sta oldScb ;update as the old one jsr detectnewmode ;see if its a new mode rts ;------------------------------------------------------------------------------ ; ; NAME: DetectNewMode ; ; PURPOSE: Detects if a mode change occurs and sets things up appropriately ; ; PASSED: NONE ; ; RETURNED: (Carry) CLEAR, no change or done ; SET, change ; ;------------------------------------------------------------------------------ detectnewmode ; ; si BandModeNum= num de la list ; ou pas de list ; ou landscape ; alors clc ; sinon setup the new values and return sec. lda hprint+prStl+wDev and #f1 beq EscapeDone ; ok it is portrait lda Page_remain beq EscapeDone ; test if there is a SCBList lda hPrint+PrXInfo+SCBList sta Temp1 lda hPrint+PrXInfo+SCBList+2 sta Temp1+2 ora Temp1 beq EscapeDone lda BandModeNum cmp [Temp1] blt goodenough EscapeDone clc rts EscapeDone1 pla clc rts goodenough ; pha pha pha lda #$24 ;each entry is $24 pha _multiply ply pla iny ;pass over the length iny lda [Temp1],y sta nextbottom iny iny lda [Temp1],y phy tax xba and #$ff ldy #icurpage cmp [PZ_PrStatus],y bne EscapeDone1 txa and #$ff sta newSCB ; read palette. ply iny iny ldx #0 looppall lda [Temp1],y sta palettedata,x iny iny inx inx cpx #$20 bne looppall ; compare with old scb and update width and lld mode lda newscb eor oldSCB and #$80 beq setPalette ; we changed mode (320-640) ; update LLD lda CurLLDMode ora #1 ;set 640 ldx NewSCB cpx #$80 bge ok640 and #$fffe ok640 pha pushword UserID jsl LldSetQuality ;set the mode ; update the Width. lda NewScb cmp #$80 bge do640 ; now 320 lsr hPrint+PrXInfo+iBandH bra setpalette do640 asl hPrint+PrXInfo+iBandH setpalette ; Pushlong hNewPalette Pushword #0 Pushword UserId jsl lldsetcolor ; ok now calculate the new BandRemain. inc BandModeNum ; test if double sized, so double new bottom. lda hprint+prStl+wDev and #f0 beq easy1 asl nextbottom easy1 ; lda nextbottom sec sbc rband+top beq goAgain bge more1 goAgain brl detectnewmode more1 cmp Page_Remain blt more2 lda Page_Remain more2 sta linesleftonpage lda Page_Remain sec sbc linesleftonpage sta Page_Remain ; update old SCB lda newSCB sta oldSCB sec rts EJECT ;------------------------------------------------------------------------------ ; ; NAME: CalcPageBandNum ; ; PURPOSE: Calculates the number of page bands ; ; PASSED: NONE ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ CalcPageBandNum ; pha stz PageBandNum ;default is failed lda hPrint+PrXInfo+SCBList sta Temp1 lda hPrint+PrXInfo+SCBList+2 sta Temp1+2 ora Temp1 beq Loose ; on va parcourir la list et s'arreter sur la premiere valeur ; correspondant a cette page. lda [temp1] bne win loose pla rts win ; tax lda Temp1 clc adc #2 sta Temp1 bcc noInc2 inc Temp1+2 noInc2 ; txa loop ; pha ldy #2 lda [temp1],y xba and #$ff cmp 3,s blt more beq found pla pla rts ;page num too big found pla pla rts more ; lda Temp1 clc adc #$24 sta Temp1 bcc noInc inc Temp1+2 noInc inc PageBandNum pla dea bne loop pla rts ENDP EJECT ;------------------------------------------------------------------------------ * * NAME: StartLLD * * PURPOSE: Shared routine to startup the low level routines. * * PASSED: NONE * * RETURNED: NONE * ;------------------------------------------------------------------------------ startLLD PROC EXPORT ; ;First calculate zero page area for low level routines. ; tdc ;give lld our zero page clc adc #$100 ;add $100 for next zero page ;NOTE: low level zero page is $100 above current zero page pha pushword UserID jsl LLDStartup ;startup low level routines ;----------------------------------------------------------- ; ; Added error checking code. Suki Lee May 25, 1988 ; bcc @1 brl ErrorExit @1 jsr GetStatus ; what state is printer in? * set paper rect for the LLD stz LLD_PaperRect ;zero it stz LLD_PaperRect+2 PushLong #0 PushLong #0 lda hPrint+PrStl+iPageV pha lda #6 pha _multiply pla plx pha lda #5 pha _Udivide pla sta LLD_PaperRect+4 pla PushLong #0 PushLong #0 lda hPrint+PrStl+CRwidth pha lda #4 pha _multiply pla plx pha lda #3 pha _Udivide pla sta LLD_PaperRect+6 ;equals CRwidth*4/3 pla ; ;Set the low level Page Rectangle ; pushptr LLD_PaperRect pushword UserID jsl LLDSetPageRect * set quality for the printer pushword #%1000000000000001 high color lda hprint+prStl+wdev ;see if 2x zoom and #f3 beq hires ;branch if 2x lda hprint+prStl+wdev ;see if high resolution and #f0 beq size2 ;branch if not high resolution hires pla pushword #%1000000000000011 high res size2 ; lda hPrint+prStl+wDev ;see if portrait and #f1 bne portrait2 ;branch if portrait pla ora #$4000 landscape pha portrait2 ; ;------------------------------------------------------------------------ ; ; Check if Condensed vertically ; lda hprint+prstl+wdev and #f2 bne Vsizing ; yes pla ora #$2000 pha Vsizing ; lda deadloc2 and #$80 bne lld640 pla and #$fffe mode320 for lld pha lld640 ; ;----------------------------------------------------------- ; ; Check the printer info string for presence of color ribbon. The format of ; this string for the ImageWriter II is: IW10CF ; where IW = ImageWriter II ; 10 = carriage width ; C = if color ribbon installed ; F = if sheet feeder installed ; ; string format for the ImageWriter LQ is: LQ1CFEnP ; where LQ = ImageWriter LQ ; 1 = 15" carriage width ; C = if color ribbon installed ; F = if sheet feeder installed, no envelope ; E = if sheet feeder w/envelope installed ; n = # of sheet feeders ; P = if in pull tractor mode ; ; The string is terminated by a carriage return ; Note: An ImageWriter I will not respond to the query. ; ldx #8 LoopZero lda #0 ; makes sure the string is clean sta PtrType,x dex dex bpl loopZero PushPtr PtrType jsl CheckPrinter ; go get its type lda PtrType ; no reponse --> IW I beq BW ldx #4 ; assume Imagewriter II for now cmp #$514C ; see if it's an LQ bne LWII ldx #3 ; it's an LQ LWII lda PtrType,x and #$00FF cmp #$0043 ; letter C? bne BW lda hPrint+prStl+wDev ;see if color/bw and #f5 bne Color ;branch if color BW pla and #$7fff ;is b/w pha Color ; lda 1,s ;get mode sta curLLDMode ;save for CurLLDMode pushword UserID jsl LldSetMode ;set low level mode Pushlong hpalette Pushword #0 Pushword UserId jsl lldsetcolor ;set the color lda #0 ErrorExit rts Export hpalette hpalette DC.L $e19e00 Export PtrType PtrType DS.B 10 ENDP EJECT ;------------------------------------------------------------------------------ * * NAME: PrAbortCheck * * PURPOSE: This is the routine that is the default idel proc. if the user * doesn't specifiy one in the print record. * * PASSED: NONE * * RETURNED: NONE * ;------------------------------------------------------------------------------ PrAbortCheck PROC EXPORT should be in scc68k more ; PushWord #0 PushWord #$0408 KeyDown PushPtr EventRecord _getNextEvent pla beq bye lda evtmsg cmp #$2E bne more lda evtmods and #$0100 beq more lda #iPrAbort sta iPrErr bye rtl ENDP ;------------------------------------------------------------------------------ * * NAME: CallIdleProc * * PURPOSE: * This routine calls the idle proc given in the print record. * Upon return, it checks iPrErr. If it is not zero we do not * return to calling routine. * * PASSED: NONE * * RETURNED: NONE * ;------------------------------------------------------------------------------ CallIdleProc PROC EXPORT jsl CallIt ;actually call the idle proc routine lda iPrErr beq Done ;-------------------------------------------------------------- ; ; If user wanted to quit we should eject current page if something ; has been printed on it already. ; ldy #fPgDirty lda [PZ_PrStatus],y beq dontEject ; if not dirty, don't eject jsl NewPage dontEject phb ; 3 bytes on stack this makes 4 plx ; now pull off 4 plx brl EndOfPrinting Done rtl EJECT ;------------------------------------------------------------------------------ ; ; NAME: CallIt ; ; PURPOSE: This routine sets up the stack so that it will rtl to the ; idle proc (which was specified in the print record, or the ; default one). ; ; PASSED: NONE ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ EXPORT Callit CallIt ; lda hPrint+PrJob+pIdleProc+1 ;get the idel proc. addr. pha ;push onto the stack phb lda hPrint+PrJob+pIdleProc dec a sta 1,s ;push the rest of the addr. rtl ;rtl to the idle proc. routine ENDP ;------------------------------------------------------------------------------ * * NAME: InsertPaperAlert * * PURPOSE: Alert Box for manual feed; to let user know the next sheet of * paper should be inserted. * * PASSED: NONE * * RETURNED: NONE * ;------------------------------------------------------------------------------ InsertPaperAlert PROC EXPORT PushLong CursorAd _SetCursor ; restore cursor back to arrow pha ; make room for result _GetMasterSCB pla pha ; make room for result of alert call and #$80 ; check mode beq mode320 ; 320 mode pushlong #alerttemp640 ; use 640 mode template bra GoOn mode320 pushlong #alerttemp320 ; use 320 mode template GoOn pushlong #$0000 _Alert ;------------------------------------------------------------ ; ; Get the current cursor record's address and turn on the watch cursor. ; PushLong #0 ; space for the address _GetCursorAdr pla sta CursorAd pla sta CursorAd+2 _WaitCursor ; set to watch again plx ; get the item hit off stack rts ENDP ;-------------------------------------------------------------- ; ; ShowErr(msg) ; ShowErr PROC EXPORT input msgptr:l begin +b _SysBeep _SysBeep PushLong #0 _getport ;get current port PushLong infoDPort _setPort ;set to info. dialog port PushPtr EraseInfoRect _eraseRect ;erase whats already there Pushlong InfoStrPos _moveto ;move to where to draw text PushLong msgptr _drawString ;draw the text from InfoStrBuffer _setPort ;restore the port ; Wait for a while to let the user see it. lda #$1FFF loop1 ldx #$00FF loop2 dex bne loop2 dea bne loop1 return ENDP \ No newline at end of file diff --git a/appleworksgs/IW.CL/Src/iw.asm b/appleworksgs/IW.CL/Src/iw.asm new file mode 100755 index 0000000..a98a72e --- /dev/null +++ b/appleworksgs/IW.CL/Src/iw.asm @@ -0,0 +1 @@ + STRING ASIS BLANKS OFF ***************************************************************** * * The Print Manager * ImageWriter Driver v2.2 * * Coding Started Summer 1986 by Luc Barthelet and VersionSoft * * Version 1.0 April 22, 1987 Suki Lee *------------------------------------------------------------------------------- * * Version 1.1 May 7, 1987 Suki Lee * * fPgDirty flag in status is updated correctly and is used to * check if a form feed should be used when user aborts. *------------------------------------------------------------------------------- * * Version 1.2 June 3, 1987 Suki Lee * * Fixed bug in 50% Better Text mode and 50% Landscape. * New features added: Condensed * PrPixelMap - prints pixel maps * mixed modes and color palettes on same * page (Not tested) *------------------------------------------------------------------------------- * * Version 1.3 July 13, 1987 Suki Lee * * New style dialog - vertical sizing is now a separate section * with radial buttons rather than a check box under printer * effects. * Fixed line spacing bug in draft text in condensed mode. * *------------------------------------------------------------------------------- * Version 2.0 November 1987 Dan Hitchens * * Major revision of code. * -Source code was gone through and commented. * -Low level routines were modified, restructured or even eliminated. * -Elimination of access to low level routines by user * -Speed enhancements were incorporated (Primarily in LLD.POINT) * -rPage (vRes) now reflects vertical condensed printing * -Bugs were fixed: * -320 mode landscape with vertical condensed was fixed. * -Landscape (with vertical condensed) was always imaging off the * page (image was too high causing it to be chopped at the top) * -The Job dialogs FROM and TO line edit items were not always * displaying or setting the insertion point correctly. * * Version 2.0d5 February 10, 1988 Harry Yee & Steve Glass * The procedure PrintCheck and its corresponding routines have been commented out * because none of this code was really being used and it caused problems while * printing to a spooler. * * Version 2.0d6 March 1, 1988 Suki Lee & Steve Glass * Bug fix: Move the code to initialize the port and to reset the printer from * LLDText to LLDStartUp. Deleted the same code from InitPrinting (called at the * beginning of LLDBitMap). Now the port is initialized only once at startup time * and not each time LLDText and LLDBitMap is called. * Commented out CheckPrinter routine since it is not being called by anyone. * Also commented out InitSSC and replaced calls to it with calls to ResetPrinter * since the two functions similarly. * The escapes codes for resetting the printer has been modified to used the * default character, Elite, rather than Pica since the printer is optimized to * print in Elite. * * Version 2.0d7 March 25, 1988 Suki Lee * Bug fix: added filtering of c cedilla in LLDText so the character will be * printed in draft mode. *------------------------------------------------------------------------------- * * Version 2.1d2 May 5, 1988 Suki Lee * Bug fix: * - Added code to check status of AppleTalk connected printer. Puts up * appropriate message to warn user of condition. * - LQ no longer ejects an extra page for each page printed. * Version 2.1d3 May 9, 1988 Suki Lee * Bug fix: * - Added code to ask the printer for an ID which indicates if a color ribbon * is installed. If printing to an ImageWriter I or if no color ribbon is * installed, the color selection on the job dialog is overridden. The routine * CheckPrinter which was removed in 2.0d6 has been modified and added back. * * Version 2.1d4 June 8, 1988 Suki Lee * Bug fix: * - Added error checking for opening connection to device. * * Version 2.1d5 June 24, 1988 Suki Lee * Bug fix: * - Took out branch for background printing in LLDStartup which doesn't clean * up the stack properly. *------------------------------------------------------------------------------- * * Version 2.2d1 July 25, 1988 Suki Lee * Bug fix: * - Added a flag to indicate when not to display status message, as in the case * of PrPixelMap where the dialog box is not put up. * * Version 2.2d2 July 26, 1988 Suki Lee * Bug fix: * - When printing in Better Text mode, some color text were not printed when * color is not selected, no color ribbon is installed in an ImageWriter II, * or printing to an ImageWriter I. Fixed the logic in MakePattern, which * calculates the dot pattern for color mapping, so the correct branch is taken * for 640 mode high resolution. Also changed the names of some of the branch * labels for clarity. * * Version 2.2d3 August 5, 1988 Suki Lee * Bug fix: * - AppleTalk will not return from a synchronous write if something happened to * the device while the write is in progress. This poses a problem for error * conditions such as out of paper for an AppleTalk connected ImageWriter. As * per Greg Seitz, recovery is possible if asynchronous writes are used. This * change is made in the subroutine PrDevWrite. Also rewrote the loop logic in * this routine because it was wasteful. * - Use GetCursorAd before the WaitCursor call and use SetCursor instead of * InitCursor when done to restore the original cursor. * * Version 2.2 (Claris) October 15, 1988 Scott Lindsey (MSL) * Bug fix: * - Added code to calculate correct printer resolution for Landscape mode. * Hacks: (work-arounds that are really incorrect code.) * - PrOpenDoc no longer calls PrValidate; this so the user can poke values * (such as a different page size) into the print record. * - So that the above is of any use, PrPrintIt looks at the first rpage * instead of PrInfoPt when calculating # of bands to print per page. * * Version 2.2.1 (Claris) December 12, 1988 Scott Lindsey (MSL) * Speed Optimization: * - PrPicFile: Instead of always using a 10K buffer for printing the band into, * as large a buffer as possible up to 64K is used. This significantly increases * the speed of printing bitmaps at the cost of some memory. * This also required some code be moved from CiXMetrics to a seperate routine * that can be called just after allocating the memory. * Safety Check: * - PrPicFile: Before printing, a 64K buffer is allocated then freed to see if * there is enough memory for Quickdraw to (potentially) use. * User friendliness: * - An error message routine for printing 'not enough memory' type messages into * the status box. A delay loop allows the user to read the message before it * continues on to whatever nastiness will follow. * Feature: * - There is now a Darker checkbox that allows the user to specify * double overstrike in non-draft mode printing. * This has been accomodated in the print record, etc. * ***************************************************************** ***************************************************************** * * Copyright 1986-1988 * Apple Computer, Inc. * All Rights Reserved * ***************************************************************** * Absaddr on * Keep IW ; MCOPY iw.macros Print off if (&FINDSYM(&SYSGLOBAL,'DUMPIT')) THEN include 'm16.stack' include 'm16.cmp' include 'all.macros' include 'iw.macros' DUMP 'iw.sym' GOTO .quit else LOAD 'iw.sym' endif Print on ;------------------------------------------------------------ ; ; Global Equates ; US EQU 0 FR EQU 1 Pays EQU US VersionNb EQU $0202 ; Version 2.2 ;------------------------------------------------------------ ; ; error codes ; PortNotOn EQU $1302 NoPrintRecord EQU $1303 PntrConFailed EQU $1308 True EQU $FFFF False EQU $0000 ENTRY PrintDefault ;_PrDefault ENTRY PrValidate ENTRY PrStlDialog ENTRY PrJobDialog ENTRY PrDrvrVer ENTRY PrOpenDoc ENTRY PrCloseDoc ENTRY PrOpenPage ENTRY PrClosePage ENTRY PrPicFile ENTRY PrError ;;;;;dummy for now;;;;;; ENTRY PrError ENTRY PrSetError ENTRY PrChanged ENTRY PrPixelMap ENTRY PrPixelMap ;;;;;dummy for now;;;;;;; ENTRY LLDBitMap ENTRY LLDSetPenPos ENTRY LLDText ENTRY LLDBitMap ENTRY LLDSetPenPos ENTRY LLDText ENTRY LLDShutDown ENTRY LLDSetQuality ENTRY LLDSetColor ENTRY LLDStartup ENTRY LLDSetPageRect ENTRY LLDSetMode ENTRY Print_Test ; ENTRY ButtonState ENTRY OpenInfoPrepare ENTRY OurGetHandle ENTRY StartLLD ENTRY CloseInfo ENTRY NewPage ; ENTRY DeadLoc ; ENTRY StyleRect ; ENTRY StyleWidth ; ENTRY JobDTemplate ; ENTRY JDRBO ; ENTRY JDRB10 ; ENTRY L1 ; ENTRY L2 ; ENTRY NamePos ; ENTRY SlashStr ; ENTRY J1StrNum ; ENTRY J1StrList ENTRY JobFilter ; ENTRY CopieFinalValue ; ENTRY FromFinalValue ; ENTRY ToFinalValue ; ENTRY IfCancelled ; ENTRY EventRecord ; ENTRY EvtWhat ; ENTRY EvtMsg ; ENTRY LandSC_P ; ENTRY Portrait_P ; ENTRY Pixel640 ; ENTRY Pixel320 ; ENTRY Portrait_R ; ENTRY LandSC_R ; ENTRY DstBitR1 ; ENTRY DstBitF1 ; ENTRY DstBitR2 ; ENTRY DstBitF2 ENTRY StyleDialog ENTRY JobDialog ; ENTRY JDRBO ; ENTRY JISTRNum ; ENTRY JIPosList ; ENTRY JIStrList ; ENTRY PixelWidth ; ENTRY Istrnum ; ENTRY Iposlist ; ENTRY Istrlist ; ENTRY OKrect ; ENTRY OKStr ; ENTRY CancelRect ; ENTRY CancelStr ; ENTRY ARectList ; ENTRY AStrList ; ENTRY JDRB0 ; ENTRY AStrNum ; ENTRY PP_Portrait ; ENTRY PP_Landsc ; ENTRY PtrList ENTRY StyleFilter ; ENTRY EvtWhere ; ENTRY InfoWidth640 ; ENTRY InfoWidth320 ; ENTRY InforRect ; ENTRY InfoWindow ; ENTRY InfoPort ; ENTRY InfoStrPos ; ENTRY InfoStrPrep ; ENTRY InfoStrDraft ; ENTRY InfoDPort ; ENTRY PrintProcess ; ENTRY EraseInfoRect ; ENTRY InfoStrBuffer ENTRY PrPrintIt ENTRY PrAbortCheck ENTRY CallIdleProc ENTRY InsertPaperAlert ; ENTRY EvtMods ; ENTRY AlertTemp640 ; ENTRY AlertTemp320 ; ENTRY InfoRect ENTRY NoShowMessage ENTRY GetStatus ENTRY PStatus ENTRY ShowErr ENTRY ProcsTable ENTRY DraftFlag ENTRY iPrErr IMPORT INFORECT IMPORT ALERTTEMP320 IMPORT ALERTTEMP640 IMPORT EVTMODS IMPORT INFOSTRBUFFER IMPORT ERASEINFORECT IMPORT PRINTPROCESS IMPORT CancelStrPrint IMPORT CancelStrPos IMPORT LOWMEMMSG IMPORT INFODPORT IMPORT INFOSTRDRAFT IMPORT INFOSTRPREP IMPORT INFOSTRPOS IMPORT INFOPORT IMPORT INFOWINDOW IMPORT INFORRECT IMPORT INFOWIDTH320 IMPORT INFOWIDTH640 IMPORT EVTWHERE IMPORT PTRLIST IMPORT PP_LANDSC IMPORT PP_PORTRAIT IMPORT ASTRNUM IMPORT JDRB0 IMPORT ASTRLIST IMPORT ARECTLIST IMPORT CANCELSTR IMPORT CANCELRECT IMPORT OKSTR IMPORT OKRECT IMPORT ISTRLIST IMPORT IPOSLIST IMPORT ISTRNUM IMPORT PIXELWIDTH IMPORT JISTRLIST IMPORT JIPOSLIST IMPORT JISTRNUM IMPORT DSTBITF2 IMPORT DSTBITR2 IMPORT DSTBITF1 IMPORT DSTBITR1 IMPORT LANDSC_R IMPORT PORTRAIT_R IMPORT PIXEL320 IMPORT PIXEL640 IMPORT PORTRAIT_P IMPORT LANDSC_P IMPORT EVTMSG IMPORT EVTWHAT IMPORT EVENTRECORD IMPORT IFCANCELLED IMPORT TOFINALVALUE IMPORT FROMFINALVALUE IMPORT COPIEFINALVALUE IMPORT J1STRLIST IMPORT J1STRNUM IMPORT SLASHSTR IMPORT NAMEPOS IMPORT L2 IMPORT L1 IMPORT JDRB10 IMPORT JDRB11 IMPORT JDRBO IMPORT JOBDTEMPLATE IMPORT STYLEWIDTH IMPORT STYLERECT IMPORT DEADLOC IMPORT BUTTONSTATE IMPORT JIPosList IMPORT CoverOpenStr IMPORT OffLineStr IMPORT PaperJamStr IMPORT PaperOutStr IMPORT MyStdText IWD PROC ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; ; Vector to appropriate printer driver routine based on value passed in X-Reg. ; ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ jmp (PrProcList,x) ;Vector to correct routine PrProcList DC.L PrintDefault ;_PrDefault DC.L PrValidate DC.L PrStlDialog DC.L PrJobDialog DC.L PrDrvrVer DC.L PrOpenDoc DC.L PrCloseDoc DC.L PrOpenPage DC.L PrClosePage DC.L PrPicFile DC.L PrError ;;;;;dummy for now;;;;;; DC.L PrError DC.L PrSetError DC.L PrChanged DC.L PrPixelMap DC.L PrPixelMap ;;;;;dummy for now;;;;;;; InvalidPr rtl ENDP include 'e16.dialog' include 'LLD.ASM' include 'HLD.ASM' .quit END \ No newline at end of file diff --git a/appleworksgs/IW.CL/Src/iw.macros b/appleworksgs/IW.CL/Src/iw.macros new file mode 100755 index 0000000..9ae8d11 --- /dev/null +++ b/appleworksgs/IW.CL/Src/iw.macros @@ -0,0 +1 @@ + MACRO &Lab _Names &MyName bra Skip&SysCnt dc i1'$42' dc i1'L:&MyName' msb on dc c'&MyName' msb off Skip&SysCnt Anop Mend MACRO &lab _PmGetPrinterName &lab ldx #19+256*40 jsl $E10000 MEND MACRO &lab _PrDevPrChanged &lab ldx #19+256*25 jsl $E10000 MEND MACRO &lab _PrDevStartup &lab ldx #19+256*26 jsl $E10000 MEND MACRO &lab _PrDevShutdown &lab ldx #19+256*27 jsl $E10000 MEND MACRO &lab _PrDevOpen &lab ldx #19+256*28 jsl $E10000 MEND MACRO &lab _PrDevRead &lab ldx #19+256*29 jsl $E10000 MEND MACRO &lab _PrDevWrite &lab ldx #19+256*30 jsl $E10000 MEND MACRO &lab _PrDevClose &lab ldx #19+256*31 jsl $E10000 MEND MACRO &lab _PrDevStatus &lab ldx #19+256*32 jsl $E10000 MEND MACRO &lab _PrDevInitBack &lab ldx #19+256*33 jsl $E10000 MEND MACRO &lab _PrDevFillBack &lab ldx #19+256*34 jsl $E10000 MEND MACRO &lab _PrDevAsyncRead &lab ldx #19+256*33 jsl $E10000 MEND MACRO &lab _PrDevAsyncWrite &lab ldx #19+256*34 jsl $E10000 MEND MACRO &lab _error &lab bcc @1 dc.b 0,$4c ; brk $4c @1 mend MACRO &lab _DevIsItSafe &lab ldx #19+256*48 jsl $E10000 MEND MACRO &lab MoveRect &Src,&Dest &lab lda &Src sta &Dest lda &Src+2 sta &Dest+2 lda &Src+4 sta &Dest+4 lda &Src+6 sta &Dest+6 MEND \ No newline at end of file diff --git a/appleworksgs/IW.CL/Src/lld.asm b/appleworksgs/IW.CL/Src/lld.asm new file mode 100755 index 0000000..9877fe7 --- /dev/null +++ b/appleworksgs/IW.CL/Src/lld.asm @@ -0,0 +1 @@ + ENTRY DerefColor ENTRY HookProc ENTRY LLDExit4 ENTRY LLDExit2 ENTRY LLDExit10 ENTRY LLDExit8 ENTRY ScreenShoot ENTRY LLDExit6 ENTRY FormFeed ENTRY LLDExit0 ENTRY ResetPrinter ENTRY SendRC ; ENTRY PrintCheck ENTRY MovePen ENTRY SetColor ENTRY SetColorT ENTRY GetColorT ENTRY Pattern ENTRY SpeDens ENTRY VSizing ENTRY DrvrBitMap ENTRY ContLine ENTRY DrvrRect ENTRY LandStock ENTRY HightLand ENTRY FlagT ENTRY FlagB ENTRY CurrentLine ENTRY ContLine ENTRY VSizing ENTRY CurrentDef ENTRY FlagBlack ENTRY SendBuff ENTRY SendRCLF ENTRY LittleSkip ENTRY WasImage ENTRY WasImage1 ENTRY WasImage2 ENTRY MakeLine ENTRY MakeBlankLine ENTRY FinalPat ENTRY BitMapShoot ENTRY SendSingleCar ENTRY SendBPrep ENTRY WriteStr ENTRY StrCmp ENTRY HeightLine01 ENTRY EndTime,DrawTime,PortTime,TmpTime,StartTime include 'm16.msl' ; LLD.MAIN0 ;------------------------------------------------------------------------------ ; ; Low Level Tables and Equates ; ;------------------------------------------------------------------------------ HandleReal EQU $F4 PointerReal EQU $F8 LLDSystem PROC EXPORT EXPORT MyPID MyPID DC.W 0 42 EXPORT MyWAP MyWAP DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 DC.B 0 ENDP ; LLD.MAIN1 ; ; Main LLD. ; * Zero page equates (While in Low Level Driver) (Allocated at users +$100) HandleDrvr EQU $00 MemoryDrvr EQU $04 Quality EQU $06 HandleColor EQU $08 HandleScreen EQU $0C PtrBitMap EQU $10 PtrColor EQU $14 HandleIO EQU $18 PtrBlack EQU $20 PtrRed EQU $24 PtrBlue EQU $28 PtrYellow EQU $2C PtrLocal EQU $30 PenPosH EQU $34 PenPosV EQU $36 NewPenPosH EQU $38 NewPenPosV EQU $3A Lock EQU $3E PageRectPtr EQU $40 PageRect EQU $44 PtrInfo EQU $4C Stock EQU $50 Stock2 EQU $52 PtrID EQU $54 ;Recharge gequ $58 Go EQU $5C Status EQU $66 ;FlagRecharge gequ $74 BackColor EQU $76 PtrRect EQU $96 ;BackFlag gequ $9A MyStack EQU $9C RealStack EQU $9E SaveStack EQU $A0 JobPrint EQU $A2 StockWStr EQU $A4 StockWTxt EQU $A8 PageRectL EQU $AA Stack EQU $AE SaveStack2 EQU $F0 MyId EQU $F2 Owner EQU $F4 HandleID EQU $F8 Error EQU $F6 DarkerMode EQU $FA ; ; MyWap equates ; NbUser EQU $0E PID EQU $1E PenPosVW EQU $18 IDBack EQU $1a GraphP EQU $1c IDWap EQU $16 Killer EQU $24 PMID EQU $0012 EJECT Export Cidrvr Cidrvr PROC ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; NAME: LLDStartUp ; ; PURPOSE: Starts up the low level routines ; ; PASSED: WORD Zero Page ; WORD User ID ; ; RETURNED: (A-reg.) =0, No Errors ; =$1308: error in establishing connection ; with the printer (Suki 5/25/88) ; =$1321, LLDStartup already made ; =Memory Mgr. Errors returned unchanged ; NOTE: 'Error' retains error value ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ;----------------------------------------------- EXPORT LLDStartUp LLDStartUp jsl xLLDStartUp rtl ;----------------------------------------------- EXPORT xLLDStartUp xLLDStartUp ; * Stack: 1: Rtls * 7: ID * 9: ZeroPage phb ;save users bank phk ;get this programs bank plb ;set bank to programs bank ;----------------------------------------------------------- ; ; commented out the following branch since it is not taken in ; normal conditions, and if taken, the stack is not cleaned up ; properly. Suki Lee 6/24/88 ; ;Now see if this is initial time ; lda MyWap+$16 ;get ID ; bne JustStartUp ;branch if not first time * * Here zero page is needed * PushWord #0 _MMStartUP ;make sure memory manager is started pla sta MyPID sta MyWap+$16 ;save ID in MyWap ok1 ; phd ;save D-reg. ; Stack: 1: Direct zero page ; 3: Plb ; 4: Rtls ; 10: ID ; 12: ZeroPage lda 12,s ;get passed direct page tcd ;use passed direct page ; ;This initlizes the zero page values ; ok6 ; ldx #3 lda #0 ldy #$18 LoopInitWap sta MyWap,y ;init. MyWap table iny iny dex bne LoopInitWap pld ;Put user zero-page plb ;Put user data bank register ; ;Just startup (no initialization stuff) ; JustStartUp ; phd lda 11,s ;One allowed zero-page ! tcd sta MyWap ;Save zero page addess * Stack: 1: ZeroPage application * 3: Rtls * 9: ID * 11: ZeroPage * Now the startup begins * Clear this new zero-page ldx #$F6 lda #0 loop sta <0,x dex dex bpl loop lda MyWap+IDWap ;get Waps ID sta MyID ;put in zero page * Stack: 1: ZeroPage application * 3: Rtls * 9: ID * 11: ZeroPage ; * Allocate memory for IOBuffer ; PushLong #0 PushLong #$2800 PushWord itsAppleTalk ; New code from Suki, 10/9/89 MSL stz ReadingDone stz ReadingLength PushWord #0 ; space for actual length Pushptr MyCompletion PushWord #10 ; the response to self ID is no more than 10 bytes Pushptr ReadBuffer _PrDevAsyncRead pla ; this value is invalid at this ; point in time since this is an ; async read call ; @didAppleTalk jsr ResetPrinter lda #0 ;indicate no errors on return Exit plb pld brl LLdExit4 AppleTalk STR 'APPLETALK' EXPORT itsAppleTalk itsAppleTalk DS.W 1 ;------------------------------------------------------------------------------ * Error on StartUp, We simulate a ShutDown to finish ;----------------------------------------------------------------------------- * Stack: 1: HandleIO * 5: ZeroPage application * 7: Rtls * 13: ID * 15: ZeroPage ErrorOpen ; ply ply sta ReadError txa sta >ReadingLength ; actual length read lda #True sta >ReadingDone rtl EXPORT ReadError ReadError DS.B 2 EXPORT ReadingDone ReadingDone DS.B 2 EXPORT ReadingLength ReadingLength DS.B 2 EXPORT ReadBuffer ReadBuffer DS.B 10 ; Export ComptCol ComptCol DC.W 0 ;Counter used in init. of color tables Export InitColor InitColor DC.W $0000 ;Initial color palette values DC.W $0F00 DC.W $00F0 DC.W $000F DC.W $0088 DC.W $0808 DC.W $0066 DC.W $0555 DC.W $0AAA DC.W $0F80 DC.W $08F8 DC.W $0F88 DC.W $0FF0 DC.W $0F0F DC.W $00FF DC.W $0FFF EJECT ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ; ; NAME: LLDShutDown ; ; PURPOSE: Shuts down the low level stuff ; ; PASSED: WORD User ID ; ; RETURNED: (A-reg.) =zero, No errors ; =$1108, Locked User ; ;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------ ;----------------------------------------------- EXPORT LLDShutDown LLDShutDown jsl xLLDShutDown rtl ;----------------------------------------------- EXPORT xLLDShutDown xLLDShutDown phd ;Take user's ZeroPage lda MyWap ;get saved LLD zero page addr. tcd ;use it Bit Lock ;Check if locked User bmi ShutLock lda 9,s ;User ID jsr ShutDown ;ShutDown the user ; ;We arrive here when we need to kill a low level call ; * Stack: 1: ZeroPage application * 3: Rtls * 9: ID KillLLD ; * Now return to MicroLLD _PrDevClose stz MyWap+$16 ;flag for next entry (done for now) pld lda #0 brl LLDexit2 * Error for ShutDown ShutLock ; lda #$1108 Error: Locked User SErrID ; pld brl LLdExit2 Error: Unknown user ;------------------------------------------------------------------------------ ; ; NAME: ShutDown ; ; PURPOSE: Subroutine which aids in shutting down low level routines ; ; PASSED: (A-reg.) User ID ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ * Real Shutdown. Entry: A ID * D User zeroPage ShutDown ; sta ; PushLong #WrapIt ;force linefeed when lines wrap (draft) jsr WriteStr lda DraftModeQuality beq @didmode bit #$0800 beq @ckCorr PushLong #NLQMode jsr WriteStr bra @didmode @ckCorr bit #$0100 beq @didmode PushLong #CorrMode jsr WriteStr @didmode * Stack: 1: Direct Page Application * 3: rtls * 9: ID user * 11: Quality lda 11,s ;get quality sta B/W vs Color * 4000 => landscape vs portrait * 2000 => vertical sizing * 0002 => Hires vs Highcolor * 0001 => 640 vs 320 * From quality we set up other variables: * spedens: 0 if portrait or 320 * 4000 if landscape 640 lores * 8000 if landscape 640 hires (144dpi) * vsizing 8000 if portrait and vsizing * currentDef: 4 if highcolor and spedens=0 * 8 other BitMapDrvr PROC EXPORT ;------------------------------------------------------------------------------ ; ; NAME: BitMapShoot ; ; PURPOSE: Performs the actual printing of a bitmap image ; ; PASSED: NONE ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ EXPORT BitMapShoot BitMapShoot jsr Pattern ;setup the initial print patterns phb ;Activate local Data Bank Register phk plb stz SpeDens ;init. variables stz Vsizing lda TmpTime:l) **PROFILE Loop ; ldx #$00F0 ; assume a full buffer for now lda s_Length ; get current strings length bne @1 brl done ; branch if nothing left in the buffer @1 cmp #$00F0 ; see if more than $f0 characters bge FullBuff ldx s_Length ; if not, send all that's left FullBuff stx WriteLength PushPtr CompleteWrite PushLong s_buffer ;strings pointer addr. Pushword WriteLength _PrDevWrite bcc AllsWell LoopWait jsr GetStatus lda PStatus bne LoopWait AllsWell lda s_Length ; adjust buffer length by the amount sec ; we just sent sbc WriteLength sta s_Length lda s_buffer ; increment buffer pointer accordingly clc adc WriteLength sta s_buffer bcs @1 brl Loop @1 inc s_buffer+2 ;if to next bank, inc. bank brl Loop Done ; tool _GetTick,out=(>EndTime:l) **PROFILE ; sublong >EndTime,>TmpTime,>TmpTime ; addlong >TmpTime,>PortTime,>PortTime lda #0 ; all's cool ErrorExit cmp #1 rts ;-------------------------------------------------------------- ; ; Completion routine for PAPWrite which does nothing since we won't ; return from port driver till the write is done. ; CompleteWrite rtl Export s_Length s_Length DS.B 2 ;temporary for strings length Export s_Buffer s_Buffer DS.B 4 ;temporary pointer to strings text WriteError DS.B 2 WriteLength DS.B 2 ENDP ; LLD.Color ***************************** * * * CiDrvr: Printer Driver IW * * Color Drvr * * * * Current Rev: Nov. 1987 * * * ***************************** ;------------------------------------------------------------------------------ ; ; NAME: SetColor ; ; PURPOSE: Copies to the location specified by the pointer, the color ; palette table which is specified by the passed SCB byte. ; (Called by LLDSetColor) ; ; PASSED: LONG Pointer to color palette ; WORD SCB (which defines palette table) ; WORD User ID ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ ColorDrvr PROC EXPORT EXPORT SetColor SetColor * Stack: 1: rts * 3: Direct page * 5: rtls * 11: ID * 13: Color palette * 15: Ptr to color palette jsr DerefColor ;dereference color table lda 13,s ;get SCB value and #$000F ;look only at color table bits xba ;times $20 to correct palette table lsr a lsr a lsr a clc adc 0 ;18(NOTE: addr. is stuffed by MakeStatus) plb rep #$30 longa on longi on and #1 rts ;------------------------------------------------------------------------------ ; ; NAME: MakeStatus ; ; PURPOSE: Stuffs the addr. of the routine that gets the status into ; the routine "GoStatus". ; ; PASSED: NONE ; ; RETURNED: NONE ; ;------------------------------------------------------------------------------ EXPORT MakeStatus MakeStatus phb phk plb pha tdc clc adc # list imagewriter.clq :obj:lq.o :obj:dialogdata.o LINKIIGS :obj:lq.o :obj:dialogdata.o -o imagewriter.clq -t $70BB0001 ### Dependancies for iw.o ### Setting the variable lq to 0 will build the regular Imagewriter driver :obj:iw.o :src:iw.asm :src:hld.asm :src:lld.asm ASMIIGS -d lq=0 :src:iw.asm -o :obj:iw.o ### Dependencies for lq.o ### Setting the variable lq to 1 will build the Imagewriter LQ driver :obj:lq.o :src:iw.asm :src:hld.asm :src:lld.asm ASMIIGS -d lq=1 :src:iw.asm -o :obj:lq.o ### Dependancies for dialogdata.o :obj:dialogdata.o :src:dialogdata.asm ASMIIGS :src:dialogdata.asm -o :obj:dialogdata.o ### Dependancies for stdtext.o :obj:stdtext.o :src:stdtext.asm ASMIIGS :src:stdtext.asm -o :obj:stdtext.o ### Dependancies for iw.sym :src:iw.sym :src:iw.asm :src:all.macros ASMIIGS -c -d DUMPIT :src:iw.asm \ No newline at end of file diff --git a/appleworksgs/Link.Map b/appleworksgs/Link.Map new file mode 100755 index 0000000..f9b9022 --- /dev/null +++ b/appleworksgs/Link.Map @@ -0,0 +1 @@ +-------------------------------------------------------------------------------- 0001 Load Segment "~ExpressLoad" relocatable LENGTH=$E5B KIND=$8001 (Data)(Dynamic) -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- 0002 Load Segment "NewFont" relocatable LENGTH=$995 KIND=$0010 (Initialization) -------------------------------------------------------------------------------- 0001 00000000 00000001 NOTHING 0002 00000001 00000994 D_NEWSYSTEMFONT -------------------------------------------------------------------------------- 0003 Load Segment "Startup" relocatable LENGTH=$8000 KIND=$0110 (Initialization)(Bank Relative) -------------------------------------------------------------------------------- 0001 00000000 00008000 Z_INIT -------------------------------------------------------------------------------- 0004 Load Segment "Driver" relocatable LENGTH=$A1EB KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 0000004A D_MAIN 0002 0000004A 000000BD D_STARTUP 0003 00000107 0000014A D_SHUTDOWN 0004 00000251 000003B8 D_CHECKFORFINDER 0005 00000609 00000162 D_MAINLOOP 0006 0000076B 000000CA D_TASKTABLE 0007 00000835 00000075 D_CHECKSTATE 0008 000008AA 0000015E D_DOMENU 0009 00000A08 00000001 D_IGNORE 000A 00000A09 00000021 D_DOQUIT 000B 00000A2A 00000122 D_MOUSEDOWN 000C 00000B4C 0000000B D_MOUSEINFO 000D 00000B57 0000000B D_KEYDOWN 000E 00000B62 0000007B D_UPDATE 000F 00000BDD 00000079 D_DONDA 0010 00000C56 0000000D D_DIDGROW 0011 00000C63 0000006C D_JMPVECTORS 0012 00000CCF 0000006C D_NOWINJMPS 0013 00000D3B 0000001C D_NULLIDLE 0014 00000D57 00000082 D_IGNORESTUFF 0015 00000DD9 000000D7 D_DOIDLE 0016 00000EB0 00000026 D_ACTIVATE 0017 00000ED6 00000093 D_JUSTACTIVATE 0018 00000F69 00000070 D_JUSTDEACTIVATE 0019 00000FD9 00000047 D_ACTIVATEWIN 001A 00001020 0000005D D_SENDMESSAGE 001B 0000107D 000001D2 D_GETMODULES 001C 0000124F 00000103 D_LOADMODULE 001D 00001352 0000004A D_UNLOADMODULE 001E 0000139C 0000002D D_FLUSHMODULES 001F 000013C9 0000000F D_RESTOREMODULES 0020 000013D8 00000010 D_INSTALLVECTS 0021 000013E8 00000060 D_INSTALLMOD 0022 00001448 0000000D D_INSTALLPTRS 0023 00001455 00000075 D_DOPTRS 0024 000014CA 00000039 D_SETHEARTBEAT 0025 00001503 00000014 D_KILLHEARTBEAT 0026 00001517 0000000C HEARTBEATHEADER 0027 00001523 00000004 D_HEARTBEATIDLE 0028 00001527 0000020A D_GOTCONTROL 0029 00001731 00000015 D_SKIPIT 002A 00001746 00000078 D_MYCONVERTSCRAP 002B 000017BE 00000010 D_USEMODULE 002C 000017CE 00000018 D_UNUSEMODULE 002D 000017E6 0000027B D_MODULEDATA 002E 00001A61 000001F0 D_GLOBALDATA 002F 00001C51 00000293 D_UTILDATA 0030 00001EE4 00000114 D_SELECTFONT 0031 00001FF8 00000055 D_KILLFONT 0032 0000204D 00000042 D_GETWDTH 0033 0000208F 0000000E D_GETSTATS 0034 0000209D 00000078 D_NEWCTL 0035 00002115 0000001C D_FASTMULT 0036 00002131 0000002B D_SET4PAT 0037 0000215C 00000039 D_MAKE4PAT 0038 00002195 00000077 D_DRAWICON 0039 0000220C 00000092 D_RECTSECT 003A 0000229E 0000005C D_ADDRECTRGN 003B 000022FA 00000082 D_CLEARBITMAP 003C 0000237C 00000065 D_SECTRGNRECT 003D 000023E1 0000004F D_SECTCLIPRECT 003E 00002430 00000164 D_DRAWPICTURE 003F 00002594 000002CD D_DRAWTEXT 0040 00002861 0000002E D_DRAWSTRING 0041 0000288F 00000045 D_CLOSEPICTURE 0042 000028D4 0000005D D_PROPENDOC 0043 00002931 0000004F D_BLINKBUTTON 0044 00002980 0000003B D_WRITEWORD2 0045 000029BB 0000003B D_WRITELONG2 0046 000029F6 0000006F D_WRITEHANDLE2 0047 00002A65 0000003B D_WRITESTRING2 0048 00002AA0 0000003B D_READWORD2 0049 00002ADB 0000003B D_READLONG2 004A 00002B16 00000087 D_READHANDLE2 004B 00002B9D 0000005A D_READSTRING2 004C 00002BF7 00000042 D_USESTDCOLORS 004D 00002C39 0000002F D_STDEREF 004E 00002C68 0000001A D_DEREF 004F 00002C82 0000000A D_UNLOCK 0050 00002C8C 00000088 D_MUSTHANDLE 0051 00002D14 00000083 D_MUSTGROW 0052 00002D97 00000049 D_MUSTGROWL 0053 00002DE0 0000016B D_CHECKPURGE 0054 00002F4B 0000004E D_NEEDHANDLE 0055 00002F99 000000B4 D_NEEDHANDLEID 0056 0000304D 00000035 D_NEEDHAND 0057 00003082 000000E3 D_GROWHANDLE 0058 00003165 00000046 D_GROWLHANDLE 0059 000031AB 00000042 D_DISPOSEPTR 005A 000031ED 00000037 D_ZEROBLOCK 005B 00003224 0000003E D_MEMORYERROR 005C 00003262 00000060 D_UNDOMEMERROR 005D 000032C2 0000000F D_MAKEROOM 005E 000032D1 00000008 D_OOMHEADER 005F 000032D9 00000066 D_MEMQUEUE 0060 0000333F 00000037 D_DISPOSEHANDLE 0061 00003376 0000010F D_LOADRSRC 0062 00003485 00000047 D_ISLETTER 0063 000034CC 00000013 D_ISDIGIT 0064 000034DF 0000000B D_ISALPHANUM 0065 000034EA 00000047 D_CHRGET 0066 00003531 0000004A D_EATBLANKS 0067 0000357B 000000BF D_GETINTEGER 0068 0000363A 00000096 D_GETIDENTIFIER 0069 000036D0 00000043 D_STRAPPEND 006A 00003713 00000060 D_STRLISTSEARCH 006B 00003773 00000098 D_STRPOS 006C 0000380B 00000061 D_ADDSTRINGS 006D 0000386C 00000041 D_CMPSTRINGS 006E 000038AD 0000009E D_CMPTEXT 006F 0000394B 0000002B D_COPYSTRINGS 0070 00003976 00000041 D_COPYSTRINGS2 0071 000039B7 00000100 D_TOUPPERTABLE 0072 00003AB7 00000100 D_TOLOWERTABLE 0073 00003BB7 000000A5 D_GETNEWUNTITLED 0074 00003C5C 0000004F D_GETNEWMODALDIALOG 0075 00003CAB 0000003B D_CLOSEDIALOG 0076 00003CE6 0000003F D_DIALOGBEEP 0077 00003D25 00000135 D_ALERTBOX 0078 00003E5A 0000005F D_WORDBOX 0079 00003EB9 00000019 D_CLOSEWORDBOX 007A 00003ED2 0000001F D_NOFILTER 007B 00003EF1 00000095 D_ESCFILTER 007C 00003F86 00000063 D_YNONLYFILTER 007D 00003FE9 0000007A D_YNFILTER 007E 00004063 000000B5 D_DIGITSONLY 007F 00004118 0000004F D_DECIMALONLY 0080 00004167 000001B3 D_DIALOGDATA 0081 0000431A 000006E4 D_MENUDATA 0082 000049FE 00000054 D_MENUINIT 0083 00004A52 000000FF D_MAKEMENUS 0084 00004B51 000000A7 D_SPECCOLOR 0085 00004BF8 0000006E D_SPECFONT 0086 00004C66 0000004C D_SPECSIZE 0087 00004CB2 0000004C D_SPECSTYLE 0088 00004CFE 00000288 D_COLORDEF 0089 00004F86 000000A1 D_MAKEEDIT 008A 00005027 0000009E D_SETMENU 008B 000050C5 0000007B D_ENABLEMITEMS 008C 00005140 00000091 D_DISABLEMITEMS 008D 000051D1 0000004F D_MAKENOWIN 008E 00005220 00000052 D_MAKESYSWIN 008F 00005272 00000053 D_MAKECLIPWIN 0090 000052C5 00000021 D_MAKEMODWIN 0091 000052E6 00000010 D_UNHILITE 0092 000052F6 000000B4 D_ACTIVEMENUS 0093 000053AA 00000042 D_SETUNDOSTR 0094 000053EC 0000009B D_MAKEUNDO 0095 00005487 00000183 D_CHECKMENUFID 0096 0000560A 000000B7 D_CHECKFONTMENU 0097 000056C1 00000032 D_TEXTSELECTON 0098 000056F3 00000032 D_TEXTSELECTOFF 0099 00005725 00000040 D_EDITCOLORS 009A 00005765 0000015C D_CHOOSEFONT 009B 000058C1 00000031 D_DOPAGESET 009C 000058F2 000000C4 D_PRJOBDIALOG 009D 000059B6 0000000B D_CLEARPRINTFLAGS 009E 000059C1 0000027A D_DOPRINT 009F 00005C3B 00000068 D_DOPRINTMERGE 00A0 00005CA3 0000000C D_DOUNDO 00A1 00005CAF 0000001E D_DOCUT 00A2 00005CCD 00000049 D_DOCOPY 00A3 00005D16 0000006A D_DOPASTE 00A4 00005D80 00000092 D_FIXPASTE 00A5 00005E12 0000000C D_DOCLEAR 00A6 00005E1E 0000033F D_DODELETEITEM 00A7 0000615D 000000C6 D_NEW 00A8 00006223 00000310 D_NEWFILTER 00A9 00006533 0000015B D_CLOSEWINDOW 00AA 0000668E 000000BC D_DISPOSEWINDOW 00AB 0000674A 00000024 D_GETPATHHANDLE 00AC 0000676E 00000024 D_PUTPATHHANDLE 00AD 00006792 00000018 D_FINDFREEWIN 00AE 000067AA 0000008D D_ADDWINDOW 00AF 00006837 00000033 D_DELETEWINDOW 00B0 0000686A 00000073 D_TRAVERSEWINDOWS 00B1 000068DD 00000092 D_NEWPRINTREC 00B2 0000696F 00000116 D_CHECKPDRIVERS 00B3 00006A85 00000071 D_SETCONDENSE 00B4 00006AF6 00000045 D_NEWCOLORREC 00B5 00006B3B 0000001A D_DOWINDOWS 00B6 00006B55 00000048 D_GETREFCON 00B7 00006B9D 00000043 D_SETREFCON 00B8 00006BE0 00000035 D_SETFILECHANGED 00B9 00006C15 00000035 D_CLEARFILECHANGED 00BA 00006C4A 00000034 D_GETFILECHANGED 00BB 00006C7E 00000011 D_GETNEWNUM 00BC 00006C8F 000000B7 D_OPENCLIP 00BD 00006D46 0000002C D_CLOSECLIP 00BE 00006D72 0000003B D_DRAWCLIP 00BF 00006DAD 00000043 D_CLIPCOPY 00C0 00006DF0 000000E6 D_WINDOWDATA 00C1 00006ED6 0000003B D_MAKENAME 00C2 00006F11 000000D5 D_SAVE 00C3 00006FE6 00000305 D_SAVEAS 00C4 000072EB 00000252 D_DOSAVE 00C5 0000753D 000000D7 D_DOEXPORT 00C6 00007614 00000041 D_SAVEHOOK 00C7 00007655 000000B4 D_FILEDATA 00C8 00007709 00000577 D_DOOPENDIALOG 00C9 00007C80 000001CA D_OPENHOOK 00CA 00007E4A 000000B7 D_DRAWBLACKRECT 00CB 00007F01 00000030 D_OPENMEMERR 00CC 00007F31 0000002A D_LOADPICTERR 00CD 00007F5B 00000121 MYSFFILTERPROC 00CE 0000807C 00000053 MYMODALDIALOG 00CF 000080CF 00000049 DOMODALPATCH 00D0 00008118 00000035 UNDOMODALPATCH 00D1 0000814D 00000071 D_UNLOADICONS 00D2 000081BE 0000005F D_LOADICONS 00D3 0000821D 00000278 D_MOREICONS 00D4 00008495 0000080D D_OPENDATA 00D5 00008CA2 0000058C D_IMPORT 00D6 0000922E 00000321 D_IMPORTDATA 00D7 0000954F 00000065 D_IMPORTFILTER 00D8 000095B4 000000EA D_LOADSEGNAME 00D9 0000969E 000000C2 D_LOADSEGNUM 00DA 00009760 0000009C D_LOADSEGMENT 00DB 000097FC 00000063 D_UNLOADSEGMENT 00DC 0000985F 000001F5 D_SEGMENTDATA 00DD 00009A54 00000210 D_NEWDOC 00DE 00009C64 000000EB D_CREATEWINDOW 00DF 00009D4F 0000049C D_REGOPEN -------------------------------------------------------------------------------- 0005 Load Segment "SPTHSTATIC" relocatable LENGTH=$32D2 KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 00000079 abytread 0002 00000079 00000036 bytread 0003 000000AF 00000025 SPStartUp 0004 000000D4 00000025 SPShutDown 0005 000000F9 00000029 SPCheck 0006 00000122 00000025 SPSuggest 0007 00000147 00000025 SPOpenUDict 0008 0000016C 00000025 SPNewUDict 0009 00000191 00000025 SPAddWord 000A 000001B6 00000025 SPEditUDict 000B 000001DB 00000010 _SPMetaHandler 000C 000001EB 00000006 SPIntData 000D 000001F1 00000140 qtheta 000E 00000331 00000250 theta 000F 00000581 00000117 ThetaData 0010 00000698 000001D7 rankword 0011 0000086F 000001DA clxgetbin 0012 00000A49 00000084 typoins 0013 00000ACD 000000C6 typosub 0014 00000B93 00000039 clxffunc 0015 00000BCC 00000043 lexcmp 0016 00000C0F 0000008B lexstrip 0017 00000C9A 000000A9 lexphon 0018 00000D43 000000B3 lexbinnext 0019 00000DF6 00000025 THStartUp 001A 00000E1B 00000025 THShutDown 001B 00000E40 00000025 THWord 001C 00000E65 00000025 THInfo 001D 00000E8A 00000004 THIntData 001E 00000E8E 00000043 Tlexcmp 001F 00000ED1 000000E0 Tlexphon 0020 00000FB1 00000C27 ~arrays 0021 00001BD8 00000012 ~arrays 0022 00001BEA 00000141 ~arrays 0023 00001D2B 0000027D ~arrays 0024 00001FA8 000001A8 ~arrays 0025 00002150 00000200 ~arrays 0026 00002350 00000044 ~arrays 0027 00002394 0000024C ~arrays 0028 000025E0 00000033 ~arrays 0029 00002613 0000000C ~arrays 002A 0000261F 00000050 ~arrays 002B 0000266F 0000014D ~arrays 002C 000027BC 00000045 ~arrays 002D 00002801 0000016E ~arrays 002E 0000296F 0000000B ~arrays 002F 0000297A 00000230 ~arrays 0030 00002BAA 00000009 ~arrays 0031 00002BB3 000001AE ~arrays 0032 00002D61 0000002D ~arrays 0033 00002D8E 0000001C ~arrays 0034 00002DAA 0000021F ~arrays 0035 00002FC9 000000AD ~arrays 0036 00003076 00000056 ~arrays 0037 000030CC 00000045 ~globals 0038 00003111 00000014 ~globals 0039 00003125 00000012 ~globals 003A 00003137 00000014 ~globals 003B 0000314B 0000002A ~globals 003C 00003175 00000037 ~globals 003D 000031AC 00000004 ~globals 003E 000031B0 00000016 ~globals 003F 000031C6 00000008 ~globals 0040 000031CE 00000014 ~globals 0041 000031E2 00000004 ~globals 0042 000031E6 0000007F ~globals 0043 00003265 00000012 ~globals 0044 00003277 00000004 ~globals 0045 0000327B 00000004 ~globals 0046 0000327F 00000002 ~globals 0047 00003281 00000037 ~globals 0048 000032B8 00000014 ~globals 0049 000032CC 00000006 ~globals -------------------------------------------------------------------------------- 0006 Load Segment "SFFilters" relocatable LENGTH=$937 KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 0000002B D_NULLFILTER 0002 0000002B 000000A4 D_GENERALFILTER 0003 000000CF 000000AA D_OPENTYPESFILTER 0004 00000179 00000038 D_WPSFFILTER 0005 000001B1 00000038 D_SSSFFILTER 0006 000001E9 00000038 D_DBSFFILTER 0007 00000221 00000038 D_PLSFFILTER 0008 00000259 00000038 D_GRSFFILTER 0009 00000291 00000038 D_CMSFFILTER 000A 000002C9 00000038 D_ASCIISFFILTER 000B 00000301 00000051 D_PLIMPORTSFFILTER 000C 00000352 00000072 D_DBTEMPLATESFFILTER 000D 000003C4 0000009C D_DRAWSFITEM 000E 00000460 000000F7 FINDICONBYTYPE 000F 00000557 0000007D FINDICONBYLIST 0010 000005D4 00000113 CHECKFORDISK 0011 000006E7 00000130 D_SFPGETFILE2 0012 00000817 00000088 D_SFPMULTIGET2 0013 0000089F 00000098 D_SFPPUTFILE2 -------------------------------------------------------------------------------- 0007 Load Segment "BobList" relocatable LENGTH=$C02 KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 00000088 D_BLISTDATA 0002 00000088 000001AF D_BLMAKELIST 0003 00000237 00000027 D_BLFORGETLISTS 0004 0000025E 00000034 D_BLMODALDIALOG 0005 00000292 00000104 D_BLSETPARMS 0006 00000396 00000058 D_BLSELECT 0007 000003EE 00000026 D_BLGETSEL 0008 00000414 0000006B D_BLACTIVATE 0009 0000047F 00000059 D_ACTIVATEBYITEM 000A 000004D8 000000CA D_SCROLLLIST 000B 000005A2 000000B5 D_ACTIONPROC 000C 00000657 0000004B D_BLDRAWPROC 000D 000006A2 0000015B D_DRAWWORDS 000E 000007FD 00000060 D_FINDWORD 000F 0000085D 0000006C D_TOGGLEWORD 0010 000008C9 000002E0 D_FILTERPROC 0011 00000BA9 00000059 D_SELECT -------------------------------------------------------------------------------- 0008 Load Segment "FileIO" relocatable LENGTH=$14DB KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 00000077 D_OPEN2 0002 00000077 0000009A D_CLOSE2 0003 00000111 000000AD D_CREATE2 0004 000001BE 00000084 D_DESTROY2 0005 00000242 00000078 D_READ2 0006 000002BA 000000AD D_WRITE2 0007 00000367 00000058 D_GETMARK2 0008 000003BF 00000063 D_SETMARK2 0009 00000422 00000054 D_GETEOF2 000A 00000476 0000006A D_SETEOF2 000B 000004E0 000000A1 D_GETBOOT2 000C 00000581 000000A3 D_GETPROG2 000D 00000624 000000C9 D_GETFILEINFO2 000E 000006ED 0000004C D_FLUSH2 000F 00000739 000001EF D_GETVOL2 0010 00000928 0000005F GSOSSTRINGS 0011 00000987 00000066 D_DESTROYBYREF 0012 000009ED 0000005E GETVOLBYREF 0013 00000A4B 0000005C UNPROTECTDISKBYREF 0014 00000AA7 000000D6 UNPROTECTDISK 0015 00000B7D 00000071 D_GETFILENAME 0016 00000BEE 00000587 WAITDISKALERT 0017 00001175 00000049 D_ALLOCNAME 0018 000011BE 00000037 D_STRTOSTR1 0019 000011F5 00000037 D_STR1CVT 001A 0000122C 0000007E HANDLEGSOSERR 001B 000012AA 00000231 D_PRODOSDATA -------------------------------------------------------------------------------- 0009 Load Segment "BrkV" relocatable LENGTH=$193 KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 0000006D D_DOBRKV 0002 0000006D 0000001C D_BRKV 0003 00000089 0000010A D_MYBRKV -------------------------------------------------------------------------------- 000A Load Segment "DateUtils" relocatable LENGTH=$AC4 KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 00000221 D_DATEDATA 0002 00000221 0000006D D_VALIDDATE 0003 0000028E 000000E3 D_DATETOLONG 0004 00000371 0000018C D_DATETOSTR 0005 000004FD 000001AF D_LONGTODATE 0006 000006AC 00000210 D_STRTODATE 0007 000008BC 0000001B D_CURRENTTIME 0008 000008D7 00000026 D_TODAYSDATE 0009 000008FD 000000DF D_STRTOTIME 000A 000009DC 000000E8 D_TIMETOSTR -------------------------------------------------------------------------------- 000B Load Segment "Cursor" relocatable LENGTH=$1889 KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 000000A6 D_SETCURSOR 0002 000000A6 0000000F D_CURSORINIT 0003 000000B5 00000210 D_BEACHBALL 0004 000002C5 0000008C D_SHIELDCURSOR 0005 00000351 0000002E D_UNSHIELDCURSOR 0006 0000037F 0000150A D_CURSORDATA -------------------------------------------------------------------------------- 000C Load Segment "Sort" relocatable LENGTH=$287 KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 0000008C D_SORT 0002 0000008C 000001FB D_MERGESORT -------------------------------------------------------------------------------- 000D Load Segment "About" relocatable LENGTH=$ABC KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 00000ABC D_DOABOUT -------------------------------------------------------------------------------- 000E Load Segment "RectUtils" relocatable LENGTH=$488 KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 000002B2 D_RECTZAP 0002 000002B2 000001D6 D_RECTCLEAR -------------------------------------------------------------------------------- 000F Load Segment "Config" relocatable LENGTH=$56E KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 000000A0 D_CONFIGURE 0002 000000A0 000001B5 D_CONFIGFILTER 0003 00000255 00000125 D_READCONFIG 0004 0000037A 00000134 D_WRITECONFIG 0005 000004AE 000000C0 D_CONFIGDATA -------------------------------------------------------------------------------- 0010 Load Segment "Stack" relocatable LENGTH=$4000 KIND=$0012 (Direct Page/Stack) -------------------------------------------------------------------------------- 0001 00000000 00004000 STACKMIN -------------------------------------------------------------------------------- 0011 Load Segment "SCRAP" relocatable LENGTH=$47BA KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 00000055 X_PLTOASCIISCRAP 0002 00000055 00000055 X_WPTOASCIISCRAP 0003 000000AA 00000055 X_SSTOASCIISCRAP 0004 000000FF 00000055 X_PLTOWPSCRAP 0005 00000154 00000055 X_ASCIITOWPSCRAP 0006 000001A9 00000057 X_AWDBTODBSCRAP 0007 00000200 0000005B X_DOASCIITODBSCRAP 0008 0000025B 00000057 X_IMPORTASCIITODBSCRAP 0009 000002B2 00000055 X_MSGSTOWPSCRAP 000A 00000307 00000055 X_DBTOPICT 000B 0000035C 00000055 X_DBTOPLSCRAP 000C 000003B1 00000055 X_WPTOPLSCRAP 000D 00000406 00000055 X_SSTOPLSCRAP 000E 0000045B 0000005B X_DOASCIITOPLTEXT 000F 000004B6 00000055 X_AWSSTOSSSCRAP 0010 0000050B 0000005B X_DOASCIITOSSSCRAP 0011 00000566 00000057 X_IMPORTASCIITOSSSCRAP 0012 000005BD 00000074 X_LOAD_PICTURE 0013 00000631 00000036 X_READWPSCRAP 0014 00000667 00000032 X_WRITEWPSCRAP 0015 00000699 00000034 X_WRITETHREAD 0016 000006CD 00000052 X_IMPORTWP 0017 0000071F 00000055 X_AWWPTOWPSCRAP 0018 00000774 000000D0 X_INITSCRAP 0019 00000844 00000227 X_CLIPDATA 001A 00000A6B 00000159 X_READSTANDARDSCRAP 001B 00000BC4 00000111 X_WRITESTANDARDSCRAP 001C 00000CD5 00000092 X_POSTSCRAP 001D 00000D67 0000019A X_GETSCRAP 001E 00000F01 000000F7 X_CHECKSCRAP 001F 00000FF8 0000006F X_CHECKDBPICT 0020 00001067 00000026 X_KILLOLDSCRAP 0021 0000108D 00000026 X_KILLCACHESCRAP 0022 000010B3 000001E8 X_CONVERTSCRAP 0023 0000129B 00000025 X_CONIGNORE 0024 000012C0 00000047 X_OTHERCOPY 0025 00001307 0000007D X_DISPOSESCRAP 0026 00001384 0000001D X_DISPOSESIMPLEHANDLE 0027 000013A1 000000A1 X_COPYSCRAP 0028 00001442 00000068 X_COPYONEHANDLE 0029 000014AA 000000B3 X_DIALOGFROMSCRAP 002A 0000155D 00000095 X_DIALOGTOSCRAP 002B 000015F2 000000B2 X_COMPAREHANDLES 002C 000016A4 00000045 X_ASCIITOPLTEXT 002D 000016E9 0000003E X_IMPORTASCIITOPLTEXT 002E 00001727 00000020 X_DISPOSEWPSCRAP 002F 00001747 00000035 X_COPYWPSCRAP 0030 0000177C 000002DB X_MASSAGEWPSCRAP 0031 00001A57 00000090 X_DBTOWPSCRAP 0032 00001AE7 00000090 X_SSTOWPSCRAP 0033 00001B77 00000026 X_SWITCHFONT 0034 00001B9D 000000E8 X_SWITCHFONTID 0035 00001C85 00000034 X_TABRULERDATA 0036 00001CB9 00000052 X_MAKESTANDARDRULER 0037 00001D0B 00000007 X_TENTHSTO80THS 0038 00001D12 0000008C X_DBTOSSSCRAP 0039 00001D9E 00000038 X_ASCIITOSSSCRAP 003A 00001DD6 00000051 X_SWTOSSSCRAP 003B 00001E27 00000051 X_WPTOSSSCRAP 003C 00001E78 00000094 X_SSTODBSCRAP 003D 00001F0C 00000051 X_SWTODBSCRAP 003E 00001F5D 00000051 X_WPTODBSCRAP 003F 00001FAE 00000038 X_ASCIITODBSCRAP 0040 00001FE6 0000004B X_COPYPLOBJ 0041 00002031 00000041 X_KILLPLOBJ 0042 00002072 00000052 X_PL2PICTSCRAP 0043 000020C4 0000005A X_GETPLSCRAPADDR 0044 0000211E 0000000C X_PS_DATA 0045 0000212A 00000055 X_DBTOASCIISCRAP 0046 0000217F 00000043 X_IMPORTASCIITOWPSCRAP 0047 000021C2 00000167 X_ASCIIFILTER 0048 00002329 000000DC X_DBSCRAPDATA 0049 00002405 00000008 X_DBAWORKSDATA 004A 0000240D 0000044A X_SSSCRAPDATA 004B 00002857 0000004F X_COPYGRPICT 004C 000028A6 0000004A X_FREEGRPICT 004D 000028F0 00000052 X_GRPICTTOPICT 004E 00002942 0000005B X_GETGRSTATADDR 004F 0000299D 000006F7 X_FORMATVALUE 0050 00003094 00000035 X_MOVESANEX 0051 000030C9 0000021B X_SANEDATA 0052 000032E4 00000082 X_INITFIELDSCANNER 0053 00003366 000000F2 X_NEXTFIELD 0054 00003458 00000169 X_FIELDSCANNERDATA 0055 000035C1 0000024F X_FSDIALOGDATA 0056 00003810 00000268 X_COPYTHREAD 0057 00003A78 000000D9 X_DISPOSETHREAD 0058 00003B51 0000004F X_IMPORTWPTOASCII 0059 00003BA0 00000055 X_IMPORTWPTOPLTEXT 005A 00003BF5 0000002D X_IMPORTASCII 005B 00003C22 00000051 X_IMPORTMSGSTOASCII 005C 00003C73 00000051 X_IMPORTMSGSTOPLTEXT 005D 00003CC4 00000051 X_IMPORTAWWPTOASCII 005E 00003D15 00000051 X_IMPORTAWWPTOPLTEXT 005F 00003D66 00000153 X_IMPORTGRSCRAP 0060 00003EB9 000001A8 X_DRAWCLIPBOARD 0061 00004061 00000418 X_DRAWPLTEXT 0062 00004479 0000003F X_SHORTASCIITEXT 0063 000044B8 0000002D X_SHORTPLTEXT 0064 000044E5 00000051 X_SHORTWPTEXT 0065 00004536 000000FF X_SHORTDBSCRAP 0066 00004635 000000F4 X_SHORTSSSCRAP 0067 00004729 0000007A X_SHORTFORMATTEXT 0068 000047A3 00000017 X_SHORTIGNORE -------------------------------------------------------------------------------- 0012 Load Segment "GRSTAT" relocatable LENGTH=$2403 KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 0000000C G_SPROCS 0002 0000000C 00000038 G_DOLISTTOPICT 0003 00000044 000000B3 G_STATICINIT 0004 000000F7 00000024 G_STATDATA 0005 0000011B 000000A5 G_FREEOBJECT 0006 000001C0 0000018B G_COPYOBJECT 0007 0000034B 00000063 G_DUPHAND 0008 000003AE 0000000B G_OBJECTDATA2 0009 000003B9 00000061 G_NEWLIST 000A 0000041A 00000041 G_FREELIST 000B 0000045B 000000CB G_INSERT 000C 00000526 00000090 G_INSERTLIST 000D 000005B6 000000A0 G_REMOVELIST 000E 00000656 00000071 G_COPYLIST 000F 000006C7 00000046 G_GETONE 0010 0000070D 00000053 G_COUNTLIST 0011 00000760 00000004 G_LISTDATA 0012 00000764 00000157 G_TRAVERSE 0013 000008BB 00000000 G_TRAVERSEDATA 0014 000008BB 00001B48 G_PALETTEDATA -------------------------------------------------------------------------------- 0013 Load Segment "PLSCRAP" relocatable LENGTH=$33C KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 0000000C P_SCRAPJUMPS 0002 0000000C 00000006 P_SCRAPDATA 0003 00000012 00000035 P_COPYPLSCRAP 0004 00000047 00000048 P_DELPLSCRAP 0005 0000008F 0000005D P_PL2PICT 0006 000000EC 0000007E P_DELOBJLIST 0007 0000016A 000000DC T_DISPOSE 0008 00000246 000000F6 P_STRINGS -------------------------------------------------------------------------------- 0014 Load Segment "WP2" relocatable LENGTH=$23FD KIND=$0000 -------------------------------------------------------------------------------- 0001 00000000 00000056 W_DISPMERGEDB 0002 00000056 00000039 W_MFDRAWITEM 0003 0000008F 00000077 W_DSDRAWITEM 0004 00000106 0000002C W_PMSELITEM 0005 00000132 000001F3 W_MERGEDLGDATA 0006 00000325 00000133 W_STATDATA 0007 00000458 00000076 W_DOLETEXTBOX2 0008 000004CE 0000025E W_FRDLGDATA 0009 0000072C 000001B0 W_DRAWRULER 000A 000008DC 000000A1 W_DRAWTABS 000B 0000097D 00000035 W_INITVISRULER 000C 000009B2 00000132 W_MAKEVISRULER 000D 00000AE4 000000FD W_RULERCLICK 000E 00000BE1 000001C3 W_MODIFYRULER 000F 00000DA4 0000074C W_RULERDATA 0010 000014F0 00000236 W_ONERULCLICK 0011 00001726 0000005A W_DELETETAB 0012 00001780 00000072 W_INSERTTAB 0013 000017F2 000002D6 W_TRACKTAB 0014 00001AC8 00000086 W_CHECKWELLS 0015 00001B4E 00000098 W_SETSTATBIT 0016 00001BE6 00000084 W_INVERTBITBOX 0017 00001C6A 0000011D W_GOTOPAGE 0018 00001D87 00000199 W_PAGEDIALOG 0019 00001F20 000001EA W_PAGEDLGFILTER 001A 0000210A 00000070 W_DRAWRECTITEM 001B 0000217A 00000283 W_PAGEDLGDATA -------------------------------------------------------------------------------- 0015 Load Segment "~JumpTable" relocatable LENGTH=$110E KIND=$0002 (Jump Table) -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- 0016 Load Segment "SP" relocatable LENGTH=$6116 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000199 _SPStartUp 0002 00000199 000000D2 _SPShutDown 0003 0000026B 0000032D _SPCheck 0004 00000598 00000160 _SPSuggest 0005 000006F8 000001EB _SPOpenUDict 0006 000008E3 0000008F _SPNewUDict 0007 00000972 0000030A _SPAddWord 0008 00000C7C 00000123 NextChar 0009 00000D9F 0000006A EatWhite 000A 00000E09 0000044D GetWord 000B 00001256 00000244 CheckWord 000C 0000149A 00000043 MakeLower 000D 000014DD 00000097 SPCloseFiles 000E 00001574 000007C3 SPDlg 000F 00001D37 0000006D SPCloseDlg 0010 00001DA4 0000007F drawWord 0011 00001E23 000000D5 selProc 0012 00001EF8 000001DF myfilter 0013 000020D7 00000C87 _SPEditUDict 0014 00002D5E 00000049 strhpcmp 0015 00002DA7 00000097 drawWord 0016 00002E3E 00000106 selProc 0017 00002F44 00000189 udfilter 0018 000030CD 00000098 setcorr 0019 00003165 0000007F corrinit 001A 000031E4 000002E9 corrfinish 001B 000034CD 00000164 seqlen 001C 00003631 000000AA correct 001D 000036DB 000001E8 cordophon 001E 000038C3 00000171 corrform 001F 00003A34 00000244 rankalt 0020 00003C78 000000B7 getacorelex 0021 00003D2F 0000018F clxalloc 0022 00003EBE 0000007B clxfree 0023 00003F39 000000CA clxword 0024 00004003 00000149 clxbinfind 0025 0000414C 000000F0 clxtypo 0026 0000423C 000001EA lexalloc 0027 00004426 00000097 lexgetstr 0028 000044BD 0000004C lexread 0029 00004509 00000180 lexfree 002A 00004689 00000098 lexblknum 002B 00004721 00000058 lexword 002C 00004779 0000018E lexfetch 002D 00004907 00000098 lexnextblk 002E 0000499F 00000025 isword 002F 000049C4 0000006E sclookup 0030 00004A32 000001FC iswelement 0031 00004C2E 00000091 pathadd 0032 00004CBF 000000BE pathdel 0033 00004D7D 00000068 clamopen 0034 00004DE5 00000027 clamclose 0035 00004E0C 00000043 clxopen 0036 00004E4F 00000023 clxclose 0037 00004E72 00000049 lexopen 0038 00004EBB 00000023 lexclose 0039 00004EDE 00000098 setquery 003A 00004F76 000000BE clblock 003B 00005034 0000010C clgetword 003C 00005140 00000078 cladvance 003D 000051B8 00000036 clisdata 003E 000051EE 00000053 clencode 003F 00005241 000000E3 makeib 0040 00005324 00000247 clamalloc 0041 0000556B 00000064 clamfree 0042 000055CF 00000050 clamword 0043 0000561F 000000B7 clfetch 0044 000056D6 0000021A clamnext 0045 000058F0 00000064 clfindbin 0046 00005954 0000002D clbinnext 0047 00005981 000000C7 clbinret 0048 00005A48 000006CE clamadd -------------------------------------------------------------------------------- 0017 Load Segment "TH" relocatable LENGTH=$9DBF KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 000004EA THDlg 0002 000004EA 00000047 drawDefBox 0003 00000531 0000007F drawWord 0004 000005B0 000000AC selProc 0005 0000065C 00000083 thfilter 0006 000006DF 00000161 fixdef 0007 00000840 0000010B _THStartUp 0008 0000094B 0000003A _THShutDown 0009 00000985 0000005C _THWord 000A 000009E1 000000D5 _THInfo 000B 00000AB6 00000450 thesopen 000C 00000F06 000000B1 thesclose 000D 00000FB7 00000549 thesword 000E 00001500 0000036E thsinit 000F 0000186E 000000E9 thesfetch 0010 00001957 000000D9 savemean 0011 00001A30 00000172 savedir 0012 00001BA2 000000A2 skipmean 0013 00001C44 00000191 findcode 0014 00001DD5 00000245 theshuff 0015 0000201A 000000BA binloc 0016 000020D4 0000056D getmean 0017 00002641 0000050B thesinfo 0018 00002B4C 00000187 setqflags 0019 00002CD3 00000041 nextlist 001A 00002D14 000000BD getshtab 001B 00002DD1 00000111 getstage 001C 00002EE2 00000098 isinf 001D 00002F7A 000000C0 getstrtab 001E 0000303A 000001BF delunf 001F 000031F9 00000365 badunf 0020 0000355E 00000123 goodpos 0021 00003681 000001AC theswtoh 0022 0000382D 0000020E theshash 0023 00003A3B 0000007B lextoasc 0024 00003AB6 00000167 thesbit 0025 00003C1D 0000015A thesskip 0026 00003D77 000000B7 thesblk 0027 00003E2E 0000001F unftry 0028 00003E4D 00000108 remphon 0029 00003F55 0000007A thintmv 002A 00003FCF 00000078 unflect 002B 00004047 00000879 unfword 002C 000048C0 00000072 cutoff1 002D 00004932 00000555 uplural 002E 00004E87 00000086 udo_ness 002F 00004F0D 00000154 udo_ly 0030 00005061 0000067E unormend 0031 000056DF 000000A7 udo_ment 0032 00005786 00000303 udo_able 0033 00005A89 000000D1 unfstage 0034 00005B5A 0000018B chkmultunf 0035 00005CE5 000000E6 multunftry 0036 00005DCB 0000063D unfphrase 0037 00006408 00000126 removunf 0038 0000652E 000006B5 inflect 0039 00006BE3 000007A8 iplural 003A 0000738B 000001FE ido_ly 003B 00007589 0000045B inormend 003C 000079E4 00000090 ido_ment 003D 00007A74 00000509 ido_able 003E 00007F7D 000000DD alttry 003F 0000805A 0000032B ido_est 0040 00008385 000000B6 appndstr 0041 0000843B 00000214 unfopen 0042 0000864F 00000046 unfclose 0043 00008695 000007CC unfexc 0044 00008E61 000001E1 unfbin 0045 00009042 000003C4 dispunf 0046 00009406 00000074 printpos 0047 0000947A 00000142 Tlexstrip 0048 000095BC 000001EA Tlexalloc 0049 000097A6 00000097 Tlexgetstr 004A 0000983D 0000004C Tlexread 004B 00009889 000000F4 Tlexfree 004C 0000997D 00000098 Tlexblknum 004D 00009A15 00000058 Tlexword 004E 00009A6D 0000018E Tlexfetch 004F 00009BFB 0000009A Tlexnextblk 0050 00009C95 0000012A Tlexbinnext -------------------------------------------------------------------------------- 0018 Load Segment "SPTH" relocatable LENGTH=$23E3 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000134 meminit 0002 00000134 0000006C memcheck 0003 000001A0 000000F0 memlink 0004 00000290 00000073 memdel 0005 00000303 00000098 memwrite 0006 0000039B 00000166 memread 0007 00000501 00000092 memflush 0008 00000593 00000043 memswitch 0009 000005D6 0000003F zalloc 000A 00000615 00000043 nzfree 000B 00000658 0000007E strdiff 000C 000006D6 000000E9 move 000D 000007BF 0000004E strecpy 000E 0000080D 000004A7 phencode 000F 00000CB4 000000F0 phprepend 0010 00000DA4 000000E7 phbin 0011 00000E8B 00000133 phcompress 0012 00000FBE 00000086 phfull 0013 00001044 0000027A doflags 0014 000012BE 0000016B undoflags 0015 00001429 0000003B proxzero 0016 00001464 00000077 c2pstr1 0017 000014DB 00000061 stdopen 0018 0000153C 0000005C stdcreate 0019 00001598 0000001C stdclose 001A 000015B4 0000002D stdread 001B 000015E1 0000002D stdwrite 001C 0000160E 00000067 stdseek 001D 00001675 00000022 stdend 001E 00001697 00000026 tolower 001F 000016BD 00000026 _toupper 0020 000016E3 00000046 isupper 0021 00001729 00000046 islower 0022 0000176F 00000025 isalpha 0023 00001794 0000000B _LADD 0024 0000179F 0000000A _LAND 0025 000017A9 00000085 _IDIV 0026 0000182E 0000000A _LORA 0027 00001838 000000F1 _LDIV 0028 00001929 0000000B _LSUB 0029 00001934 00000045 _IMUL 002A 00001979 00000087 _LMUL 002B 00001A00 0000002B _LCOMP 002C 00001A2B 00000046 qsort 002D 00001A71 0000006C c2pstr 002E 00001ADD 0000007C p2cstr 002F 00001B59 00000046 _BINSRCH 0030 00001B9F 00000010 _ILSHIFT 0031 00001BAF 00000027 _LLSHIFT 0032 00001BD6 00000024 _IRSHIFT 0033 00001BFA 00000049 _LRSHIFT 0034 00001C43 0000006D strcat 0035 00001CB0 0000004C strchr 0036 00001CFC 00000052 strlen 0037 00001D4E 00000086 strcmp 0038 00001DD4 0000004E strcpy 0039 00001E22 00000008 _CALLFUNC 003A 00001E2A 000000A8 strncmp 003B 00001ED2 0000004C strrchr 003C 00001F1E 00000088 strncpy 003D 00001FA6 00000354 qs1 003E 000022FA 00000064 qsexc 003F 0000235E 00000085 qstexc -------------------------------------------------------------------------------- 0019 Load Segment "ColorEdit" relocatable LENGTH=$21E5 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000178 D_COLOR_EDITOR 0002 00000178 000001AA D_COLORVARS 0003 00000322 0000002C D_CEDOBUTTON 0004 0000034E 00000073 D_CEDORADIO 0005 000003C1 0000004E D_GOPURE 0006 0000040F 00000047 D_GODITH 0007 00000456 00000435 D_RGBTOHIS 0008 0000088B 000000CC D_MAXOFTHREE 0009 00000957 000000C6 D_MINOFTHREE 000A 00000A1D 000002CA D_HISTORGB 000B 00000CE7 0000022C D_CEHUEVALUE 000C 00000F13 00000249 D_COLORDATA 000D 0000115C 00000307 D_CECREATE 000E 00001463 0000004C D_CEDISPOSE 000F 000014AF 000000E8 D_CESCROLLACTION 0010 00001597 00000061 D_CECOLORADJUST 0011 000015F8 000000BA D_RGBTOCOLOR 0012 000016B2 0000000C D_ADJUSTTABLE 0013 000016BE 0000005D D_ADJUSTRED 0014 0000171B 0000005D D_ADJUSTGREEN 0015 00001778 0000005D D_ADJUSTBLUE 0016 000017D5 0000005D D_ADJUSTHUE 0017 00001832 0000005D D_ADJUSTINT 0018 0000188F 0000005D D_ADJUSTSAT 0019 000018EC 0000011A D_CEINITBARS 001A 00001A06 0000011E D_SETRGBBARS 001B 00001B24 00000118 D_SETHISBARS 001C 00001C3C 0000008F D_DRAWTABLE 001D 00001CCB 00000064 D_FINDITEM 001E 00001D2F 00000052 D_DESELECTITEM 001F 00001D81 00000057 D_SELECTITEM 0020 00001DD8 0000003B D_SETITEMRECT 0021 00001E13 00000140 D_PALLETE 0022 00001F53 0000004E D_SETSCBS 0023 00001FA1 00000075 D_NEWCONTROL2 0024 00002016 000000B5 D_RECTDRAWCHAR 0025 000020CB 0000009D D_CECOLORUPDATE 0026 00002168 00000034 D_CEDOUBLE 0027 0000219C 00000049 D_CEPUREFILL -------------------------------------------------------------------------------- 001A Load Segment "WPIO" relocatable LENGTH=$80E KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000397 X_SCREADWPSCRAP 0002 00000397 00000056 X_SCWRITEWPSCRAP 0003 000003ED 00000353 X_SCWRITETHREAD 0004 00000740 000000CE X_SCIMPORTWP -------------------------------------------------------------------------------- 001B Load Segment "TOASCII" relocatable LENGTH=$665 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000142 X_SCPLTOASCIISCRAP 0002 00000142 000001FB X_SCWPTOASCIISCRAP 0003 0000033D 00000328 X_SCSSTOASCIISCRAP -------------------------------------------------------------------------------- 001C Load Segment "TOWPSCRAP" relocatable LENGTH=$A1A KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000498 X_SCPLTOWPSCRAP 0002 00000498 00000582 X_SCASCIITOWPSCRAP -------------------------------------------------------------------------------- 001D Load Segment "IMPORTAWDB" relocatable LENGTH=$854 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000854 X_SCAWDBTODBSCRAP -------------------------------------------------------------------------------- 001E Load Segment "TODBSCRAP" relocatable LENGTH=$660 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 000004A2 X_SCDOASCIITODBSCRAP 0002 000004A2 000001BE X_SCIMPORTASCIITODBSCRAP -------------------------------------------------------------------------------- 001F Load Segment "IMPORTAWWP" relocatable LENGTH=$1110 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00001110 X_SCAWWPTOWPSCRAP -------------------------------------------------------------------------------- 0020 Load Segment "IMPORTMSGS" relocatable LENGTH=$B97 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 000001B9 X_SCMSGSTOWPSCRAP 0002 000001B9 000009DE X_DOMSGSTOWPSCRAP -------------------------------------------------------------------------------- 0021 Load Segment "TOPICT" relocatable LENGTH=$10F KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 0000010F X_SCDBTOPICT -------------------------------------------------------------------------------- 0022 Load Segment "TOSTATTEXT" relocatable LENGTH=$E14 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 000005D3 X_SCDBTOPLSCRAP 0002 000005D3 00000202 X_SCWPTOPLSCRAP 0003 000007D5 0000046D X_SCSSTOPLSCRAP 0004 00000C42 000001D2 X_SCDOASCIITOPLTEXT -------------------------------------------------------------------------------- 0023 Load Segment "IMPORTAWSS" relocatable LENGTH=$F93 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000F93 X_SCAWSSTOSSSCRAP -------------------------------------------------------------------------------- 0024 Load Segment "TOSSSCRAP" relocatable LENGTH=$3A2 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 000001F9 X_SCDOASCIITOSSSCRAP 0002 000001F9 000001A9 X_SCIMPORTASCIITOSSSCRAP -------------------------------------------------------------------------------- 0025 Load Segment "IMPORTPICT" relocatable LENGTH=$63C KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 0000063C X_SCLOAD_PICTURE -------------------------------------------------------------------------------- 0026 Load Segment "HEAP" relocatable LENGTH=$1254 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 0000007F H_INIT 0002 0000007F 000000F4 H_SETHEAP 0003 00000173 000000F6 H_UNSETHEAP 0004 00000269 00000019 H_RESETHEAP 0005 00000282 0000008F H_NEWHEAP 0006 00000311 00000095 H_DISPOSEHEAP 0007 000003A6 000000DA H_WRITEHEAP 0008 00000480 000002F0 H_READHEAP 0009 00000770 00000074 CALCHEADERPTRS 000A 000007E4 0000002E H_NEWBLOCK 000B 00000812 0000001C H_DISPOSEBLOCK 000C 0000082E 000002B1 H_RESIZEBLOCK 000D 00000ADF 00000056 H_COPYBLOCK 000E 00000B35 00000044 H_GETBLOCKPTR 000F 00000B79 00000042 H_GETBLOCKSIZE 0010 00000BBB 0000000D H_TRUNCHEAP 0011 00000BC8 000000A8 NEWINDEX 0012 00000C70 0000001C DISPOSEINDEX 0013 00000C8C 00000183 NEWBLOCK 0014 00000E0F 0000006A DISPOSEBLOCK 0015 00000E79 0000007A COMPACTMOVEBLOCK 0016 00000EF3 000001A0 SQUEEZEHEAP 0017 00001093 0000011F COMPACTSEGMENT 0018 000011B2 000000A2 NEWDATASEGMENT -------------------------------------------------------------------------------- 0027 Load Segment "EVAL" relocatable LENGTH=$681C KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00001C84 E_DOEVALEXPR 0002 00001C84 000000DF E_EVALEXPR 0003 00001D63 00000061 E_MOVESANEX 0004 00001DC4 00000095 E_EVALMOD 0005 00001E59 000000D6 E_EVALROUND 0006 00001F2F 00000075 E_EVALSIGN 0007 00001FA4 0000011F E_EVALRANDOM 0008 000020C3 000000DE E_EVALACOS 0009 000021A1 000000B2 E_EVALASIN 000A 00002253 000000A5 E_EVALFV 000B 000022F8 00000189 E_EVALIRR 000C 00002481 0000007D E_EVALPMT 000D 000024FE 0000007D E_EVALPV 000E 0000257B 000000AD E_EVALRATE 000F 00002628 000000D0 E_EVALTERM 0010 000026F8 00000081 E_EVALENDS 0011 00002779 00000040 E_EVALLOWER 0012 000027B9 000000A7 E_EVALPOS 0013 00002860 0000004D E_EVALPROPER 0014 000028AD 000000E5 E_EVALSUBSTR 0015 00002992 00000040 E_EVALUPPER 0016 000029D2 00000059 E_EVALASC 0017 00002A2B 0000006B E_EVALCHR 0018 00002A96 0000006A E_EVALSTR 0019 00002B00 000000B2 E_EVALVAL 001A 00002BB2 0000007F E_EVALALERT 001B 00002C31 000000A2 E_EVALDATE 001C 00002CD3 00000090 E_EVALDAY 001D 00002D63 000000B4 E_EVALMONTH 001E 00002E17 00000098 E_EVALNUMDATE 001F 00002EAF 0000006B E_EVALTODAY 0020 00002F1A 000000B4 E_EVALWEEKDAY 0021 00002FCE 00000093 E_EVALYEAR 0022 00003061 00000071 E_EVALTIME 0023 000030D2 000000E2 E_CHECKARGTYPE 0024 000031B4 00000268 E_CHECKARGTYPES 0025 0000341C 000001AB E_CMPARGS 0026 000035C7 000000D3 E_CMPDATES 0027 0000369A 0000009E E_CMPTIMES 0028 00003738 00000023 E_GETTYPE 0029 0000375B 00000023 E_SETTYPE 002A 0000377E 00000025 E_PUSHTYPE 002B 000037A3 0000032C E_EXPANDFORMULA 002C 00003ACF 0000000A E_GETNFUNCS 002D 00003AD9 0000005A E_GETFUNCNAME 002E 00003B33 00000198 E_PARSEFORMULA 002F 00003CCB 00000120 E_PARSENUMBER 0030 00003DEB 00000CEF E_PARSEEXPR 0031 00004ADA 00000802 E_EVALDATA 0032 000052DC 0000003B E_HASHSTRING 0033 00005317 00000847 E_GETNEXTTOKEN 0034 00005B5E 0000000A E_GETNDBFUNCS 0035 00005B68 00000068 E_GETDBFUNCNAME 0036 00005BD0 0000000A E_GETNOPS 0037 00005BDA 0000004C E_GETOPNAME 0038 00005C26 00000026 E_EVALRANGEDATA 0039 00005C4C 000000BD E_EVALGETCELL 003A 00005D09 00000088 E_GETCELLTYPE 003B 00005D91 000000D5 E_DORANGE 003C 00005E66 00000077 E_RANGEORIENTATION 003D 00005EDD 0000005A E_FIXCELLLIST 003E 00005F37 000000B9 E_SUMRANGE 003F 00005FF0 000000D9 E_MAXRANGE 0040 000060C9 000000F9 E_VARRANGE 0041 000061C2 00000049 E_COUNTRANGE 0042 0000620B 00000109 E_NPVRANGE 0043 00006314 00000101 E_IRRRANGE 0044 00006415 000000EB E_ANDRANGE 0045 00006500 000000B7 E_CONCATRANGE 0046 000065B7 000000E4 E_CHOOSERANGE 0047 0000669B 000000AF E_LOOKUPNUMRANGE 0048 0000674A 000000D2 E_LOOKUPSTRRANGE -------------------------------------------------------------------------------- 0028 Load Segment "PICT" relocatable LENGTH=$1EFF KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 0000098E Q_MANGLEPICT 0002 0000098E 00000138 Q_PICTDATA 0003 00000AC6 00000160 Q_REGION 0004 00000C26 000000ED Q_MANGLEREGION 0005 00000D13 00000107 Q_FLIPHRGN 0006 00000E1A 0000011C Q_FLIPVRGN 0007 00000F36 00000212 Q_FLIPDRGN 0008 00001148 00000051 Q_ROTRRGN 0009 00001199 00000051 Q_ROTLRGN 000A 000011EA 00000304 Q_PIXOPS 000B 000014EE 000000CA Q_FLIPHMAP 000C 000015B8 00000082 Q_FLIPVMAP 000D 0000163A 000000DD Q_ROTRMAP 000E 00001717 000000F8 Q_ROTLMAP 000F 0000180F 000002A5 Q_TEXTOPS 0010 00001AB4 000002DB Q_MAKETEXTIMAGE 0011 00001D8F 00000170 Q_MANGLEPOINT -------------------------------------------------------------------------------- 0029 Load Segment "CM" relocatable LENGTH=$8D68 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000070 C_PROCS 0002 00000070 00000002 CM_VERSION 0003 00000072 00000345 C_ATTRDATA 0004 000003B7 0000000F C_SENDTEXT 0005 000003C6 0000001D C_SETHBMODE 0006 000003E3 0000000D C_ABORTITEM 0007 000003F0 00000199 C_FIXMENUS 0008 00000589 00000035 C_SETMITEM 0009 000005BE 00000035 C_SETMENU 000A 000005F3 00000019 C_MAKEROOM 000B 0000060C 00000015 C_PRINTCHANGED 000C 00000621 00000052 C_PRINTDOC 000D 00000673 00000015 C_MESSAGE 000E 00000688 00000073 C_GLOBALS 000F 000006FB 00000016 C_SETTTYVECT 0010 00000711 0000001A C_DOTTYSET 0011 0000072B 0000002F C_CTLDRIVE 0012 0000075A 00000004 C_TTYVECT 0013 0000075E 00000000 C_COMM1TOOLS 0014 0000075E 00000065 C_NEWDOC 0015 000007C3 0000006D C_DISPOSEDOC 0016 00000830 000000DA C_MAKEWIN 0017 0000090A 000000AF C_INITWINDOW 0018 000009B9 00000005 C_LOADMOD 0019 000009BE 00000005 C_UNLOADMOD 001A 000009C3 00000019 C_UNLOCKMEM 001B 000009DC 00000019 C_RELOCKMEM 001C 000009F5 0000009D C_OPENDOC 001D 00000A92 00000037 C_SAVEDOC 001E 00000AC9 0000000A C_NOHARD 001F 00000AD3 00000023 C_INITSTUFF 0020 00000AF6 00000049 C_RESETMODEM 0021 00000B3F 00000016 C_INBUFDATA 0022 00000B55 0000000E C_CLRINBUF 0023 00000B63 0000001E C_DOINBUF 0024 00000B81 00000012 C_STUFFINBUF 0025 00000B93 00000070 C_TESTINBUF 0026 00000C03 00000091 C_WAITFORMODEM 0027 00000C94 000000A2 C_SCREENDATA 0028 00000D36 0000000D C_MULT12 0029 00000D43 00000011 C_MULT11 002A 00000D54 0000002B C_DISPMAP 002B 00000D7F 00000004 C_SCRMOD 002C 00000D83 0000000D C_KILLCURSOR 002D 00000D90 00000010 C_FIXCURSOR 002E 00000DA0 00000007 C_EATLF 002F 00000DA7 00000094 C_TTYDRIVE 0030 00000E3B 0000000A C_CRSTUFF 0031 00000E45 0000001D C_BONK 0032 00000E62 0000001C C_BS 0033 00000E7E 00000063 C_DEL 0034 00000EE1 00000068 C_FF2 0035 00000F49 00000008 C_CR 0036 00000F51 00000084 C_LF 0037 00000FD5 00000008 C_CHECKBOTTOM 0038 00000FDD 00000084 C_STUFFCHAR 0039 00001061 0000008F C_POSTSCREEN 003A 000010F0 00000012 C_MONOFONT 003B 00001102 00000014 C_SETCURLINE 003C 00001116 00000050 C_SCRINIT 003D 00001166 00000007 C_HOME 003E 0000116D 00000017 C_CLEARBUF 003F 00001184 000001FD C_DISPLAYINIT 0040 00001381 0000000E C_MOVETOXY 0041 0000138F 0000000E C_CURSORXY 0042 0000139D 0000001D C_PORTANDCLIP 0043 000013BA 0000000E C_TEXTCLIP 0044 000013C8 00000020 C_CALCTLINE 0045 000013E8 00000035 C_NEXTTLINE 0046 0000141D 0000003B C_CLEARLINES 0047 00001458 00000028 C_LFCLEAR 0048 00001480 0000000B C_DEREF 0049 0000148B 00000030 C_REDRAWDISP 004A 000014BB 00000050 C_DRAWLINE 004B 0000150B 0000009A C_SCROLLDISP 004C 000015A5 0000009C C_MAKESRECT 004D 00001641 000000AA C_SERIALDATA 004E 000016EB 00000034 C_DOSERDEF 004F 0000171F 00000077 C_INITFW 0050 00001796 00000086 C_FWINIT 0051 0000181C 00000023 C_EXTINT 0052 0000183F 00000029 C_FLUSHSEND 0053 00001868 00000007 C_INITLINECOUNT 0054 0000186F 00000067 C_FLUSHRCV 0055 000018D6 0000000E C_SSCADD 0056 000018E4 00000019 C_SENDBYTE 0057 000018FD 00000018 C_SENDNYB 0058 00001915 00000008 C_SERCOMMAND 0059 0000191D 0000010A C_SETSSC 005A 00001A27 00000047 C_DOMODEBITS 005B 00001A6E 0000000C C_CTLOFF 005C 00001A7A 000000A0 C_SETSSC2 005D 00001B1A 00000061 C_GETCHAR 005E 00001B7B 0000004D C_WAIT 005F 00001BC8 00000056 C_KILLXON 0060 00001C1E 0000007A C_ACTIVATE 0061 00001C98 00000069 C_DEACTIVATE 0062 00001D01 00000072 C_UPDATEDOC 0063 00001D73 0000003A C_DRAWGROW 0064 00001DAD 00000033 C_DRAWINFO 0065 00001DE0 00000015 C_SETPEN 0066 00001DF5 000000B0 C_GREWDOC 0067 00001EA5 00000046 C_SWAPIN 0068 00001EEB 00000046 C_SWAPOUT 0069 00001F31 0000003E C_NEWSCROLL 006A 00001F6F 0000008B C_MAKESBAR 006B 00001FFA 00000034 C_WINDDATA 006C 0000202E 0000000A C_DIALOGDATA 006D 00002038 0000000F C_SETCHECK 006E 00002047 00000007 C_SETDLG 006F 0000204E 00000004 C_CLRDLG 0070 00002052 00000012 C_SETFC 0071 00002064 00000067 C_DORECTITEM 0072 000020CB 0000003B C_GETRADIO 0073 00002106 0000001E C_SETRADIO 0074 00002124 00000014 C_GETDVAL 0075 00002138 00000013 C_SETDVAL 0076 0000214B 00000019 C_SERIALSHELL 0077 00002164 0000001A C_SER2COPY 0078 0000217E 0000001A C_COPY2SER 0079 00002198 00000714 C_SERIALDIALOG 007A 000028AC 00000005 C_UNDO 007B 000028B1 00000019 C_CUT 007C 000028CA 00000130 C_COPY 007D 000029FA 00000015 C_IMAGE 007E 00002A0F 000000A5 C_PASTE 007F 00002AB4 00000014 C_PASTEDATA 0080 00002AC8 0000001E C_PASTEDONE 0081 00002AE6 00000033 C_CLEAR 0082 00002B19 00000081 C_PASTEIDLE 0083 00002B9A 000003E4 C_HARDWAREDATA 0084 00002F7E 0000003A C_SAVESET 0085 00002FB8 00000042 C_ACCEPTSET 0086 00002FFA 00000035 C_CANCELSET 0087 0000302F 00000044 C_INITHARDDEF 0088 00003073 00000008 C_SETHARD 0089 0000307B 00000012 C_DOLOCAL 008A 0000308D 00000012 C_DOAUTODIAL 008B 0000309F 0000005B C_LISTDRAW 008C 000030FA 00000096 C_MODEMSEL 008D 00003190 00000042 C_DOSL 008E 000031D2 00000075 C_DOML 008F 00003247 00000043 C_SERIALSEL 0090 0000328A 00000019 C_SETTEMPGS 0091 000032A3 0000000E C_TEMP2SLOT 0092 000032B1 00000025 C_SETINITPTR 0093 000032D6 00000538 C_HARDWAREDIALOG 0094 0000380E 0000000F C_SPCR 0095 0000381D 0000008F C_DOINIT 0096 000038AC 0000004A C_FIXBAUD 0097 000038F6 00000044 C_CAPTUREDATA 0098 0000393A 0000010C C_INITCAPTURE 0099 00003A46 0000005C C_CRCAP 009A 00003AA2 00000026 C_SAVECAPSIZE 009B 00003AC8 00000027 C_DELCAP 009C 00003AEF 0000004A C_CAPSTUFF 009D 00003B39 00000035 C_DOCAPTURE 009E 00003B6E 0000001B C_CAPCLOSE 009F 00003B89 00000203 C_CLOSECAPTURE 00A0 00003D8C 000000AF C_DUMPCAPTURE 00A1 00003E3B 000001BF C_DIALDATA 00A2 00003FFA 00000042 C_GETDIAL 00A3 0000403C 0000000C C_UPCHAR 00A4 00004048 0000004C C_FINDDIALCHAR 00A5 00004094 00000044 C_NEWDIAL 00A6 000040D8 0000000D C_DIALCLOSE 00A7 000040E5 0000007A C_INITDIALEDIT 00A8 0000415F 0000001A C_RESETDIALSET 00A9 00004179 00000029 C_INITDIALREC 00AA 000041A2 00000044 C_DISPDIALEDIT 00AB 000041E6 0000000D C_DUMPDIALEDIT 00AC 000041F3 00000075 C_CHECKFCHAR 00AD 00004268 00000163 C_DIALADD 00AE 000043CB 00000007 C_SETDC 00AF 000043D2 00000072 C_DIALREMOVE 00B0 00004444 0000001C C_HILITEDITEM 00B1 00004460 00000018 C_ADDCHECK 00B2 00004478 0000003C C_RMCHECK 00B3 000044B4 0000001F C_GETNUMFIELD 00B4 000044D3 0000002A C_DIALCHECK 00B5 000044FD 00000100 C_FASTKEY 00B6 000045FD 00000036 C_RDSET 00B7 00004633 0000001A C_DIALINITSTR 00B8 0000464D 0000001B C_RUNDIAL 00B9 00004668 0000012E C_DIALDRAW 00BA 00004796 00000049 C_UPDATEEDIT 00BB 000047DF 0000006F C_DIALSEL 00BC 0000484E 00000374 C_DIALDIALOG 00BD 00004BC2 0000006C C_DIALFILTER 00BE 00004C2E 00000044 C_KEYDATA 00BF 00004C72 000000D5 C_KEYDOWN 00C0 00004D47 00000028 C_GETKEY 00C1 00004D6F 00000007 C_KEYINIT 00C2 00004D76 00000010 C_SNAP 00C3 00004D86 00000015 C_MOUSEUP 00C4 00004D9B 00000015 C_MOUSEINFO 00C5 00004DB0 0000013C C_MOUSEDOWN 00C6 00004EEC 00000018 C_DOPAGEUP 00C7 00004F04 0000003E C_DOTHUMB 00C8 00004F42 000000CA C_ACTIONPROC 00C9 0000500C 00000048 C_CRC2 00CA 00005054 0000002A C_CHECKSUM 00CB 0000507E 00000045 C_CHECKCRC 00CC 000050C3 00000028 C_LEDATA 00CD 000050EB 0000004A C_NEWLE 00CE 00005135 00000047 C_DOLE 00CF 0000517C 00000033 C_LEON 00D0 000051AF 00000030 C_LEOFF 00D1 000051DF 00000015 C_LEDISP 00D2 000051F4 0000000E C_ER1 00D3 00005202 0000000E C_ER2 00D4 00005210 00000055 C_DOSTAT 00D5 00005265 000000B8 C_SENDLE 00D6 0000531D 00000030 C_TTYPTR 00D7 0000534D 0000001C C_INITLE 00D8 00005369 00000007 C_INITSTATS 00D9 00005370 00000030 C_INTDATA 00DA 000053A0 000000A7 C_NEWINT 00DB 00005447 00000015 C_DISPINT 00DC 0000545C 00000016 C_CLEARRCV 00DD 00005472 0000000F C_FLUSHINQ 00DE 00005481 0000000F C_FLUSHOUTQ 00DF 00005490 00000018 C_CLEARSEND 00E0 000054A8 00000043 C_MYINT 00E1 000054EB 00000000 C_ACIADATA 00E2 000054EB 00000016 C_RCVINTON 00E3 00005501 00000013 C_RCVINTOFF 00E4 00005514 00000019 C_XMITINTON 00E5 0000552D 00000019 C_XMITINTOFF 00E6 00005546 000000E4 C_IDLEDATA 00E7 0000562A 000000A4 C_IDLEPROC 00E8 000056CE 0000005E C_IDLESTATS 00E9 0000572C 0000001B C_ANYUPDATE 00EA 00005747 0000005B C_IDLECURSOR 00EB 000057A2 0000011E C_DOSTATS 00EC 000058C0 0000002D C_DRAWINT 00ED 000058ED 00000063 C_DRAWBLOCKS 00EE 00005950 00000013 C_HBINIT 00EF 00005963 00000005 C_HBDISP 00F0 00005968 0000007B C_HBDATA 00F1 000059E3 00000082 C_MYHBIDLE 00F2 00005A65 00000009 C_DOABORT 00F3 00005A6E 00000033 C_STARTDIAL 00F4 00005AA1 0000000C C_ENDDIAL 00F5 00005AAD 00000013 C_KILLDIAL 00F6 00005AC0 00000091 C_DIALING 00F7 00005B51 0000005C C_HANGUP 00F8 00005BAD 00000063 C_ANSWERPHONE 00F9 00005C10 00000033 C_HAYESCOMM 00FA 00005C43 0000005C C_TESTONLINE 00FB 00005C9F 00000028 C_NORESPONSE 00FC 00005CC7 0000003E C_PRINTMESSAGE 00FD 00005D05 0000001A C_BEEPX3 00FE 00005D1F 0000002C C_IDLEMESSAGE 00FF 00005D4B 00000020 C_DOIDLEMESS 0100 00005D6B 0000003E C_HUHABORT 0101 00005DA9 00000023 C_SETUPDATA 0102 00005DCC 0000007A C_INITHARDWARE 0103 00005E46 00000019 C_DISPHARDWARE 0104 00005E5F 00000036 C_DOREAD 0105 00005E95 00000036 C_DOWRITE 0106 00005ECB 00000230 C_READCOMM 0107 000060FB 00000182 C_WRITECOMM 0108 0000627D 00000037 C_SETSERIAL 0109 000062B4 0000002C C_MOVESERIAL 010A 000062E0 0000000F C_GETSCRSTART 010B 000062EF 00000029 C_DOSTR 010C 00006318 0000000B C_INITSERIAL 010D 00006323 000001E4 C_CHKHARD 010E 00006507 00000017 C_CHKCP 010F 0000651E 0000004E C_APPLETALK 0110 0000656C 00000018 C_SELECTDATA 0111 00006584 00000194 C_CLICK 0112 00006718 00000078 C_PT2COORD 0113 00006790 0000002E C_COORD2PT 0114 000067BE 00000021 C_UNSELECT 0115 000067DF 00000031 C_SELECTALL 0116 00006810 00000081 C_INVERTRECT 0117 00006891 0000006E C_INVERTAREA2 0118 000068FF 00000094 C_INVERTAREA 0119 00006993 00000011 C_MOVESELECT3 011A 000069A4 0000003B C_MOVESELECT 011B 000069DF 00000040 C_GETSELEND 011C 00006A1F 00000037 C_FIXBOTTOM 011D 00006A56 00000040 C_SNAP2END 011E 00006A96 000001F3 C_XFERDATA 011F 00006C89 00000012 C_XSETCLOCK 0120 00006C9B 00000028 C_XCHECKTIME 0121 00006CC3 0000003E C_XSENDCHAR 0122 00006D01 0000002E C_XSENDSTRING 0123 00006D2F 00000034 C_XSENDPTR 0124 00006D63 00000046 C_XRCVPTR 0125 00006DA9 00000023 C_XSPACELEFT 0126 00006DCC 0000001F C_XRCVSIZE 0127 00006DEB 0000002E C_TTYSTRING 0128 00006E19 00000144 SF_PUTDIALOG640 0129 00006F5D 00000001 C_SFINIT 012A 00006F5E 000000C0 SF_GETDIALOG640 012B 0000701E 0000003C SF_STRINGS 012C 0000705A 00000057 C_TESTBIN2 012D 000070B1 000001CF C_BIN2FILE 012E 00007280 000000CA C_OPENSEND2 012F 0000734A 00000187 C_FILE2BIN 0130 000074D1 00000066 C_BATCHHEADER 0131 00007537 00000052 C_P16TOGSOSDATE 0132 00007589 0000004F C_GSOSTOP16DATE 0133 000075D8 000000FE C_BIN2DATA 0134 000076D6 00000168 C_XDIALOGDATA 0135 0000783E 00000044 C_XDDISPOSE 0136 00007882 00000137 C_XDADD 0137 000079B9 00000027 C_SETXDSIZE 0138 000079E0 00000092 C_XDREMOVE 0139 00007A72 0000016B C_XFERDIALOG 013A 00007BDD 0000005D C_XFERDRAW 013B 00007C3A 0000002F C_XFERSEL 013C 00007C69 000000B8 C_BOBLISTTOPATH 013D 00007D21 00000139 C_GETSENDFILE 013E 00007E5A 0000003C C_SFGETPROC 013F 00007E96 00000059 C_DOSEND1 0140 00007EEF 00000034 C_CLOSESEND 0141 00007F23 0000020E C_SENDIDLE 0142 00008131 00000085 C_OPENSENDFILE 0143 000081B6 00000022 C_CLEARBLOCK 0144 000081D8 0000003B C_NEXTSENDBLOCK 0145 00008213 00000054 C_GETSENDBLOCK 0146 00008267 0000007D C_READSENDBLOCK 0147 000082E4 0000008F C_GETNEXTSEND 0148 00008373 00000015 C_NOTLASTANDBIN2 0149 00008388 00000034 C_GETSENDBUF 014A 000083BC 0000000D C_DUMPSENDBUF 014B 000083C9 000000B9 C_DORCV1 014C 00008482 00000052 C_RCVINIT 014D 000084D4 00000583 C_RCVIDLE 014E 00008A57 00000068 C_P2C 014F 00008ABF 000000BF C_OPENBATCH 0150 00008B7E 00000074 C_SFPUTPROC 0151 00008BF2 00000176 C_OPENRCVFILE -------------------------------------------------------------------------------- 002A Load Segment "DB" relocatable LENGTH=$FC76 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000072 F_PROCS 0002 00000072 0000041D F_ATTRDATA 0003 0000048F 00000302 F_VECTOR 0004 00000791 000000D3 F_ACCEPTFIELDNAME 0005 00000864 00000068 F_ACCEPTLABEL 0006 000008CC 000001D6 F_ACCEPTCELL 0007 00000AA2 00000022 F_CLEARACTIVE 0008 00000AC4 000000B6 F_DRAWACTIVE 0009 00000B7A 0000021F F_EDITACTIVE 000A 00000D99 000001DE F_MOVEACTIVE 000B 00000F77 0000014C F_MOVEDOWN 000C 000010C3 00000120 F_MOVELEFT 000D 000011E3 0000011E F_MOVERIGHT 000E 00001301 0000014C F_MOVEUP 000F 0000144D 0000001B F_SETACTIVE 0010 00001468 00000280 F_CENTERACTIVE 0011 000016E8 000000B4 F_ACTIVATEDOC 0012 0000179C 0000024A F_CALCVARS 0013 000019E6 00000045 F_CREATECONTROLS 0014 00001A2B 000000DE F_DEACTIVATEDOC 0015 00001B09 00000091 F_DISPOSEDOC 0016 00001B9A 00000116 F_GROWDOC 0017 00001CB0 000000AD F_IDLEPROC 0018 00001D5D 000001D2 F_INITVARS 0019 00001F2F 000001AD F_KEYDOWN 001A 000020DC 00000050 F_LOADMOD 001B 0000212C 0000003A F_LOCKHANDLES 001C 00002166 00000019 F_MAKEROOM 001D 0000217F 000000C8 F_MAKEWIN 001E 00002247 00000279 F_MESSAGE 001F 000024C0 0000014B F_NEWDOC 0020 0000260B 0000006D F_NEWSIZE 0021 00002678 00000021 F_RELOCKMEM 0022 00002699 000000A2 F_SETUPDBWIN 0023 0000273B 0000001F F_UNLOADMOD 0024 0000275A 00000028 F_UNLOCKHANDLES 0025 00002782 00000021 F_UNLOCKMEM 0026 000027A3 0000006B F_CELLCLRVALUE 0027 0000280E 00000085 F_CELLCLRVALUE2 0028 00002893 00000088 F_CELLDISPOSE 0029 0000291B 0000004E F_CELLGETASCII 002A 00002969 00000054 F_CELLGETASCII2 002B 000029BD 00000059 F_CELLGETVALUE 002C 00002A16 0000006F F_CELLGETVALUE2 002D 00002A85 00000098 F_CELLSETVALUE 002E 00002B1D 00000149 F_CELLSETVALUE2 002F 00002C66 0000004C F_CELLGETSTATUS 0030 00002CB2 00000059 F_CELLGETSTATUS2 0031 00002D0B 00000058 F_CELLSELECT 0032 00002D63 00000094 F_CELLSETSTATUS 0033 00002DF7 00000096 F_CELLSETSTATUS2 0034 00002E8D 000000F5 F_CELLTOASCII 0035 00002F82 00000010 F_CELLVALID 0036 00002F92 0000035F F_CONSTDATA 0037 000032F1 00000180 F_ACTIVEDATA 0038 00003471 00000066 F_FIELDDATA 0039 000034D7 000000AA F_TEMPLATEDATA 003A 00003581 00000020 F_TRACKDATA 003B 000035A1 0000003C F_DELETE 003C 000035DD 000000F0 F_DELETEFIELDS 003D 000036CD 0000009C F_DELETEROWS 003E 00003769 000000D1 F_DELETECELLS 003F 0000383A 0000005C F_DISPOSEHANDLES 0040 00003896 0000005E F_DRAWENTRYBAR 0041 000038F4 000002F7 F_DRAWDATA 0042 00003BEB 00000069 F_DRAWGROW 0043 00003C54 00000093 F_DRAWRECORDCOUNT 0044 00003CE7 00000141 F_DRAWRULER 0045 00003E28 0000007E F_DRAWSELECTBOXES 0046 00003EA6 00000071 F_NEWLINEEDIT 0047 00003F17 00000027 F_BEGINEDIT 0048 00003F3E 000000E7 F_LINEEDITKEY 0049 00004025 000000BD F_ENDEDIT 004A 000040E2 00000046 F_CLEARLINEEDIT 004B 00004128 0000001C F_DRAWLETEXT 004C 00004144 00000068 F_EVALFORMULA 004D 000041AC 00000126 F_EVALGETFIELD 004E 000042D2 0000015D F_EVALCELL 004F 0000442F 0000005A F_EVALFIELD 0050 00004489 00000227 F_EVALCALCORDER 0051 000046B0 00000099 F_EVALUPDATE 0052 00004749 00000046 F_FIELDACTIVATE 0053 0000478F 00000426 F_FIELDALLOCATE 0054 00004BB5 0000005E F_FIELDDEACTIVATE 0055 00004C13 00000063 F_FIELDDESELECT 0056 00004C76 00000343 F_FIELDDISPOSE 0057 00004FB9 0000012F F_FIELDEDIT 0058 000050E8 000000BD F_FIELDINVAL 0059 000051A5 00000057 F_FIELDMARK 005A 000051FC 0000031A F_FIELDMOUSE 005B 00005516 00000063 F_FIELDSELECT 005C 00005579 00000086 F_FINDFIELDNAME 005D 000055FF 0000005E F_GETLIMITRECT 005E 0000565D 00000263 F_NEWFIELD 005F 000058C0 000000F4 F_SENDTOFRONT 0060 000059B4 00000238 F_MOVEFIELDS 0061 00005BEC 000001AC F_CONFINEFIELDS 0062 00005D98 000002CC F_OPENDOC 0063 00006064 0000030F F_SAVEDOC 0064 00006373 0000005F F_OPENTEMPLATE 0065 000063D2 00000036 F_SAVETEMPLATE 0066 00006408 000000E7 F_FIND 0067 000064EF 00000097 F_FINDNEXT 0068 00006586 0000034F F_REPLACE 0069 000068D5 0000010B F_FINDNEXTCELL 006A 000069E0 00000005 F_EDITCOLORS 006B 000069E5 00000025 F_GRID 006C 00006A0A 0000001F F_GRIDSIZE 006D 00006A29 0000017F F_EDITFORMULA 006E 00006BA8 000000AB F_EDITFORMAT 006F 00006C53 00000072 F_INSERTRECORD 0070 00006CC5 00000127 F_MATCHRECORDS 0071 00006DEC 000000DC F_SELECTALL 0072 00006EC8 00000096 F_TOGGLEMARKED 0073 00006F5E 00000074 F_UNMARKFIELDS 0074 00006FD2 000000B1 F_MARKFIELDS 0075 00007083 000000E9 F_CHOOSEFONT 0076 0000716C 000000A4 F_SHOWDEFINITION 0077 00007210 000000A4 F_SHOWLIST 0078 000072B4 0000007E F_SHOWFORM 0079 00007332 000000B9 F_HIDERECORDS 007A 000073EB 00000008 F_HIDEUNSELECTED 007B 000073F3 00000008 F_HIDESELECTED 007C 000073FB 000000D9 F_SHOWALL 007D 000074D4 00000089 F_UNDO 007E 0000755D 00000084 F_DISPLAYPREF 007F 000075E1 00000017 F_RETURNPREF 0080 000075F8 0000007E F_EDITDEF 0081 00007676 000000D4 F_ALIGNPTTOGRID 0082 0000774A 00000007 F_GETPTR 0083 00007751 0000000B F_GETLISTFIRST 0084 0000775C 0000000B F_GETTOPFIELD 0085 00007767 00000008 F_GETSYSTEMSTATE 0086 0000776F 0000000B F_GETACTIVEWINDOW 0087 0000777A 000000C8 F_CREATEFIELDSLIST 0088 00007842 00000059 F_SETMAXPIXS 0089 0000789B 0000002E F_CALCRECS 008A 000078C9 0000001A F_CLIPTOVIEW 008B 000078E3 00000033 F_CLIPTOVIEW2 008C 00007916 0000001A F_CLIPTOWINDOW 008D 00007930 00000055 F_SETVIEWRECT 008E 00007985 000000EA F_REDRAWBOXES 008F 00007A6F 0000020B F_FINDPOINT 0090 00007C7A 00000052 F_COMPLETE 0091 00007CCC 0000029B F_SETMENUITEMS 0092 00007F67 0000007A F_WHICHCOLUMN 0093 00007FE1 00000082 F_UPDATEVIEW 0094 00008063 00000037 F_RECORDSPERPAGE 0095 0000809A 0000001E F_SETSYSFONT 0096 000080B8 0000004B F_GETSELFIELD 0097 00008103 000001E4 F_DESELECTALL 0098 000082E7 00000072 F_SETDISPLAYMARKED 0099 00008359 00000011 F_SETCHANGEDBIT 009A 0000836A 0000000F F_TEMPLATECHANGED 009B 00008379 000000A9 F_ASCIITOTYPE 009C 00008422 0000015B F_QUOTEPREVIOUS 009D 0000857D 00000073 F_APPLENUMBER 009E 000085F0 00000001 F_DEBUG 009F 000085F1 00000011 F_MODESELECT 00A0 00008602 00000138 F_DEFMOUSE 00A1 0000873A 000000E6 F_FORMMOUSE 00A2 00008820 00000150 F_LISTMOUSE 00A3 00008970 00000228 F_MOUSEDOWN 00A4 00008B98 00000019 F_MOUSEINFO 00A5 00008BB1 00000019 F_MOUSEUP 00A6 00008BCA 000001BB F_ROWSELECT 00A7 00008D85 000001CE F_COLUMNSELECT 00A8 00008F53 00000492 F_AREASELECT 00A9 000093E5 000004EF F_DRAWDEFPAGE 00AA 000098D4 00000491 F_DRAWDATAPAGE 00AB 00009D65 00000444 F_DRAWLISTPAGE 00AC 0000A1A9 00000070 F_PRINTCHANGED 00AD 0000A219 000002E2 F_PRINTDOC 00AE 0000A4FB 0000003E F_RECORDACTIVATE 00AF 0000A539 00000082 F_RECORDADDFIELD 00B0 0000A5BB 0000015B F_RECORDALLOCATE 00B1 0000A716 00000065 F_RECORDDEACTIVATE 00B2 0000A77B 00000065 F_RECORDDEALLOCATE 00B3 0000A7E0 000000ED F_RECORDDELETEFIELD 00B4 0000A8CD 00000064 F_RECORDDESELECT 00B5 0000A931 000000C9 F_RECORDDISPOSE 00B6 0000A9FA 0000004E F_RECORDSELECT 00B7 0000AA48 00000093 F_ROWEVALUATE 00B8 0000AADB 00000135 F_ALLOCATEROWS 00B9 0000AC10 0000000D F_NEWACTIVE 00BA 0000AC1D 0000008A F_REBUILDACTIVE 00BB 0000ACA7 00000025 F_SUMMARYONLY 00BC 0000ACCC 000000CB F_CREATEREPORT 00BD 0000AD97 00000054 F_HEADER 00BE 0000ADEB 00000054 F_FOOTER 00BF 0000AE3F 00000027 F_REPORTFORMAT 00C0 0000AE66 0000005C F_FORALLFIELDS 00C1 0000AEC2 00000046 F_FORALLCOLUMNS 00C2 0000AF08 0000000F F_CLRLOOKEDATBITS 00C3 0000AF17 0000000F F_CLRPENDINGBITS 00C4 0000AF26 0000000F F_CLRDELETEBITS 00C5 0000AF35 0000000F F_CLRUPDATEBITS 00C6 0000AF44 0000002E R_ACTIVATEMARKED 00C7 0000AF72 0000002E R_DEACTIVATEMARKED 00C8 0000AFA0 00000063 R_INVALMARKEDFIELDS 00C9 0000B003 0000002E R_INVALUPDATEFIELDS 00CA 0000B031 00000029 R_INVALPENDINGFIELDS 00CB 0000B05A 0000001C R_CLRUPDATEBIT 00CC 0000B076 0000001C R_CLRPENDINGBIT 00CD 0000B092 0000001C R_CLRDELETEBIT 00CE 0000B0AE 0000001C R_CLRLOOKEDATBIT 00CF 0000B0CA 00000026 R_SETSELECTEDPENDING 00D0 0000B0F0 00000029 R_SETSELECTEDPENDING2 00D1 0000B119 00000029 R_CLRSELECTEDPENDING2 00D2 0000B142 00000031 R_UNMARKSELECTED 00D3 0000B173 0000002E R_MARKSELECTED 00D4 0000B1A1 00000024 R_DISPOSEDELETE 00D5 0000B1C5 00000024 R_DISPOSEPENDING 00D6 0000B1E9 00000054 R_INVALUPDATECOLUMNS 00D7 0000B23D 0000005E F_CLEAR 00D8 0000B29B 00000098 F_COPY 00D9 0000B333 0000005C F_CUT 00DA 0000B38F 000002EC F_PASTE 00DB 0000B67B 0000009B F_PASTEROWS 00DC 0000B716 000000BD F_PASTECOLS 00DD 0000B7D3 000001E9 F_PASTEAREA 00DE 0000B9BC 000001AE F_COLUMNSPASTE 00DF 0000BB6A 00000179 F_ROWSPASTE 00E0 0000BCE3 00000032 F_MAKESCRAP 00E1 0000BD15 0000008A F_GETFIELDSSCRAP 00E2 0000BD9F 00000098 F_AREACOPY 00E3 0000BE37 000002F9 F_AREAPASTE 00E4 0000C130 000001DF F_PASTECELL 00E5 0000C30F 00000048 F_SETHSCROLL 00E6 0000C357 00000048 F_SETVSCROLL 00E7 0000C39F 000000C0 F_GETHSCROLLINFO 00E8 0000C45F 000000EE F_GETVSCROLLINFO 00E9 0000C54D 000000B6 F_HACTION 00EA 0000C603 000000D7 F_VACTION 00EB 0000C6DA 00000177 F_THUMB 00EC 0000C851 000002E7 F_VSCROLL 00ED 0000CB38 00000218 F_HSCROLL 00EE 0000CD50 000000CE F_SORT 00EF 0000CE1E 00000158 F_MERGESORT 00F0 0000CF76 00000187 F_SORTCOMPARE 00F1 0000D0FD 0000025A F_DRAGRECT 00F2 0000D357 000001AF F_TRACKCOLUMN 00F3 0000D506 0000014F F_TRACKCOLUMNPOS 00F4 0000D655 000003C2 F_TRACKLINE 00F5 0000DA17 00000018 F_TSETLIMIT 00F6 0000DA2F 00000060 F_TGETNEWPT 00F7 0000DA8F 000000B7 F_TSCROLL 00F8 0000DB46 00000155 F_TRACKRECT 00F9 0000DC9B 00000232 F_MOVECOLUMN 00FA 0000DECD 0000003F F_UNDOSETTEXT 00FB 0000DF0C 0000021F F_UNDODATA 00FC 0000E12B 00000055 F_CLEARRPENDINGS 00FD 0000E180 00000064 F_CLEARRBITS 00FE 0000E1E4 00000001 F_NOACTION 00FF 0000E1E5 0000001D F_UNDOADDFIELD 0100 0000E202 0000001D F_REDOADDFIELD 0101 0000E21F 00000015 F_COMPADDFIELD 0102 0000E234 00000072 F_UNDORESIZEFIELD 0103 0000E2A6 000000A4 F_UNDOMOVEFIELDS 0104 0000E34A 00000105 F_UNDOMARKFIELDS 0105 0000E44F 00000017 F_UNDOUNMARKFIELDS 0106 0000E466 00000028 F_COMPDELFIELDS 0107 0000E48E 000000A5 F_UNDODELFIELDS 0108 0000E533 0000007D F_COMPDELRECORDS 0109 0000E5B0 000000A3 F_UNDODELRECORDS 010A 0000E653 0000006C F_COMPDELCELLS 010B 0000E6BF 000000DC F_UNDODELCELLS 010C 0000E79B 00000041 F_UNDORESIZECOLUMN 010D 0000E7DC 0000001C F_UNDOMOVECOLUMN 010E 0000E7F8 000000A2 F_COMPCHANGECELL 010F 0000E89A 000000E1 F_UNDOCHANGECELL 0110 0000E97B 00000026 F_COMPPASTEHANDLE 0111 0000E9A1 000000C0 F_UNDOPASTEHANDLE 0112 0000EA61 00000015 F_COMPPASTECELLS 0113 0000EA76 00000119 F_UNDOPASTECELLS 0114 0000EB8F 0000001B F_COMPPASTECOLUMNS 0115 0000EBAA 00000017 F_UNDOPASTECOLUMNS 0116 0000EBC1 00000017 F_COMPPASTEROWS 0117 0000EBD8 00000017 F_UNDOPASTEROWS 0118 0000EBEF 00000084 F_CALCCOLUMNS 0119 0000EC73 0000002C F_PERFORMUPDATE 011A 0000EC9F 000000BD F_RESTOREWINDOWDATA 011B 0000ED5C 000000F4 F_SETWINDOWDATA 011C 0000EE50 0000014B F_UPDATE 011D 0000EF9B 00000056 F_UPDATECELL 011E 0000EFF1 0000005D F_UPDATEDEF 011F 0000F04E 0000002A F_UPDATEDOC 0120 0000F078 00000023 F_UPDATEFIELD 0121 0000F09B 0000012C F_UPDATEFORM 0122 0000F1C7 00000053 F_UPDATERECT 0123 0000F21A 00000188 F_UPDATELIST 0124 0000F3A2 00000054 F_UPDATEROW 0125 0000F3F6 00000021 F_FORCEUPDATE 0126 0000F417 0000005F F_CELLGETLRECT 0127 0000F476 000000E9 F_CELLGETRECT 0128 0000F55F 0000008B F_CELLRANGEGETRECT 0129 0000F5EA 0000008A F_COLUMNGETRECT 012A 0000F674 0000004C F_COLUMNLEFTRIGHT 012B 0000F6C0 0000006B F_FIELDGETRECT 012C 0000F72B 00000048 F_RANGEGETRECT 012D 0000F773 000000C9 F_ROWGETRECT 012E 0000F83C 00000059 F_ROWTOPBOTTOM 012F 0000F895 0000005E F_COLUMNTOFIELD 0130 0000F8F3 0000006A F_FIELDTOCOLUMN 0131 0000F95D 00000009 F_FIELD2COLUMN 0132 0000F966 0000000A F_COLUMN2FIELD 0133 0000F970 00000048 F_ROW2RECORD 0134 0000F9B8 00000056 F_RECORD2ROW 0135 0000FA0E 0000002C F_HL2G 0136 0000FA3A 0000002C F_HG2L 0137 0000FA66 00000028 F_VL2G 0138 0000FA8E 00000028 F_VG2L 0139 0000FAB6 0000000D F_PTG2L 013A 0000FAC3 0000000D F_PTL2G 013B 0000FAD0 00000043 F_RECTG2L 013C 0000FB13 00000043 F_RECTL2G 013D 0000FB56 00000012 F_PAGE2PIXS 013E 0000FB68 0000001A F_PIXS2PAGE 013F 0000FB82 00000073 F_PIXSTOROW 0140 0000FBF5 00000009 F_PIXS2ROW 0141 0000FBFE 00000012 F_ROW2PAGE 0142 0000FC10 00000013 F_ROW2PIXS 0143 0000FC23 00000053 F_ROWTOPIXS -------------------------------------------------------------------------------- 002B Load Segment "DB2" relocatable LENGTH=$865C KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000053 F_ALERT 0002 00000053 00000698 F_ALERTDATA 0003 000006EB 00000244 F_FIELDDIALOG 0004 0000092F 0000001C F_DISABLECTL 0005 0000094B 00000419 F_EVALDIALOG 0006 00000D64 00000017 F_DRAWBLISTSTR 0007 00000D7B 00000099 F_DRAWLISTNAME 0008 00000E14 0000002A F_DRAWLIST1NAME 0009 00000E3E 0000002A F_DRAWLIST2NAME 000A 00000E68 0000002A F_EFIELDDRAWNAME 000B 00000E92 00000027 F_EOPDRAWNAME 000C 00000EB9 00000027 F_EFUNCDRAWNAME 000D 00000EE0 000000DB F_FINDDIALOG 000E 00000FBB 000000F7 F_REPLACEDIALOG 000F 000010B2 00000296 F_DIALOGFILTER 0010 00001348 000002EE F_GRIDDIALOG 0011 00001636 000001FC F_DISPLAYDIALOG 0012 00001832 000001E5 F_RETURNDIALOG 0013 00001A17 00000789 F_DIALOGDATA 0014 000021A0 0000038F F_HEADERDIALOG 0015 0000252F 0000064C F_REPORTFORMATDIALOG 0016 00002B7B 000000E9 F_UBREAKAPROC 0017 00002C64 0000014F F_UBREAKPROC 0018 00002DB3 000000DE F_REPORTNEWFIELD 0019 00002E91 000000A4 F_REPORTLE 001A 00002F35 00000097 F_REPORTSELNAME 001B 00002FCC 0000001E F_REPORTDATA 001C 00002FEA 00000258 F_SORTDIALOG 001D 00003242 00000126 F_SORTDATA 001E 00003368 00000028 F_NEWWORDS 001F 00003390 00000115 F_UDRAWARROWS 0020 000034A5 000000B4 F_UDRAWDIRS 0021 00003559 000000D9 F_DRAWDIR 0022 00003632 0000013E F_RIGHTARROW 0023 00003770 000001A0 F_LEFTARROW 0024 00003910 000000D6 F_CHECKSORT 0025 000039E6 0000060E F_FORMATFIELDDIALOG 0026 00003FF4 000007C2 F_FORMATDIALOGDATA 0027 000047B6 000000C4 F_DCOLORPROC 0028 0000487A 00000145 F_FDCOLORFILTER 0029 000049BF 00000104 F_CENTERSTRINRECT 002A 00004AC3 0000002A F_CONFINERECT 002B 00004AED 00000160 F_CONVERTTEXT 002C 00004C4D 00000148 F_FIELDNEXTNAME 002D 00004D95 00000049 F_SWAPINASCIIONLY 002E 00004DDE 0000002C F_SWAPOUTASCIIONLY 002F 00004E0A 0000000A F_ASCIISWAPDATA 0030 00004E14 00000067 F_GETPOINT 0031 00004E7B 00000043 F_INVALRECT 0032 00004EBE 0000006D F_ISSCROLLABLE 0033 00004F2B 000000A0 F_PTINGRAB 0034 00004FCB 00000099 F_SELECTRECT 0035 00005064 00000057 F_STRTOHANDLE 0036 000050BB 00000043 F_VALIDRECT 0037 000050FE 0000000C F_WATCHUPDATE 0038 0000510A 00000067 F_NEWSTRBLOCK 0039 00005171 0000005F F_NEWSTRVALUE 003A 000051D0 00000094 F_DBSFIELDOFFSETS 003B 00005264 00000171 F_DBSCELLOFFSETS 003C 000053D5 00000180 F_ACTIVEDATA2 003D 00005555 00000030 F_DYNAMICSWAPIN 003E 00005585 00000030 F_DYNAMICSWAPOUT 003F 000055B5 000000A4 F_FIXSCRAP 0040 00005659 00000109 F_DRAWPICTURE 0041 00005762 0000003F CREATEREPORT 0042 000057A1 000000EF SETUPREPORT 0043 00005890 000002AB REPORTBODY 0044 00005B3B 0000012A PROCESSBREAK 0045 00005C65 00000291 REPORTHEADER 0046 00005EF6 0000019D REPORTFOOTER 0047 00006093 00000064 INITBLOCK 0048 000060F7 00000122 ADDTOBLOCK 0049 00006219 00000053 GETBLOCKWP 004A 0000626C 0000000D KILLBLOCK 004B 00006279 0000021C REPORTDATA 004C 00006495 0000000E F_COLUMNGETPTR 004D 000064A3 00000038 GETRANGECOUNT 004E 000064DB 00000024 F_COUNT 004F 000064FF 00000079 GETRANGESUM 0050 00006578 00000099 GETRANGEMIN 0051 00006611 00000099 GETRANGEMAX 0052 000066AA 00000074 GETRANGEAVG 0053 0000671E 00000059 GETRANGESTDV 0054 00006777 0000005E F_SUMRANGE 0055 000067D5 00000073 F_SUMDATE 0056 00006848 0000005F F_SUMTIME 0057 000068A7 00000015 F_LONGIGNORE 0058 000068BC 00000081 F_MAXRANGE 0059 0000693D 00000075 F_MAXDATE 005A 000069B2 00000061 F_MAXTIME 005B 00006A13 000000EE F_STDVRANGE 005C 00006B01 00000022 F_AVG 005D 00006B23 00000043 F_AVGDATE 005E 00006B66 0000002B F_AVGTIME 005F 00006B91 000000D7 F_STDV 0060 00006C68 00000020 ZEROSTUFF 0061 00006C88 00000064 F_TRAVERSE 0062 00006CEC 0000099E F_OPENT 0063 0000768A 00000330 F_SAVET 0064 000079BA 000001A7 F_TDATA 0065 00007B61 00000701 F_MAKESCRAP2 0066 00008262 000003FA F_EDITDEF2 -------------------------------------------------------------------------------- 002C Load Segment "GR" relocatable LENGTH=$EC14 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000072 G_PROCS 0002 00000072 0000004A G_NEWDOC 0003 000000BC 00000117 G_NEWDOCREC 0004 000001D3 0000010D G_MAKESCROLLBARS 0005 000002E0 00000081 G_DISPOSEDOC 0006 00000361 0000005E G_ACTIVATEDOC 0007 000003BF 000000C4 G_DEACTIVATEDOC 0008 00000483 00000146 G_MYMOUSEDOWN 0009 000005C9 0000006C G_MYKEYDOWN 000A 00000635 00000019 G_MYMOUSEINFO 000B 0000064E 00000028 G_GREWDOC 000C 00000676 0000014A G_IDLEPROC 000D 000007C0 00000019 G_MAKEROOM 000E 000007D9 000000B3 G_PRINTCHANGED 000F 0000088C 00000019 G_MYMOUSEUP 0010 000008A5 00000169 G_MODULEMESSAGE 0011 00000A0E 0000005E G_LOADMOD 0012 00000A6C 00000023 G_UNLOADMOD 0013 00000A8F 00000019 G_UNLOCKMEM 0014 00000AA8 00000019 G_RELOCKMEM 0015 00000AC1 0000009B G_MAKEWIN 0016 00000B5C 00000042 G_USENEWWIN 0017 00000B9E 0000009D G_SWAPIN 0018 00000C3B 00000049 G_SWAPOUT 0019 00000C84 00000046 G_ATTRDATA 001A 00000CCA 0000008B G_WINDOWDATA 001B 00000D55 00000123 G_BRINGTOFRONT 001C 00000E78 000000C4 G_SHUFFLEUP 001D 00000F3C 000000BB G_SHUFFLEDOWN 001E 00000FF7 00000103 G_NUDGELEFT 001F 000010FA 000000B7 G_GROUP 0020 000011B1 000000A4 G_UNGROUP 0021 00001255 00000042 G_FLIPHORIZONTAL 0022 00001297 00000042 G_FLIPVERTICAL 0023 000012D9 00000044 G_ROTATELEFT 0024 0000131D 00000044 G_ROTATERIGHT 0025 00001361 000000E8 G_MANGLESELECTION 0026 00001449 00000050 G_BUCKETDATA 0027 00001499 000001AC G_BUCKET 0028 00001645 000002F3 G_MAKEFILLRGN 0029 00001938 00000201 G_SCANLINE 002A 00001B39 00000076 G_ENQUEUE 002B 00001BAF 0000007F G_DEQUEUE 002C 00001C2E 000000A2 G_CONTENTCLICK 002D 00001CD0 0000004A G_GLOBALTODOC 002E 00001D1A 000001FF G_ARROWCLICK 002F 00001F19 0000029B G_DRAG 0030 000021B4 00000361 G_STRETCH 0031 00002515 000003CF G_HANDCLICK 0032 000028E4 000002D0 G_COLLAPSEOBJECT 0033 00002BB4 00000040 G_FLATTEN 0034 00002BF4 000000AA G_FLATTEN2 0035 00002C9E 00000004 G_COLLAPSEDATA 0036 00002CA2 0000051C G_CREATEOBJECT 0037 000031BE 000003FF G_POLYCLICK 0038 000035BD 0000004D G_INCWAIT 0039 0000360A 0000015C G_FIXDRAWPAINTCURSOR 003A 00003766 00000030 G_MYCDATA 003B 00003796 00000323 G_DRAWOBJECT 003C 00003AB9 000000AD G_CUT 003D 00003B66 000001D9 G_COPY 003E 00003D3F 000002C9 G_PASTE 003F 00004008 000000A5 G_CLEAR 0040 000040AD 0000014A G_COLLAPSE 0041 000041F7 00000058 G_EDITIMAGE 0042 0000424F 00000144 G_MAKESHADOW 0043 00004393 0000006A G_DUPLICATE 0044 000043FD 00000004 G_EDITDATA 0045 00004401 00000189 G_ERASE 0046 0000458A 000000AB G_ERASEWORLD 0047 00004635 00000125 G_ERASEOBJECT 0048 0000475A 000000A0 G_ERRMSG 0049 000047FA 000001AA G_FATCLICK 004A 000049A4 0000007E G_NEWVIEW 004B 00004A22 0000006D G_FATSTART 004C 00004A8F 00000055 G_FATMAP 004D 00004AE4 0000009E G_FATZAP 004E 00004B82 0000034D G_FATRECT 004F 00004ECF 00000024 G_FATDATA 0050 00004EF3 000000E8 G_SAVEDOC 0051 00004FDB 0000004A G_WRITELIST 0052 00005025 000000DA G_WRITEOBJECT 0053 000050FF 00000176 G_OPENDOC 0054 00005275 0000007A G_READLIST 0055 000052EF 00000147 G_READOBJECT 0056 00005436 000003AE G_WRITEAPPLEPREFERRED 0057 000057E4 00000102 G_IMPORTDOC 0058 000058E6 000000AC G_GRFILEDATA 0059 00005992 00000182 G_FINDOBJECT 005A 00005B14 00000108 G_COMPUTEVARS 005B 00005C1C 00000219 G_GLOBALS 005C 00005E35 0000015D G_GLOBALAUX 005D 00005F92 0000006F G_GROW 005E 00006001 000001B1 G_NEWSIZE 005F 000061B2 00000051 G_DRAWGROWBOX 0060 00006203 00000171 G_MARQUEECLICK 0061 00006374 00000344 G_LASSOCLICK 0062 000066B8 000001B4 G_GRSELCLICK 0063 0000686C 00000239 G_ACTIVATEGRSEL 0064 00006AA5 0000009D G_DEACTIVATEGRSEL 0065 00006B42 000000B8 G_KILLGRSEL 0066 00006BFA 00000173 G_MOVEGRSEL 0067 00006D6D 0000013E G_MANGLEGRSEL 0068 00006EAB 00000294 G_DUMPGROBJLIST 0069 0000713F 00000115 G_MAKEGROBJLIST 006A 00007254 000000EC G_IDLEGRSEL 006B 00007340 00000065 G_MAKEFRAMERGN 006C 000073A5 0000001E G_KILLFRAMERGN 006D 000073C3 000000AC G_CHANGEIT1 006E 0000746F 0000005C G_UNDOGRSEL 006F 000074CB 0000000B G_GRSELCHANGED 0070 000074D6 00000034 G_MEMHACK 0071 0000750A 00000070 G_GRSELDATA 0072 0000757A 00000002 G_HANDLEDATA 0073 0000757C 0000003B G_SETHANDLESTATE 0074 000075B7 00000065 G_FIXHANDLES 0075 0000761C 00000028 G_FINDHANDLE 0076 00007644 0000009F G_DOOBJECTHANDLES 0077 000076E3 000001D5 G_DOHANDLES 0078 000078B8 0000030D G_MENUDATA 0079 00007BC5 00000019 G_TOGTOOLS 007A 00007BDE 00000019 G_TOGPATTERNS 007B 00007BF7 00000012 G_TOGGRID 007C 00007C09 000001FE G_TOGPALETTE 007D 00007E07 00000130 G_FIXMENUS 007E 00007F37 00000005 G_TOGLOGGING 007F 00007F3C 00000015 G_BEGINPAINT 0080 00007F51 00000020 G_FIXGRID 0081 00007F71 0000001E G_SAVEGRID 0082 00007F8F 0000000C G_TOGDEBUG 0083 00007F9B 0000000D G_WAITFORKEY 0084 00007FA8 00000095 G_WAITDBLCLICK 0085 0000803D 00000042 G_WAITMOUSE 0086 0000807F 00000050 G_WAITMOUSE2 0087 000080CF 00000008 G_OBJECTDATA 0088 000080D7 00000115 G_NEWOBJECT 0089 000081EC 000000A1 G_GETSELECTBOUNDS 008A 0000828D 0000009F G_GETLISTBOUNDS 008B 0000832C 00000030 G_OFFSETLIST 008C 0000835C 00000030 G_OFFSETOBJECT 008D 0000838C 000000E6 G_DOOFFSET 008E 00008472 00000329 G_MAPOBJECT 008F 0000879B 0000004E G_GETFRONTSELECT 0090 000087E9 00000184 G_ADDOBJECT 0091 0000896D 000000D0 G_NEWPIXELMAP 0092 00008A3D 0000034F G_MAKEOBJECTRGN 0093 00008D8C 000003A7 G_FIXBOUNDS 0094 00009133 000001C1 G_SLICEOBJECT 0095 000092F4 00000000 G_OBJECTRGNDATA 0096 000092F4 00000020 G_ORIENTDATA 0097 00009314 00000025 G_MANGLEORIENT 0098 00009339 00000077 G_ORIENTLIST 0099 000093B0 00000077 G_ORIENTOBJECT 009A 00009427 00000080 G_ORIENTPICT 009B 000094A7 00000081 G_ORIENTRGN 009C 00009528 00000072 G_ORIENTPT 009D 0000959A 000003C7 G_MANGLEOBJECT 009E 00009961 00000087 G_DOORIENT 009F 000099E8 000000F6 G_MANGLEVIAPICT 00A0 00009ADE 00000022 G_STOPPAINT 00A1 00009B00 00000282 G_PAINT 00A2 00009D82 000002EA G_DOPAINT 00A3 0000A06C 00000179 G_RECTPAINT 00A4 0000A1E5 0000005B G_BRUSHLINESIZE 00A5 0000A240 0000014E G_MAKEBRUSHRGN 00A6 0000A38E 00000118 G_DRAWBRUSH 00A7 0000A4A6 0000030B G_SPRAY 00A8 0000A7B1 00000116 G_PAINTDATA 00A9 0000A8C7 0000027D G_DRAWTL 00AA 0000AB44 000004F9 G_TLCLICK 00AB 0000B03D 000000F1 G_SETTOOL 00AC 0000B12E 000000AB G_TOGTOOL 00AD 0000B1D9 00000067 G_FINDTOOL 00AE 0000B240 00000040 G_TOGLINE 00AF 0000B280 00000056 G_FINDLINE 00B0 0000B2D6 000000BD G_TOGBRUSH 00B1 0000B393 0000005A G_FINDBRUSH 00B2 0000B3ED 000002A6 G_DRAWPATTERNS 00B3 0000B693 00000094 G_DRAWTHING 00B4 0000B727 00000367 G_PATCLICK 00B5 0000BA8E 00000014 G_SETPAT 00B6 0000BAA2 00000002 G_TOOLDATA 00B7 0000BAA4 00000184 G_LISTTOPICT 00B8 0000BC28 00000B0E G_PICTTOLIST 00B9 0000C736 000000A6 G_ADDPATTERN 00BA 0000C7DC 000000D5 G_SETUPPIXMAP 00BB 0000C8B1 00000057 G_USEDOCLOC 00BC 0000C908 00000057 G_USEPIXLOC 00BD 0000C95F 0000006B G_ZAPTOPIXMAP 00BE 0000C9CA 000000A4 G_CLEARPIXMAP 00BF 0000CA6E 00000020 G_PIXMAPDATA 00C0 0000CA8E 00000267 G_PRINT 00C1 0000CCF5 0000000E G_SCROLLDATA 00C2 0000CD03 0000010D G_SCROLL 00C3 0000CE10 0000003F G_ACTIONPROC 00C4 0000CE4F 00000149 G_SCROLLIT 00C5 0000CF98 00000029 G_DOSELECTALL 00C6 0000CFC1 000000DD G_SELECT 00C7 0000D09E 0000013C G_TEXTCLICK 00C8 0000D1DA 000001B1 G_DEACTIVATETEXT 00C9 0000D38B 000000BC G_TEXTKEY 00CA 0000D447 0000002A G_TEXTIDLE 00CB 0000D471 0000010B G_MYCHOOSEFONT 00CC 0000D57C 00000034 G_GETPATCOLOR 00CD 0000D5B0 00000119 G_MANGLEPLTEXT 00CE 0000D6C9 00000010 G_TEXTDATA 00CF 0000D6D9 00000071 G_BEGINUSERACTION 00D0 0000D74A 00000033 G_CHANGEACTIONNAME 00D1 0000D77D 00000039 G_ENDUSERACTION 00D2 0000D7B6 00000030 G_BADACTION 00D3 0000D7E6 00000025 G_NOUSERACTION 00D4 0000D80B 00000018 G_CANUNDO 00D5 0000D823 0000001B G_CANREDO 00D6 0000D83E 0000002F G_SETCURRENTUNDO 00D7 0000D86D 00000004 G_MEMDONE 00D8 0000D871 00000055 G_UNDO 00D9 0000D8C6 00000068 G_FIXUNDOITEM 00DA 0000D92E 000001EA G_UNDORECORD 00DB 0000DB18 000000DD G_UNDOSTUFF 00DC 0000DBF5 0000013F G_UNDOPROCESS 00DD 0000DD34 00000000 G_DOACTION 00DE 0000DD34 0000009A G_UNDODATA 00DF 0000DDCE 00000053 G_STARTDRAWING 00E0 0000DE21 0000003B G_UPDATEDOC 00E1 0000DE5C 00000023 G_UPDATEFRAME 00E2 0000DE7F 00000030 G_UPDATERECT 00E3 0000DEAF 00000073 G_UPDATERGN 00E4 0000DF22 00000008 G_UPDATEOFF 00E5 0000DF2A 0000002A G_STARTUPDATE 00E6 0000DF54 0000028F G_ENDUPDATE 00E7 0000E1E3 00000071 G_LOGPARTIALUPDATE 00E8 0000E254 00000058 G_LOGFULLUPDATE 00E9 0000E2AC 0000000C G_UPDATEDATA 00EA 0000E2B8 0000010A G_WADD 00EB 0000E3C2 0000009E G_WDELETE 00EC 0000E460 00000098 G_FIXPARENTS 00ED 0000E4F8 00000089 G_WMOVE 00EE 0000E581 0000007A G_WSHUFFLE 00EF 0000E5FB 000000D3 G_WSWITCH 00F0 0000E6CE 0000010F G_WCHANGECOLORS 00F1 0000E7DD 000000B7 G_WCHANGELINESIZE 00F2 0000E894 000000B0 G_WGROUP 00F3 0000E944 00000122 G_GROUPIT 00F4 0000EA66 000000FA G_WUNGROUP 00F5 0000EB60 0000004D G_WSETACTIVEPAINT 00F6 0000EBAD 0000001D G_FLUSHADD 00F7 0000EBCA 0000001D G_FLUSHSWITCH 00F8 0000EBE7 0000001D G_FLUSHGROUP 00F9 0000EC04 00000010 G_DOCCHANGED -------------------------------------------------------------------------------- 002D Load Segment "GR2" relocatable LENGTH=$1C3F KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 0000007B G_OPENBLOCK 0002 0000007B 000000C4 G_WRITEBLOCK 0003 0000013F 00000083 G_CHECKBLOCK 0004 000001C2 00000046 G_CLOSEBLOCK 0005 00000208 0000011E G_MAKELINERGN 0006 00000326 000001C2 G_MAKEARCRGN 0007 000004E8 0000030A G_ANGLETOPT 0008 000007F2 00000088 G_FIXRECT 0009 0000087A 0000008D G_MANGLEPOLY 000A 00000907 000002C2 G_PIXELMAPTORGN320 000B 00000BC9 000002CB G_PIXELMAPTORGN640 000C 00000E94 000000FA G_XORBUF 000D 00000F8E 000000F3 G_ADDBUFTORGN 000E 00001081 00000077 G_CLOSERGN 000F 000010F8 00000614 G_RGNDATA 0010 0000170C 00000533 G_TRACKMOUSE 0011 00001C3F 00000000 G_TRACKDATA -------------------------------------------------------------------------------- 002E Load Segment "PL" relocatable LENGTH=$FF2E KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000072 P_PROCS 0002 00000072 00000001 P_IGNORE 0003 00000073 000000AF P_MAKEWIN 0004 00000122 0000017D P_NEWDOC 0005 0000029F 00000052 P_INITDOC 0006 000002F1 000000F6 P_SHOWDOC 0007 000003E7 0000014B P_ACTIVATEDOC 0008 00000532 000000B3 P_DEACTIVATEDOC 0009 000005E5 000000BC P_DISPOSEDOC 000A 000006A1 00000050 P_KEYDOWN 000B 000006F1 000005CC P_GREWDOC 000C 00000CBD 0000003A P_IDLEPROC 000D 00000CF7 00000135 P_PRINTCHANGED 000E 00000E2C 00000022 P_MESSAGE 000F 00000E4E 000000ED P_LOADMOD 0010 00000F3B 0000006D P_UNLOADMOD 0011 00000FA8 00000015 P_MAKEROOM 0012 00000FBD 00000015 P_UNLOCKMEM 0013 00000FD2 00000015 P_RELOCKMEM 0014 00000FE7 00000465 P_ATTRDATA 0015 0000144C 00000769 P_DATA 0016 00001BB5 00000AFF P_ICONDATA 0017 000026B4 00000023 P_APPLEFUCK 0018 000026D7 00000014 P_ENTRY 0019 000026EB 0000004C P_SAVEWINDOWSTUFF 001A 00002737 00000070 P_LOADWINDOWSTUFF 001B 000027A7 00000008 P_LSHIFT 001C 000027AF 00000008 P_RSHIFT 001D 000027B7 00000006 P_FIX2INT 001E 000027BD 000000E7 P_DOSCRITCH 001F 000028A4 000000FC P_TRACKCURSOR 0020 000029A0 00000045 P_LOCAL2PL 0021 000029E5 00000045 P_PL2LOCAL 0022 00002A2A 00000054 P_FIXPT 0023 00002A7E 000000AC P_FIXRECT 0024 00002B2A 00000001 P_UNMAPPT 0025 00002B2B 00000056 LOCAL2TEXTOBJ 0026 00002B81 00000056 TEXTOBJ2LOCAL 0027 00002BD7 000000CB P_ROUNDGUIDE 0028 00002CA2 0000005B P_MAGVALUE 0029 00002CFD 00000059 P_MAGPT 002A 00002D56 000000DF P_MAGMOVE 002B 00002E35 0000009E P_SETSPECSTR 002C 00002ED3 00000004 P_GETPAGEMODE 002D 00002ED7 00000055 P_CHGVIEW 002E 00002F2C 0000003B P_CHGTEMPLATE 002F 00002F67 000000CD P_CHGTMPLCOUNT 0030 00003034 00000034 P_CHGGUIDEVIS 0031 00003068 00000016 P_CHGGUIDELOCK 0032 0000307E 00000016 P_CHGGUIDEMAG 0033 00003094 0000009E P_CHGRULERVIS 0034 00003132 0000008E P_CHGPALVIS 0035 000031C0 000000F1 P_GOTOPAGE 0036 000032B1 00000124 P_SETPAGENO 0037 000033D5 000000A2 P_THREAD2PAIR 0038 00003477 00000086 P_PAIR2THREAD 0039 000034FD 0000005C P_SETPARAG 003A 00003559 000005A3 P_OPENDOC 003B 00003AFC 000002D6 P_SAVEDOC 003C 00003DD2 00000272 P_PRINTDOC 003D 00004044 000000A4 P_DRAWTOOLS 003E 000040E8 0000012F P_MDINTOOLS 003F 00004217 000000D4 P_NEWTOOL 0040 000042EB 00000280 P_MOUSEDOWN 0041 0000456B 00000015 P_MOUSEUP 0042 00004580 000002D9 P_MOUSECONTENT 0043 00004859 000000CA P_FINDTEXTOBJ 0044 00004923 000000E7 P_INSERTOBJ 0045 00004A0A 00000091 P_REMOVEOBJ 0046 00004A9B 0000001C P_DESELECTALL 0047 00004AB7 00000042 P_SELECTRECT 0048 00004AF9 00000051 P_DELOBJECTS 0049 00004B4A 0000023D P_DRAWOBJECT 004A 00004D87 0000015C P_DRAWOBJLIST 004B 00004EE3 00000122 P_MAKEOBJ 004C 00005005 00000297 P_NEWOBJ 004D 0000529C 00000024 P_OBJDATA 004E 000052C0 000000E5 P_DRAWFIGURE 004F 000053A5 00000198 P_DRAWSPEC 0050 0000553D 0000004A P_ISOBJSEL 0051 00005587 0000014B P_MAKEFIGURE 0052 000056D2 0000005D P_SETPEN 0053 0000572F 0000005D P_ADDTHREADRGN 0054 0000578C 00000091 P_DRAWRGN 0055 0000581D 0000010E P_DRAWHANDLES 0056 0000592B 0000012A P_SETOBJATTR 0057 00005A55 00000050 P_SETDELFLAG 0058 00005AA5 0000008A P_DELMARKOBJ 0059 00005B2F 00000232 P_MOVEOBJECT 005A 00005D61 000002E7 P_STRETCHOBJ 005B 00006048 00000054 P_WAITMOUSE 005C 0000609C 000001C3 P_INSERTPAGES 005D 0000625F 00000095 P_INSPGFILTER 005E 000062F4 00000272 P_DELETEPAGE 005F 00006566 0000004B P_INITPAGE 0060 000065B1 00000063 P_SAVEPAGE 0061 00006614 00000068 P_LOADPAGE 0062 0000667C 000000AE P_CHANGEPAGE 0063 0000672A 00000070 P_DRAWTEMPLATE 0064 0000679A 00000072 P_KILLPAGE 0065 0000680C 000000D6 P_MERGEGUIDES 0066 000068E2 0000006D P_CENTERPAGE 0067 0000694F 0000006A P_FIXTEXTOBJ 0068 000069B9 00000254 P_DRAWRULERS 0069 00006C0D 00000033 P_FORCEUPDATE 006A 00006C40 000001F2 P_UPDATEDOC 006B 00006E32 000000F4 P_PAGEICONS 006C 00006F26 000001B2 P_DRAWAPAGE 006D 000070D8 000001F5 P_DRAWCONTENT 006E 000072CD 00000157 P_FIXSPECMENU 006F 00007424 00000094 P_FIXMENUS 0070 000074B8 000000AB P_SETFORMAT 0071 00007563 0000001A P_GETMJUST 0072 0000757D 0000001D P_GETMSPACING 0073 0000759A 00000008 P_LEFT 0074 000075A2 00000008 P_CENTER 0075 000075AA 00000008 P_RIGHT 0076 000075B2 00000008 P_FULL 0077 000075BA 00000038 P_CHANGEJUST 0078 000075F2 00000008 P_SINGLESPACE 0079 000075FA 00000008 P_DOUBLESPACE 007A 00007602 00000008 P_TRIPLESPACE 007B 0000760A 0000005C P_SETSPACING 007C 00007666 00000038 P_CHANGESPACE 007D 0000769E 0000005A P_DOFONT 007E 000076F8 000000A1 P_CHANGEALL 007F 00007799 000000DC P_DOSTYLE 0080 00007875 0000005E P_DOSIZE 0081 000078D3 0000005F P_DOCOLOR 0082 00007932 00000055 P_CUT 0083 00007987 00000085 P_COPY 0084 00007A0C 0000028C P_PASTE 0085 00007C98 00000010 P_CLEAR 0086 00007CA8 0000004B P_CLEARPRIM 0087 00007CF3 000000D6 P_SELECTALL 0088 00007DC9 0000003B P_DUPLICATE 0089 00007E04 00000098 P_COPYPRIM 008A 00007E9C 000001D7 P_COPYOBJLIST 008B 00008073 0000019A P_ADDOBJLIST 008C 0000820D 00000016 P_GETCENTER 008D 00008223 00000082 P_DRAWIMAGE 008E 000082A5 00000177 P_MAKEPICT 008F 0000841C 0000003F P_KILLIMPORT 0090 0000845B 00000027 P_SETUNDOSTR 0091 00008482 00000009 P_KILLUNDO 0092 0000848B 000000F2 P_KILLBUILD 0093 0000857D 00000138 P_BUILDUNDO 0094 000086B5 00000010 P_BUILDTYPE 0095 000086C5 00000196 P_LISTUNDO 0096 0000885B 00000303 P_UNDO 0097 00008B5E 000000D3 P_UNDODATASEG 0098 00008C31 000000AB P_BRINGFRONT 0099 00008CDC 000000AE P_SENDBACK 009A 00008D8A 00000008 P_FLIPHORIZ 009B 00008D92 00000008 P_FLIPVERT 009C 00008D9A 00000008 P_ROTATELEFT 009D 00008DA2 00000008 P_ROTATERIGHT 009E 00008DAA 000001B2 P_DOROTATE 009F 00008F5C 00000077 P_ROTATERECT 00A0 00008FD3 00000383 P_ACTIONPROC 00A1 00009356 000003E5 P_SCROLLPAGES 00A2 0000973B 00000156 P_NEWGUIDE 00A3 00009891 00000280 P_MOVEGUIDE 00A4 00009B11 00000113 P_DRAWGUIDES 00A5 00009C24 00000169 P_DRAWAGUIDE 00A6 00009D8D 00000569 P_SETGUIDES 00A7 0000A2F6 0000013A P_KILLOLDGUIDES 00A8 0000A430 0000015E P_EXPLODERECT 00A9 0000A58E 000002A0 P_DRAGSTUFF 00AA 0000A82E 00000064 P_ERASETABS 00AB 0000A892 00000068 P_ERASETABWELL 00AC 0000A8FA 00000009 P_HIDETABS 00AD 0000A903 000000BB P_DRAWTABS 00AE 0000A9BE 0000006C P_DRAWTABWELL 00AF 0000AA2A 000003DF P_MOVETABS 00B0 0000AE09 00000247 P_DRAGTAB 00B1 0000B050 00000143 T_NEW 00B2 0000B193 00000111 T_RETHREAD 00B3 0000B2A4 00000114 T_ACTIVATE 00B4 0000B3B8 00000060 T_DEACTIVATE 00B5 0000B418 00000089 T_CLIPTHREAD 00B6 0000B4A1 000000B4 T_REFRESH 00B7 0000B555 00000053 T_IDLE 00B8 0000B5A8 00000074 T_DATA 00B9 0000B61C 00000000 T_TEXTEQU 00BA 0000B61C 00000066 T_COUNTSPACES 00BB 0000B682 00000160 T_USETAB 00BC 0000B7E2 00000171 T_CUTLINE 00BD 0000B953 000002A7 T_CUTPARAG 00BE 0000BBFA 00000079 T_RECUTPARAG 00BF 0000BC73 0000007E T_TRACKFONT 00C0 0000BCF1 00000044 T_GETSTART 00C1 0000BD35 00000155 T_PT2OFFSET 00C2 0000BE8A 000001F9 T_PIX2OFFSET 00C3 0000C083 000001EE T_OFFSET2PIX 00C4 0000C271 00000055 T_OFFSET2LINE 00C5 0000C2C6 0000010A T_BLINKCARET 00C6 0000C3D0 0000000D T_ERASECARET 00C7 0000C3DD 00000004 T_MULLINE 00C8 0000C3E1 0000000A T_MULPARAG 00C9 0000C3EB 00000030 T_GETPARPTR 00CA 0000C41B 00000057 T_GETTEXTPTR 00CB 0000C472 00000030 T_GETRULBITS 00CC 0000C4A2 0000004F T_GETSPACING 00CD 0000C4F1 00000056 T_LOCKRULER 00CE 0000C547 00000010 T_UNLOCKRULER 00CF 0000C557 00000081 T_GETPARSIZE 00D0 0000C5D8 0000008C T_LOCKLINES2 00D1 0000C664 0000000A T_LOCKLINES 00D2 0000C66E 0000004D T_GETLINEPTR2 00D3 0000C6BB 0000000B T_GETLINEPTR 00D4 0000C6C6 00000022 T_EATJUNK 00D5 0000C6E8 00000042 T_PREVCHAR 00D6 0000C72A 00000039 T_NEXTCHAR 00D7 0000C763 0000000F T_JUNKLEFT 00D8 0000C772 0000000C T_JUNKRIGHT 00D9 0000C77E 000000ED T_GETOBJBOUND 00DA 0000C86B 000000ED T_NEWPARHDL 00DB 0000C958 0000005E T_OFFSETPCOUNT 00DC 0000C9B6 00000073 T_OFFSETPARS 00DD 0000CA29 000000BB T_NEWPARS 00DE 0000CAE4 00000188 T_DELETEPARS 00DF 0000CC6C 000000B3 T_COPYPAREND 00E0 0000CD1F 0000012B T_PASTEPAR 00E1 0000CE4A 00000067 T_GETOBJECT 00E2 0000CEB1 00000075 T_TOPLINE 00E3 0000CF26 00000050 T_LINEHEIGHT 00E4 0000CF76 00000151 T_INVERTOBJ 00E5 0000D0C7 00000145 T_INVERTAREA 00E6 0000D20C 00000072 T_INVSELECT 00E7 0000D27E 00000073 T_OFFTHREAD 00E8 0000D2F1 00000077 T_MOVEDDOT 00E9 0000D368 0000007D T_PADTHREAD 00EA 0000D3E5 00000105 T_UPDATE 00EB 0000D4EA 000000B8 T_DRAWPARAG 00EC 0000D5A2 00000198 T_DRAWLINES 00ED 0000D73A 0000029C T_DRAWLINE 00EE 0000D9D6 00000239 T_DRAWOSLINE 00EF 0000DC0F 00000119 T_DRAWONELINE 00F0 0000DD28 0000004D T_SWAPDOTMARK 00F1 0000DD75 00000293 T_CLICK 00F2 0000E008 00000053 T_SELECTWORD 00F3 0000E05B 0000011D T_WORDBOUNDS 00F4 0000E178 0000002D T_INWORD 00F5 0000E1A5 0000004A T_SELECTLINE 00F6 0000E1EF 0000012D T_BUMPPARAGS 00F7 0000E31C 000000E0 T_CMPLINES 00F8 0000E3FC 000000DC T_FIXPARAG 00F9 0000E4D8 000001A8 T_INSERTCR 00FA 0000E680 0000008B T_DELETECR 00FB 0000E70B 000000FA T_DELETECHAR 00FC 0000E805 000000D8 T_INSERTCHARS 00FD 0000E8DD 00000157 T_KEY 00FE 0000EA34 00000079 T_CLEAR 00FF 0000EAAD 0000009B T_MAKEPARSTYLE 0100 0000EB48 00000360 T_PASTE 0101 0000EEA8 0000005A T_COPY 0102 0000EF02 00000086 T_CLEARPRIM 0103 0000EF88 0000029F T_COPYPRIM 0104 0000F227 000000DC T_COPYTEXT 0105 0000F303 000000C4 T_CPYORCLROBJ 0106 0000F3C7 000000D1 T_UPDATEPARS 0107 0000F498 000000C9 T_DOCHANGE 0108 0000F561 00000159 T_INSERTFONT 0109 0000F6BA 0000010C T_CHANGEFONT 010A 0000F7C6 000001ED T_RANGEFONT 010B 0000F9B3 000000EE T_LOWER 010C 0000FAA1 00000011 T_ISSPACE 010D 0000FAB2 0000001E T_USERULER 010E 0000FAD0 0000003C T_UNUSERULER 010F 0000FB0C 00000060 T_NEWRULER 0110 0000FB6C 0000006A T_DRAWRULER 0111 0000FBD6 00000119 T_CHANGERULS 0112 0000FCEF 0000007A T_SETRULERS 0113 0000FD69 00000036 T_CLEARRULERS 0114 0000FD9F 0000018F T_DOCONTROL -------------------------------------------------------------------------------- 002F Load Segment "PL2" relocatable LENGTH=$2B51 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000688 P_DO_RULER 0002 00000688 00000020 P_RULERDATA 0003 000006A8 00000104 P_ERRORALERT 0004 000007AC 00000036 P_CHECKHAND 0005 000007E2 00000052 P_TRAVERSE 0006 00000834 0000009E P_FINDGUIDE 0007 000008D2 00000123 P_MERGE 0008 000009F5 000000A6 P_INSERTDATA 0009 00000A9B 000000B1 P_DELETEDATA 000A 00000B4C 0000010F FIX2ASC 000B 00000C5B 00000072 P_ADDGUIDE 000C 00000CCD 00000091 P_EXPLODEGUIDE 000D 00000D5E 000000DF P_DRAWATAB 000E 00000E3D 00000088 P_TABICONS 000F 00000EC5 0000016B P_DOSPACINGDLOG 0010 00001030 000000E4 ASC2FIX 0011 00001114 00000029 P_GETMODIFIERS 0012 0000113D 00000060 P_SETCURSOR 0013 0000119D 000003E2 P_CURSORS 0014 0000157F 000001AB P_LISTOP 0015 0000172A 00000206 P_FINDOBJECT 0016 00001930 00000070 P_LINEADJUST 0017 000019A0 000002B0 P_DOHANDLES 0018 00001C50 000000E4 P_DOTHREAD 0019 00001D34 000000D6 P_BOUNDSRECT 001A 00001E0A 00000198 P_CONSTRAIN 001B 00001FA2 000000AE P_ADDOBJRGN 001C 00002050 00000036 P_SMALLRECT 001D 00002086 00000029 P_MASKRECT 001E 000020AF 000000F7 P_FIXSPECRECT 001F 000021A6 00000051 P_VALIDRECT 0020 000021F7 0000003F P_GETPICTSIZE 0021 00002236 000001BD P_PTINLINE 0022 000023F3 000000FE P_PTINOVAL 0023 000024F1 000000F4 T_CLEARBOTTOM 0024 000025E5 0000017C T_WP2PLTEXT 0025 00002761 00000127 T_PL2WPTEXT 0026 00002888 0000005D T_CLEARMARKS 0027 000028E5 00000000 T_WPRULDATA 0028 000028E5 00000010 T_DOROOM 0029 000028F5 000000C6 T_MAKEROOM 002A 000029BB 000000B7 T_LESSROOM 002B 00002A72 00000058 T_CALCFBYTES 002C 00002ACA 00000087 T_WRITEFBYTES -------------------------------------------------------------------------------- 0030 Load Segment "SS" relocatable LENGTH=$ECE2 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000072 S_PROCS 0002 00000072 000004CD S_ATTRDATA 0003 0000053F 000000A8 S_CURRENTDATA 0004 000005E7 00000010 S_CONSTANTDATA 0005 000005F7 00000170 S_WINDOWDATA 0006 00000767 00000435 S_ERRORDATA 0007 00000B9C 000000DE S_ACTIVATEDOC 0008 00000C7A 00000087 S_DEACTIVATEDOC 0009 00000D01 00000079 S_DISPOSEDOC 000A 00000D7A 000001E9 S_GROWDOC 000B 00000F63 000000EE S_IDLEPROC 000C 00001051 00000080 S_LOADMOD 000D 000010D1 00000015 S_MAKEROOM 000E 000010E6 000000F8 S_MAKEWIN 000F 000011DE 00000096 S_MESSAGE 0010 00001274 00000087 S_NEWDOC 0011 000012FB 00000015 S_PRINTCHANGED 0012 00001310 00000300 S_PRINTDOC 0013 00001610 00000019 S_RELOCKMEM 0014 00001629 00000037 S_UNLOADMOD 0015 00001660 00000019 S_UNLOCKMEM 0016 00001679 00000014 S_FILEIODATA 0017 0000168D 00000298 S_OPENDOC 0018 00001925 000002C1 S_SAVEDOC 0019 00001BE6 000000E0 S_READINMORE 001A 00001CC6 00000065 S_WRITEOUTMORE 001B 00001D2B 00000080 S_LOADCOLWDS 001C 00001DAB 00000083 S_SAVECOLWDS 001D 00001E2E 0000005C S_LOADRECALCULATELIST 001E 00001E8A 00000089 S_SAVERECALCULATELIST 001F 00001F13 00000225 S_LOADCELLSINTOSHEET 0020 00002138 0000008F S_SAVECELLSFROMSHEET 0021 000021C7 000001A4 S_GETFILECELL 0022 0000236B 00000126 S_SAVECELLASCII 0023 00002491 000000F0 S_CLEAR 0024 00002581 00000049 S_CLEARCELL 0025 000025CA 000000EC S_COPY 0026 000026B6 00000020 S_SCRAPDATA 0027 000026D6 0000007F S_CUT 0028 00002755 00000254 S_PASTE 0029 000029A9 00000041 S_IMAGE 002A 000029EA 0000000C S_IMAGEDATA 002B 000029F6 0000007D S_SETIMAGE 002C 00002A73 0000019C S_GETSCRAPCELL 002D 00002C0F 00000103 S_SCRAPVALUE2STRING 002E 00002D12 000000A1 S_GETSSSCRAP 002F 00002DB3 000000C5 S_ADDBUFFERTOSCRAP 0030 00002E78 000003DF S_PUTSSSCRAP 0031 00003257 00000085 S_CHECKFORMULA 0032 000032DC 00000401 S_PASTEVALUES 0033 000036DD 0000007D S_SELECTALL 0034 0000375A 000001FA S_FILL 0035 00003954 000000CA S_UNDODATA 0036 00003A1E 0000007E S_SETUNDOON 0037 00003A9C 00000055 S_SETUNDOOFF 0038 00003AF1 000000C4 S_DELETEUNDO 0039 00003BB5 00000513 S_UNDO 003A 000040C8 000000AD S_BUILDCOLWDUNDO 003B 00004175 00000056 S_BUILDSIMPLEUNDO 003C 000041CB 00000163 S_BUILDMOVEUNDO 003D 0000432E 00000177 S_BUILDTRASHUNDO 003E 000044A5 00000131 S_UNDOTRASHCELLS 003F 000045D6 00000061 S_STARTSORTUNDO 0040 00004637 000000B8 S_BUILDSORTUNDO 0041 000046EF 0000002A S_FIXLE 0042 00004719 00000004 S_PROTECTDATA 0043 0000471D 00000069 S_CHKCELLPROTECT 0044 00004786 00000024 S_MOVEDATA 0045 000047AA 00000192 S_INSERT 0046 0000493C 000000E9 S_DELETE 0047 00004A25 000000F9 S_MOVE 0048 00004B1E 000000A7 S_TRANSPOSE 0049 00004BC5 0000013B S_DOMOVE 004A 00004D00 00000049 S_DRAWMOVE 004B 00004D49 00000138 S_DOTRANSPOSE 004C 00004E81 000003B3 S_MOVECELL 004D 00005234 0000023D S_SPLITDEPENDLIST 004E 00005471 00000208 S_MERGEDEPENDLISTS 004F 00005679 00000279 S_TRAVERSEDEPENDFORMULAS 0050 000058F2 00000118 S_FIXDEPENDLIST 0051 00005A0A 000000C6 S_FIXFORMULA 0052 00005AD0 000001CF S_FIXFORMULA2 0053 00005C9F 00000037 S_CHKCONTENT 0054 00005CD6 00000135 S_TRASHCELL 0055 00005E0B 000000BF S_TRASHFORMULA 0056 00005ECA 0000014D S_TRASHFORMULA2 0057 00006017 00000097 S_TRANSPOSECELL 0058 000060AE 00000138 S_FIXFORMULA3 0059 000061E6 000005F7 S_SWAPCELL 005A 000067DD 00000050 S_CLEARCHANGEDBITS 005B 0000682D 00000029 S_CLEARCHANGEDBITS2 005C 00006856 00000002 S_SORTDATA 005D 00006858 00000121 S_SORT 005E 00006979 0000015E S_DOROWSORT 005F 00006AD7 0000015E S_DOCOLSORT 0060 00006C35 0000012E S_SORTCOMPARE 0061 00006D63 0000013D S_SWAPCOLUMNS 0062 00006EA0 000001EB S_SWAPROWS 0063 0000708B 00000187 S_PASTEFORMAT 0064 00007212 0000008A S_ALIGNLEFT 0065 0000729C 00000090 S_ALIGNRIGHT 0066 0000732C 00000090 S_ALIGNCENTER 0067 000073BC 000000AF S_FIXALIGN 0068 0000746B 00000016 S_FORMATDATA 0069 00007481 00000098 S_FORMATBOLD 006A 00007519 00000041 S_TOGGLEFORMAT 006B 0000755A 00000098 S_FORMATDOLLAR 006C 000075F2 000000AF S_SETDECIMAL 006D 000076A1 00000099 S_DOFORMATCHANGE 006E 0000773A 0000011C S_DOFORMAT 006F 00007856 00000339 S_DOCHECKS 0070 00007B8F 0000005C S_CHECKTRAVERSE 0071 00007BEB 0000005D S_CHANGECALCMODE 0072 00007C48 00000019 S_RECALC 0073 00007C61 0000004C S_CHANGEVIEW 0074 00007CAD 0000007A S_CHANGEDEFWIDTH 0075 00007D27 00000045 S_RESTORECOLWIDTH 0076 00007D6C 00000103 S_SETTITLES 0077 00007E6F 0000004C S_CHANGEGRID 0078 00007EBB 00000068 S_ADJUSTTITLEOFFSET 0079 00007F23 0000001F S_ADJUSTSHEETCOLUMNS 007A 00007F42 00000081 S_REFRESHSCREEN 007B 00007FC3 000000BC S_ACTIVATESCRLBARS 007C 0000807F 0000013C S_GOTO 007D 000081BB 00000015 S_NEWCHART 007E 000081D0 00000015 S_MODIFYCHART 007F 000081E5 0000002B S_REFRESHUPDATERGN 0080 00008210 00000182 S_HSCRLACTION 0081 00008392 00000204 S_SCRLUPDATE 0082 00008596 00000110 S_THUMB 0083 000086A6 00000105 S_UPDATEDOC 0084 000087AB 00000114 S_VSCRLACTION 0085 000088BF 0000014A S_DRAWBORDERS 0086 00008A09 0000037E S_DRAWCELL 0087 00008D87 00000138 S_DRAWCOLLABELS 0088 00008EBF 0000009F S_DRAWGRID 0089 00008F5E 000000E4 S_DRAWROWLABELS 008A 00009042 000000A1 S_HILITECELLS 008B 000090E3 0000004C S_FINDLEFTCONTENT 008C 0000912F 0000004A S_FINDRIGHTCONTENT 008D 00009179 00000093 S_DRAWLOCATION 008E 0000920C 000000AC S_DRAWBOTHTITLES 008F 000092B8 00000076 S_DRAWCOLTITLES 0090 0000932E 00000075 S_DRAWROWTITLES 0091 000093A3 000001A2 S_DRAWREGION 0092 00009545 000001D4 S_PRINTPAGE 0093 00009719 0000025E S_REDRAWCELLRANGE 0094 00009977 00000015 S_MOUSEINFO 0095 0000998C 00000015 S_MOUSEUP 0096 000099A1 000002BC S_MOUSEDOWN 0097 00009C5D 00000114 S_COLLABELCLICK 0098 00009D71 0000034F S_SELECTCELLS 0099 0000A0C0 00000008 S_SELECTDATA 009A 0000A0C8 00000015 S_SELECTSCROLL 009B 0000A0DD 0000009D S_SELECTSTART 009C 0000A17A 000000DC S_SELECTMIDDLE 009D 0000A256 00000021 S_SELECTFINISH 009E 0000A277 00000064 S_GISCROLL 009F 0000A2DB 0000007C S_GISTART 00A0 0000A357 0000009C S_GIMIDDLE 00A1 0000A3F3 0000010B S_GIFINISH 00A2 0000A4FE 000000E4 S_TRACKVERTLINE 00A3 0000A5E2 000000DA S_POINTSHOOTMOVE 00A4 0000A6BC 000002EC S_KEYDOWN 00A5 0000A9A8 000000C1 S_PAGEOVER 00A6 0000AA69 000000AA S_DOPAGELEFT 00A7 0000AB13 00000108 S_DOPAGERIGHT 00A8 0000AC1B 000000A5 S_DOPAGEUP 00A9 0000ACC0 000000F9 S_DOPAGEDOWN 00AA 0000ADB9 0000004E S_CELLWIDTH 00AB 0000AE07 00000062 S_CHANGECOLWIDTH 00AC 0000AE69 00000042 S_CHANGEDEF 00AD 0000AEAB 00000023 S_COLLAB2TEXT 00AE 0000AECE 0000002C S_COPYIN 00AF 0000AEFA 0000002C S_COPYOUT 00B0 0000AF26 0000004F S_FINDRECT 00B1 0000AF75 00000054 S_FIXPADCELLS 00B2 0000AFC9 000000A5 S_INITSTATE 00B3 0000B06E 000000E7 S_INSERTCONTROLS 00B4 0000B155 00000040 S_ISCELLCIRCULAR 00B5 0000B195 00000167 S_LOADAWORKSINFO 00B6 0000B2FC 00000066 S_NEWSHEET 00B7 0000B362 00000179 S_QRTRAVERSETABLE 00B8 0000B4DB 00000177 S_QTRAVERSETABLE 00B9 0000B652 00000185 S_QTRAVERSE 00BA 0000B7D7 000000DF S_RESETCIRCULARITY 00BB 0000B8B6 00000037 S_RESTOREWIDTH 00BC 0000B8ED 00000110 S_SETBRMOSTCELL 00BD 0000B9FD 0000007E S_SETCELLWIDTH 00BE 0000BA7B 00000050 S_SETCURFORMAT 00BF 0000BACB 0000002D S_SETEDITTINGMENUS 00C0 0000BAF8 00000064 S_SETMAXTLCELL 00C1 0000BB5C 00000087 S_SETVERTLINES 00C2 0000BBE3 000000AF S_SWAPIN 00C3 0000BC92 00000042 S_SWAPOUT 00C4 0000BCD4 0000006D S_TRAVERSERANGE 00C5 0000BD41 00000092 S_WHERECELL 00C6 0000BDD3 0000005D S_WHICHCELL 00C7 0000BE30 0000007C S_SETCELLTABLEENTRY 00C8 0000BEAC 00000039 S_GETCELLTABLEENTRY 00C9 0000BEE5 0000002E S_GETCELLINDEX 00CA 0000BF13 00000039 S_GETCELLPTR 00CB 0000BF4C 00000049 S_GETKEYINDEX 00CC 0000BF95 000001A1 S_SETKEYINDEX 00CD 0000C136 00000037 S_GETROWSTRUCTINDEX 00CE 0000C16D 0000006C S_SETROWSTRUCTINDEX 00CF 0000C1D9 00000120 S_NEWCELL 00D0 0000C2F9 00000023 S_UPDATEPRIORITIES 00D1 0000C31C 00000002 S_PRIORITYDATA 00D2 0000C31E 00000116 S_UPDATECELLPRIORITY 00D3 0000C434 00000041 S_GETCELLPRIORITY 00D4 0000C475 000000D7 S_REMOVEPADCELLS 00D5 0000C54C 00000199 S_INSERTRIGHTPADCELLS 00D6 0000C6E5 00000199 S_INSERTLEFTPADCELLS 00D7 0000C87E 000001CA S_REMOVECELL 00D8 0000CA48 00000127 S_REMOVEDEPENDENCY 00D9 0000CB6F 00000143 S_INSERTDEPENDENCY 00DA 0000CCB2 00000004 S_DEPENDDATA 00DB 0000CCB6 000001AC S_ENTERRANGEDEP 00DC 0000CE62 0000024A S_REMOVERANGEDEP 00DD 0000D0AC 00000135 S_NEWLINEEDIT 00DE 0000D1E1 00000037 S_SETCARET 00DF 0000D218 00000231 S_ENDEDIT 00E0 0000D449 00000054 S_DRAWLETEXT 00E1 0000D49D 00000135 S_PARSETEXT 00E2 0000D5D2 00000151 S_NEWEDITCELL 00E3 0000D723 00000130 S_ACCEPTCELL 00E4 0000D853 000000F3 S_REARRANGEPADCELLS 00E5 0000D946 00000124 S_ADDCELLTOCHANGEDLIST 00E6 0000DA6A 00000094 S_REMOVECELLFROMCHANGEDLIST 00E7 0000DAFE 00000100 S_RECALCLIST 00E8 0000DBFE 0000000E S_ZERORECALCLIST 00E9 0000DC0C 0000010F S_ADDCELLTORECALCLIST 00EA 0000DD1B 00000259 S_ADDCELLTODEPLIST 00EB 0000DF74 0000025C S_REMOVECELLFROMDEPLIST 00EC 0000E1D0 00000215 S_CALCULATESHEET 00ED 0000E3E5 000000AB S_ADDDEPLISTTORECALC 00EE 0000E490 00000062 S_CALCULATECELL 00EF 0000E4F2 0000000E S_CHECKSTACK 00F0 0000E500 0000016F S_TRAVERSEDEPENDONMETREE 00F1 0000E66F 00000066 S_CHECKCELLCIRCULARITY 00F2 0000E6D5 00000088 S_SETCELLCIRCULAR 00F3 0000E75D 0000003C S_CLEARCELLVISITED 00F4 0000E799 00000084 S_SETCIRCULARBITS 00F5 0000E81D 0000005F S_CLEARCELLCIRCULAR 00F6 0000E87C 00000023 S_RESETCIRCULARBITS 00F7 0000E89F 000000F6 S_CHECKFORCIRC 00F8 0000E995 0000001A S_FORMULADATA 00F9 0000E9AF 00000202 S_EVALFORMULA 00FA 0000EBB1 00000099 S_GETMINMAX 00FB 0000EC4A 0000006D S_SETDEFAULTS 00FC 0000ECB7 0000002B S_LISTFORMULAS -------------------------------------------------------------------------------- 0031 Load Segment "SS2" relocatable LENGTH=$5B08 KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000034 S_ADJUSTCELL 0002 00000034 00000011 S_ADJUSTPOINT 0003 00000045 00000084 S_CELL2STR 0004 000000C9 0000006C S_DISPOSEROWBLOCK 0005 00000135 00000158 S_GETDESTCELLRANGES 0006 0000028D 0000006E S_GETREALCELL 0007 000002FB 0000006C S_GETREFCELL 0008 00000367 00000041 S_INRANGE 0009 000003A8 0000001D S_NORMALIZERANGE 000A 000003C5 00000072 S_SECTRANGE 000B 00000437 000000D7 S_TEXT2CELL 000C 0000050E 00000090 S_TRAVERSEDEST 000D 0000059E 0000005D S_DLOGRECT 000E 000005FB 00000113 S_GETDIRDLOG 000F 0000070E 000000DB S_GETCELLDLOG 0010 000007E9 0000010E S_DOSORTDLOG 0011 000008F7 00000227 S_TITLEDIALOG 0012 00000B1E 0000005D S_CELLNUMBERFROMLETTERS 0013 00000B7B 00000065 S_CELLNUMBERFROMNUMBERS 0014 00000BE0 00000075 S_ROWNUMBERFROMNUMBER 0015 00000C55 0000005F S_COLLETTERFROMNUMBER 0016 00000CB4 00000107 S_TITLEFILTER 0017 00000DBB 00000972 S_DLOGDATA 0018 0000172D 00000082 S_DODEFAULTWIDTHDLOG 0019 000017AF 00000134 S_THINGDEF 001A 000018E3 000000B4 S_WIDTHFILTER 001B 00001997 00000137 S_LISTFORMULASDLOG 001C 00001ACE 000000C1 S_LFFILTER 001D 00001B8F 00000040 S_DRAWLFMEMBER 001E 00001BCF 0000007D S_SELECTLFMEMBER 001F 00001C4C 000003FD S_DODEFAULTDLOG 0020 00002049 000001BE S_DONEWCHART 0021 00002207 000004E1 S_DOCHARTDLOG 0022 000026E8 000002B3 S_CHARTFILTER 0023 0000299B 00000151 S_DOMODIFYCHART 0024 00002AEC 0000009E S_CHARTLISTPROC 0025 00002B8A 00000015 S_CHARTDUMMY 0026 00002B9F 000001AF S_CALCCHART 0027 00002D4E 000000B0 S_KILLCHART 0028 00002DFE 00000083 S_BREAKLINK 0029 00002E81 00000082 S_DOLINKBREAKAGE 002A 00002F03 00000054 S_KILLLINKS 002B 00002F57 000000DA S_SAVECHARTS 002C 00003031 000000F4 S_LOADCHARTS 002D 00003125 000002D1 S_MAKEPIE 002E 000033F6 000000C4 S_PIESUM 002F 000034BA 00000141 S_PIEDIV 0030 000035FB 00000198 S_PIELEGEND 0031 00003793 00000139 S_SLICEPIE 0032 000038CC 0000027A ANGLETOPT 0033 00003B46 00000006 FIX2INT 0034 00003B4C 00000040 S_PIEDATA 0035 00003B8C 000002FF S_MAKEBAR 0036 00003E8B 000000A2 S_CHARTAXES 0037 00003F2D 00000226 S_PLOTAXES 0038 00004153 000001EA S_DOPLOT 0039 0000433D 000000A1 S_PLOTBAR 003A 000043DE 000002A2 S_PLOT3DBAR 003B 00004680 000001C1 S_DOSCALING 003C 00004841 0000005C S_PLOTLINE 003D 0000489D 0000006B S_PLOTPT 003E 00004908 0000002A S_BARDATA 003F 00004932 0000101C S_CHARTDATA 0040 0000594E 00000152 S_SANEDATA2 0041 00005AA0 00000068 S_CURRENTDATA2 -------------------------------------------------------------------------------- 0032 Load Segment "WP" relocatable LENGTH=$EB2C KIND=$8000 (Dynamic) -------------------------------------------------------------------------------- 0001 00000000 00000072 W_PROCS 0002 00000072 000003F7 W_ATTRDATA 0003 00000469 000000D6 W_MAKEWIN 0004 0000053F 0000008E W_NEWDOC 0005 000005CD 0000011A W_DISPOSEDOC 0006 000006E7 00000060 W_MYCLEAR 0007 00000747 0000014C W_ACTIVATEDOC 0008 00000893 00000054 W_DEACTIVATEDOC 0009 000008E7 000000A6 W_UPDATEDOC 000A 0000098D 00000047 W_MYKEYDOWN 000B 000009D4 00000015 W_MYMOUSEINFO 000C 000009E9 00000034 W_GREWDOC 000D 00000A1D 000000BC W_MYIDLEPROC 000E 00000AD9 00000054 W_MYMAKEROOM 000F 00000B2D 00000015 W_WPMOUSEUP 0010 00000B42 0000008E W_WPMESSAGE 0011 00000BD0 0000002C W_LOADMOD 0012 00000BFC 00000046 W_UNLOADMOD 0013 00000C42 00000019 W_UNLOCKMEM 0014 00000C5B 00000019 W_RELOCKMEM 0015 00000C74 00000074 W_SAMPLEDATA 0016 00000CE8 000002B0 WPGLOBALS 0017 00000F98 00000066 W_INITSCREEN 0018 00000FFE 00000078 W_READPRINTREC 0019 00001076 00000014 W_SCREENCHANGED 001A 0000108A 00000005 W_SCREENCHANGEDNS 001B 0000108F 00000127 W_MAKESCROLLBAR 001C 000011B6 00000082 W_CALCSCROLLVALS 001D 00001238 000000A6 W_CARETON 001E 000012DE 00000038 W_CALCDOCRECT 001F 00001316 00000040 W_SETRULRECT 0020 00001356 0000002D W_SETDOCRECT 0021 00001383 000000DD W_DRAWGROW 0022 00001460 000000EC W_DRAWPGBOX 0023 0000154C 00000030 W_SETFULLRECT 0024 0000157C 00000039 W_CALCGROWRECT 0025 000015B5 0000007C W_SCROLLCLICK 0026 00001631 00000152 W_SCROLLBARPROC 0027 00001783 00000065 W_GOTNEWCTLVALS 0028 000017E8 00000124 W_MAKENEWTOP 0029 0000190C 0000001D W_GETTOPSPACE 002A 00001929 00000046 W_GETPAGESIZE 002B 0000196F 00000011 W_GETSPACETOFOOTER 002C 00001980 00000034 W_HONPAGE 002D 000019B4 00000034 W_FONPAGE 002E 000019E8 00000083 W_CHECKDOCPOS 002F 00001A6B 0000006B W_MAKEPAGESTR 0030 00001AD6 000000BB W_INITNEW 0031 00001B91 0000002A W_PUTDOC 0032 00001BBB 0000005C W_GETDOC 0033 00001C17 00000020 W_GETRGN 0034 00001C37 00000099 W_SWITCHDATA 0035 00001CD0 00000036 W_PUTDATA 0036 00001D06 0000007C W_CALCPIXELS 0037 00001D82 0000002A W_FILLDATETIME 0038 00001DAC 0000013B W_INITPARS 0039 00001EE7 0000003D W_GETADDR 003A 00001F24 00000028 W_GETPARREC 003B 00001F4C 00000047 W_MAKEEMPTYBLOCK 003C 00001F93 0000000D W_DOROOM 003D 00001FA0 000005FC W_MAKEROOM 003E 0000259C 000000D2 W_LESSROOM 003F 0000266E 00000053 W_NEWRULER 0040 000026C1 00000016 W_READRULER 0041 000026D7 0000001C W_READRULERP 0042 000026F3 0000002C W_USERULER 0043 0000271F 00000038 W_UNUSERULER 0044 00002757 000000B0 W_FINDLINE 0045 00002807 000000B0 W_MAKECR 0046 000028B7 000000DE W_MAKENEWPARREC 0047 00002995 0000004A W_PARLOCK 0048 000029DF 0000004A W_PARUNLOCK 0049 00002A29 0000000A W_GETLASTLINE 004A 00002A33 00000044 W_GETLASTLGUTS 004B 00002A77 00000070 W_GETENDPAR 004C 00002AE7 0000022A W_DELPARS 004D 00002D11 00000022 W_CHECKWIDOW 004E 00002D33 00000270 W_MAKELINES 004F 00002FA3 0000005B W_VALIDLINES 0050 00002FFE 000002FF W_CUTLINE 0051 000032FD 00000058 W_GETLRECPTR 0052 00003355 00000011 W_GETLINEREC 0053 00003366 000001B0 W_USETAB 0054 00003516 00000049 W_CALCLINEHEIGHT 0055 0000355F 000000F4 W_FINDFONT 0056 00003653 0000009D W_READFONT 0057 000036F0 0000007D W_UPDATELINES 0058 0000376D 000000C0 W_CUTLINE2 0059 0000382D 0000006E W_GETLINEADDR 005A 0000389B 00000067 W_GETENDLINE 005B 00003902 0000004C W_NEXTLINE 005C 0000394E 00000013 W_UPDATETEXT 005D 00003961 0000036F W_UPDATETEXTP 005E 00003CD0 0000030A W_DRAWLINE 005F 00003FDA 0000027D W_DRAWPARTLINE 0060 00004257 00000110 W_DRAWHEADER 0061 00004367 000000D1 W_CHANGERULER 0062 00004438 0000009C W_GOTOPG 0063 000044D4 0000003B W_GOTOBEG 0064 0000450F 00000083 W_GOTOEND 0065 00004592 00000074 W_GOTAPNUM 0066 00004606 00000075 W_WPSELECTALL 0067 0000467B 00000075 W_WPSELECTPAR 0068 000046F0 00000057 W_COPYRULER 0069 00004747 00000130 W_PASTERULER 006A 00004877 0000009D W_DOSETPG 006B 00004914 00000048 W_DONORMAL 006C 0000495C 0000004E W_DOHEAD 006D 000049AA 0000004B W_DOFOOT 006E 000049F5 00000082 W_CHANGEVIEW 006F 00004A77 00000036 W_UNCHECKVIEW 0070 00004AAD 000000BF W_INSERTPAGEBRK 0071 00004B6C 00000025 W_DOPAGENUM 0072 00004B91 00000025 W_DODATE 0073 00004BB6 00000025 W_DOTIME 0074 00004BDB 0000013A W_EDITDATA 0075 00004D15 00000E34 W_INSERTKEYS 0076 00005B49 000000AA W_ISJUNK 0077 00005BF3 00000137 W_MAKEFONTCHANGE 0078 00005D2A 00000198 W_OSUPDATETEXT 0079 00005EC2 00000093 W_MYCLEARRECT 007A 00005F55 000000A6 W_PUTNEWHEIGHT 007B 00005FFB 00000009 W_OPTIONCONVERT 007C 00006004 00000071 W_CHECKCOL 007D 00006075 00000143 W_MYMOUSEDOWN 007E 000061B8 000001F2 W_MOUSEINCONTENT 007F 000063AA 000003E5 W_INVTEXT 0080 0000678F 00000066 W_SELECTON 0081 000067F5 00000011 W_SELECTOFF 0082 00006806 00000050 W_KILLSELECT 0083 00006856 00000011 W_MAKESELECT 0084 00006867 0000002D W_INVSELECT 0085 00006894 000001A1 W_DOUBLECLICK 0086 00006A35 00000181 W_TRIPLECLICK 0087 00006BB6 00000072 W_PTTOTEXT 0088 00006C28 0000005C W_STARTFIRST 0089 00006C84 00000176 W_MINRULER 008A 00006DFA 00000146 W_CALCPAGES 008B 00006F40 00000039 W_NEWNUMPGS 008C 00006F79 0000018F W_SETTOPPAGE 008D 00007108 000002B7 W_PUTONSCREEN 008E 000073BF 0000005F W_SETBOUNDS 008F 0000741E 00000009 W_MAKECARETNS 0090 00007427 0000006F W_MAKECARETGUTS 0091 00007496 00000087 W_MAKECARET 0092 0000751D 000002CF W_LINETOPIXEL 0093 000077EC 00000046 W_LINETOTOPPIXEL 0094 00007832 000002AD W_PIXELTOLINE 0095 00007ADF 0000000B W_GETLEFT 0096 00007AEA 000002A0 W_GETHPOS 0097 00007D8A 000002F8 W_PIXELTOOFFSET 0098 00008082 0000031C W_TEXTCHANGE 0099 0000839E 00000028 W_CALCNEWLINES 009A 000083C6 000001EF W_CALCFONTS 009B 000085B5 000000A6 W_CHANGEALL 009C 0000865B 00000059 W_DOFONTS 009D 000086B4 0000005D W_GOTSIZE 009E 00008711 000000C2 W_GOTSTYLE 009F 000087D3 00000059 W_WPDOCOLORS 00A0 0000882C 00000127 W_DOCHANGE 00A1 00008953 00000013 W_KILLCHANGES 00A2 00008966 00000072 W_GETFIRSTCHAR 00A3 000089D8 00000077 W_GETNEXTCHAR 00A4 00008A4F 0000009A W_BACKCHAR 00A5 00008AE9 0000009F W_FORCHAR 00A6 00008B88 00000151 W_WPRIGHTARROW 00A7 00008CD9 0000018B W_WPLEFTARROW 00A8 00008E64 00000102 W_DOUPARROW 00A9 00008F66 000000CA W_DODOWNARROW 00AA 00009030 0000008A W_GOUPLINE 00AB 000090BA 0000009E W_GODOWNLINE 00AC 00009158 00000036 W_GETNEWOFFSET 00AD 0000918E 00000058 W_CALCFBYTES 00AE 000091E6 00000090 W_WRITEFBYTES 00AF 00009276 0000012E W_WRITEFBYTES2 00B0 000093A4 0000008C W_JUNKLEFT 00B1 00009430 00000021 W_JUNKRIGHT 00B2 00009451 000001D4 W_DELETERANGE 00B3 00009625 000000C8 W_DELSELECT 00B4 000096ED 000000B9 W_DELETERANGED 00B5 000097A6 00000064 W_PRINTCHANGED 00B6 0000980A 000003CE W_PRINTDOC 00B7 00009BD8 00000305 W_OPENDOC 00B8 00009EDD 000001D0 W_SAVEDOC 00B9 0000A0AD 00000230 W_MYPASTE 00BA 0000A2DD 00000021 W_GETCOPY 00BB 0000A2FE 000000A9 W_MYCUT 00BC 0000A3A7 0000006B W_MYCOPY 00BD 0000A412 00000741 W_PASTETEXT 00BE 0000AB53 00000072 W_SPLITBLOCK 00BF 0000ABC5 00000026 W_UNDOON 00C0 0000ABEB 00000050 W_UNDOONND 00C1 0000AC3B 0000006F W_UNDOOFF 00C2 0000ACAA 000004C0 W_MYUNDO 00C3 0000B16A 00000020 W_TOOLDATA 00C4 0000B18A 000000DE W_KILLKEY 00C5 0000B268 00000084 W_NEXTCHARBACK 00C6 0000B2EC 00000011 W_ISSPACE 00C7 0000B2FD 0000017E W_WORDBOUNDS 00C8 0000B47B 000001A9 W_LOWERCASE 00C9 0000B624 000000D5 W_SELSENTENCE 00CA 0000B6F9 00000092 W_SELECTTEXT 00CB 0000B78B 0000008C W_STRTOWPSCRAP 00CC 0000B817 00000169 W_PASTESTR 00CD 0000B980 00000092 W_UPDATEAFTER 00CE 0000BA12 00000026 W_RECUTDOC 00CF 0000BA38 00000098 W_FINDFONT2 00D0 0000BAD0 00000074 W_INVALSCROLL 00D1 0000BB44 00000022 W_FINDNEXT 00D2 0000BB66 000001A8 W_FINDREPLACE 00D3 0000BD0E 000002CC W_FINDREPFILTER 00D4 0000BFDA 00000033 W_DISPCHARSIN 00D5 0000C00D 00000033 W_DISPCHARSOUT 00D6 0000C040 0000007E W_FRDATA 00D7 0000C0BE 000000D9 W_FINDIT 00D8 0000C197 00000040 W_GETTARGET 00D9 0000C1D7 00000186 W_JUSTFIND 00DA 0000C35D 00000047 W_SAMECHAR 00DB 0000C3A4 000000A2 W_REPLACEIT 00DC 0000C446 00000087 W_REPLACEFIND 00DD 0000C4CD 000001E9 W_REPLACEALL 00DE 0000C6B6 00000018 W_STARTOVER 00DF 0000C6CE 000001A8 W_STATISTICS 00E0 0000C876 000003D8 W_WPCOPY 00E1 0000CC4E 00000054 W_PASTEASCII 00E2 0000CCA2 00000089 W_DELETETEXT 00E3 0000CD2B 000003C5 W_PRINTMERGE 00E4 0000D0F0 00000128 W_PUTFIELDDATA 00E5 0000D218 0000005F W_GETFIELDSCRAP 00E6 0000D277 0000014B W_PMERGEDATA 00E7 0000D3C2 00000038 W_STRIPDBNAME 00E8 0000D3FA 00000257 W_PICKMERGEDB 00E9 0000D651 000000CA W_VERIFYMERGEDB 00EA 0000D71B 00000068 W_GETMFSTRING 00EB 0000D783 0000023C W_ADDMERGEFIELD 00EC 0000D9BF 00000068 W_CREATEREPORT 00ED 0000DA27 00000073 W_PASTEHEADER 00EE 0000DA9A 00000073 W_PASTEFOOTER 00EF 0000DB0D 000001C6 W_COLLAPSERULERS 00F0 0000DCD3 00000080 W_COMPARERULERS 00F1 0000DD53 000000C9 W_SHRINKTEXTBLOCKS 00F2 0000DE1C 00000061 W_UNLOCKARRAYS 00F3 0000DE7D 00000068 W_LOCKARRAYS 00F4 0000DEE5 00000096 W_CHECKSPELLING 00F5 0000DF7B 0000012D W_STARTSPELL 00F6 0000E0A8 000001E0 W_SPHANDLEERR 00F7 0000E288 00000044 W_ADDRTOLINEOFF 00F8 0000E2CC 0000015B W_THESAURUS 00F9 0000E427 00000058 W_EDITUSERDICT 00FA 0000E47F 000001B5 W_FINDDICT 00FB 0000E634 0000006C W_SPAUXFILT 00FC 0000E6A0 00000062 W_MAKEWORD 00FD 0000E702 00000038 W_LOADSPELL 00FE 0000E73A 00000038 W_LOADTHES 00FF 0000E772 0000003A W_KILLSPTH 0100 0000E7AC 000000C9 W_ADDSTR1 0101 0000E875 000002B7 W_SPELLDATA Output Load File "Source:AWGS:AppleWorks.GS" contains 50 Load Segments with a total length of $B7788 bytes. \ No newline at end of file diff --git a/appleworksgs/Macros/M16.UTILITY b/appleworksgs/Macros/M16.UTILITY new file mode 100755 index 0000000..d97bc2f --- /dev/null +++ b/appleworksgs/Macros/M16.UTILITY @@ -0,0 +1 @@ +************************************************************************* * * * Apple //GS Utility Macros * * by * * Lou Infeld * * * * Copyright Apple Computer, Inc. 1986-1988 * * All Rights Reserved * ************************************************************************* ;............................................................... ; IncLong - our name for incl - SP - 4/27/89 ;............................................................... MACRO &lab IncLong &address &lab incl &address MEND ;............................................................... ; ; Inc Long word ;............................................................... MACRO &lab incl &address &lab inc &address bne ~t&sysindex inc &address+2 ~t&sysindex MEND ;............................................................... ; DecLong - our name for decl - SP - 4/27/89 ;............................................................... MACRO &lab DecLong &address &lab decl &address MEND ;............................................................... ; ; Dec Long word ;............................................................... MACRO &lab decl &address &lab lda &address bne ~t&sysindex dec &address+2 ~t&sysindex dec &address MEND ;............................................................... ; ; Define string ; ; Generates a Pascal type of string ;............................................................... MACRO str &string lcla ¶ms lcla &length lclc &sset lclc &temp ¶ms seta &nbr(&syslist) &length seta 0 WHILE (¶ms) DO &temp setc &syslist[¶ms] IF (&substr(&temp,1,1) = '''') THEN IF (&substr(&temp,&len(&temp),1) = '''') THEN &length seta &length+&len(&temp)-2 ELSE AERROR "STR macro: Mismatched string delimiters" ENDIF ELSE &length seta &length+1 ENDIF &temp setc &substr(&temp,2,&len(&temp)) WHILE (&pos('''''',&temp) > 0) DO &length seta &length-1 &temp setc &substr(&temp,&pos('''''',&temp)+2,&len(&temp)) ENDWHILE ¶ms seta ¶ms-1 ENDWHILE DC.B &length &sset SETC &SETTING('STRING') STRING ASIS ¶ms seta &nbr(&syslist) &length seta 1 WHILE (&length ¶ms) DO DC.B &syslist[&length] &length seta &length+1 ENDWHILE STRING &sset MEND MACRO hexdata &op lcla &length lcla &index lcla &count lclc &thestr &thestr setc '' &length seta &len(&op) &index seta 1 &count seta 0 WHILE (&length) DO &thestr setc &concat(&thestr,',$',&substr(&op,&index,2)) IF (&count = 20) THEN &count seta 0 DC.B &substr(&thestr,2,&len(&thestr)-1) &thestr setc '' ENDIF &count seta &count+1 &index seta &index+2 &length seta &length-2 IF (&length<0) THEN aerror 'hexdata: operand has an odd number of nibbles' MEXIT ENDIF ENDWHILE IF (&count 1) THEN DC.B &substr(&thestr,2,&len(&thestr)-1) ENDIF MEND ;............................................................... ; ; Turn on native mode ; ; The processor is put into 'native' mode. 8 bit or 16 bit ; mode can be specified by using 'short' or 'long' as the ; parameter. If no parameter is specified, 'long' is assumed ;............................................................... MACRO native &mode clc xce IF &mode'' THEN &mode ELSE long ENDIF MEND ;............................................................... ; ; Turn on emulation mode ; ; The processor is put into 'emulation' mode. ;............................................................... MACRO emulation sec xce longa off longi off MEND ;............................................................... ; ; Set Memory & registers to 16 bits ;............................................................... MACRO long rep #%00110000 longa on longi on MEND ;............................................................... ; ; Set Memory & A register to 16 bits ;............................................................... MACRO longm rep #%00100000 longa on MEND ;............................................................... ; ; Set X & Y registers to 16 bits ;............................................................... MACRO longx rep #%00010000 longi on MEND ;............................................................... ; ; Set Memory & registers to 8 bits ;............................................................... MACRO short sep #%00110000 longa off longi off MEND ;............................................................... ; ; Set Memory & A register to 8 bits ;............................................................... MACRO shortm sep #%00100000 longa off MEND ;............................................................... ; ; Set X & Y registers to 8 bits ;............................................................... MACRO shortx sep #%00010000 longi off MEND \ No newline at end of file diff --git a/appleworksgs/Macros/Macros.dump b/appleworksgs/Macros/Macros.dump new file mode 100755 index 0000000..ba4b45b Binary files /dev/null and b/appleworksgs/Macros/Macros.dump differ diff --git a/appleworksgs/Macros/Macros.make b/appleworksgs/Macros/Macros.make new file mode 100755 index 0000000..1877b09 --- /dev/null +++ b/appleworksgs/Macros/Macros.make @@ -0,0 +1 @@ +# # Macros.make - Makefile for Macros # # Copyright 1989, Claris Corporation. # # This makefile rebuilds the symbol table dump file # whenever any of the macro files it includes have changed. #-------------------------------------------------------------------------------- # Variables Module = Macros ModuleDir = {AWGS}{Module}: Makefile = {ModuleDir}{Module}.make MacroFiles = {ModuleDir}m16.bob {ModuleDir}m16.branch {ModuleDir}m16.cmp {ModuleDir}m16.eval {ModuleDir}m16.math {ModuleDir}m16.move {ModuleDir}m16.msl {ModuleDir}m16.stack {ModuleDir}m16.tools {ModuleDir}m16.utility {ModuleDir}e16.tools #-------------------------------------------------------------------------------- # Main target {ModuleDir}Macros.dump {MacroFiles} {MakeFile} @echo "# Creating {ModuleDir}DumpMacros.aii " @echo > {ModuleDir}DumpMacros.aii @for i in {MacroFiles}; @echo "tincludet'{i}'" >> {ModuleDir}DumpMacros.aii; @end @echo >> {ModuleDir}DumpMacros.aii @echo "tDUMPt'{ModuleDir}Macros.dump'" >> {ModuleDir}DumpMacros.aii @echo "tEND" >> {ModuleDir}DumpMacros.aii AsmIIGS {ModuleDir}DumpMacros.aii -c # don't even bother with object. Delete {ModuleDir}DumpMacros.aii # don't need source files clean @confirm "Delete {ModuleDir}Macros.dump" @if {status} == 0 then delete {ModuleDir}Macros.dump @end \ No newline at end of file diff --git a/appleworksgs/Macros/e16.tools b/appleworksgs/Macros/e16.tools new file mode 100755 index 0000000..8da7d66 --- /dev/null +++ b/appleworksgs/Macros/e16.tools @@ -0,0 +1 @@ +; File: AIIGSRecords.aii ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; Str255 RECORD 0 ; Types length DS.B 1 ; Byte - text DS.B 255 ; char[255] - ENDR Str32 RECORD 0 ; Types length DS.B 1 ; Byte - text DS.B 32 ; char[32] - ENDR Point RECORD 0 ; Types v DS.B 2 ; Integer - h DS.B 2 ; Integer - ENDR Rect RECORD 0 ; Types v1 DS.B 2 ; Integer - h1 DS.B 2 ; Integer - v2 DS.B 2 ; Integer - h2 DS.B 2 ; Integer - ENDR TimeRec RECORD 0 ; Types second DS.B 1 ; Byte - minute DS.B 1 ; Byte - hour DS.B 1 ; Byte - year DS.B 1 ; Byte - day DS.B 1 ; Byte - month DS.B 1 ; Byte - extra DS.B 1 ; Byte - weekDay DS.B 1 ; Byte - ENDR Cursor RECORD 0 ; Quickdraw cursorHeight DS.B 2 ; Word - size in bytes cursorWidth DS.B 2 ; Word - enclosing rectangle cursorData DS.B 2 ; Word[1] - cursorMask DS.B 2 ; Word[1] - cursorHotSpot DS Point ; Point - ENDR Region RECORD 0 ; Quickdraw rgnSize DS.B 2 ; word - size in bytes rgnBBox DS Rect ; Rect - enclosing rectangle ENDR BufDimRec RECORD 0 ; Quickdraw maxWidth DS.B 2 ; Word - textBufHeight DS.B 2 ; Word - textBufferWords DS.B 2 ; Word - fontWidth DS.B 2 ; Word - ENDR Font RECORD 0 ; Quickdraw offseToMF DS.B 2 ; Word - fully defined front of the Font record. family DS.B 2 ; Word - style DS.B 2 ; TextStyle - size DS.B 2 ; Word - version DS.B 2 ; Word - fbrExtent DS.B 2 ; Word - ENDR FontGlobalsRecord RECORD 0 ; Quickdraw fgFontID DS.B 2 ; Word - currently 12 bytes long, but may be expanded fgStyle DS.B 2 ; TextStyle - fgSize DS.B 2 ; Word - fgVersion DS.B 2 ; Word - fgWidMax DS.B 2 ; Word - fgFBRExtent DS.B 2 ; Word - ENDR FontID RECORD 0 ; Quickdraw famNum DS.B 2 ; Word - fontStyle DS.B 1 ; Byte - fontSize DS.B 1 ; Byte - ENDR FontInfoRecord RECORD 0 ; Quickdraw ascent DS.B 2 ; integer - descent DS.B 2 ; integer - widMax DS.B 2 ; integer - leading DS.B 2 ; integer - ENDR LocInfo RECORD 0 ; Quickdraw portSCB DS.B 2 ; Word - SCBByte in low byte ptrToPixImage DS.B 4 ; Pointer - ImageRef width DS.B 2 ; Word - Width boundsRect DS Rect ; Rect - BoundsRect ENDR QDProcs RECORD 0 ; Quickdraw stdText DS.B 4 ; VoidProcPtr - stdLine DS.B 4 ; VoidProcPtr - stdRect DS.B 4 ; VoidProcPtr - stdRRect DS.B 4 ; VoidProcPtr - stdOval DS.B 4 ; VoidProcPtr - stdArc DS.B 4 ; VoidProcPtr - stdPoly DS.B 4 ; VoidProcPtr - stdRgn DS.B 4 ; VoidProcPtr - stdPixels DS.B 4 ; VoidProcPtr - stdComment DS.B 4 ; VoidProcPtr - stdTxMeas DS.B 4 ; VoidProcPtr - stdTxBnds DS.B 4 ; VoidProcPtr - stdGetPic DS.B 4 ; VoidProcPtr - stdPutPic DS.B 4 ; VoidProcPtr - ENDR GrafPort RECORD 0 ; Quickdraw portInfo DS LocInfo ; LocInfo - portRect DS Rect ; Rect - PortRect clipRgn DS.B 4 ; RgnHandle - Clip Rgn. Pointer visRgn DS.B 4 ; RgnHandle - Vis. Rgn. Pointer bkPat DS.B 32 ; Pattern - BackGround Pattern pnLoc DS Point ; Point - Pen Location pnSize DS Point ; Point - Pen Size pnMode DS.B 2 ; Word - Pen Mode pnPat DS.B 32 ; Pattern - Pen Pattern pnMask DS.B 8 ; Mask - Pen Mask pnVis DS.B 2 ; Word - Pen Visable fontHandle DS.B 4 ; FontHndl - fontID DS FontID ; FontID - Font ID fontFlags DS.B 2 ; Word - FontFlags txSize DS.B 2 ; Integer - Text Size txFace DS.B 2 ; TextStyle - Text Face txMode DS.B 2 ; Word - Text Mode spExtra DS.B 4 ; Fixed - Fixed Point Value chExtra DS.B 4 ; Fixed - Fixed Point Value fgColor DS.B 2 ; Word - ForeGround Color bgColor DS.B 2 ; Word - BackGround Color picSave DS.B 4 ; Handle - PicSave rgnSave DS.B 4 ; Handle - RgnSave polySave DS.B 4 ; Handle - PolySave grafProcs DS.B 4 ; QDProcsPtr - arcRot DS.B 2 ; Integer - ArcRot userField DS.B 4 ; Longint - UserField sysField DS.B 4 ; Longint - SysField ENDR PaintParam RECORD 0 ; Quickdraw ptrToSourceLocInfo DS.B 4 ; LocInfoPtr - ptrToDestLocInfo DS.B 4 ; LocInfoPtr - ptrToSourceRect DS.B 4 ; RectPtr - ptrToDestPoint DS.B 4 ; PointPtr - mode DS.B 2 ; Word - maskHandle DS.B 4 ; Handle - clip region ENDR PenState RECORD 0 ; Quickdraw psPnSize DS Point ; Point - psPnMode DS.B 2 ; Word - psPnPat DS.B 32 ; Pattern - psPnMask DS.B 8 ; Mask - ENDR RomFontRec RECORD 0 ; Quickdraw rfFamNum DS.B 2 ; Word - rfFamStyle DS.B 2 ; Word - rfSize DS.B 2 ; Word - rfFontHandle DS.B 4 ; FontHndl - rfNamePtr DS.B 4 ; Pointer - rfFBRExtent DS.B 2 ; Word - ENDR ColorTable RECORD 0 ; Quickdraw entries DS.B 32 ; Word[16] - ENDR ClampRec RECORD 0 ; MiscTool yMaxClamp DS.B 2 ; Word - yMinClamp DS.B 2 ; Word - xMaxClamp DS.B 2 ; Word - xMinClamp DS.B 2 ; Word - ENDR FWRec RECORD 0 ; MiscTool yRegExit DS.B 2 ; Word - xRegExit DS.B 2 ; Word - aRegExit DS.B 2 ; Word - status DS.B 2 ; Word - ENDR MouseRec RECORD 0 ; MiscTool mouseMode DS.B 1 ; Byte - mouseStatus DS.B 1 ; Byte - yPos DS.B 2 ; Word - xPos DS.B 2 ; Word - ENDR InterruptStateRec RECORD 0 ; MiscTool irq_A DS.B 2 ; Word - irq_X DS.B 2 ; Word - irq_Y DS.B 2 ; Word - irq_S DS.B 2 ; Word - irq_D DS.B 2 ; Word - irq_P DS.B 1 ; Byte - irq_DB DS.B 1 ; Byte - irq_e DS.B 1 ; Byte - irq_K DS.B 1 ; Byte - irq_PC DS.B 2 ; Word - irq_state DS.B 1 ; Byte - irq_shadow DS.B 2 ; Word - irq_mslot DS.B 1 ; Byte - ENDR EventRecord RECORD 0 ; Event what DS.B 2 ; Word - event code message DS.B 4 ; Long - event message when DS.B 4 ; Long - ticks since startup where DS Point ; Point - mouse location modifiers DS.B 2 ; Word - modifier flags wmTaskData DS.B 4 ; Long - wmTaskMask DS.B 4 ; Long - wmLastClickTick DS.B 4 ; Long - wmClickCount DS.B 2 ; Word - wmTaskData2 DS.B 4 ; Long - wmTaskData3 DS.B 4 ; Long - wmTaskData4 DS.B 4 ; Long - wmLastClickPt DS Point ; Point - ENDR BarColors RECORD 0 ; Control barOutline DS.B 2 ; Word - color for outlining bar, arrows, and thumb barNorArrow DS.B 2 ; Word - color of arrows when not highlighted barSelArrow DS.B 2 ; Word - color of arrows when highlighted barArrowBack DS.B 2 ; Word - color of arrow box's background barNorThumb DS.B 2 ; Word - color of thumb's background when not highlighted barSelThumb DS.B 2 ; Word - color of thumb's background when highlighted barPageRgn DS.B 2 ; Word - color and pattern page region: high byte - 1= dither, 0 = solid barInactive DS.B 2 ; Word - color of scroll bar's interior when inactive ENDR BoxColors RECORD 0 ; Control boxReserved DS.B 2 ; Word - reserved boxNor DS.B 2 ; Word - color of box when not checked boxSel DS.B 2 ; Word - color of box when checked boxTitle DS.B 2 ; Word - color of check box's title ENDR BttnColors RECORD 0 ; Control bttnOutline DS.B 2 ; Word - color of outline bttnNorBack DS.B 2 ; Word - color of background when not selected bttnSelBack DS.B 2 ; Word - color of background when selected bttnNorText DS.B 2 ; Word - color of title's text when not selected bttnSelText DS.B 2 ; Word - color of title's text when selected ENDR CtlRec RECORD 0 ; Control ctlNext DS.B 4 ; CtlRecHndl - Handle of next control. ctlOwner DS.B 4 ; WindowPtr - Pointer to control's window. ctlRect DS Rect ; Rect - Enclosing rectangle. ctlFlag DS.B 1 ; Byte - Bit flags. ctlHilite DS.B 1 ; Byte - Highlighted part. ctlValue DS.B 2 ; Integer - Control's value. ctlProc DS.B 4 ; LongProcPtr - Control's definition procedure. ctlAction DS.B 4 ; LongProcPtr - Control's action procedure. ctlData DS.B 4 ; Longint - Reserved for CtrlProc's use. ctlRefCon DS.B 4 ; Longint - Reserved for application's use. ctlColor DS.B 4 ; Pointer - Pointer to appropriate color table. ctlReserved DS.B 16 ; Byte[16] - Reserved for future expansion ctlID DS.B 4 ; Long - ctlMoreFlags DS.B 2 ; Word - ctlVersion DS.B 2 ; Word - ENDR LimitBlk RECORD 0 ; Control boundRect DS Rect ; Rect - Drag bounds. slopRect DS Rect ; Rect - Cursor bounds. axisParam DS.B 2 ; Word - Movement constrains. dragPatt DS.B 4 ; Pointer - Pointer to 32 byte Pattern for drag outline. ENDR RadioColors RECORD 0 ; Control radReserved DS.B 2 ; Word - reserved radNor DS.B 2 ; Word - color of radio button when off radSel DS.B 2 ; Word - color of radio button when on radTitle DS.B 2 ; Word - color of radio button's title text ENDR WindColor RECORD 0 ; Window frameColor DS.B 2 ; Word - Color of window frame. titleColor DS.B 2 ; Word - Color of title and bar. tBarColor DS.B 2 ; Word - Color/pattern of title bar. growColor DS.B 2 ; Word - Color of grow box. infoColor DS.B 2 ; Word - Color of information bar. ENDR WindRec RECORD 0 ; Window port DS GrafPort ; GrafPort - Window's port wDefProc DS.B 4 ; ProcPtr - wRefCon DS.B 4 ; Long - wContDraw DS.B 4 ; ProcPtr - wReserved DS.B 4 ; Long - Space for future expansion wStrucRgn DS.B 4 ; RgnHandle - Region of frame plus content. wContRgn DS.B 4 ; RgnHandle - Content region. wUpdateRgn DS.B 4 ; RgnHandle - Update region. wControls DS.B 4 ; CtlRecHndl - Window's control list. wFrameCtrls DS.B 4 ; CtlRecHndl - Window frame's control list. wFrame DS.B 2 ; Word - ENDR WindowChain RECORD 0 ; Window wNext DS.B 4 ; WindowChainPtr - theWindow DS WindRec ; WindRec - ENDR ParamList RECORD 0 ; Window paramLength DS.B 2 ; Word - Parameter to NewWindow. wFrameBits DS.B 2 ; Word - Parameter to NewWindow. wTitle DS.B 4 ; Pointer - Parameter to NewWindow. wRefCon DS.B 4 ; Long - Parameter to NewWindow. wZoom DS Rect ; Rect - Parameter to NewWindow. wColor DS.B 4 ; WindColorPtr - Parameter to NewWindow. wYOrigin DS.B 2 ; Word - Parameter to NewWindow. wXOrigin DS.B 2 ; Word - Parameter to NewWindow. wDataH DS.B 2 ; Word - Parameter to NewWindow. wDataW DS.B 2 ; Word - Parameter to NewWindow. wMaxH DS.B 2 ; Word - Parameter to NewWindow. wMaxW DS.B 2 ; Word - Parameter to NewWindow. wScrollVer DS.B 2 ; Word - Parameter to NewWindow. wScrollHor DS.B 2 ; Word - Parameter to NewWindow. wPageVer DS.B 2 ; Word - Parameter to NewWindow. wPageHor DS.B 2 ; Word - Parameter to NewWindow. wInfoRefCon DS.B 4 ; Long - Parameter to NewWindow. wInfoHeight DS.B 2 ; Word - height of information bar wFrameDefProc DS.B 4 ; LongProcPtr - Parameter to NewWindow. wInfoDefProc DS.B 4 ; VoidProcPtr - Parameter to NewWindow. wContDefProc DS.B 4 ; VoidProcPtr - Parameter to NewWindow. wPosition DS Rect ; Rect - Parameter to NewWindow. wPlane DS.B 4 ; WindowPtr - Parameter to NewWindow. wStorage DS.B 4 ; WindowChainPtr - Parameter to NewWindow. ENDR DeskMessageRecord RECORD 0 ; Window reserved DS.B 4 ; Long - messageType DS.B 2 ; Word - drawType DS.B 2 ; Word - ENDR LERec RECORD 0 ; LineEdit leLineHandle DS.B 4 ; Handle - leLength DS.B 2 ; unsigned Integer - leMaxLength DS.B 2 ; unsigned Integer - leDestRect DS Rect ; Rect - leViewRect DS Rect ; Rect - lePort DS.B 4 ; GrafPortPtr - leLineHite DS.B 2 ; unsigned Integer - leBaseHite DS.B 2 ; unsigned Integer - leSelStart DS.B 2 ; unsigned Integer - leSelEnd DS.B 2 ; unsigned Integer - leActFlg DS.B 2 ; Word - leCarAct DS.B 2 ; Word - leCarOn DS.B 2 ; Word - leCarTime DS.B 4 ; unsigned Longint - leHiliteHook DS.B 4 ; VoidProcPtr - leCaretHook DS.B 4 ; VoidProcPtr - leJust DS.B 2 ; Word - lePWChar DS.B 2 ; Word - ENDR ItemTemplate RECORD 0 ; Dialog itemID DS.B 2 ; Word - itemRect DS Rect ; Rect - itemType DS.B 2 ; Word - itemDescr DS.B 4 ; Pointer - itemValue DS.B 2 ; Word - itemFlag DS.B 2 ; Word - itemColor DS.B 4 ; Pointer - pointer to appropriate type of color table ENDR AlertTemplate RECORD 0 ; Dialog atBoundsRect DS Rect ; Rect - atAlertID DS.B 2 ; Word - atStage1 DS.B 1 ; Byte - atStage2 DS.B 1 ; Byte - atStage3 DS.B 1 ; Byte - atStage4 DS.B 1 ; Byte - atItemList DS.B 4 ; ItemTempPtr[1] - Null terminated array ENDR DialogTemplate RECORD 0 ; Dialog dtBoundsRect DS Rect ; Rect - dtVisible DS.B 2 ; Boolean - dtRefCon DS.B 4 ; Longint - dtItemList DS.B 4 ; ItemTempPtr[1] - Null terminated array ENDR IconRecord RECORD 0 ; Dialog iconRect DS Rect ; Rect - iconImage DS.B 1 ; Byte[1] - ENDR UserCtlItemPB RECORD 0 ; Dialog defProcParm DS.B 4 ; Longint - ? should this be a LongProcPtr? titleParm DS.B 4 ; Pointer - param2 DS.B 2 ; Word - param1 DS.B 2 ; Word - ENDR PrPrinterSpecRec RECORD 0 ; Print prPrinterType DS.B 2 ; Word - prCharacteristics DS.B 2 ; Word - ENDR PrInfoRec RECORD 0 ; Print iDev DS.B 2 ; Word - reserved for internal use iVRes DS.B 2 ; Word - vertical resolution of printer iHRes DS.B 2 ; Word - horizontal resolution of printer rPage DS Rect ; Rect - defining page rectangle ENDR PrJobRec RECORD 0 ; Print iFstPage DS.B 2 ; Word - first page to print iLstPage DS.B 2 ; Word - last page to print iCopies DS.B 2 ; Word - number of copies bJDocLoop DS.B 1 ; Byte - printing method fFromUser DS.B 1 ; Byte - used internally pIdleProc DS.B 4 ; WordProcPtr - background procedure pFileName DS.B 4 ; Pointer - spool file name iFileVol DS.B 2 ; Word - spool file volume reference number bFileVers DS.B 1 ; Byte - spool file version number bJobX DS.B 1 ; Byte - used internally ENDR PrStyleRec RECORD 0 ; Print wDev DS.B 2 ; Word - output quality information internA DS.B 6 ; Word[3] - for internal use feed DS.B 2 ; Word - paper feed type paperType DS.B 2 ; Word - paper type crWidth DS.B 2 ; Word - carriage Width for image writer or vertical sizing for lazer writer reduction DS.B 2 ; Word - % reduction, laser writer only internB DS.B 2 ; Word - for internal use ENDR PrRec RECORD 0 ; Print prVersion DS.B 2 ; Word - print manager version prInfo DS PrInfoRec ; PrInfoRec - printer infomation subrecord rPaper DS Rect ; Rect - Defining paper rectangle prStl DS PrStyleRec ; PrStyleRec - style subrecord prInfoPT DS.B 14 ; Byte[14] - reserved for internal use prXInfo DS.B 24 ; Byte[24] - reserved for internal use prJob DS PrJobRec ; PrJobRec - job subrecord printX DS.B 38 ; Byte[38] - reserved for future use iReserved DS.B 2 ; Word - reserved for internal use ENDR PrStatusRec RECORD 0 ; Print iTotPages DS.B 2 ; Word - number of pages in spool file iCurPage DS.B 2 ; Word - page being printed iTotCopies DS.B 2 ; Word - number of copies requested iCurCopy DS.B 2 ; Word - copy being printed iTotBands DS.B 2 ; Word - reserved for internal use iCurBand DS.B 2 ; Word - reserved for internal use fPgDirty DS.B 2 ; Word - TRUE if started printing page fImaging DS.B 2 ; Word - reserved for internal use hPrint DS.B 4 ; PrRecHndl - handle of print record pPrPort DS.B 4 ; GrafPortPtr - pointer to grafport being use for printing hPic DS.B 4 ; Long - reserved for internal use ENDR ReadConfigRec RECORD 0 ; ADB rcRepeatDelay DS.B 1 ; Byte - Output Byte: Repeat / Delay rcLayoutOrLang DS.B 1 ; Byte - Output Byte: Layout / Language rcADBAddr DS.B 1 ; Byte - Output Byte: ADB address - keyboard and mouse ENDR SetConfigRec RECORD 0 ; ADB scADBAddr DS.B 1 ; Byte - keyboard and mouse scLayoutOrLang DS.B 1 ; Byte - scRepeatDelay DS.B 1 ; Byte - ENDR SynchRec RECORD 0 ; ADB synchMode DS.B 1 ; Byte - synchKybdMouseAddr DS.B 1 ; Byte - synchLayoutOrLang DS.B 1 ; Byte - synchRepeatDelay DS.B 1 ; Byte - ENDR ScaleRec RECORD 0 ; ADB xDivide DS.B 2 ; Word - yDivide DS.B 2 ; Word - xOffset DS.B 2 ; Word - yOffset DS.B 2 ; Word - xMultiply DS.B 2 ; Word - yMultiply DS.B 2 ; Word - ENDR FontStatRec RECORD 0 ; Font resultID DS FontID ; FontID - resultStats DS.B 2 ; Word - ENDR GSString255 RECORD 0 ; GSOS length DS.B 2 ; Word - Number of Chars in text field text DS.B 255 ; char[255] - ENDR GSString32 RECORD 0 ; GSOS length DS.B 2 ; Word - Number of characters in text field text DS.B 32 ; char[32] - ENDR ResultBuf255 RECORD 0 ; GSOS bufSize DS.B 2 ; Word - bufString DS GSString255 ; GSString255 - ENDR ResultBuf32 RECORD 0 ; GSOS bufSize DS.B 2 ; Word - bufString DS GSString32 ; GSString32 - ENDR ChangePathRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - pathname DS.B 4 ; GSString255Ptr - newPathname DS.B 4 ; GSString255Ptr - ENDR CreateRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - pathname DS.B 4 ; GSString255Ptr - access DS.B 2 ; Word - fileType DS.B 2 ; Word - auxType DS.B 4 ; Long - storageType DS.B 2 ; Word - eof DS.B 4 ; Long - resourceEOF DS.B 4 ; Long - ENDR DAccessRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - devNum DS.B 2 ; Word - code DS.B 2 ; Word - list DS.B 4 ; Pointer - requestCount DS.B 4 ; Long - transferCount DS.B 4 ; Long - ENDR DevNumRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - devName DS.B 4 ; GSString255Ptr - devNum DS.B 2 ; Word - ENDR DInfoRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - minimum = 2 devNum DS.B 2 ; Word - devName DS.B 4 ; GSString32Ptr - characteristics DS.B 2 ; Word - totalBlocks DS.B 4 ; Long - slotNum DS.B 2 ; Word - unitNum DS.B 2 ; Word - version DS.B 2 ; Word - deviceID DS.B 2 ; Word - headLink DS.B 2 ; Word - forwardLink DS.B 2 ; Word - extendedDIBptr DS.B 4 ; Long - ENDR DIORecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - devNum DS.B 2 ; Word - buffer DS.B 4 ; Pointer - requestCount DS.B 4 ; Long - startingBlock DS.B 4 ; Long - blockSize DS.B 2 ; Word - transferCount DS.B 4 ; Long - ENDR DirEntryRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - refNum DS.B 2 ; Word - flags DS.B 2 ; Word - base DS.B 2 ; Word - displacement DS.B 2 ; Word - name DS.B 4 ; Pointer - entryNum DS.B 2 ; Word - fileType DS.B 2 ; Word - eof DS.B 4 ; Longint - blockCount DS.B 4 ; Long - createDateTime DS TimeRec ; TimeRec - modDateTime DS TimeRec ; TimeRec - access DS.B 2 ; Word - auxType DS.B 4 ; Long - fileSysID DS.B 2 ; Word - optionList DS.B 4 ; ResultBuf255Ptr - resourceEOF DS.B 4 ; Long - resourceBlocks DS.B 4 ; Long - ENDR ExpandPathRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - inputPath DS.B 4 ; GSString255Ptr - outputPath DS.B 4 ; ResultBuf255Ptr - flags DS.B 2 ; Word - ENDR FileInfoRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - pathname DS.B 4 ; GSString255Ptr - access DS.B 2 ; Word - fileType DS.B 2 ; Word - auxType DS.B 4 ; Long - storageType DS.B 2 ; Word - must be 0 for SetFileInfo createDateTime DS TimeRec ; TimeRec - modDateTime DS TimeRec ; TimeRec - optionList DS.B 4 ; Long - eof DS.B 4 ; Long - blocksUsed DS.B 4 ; Long - must be 0 for SetFileInfo resourceEOF DS.B 4 ; Long - must be 0 for SetFileInfo resourceBlocks DS.B 4 ; Long - must be 0 for SetFileInfo ENDR FormatRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - devName DS.B 4 ; GSString32Ptr - device name pointer volName DS.B 4 ; GSString32Ptr - volume name pointer fileSysID DS.B 2 ; Word - file system ID reqFileSysID DS.B 2 ; Word - in; ENDR FSTInfoRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - fstNum DS.B 2 ; Word - fileSysId DS.B 2 ; Word - fstName DS.B 4 ; ResultBuf255Ptr - version DS.B 2 ; Word - attributes DS.B 2 ; Word - blockSize DS.B 2 ; Word - maxVolSize DS.B 4 ; Long - maxFileSize DS.B 4 ; Long - ENDR InterruptRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - intNum DS.B 2 ; Word - vrn DS.B 2 ; Word - used only by BindInt intCode DS.B 4 ; Long - used only by BindInt ENDR IORecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - refNum DS.B 2 ; Word - dataBuffer DS.B 4 ; Pointer - requestCount DS.B 4 ; Long - transferCount DS.B 4 ; Long - cachePriority DS.B 2 ; Word - ENDR LevelRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - level DS.B 2 ; Word - ENDR NameRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - pathname DS.B 4 ; GSString255Ptr - full pathname or a filename depending on call ENDR NewlineRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - refNum DS.B 2 ; Word - enableMask DS.B 2 ; Word - numChars DS.B 2 ; Word - newlineTable DS.B 4 ; Pointer - ENDR OpenRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - refNum DS.B 2 ; Word - pathname DS.B 4 ; GSString255Ptr - requestAccess DS.B 2 ; Word - resourceNumber DS.B 2 ; Word - For extended files: dataFork/resourceFork access DS.B 2 ; Word - Value of file's access attribute fileType DS.B 2 ; Word - Value of file's fileType attribute auxType DS.B 4 ; Long - storageType DS.B 2 ; Word - createDateTime DS TimeRec ; TimeRec - modDateTime DS TimeRec ; TimeRec - optionList DS.B 4 ; WordPtr - eof DS.B 4 ; Long - blocksUsed DS.B 4 ; Long - resourceEOF DS.B 4 ; Long - resourceBlocks DS.B 4 ; Long - ENDR OSShutdownRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - in shutdownFlag DS.B 2 ; Word - in ENDR PositionRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - refNum DS.B 2 ; Word - position DS.B 4 ; Long - ENDR EOFRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - refNum DS.B 2 ; Word - eof DS.B 4 ; Long - ENDR QuitRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - pathname DS.B 4 ; GSString255Ptr - pathname of next app to run flags DS.B 2 ; Word - ENDR RefNumRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - refNum DS.B 2 ; Word - ENDR SessionStatusRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - in: min = 1 status DS.B 2 ; Word - out: ENDR SetPositionRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - refNum DS.B 2 ; Word - base DS.B 2 ; Word - displacement DS.B 4 ; Long - ENDR SysPrefsRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - preferences DS.B 2 ; Word - ENDR VersionRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - version DS.B 2 ; Word - ENDR VolumeRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - devName DS.B 4 ; GSString32Ptr - volName DS.B 4 ; ResultBuf255Ptr - totalBlocks DS.B 4 ; Long - freeBlocks DS.B 4 ; Long - fileSysID DS.B 2 ; Word - blockSize DS.B 2 ; Word - ENDR IntDivRec RECORD 0 ; IntMath quotient DS.B 2 ; Integer - quotient from SDivide remainder DS.B 2 ; Integer - remainder from SDivide ENDR LongDivRec RECORD 0 ; IntMath quotient DS.B 4 ; Longint - Quotient from LongDiv remainder DS.B 4 ; Longint - remainder from LongDiv ENDR LongMulRec RECORD 0 ; IntMath lsResult DS.B 4 ; Longint - low 2 words of product msResult DS.B 4 ; Longint - High 2 words of product ENDR WordDivRec RECORD 0 ; IntMath quotient DS.B 2 ; Word - Quotient from UDivide remainder DS.B 2 ; Word - remainder from UDivide ENDR LColorTable RECORD 0 ; List listFrameClr DS.B 2 ; Word - Frame color listNorTextClr DS.B 2 ; Word - Unhighlighted text color listSelTextClr DS.B 2 ; Word - Highlighted text color listNorBackClr DS.B 2 ; Word - Unhighlighted background color listSelBackClr DS.B 2 ; Word - Highlighted backgraound color ENDR MemRec RECORD 0 ; List memPtr DS.B 4 ; Pointer - Pointer to string, or custom memFlag DS.B 1 ; Byte - Bit Flag ENDR ListCtlRec RECORD 0 ; List ctlNext DS.B 4 ; CtlRecHndl - Handle of Next Control ctlOwner DS.B 4 ; GrafPortPtr - Window owner ctlRect DS Rect ; Rect - Enclosing Rect ctlFlag DS.B 1 ; Byte - Bit 7 visible, Bit 0 string type, Bit 1 multiple ctlHilite DS.B 1 ; Byte - (not used) ctlValue DS.B 2 ; Word - First member in display ctlProc DS.B 4 ; LongProcPtr - Address of list definition procedure ctlAction DS.B 4 ; LongProcPtr - Address of list action procedure ctlData DS.B 4 ; Long - Low = view size, High = total members ctlRefCon DS.B 4 ; Long - Not used ctlColor DS.B 4 ; LColorTablePtr - Null for default colors ctlMemDraw DS.B 4 ; VoidProcPtr - Address of routine to draw members ctlMemHeight DS.B 2 ; Word - Member's Height in Pixels ctlMemSize DS.B 2 ; Word - Bytes in member record ctlList DS.B 4 ; MemRecPtr - Adress of first member record in array ctlListBar DS.B 4 ; CtlRecHndl - Handle of list contrlo's scroll bar control ENDR ListRec RECORD 0 ; List listRect DS Rect ; Rect - Enclosing Rectangle listSize DS.B 2 ; Word - Number of List Members listView DS.B 2 ; Word - Max Viewable members listType DS.B 2 ; Word - Bit Flag listStart DS.B 2 ; Word - First member in view listCtl DS.B 4 ; CtlRecHndl - List control's handle listDraw DS.B 4 ; VoidProcPtr - Address of Custom drawing routine listMemHeight DS.B 2 ; Word - Height of list members listMemSize DS.B 2 ; Word - Size of Member Records listPointer DS.B 4 ; MemRecPtr - Pointer to first element in MemRec array listRefCon DS.B 4 ; Long - becomes Control's refCon listScrollClr DS.B 4 ; BarColorsPtr - Color table for list's scroll bar ENDR InitialLoadOutputRec RECORD 0 ; Loader userID DS.B 2 ; Word - startAddr DS.B 4 ; Pointer - dPageAddr DS.B 2 ; Word - buffSize DS.B 2 ; Word - ENDR RestartOutRec RECORD 0 ; Loader userID DS.B 2 ; Word - startAddr DS.B 4 ; Pointer - dPageAddr DS.B 2 ; Word - buffSize DS.B 2 ; Word - ENDR LoadSegNameOut RECORD 0 ; Loader segAddr DS.B 4 ; Pointer - fileNum DS.B 2 ; Word - segNum DS.B 2 ; Word - ENDR UnloadSegOutRec RECORD 0 ; Loader userID DS.B 2 ; Word - fileNum DS.B 2 ; Word - segNum DS.B 2 ; Word - ENDR QDIconRecord RECORD 0 ; QDAux iconType DS.B 2 ; Word - iconSize DS.B 2 ; Word - iconHeight DS.B 2 ; Word - iconWidth DS.B 2 ; Word - iconImage DS.B 1 ; Byte[1] - iconMask DS.B 1 ; Byte[1] - ENDR MessageRec RECORD 0 ; Locator messageNext DS.B 4 ; MessageRecHndl - messageType DS.B 2 ; Integer - messageData DS.B 2 ; Integer - fileNames DS.B 100 ; Str255[1] - ENDR ToolSpec RECORD 0 ; Locator toolNumber DS.B 2 ; Word - minVersion DS.B 2 ; Word - ENDR StartStopRecord RECORD 0 ; Locator flags DS.B 2 ; Word - videoMode DS.B 2 ; Word - resFileID DS.B 2 ; Word - dPageHandle DS.B 4 ; Handle - numTools DS.B 2 ; Word - ENDR MenuRec RECORD 0 ; Menu menuID DS.B 2 ; Word - Menu's ID number menuWidth DS.B 2 ; Word - Width of menu menuHeight DS.B 2 ; Word - Height of menu menuProc DS.B 4 ; WordProcPtr - Menu's definition procedure menuFlag DS.B 1 ; Byte - Bit flags menuRes DS.B 1 ; Byte - firstItem DS.B 1 ; Byte - numOfItems DS.B 1 ; Byte - titleWidth DS.B 2 ; Word - Width of menu's title titleName DS.B 4 ; Pointer - Menu's title ENDR MiBufInfo RECORD 0 ; Midi bufSize DS.B 2 ; Word - size of buffer (0 for default) address DS.B 4 ; Pointer - address of buffer (0 for auto-allocation) ENDR MiDriverInfo RECORD 0 ; Midi slot DS.B 2 ; Word - device slot external DS.B 2 ; Word - slot internal (=0) / external (=1) pathname DS.B 65 ; Byte[65] - device driver pathname ENDR LocRec RECORD 0 ; NoteSeq curPhraseItem DS.B 2 ; Word - curPattItem DS.B 2 ; Word - curLevel DS.B 2 ; Word - ENDR Envelope RECORD 0 ; Notesyn st1BkPt DS.B 1 ; Byte - st1Increment DS.B 2 ; Word - st2BkPt DS.B 1 ; Byte - st2Increment DS.B 2 ; Word - st3BkPt DS.B 1 ; Byte - st3Increment DS.B 2 ; Word - st4BkPt DS.B 1 ; Byte - st4Increment DS.B 2 ; Word - st5BkPt DS.B 1 ; Byte - st5Increment DS.B 2 ; Word - st6BkPt DS.B 1 ; Byte - st6Increment DS.B 2 ; Word - st7BkPt DS.B 1 ; Byte - st7Increment DS.B 2 ; Word - st8BkPt DS.B 1 ; Byte - st8Increment DS.B 2 ; Word - ENDR WaveForm RECORD 0 ; Notesyn wfTopKey DS.B 1 ; Byte - wfWaveAddress DS.B 1 ; Byte - wfWaveSize DS.B 1 ; Byte - wfDocMode DS.B 1 ; Byte - wfRelPitch DS.B 2 ; Word - ENDR Instrument RECORD 0 ; Notesyn theEnvelope DS Envelope ; Envelope - releaseSegment DS.B 1 ; Byte - priorityIncrement DS.B 1 ; Byte - pitchBendRange DS.B 1 ; Byte - vibratoDepth DS.B 1 ; Byte - vibratoSpeed DS.B 1 ; Byte - inSpare DS.B 1 ; Byte - aWaveCount DS.B 1 ; Byte - bWaveCount DS.B 1 ; Byte - aWaveList DS.B 6 ; WaveForm[1] - bWaveList DS.B 6 ; WaveForm[1] - ENDR BlockRec RECORD 0 ; ProDOS blockDevNum DS.B 2 ; Word - blockDataBuffer DS.B 4 ; Ptr - blockNum DS.B 4 ; Longint - ENDR DevNumRec RECORD 0 ; ProDOS devName DS.B 4 ; Ptr - devNum DS.B 2 ; Word - ENDR DInfoRec RECORD 0 ; ProDOS devNum DS.B 2 ; Word - devName DS.B 4 ; Ptr - ENDR DirEntryRec RECORD 0 ; ProDOS refNum DS.B 2 ; Word - reserved DS.B 2 ; Word - base DS.B 2 ; Word - displacement DS.B 2 ; Word - nameBuffer DS.B 4 ; Pointer - entryNum DS.B 2 ; Word - fileType DS.B 2 ; Word - endOfFile DS.B 4 ; Longint - blockCount DS.B 4 ; Long - createTime DS TimeRec ; TimeRec - modTime DS TimeRec ; TimeRec - access DS.B 2 ; Word - auxType DS.B 4 ; Long - fileSysID DS.B 2 ; Word - ENDR EOFRec RECORD 0 ; ProDOS eofRefNum DS.B 2 ; Word - eofPosition DS.B 4 ; Longint - ENDR FileIORec RECORD 0 ; ProDOS fileRefNum DS.B 2 ; Word - dataBuffer DS.B 4 ; Ptr - requestCount DS.B 4 ; Longint - transferCount DS.B 4 ; Longint - ENDR FileRec RECORD 0 ; ProDOS pathname DS.B 4 ; Ptr - fAccess DS.B 2 ; Word - fileType DS.B 2 ; Word - auxType DS.B 4 ; Longint - storageType DS.B 2 ; Word - createDate DS.B 2 ; Word - createTime DS.B 2 ; Word - modDate DS.B 2 ; Word - modTime DS.B 2 ; Word - blocksUsed DS.B 4 ; Longint - ENDR FormatRec RECORD 0 ; ProDOS devName DS.B 4 ; Ptr - device name pointer volName DS.B 4 ; Ptr - device name pointer fileSysID DS.B 2 ; Word - file system ID ENDR EraseDiskRec RECORD 0 ; ProDOS devName DS.B 4 ; Ptr - device name pointer volName DS.B 4 ; Ptr - device name pointer fileSysID DS.B 2 ; Word - file system ID ENDR InterruptRec RECORD 0 ; ProDOS intNum DS.B 2 ; Word - intCode DS.B 4 ; Ptr - ENDR MarkRec RECORD 0 ; ProDOS markRefNum DS.B 2 ; Word - position DS.B 4 ; Long - ENDR NewLineRec RECORD 0 ; ProDOS newLRefNum DS.B 2 ; Word - enableMask DS.B 2 ; Word - newlineChar DS.B 2 ; Word - ENDR OpenRec RECORD 0 ; ProDOS openRefNum DS.B 2 ; Word - openPathname DS.B 4 ; Ptr - ioBuffer DS.B 4 ; Handle - ENDR PathNameRec RECORD 0 ; ProDOS pathname DS.B 4 ; Ptr - newPathname DS.B 4 ; Ptr - ENDR PrefixRec RECORD 0 ; ProDOS prefixNum DS.B 2 ; Word - prefix DS.B 4 ; Ptr - ENDR QuitRec RECORD 0 ; ProDOS quitPathname DS.B 4 ; Ptr - flags DS.B 2 ; Word - ENDR VolumeRec RECORD 0 ; ProDOS deviceName DS.B 4 ; Ptr - volName DS.B 4 ; Ptr - totalBlocks DS.B 4 ; Long - freeBlocks DS.B 4 ; Long - fileSysID DS.B 2 ; Word - ENDR ExpandPathRec RECORD 0 ; ProDOS inputPath DS.B 4 ; StringPtr - outputPath DS.B 4 ; StringPtr - flags DS.B 2 ; Word - ENDR ResHeaderRec RECORD 0 ; Resources rFileVersion DS.B 4 ; Long - Format version of resource fork rFileToMap DS.B 4 ; Long - Offset from start to resource map record rFileMapSize DS.B 4 ; Long - Number of bytes map occupies in file rFileMemo DS.B 128 ; byte[128] - Reserved space for application rFileRecSize DS.B 4 ; Long - Size of ResHeaderRec Record ENDR FreeBlockRec RECORD 0 ; Resources blkOffset DS.B 4 ; Long - blkSize DS.B 4 ; Long - ENDR ResMap RECORD 0 ; Resources mapNext DS.B 40 ; ResMapHandle - Handle to next resource map mapFlag DS.B 2 ; Word - Bit Flags mapOffset DS.B 4 ; Long - Map's file position mapSize DS.B 4 ; Long - Number of bytes map occupies in file mapToIndex DS.B 2 ; Word - mapFileNum DS.B 2 ; Word - mapID DS.B 2 ; Word - mapIndexSize DS.B 4 ; Long - mapIndexUsed DS.B 4 ; Long - mapFreeListSize DS.B 2 ; Word - mapFreeListUsed DS.B 2 ; Word - n bytes (array of free block records) mapFreeList DS.B 8 ; FreeBlockRec[1] - ENDR ResRefRec RECORD 0 ; Resources resType DS.B 2 ; ResType - resID DS.B 4 ; ResID - resOffset DS.B 4 ; Long - resAttr DS.B 2 ; ResAttr - resSize DS.B 4 ; Long - resHandle DS.B 4 ; Handle - ENDR ResourceSpec RECORD 0 ; Resources resourceType DS.B 2 ; ResType - resourceID DS.B 4 ; ResID - ENDR ResNameEntry RECORD 0 ; Resources namedResID DS.B 4 ; ResID - resName DS Str255 ; Str255 - ENDR ResNameRecord RECORD 0 ; Resources version DS.B 2 ; word - nameCount DS.B 4 ; long - resNameEntries DS.B 4 ; ResNameEntry[1] - ENDR GetLInfoPB RECORD 0 ; Shell sfile DS.B 4 ; Ptr - address of source file name dfile DS.B 4 ; Ptr - address of output file name parms DS.B 4 ; Ptr - address of parameter list lstring DS.B 4 ; Ptr - address of language specific input string merr DS.B 1 ; Byte - max error level allowed merrf DS.B 1 ; Byte - max error level found lops DS.B 1 ; Byte - operations flag kflag DS.B 1 ; Byte - KEEP flag mflags DS.B 4 ; unsigned long - set of letters selected with '-' pflags DS.B 4 ; unsigned long - set of letters selected with '+' org DS.B 4 ; unsigned long - abs start address of non-relloc load file ENDR SoundParamBlock RECORD 0 ; Sound waveStart DS.B 4 ; Pointer - starting address of wave waveSize DS.B 2 ; Word - waveform size in pages freqOffset DS.B 2 ; Word - ? formula to be provided docBuffer DS.B 2 ; Word - DOC buffer start address, low byte = 0 bufferSize DS.B 2 ; Word - DOC buffer start address, low byte = 0 nextWavePtr DS.B 4 ; SoundPBPtr - Pointer to start of next wave's parameter block volSetting DS.B 2 ; Word - DOC volume setting. High byte = 0 ENDR DocRegParamBlk RECORD 0 ; Sound oscGenType DS.B 2 ; Word - freqLow1 DS.B 1 ; Byte - freqHigh1 DS.B 1 ; Byte - vol1 DS.B 1 ; Byte - tablePtr1 DS.B 1 ; Byte - control1 DS.B 1 ; Byte - tableSize1 DS.B 1 ; Byte - freqLow2 DS.B 1 ; Byte - freqHigh2 DS.B 1 ; Byte - vol2 DS.B 1 ; Byte - tablePtr2 DS.B 1 ; Byte - control2 DS.B 1 ; Byte - tableSize2 DS.B 1 ; Byte - ENDR SFReplyRec RECORD 0 ; StdFile good DS.B 2 ; Boolean - TRUE for open; FALSE for cancel fileType DS.B 2 ; Word - ProDOS file type auxFileType DS.B 2 ; Word - ProDOS aux file type filename DS.B 16 ; char[16] - length byte - Name of file in prefix 0 fullPathname DS.B 129 ; char[129] - length byte - The full pathname of the selected file. ENDR SFReplyRec2 RECORD 0 ; StdFile good DS.B 2 ; Boolean - filetype DS.B 2 ; Word - auxType DS.B 4 ; Long - nameDesc DS.B 2 ; RefDescriptor - nameRef DS.B 4 ; Ref - pathDesc DS.B 2 ; RefDescriptor - pathRef DS.B 4 ; Ref - ENDR multiReplyRecord RECORD 0 ; StdFile good DS.B 2 ; Word - namesHandle DS.B 4 ; Handle - ENDR SFTypeList RECORD 0 ; StdFile numEntries DS.B 1 ; byte - fileTypeEntries DS.B 5 ; byte[5] - ENDR TypeSelector2 RECORD 0 ; StdFile flags DS.B 2 ; Word - fileType DS.B 2 ; Word - auxType DS.B 4 ; Long - ENDR SFTypeList2 RECORD 0 ; StdFile numEntries DS.B 2 ; Word - fileTypeEntries DS.B 40 ; TypeSelector2[5] - ENDR TEColorTable RECORD 0 ; TextEdit contentColor DS.B 2 ; word - outlineColor DS.B 2 ; word - pageBoundaryColor DS.B 2 ; word - hiliteForeColor DS.B 2 ; word - hiliteBackColor DS.B 2 ; word - vertColorDescriptor DS.B 2 ; word - vertColorRef DS.B 4 ; long - horzColorDescriptor DS.B 2 ; word - horzColorRef DS.B 4 ; long - growColorDescriptor DS.B 2 ; word - growColorRef DS.B 4 ; long - ENDR TERecord RECORD 0 ; TextEdit ctlNext DS.B 4 ; CtlRecHndl - ctlOwner DS.B 4 ; WindowPtr - ctlRect DS Rect ; Rect - ctlFlag DS.B 1 ; Byte - ctlHilite DS.B 1 ; Byte - ctlValue DS.B 2 ; Word - ctlProc DS.B 4 ; ProcPtr - ctlAction DS.B 4 ; ProcPtr - ctlData DS.B 4 ; Long - ctlRefCon DS.B 4 ; Long - ctlColorRef DS.B 4 ; TEColorTablePtr - reserved DS.B 16 ; byte[16] - ctlID DS.B 4 ; long - ctlMoreFlags DS.B 2 ; Word - ctlVersion DS.B 2 ; Word - theChar DS.B 2 ; Word - theModifiers DS.B 2 ; Word - extendFlag DS.B 2 ; Word - moveByWord DS.B 2 ; Word - inputPtr DS.B 4 ; Ptr - inputLength DS.B 4 ; Long - theRect DS Rect ; Rect - ENDR TETabItem RECORD 0 ; TextEdit tabKind DS.B 2 ; Word - tabData DS.B 2 ; Word - ENDR TERuler RECORD 0 ; TextEdit leftMargin DS.B 2 ; Word - leftIndent DS.B 2 ; Word - rightMargin DS.B 2 ; Word - just DS.B 2 ; Word - extraLS DS.B 2 ; Word - flags DS.B 2 ; Word - userData DS.B 2 ; Word - tabType DS.B 2 ; Word - tabs DS.B 4 ; TETabItem[1] - tabTerminator DS.B 2 ; Word - ENDR TEStyle RECORD 0 ; TextEdit teFont DS FontID ; FontID - foreColor DS.B 2 ; Word - backColor DS.B 2 ; Word - reserved DS.B 4 ; Long - ENDR TEStyleGroup RECORD 0 ; TextEdit count DS.B 2 ; word - styles DS.B 12 ; TEStyle[1] - ENDR TEStyleItem RECORD 0 ; TextEdit length DS.B 4 ; long - offset DS.B 4 ; long - ENDR TEFormat RECORD 0 ; TextEdit version DS.B 2 ; word - rulerListLength DS.B 4 ; long - theRulerList DS.B 22 ; TERuler[1] - styleListLength DS.B 4 ; long - theStyleList DS.B 12 ; TEStyle[1] - numberOfStyles DS.B 4 ; long - theStyles DS.B 8 ; TEStyleItem[1] - ENDR TEInfoRec RECORD 0 ; TextEdit charCount DS.B 4 ; long - lineCount DS.B 4 ; long - formatMemory DS.B 4 ; long - totalMemory DS.B 4 ; long - styleCount DS.B 4 ; long - rulerCount DS.B 4 ; long - ENDR TEHooks RECORD 0 ; TextEdit charFilter DS.B 4 ; ProcPtr - wordWrap DS.B 4 ; ProcPtr - wordBreak DS.B 4 ; ProcPtr - drawText DS.B 4 ; ProcPtr - eraseText DS.B 4 ; ProcPtr - ENDR DeviceRec RECORD 0 ; TextTool ptrOrSlot DS.B 4 ; Long - slot number or jump table ptr deviceType DS.B 2 ; Word - type of input device ENDR TxtMaskRec RECORD 0 ; TextTool orMask DS.B 2 ; Word - andMask DS.B 2 ; Word - ENDR GET_INFO_PARAM RECORD 0 ; AppleTalk Async_Flag DS.B 1 ; Byte - Command DS.B 1 ; Byte - Result_Code DS.B 2 ; Word - Completion_Rtn_Return DS.B 4 ; Long - This_Net DS.B 2 ; Word - A_Bridge DS.B 1 ; Byte - Hardware_ID DS.B 1 ; Byte - ROM_Version DS.B 2 ; Word - Node_Number DS.B 1 ; Byte - ENDR GET_GLOBAL_PARAM RECORD 0 ; AppleTalk Async_Flag DS.B 1 ; Byte - Command DS.B 1 ; Byte - Result_Code DS.B 2 ; Word - Buffer_Pointer DS.B 4 ; Long - ENDR GET_GLOBAL_BUFFER RECORD 0 ; AppleTalk LAP_Destination_Node DS.B 1 ; Byte - LAP_Source_Node DS.B 1 ; Byte - LAP_Type DS.B 1 ; Byte - Hop_Count_DL DS.B 1 ; Byte - Datagram_Length DS.B 1 ; Byte - DDP_Checksum DS.B 2 ; Word - Destination_Network DS.B 2 ; Word - Source_Network DS.B 2 ; Word - Destination_Node DS.B 1 ; Byte - Source_Node DS.B 1 ; Byte - Destination_Socket DS.B 1 ; Byte - Source_Socket DS.B 1 ; Byte - DDP_Type DS.B 1 ; Byte - Packet_Length DS.B 2 ; Word - ENDR INSTALL_TIMER_PARAM RECORD 0 ; AppleTalk Async_Flag DS.B 1 ; Byte - Command DS.B 1 ; Byte - Result_Code DS.B 2 ; Word - Completion_Rtn_Return DS.B 4 ; Long - Running_Tick_Count DS.B 2 ; Word - Ticks_to_Complete DS.B 2 ; Word - Reserved DS.B 4 ; Pointer - ENDR REMOVE_TIMER_PARAM RECORD 0 ; AppleTalk Async_Flag DS.B 1 ; Byte - Command DS.B 1 ; Byte - Result_Code DS.B 2 ; Word - Reserved DS.B 12 ; Byte[12] - ENDR BOOT_PARAM RECORD 0 ; AppleTalk Async_Flag DS.B 1 ; Byte - Command DS.B 1 ; Byte - Result_Code DS.B 2 ; Word - ENDR SP_GET_PARMS_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation MaxCmdSize DS.B 2 ; Word - MaxDataSize DS.B 2 ; Word - ENDR SP_GET_STATUS_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine SLSNet DS.B 2 ; Word - SLS Network Number SLSNode DS.B 1 ; Byte - SLS Node Number SLSSocket DS.B 1 ; Byte - SLS Socket Number BufferLen DS.B 2 ; Word - Buffer Length BufferAddr DS.B 4 ; Long - Buffer Address DataLen DS.B 2 ; Word - Length of Status Data ENDR SP_OPEN_SESSION_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine SLSNet DS.B 2 ; Word - SLS Network Number SLSNode DS.B 1 ; Byte - SLS Node Number SLSSocket DS.B 1 ; Byte - SLS Socket Number AttnRtnAddr DS.B 4 ; Long - Attention Routine Addr RefNum DS.B 1 ; Byte - Session Reference Number ENDR SP_CLOSE_SESSION_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine RefNum DS.B 1 ; Byte - Session Reference Number ENDR SP_COMMAND_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine RefNum DS.B 1 ; Byte - Session Reference Number CmdBlkLen DS.B 2 ; Word - Command Block Length CmdBlkAddr DS.B 4 ; Long - Command Block Address ReplyBufLen DS.B 2 ; Word - Reply Buffer Length ReplyBufAddr DS.B 4 ; Long - Reply Buffer Address CmdResult DS.B 4 ; Long - Command Result ReplyLen DS.B 2 ; Word - Reply Length ENDR SP_WRITE_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine RefNum DS.B 1 ; Byte - Session Reference Number CmdBlkLen DS.B 2 ; Word - Command Block Length CmdBlkAddr DS.B 4 ; Long - Command Block Address WriteDataLen DS.B 2 ; Word - Write Data Length WriteDataAddr DS.B 4 ; Long - Write Data Address ReplyBufLen DS.B 2 ; Word - Reply Buffer Length ReplyBufAddr DS.B 4 ; Long - Reply Buffer Address CmdResult DS.B 4 ; Long - Command Result WrittenLen DS.B 2 ; Word - Written Length ReplyLen DS.B 2 ; Word - Reply Length ENDR SERVER RECORD 0 ; AppleTalk ServerName DS.B 4 ; Pointer - Pointer to a Server Entity Net DS.B 2 ; Word - Net of the server Node DS.B 1 ; Byte - Node of the server Socket DS.B 1 ; Byte - Socket number of the server ENDR SEND_ATP_REQ_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ATP command to execute Result DS.B 2 ; Word - error result from the ATP operation completionPtr DS.B 4 ; Long - pointer to the completion routine socketID DS.B 1 ; Byte - dynamic socket number destNetID DS.B 2 ; Word - destination network # destNodeID DS.B 1 ; Byte - destination node # destSocketID DS.B 1 ; Byte - destination socket # transactionID DS.B 2 ; Word - transaction ID # reqBuffLen DS.B 2 ; Word - request buffer length reqBuffPtr DS.B 4 ; Long - pointer to the request buffer userBytes DS.B 4 ; Long - user BYTEs numberRespBuffs DS.B 1 ; Byte - number of response buffers respBuffPtr DS.B 4 ; Long - pointer to the response buffer atpFlags DS.B 1 ; Byte - flags for ATP transaction rinterval DS.B 1 ; Byte - timeout before retrying rcount DS.B 1 ; Byte - number of retries to attempt bitMap DS.B 1 ; Byte - bitmap indicating for packet reception responseRcv DS.B 1 ; Byte - number of responses received reserved DS.B 1 ; Byte - reserved for future use ENDR CANCEL_ATP_REQ_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ATP command to execute Result DS.B 2 ; Word - error result from ATP operation transactionID DS.B 2 ; Word - transaction ID # ENDR OPEN_ATP_SOCKET_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ATP command to execute Result DS.B 2 ; Word - error result from the ATP operation socketID DS.B 1 ; Byte - socket number to open ENDR CLOSE_ATP_SOCKET_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ATP command to execute Result DS.B 2 ; Word - error result from ATP operation socketID DS.B 1 ; Byte - socket number for closing ENDR GET_ATP_REQ_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ATP command to execute Result DS.B 2 ; Word - error result from ATP operation completionPtr DS.B 4 ; Long - pointer to the completion routine respSocketID DS.B 1 ; Byte - response socket # networkID DS.B 2 ; Word - source network # nodeID DS.B 1 ; Byte - source node # socketID DS.B 1 ; Byte - source socket # transactionID DS.B 2 ; Word - ATP transaction ID reqBuffLen DS.B 2 ; Word - request buffer length reqBuffPtr DS.B 4 ; Long - pointer to request buffer userBytes DS.B 4 ; Long - user BYTEs requestLen DS.B 2 ; Word - actual request length atpFlags DS.B 1 ; Byte - ATP operation flags bitmap DS.B 1 ; Byte - bitmap for packet reception reserved DS.B 4 ; Long - reserved for future use ENDR SEND_ATP_RESP_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ATP command to execute Result DS.B 2 ; Word - result to the ATP operation completionPtr DS.B 4 ; Long - pointer to the completion routine socketID DS.B 1 ; Byte - response socket # destNetID DS.B 2 ; Word - destination network # destNodeID DS.B 1 ; Byte - destination node # destSocketID DS.B 1 ; Byte - destination socket # transactionID DS.B 2 ; Word - transaction ID # numRespBuffers DS.B 1 ; Byte - number of response buffers totalPackets DS.B 1 ; Byte - total ATP packets respBDSPtr DS.B 4 ; Long - pointer to the BDS buffer atpFlags DS.B 1 ; Byte - ATP operation flags bitmap DS.B 1 ; Byte - bitmap for packet reception addRoutinePtr DS.B 4 ; Long - pointer to a routine to call when packets have been released stsFlag DS.B 1 ; Byte - Flag indicating the use of STS servicing ENDR ADD_ATP_RESP_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ATP command to execute Result DS.B 2 ; Word - error result to the ATP operation socketID DS.B 1 ; Byte - response socket # destNetID DS.B 2 ; Word - destination network # destNodeID DS.B 1 ; Byte - destination node # destSocketID DS.B 1 ; Byte - destination socket # transactionID DS.B 2 ; Word - ATP transaction ID # respBuffLen DS.B 2 ; Word - length of the response buffer respBuffPtr DS.B 4 ; Long - pointer to the response buffer userBytes DS.B 4 ; Long - user BYTEs atpFlags DS.B 1 ; Byte - ATP operation flag ENDR REL_ATP_CB_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ATP command to execute Result DS.B 2 ; Word - error result to the ATP operation socketID DS.B 1 ; Byte - response socket # destNetID DS.B 2 ; Word - destination network # destNodeID DS.B 1 ; Byte - destination node # destSocketID DS.B 1 ; Byte - destination socket # transactionID DS.B 2 ; Word - ATP transaction ID ENDR RESPBDSBUFFER RECORD 0 ; AppleTalk BufferLength DS.B 2 ; Word - BufferPtr DS.B 4 ; Long - UserBytes DS.B 4 ; Long - ActualLength DS.B 2 ; Word - ENDR OPEN_SOCKET_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - DDP command to execute Result DS.B 2 ; Word - error result from DDP operation socketNumber DS.B 1 ; Byte - socket number opened clientAddr DS.B 4 ; Long - client address ENDR CLOSE_SOCKET_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - DDP commnd to execute Result DS.B 2 ; Word - error result from DDP operation socketNumber DS.B 1 ; Byte - socket # to close ENDR SEND_DATAGRAM_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - DDP command to execute Result DS.B 2 ; Word - error result from DDP operation checksum DS.B 1 ; Byte - calculated checksum destNet DS.B 2 ; Word - destination network # destNode DS.B 1 ; Byte - destination node # destSocket DS.B 1 ; Byte - destination socket # sourceSocket DS.B 1 ; Byte - DDP socket to send from ddpType DS.B 1 ; Byte - DDP protocol type BDSPtr DS.B 4 ; Long - pointer to the DDP BDS buffer ENDR LAP_WRITE_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - lap command to execute Result DS.B 2 ; Word - lap error result code destNode DS.B 1 ; Byte - destination node to send packet to lapType DS.B 1 ; Byte - lap protocol type to send lapBDSPtr DS.B 4 ; Long - pointer to the lap BDS buffer ENDR READ_BUFFER_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - LAP command to execute Result DS.B 2 ; Word - error result of the LAP operation requestCount DS.B 2 ; Word - how many BYTEs to transfer bufferPtr DS.B 4 ; Long - pointer to a buffer to store info purge DS.B 1 ; Byte - flag for purging the buffer if wrong size amountTransfered DS.B 2 ; Word - actual amount transfered ENDR ATTACH_PROT_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - LAP command to execute Result DS.B 2 ; Word - error result of LAP operation protType DS.B 1 ; Byte - protocol type specifing the LAP type protAddr DS.B 4 ; Long - protocol address specifing the LAP handler ENDR REMOVE_PROT RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - LAP command to execute Result DS.B 2 ; Word - error result of LAP operation protType DS.B 1 ; Byte - protocol type specifing the LAP type ENDR BDS RECORD 0 ; AppleTalk BufLen DS.B 2 ; Word - BufPtr DS.B 4 ; Long - ENDR REGISTER_NAME_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - NBP command to execute Result DS.B 2 ; Word - error result from NBP operation completionPtr DS.B 4 ; Long - pointer to the completion routine namePtr DS.B 4 ; Long - pointer to the entityType rinterval DS.B 1 ; Byte - timeOut period before retrying rcount DS.B 1 ; Byte - number of retries to attempt reserved DS.B 2 ; Word - reserved for future use socketNumber DS.B 1 ; Byte - socket listner being registered checkFlag DS.B 1 ; Byte - flag for checking duplicate names ENDR REMOVE_NAME_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - NBP command to execute Result DS.B 2 ; Word - error result from NBP operation entityPtr DS.B 4 ; Long - pointer to the entity entityType ENDR LOOKUP_NAME_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - NBP command to execute Result DS.B 2 ; Word - error result from NBP operation completionPtr DS.B 4 ; Long - pointer to the completion routine entityPtr DS.B 4 ; Long - pointer to the entity entityType rinterval DS.B 1 ; Byte - timeout interval before retrying rcount DS.B 1 ; Byte - number of retries to attempt reserved DS.B 2 ; Word - reserved for future use bufferLength DS.B 2 ; Word - length of the user buffer bufferPtr DS.B 4 ; Long - pointer to the user buffer maxMatch DS.B 1 ; Byte - maxiumn number of name matches actualMatch DS.B 1 ; Byte - actual number of matches ENDR CONFIRM_NAME_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - NBP command to execute Result DS.B 2 ; Word - error result from NBP operation completionPtr DS.B 4 ; Long - pointer to the completion routine entityPtr DS.B 4 ; Long - pointer to the entity name rinterval DS.B 1 ; Byte - timeout interval before retrying rcount DS.B 1 ; Byte - number of retries to attempt reserved DS.B 2 ; Word - reserved for future use networkID DS.B 2 ; Word - network number for confirmation nodeID DS.B 1 ; Byte - node number for confirmation socketID DS.B 1 ; Byte - socket number for confirmation actualSocketID DS.B 1 ; Byte - actual socket number confirmed ENDR PAP_STATUS_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine printerNamePtr DS.B 4 ; Long - pointer to the printer name statusBuffPtr DS.B 4 ; Long - pointer to the status buffer ENDR PAP_OPEN_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine sessRefID DS.B 1 ; Byte - session reference number printerNamePtr DS.B 4 ; Long - printer name pointer flowQuantum DS.B 1 ; Byte - number of ATP packets to be sent statusBuffPtr DS.B 4 ; Long - pointer to the status buffer ENDR PAP_CLOSE_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine sessRefID DS.B 1 ; Byte - session referance number ENDR PAP_READ_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine sessRefID DS.B 1 ; Byte - session reference # buffLength DS.B 2 ; Word - length of the user buffer buffPtr DS.B 4 ; Long - pointer to the user buffer papEOF DS.B 1 ; Byte - end of file flag ENDR PAP_WRITE_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine sessRefID DS.B 1 ; Byte - session reference # dataLength DS.B 2 ; Word - data length buffPtr DS.B 4 ; Long - pointer to the buffer papEOF DS.B 1 ; Byte - end of file flag ENDR PAP_UNLOAD_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PAP command to execute Result DS.B 2 ; Word - error result from a PAP operation completionPtr DS.B 4 ; Long - pointer to the completion routine ENDR FI_USER_PREFIX_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation DirectionFlag DS.B 1 ; Byte - high bit set to point to by User Pointer is stored in PFI UserNamePtr DS.B 2 ; Word - name pointed to my User Mane Pointer ENDR FI_LOGIN_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation networkID DS.B 2 ; Word - network number for confirmation nodeID DS.B 1 ; Byte - node number for confirmation socketID DS.B 1 ; Byte - socket number for confirmation cmdbufferLength DS.B 2 ; Word - length of the user command buffer cmdbufferPtr DS.B 4 ; Long - pointer to the user command buffer rplybufferLength DS.B 2 ; Word - length of the reply buffer rplybufferPtr DS.B 4 ; Long - pointer to the reply buffer sessRefID DS.B 1 ; Byte - session reference number AttnRtnAddr DS.B 4 ; Long - ENDR FI_LOGIN_CONT_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation sessRefID DS.B 1 ; Byte - session reference number cmdbufferLength DS.B 2 ; Word - length of the user command buffer cmdbufferPtr DS.B 4 ; Long - pointer to the user command buffer rplybufferLength DS.B 2 ; Word - length of the reply buffer rplybufferPtr DS.B 4 ; Long - pointer to the reply buffer ENDR FI_LOGOUT_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation sessRefID DS.B 1 ; Byte - session reference number ENDR FI_MOUNTVOL_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation sessRefID DS.B 1 ; Byte - session reference number mountflag DS.B 1 ; Byte - mount flag field specifies whether the vol is to be mounted volNamePtr DS.B 4 ; Long - pointer to the volume that will be pseudo-mounted volID DS.B 2 ; Word - volume ID returned by AFP slotDrive DS.B 1 ; Byte - the slot/drive in ProDOS format into which the volume was pseudo-mounted passwordPtr DS.B 4 ; Long - pointer to password for the pseudo-mounted volume ENDR FI_LIST_SESSIONS_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation buffLength DS.B 2 ; Word - length of the user buffer buffPtr DS.B 4 ; Long - pointer to the user buffer entriesRtn DS.B 1 ; Byte - contains the number of entries returned from the list of current sessions */ being maintained through the PFI and any volumes mounted for those sessions ENDR FI_TIME_ZONE_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation timeFlag DS.B 1 ; Byte - depending on bit set of the time falg field indicates whether the time should be added to or subtracted from the time zone selected ENDR FI_GET_SRCPATH_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation buffPtr DS.B 4 ; Long - pointer to the user buffer where the pathname will be placed ENDR FI_ACCESS_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation directionalFlag DS.B 1 ; Byte - if bit 7 of the directional flag is set, the access is being set accessRights DS.B 4 ; Long - access rights in AFP format pathnamePtr DS.B 4 ; Long - pointer the path name containing that volume creatorNamePtr DS.B 4 ; Long - if bit 6 of the directional flag is set, the creator's name will be dealt with groupNamePtr DS.B 4 ; Long - if bit 5 of the directional flag is set, the group name will be dealt with ENDR FI_NAMING_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation directionalFlag DS.B 1 ; Byte - if bit 7 of the directional flag is set, the naming convention is being set namingconvFlag DS.B 1 ; Byte - if bit 7 of the naming convention flag is set, the naming convention becomes AFP format ENDR CONVERT_TIME_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation formatFlag DS.B 1 ; Byte - if the format flag is set to 0, then from date time is AFP format if the format flag is set to 1, then from date time is ProDOS format fromDateTime DS.B 4 ; Long - this field contains the From DATE/Time data (values) to convert, not pointers toDateTime DS.B 4 ; Long - this field contains the TO DATE/Time data (values) to convert, not pointers ENDR FI_SET_BUFFER_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PFI command to execute Result DS.B 2 ; Word - error result from PFI operation DirFlag DS.B 1 ; Byte - $00 or $80 BufLen DS.B 2 ; Word - Buffer Length BufPtr DS.B 4 ; Long - if the format flag is set to 0, then from date time is AFP format ENDR LIST_SESSIONS_BUFFER RECORD 0 ; AppleTalk RefNum DS.B 1 ; Byte - SlotDrive DS.B 1 ; Byte - VolName DS.B 28 ; char[28] - VolID DS.B 2 ; Word - ENDR PM_SET_PRINTER_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - PM command to execute Result DS.B 2 ; Word - error code returned from a PM operation entityPtr DS.B 4 ; Long - pointer to the entity name PMFlags DS.B 1 ; Byte - PM operation flags flushInterval DS.B 2 ; Word - flush interval timeOut DS.B 2 ; Word - timeOut numberbuff DS.B 2 ; Word - nubmer of buffers allocated ENDR GET_MY_ZONE_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ZIP Command to execute Result DS.B 2 ; Word - error result from a ZIP operation completionPtr DS.B 4 ; Long - Pointer to the completion routine buffPtr DS.B 4 ; Long - pointe to the buffer timeOut DS.B 1 ; Byte - timeout interval for retrying retry DS.B 1 ; Byte - number of retries to attempt reserved DS.B 2 ; Word - reserved for future use ENDR GET_ZONE_LIST_PARAM RECORD 0 ; AppleTalk async DS.B 1 ; Byte - asyncronous flag Command DS.B 1 ; Byte - ZIP command to execute Result DS.B 2 ; Word - error result from a ZIP operation completionPtr DS.B 4 ; Long - pointer to the completion routine buffLength DS.B 2 ; Word - length of the user buffer buffPtr DS.B 4 ; Long - pointer to the user buffer bridgeNodeID DS.B 1 ; Byte - bridge node number startIndex DS.B 2 ; Word - starting index of the buffer timeOut DS.B 1 ; Byte - timeout interval for retrying retry DS.B 1 ; Byte - number of retries to attempt zonesFound DS.B 2 ; Word - number of zones found reserved DS.B 2 ; Word - reserved for future use (not clear in manual) ENDR CMD_BLOCK RECORD 0 ; AppleTalk CmdLen DS.B 2 ; Word - AFP Command Length CmdBlkAddr DS.B 4 ; Pointer - Address of AFP Command ReplyLen DS.B 2 ; Word - Size of Reply Buffer ReplyBuf DS.B 4 ; Pointer - Address of Reply Buffer WriteLen DS.B 2 ; Word - Size of Data to be written WriteBuf DS.B 4 ; Pointer - Address of Write Buffer ENDR ; File: E16.ACE ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; aceNoError EQU $0 aceIsActive EQU $1D01 aceBadDP EQU $1D02 aceNotActive EQU $1D03 ; Error - aceNoSuchParam EQU $1D04 aceBadMethod EQU $1D05 aceBadSrc EQU $1D06 aceBadDest EQU $1D07 aceDatatOverlap EQU $1D08 aceNotImplemented EQU $1DFF ; File: E16.ADB ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; cmndIncomplete EQU $0910 ; error - Command not completed. cantSync EQU $0911 ; error - Can't synchronize adbBusy EQU $0982 ; error - Busy (command pending) devNotAtAddr EQU $0983 ; error - Device not present at address srqListFull EQU $0984 ; error - List full readModes EQU $000A readConfig EQU $000B readADBError EQU $000C readVersionNum EQU $000D readAvailCharSet EQU $000E readAvailLayout EQU $000F readMicroMem EQU $0009 ADBabort EQU $0001 ; SendInfo - command resetKbd EQU $0002 ; SendInfo - command flushKbd EQU $0003 ; SendInfo - command setModes EQU $0004 ; SendInfo - 2nd param is pointer to mode byte clearModes EQU $0005 ; SendInfo - 2nd param is pointer to mode Byte setConfig EQU $0006 ; SendInfo - 2nd param is pointer to SetConfigRec synch EQU $0007 ; SendInfo - 2nd param is pointer to SynchRec writeMicroMem EQU $0008 ; SendInfo - 2nd param is pointer to MicroControlMemRec resetSys EQU $0010 ; SendInfo - command keyCode EQU $0011 ; SendInfo - 2nd param is pointer to key code byte. resetADB EQU $0040 ; SendInfo - command transmitADBBytes EQU $0047 ; SendInfo - add number of bytes to this enableSRQ EQU $0050 ; SendInfo - command - ADB address in low nibble flushADBDevBuf EQU $0060 ; SendInfo - command - ADB address in low nibble disableSRQ EQU $0070 ; SendInfo - command - ADB address in low nibble transmit2ADBBytes EQU $0080 ; SendInfo - add ADB address to this listen EQU $0080 ; SendInfo - adbCommand = listen + ( 16 * reg) + (adb address) talk EQU $00C0 ; SendInfo - adbCommand = talk + ( 16 * reg) + (adb address) ; offset constants for ReadConfigRec orcRepeatDelay EQU 0 orcLayoutOrLang EQU 1 orcADBAddr EQU 2 ; offset constants for SetConfigRec oscADBAddr EQU 0 oscLayoutOrLang EQU 1 oscRepeatDelay EQU 2 ; offset constants for SynchRec osynchMode EQU 0 osynchKybdMouseAddr EQU 1 osynchLayoutOrLang EQU 2 osynchRepeatDelay EQU 3 ; offset constants for ScaleRec oxDivide EQU 0 oyDivide EQU 2 oxOffset EQU 4 oyOffset EQU 6 oxMultiply EQU 8 oyMultiply EQU 10 ; File: E16.AppleTalk ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; atGetInfoCommand EQU $02 atGetGlobalCommand EQU $03 atInstallTimerCommand EQU $04 atRemoveTimerCommand EQU $05 atBootCommand EQU $06 atLapWriteCommand EQU $07 atReadBufferCommand EQU $08 atAttachProtCommand EQU $09 atRemoveProtCommand EQU $0a atOpenSocketCommand EQU $0b atCloseSocketCommand EQU $0c atSendDatagramCommand EQU $0d atRegisterNameCommand EQU $0e atRemoveNameCommand EQU $0f atLookupNameCommand EQU $10 atConfirmNameCommand EQU $11 atSendATPReqCommand EQU $12 atCancelATPReqCommand EQU $13 atOpenATPSocketCommand EQU $14 atCloseATPSocketCommand EQU $15 atGetATPReqCommand EQU $16 atSendATPRespCommand EQU $17 atAddATPRespCommand EQU $18 atRelATPCBCommand EQU $19 atGetMyZoneCommand EQU $1a atGetZoneListCommand EQU $1b atSPGetParmsCommand EQU $1c atSPGetStatusCommand EQU $1d atSPOpenSessionCommand EQU $1e atSPCloseSessionCommand EQU $1f atSPCommandCommand EQU $20 atSPWriteCommand EQU $21 atPAPStatusCommand EQU $22 atPAPOpenCommand EQU $23 atPAPCloseCommand EQU $24 atPAPReadCommand EQU $25 atPAPWriteCommand EQU $26 atPAPUnloadCommand EQU $27 atPMSetPrinterCommand EQU $28 atFIUserPrefixCommand EQU $2a atFILoginCommand EQU $2b atFILoginContCommand EQU $2c atFILogOutCommand EQU $2d atFIMountVolCommand EQU $2e atFIListSessionsCommand EQU $2f atFITimeZoneCommand EQU $30 atFIGetSrcPathCommand EQU $31 atFIAccessCommand EQU $32 atFINamingCommand EQU $33 atConvertTimeCommand EQU $34 atFISetBufferCommand EQU $36 atinvalidCmdErr EQU $101 ; Error - Invalid command atmemoryErr EQU $102 ; Error - Heap/memory management error attimerErr EQU $103 ; Error - No timer installed error atsyncErr EQU $104 ; Error - Syncronous only call attooManyTimes EQU $105 ; Error - Too many times atlapNoPacketErr EQU $201 ; LAP Error - No packet in buffer atlapEOBErr EQU $202 ; LAP Error - End of buffer atlapLenErr EQU $203 ; LAP Error - LAP data too large atlapFailedErr EQU $204 ; LAP Error - Retry count exhausted atlapTypeErr EQU $205 ; LAP Error - Illegal LAP type atlapDuplicateErr EQU $206 ; LAP Error - Duplicate LAP type atlapProtocolErr EQU $207 ; LAP Error - Too many protocols atlapTypeFoundErr EQU $208 ; LAP Error - Type not found atlapDataLostErr EQU $209 ; LAP Error - Data lost in Purge atddpSktNumErr EQU $301 ; DDP Error - Too many sockets open atddpSktErr EQU $302 ; DDP Error - Socket not open atddpSktOpenErr EQU $303 ; DDP Error - Socket already open atddpSktTypeErr EQU $304 ; DDP Error - Invalid Socket Type atddpLenErr EQU $305 ; DDP Error - DDP length error atddpBridgeErr EQU $306 ; DDP Error - No bridge available atnbpNameNumberErr EQU $401 ; NBP Error - Too many names atnbpNameExistErr EQU $402 ; NBP Error - Name already exists atnbpNameFoundErr EQU $403 ; NBP Error - Name not found atnbpBufferErr EQU $404 ; NBP Error - User buffer full atnbpWildcardErr EQU $405 ; NBP Error - Wildcard not allowed atnbpNameErr EQU $406 ; NBP Error - Invalid name format atnbpAddressErr EQU $407 ; NBP Error - Incorrect address atnbpProcessErr EQU $408 ; NBP Error - Too many NBP processes atatpDataLenErr EQU $501 ; ATP Error - ATP data too large atatpSocketErr EQU $502 ; ATP Error - Invalid ATP socket atatpControlBlkErr EQU $503 ; ATP Error - ATP control block not found atatpProcessErr EQU $504 ; ATP Error - Too many active ATP calls atatpReleaseErr EQU $505 ; ATP Error - No release received atatpNoRespActive EQU $506 ; ATP Error - No response active atatpRespErr EQU $507 ; ATP Error - No send response active atatpReqErr EQU $508 ; ATP Error - ATP send request aborted atatpSktClosedErr EQU $509 ; ATP Error - socket closed error atatpTooManySkts EQU $50A ; ATP Error - Too many ATP sockets atatpTooManyResp EQU $50B ; ATP Error - Too many responses expected atatpDDPSktErr EQU $50C ; ATP Error - Unable to open DDP socket atatpSndRespRelErr EQU $50D ; ATP Error - ATP Send Response was released atzipNetworkErr EQU $601 ; ZIP Error - Network error atzipOverflow EQU $602 ; ZIP Error - ZIP overflow atzipNotFound EQU $603 ; ZIP Error - ZIP not found ataspNetworkErr EQU $701 ; ASP Error - Network error ataspSessNumErr EQU $702 ; ASP Error - Too many sessions ataspRefErr EQU $703 ; ASP Error - Invalid reference number ataspSizeErr EQU $704 ; ASP Error - Size error ataspBufErr EQU $705 ; ASP Error - Buffer error ataspNoRespErr EQU $706 ; ASP Error - No response from server ataspBadVersion EQU $707 ; ASP Error - Bad version number ataspTooManySessions EQU $708 ; ASP Error - Too many sessions ataspServBusyErr EQU $709 ; ASP Error - Server busy ataspSessionClosed EQU $70A ; ASP Error - Session closed atpapSessNumErr EQU $801 ; PAP error - Too many sessions atpapRefErr EQU $802 ; PAP error - Invalid Reference atpapQuantumErr EQU $803 ; PAP error - Quantum Error atpapCommandErr EQU $804 ; PAP error - Too many commands atpapNameErr EQU $805 ; PAP error - Name not found atpapSessionErr EQU $806 ; PAP error - Session closed atpapNetworkErr EQU $807 ; PAP error - Network error atpapServRespErr EQU $808 ; PAP error - Server not responding atpapServBusyErr EQU $809 ; PAP error - Server busy atpapBuffSizeErr EQU $80A ; PAP error - Buffer size error atpapInUseErr EQU $80B ; PAP error - PAP in use atpfiTooManySessErr EQU $A01 ; PFI error - Too many sessions atpfiUnableOpenSessErr EQU $A02 ; PFI error - Unable to open session atpfiNoRespFrmSrvrErr EQU $A03 ; PFI error - No response from server atpfiLoginContErr EQU $A04 ; PFI error - Login continue atpfiInvalidNameErr EQU $A05 ; PFI error - Invalid name atpfiInvalidSessNumErr EQU $A06 ; PFI error - Invalid Sess reference # or unknown volume atpfiUnableOpenVolErr EQU $A07 ; PFI error - Unable to open volume atpfiTooManyVolsOpenErr EQU $A08 ; PFI error - Too many mounted volumes atpfiVolNotMountedErr EQU $A09 ; PFI error - Volume Not Mounted atpfiBufferToSmallErr EQU $A0B ; PFI error - Buffer to small atpfiTimeFlagErr EQU $A0C ; PFI error - Time flag error atpfiUnableTSetGroupErr EQU $A0D ; PFI error - Unable to set creator atpfiDirNotFoundErr EQU $A0E ; PFI error - Directory not found atpfiAccessDeniedErr EQU $A0F ; PFI error - Access denied atpfiMiscellaneousErr EQU $A10 ; PFI error - Miscellaneous error atpfiVolAlreadyMntedErr EQU $A11 ; PFI error - Volume already mounted atpfiUnableGetCrtrErr EQU $A12 ; PFI error - Unable to get creator atpfiAlrdyLggedOnSrvrErr EQU $A13 ; PFI error - Already logged onto server atpfiTimeError EQU $A14 ; PFI error - Time error atpfiUserNotAuthorizedErr EQU $A15 ; PFI error - User not authorized atpfiParamterErr EQU $A16 ; PFI error - Parameter error atpfiSrvrGoingDownErr EQU $A17 ; PFI error - Server going down atpfiBadUAMErr EQU $A18 ; PFI error - Bad UAM atpfiBadVersionNumErr EQU $A19 ; PFI error - Bad version number ; File: E16.Control ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; wmNotStartedUp EQU $1001 ; error - Window manager was not started first. noConstraint EQU $0000 ; Axis Parameter - No constraint on movement. hAxisOnly EQU $0001 ; Axis Parameter - Horizontal axis only. vAxisOnly EQU $0002 ; Axis Parameter - Vertical axis only. simpRound EQU $0000 ; CtlFlag - Simple button flag upFlag EQU $0001 ; CtlFlag - Scroll bar flag. boldButton EQU $0001 ; CtlFlag - Bold round cornered outlined button. simpBRound EQU $0001 ; CtlFlag - Simple button flag downFlag EQU $0002 ; CtlFlag - Scroll bar flag. simpSquare EQU $0002 ; CtlFlag - Simple button flag simpDropSquare EQU $0003 ; CtlFlag - Simple button flag leftFlag EQU $0004 ; CtlFlag - Scroll bar flag. rightFlag EQU $0008 ; CtlFlag - Scroll bar flag. dirScroll EQU $0010 ; CtlFlag - Scroll bar flag. horScroll EQU $0010 ; CtlFlag - Scroll bar flag. family EQU $007F ; CtlFlag - Mask for radio button family number ctlInVis EQU $0080 ; CtlFlag - invisible mask for any type of control inListBox EQU $88 simpleProc EQU $00000000 checkProc EQU $02000000 radioProc EQU $04000000 scrollProc EQU $06000000 growProc EQU $08000000 drawCtl EQU $0000 ; DefProc - Draw control command. calcCRect EQU $0001 ; DefProc - Compute drag RECT command. testCtl EQU $0002 ; DefProc - Hit test command. initCtl EQU $0003 ; DefProc - Initialize command. dispCtl EQU $0004 ; DefProc - Dispose command. posCtl EQU $0005 ; DefProc - Move indicator command. thumbCtl EQU $0006 ; DefProc - Compute drag parameters command. dragCtl EQU $0007 ; DefProc - Drag command. autoTrack EQU $0008 ; DefProc - Action command. newValue EQU $0009 ; DefProc - Set new value command. setParams EQU $000A ; DefProc - Set new parameters command. moveCtl EQU $000B ; DefProc - Move command. recSize EQU $000C ; DefProc - Return record size command. noHilite EQU $0000 ; hiliteState - Param to HiliteControl inactiveHilite EQU $00FF ; hiliteState - Param to HiliteControl noPart EQU $0000 simpleButton EQU $0002 checkBox EQU $0003 radioButton EQU $0004 upArrow EQU $0005 downArrow EQU $0006 pageUp EQU $0007 pageDown EQU $0008 growBox EQU $000A thumb EQU $0081 fCtlTarget EQU $8000 ; CtlRec.ctlMoreFlags - is current target of typing commands fCtlCanBeTarget EQU $4000 ; CtlRec.ctlMoreFlags - can be made the target control fCtlWantEvents EQU $2000 ; CtlRec.ctlMoreFlags - control can be called view SendEventToCtl fCtlProcRefNotPtr EQU $1000 ; CtlRec.ctlMoreFlags - set = ID of defproc, clear = pointer to defproc fCtlTellAboutSize EQU $0800 ; CtlRec.ctlMoreFlags - set if ctl needs notification when size of owning window changes fCtlIsMultiPar EQU $0400 ; CtlRec.ctlMoreFlags - set if ctl needs notification to be hidden titleIsPtr EQU $00 titleIsHandle EQU $01 titleIsResource EQU $02 colorTableIsPtr EQU $00 colorTableIsHandle EQU $04 colorTableIsResource EQU $08 ctlHandleEvent EQU $0D ctlChangeTarget EQU $0E ctlChangeBounds EQU $0F ctlWindChangeSize EQU $10 ctlHandleTab EQU $11 ctlHideCtl EQU $12 singlePtr EQU $0000 singleHandle EQU $0001 singleResource EQU $0002 ptrToPtr EQU $0003 ptrToHandle EQU $0004 ptrToResource EQU $0005 handleToPtr EQU $0006 handleToHandle EQU $0007 handleToResource EQU $0008 resourceToResource EQU $0009 simpleButtonControl EQU $80000000 checkControl EQU $82000000 radioControl EQU $84000000 scrollBarControl EQU $86000000 growControl EQU $88000000 statTextControl EQU $81000000 editLineControl EQU $83000000 editTextControl EQU $85000000 popUpControl EQU $87000000 listControl EQU $89000000 iconButtonControl EQU $07FF0001 pictureControl EQU $8D000000 noCtlError EQU $1004 ; Error - no controls in window noSuperCtlError EQU $1005 ; Error - no super controls in window noCtlTargetError EQU $1006 ; Error - no target super control notSuperCtlError EQU $1007 ; Error - action can only be done on super control canNotBeTargetError EQU $1008 ; Error - conrol cannot be made target noSuchIDError EQU $1009 ; Error - specified ID cannot be found tooFewParmsError EQU $100A ; Error - not enough params specified noCtlToBeTargetError EQU $100B ; Error - NextCtl call, no ctl could be target noWind_Err EQU $100C ; Error - there is no front window ; offset constants for BarColors obarOutline EQU 0 obarNorArrow EQU 2 obarSelArrow EQU 4 obarArrowBack EQU 6 obarNorThumb EQU 8 obarSelThumb EQU 10 obarPageRgn EQU 12 obarInactive EQU 14 ; offset constants for BoxColors oboxReserved EQU 0 oboxNor EQU 2 oboxSel EQU 4 oboxTitle EQU 6 ; offset constants for BttnColors obttnOutline EQU 0 obttnNorBack EQU 2 obttnSelBack EQU 4 obttnNorText EQU 6 obttnSelText EQU 8 ; offset constants for CtlRec octlNext EQU 0 octlOwner EQU 4 octlRect EQU 8 octlFlag EQU 16 octlHilite EQU 17 octlValue EQU 18 octlProc EQU 20 octlAction EQU 24 octlData EQU 28 octlRefCon EQU 32 octlColor EQU 36 octlReserved EQU 40 octlID EQU 56 octlMoreFlags EQU 60 octlVersion EQU 62 ; offset constants for LimitBlk oboundRect EQU 0 oslopRect EQU 8 oaxisParam EQU 16 odragPatt EQU 18 ; offset constants for RadioColors oradReserved EQU 0 oradNor EQU 2 oradSel EQU 4 oradTitle EQU 6 ; File: E16.Desk ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; daNotFound EQU $0510 ; error - desk accessory not found notSysWindow EQU $0511 ; error - not the system window eventAction EQU $0001 runAction EQU $0002 undoAction EQU $0005 cutAction EQU $0006 copyAction EQU $0007 pasteAction EQU $0008 clearAction EQU $0009 cursorAction EQU $0003 undo EQU $0001 ; System Edit - edit type cut EQU $0002 ; System Edit - edit type copy EQU $0003 ; System Edit - edit type paste EQU $0004 ; System Edit - edit type clear EQU $0005 ; System Edit - edit type ; File: E16.Dialog ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; badItemType EQU $150A newItemFailed EQU $150B itemNotFound EQU $150C notModalDialog EQU $150D getInitView EQU $0001 getInitTotal EQU $0002 getInitValue EQU $0003 scrollLineUp EQU $0004 scrollLineDown EQU $0005 scrollPageUp EQU $0006 scrollPageDown EQU $0007 scrollThumb EQU $0008 buttonItem EQU $000A checkItem EQU $000B radioItem EQU $000C scrollBarItem EQU $000D userCtlItem EQU $000E statText EQU $000F longStatText EQU $0010 editLine EQU $0011 iconItem EQU $0012 picItem EQU $0013 userItem EQU $0014 userCtlItem2 EQU $0015 longStatText2 EQU $0016 itemDisable EQU $8000 minItemType EQU $000A maxItemType EQU $0016 ok EQU $0001 cancel EQU $0002 inButton EQU $0002 ; ModalDialog2 - Part code inCheckBox EQU $0003 ; ModalDialog2 - Part code inRadioButton EQU $0004 ; ModalDialog2 - Part code inUpArrow EQU $0005 ; ModalDialog2 - Part code inDownArrow EQU $0006 ; ModalDialog2 - Part code inPageUp EQU $0007 ; ModalDialog2 - Part code inPageDown EQU $0008 ; ModalDialog2 - Part code inStatText EQU $0009 ; ModalDialog2 - Part code inGrow EQU $000A ; ModalDialog2 - Part code inEditLine EQU $000B ; ModalDialog2 - Part code inUserItem EQU $000C ; ModalDialog2 - Part code inLongStatText EQU $000D ; ModalDialog2 - Part code inIconItem EQU $000E ; ModalDialog2 - Part code inLongStatText2 EQU $000F inThumb EQU $0081 ; ModalDialog2 - Part code okDefault EQU $0000 cancelDefault EQU $0040 alertDrawn EQU $0080 ; offset constants for ItemTemplate oitemID EQU 0 oitemRect EQU 2 oitemType EQU 10 oitemDescr EQU 12 oitemValue EQU 16 oitemFlag EQU 18 oitemColor EQU 20 ; offset constants for AlertTemplate oatBoundsRect EQU 0 oatAlertID EQU 8 oatStage1 EQU 10 oatStage2 EQU 11 oatStage3 EQU 12 oatStage4 EQU 13 oatItemList EQU 14 ; offset constants for DialogTemplate odtBoundsRect EQU 0 odtVisible EQU 8 odtRefCon EQU 10 odtItemList EQU 14 ; offset constants for IconRecord oiconRect EQU 0 oiconImage EQU 8 ; offset constants for UserCtlItemPB odefProcParm EQU 0 otitleParm EQU 4 oparam2 EQU 8 oparam1 EQU 10 ; File: E16.Event ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; emDupStrtUpErr EQU $0601 ; error - duplicate EMStartup Call emResetErr EQU $0602 ; error - can't reset error the Event Manager emNotActErr EQU $0603 ; error - event manager not active emBadEvtCodeErr EQU $0604 ; error - illegal event code emBadBttnNoErr EQU $0605 ; error - illegal button number emQSiz2LrgErr EQU $0606 ; error - queue size too large emNoMemQueueErr EQU $0607 ; error - not enough memory for queue emBadEvtQErr EQU $0681 ; error - fatal sys error - event queue damaged emBadQHndlErr EQU $0682 ; error - fatal sys error - queue handle damaged nullEvt EQU $0000 mouseDownEvt EQU $0001 mouseUpEvt EQU $0002 keyDownEvt EQU $0003 autoKeyEvt EQU $0005 updateEvt EQU $0006 activateEvt EQU $0008 switchEvt EQU $0009 deskAccEvt EQU $000A driverEvt EQU $000B app1Evt EQU $000C app2Evt EQU $000D app3Evt EQU $000E app4Evt EQU $000F mDownMask EQU $0002 mUpMask EQU $0004 keyDownMask EQU $0008 autoKeyMask EQU $0020 updateMask EQU $0040 activeMask EQU $0100 switchMask EQU $0200 deskAccMask EQU $0400 driverMask EQU $0800 app1Mask EQU $1000 app2Mask EQU $2000 app3Mask EQU $4000 app4Mask EQU $8000 everyEvent EQU $FFFF jcTickCount EQU $00 ; Journal Code - TickCount call jcGetMouse EQU $01 ; Journal Code - GetMouse call jcButton EQU $02 ; Journal Code - Button call jcEvent EQU $04 ; Journal Code - GetNextEvent and EventAvail calls activeFlag EQU $0001 ; Modifier Flags - set if window being activated changeFlag EQU $0002 ; Modifier Flags - set if active wind. changed state btn1State EQU $0040 ; Modifier Flags - set if button 1 up btn0State EQU $0080 ; Modifier Flags - set if button 0 up appleKey EQU $0100 ; Modifier Flags - set if Apple key down shiftKey EQU $0200 ; Modifier Flags - set if shift key down capsLock EQU $0400 ; Modifier Flags - set if caps lock key down optionKey EQU $0800 ; Modifier Flags - set if option key down controlKey EQU $1000 ; Modifier Flags - set if Control key down keyPad EQU $2000 ; Modifier Flags - set if keypress from key pad ; offset constants for EventRecord owhat EQU 0 omessage EQU 2 owhen EQU 6 owhere EQU 10 omodifiers EQU 14 owmTaskData EQU 16 owmTaskMask EQU 20 owmLastClickTick EQU 24 owmClickCount EQU 28 owmTaskData2 EQU 30 owmTaskData3 EQU 34 owmTaskData4 EQU 38 owmLastClickPt EQU 42 ; File: E16.Font ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; fmDupStartUpErr EQU $1B01 ; error - duplicate FMStartUp call fmResetErr EQU $1B02 ; error - can't reset the Font Manager fmNotActiveErr EQU $1B03 ; error - Font Manager not active fmFamNotFndErr EQU $1B04 ; error - family not found fmFontNtFndErr EQU $1B05 ; error - font not found fmFontMemErr EQU $1B06 ; error - font not in memory fmSysFontErr EQU $1B07 ; error - system font cannot be purgeable fmBadFamNumErr EQU $1B08 ; error - illegal family number fmBadSizeErr EQU $1B09 ; error - illegal size fmBadNameErr EQU $1B0A ; error - illegal name length fmMenuErr EQU $1B0B ; error - fix font menu never called fmScaleSizeErr EQU $1B0C ; error - scaled size of font exeeds limits newYork EQU $0002 geneva EQU $0003 monaco EQU $0004 venice EQU $0005 london EQU $0006 athens EQU $0007 sanFran EQU $0008 toronto EQU $0009 cairo EQU $000B losAngeles EQU $000C times EQU $0014 helvetica EQU $0015 courier EQU $0016 symbol EQU $0017 taliesin EQU $0018 shaston EQU $FFFE baseOnlyBit EQU $0020 notBaseBit EQU $0020 memOnlyBit EQU $0001 realOnlyBit EQU $0002 anyFamBit EQU $0004 anyStyleBit EQU $0008 anySizeBit EQU $0010 memBit EQU $0001 unrealBit EQU $0002 apFamBit EQU $0004 apVarBit EQU $0008 purgeBit EQU $0010 notDiskBit EQU $0020 notFoundBit EQU $8000 dontScaleBit EQU $0001 ; offset constants for FontStatRec oresultID EQU 0 oresultStats EQU 4 ; File: E16.GSOS ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; readEnable EQU $0001 ; access - read enable bit: CreateRec, OpenRec access and requestAccess fields writeEnable EQU $0002 ; access - write enable bit: CreateRec, OpenRec access and requestAccess fields fileInvisible EQU $0004 ; access - Invisible bit backupNeeded EQU $0020 ; access - backup needed bit: CreateRec, OpenRec access field. (Must be 0 in requestAccess field ) renameEnable EQU $0040 ; access - rename enable bit: CreateRec, OpenRec access and requestAccess fields destroyEnable EQU $0080 ; access - destroy enable bit: CreateRec, OpenRec access and requestAccess fields startPlus EQU $0000 ; base - > setMark = displacement eofMinus EQU $0001 ; base - > setMark = eof - displacement markPlus EQU $0002 ; base - > setMark = mark + displacement markMinus EQU $0003 ; base - > setMark = mark - displacement cacheOff EQU $0000 ; cachePriority - do not cache blocks invloved in this read cacheOn EQU $0001 ; cachePriority - cache blocks invloved in this read if possible badSystemCall EQU $0001 ; error - bad system call number invalidPcount EQU $0004 ; error - invalid parameter count gsosActive EQU $07 ; error - GS/OS already active IF &FINDSYM(&SYSGLOBAL,'DEVNOTFOUND')=0 AND &FINDSYM(&SYSGLOBAL,'devnotfound')=0 THEN ; error - device not found devNotFound EQU $10 ENDIF invalidDevNum EQU $11 ; error - invalid device number drvrBadReq EQU $20 ; error - bad request or command drvrBadCode EQU $0021 ; error - bad control or status code drvrBadParm EQU $0022 ; error - bad call parameter drvrNotOpen EQU $0023 ; error - character device not open drvrPriorOpen EQU $0024 ; error - character device already open irqTableFull EQU $0025 ; error - interrupt table full drvrNoResrc EQU $0026 ; error - resources not available drvrIOError EQU $0027 ; error - I/O error drvrNoDevice EQU $0028 ; error - device not connected drvrBusy EQU $0029 ; error - call aborted, driver is busy drvrWrtProt EQU $002B ; error - device is write protected drvrBadCount EQU $002C ; error - invalid byte count drvrBadBlock EQU $002D ; error - invalid block address drvrDiskSwitch EQU $002E ; error - disk has been switched drvrOffLine EQU $002F ; error - device off line/ no media present badPathSyntax EQU $0040 ; error - invalid pathname syntax invalidRefNum EQU $0043 ; error - invalid reference number IF &FINDSYM(&SYSGLOBAL,'PATHNOTFOUND')=0 AND &FINDSYM(&SYSGLOBAL,'pathnotfound')=0 THEN ; error - subdirectory does not exist pathNotFound EQU $44 ENDIF volNotFound EQU $0045 ; error - volume not found IF &FINDSYM(&SYSGLOBAL,'FILENOTFOUND')=0 AND &FINDSYM(&SYSGLOBAL,'filenotfound')=0 THEN ; error - file not found fileNotFound EQU $0046 ENDIF dupPathname EQU $0047 ; error - create or rename with existing name volumeFull EQU $0048 ; error - volume full error volDirFull EQU $0049 ; error - volume directory full badFileFormat EQU $004A ; error - version error (incompatible file format) IF &FINDSYM(&SYSGLOBAL,'BADSTORETYPE')=0 AND &FINDSYM(&SYSGLOBAL,'badstoretype')=0 THEN ; error - unsupported (or incorrect) storage type badStoreType EQU $004B ENDIF IF &FINDSYM(&SYSGLOBAL,'EOFENCOUNTERED')=0 AND &FINDSYM(&SYSGLOBAL,'eofencountered')=0 THEN ; error - end-of-file encountered eofEncountered EQU $004C ENDIF outOfRange EQU $004D ; error - position out of range invalidAccess EQU $004E ; error - access not allowed buffTooSmall EQU $004F ; error - buffer too small fileBusy EQU $0050 ; error - file is already open dirError EQU $0051 ; error - directory error unknownVol EQU $0052 ; error - unknown volume type IF &FINDSYM(&SYSGLOBAL,'PARAMRANGEERR')=0 AND &FINDSYM(&SYSGLOBAL,'paramrangeerr')=0 THEN ; error - parameter out of range paramRangeErr EQU $0053 ENDIF outOfMem EQU $0054 ; error - out of memory dupVolume EQU $0057 ; error - duplicate volume name notBlockDev EQU $0058 ; error - not a block device IF &FINDSYM(&SYSGLOBAL,'INVALIDLEVEL')=0 AND &FINDSYM(&SYSGLOBAL,'invalidlevel')=0 THEN ; error - specifield level outside legal range invalidLevel EQU $0059 ENDIF damagedBitMap EQU $005A ; error - block number too large badPathNames EQU $005B ; error - invalid pathnames for ChangePath notSystemFile EQU $005C ; error - not an executable file osUnsupported EQU $005D ; error - Operating System not supported IF &FINDSYM(&SYSGLOBAL,'STACKOVERFLOW')=0 AND &FINDSYM(&SYSGLOBAL,'stackoverflow')=0 THEN ; error - too many applications on stack stackOverflow EQU $005F ENDIF dataUnavail EQU $0060 ; error - Data unavailable endOfDir EQU $0061 ; error - end of directory has been reached invalidClass EQU $0062 ; error - invalid FST call class resForkNotFound EQU $0063 ; error - file does not contain required resource invalidFSTID EQU $0064 ; error - error - FST ID is invalid ProDOSFSID EQU $0001 ; fileSysID - ProDOS/SOS dos33FSID EQU $0002 ; fileSysID - DOS 3.3 dos32FSID EQU $0003 ; fileSysID - DOS 3.2 dos31FSID EQU $0003 ; fileSysID - DOS 3.1 appleIIPascalFSID EQU $0004 ; fileSysID - Apple II Pascal mfsFSID EQU $0005 ; fileSysID - Macintosh (flat file system) hfsFSID EQU $0006 ; fileSysID - Macintosh (hierarchical file system) lisaFSID EQU $0007 ; fileSysID - Lisa file system appleCPMFSID EQU $0008 ; fileSysID - Apple CP/M charFSTFSID EQU $0009 ; fileSysID - Character FST msDOSFSID EQU $000A ; fileSysID - MS/DOS highSierraFSID EQU $000B ; fileSysID - High Sierra ISO9660FSID EQU $000C ; fileSysID - ISO 9660 characterFST EQU $4000 ; FSTInfo.attributes - character FST ucFST EQU $8000 ; FSTInfo.attributes - SCM should upper case pathnames before passing them to the FST onStack EQU $8000 ; QuitRec.flags - place state information about quitting program on the quit return stack restartable EQU $4000 ; QuitRec.flags - the quitting program is capable of being restarted from its dormant memory seedling EQU $0001 ; storageType - standard file with seedling structure standardFile EQU $0001 ; storageType - standard file type (no resource fork) sapling EQU $0002 ; storageType - standard file with sapling structure tree EQU $0003 ; storageType - standard file with tree structure pascalRegion EQU $0004 ; storageType - UCSD Pascal region on a partitioned disk extendedFile EQU $0005 ; storageType - extended file type (with resource fork) directoryFile EQU $000D ; storageType - volume directory or subdirectory file minorRelNumMask EQU $00FF ; version - minor release number majorRelNumMask EQU $7F00 ; version - major release number finalRelNumMask EQU $8000 ; version - final release number isFileExtended EQU $8000 PrefixRecGS RECORD 0 ; GSOS pCount DS.B 2 ; Word - prefixNum DS.B 2 ; Word - prefix DS.B 4 ; ResultBuf255Ptr or GSString255Ptr - ENDR ; File: E16.IntMath ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; imBadInptParam EQU $0B01 ; error - bad input parameter imIllegalChar EQU $0B02 ; error - Illegal character in string imOverflow EQU $0B03 ; error - integer or long integer overflow imStrOverflow EQU $0B04 ; error - string overflow minLongint EQU $80000000 ; Limit - minimum negative signed long integer minFrac EQU $80000000 ; Limit - pinned value for negative Frac overflow minFixed EQU $80000000 ; Limit - pinned value for negative Fixed overflow minInt EQU $8000 ; Limit - Minimum negative signed integer maxInt EQU $7FFF ; Limit - Maximum positive signed integer maxUInt EQU $FFFF ; Limit - Maximum positive unsigned integer maxLongint EQU $7FFFFFFF ; Limit - maximum positive signed Longint maxFrac EQU $7FFFFFFF ; Limit - pinned value for positive Frac overflow maxFixed EQU $7FFFFFFF ; Limit - pinned value for positive Fixed overflow maxULong EQU $FFFFFFFF ; Limit - maximum unsigned Long unsignedFlag EQU $0000 signedFlag EQU $0001 ; offset constants for IntDivRec oidquotient EQU 0 oidremainder EQU 2 ; offset constants for LongDivRec oldquotient EQU 0 oldremainder EQU 4 ; offset constants for LongMulRec olsResult EQU 0 omsResult EQU 4 ; offset constants for WordDivRec owdquotient EQU 0 owdremainder EQU 2 ; File: E16.LineEdit ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; leDupStrtUpErr EQU $1401 ; error - duplicate LEStartup call leResetErr EQU $1402 ; error - can't reset Line Edit leNotActiveErr EQU $1403 ; error - Line Edit not active leScrapErr EQU $1404 ; error - desk scrap too big to copy leJustLeft EQU $0000 leJustCenter EQU $0001 leJustFill EQU $0002 leJustRight EQU $FFFF ; offset constants for LERec oleLineHandle EQU 0 oleLength EQU 4 oleMaxLength EQU 6 oleDestRect EQU 8 oleViewRect EQU 16 olePort EQU 24 oleLineHite EQU 28 oleBaseHite EQU 30 oleSelStart EQU 32 oleSelEnd EQU 34 oleActFlg EQU 36 oleCarAct EQU 38 oleCarOn EQU 40 oleCarTime EQU 42 oleHiliteHook EQU 46 oleCaretHook EQU 50 oleJust EQU 54 olePWChar EQU 56 ; File: E16.List ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; cString EQU $0001 ; ListType bit mask - null terminated string type LIST_STRG EQU $0001 ; ListType bit mask - null terminated string type selectOnlyOne EQU $0002 ; ListType bit mask - only one selection allowed LIST_SELECT EQU $0002 ; ListType bit mask - single selection only memDisabled EQU $40 ; memFlag - Sets member flag to disabled memSelected EQU $80 ; memFlag - Sets member flag to selected ; offset constants for LColorTable olistFrameClr EQU 0 olistNorTextClr EQU 2 olistSelTextClr EQU 4 olistNorBackClr EQU 6 olistSelBackClr EQU 8 ; offset constants for MemRec omemPtr EQU 0 omemFlag EQU 4 ; Front of ListCtlRec matches CtlRec octlMemDraw EQU 40 octlMemHeight EQU 44 octlMemSize EQU 46 octlList EQU 48 octlListBar EQU 52 ; offset constants for ListRec olistRect EQU 0 olistSize EQU 8 olistView EQU 10 olistType EQU 12 olistStart EQU 14 olistCtl EQU 16 olistDraw EQU 20 olistMemHeight EQU 24 olistMemSize EQU 26 olistPointer EQU 28 olistRefCon EQU 32 olistScrollClr EQU 36 ; File: E16.Loader ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; idNotFound EQU $1101 ; error - segment/application/entry not found idNotLoadFile EQU $1104 ; error - file is not a load file idBusyErr EQU $1105 ; error - system loader is busy idFilVersErr EQU $1107 ; error - file version error idUserIDErr EQU $1108 ; error - user ID error idSequenceErr EQU $1109 ; error - segnum out of sequence idBadRecordErr EQU $110A ; error - illegal load record found idForeignSegErr EQU $110B ; error - segment is foreign ; offset constants for InitialLoadOutputRec ouserID EQU 0 ostartAddr EQU 2 odPageAddr EQU 6 obuffSize EQU 8 ; offset constants for RestartOutRec orouserID EQU 0 orostartAddr EQU 2 orodPageAddr EQU 6 orobuffSize EQU 8 ; offset constants for LoadSegNameOut osegAddr EQU 0 ofileNum EQU 4 osegNum EQU 6 ; offset constants for UnloadSegOutRec oususerID EQU 0 ousfileNum EQU 2 oussegNum EQU 4 ; File: E16.Locator ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; toolNotFoundErr EQU $0001 funcNotFoundErr EQU $0002 toolVersionErr EQU $0110 sysStrtMtErr EQU $0100 ; error - can't mount system startup volume messNotFoundErr EQU $0111 fileInfoType EQU $0001 ; MessageCenter - Message type parameter addMessage EQU $0001 ; MessageCenter - action parameter getMessage EQU $0002 ; MessageCenter - action parameter deleteMessage EQU $0003 ; MessageCenter - action parameter mvReturn EQU $0001 ; TLMountVolume - like ok for dialogs mvEscape EQU $0002 ; TLMountVolume - like cancel for dialogs sysTool EQU $0000 userTool EQU $8000 ; offset constants for MessageRec omessageNext EQU 0 omessageType EQU 4 omessageData EQU 6 ofileNames EQU 8 ; offset constants for ToolSpec otoolNumber EQU 0 ominVersion EQU 2 ; offset constants for StartStopRecord ossflags EQU 0 ossvideoMode EQU 2 ossresFileID EQU 4 ossdPageHandle EQU 6 ossnumTools EQU 10 ; File: E16.Memory ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; memErr EQU $0201 ; error - unable to allocate block emptyErr EQU $0202 ; error - illegal operation, empty handle notEmptyErr EQU $0203 ; error - an empty handle was expected for this operation lockErr EQU $0204 ; error - illegal operation on a locked block purgeErr EQU $0205 ; error - attempt to purge an unpurgable block handleErr EQU $0206 ; error - an invalid handle was given idErr EQU $0207 ; error - an invalid owner ID was given attrErr EQU $0208 ; error - operation illegal on block with given attributes attrNoPurge EQU $0000 ; Handle Attribute Bits - Not purgeable attrBank EQU $0001 ; Handle Attribute Bits - fixed bank attrAddr EQU $0002 ; Handle Attribute Bits - fixed address attrPage EQU $0004 attrNoSpec EQU $0008 attrNoCross EQU $0010 attrPurge1 EQU $0100 ; Handle Attribute Bits - Purge level 1 attrPurge2 EQU $0200 ; Handle Attribute Bits - Purge level 2 attrPurge3 EQU $0300 ; Handle Attribute Bits - Purge level 3 attrPurge EQU $0300 attrHandle EQU $1000 ; Handle Attribute Bits - block of master pointers attrSystem EQU $2000 ; Handle Attribute Bits - system handle attrFixed EQU $4000 ; Handle Attribute Bits - not movable attrLocked EQU $8000 ; Handle Attribute Bits - locked ; File: E16.Menu ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; mDrawMsg EQU $0000 mChooseMsg EQU $0001 mSizeMsg EQU $0002 mDrawTitle EQU $0003 mDrawMItem EQU $0004 mGetMItemID EQU $0005 mInvis EQU $0004 mCustom EQU $0010 mXor EQU $0020 mSelected EQU $0040 mDisabled EQU $0080 customMenu EQU $0010 xorMItemHilite EQU $0020 xorTitleHilite EQU $0020 underMItem EQU $0040 disableItem EQU $0080 disableMenu EQU $0080 enableItem EQU $FF7F enableMenu EQU $FF7F noUnderMItem EQU $FFBF colorMItemHilite EQU $FFDF colorTitleHilite EQU $FFDF colorReplace EQU $FFDF standardMenu EQU $FFEF ; offset constants for MenuRec omenuID EQU 0 omenuWidth EQU 2 omenuHeight EQU 4 omenuProc EQU 6 omenuFlag EQU 10 omenuRes EQU 11 ofirstItem EQU 12 onumOfItems EQU 13 otitleWidth EQU 14 otitleName EQU 16 ; File: E16.Midi ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; miToolNum EQU $0020 miDrvrFileType EQU $00BB miNSVer EQU $0102 miSTVer EQU $0203 miDrvrAuxType EQU $0300 miStartUpErr EQU $2000 miPacketErr EQU $2001 miArrayErr EQU $2002 miFullBufErr EQU $2003 miToolsErr EQU $2004 miOutOffErr EQU $2005 miNoBufErr EQU $2007 miDriverErr EQU $2008 miBadFreqErr EQU $2009 miClockErr EQU $200A miConflictErr EQU $200B miNoDevErr EQU $200C miDevNotAvail EQU $2080 miDevSlotBusy EQU $2081 miDevBusy EQU $2082 miDevOverrun EQU $2083 miDevNoConnect EQU $2084 miDevReadErr EQU $2085 miDevVersion EQU $2086 miDevIntHndlr EQU $2087 miSetClock EQU $0000 miStartClock EQU $0001 miStopClock EQU $0002 miSetFreq EQU $0003 miRawMode EQU $00000000 miSetRTVec EQU $0000 miPacketMode EQU $00000001 miSetErrVec EQU $0001 miStandardMode EQU $00000002 miSetInBuf EQU $0002 miSetOutBuf EQU $0003 miStartInput EQU $0004 miStartOutput EQU $0005 miStopInput EQU $0006 miStopOutput EQU $0007 miFlushInput EQU $0008 miFlushOutput EQU $0009 miFlushPacket EQU $000A miWaitOutput EQU $000B miSetInMode EQU $000C miSetOutMode EQU $000D miClrNotePad EQU $000E miSetDelay EQU $000F miOutputStat EQU $0010 miIgnoreSysEx EQU $0011 miSelectDrvr EQU $0000 miLoadDrvr EQU $0001 miUnloadDrvr EQU $0002 miNextPktLen EQU $0 miInputChars EQU $0001 miOutputChars EQU $0002 miMaxInChars EQU $0003 miMaxOutChars EQU $0004 miRecordAddr EQU $0005 miPlayAddr EQU $0006 miClockValue EQU $0007 miClockFreq EQU $0008 midiInputPoll EQU $00E101B2 ; MidiInputChannel - vector to poll MIDI input channel ; offset constants for MiBufInfo obufSize EQU 0 oaddress EQU 2 ; offset constants for MiDriverInfo oslot EQU 0 oexternal EQU 2 opathname EQU 4 ; File: E16.MiscTool ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; badInputErr EQU $0301 ; error - bad input parameter noDevParamErr EQU $0302 ; error - no device for input parameter taskInstlErr EQU $0303 ; error - task already installed error noSigTaskErr EQU $0304 ; error - no signature in task header queueDmgdErr EQU $0305 ; error - queue has been damaged error taskNtFdErr EQU $0306 ; error - task was not found error firmTaskErr EQU $0307 ; error - firmware task was unsuccessful hbQueueBadErr EQU $0308 ; error - heartbeat queue damaged unCnctdDevErr EQU $0309 ; error - attempted to dispatch to unconnected device idTagNtAvlErr EQU $030B ; error - ID tag not available pdosUnClmdIntErr EQU $0001 ; System Fail - ProDOS unclaimed interrupt error divByZeroErr EQU $0004 ; System Fail - divide by zero error pdosVCBErr EQU $000A ; System Fail - ProDOS VCB unusable pdosFCBErr EQU $000B ; System Fail - ProDOS FCB unusable pdosBlk0Err EQU $000C ; System Fail - ProDOS block zero allocated illegally pdosIntShdwErr EQU $000D ; System Fail - ProDOS interrupt w/ shadowing off segLoader1Err EQU $0015 ; System Fail - segment loader error sPackage0Err EQU $0017 ; System Fail - can't load a package package1Err EQU $0018 ; System Fail - can't load a package package2Err EQU $0019 ; System Fail - can't load a package package3Err EQU $001A ; System Fail - can't load a package package4Err EQU $001B ; System Fail - can't load a package package5Err EQU $001C ; System Fail - can't load a package package6Err EQU $001D ; System Fail - can't load a package package7Err EQU $001E ; System Fail - can't load a package package8Err EQU $0020 ; System Fail - can't load a package package9Err EQU $0021 ; System Fail - can't load a package package10Err EQU $0022 ; System Fail - can't load a package package11Err EQU $0023 ; System Fail - can't load a package package12Err EQU $0024 ; System Fail - can't load a package outOfMemErr EQU $0025 ; System Fail - out of memory error segLoader2Err EQU $0026 ; System Fail - segment loader error fMapTrshdErr EQU $0027 ; System Fail - file map trashed stkOvrFlwErr EQU $0028 ; System Fail - stack overflow error psInstDiskErr EQU $0030 ; System Fail - Please Insert Disk (file manager alert) memMgr1Err EQU $0032 ; System Fail - memory manager error memMgr2Err EQU $0033 ; System Fail - memory manager error memMgr3Err EQU $0034 ; System Fail - memory manager error memMgr4Err EQU $0035 ; System Fail - memory manager error memMgr5Err EQU $0036 ; System Fail - memory manager error memMgr6Err EQU $0037 ; System Fail - memory manager error memMgr7Err EQU $0038 ; System Fail - memory manager error memMgr8Err EQU $0039 ; System Fail - memory manager error memMgr9Err EQU $003A ; System Fail - memory manager error memMgr10Err EQU $003B ; System Fail - memory manager error memMgr11Err EQU $003C ; System Fail - memory manager error memMgr12Err EQU $003D ; System Fail - memory manager error memMgr13Err EQU $003E ; System Fail - memory manager error memMgr14Err EQU $003F ; System Fail - memory manager error memMgr15Err EQU $0040 ; System Fail - memory manager error memMgr16Err EQU $0041 ; System Fail - memory manager error memMgr17Err EQU $0042 ; System Fail - memory manager error memMgr18Err EQU $0043 ; System Fail - memory manager error memMgr19Err EQU $0044 ; System Fail - memory manager error memMgr20Err EQU $0045 ; System Fail - memory manager error memMgr21Err EQU $0046 ; System Fail - memory manager error memMgr22Err EQU $0047 ; System Fail - memory manager error memMgr23Err EQU $0048 ; System Fail - memory manager error memMgr24Err EQU $0049 ; System Fail - memory manager error memMgr25Err EQU $004A ; System Fail - memory manager error memMgr26Err EQU $004B ; System Fail - memory manager error memMgr27Err EQU $004C ; System Fail - memory manager error memMgr28Err EQU $004D ; System Fail - memory manager error memMgr29Err EQU $004E ; System Fail - memory manager error memMgr30Err EQU $004F ; System Fail - memory manager error memMgr31Err EQU $0050 ; System Fail - memory manager error memMgr32Err EQU $0051 ; System Fail - memory manager error memMgr33Err EQU $0052 ; System Fail - memory manager error memMgr34Err EQU $0053 ; System Fail - memory manager error stupVolMntErr EQU $0100 ; System Fail - can't mount system startup volume p1PrntModem EQU $0000 p1LineLnth EQU $0001 p1DelLine EQU $0002 p1AddLine EQU $0003 p1Echo EQU $0004 p1Buffer EQU $0005 p1Baud EQU $0006 p1DtStpBits EQU $0007 p1Parity EQU $0008 p1DCDHndShk EQU $0009 p1DSRHndShk EQU $000A p1XnfHndShk EQU $000B p2PrntModem EQU $000C p2LineLnth EQU $000D p2DelLine EQU $000E p2AddLine EQU $000F p2Echo EQU $0010 p2Buffer EQU $0011 p2Baud EQU $0012 p2DtStpBits EQU $0013 p2Parity EQU $0014 p2DCDHndShk EQU $0015 p2DSRHndShk EQU $0016 p2XnfHndShk EQU $0017 dspColMono EQU $0018 dsp40or80 EQU $0019 dspTxtColor EQU $001A dspBckColor EQU $001B dspBrdColor EQU $001C hrtz50or60 EQU $001D userVolume EQU $001E bellVolume EQU $001F sysSpeed EQU $0020 slt1intExt EQU $0021 slt2intExt EQU $0022 slt3intExt EQU $0023 slt4intExt EQU $0024 slt5intExt EQU $0025 slt6intExt EQU $0026 slt7intExt EQU $0027 startupSlt EQU $0028 txtDspLang EQU $0029 kybdLang EQU $002A kyBdBuffer EQU $002B kyBdRepSpd EQU $002C kyBdRepDel EQU $002D dblClkTime EQU $002E flashRate EQU $002F shftCpsLCas EQU $0030 fstSpDelKey EQU $0031 dualSpeed EQU $0032 hiMouseRes EQU $0033 dateFormat EQU $0034 clockFormat EQU $0035 rdMinRam EQU $0036 rdMaxRam EQU $0037 langCount EQU $0038 lang1 EQU $0039 lang2 EQU $003A lang3 EQU $003B lang4 EQU $003C lang5 EQU $003D lang6 EQU $003E lang7 EQU $003F lang8 EQU $0040 layoutCount EQU $0041 layout1 EQU $0042 layout2 EQU $0043 layout3 EQU $0044 layout4 EQU $0045 layout5 EQU $0046 layout6 EQU $0047 layout7 EQU $0048 layout8 EQU $0049 layout9 EQU $004A layout10 EQU $004B layout11 EQU $004C layout12 EQU $004D layout13 EQU $004E layout14 EQU $004F layout15 EQU $0050 layout16 EQU $0051 aTalkNodeNo EQU $0080 irqIntFlag EQU $0000 irqDataReg EQU $0001 irqSerial1 EQU $0002 irqSerial2 EQU $0003 irqAplTlkHi EQU $0004 tickCnt EQU $0005 irqVolume EQU $0006 irqActive EQU $0007 irqSndData EQU $0008 brkVar EQU $0009 evMgrData EQU $000A mouseSlot EQU $000B mouseClamps EQU $000C absClamps EQU $000D sccIntFlag EQU $000E extVGCInt EQU $0001 ; Hardware Interrupt Status - Returned by GetIRQEnable scanLineInt EQU $0002 ; Hardware Interrupt Status - Returned by GetIRQEnable adbDataInt EQU $0004 ; Hardware Interrupt Status - Returned by GetIRQEnable oneSecInt EQU $0010 ; Hardware Interrupt Status - Returned by GetIRQEnable quartSecInt EQU $0020 ; Hardware Interrupt Status - Returned by GetIRQEnable vbInt EQU $0040 ; Hardware Interrupt Status - Returned by GetIRQEnable kbdInt EQU $0080 ; Hardware Interrupt Status - Returned by GetIRQEnable kybdEnable EQU $0000 ; Interrupt Ref Number - Parameter to IntSource kybdDisable EQU $0001 ; Interrupt Ref Number - Parameter to IntSource vblEnable EQU $0002 ; Interrupt Ref Number - Parameter to IntSource vblDisable EQU $0003 ; Interrupt Ref Number - Parameter to IntSource qSecEnable EQU $0004 ; Interrupt Ref Number - Parameter to IntSource qSecDisable EQU $0005 ; Interrupt Ref Number - Parameter to IntSource oSecEnable EQU $0006 ; Interrupt Ref Number - Parameter to IntSource oSecDisable EQU $0007 ; Interrupt Ref Number - Parameter to IntSource adbEnable EQU $000A ; Interrupt Ref Number - Parameter to IntSource adbDisable EQU $000B ; Interrupt Ref Number - Parameter to IntSource scLnEnable EQU $000C ; Interrupt Ref Number - Parameter to IntSource scLnDisable EQU $000D ; Interrupt Ref Number - Parameter to IntSource exVCGEnable EQU $000E ; Interrupt Ref Number - Parameter to IntSource exVCGDisable EQU $000F ; Interrupt Ref Number - Parameter to IntSource mouseOff EQU $0000 transparent EQU $0001 transParnt EQU $0001 ; Mouse Mode Value - (old name) moveIntrpt EQU $0003 bttnIntrpt EQU $0005 bttnOrMove EQU $0007 mouseOffVI EQU $0008 transParntVI EQU $0009 ; Mouse Mode Value - (old name) transparentVI EQU $0009 moveIntrptVI EQU $000B bttnIntrptVI EQU $000D bttnOrMoveVI EQU $000F toolLoc1 EQU $0000 toolLoc2 EQU $0001 usrTLoc1 EQU $0002 usrTLoc2 EQU $0003 intrptMgr EQU $0004 copMgr EQU $0005 abortMgr EQU $0006 _sysFailMgr EQU $0007 aTalkIntHnd EQU $0008 sccIntHnd EQU $0009 scLnIntHnd EQU $000A sndIntHnd EQU $000B vblIntHnd EQU $000C mouseIntHnd EQU $000D qSecIntHnd EQU $000E kybdIntHnd EQU $000F adbRBIHnd EQU $0010 adbSRQHnd EQU $0011 deskAccHnd EQU $0012 flshBufHnd EQU $0013 kybdMicHnd EQU $0014 oneSecHnd EQU $0015 extVCGHnd EQU $0016 otherIntHnd EQU $0017 crsrUpdtHnd EQU $0018 incBsyFlag EQU $0019 decBsyFlag EQU $001A bellVector EQU $001B breakVector EQU $001C traceVector EQU $001D stepVector EQU $001E ctlYVector EQU $0028 proDOSVctr EQU $002A osVector EQU $002B msgPtrVctr EQU $002C ; offset constants for ClampRec oyMaxClamp EQU 0 oyMinClamp EQU 2 oxMaxClamp EQU 4 oxMinClamp EQU 6 ; offset constants for FWRec oyRegExit EQU 0 oxRegExit EQU 2 oaRegExit EQU 4 ostatus EQU 6 ; offset constants for MouseRec omouseMode EQU 0 omouseStatus EQU 1 oyPos EQU 2 oxPos EQU 4 ; offset constants for InterruptStateRec oirq_A EQU 0 oirq_X EQU 2 oirq_Y EQU 4 oirq_S EQU 6 oirq_D EQU 8 oirq_P EQU 10 oirq_DB EQU 11 oirq_e EQU 12 oirq_K EQU 13 oirq_PC EQU 14 oirq_state EQU 16 oirq_shadow EQU 17 oirq_mslot EQU 19 ; File: E16.NoteSeq ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; pitchBend EQU $0 tempo EQU $00000001 turnNotesOff EQU $00000002 jump EQU $00000003 setVibratoDepth EQU $00000004 programChange EQU $00000005 setRegister EQU $00000006 ifGo EQU $00000007 incRegister EQU $00000008 decRegister EQU $00000009 midiNoteOff EQU $0000000A midiNoteOn EQU $0000000B midiPolyKey EQU $0000000C midiCtlChange EQU $0000000D midiProgChange EQU $0000000E midiChnlPress EQU $0000000F midiPitchBend EQU $00000010 midiSelChnlMode EQU $00000011 midiSysExclusive EQU $00000012 midiSysCommon EQU $00000013 midiSysRealTime EQU $00000014 midiSetSysExl EQU $00000015 commandMask EQU $0000007F volumeMask EQU $0000007F chord EQU $00000080 val1Mask EQU $00007F00 toneMask EQU $00007F00 noteMask EQU $00008000 lByte EQU $00FF0000 ; Command - meaning depends on midi command durationMask EQU $07FF0000 trackMask EQU $78000000 delayMask EQU $80000000 hByte EQU $FF000000 noRoomMidiErr EQU $1A00 noCommandErr EQU $1A01 ; error - can't understand the current SeqItem noRoomErr EQU $1A02 ; error - sequence is more than twelve levels deep startedErr EQU $1A03 ; error - Note Sequencer is already started noNoteErr EQU $1A04 ; error - can't find the note to be turned off by the current SeqItem noStartErr EQU $1A05 ; error - Note Sequencer not started yet instBndsErr EQU $1A06 ; error - Instrument number out of Instrument boundary range nsWrongVer EQU $1A07 ; error - incompatible versions of NoteSequencer and NoteSynthesizer ; offset constants for LocRec ocurPhraseItem EQU 0 ocurPattItem EQU 2 ocurLevel EQU 4 ; File: E16.NoteSyn ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; nsAlreadyInit EQU $1901 ; error - Note Syn already initialized nsSndNotInit EQU $1902 ; error - Sound Tools not initialized nsNotAvail EQU $1921 ; error - generator not available nsBadGenNum EQU $1922 ; error - bad generator number nsNotInit EQU $1923 ; error - Note Syn not initialized nsGenAlreadyOn EQU $1924 ; error - generator already on soundWrongVer EQU $1925 ; error - incompatible versions of Sound and NoteSyn ; offset constants for Envelope ost1BkPt EQU 0 ost1Increment EQU 1 ost2BkPt EQU 3 ost2Increment EQU 4 ost3BkPt EQU 6 ost3Increment EQU 7 ost4BkPt EQU 9 ost4Increment EQU 10 ost5BkPt EQU 12 ost5Increment EQU 13 ost6BkPt EQU 15 ost6Increment EQU 16 ost7BkPt EQU 18 ost7Increment EQU 19 ost8BkPt EQU 21 ost8Increment EQU 22 ; offset constants for WaveForm owfTopKey EQU 0 owfWaveAddress EQU 1 owfWaveSize EQU 2 owfDocMode EQU 3 owfRelPitch EQU 4 ; offset constants for Instrument otheEnvelope EQU 0 oreleaseSegment EQU 24 opriorityIncrement EQU 25 opitchBendRange EQU 26 ovibratoDepth EQU 27 ovibratoSpeed EQU 28 oinSpare EQU 29 oaWaveCount EQU 30 obWaveCount EQU 31 oaWaveList EQU 32 obWaveList EQU 32 ; File: E16.Print ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; pntrConFailed EQU $1308 ; error - connection to the printer failed memFullErr EQU $FF80 ioAbort EQU $FFE5 prAbort EQU $0080 missingDriver EQU $1301 ; errors - specified driver not in system/drivers portNotOn EQU $1302 ; errors - specified port not selected in ctl panel noPrintRecord EQU $1303 ; errors - no print record was given badLaserPrep EQU $1304 ; errors - laser prep in laser writer incompatible badLPFile EQU $1305 ; errors - laser prep in system/drivers incompatible papConnNotOpen EQU $1306 ; errors - cannot connect to laser writer papReadWriteErr EQU $1307 ; errors - apple talk PAPRead or PAPWrite error startUpAlreadyMade EQU $1321 ; errors - low level startup already made invalidCtlVal EQU $1322 ; errors - invalid control value had been spec'd reset EQU $0001 ; LLDControl - Printer control value - reset printer formFeed EQU $0002 ; LLDControl - Printer control value - form feed lineFeed EQU $0003 ; LLDControl - Printer control value - line feed bothDrivers EQU $0 ; whichDriver - input to PMLoadDriver and PMUnloadDriver printerDriver EQU $0001 ; whichDriver - input to PMLoadDriver and PMUnloadDriver portDriver EQU $0002 ; whichDriver - input to PMLoadDriver and PMUnloadDriver PrPortrait EQU $0000 prLandscape EQU $0001 prImageWriter EQU $0001 prImageWriterLQ EQU $0002 prLaserWriter EQU $0003 prEpson EQU $0004 prBlackWhite EQU $0001 prColor EQU $0002 bDraftLoop EQU $0000 bSpoolLoop EQU $0080 ; offset constants for PrPrinterSpecRec oprPrinterType EQU 0 oprCharacteristics EQU 2 ; offset constants for PrInfoRec oiDev EQU 0 oiVRes EQU 2 oiHRes EQU 4 orPage EQU 6 ; offset constants for PrJobRec oiFstPage EQU 0 oiLstPage EQU 2 oiCopies EQU 4 obJDocLoop EQU 6 ofFromUser EQU 7 opIdleProc EQU 8 opFileName EQU 12 oiFileVol EQU 16 obFileVers EQU 18 obJobX EQU 19 ; offset constants for PrStyleRec owDev EQU 0 ointernA EQU 2 ofeed EQU 8 opaperType EQU 10 ocrWidth EQU 12 oreduction EQU 14 ointernB EQU 16 ; offset constants for PrRec oprVersion EQU $0 oprInfo EQU $2 orPaper EQU $10 oprStl EQU $18 oprInfoPT EQU $2A oprXInfo EQU $38 oprJob EQU $50 oprintX EQU $64 oiReserved EQU $8A ; offset constants for PrStatusRec oiTotPages EQU 0 oiCurPage EQU 2 oiTotCopies EQU 4 oiCurCopy EQU 6 oiTotBands EQU 8 oiCurBand EQU 10 ofPgDirty EQU 12 ofImaging EQU 14 ohPrint EQU 16 opPrPort EQU 20 ohPic EQU 24 ; File: E16.ProDOS ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; invalidCallNum EQU $0001 ; error - invalid call number unclaimedIntErr EQU $01 ; error - fatal error - unclaimed interrupt badPBlockPtr EQU $05 ; error - call pointer out of bounds pdosActiveErr EQU $06 ; error - ProDOS is active pdosBusyErr EQU $07 ; error - ProDOS is busy vcbUnusable EQU $0A ; error - fatal error - VCB unusable fcbUnusable EQU $0B ; error - fatal error - FCB unusable badBlockZero EQU $0C ; error - fatal error - block zero allocated illegally shdwInterruptErr EQU $0D ; error - fatal error - interrupt occured while I/O shadowing off IF &FINDSYM(&SYSGLOBAL,'DEVNOTFOUND')=0 AND &FINDSYM(&SYSGLOBAL,'devnotfound')=0 THEN ; error - device not found devNotFound EQU $10 ENDIF badDevRefNum EQU $11 ; error - invalid device reference number osVersionErr EQU $11 ; error - Wrong OS version badReqCode EQU $20 ; error - invalid request code intTableFull EQU $25 ; error - interrupt table full invalidOperation EQU $26 ; error - invalid operation ioError EQU $27 ; error - I/O error noDevConnect EQU $28 ; error - no device connected writeProtectErr EQU $2B ; error - write protect error diskSwitchErr EQU $2E ; error - disk switched error devOffLine EQU $002F ; error - device off line/ no media present badPathname EQU $40 ; error - invalid pathname syntax fcbFullErr EQU $42 ; error - FCB full error badFileRefNum EQU $43 ; error - invalid file reference number IF &FINDSYM(&SYSGLOBAL,'PATHNOTFOUND')=0 AND &FINDSYM(&SYSGLOBAL,'pathnotfound')=0 THEN ; error - path not found pathNotFound EQU $44 ENDIF volumeNotFound EQU $45 ; error - volume not found IF &FINDSYM(&SYSGLOBAL,'FILENOTFOUND')=0 AND &FINDSYM(&SYSGLOBAL,'filenotfound')=0 THEN ; error - file not found fileNotFound EQU $46 ENDIF dupFileName EQU $47 ; error - duplicate file name volumeFullErr EQU $48 ; error - volume full error dirFullErr EQU $49 ; error - directory full error versionErr EQU $4A ; error - version error (incompatible file format) IF &FINDSYM(&SYSGLOBAL,'BADSTORETYPE')=0 AND &FINDSYM(&SYSGLOBAL,'badstoretype')=0 THEN ; error - unsupported (or incorrect) storage type badStoreType EQU $4B ENDIF IF &FINDSYM(&SYSGLOBAL,'EOFENCOUNTERED')=0 AND &FINDSYM(&SYSGLOBAL,'eofencountered')=0 THEN ; error - end-of-file encountered eofEncountered EQU $4C ENDIF positionRangeErr EQU $4D ; error - position out of range accessErr EQU $4E ; error - access not allowed fileOpenErr EQU $50 ; error - file is open dirDamaged EQU $51 ; error - directory structure is damaged badVolType EQU $52 ; error - unsupported volume type IF &FINDSYM(&SYSGLOBAL,'PARAMRANGEERR')=0 AND &FINDSYM(&SYSGLOBAL,'paramrangeerr')=0 THEN ; error - parameter out of range paramRangeErr EQU $53 ENDIF memoryFullErr EQU $54 ; error - out of memory vcbFullErr EQU $55 ; error - VCB full error dupVolumeErr EQU $57 ; error - duplicate volume error notBlkDevErr EQU $58 ; error - not a blocked device IF &FINDSYM(&SYSGLOBAL,'INVALIDLEVEL')=0 AND &FINDSYM(&SYSGLOBAL,'invalidlevel')=0 THEN ; error - invalid level invalidLevel EQU $59 ENDIF blkNumRangeErr EQU $5A ; error - block number out of range notSameVolErr EQU $5B ; error - different volumes found on ChangePath call notExecSysFile EQU $5C ; error - not an executable system file osUnavailable EQU $5D ; error - Operating System/file system not available deallocateRamErr EQU $5E ; error - Cannot deallocate /RAM IF &FINDSYM(&SYSGLOBAL,'STACKOVERFLOW')=0 AND &FINDSYM(&SYSGLOBAL,'stackoverflow')=0 THEN ; error - Return stack overflow stackOverflow EQU $5F ENDIF dataUnavailable EQU $60 ; error - Data unavailable endofDirectory EQU $0061 ; offset constants for BlockRec oblockDevNum EQU 0 oblockDataBuffer EQU 2 oblockNum EQU 6 ; offset constants for DevNumRec odevName EQU 0 odevNum EQU 4 ; offset constants for DInfoRec odidevNum EQU 0 odidevName EQU 2 ; offset constants for DirEntryRec oderefNum EQU 0 odereserved EQU 2 odebase EQU 4 odedisplacement EQU 6 odenameBuffer EQU 8 odeentryNum EQU 12 odefileType EQU 14 odeendOfFile EQU 16 odeblockCount EQU 20 odecreateTime EQU 24 odemodTime EQU 32 odeaccess EQU 40 odeauxType EQU 42 odefileSysID EQU 46 ; offset constants for EOFRec oeofRefNum EQU 0 oeofPosition EQU 2 ; offset constants for FileIORec ofileRefNum EQU 0 odataBuffer EQU 2 orequestCount EQU 6 otransferCount EQU 10 ; offset constants for FileRec ofrpathname EQU 0 ofrfAccess EQU 4 ofrfileType EQU 6 ofrauxType EQU 8 ofrstorageType EQU 12 ofrcreateDate EQU 14 ofrcreateTime EQU 16 ofrmodDate EQU 18 ofrmodTime EQU 20 ofrblocksUsed EQU 22 ; offset constants for EraseDiskRec ;odevName EQU 0 ovolName EQU 4 ofileSysID EQU 8 ; offset constants for InterruptRec ointNum EQU 0 ointCode EQU 2 ; offset constants for MarkRec omarkRefNum EQU 0 oposition EQU 2 ; offset constants for NewLineRec onewLRefNum EQU 0 oenableMask EQU 2 onewlineChar EQU 4 ; offset constants for OpenRec oopenRefNum EQU 0 oopenPathname EQU 2 oioBuffer EQU 6 ; offset constants for PathNameRec ;opathname EQU 0 onewPathname EQU 4 ; offset constants for PrefixRec oprefixNum EQU 0 oprefix EQU 2 ; offset constants for QuitRec oqrquitPathname EQU 0 oqrflags EQU 4 ; offset constants for VolumeRec ovrdeviceName EQU 0 ovrvolName EQU 4 ovrtotalBlocks EQU 8 ovrfreeBlocks EQU 12 ovrfileSysID EQU 16 ; File: E16.QDAux ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; ; offset constants for QDIconRecord oqdiconType EQU 0 oqdiconSize EQU 2 oqdiconHeight EQU 4 oqdiconWidth EQU 6 oqdiconImage EQU 8 oqdiconMask EQU 9 ; File: E16.Quickdraw ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; alreadyInitialized EQU $0401 ; error - Quickdraw already initialized cannotReset EQU $0402 ; error - never used notInitialized EQU $0403 ; error - Quickdraw not initialized screenReserved EQU $0410 ; error - screen reserved badRect EQU $0411 ; error - bad rectangle notEqualChunkiness EQU $0420 ; error - Chunkiness is not equal rgnAlreadyOpen EQU $0430 ; error - region is already open rgnNotOpen EQU $0431 ; error - region is not open rgnScanOverflow EQU $0432 ; error - region scan overflow rgnFull EQU $0433 ; error - region is full polyAlreadyOpen EQU $0440 ; error - poly is already open polyNotOpen EQU $0441 ; error - poly is not open polyTooBig EQU $0442 ; error - poly is too big badTableNum EQU $0450 ; error - bad table number badColorNum EQU $0451 ; error - bad color number badScanLine EQU $0452 ; error - bad scan line notImplemented EQU $04FF ; error - not implemented tsNumber EQU $04 _colorTable EQU $0F ; AnSCBByte - Mask for SCB color table scbReserved EQU $10 ; AnSCBByte - Mask for SCB reserved bit scbFill EQU $20 ; AnSCBByte - Mask for SCB fill bit scbInterrupt EQU $40 ; AnSCBByte - Mask for SCB interrupt bit scbColorMode EQU $80 ; AnSCBByte - Mask for SCB color mode bit table320 EQU $32 ; ColorData - (val=size) table640 EQU $32 ; ColorData - (val=size) blueMask EQU $000F ; ColorValue - Mask for Blue nibble greenMask EQU $00F0 ; ColorValue - Mask for green nibble redMask EQU $0F00 ; ColorValue - Mask for red nibble widMaxSize EQU $0001 zeroSize EQU $0002 maskSize EQU $08 ; GrafPort - Mask Size (val=size) locSize EQU $10 ; GrafPort - Loc Size (val=size) patsize EQU $20 ; GrafPort - Pattern Size (val=size) pnStateSize EQU $32 ; GrafPort - Pen State Size (Val=size) portSize EQU $AA ; GrafPort - Size of GrafPort black EQU $000 ; MasterColors - These work in 320 and 640 mode blue EQU $00F ; MasterColors - These work in 320 and 640 mode darkGreen320 EQU $080 ; MasterColors - These work in 320 mode green320 EQU $0E0 ; MasterColors - These work in 320 mode green640 EQU $0F0 ; MasterColors - These work in 640 mode lightBlue320 EQU $4DF ; MasterColors - These work in 320 mode purple320 EQU $72C ; MasterColors - These work in 320 mode darkGray320 EQU $777 ; MasterColors - These work in 320 mode periwinkleBlue320 EQU $78F ; MasterColors - These work in 320 mode brown320 EQU $841 ; MasterColors - These work in 320 mode lightGray320 EQU $0CCC ; MasterColors - These work in 320 mode red320 EQU $0D00 ; MasterColors - These work in 320 mode lilac320 EQU $0DAF ; MasterColors - These work in 320 mode red640 EQU $0F00 ; MasterColors - These work in 640 mode orange320 EQU $0F70 ; MasterColors - These work in 320 mode flesh320 EQU $0FA9 ; MasterColors - These work in 320 mode yellow EQU $0FF0 ; MasterColors - These work in 320 and 640 mode white EQU $0FFF ; MasterColors - These work in 320 and 640 mode modeCopy EQU $0000 modeOR EQU $0001 modeXOR EQU $0002 modeBIC EQU $0003 modeForeCopy EQU $0004 modeForeOR EQU $0005 modeForeXOR EQU $0006 modeForeBIC EQU $0007 modeNOT EQU $8000 notCopy EQU $8000 notOR EQU $8001 notXOR EQU $8002 notBIC EQU $8003 notForeCOPY EQU $8004 notForeOR EQU $8005 notForeXOR EQU $8006 notForeBIC EQU $8007 frameVerb EQU $00 ; PicInfo - PRIVATE - for reference only picNop EQU $00 ; PicInfo - PRIVATE - for reference only drawCharVerb EQU $00 ; PicInfo - PRIVATE - for reference only paintVerb EQU $01 ; PicInfo - PRIVATE - for reference only picClipRgn EQU $01 ; PicInfo - PRIVATE - for reference only drawTextVerb EQU $01 ; PicInfo - PRIVATE - for reference only eraseVerb EQU $02 ; PicInfo - PRIVATE - for reference only picBkPat EQU $02 ; PicInfo - PRIVATE - for reference only drawCStrVerb EQU $02 ; PicInfo - PRIVATE - for reference only invertVerb EQU $03 ; PicInfo - PRIVATE - for reference only picTxFont EQU $03 ; PicInfo - PRIVATE - for reference only fillVerb EQU $04 ; PicInfo - PRIVATE - for reference only picTxFace EQU $04 ; PicInfo - PRIVATE - for reference only picTxMode EQU $05 ; PicInfo - PRIVATE - for reference only picSpExtra EQU $06 ; PicInfo - PRIVATE - for reference only picPnSize EQU $07 ; PicInfo - PRIVATE - for reference only picPnMode EQU $08 ; PicInfo - PRIVATE - for reference only picPnPat EQU $09 ; PicInfo - PRIVATE - for reference only picThePat EQU $0A ; PicInfo - PRIVATE - for reference only picOvSize EQU $0B ; PicInfo - PRIVATE - for reference only picOrigin EQU $0C ; PicInfo - PRIVATE - for reference only picTxSize EQU $0D ; PicInfo - PRIVATE - for reference only picFGColor EQU $0E ; PicInfo - PRIVATE - for reference only picBGColor EQU $0F ; PicInfo - PRIVATE - for reference only picTxRatio EQU $10 ; PicInfo - PRIVATE - for reference only picVersion EQU $11 ; PicInfo - PRIVATE - for reference only lineNoun EQU $20 ; PicInfo - PRIVATE - for reference only picLine EQU $20 ; PicInfo - PRIVATE - for reference only picLineFrom EQU $21 ; PicInfo - PRIVATE - for reference only picShortL EQU $22 ; PicInfo - PRIVATE - for reference only picShortLFrom EQU $23 ; PicInfo - PRIVATE - for reference only picLongText EQU $28 ; PicInfo - PRIVATE - for reference only picDHText EQU $29 ; PicInfo - PRIVATE - for reference only picDVText EQU $2A ; PicInfo - PRIVATE - for reference only picDVDHText EQU $2B ; PicInfo - PRIVATE - for reference only rectNoun EQU $30 ; PicInfo - PRIVATE - for reference only rRectNoun EQU $40 ; PicInfo - PRIVATE - for reference only ovalNoun EQU $50 ; PicInfo - PRIVATE - for reference only arcNoun EQU $60 ; PicInfo - PRIVATE - for reference only polyNoun EQU $70 ; PicInfo - PRIVATE - for reference only rgnNoun EQU $80 ; PicInfo - PRIVATE - for reference only mapNoun EQU $90 ; PicInfo - PRIVATE - for reference only picBitsRect EQU $90 ; PicInfo - PRIVATE - for reference only picBitsRgn EQU $91 ; PicInfo - PRIVATE - for reference only picPBitsRect EQU $98 ; PicInfo - PRIVATE - for reference only picPBitsRgn EQU $99 ; PicInfo - PRIVATE - for reference only picShortComment EQU $A0 ; PicInfo - PRIVATE - for reference only picLongComment EQU $A1 ; PicInfo - PRIVATE - for reference only picEnd EQU $FF ; PicInfo - PRIVATE - for reference only mode320 EQU $0000 ; QDStartup - Argument to QDStartup mode640 EQU $0080 ; QDStartup - Argument to QDStartup flagUseShadowing EQU $8000 ; QDStartup - Argument to QDStartup flagFastPortAware EQU $4000 ; QDStartup - Argument to QDStartup boldMask EQU $0001 ; TextStyle - Mask for bold bit italicMask EQU $0002 ; TextStyle - Mask for italic bit underlineMask EQU $0004 ; TextStyle - Mask for underline bit outlineMask EQU $0008 ; TextStyle - Mask for outline bit shadowMask EQU $0010 ; TextStyle - Mask for shadow bit ; offset constants for Cursor ocursorHeight EQU 0 ocursorWidth EQU 2 ocursorData EQU 4 ocursorMask EQU 6 ocursorHotSpot EQU 8 ; offset constants for Region orgnSize EQU 0 orgnBBox EQU 2 ; offset constants for BufDimRec omaxWidth EQU 0 otextBufHeight EQU 2 otextBufferWords EQU 4 ofontWidth EQU 6 ; offset constants for Font ooffseToMF EQU 0 ofamily EQU 2 ostyle EQU 4 osize EQU 6 oversion EQU 8 ofbrExtent EQU 10 ; offset constants for FontGlobalsRecord ofgFontID EQU 0 ofgStyle EQU 2 ofgSize EQU 4 ofgVersion EQU 6 ofgWidMax EQU 8 ofgFBRExtent EQU 10 ; offset constants for FontID ofamNum EQU 0 ofontStyle EQU 2 ofontSize EQU 3 ; offset constants for FontInfoRecord oascent EQU 0 odescent EQU 2 owidMax EQU 4 oleading EQU 6 ; offset constants for LocInfo oportSCB EQU 0 optrToPixImage EQU 2 owidth EQU 6 oboundsRect EQU 8 ; offset constants for QDProcs ostdText EQU 0 ostdLine EQU 4 ostdRect EQU 8 ostdRRect EQU 12 ostdOval EQU 16 ostdArc EQU 20 ostdPoly EQU 24 ostdRgn EQU 28 ostdPixels EQU 32 ostdComment EQU 36 ostdTxMeas EQU 40 ostdTxBnds EQU 44 ostdGetPic EQU 48 ostdPutPic EQU 52 ; offset constants for GrafPort oportInfo EQU 0 oportRect EQU 16 oclipRgn EQU 24 ovisRgn EQU 28 obkPat EQU 32 opnLoc EQU 64 opnSize EQU 68 opnMode EQU 72 opnPat EQU 74 opnMask EQU 106 opnVis EQU 114 ofontHandle EQU 116 ofontID EQU 120 ofontFlags EQU 124 otxSize EQU 126 otxFace EQU 128 otxMode EQU 130 ospExtra EQU 132 ochExtra EQU 136 ofgColor EQU 140 obgColor EQU 142 opicSave EQU 144 orgnSave EQU 148 opolySave EQU 152 ografProcs EQU 156 oarcRot EQU 160 ouserField EQU 162 osysField EQU 166 ; offset constants for PaintParam optrToSourceLocInfo EQU 0 optrToDestLocInfo EQU 4 optrToSourceRect EQU 8 optrToDestPoint EQU 12 omode EQU 16 omaskHandle EQU 18 ; offset constants for PenState opsPnSize EQU 0 opsPnMode EQU 4 opsPnPat EQU 6 opsPnMask EQU 38 ; offset constants for RomFontRec orfFamNum EQU 0 orfFamStyle EQU 2 orfSize EQU 4 orfFontHandle EQU 6 orfNamePtr EQU 10 orfFBRExtent EQU 14 ; offset constants for ColorTable oentries EQU 0 ; File: E16.Resources ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; resLogOut EQU $0 resLogIn EQU $1 resLogApp EQU $0 resLogSys EQU $2 resForkUsed EQU $1E01 ; Error - Resource fork not empty resBadFormat EQU $1E02 ; Error - Format of resource fork is unknown resForkEmpty EQU $1E03 ; Error - Resource fork is empty resNoCurFile EQU $1E04 ; Error - there are no current open resource files resDupID EQU $1E05 ; Error - ID is already used IF &FINDSYM(&SYSGLOBAL,'RESNOTFOUND')=0 AND &FINDSYM(&SYSGLOBAL,'resnotfound')=0 THEN ; Error - resource was not found resNotFound EQU $1E06 ENDIF resFileNotFound EQU $1E07 ; Error - resource file not found resBadAppID EQU $1E08 ; Error - User ID not found, please call ResourceStartup resNoUniqueID EQU $1E09 ; Error - a unique ID was not found resBadAttr EQU $1E0A ; Error - reseved bits in attributes word are not zero resHashGone EQU $1E0B ; Error - the hash count table is no longer valid resIndexRange EQU $1E0D ; Error - index is out of range resNoCurApp EQU $1E0E ; Error - no current application, please call ResourceStartup resChanged EQU $0020 resPreLoad EQU $0040 resProtected EQU $0080 resAbsLoad EQU $0400 resConverter EQU $0800 resMemAttr EQU $C3F1 systemMap EQU $0001 mapChanged EQU $0002 romMap EQU $0004 resNameOffset EQU $10000 resNameVersion EQU $0001 rIcon EQU $8001 ; Resources - resource type holding names rPicture EQU $8002 ; Resources - resource type holding names rControlList EQU $8003 ; Resources - resource type holding names rControlTemplate EQU $8004 ; Resources - resource type holding names rWindow EQU $8005 ; Resources - resource type holding names rString EQU $8006 ; Resources - resource type holding names rStringList EQU $8007 ; Resources - resource type holding names rMenuBar EQU $8008 ; Resources - resource type holding names rMenu EQU $8009 ; Resources - resource type holding names rMenuItem EQU $800A ; Resources - resource type holding names rTextForLETextBox2 EQU $800B ; Resources - resource type holding names rCtlDefProc EQU $800C ; Resources - resource type holding names rCtlColorTbl EQU $800D ; Resources - resource type holding names rWindParam1 EQU $800E ; Resources - resource type holding names rWindParam2 EQU $800F ; Resources - resource type holding names rWindColor EQU $8010 ; Resources - resource type holding names rResName EQU $8014 ; Resources - resource type holding names ;----------------------------------------------------------- ; FILE: E16.SANE ; ; ; Copyright Apple Computer, Inc. 1986-88 ; All Rights Reserved ; ; ; ; These equates give assembly language access to 65816 SANE. ;----------------------------------------------------------- ;----------------------------------------------------------- ; Tool Set and Function Numbers. ;----------------------------------------------------------- SANEtsNum equ $A ; SANE tool set number FPNum equ $9 ; Function number for Arithmetic DecStrNum equ $A ; Function number for Scanner/Formatter ElemNum equ $B ; Function no. for Elementary functions ;----------------------------------------------------------- ; Operation code masks. ;----------------------------------------------------------- FOADD equ $00 ; add FOSUB equ $02 ; subtract FOMUL equ $04 ; multiply FODIV equ $06 ; divide FOCMP equ $08 ; compare, no exception from unordered FOCPX equ $0A ; compare, signal invalid if unordered FOREM equ $0C ; remainder FOZ2X equ $0E ; convert to extended FOX2Z equ $10 ; convert from extended FOSQRT equ $12 ; square root FORTI equ $14 ; round to integral value FOTTI equ $16 ; truncate to integral value FOSCALB equ $18 ; binary scale FOLOGB equ $1A ; binary log FOCLASS equ $1C ; classify FONEXT equ $1E ; next-after FOSETENV equ $01 ; set environment FOGETENV equ $03 ; get environment FOSETHV equ $05 ; set halt vector FOGETHV equ $07 ; get halt vector FOD2B equ $09 ; convert decimal to binary FOB2D equ $0B ; convert binary to decimal FONEG equ $0D ; negate FOABS equ $0F ; absolute value FOCPYSGN equ $11 ; copy sign ; UNDEFINED equ $13 FOSETXCP equ $15 ; set exception FOPROCENTRY equ $17 ; procedure-entry FOPROCEXIT equ $19 ; procedure-exit FOTESTXCP equ $1B ; test exception ; UNDEFINED equ $1D ; UNDEFINED equ $1F ;----------------------------------------------------------- ; Operand format masks. ;----------------------------------------------------------- FFEXT equ $000 ; extended -- 80-bit float FFDBL equ $100 ; double -- 64-bit float FFSGL equ $200 ; single -- 32-bit float FFLNG equ $300 ; longint -- 32-bit integer FFINT equ $400 ; integer -- 16-bit integer FFCOMP equ $500 ; comp -- 64-bit integer ; UNDEFINED equ $600 ; UNDEFINED equ $700 ;----------------------------------------------------------- ; Class and sign inquiries. ;----------------------------------------------------------- FCSNAN equ $FC ; -4: signaling NAN FCQNAN equ $FD ; -3: quiet NAN FCINF equ $FE ; -2: infinite FCZERO equ $FF ; -1: zero FCNORM equ $00 ; 0: normal FCDENORM equ $01 ; 1: denormal ;----------------------------------------------------------- ; Exceptions. ;----------------------------------------------------------- FBINVALID equ $1 FBUFLOW equ $2 FBOFLOW equ $4 FBDIVZER equ $8 FBINEXACT equ $10 ;----------------------------------------------------------- ; Elementary function operation code masks. ;----------------------------------------------------------- FOLNX equ $00 ; base-e log FOLOG2X equ $02 ; base-2 log FOLN1X equ $04 ; ln (1 + x) FOLOG21X equ $06 ; log2 (1 + x) FOEXPX equ $08 ; base-e exponential FOEXP2X equ $0A ; base-2 exponential FOEXP1X equ $0C ; exp (x) - 1 FOEXP21X equ $0E ; exp2 (x) - 1 FOXPWRI equ $10 ; integer exponentiation FOXPWRY equ $12 ; general exponentiation FOCOMPOUND equ $14 ; compound FOANNUITY equ $16 ; annuity FOATANX equ $18 ; arctangent FOSINX equ $1A ; sine FOCOSX equ $1C ; cosine FOTANX equ $1E ; tangent FORANDX equ $20 ; random ;----------------------------------------------------------- ; Scanner and formatter operation code masks. ;----------------------------------------------------------- FOPSTR2DEC equ 0 ; Pascal string to decimal record FOCSTR2DEC equ 2 ; C string (char stream) to dec. record FODEC2STR equ 1 ; decimal record to (Pascal) string ;----------------------------------------------------------- ; NaN codes. ;----------------------------------------------------------- NANSQRT equ 1 ; Invalid square root such as sqrt(-1) NANADD equ 2 ; Invalid addition such as +INF - +INF NANDIV equ 4 ; Invalid division such as 0/0 NANMUL equ 8 ; Invalid multiply such as 0 * INF NANREM equ 9 ; Invalid rem or mod such as x REM 0 NANASCBIN equ 17 ; Conversion of invalid ASCII string NANCOMP equ 20 ; Comp NaN converted to floating NANZERO equ 21 ; Attempt to create a NaN with zero code NANTRIG equ 33 ; Invalid argument to trig routine NANINVTRIG equ 34 ; Invalid arg to inverse trig routine NANLOG equ 36 ; Invalid argument to log routine NANPOWER equ 37 ; Invalid argument to x^i or x^y routine NANFINAN equ 38 ; Invalid argument to financial function ; File: E16.Scheduler ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; ; File: E16.Scrap ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; badScrapType EQU $1610 ; error - No scrap of this type. textScrap EQU $0000 picScrap EQU $0001 ; File: E16.Shell ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; ; offset constants for GetLInfoPB osfile EQU 0 odfile EQU 4 oparms EQU 8 olstring EQU 12 omerr EQU 16 omerrf EQU 17 olops EQU 18 okflag EQU 19 omflags EQU 20 opflags EQU 24 oorg EQU 28 ; File: E16.Sound ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; noDOCFndErr EQU $0810 ; error - no DOC chip found docAddrRngErr EQU $0811 ; error - DOC address range error noSAppInitErr EQU $0812 ; error - no SAppInit call made invalGenNumErr EQU $0813 ; error - invalid generator number synthModeErr EQU $0814 ; error - synthesizer mode error genBusyErr EQU $0815 ; error - generator busy error mstrIRQNotAssgnErr EQU $0817 ; error - master IRQ not assigned sndAlreadyStrtErr EQU $0818 ; error - sound tools already started unclaimedSndIntErr EQU $08FF ; error - sound tools already started ffSynthMode EQU $0001 ; channelGenMode - Free form synthesizer mode noteSynthMode EQU $0002 ; channelGenMode - Note synthesizer mode. gen0off EQU $0001 ; genMask - param to FFStopSound gen1off EQU $0002 ; genMask - param to FFStopSound gen2off EQU $0004 ; genMask - param to FFStopSound gen3off EQU $0008 ; genMask - param to FFStopSound gen4off EQU $0010 ; genMask - param to FFStopSound gen5off EQU $0020 ; genMask - param to FFStopSound gen6off EQU $0040 ; genMask - param to FFStopSound gen7off EQU $0080 ; genMask - param to FFStopSound gen8off EQU $0100 ; genMask - param to FFStopSound gen9off EQU $0200 ; genMask - param to FFStopSound gen10off EQU $0400 ; genMask - param to FFStopSound gen11off EQU $0800 ; genMask - param to FFStopSound gen12off EQU $1000 ; genMask - param to FFStopSound gen13off EQU $2000 ; genMask - param to FFStopSound gen14off EQU $4000 ; genMask - param to FFStopSound genAvail EQU $0000 ; genStatus - Generator available status ffSynth EQU $0100 ; genStatus - Free Form Synthesizer status noteSynth EQU $0200 ; genStatus - Note Synthesizer status lastBlock EQU $8000 ; genStatus - Last block of wave smReadRegister EQU $00 ; Jump Table Offset - Read Register routine smWriteRegister EQU $04 ; Jump Table Offset - Write Register routine smReadRam EQU $08 ; Jump Table Offset - Read Ram routine smWriteRam EQU $0C ; Jump Table Offset - Write Ram routine smReadNext EQU $10 ; Jump Table Offset - Read Next routine smWriteNext EQU $14 ; Jump Table Offset - Write Next routine smOscTable EQU $18 ; Jump Table Offset - Pointer to Oscillator table smGenTable EQU $1C ; Jump Table Offset - Pointer to generator table smGcbAddrTable EQU $20 ; Jump Table Offset - Pointer to GCB address table smDisableInc EQU $24 ; Jump Table Offset - Disable Increment routine ; offset constants for SoundParamBlock owaveStart EQU 0 owaveSize EQU 4 ofreqOffset EQU 6 odocBuffer EQU 8 obufferSize EQU 10 onextWavePtr EQU 12 ovolSetting EQU 16 ; offset constants for DocRegParamBlk ooscGenType EQU 0 ofreqLow1 EQU 2 ofreqHigh1 EQU 3 ovol1 EQU 4 otablePtr1 EQU 5 ocontrol1 EQU 6 otableSize1 EQU 7 ofreqLow2 EQU 8 ofreqHigh2 EQU 9 ovol2 EQU 10 otablePtr2 EQU 11 ocontrol2 EQU 12 otableSize2 EQU 13 ; File: E16.StdFile ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; noDisplay EQU $0000 ; filterProc result - file not to be displayed noSelect EQU $0001 ; filterProc result - file displayed, but not selectable displaySelect EQU $0002 ; filterProc result - file displayed and selectable sfMatchFileType EQU $8000 sfMatchAuxType EQU $4000 sfDisplayGrey EQU $2000 ; offset constants for SFReplyRec ogood EQU 0 ofileType EQU 2 oauxFileType EQU 4 ofilename EQU 6 ofullPathname EQU 22 ;offset constants for SFReplyRec2 ;ogood EQU 0 ;ofileType EQU 2 oauxType EQU 4 onameDesc EQU 8 onameRef EQU 10 opathDesc EQU 14 opathRef EQU 16 ; File: E16.TextEdit ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; teAlreadyStarted EQU $2201 teNotStarted EQU $2202 teInvalidHandle EQU $2203 teInvalidVerb EQU $2204 teInvalidFlag EQU $2205 teInvalidPCount EQU $2206 teInvalidRect EQU $2207 teBufferOverflow EQU $2208 teInvalidLine EQU $2209 teInvalidCall EQU $220A NullVerb EQU $0 PStringVerb EQU $0001 CStringVerb EQU $0002 C1InputVerb EQU $0003 C1OutputVerb EQU $0004 HandleVerb EQU $0005 PointerVerb EQU $0006 NewPStringVerb EQU $0007 fEqualLineSpacing EQU $8000 fShowInvisibles EQU $4000 teInvalidDescriptor EQU $2204 teInvalidParameter EQU $220B teInvalidTextBox2 EQU $220C teEqualLineSpacing EQU $8000 teShowInvisibles EQU $4000 teJustLeft EQU $0 teJustRight EQU $1 teJustCenter EQU $2 teJustFull EQU $3 teNoTabs EQU $0 teColumnTabs EQU $1 teAbsoluteTabs EQU $2 teLeftTab EQU $0 teCenterTab EQU $1 teRightTab EQU $2 teDecimalTab EQU $3 teInvis EQU $4000 teCtlColorIsPtr EQU $0000 teCtlColorIsHandle EQU $0004 teCtlColorIsResource EQU $0008 teCtlStyleIsPtr EQU $0000 teCtlStyleIsHandle EQU $0001 teCtlStyleIsResource EQU $0002 teNotControl EQU $80000000 teSingleFormat EQU $40000000 teSingleStyle EQU $20000000 teNoWordWrap EQU $10000000 teNoScroll EQU $08000000 teReadOnly EQU $04000000 teSmartCutPaste EQU $02000000 teTabSwitch EQU $01000000 teDrawBounds EQU $00800000 teColorHilite EQU $00400000 teRefIsPtr EQU $0000 teRefIsHandle EQU $0001 teRefIsResource EQU $0002 teRefIsNewHandle EQU $0003 teDataIsPString EQU $0000 teDataIsCString EQU $0001 teDataIsC1Input EQU $0002 teDataIsC1Output EQU $0003 teDataIsTextBox2 EQU $0004 teDataIsTextBlock EQU $0005 teTextIsPtr EQU $0000 teTextIsHandle EQU $0008 teTextIsResource EQU $0010 teTextIsNewHandle EQU $0018 tePartialLines EQU $8000 teDontDraw EQU $4000 teUseFont EQU $0020 teUseSize EQU $0010 teUseForeColor EQU $0008 teUseBackColor EQU $0004 teUseUserData EQU $0002 teUseAttributes EQU $0001 teReplaceFont EQU $0040 teReplaceSize EQU $0020 teReplaceForeColor EQU $0010 teReplaceBackColor EQU $0008 teReplaceUserField EQU $0004 teReplaceAttributes EQU $0002 teSwitchAttributes EQU $0001 teEraseRect EQU $0001 teEraseBuffer EQU $0002 teRectChanged EQU $0003 TEParamBlock RECORD 0 ; TextEdit pCount DS.B 2 ; word - controlID DS.B 4 ; long - boundsRect DS Rect ; Rect - procRef DS.B 4 ; long - flags DS.B 2 ; word - moreflags DS.B 2 ; word - refCon DS.B 4 ; long - textFlags DS.B 4 ; long - indentRect DS Rect ; Rect - vertBar DS.B 4 ; CtlRecHndl - vertScroll DS.B 2 ; word - horzBar DS.B 4 ; CtlRecHndl - horzScroll DS.B 2 ; word - styleRef DS.B 4 ; TEStyleRef - textDescriptor DS.B 2 ; Word - textRef DS.B 4 ; TETextRef - textLength DS.B 4 ; long - maxChars DS.B 4 ; long - maxLines DS.B 4 ; long - maxHeight DS.B 2 ; word - pageHeight DS.B 2 ; word - headerHeight DS.B 2 ; word - footerHeight DS.B 2 ; word - pageBoundary DS.B 2 ; word - colorRef DS.B 4 ; long - drawMode DS.B 2 ; word - filterProcPtr DS.B 4 ; ProcPtr - ENDR ; File: E16.TextTool ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; badDevType EQU $0C01 ; error - not implemented badDevNum EQU $0C02 ; error - Illegal device number. badMode EQU $0C03 ; error - Bad mode: illegal operation. unDefHW EQU $0C04 ; error - Undefined hardware error lostDev EQU $0C05 ; error - Lost device: Device no longer on line lostFile EQU $0C06 ; error - File no longer in diskette directory badTitle EQU $0C07 ; error - Illegal Filename textNoRoom EQU $0C08 ; error - Insufficient space on specified diskette noDevice EQU $0C09 ; error - Volume not online noFile EQU $0C0A ; error - File not in specifiled directory dupFile EQU $0C0B ; error - Filename already exists notClosed EQU $0C0C ; error - Attempt to open an open file notOpen EQU $0C0D ; error - Attempt to close closed file textBadFormat EQU $0C0E ; error - error reading real or integer ringBuffOFlo EQU $0C0F ; error - Chars arriving too fast writeProtected EQU $0C10 devErr EQU $0C40 ; error - Read or Write failed input EQU $0000 output EQU $0001 errorOutput EQU $0002 basicType EQU $0000 pascalType EQU $0001 ramBased EQU $0002 textNoEcho EQU $0000 textEcho EQU $0001 ; File: E16.Types ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; refIsPointer EQU $0000 refIsHandle EQU $0001 refIsResource EQU $0002 refIsNewHandle EQU $0003 ; offset constants for Point ov EQU 0 oh EQU 2 ; offset constants for Rect ov1 EQU 0 oh1 EQU 2 ov2 EQU 4 oh2 EQU 6 ; offset constants for TimeRec osecond EQU 0 ominute EQU 1 ohour EQU 2 oyear EQU 3 oday EQU 4 omonth EQU 5 oextra EQU 6 oweekDay EQU 7 ; File: E16.Video ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; vdVideoOverlay EQU $01 vdFrameGrabber EQU $02 vdInVStandards EQU $03 vdOutVStandards EQU $04 vdKeyDissLevels EQU $05 vdNKeyDissLevels EQU $06 vdAdjSideEffect EQU $07 vdKeyColorBits EQU $08 vdInHueAdj EQU $09 vdInSatAdj EQU $0A vdInContrastAdj EQU $0B vdInBrightAdj EQU $0C vdOutSetup EQU $0D vdOutChromaFilter EQU $0E vdOutExtBlank EQU $0F vdKeyEnhDiss EQU $10 vdLineInterrupt EQU $11 vdGGBus EQU $12 vdDualOut EQU $13 vdTextMonoOver EQU $14 vdGenlock EQU $32 vdVideoDetect EQU $33 vdGenlocked EQU $34 vdAdjInc EQU $50 vdAdjDec EQU $51 vdAdjSave EQU $52 vdAvail EQU $01 vdNotAvail EQU $00 vdYes EQU $01 vdNo EQU $00 vdOn EQU $01 vdOff EQU $00 vdKColorEnable EQU $64 vdVerticalBlank EQU $82 vdMainPageLin EQU $C8 vdRAMPageSel EQU $C9 vdVBLInterrupt EQU $CA vdInterlaceMode EQU $CB vdClearVBLInt EQU $CC vdClearLineInt EQU $CD vdDisplayField EQU $CE vdVBLIntRequest EQU $CF vdLineIntRequest EQU $D0 vdNone EQU $00 vdNTSC EQU $01 vdPAL EQU $02 vdSECAM EQU $04 vdSNTSC EQU $08 vdSPAL EQU $10 vdSSECAM EQU $20 vdRGB60 EQU $40 vdRGB50 EQU $80 vdAux EQU $00 vdMain EQU $10 vdInterlace EQU $30 vdField1 EQU $01 vdField0 EQU $00 vdEnable EQU $01 vdDisable EQU $00 vdExternal EQU $00 vdGraphics EQU $01 vdVBlank EQU $01 vdActiveVideo EQU $00 vdNoVideoDevice EQU $2110 ; Error - no video device was found vdAlreadyStarted EQU $2111 ; Error - Video tool set already started vdInvalidSelector EQU $2112 ; Error - an invalid selector was specified vdInvalidParam EQU $2113 ; Error - an invalid parameter was specified vdUnImplemented EQU $21FF ; Error - an unimplemented tool set routine was called ; File: E16.Window ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; paramLenErr EQU $0E01 ; error - first word of parameter list is the wrong size allocateErr EQU $0E02 ; error - unable to allocate window record taskMaskErr EQU $0E03 ; error - bits 12-15 are not clear in WmTaskMask field of EventRecord wNoConstraint EQU $0000 ; Axis parameter - No constraint on movement. wHAxisOnly EQU $0001 ; Axis parameter - Horizontal axis only. wVAxisOnly EQU $0002 ; Axis parameter - Vertical axis only. FromDesk EQU $00 ; Desktop Command - Subtract region from desktop ToDesk EQU $1 ; Desktop Command - Add region to desktop GetDesktop EQU $2 ; Desktop Command - Get Handle of Desktop region SetDesktop EQU $3 ; Desktop Command - Set Handle of Desktop region GetDeskPat EQU $4 ; Desktop command - Address of pattern or drawing routine SetDeskPat EQU $5 ; Desktop command - Change Address of pattern or drawing routine GetVisDesktop EQU $6 ; Desktop command - Get destop region less visible windows. BackGroundRgn EQU $7 ; Desktop command - For drawing directly on desktop. toBottom EQU $FFFFFFFE ; SendBehind value - To send window to bottom. topMost EQU $FFFFFFFF ; SendBehind value - To make window top. bottomMost EQU $0000 ; SendBehind value - To make window bottom. tmMenuKey EQU $0001 tmUpdate EQU $0002 tmFindW EQU $0004 tmMenuSel EQU $0008 tmOpenNDA EQU $0010 tmSysClick EQU $0020 tmDragW EQU $0040 tmContent EQU $0080 tmClose EQU $0100 tmZoom EQU $0200 tmGrow EQU $0400 tmScroll EQU $0800 tmSpecial EQU $1000 tmCRedraw EQU $2000 tmInactive EQU $4000 tmInfo EQU $8000 wNoHit EQU $0000 ; TaskMaster codes - retained for back compatibility. inNull EQU $0000 ; TaskMaster codes - retained for back compatibility inKey EQU $0003 ; TaskMaster codes - retained for back compatibility inButtDwn EQU $0001 ; TaskMaster codes - retained for back compatibility inUpdate EQU $0006 ; TaskMaster codes - retained for back compatibility wInDesk EQU $0010 ; TaskMaster codes - On Desktop wInMenuBar EQU $0011 ; TaskMaster codes - On system menu bar wClickCalled EQU $0012 ; TaskMaster codes - system click called wInContent EQU $0013 ; TaskMaster codes - In content region wInDrag EQU $0014 ; TaskMaster codes - In drag region wInGrow EQU $0015 ; TaskMaster codes - In grow region, active window only wInGoAway EQU $0016 ; TaskMaster codes - In go-away region, active window only wInZoom EQU $0017 ; TaskMaster codes - In zoom region, active window only wInInfo EQU $0018 ; TaskMaster codes - In information bar wInSpecial EQU $0019 ; TaskMaster codes - Item ID selected was 250 - 255 wInDeskItem EQU $001A ; TaskMaster codes - Item ID selected was 1 - 249 wInFrame EQU $1B ; TaskMaster codes - in Frame, but not on anything else wInactMenu EQU $1C ; TaskMaster codes - "selection" of inactive menu item wClosedNDA EQU $001D ; TaskMaster codes - desk accessory closed wCalledSysEdit EQU $001E ; TaskMaster codes - inactive menu item selected wInSysWindow EQU $8000 ; TaskMaster codes - hi bit set for system windows wDraw EQU $00 ; VarCode - Draw window frame command. wHit EQU $01 ; VarCode - Hit test command. wCalcRgns EQU $02 ; VarCode - Compute regions command. wNew EQU $03 ; VarCode - Initialization command. wDispose EQU $04 ; VarCode - Dispose command. fHilited EQU $0001 ; WFrame - Window is highlighted. fZoomed EQU $0002 ; WFrame - Window is zoomed. fAllocated EQU $0004 ; WFrame - Window record was allocated. fCtlTie EQU $0008 ; WFrame - Window state tied to controls. fInfo EQU $0010 ; WFrame - Window has an information bar. fVis EQU $0020 ; WFrame - Window is visible. fQContent EQU $0040 fMove EQU $0080 ; WFrame - Window is movable. fZoom EQU $0100 ; WFrame - Window is zoomable. fFlex EQU $0200 fGrow EQU $0400 ; WFrame - Window has grow box. fBScroll EQU $0800 ; WFrame - Window has horizontal scroll bar. fRScroll EQU $1000 ; WFrame - Window has vertical scroll bar. fAlert EQU $2000 fClose EQU $4000 ; WFrame - Window has a close box. fTitle EQU $8000 ; WFrame - Window has a title bar. windSize EQU $145 ; WindRec - Size of WindRec. wmTaskRecSize EQU $0046 ; WmTaskRec - Size of WmTaskRec. wTrackZoom EQU $001F wHitFrame EQU $0020 wInControl EQU $0021 ; offset constants for WindColor oframeColor EQU 0 otitleColor EQU 2 otBarColor EQU 4 ogrowColor EQU 6 oinfoColor EQU 8 ; offset constants for WindRec oport EQU 0 owDefProc EQU 170 owrRefCon EQU 174 owContDraw EQU 178 owReserved EQU 182 owStrucRgn EQU 186 owContRgn EQU 190 owUpdateRgn EQU 194 owControls EQU 198 owFrameCtrls EQU 202 owFrame EQU 206 ; offset constants for WindowChain owNext EQU 0 otheWindow EQU 4 ; offset constants for ParamList oparamLength EQU 0 owFrameBits EQU 2 owTitle EQU 4 owRefCon EQU 8 owZoom EQU 12 owColor EQU 20 owYOrigin EQU 24 owXOrigin EQU 26 owDataH EQU 28 owDataW EQU 30 owMaxH EQU 32 owMaxW EQU 34 owScrollVer EQU 36 owScrollHor EQU 38 owPageVer EQU 40 owPageHor EQU 42 owInfoRefCon EQU 44 owInfoHeight EQU 48 owFrameDefProc EQU 50 owInfoDefProc EQU 54 owContDefProc EQU 58 owPosition EQU 62 owPlane EQU 70 owStorage EQU 74 ; offset constants for DeskMessageRecord odmreserved EQU 0 odmmessageType EQU 4 odmdrawType EQU 6 \ No newline at end of file diff --git a/appleworksgs/Macros/m16.bob b/appleworksgs/Macros/m16.bob new file mode 100755 index 0000000..ce924b0 --- /dev/null +++ b/appleworksgs/Macros/m16.bob @@ -0,0 +1 @@ +;..............................................................................; ; ; If - expression, test, value, goto ; ; This macro implements an if construct. The expression will be evaluated, ; its value compared to the given value, and if the test succeeds execution ; continues at 'goto'. Otherwise execution will continue until an EndWhile ; macro is encountered. ; ; The expression may be a register, simple variable, or complex expression. ; If the 'goto' label is preceeded by a '!' then it is assumed that a long ; branch is necessary. ; ; Sample calls: ; ; If X,'<>',#50,DoneIf - if x<>50 then goto DoneIf ; If Var1,'=',Var2,!DoneIf - if var1=var2 then branch long to DoneIf ; If '(Var1.+Var2)','>',Var3,Quit - if var1+var2>var3 then goto Quit ; ; The following test conditions are supported and must be quoted: ; ; '=', '>', '>=', '<', '<=', '<>' ; ; A complex expression must be quoted and placed in paranthesis to work ; correctly. ; ;..............................................................................; MACRO &lab IF_ &exp,&test,&value,&goto &lab ; lclc &cc lclc &first lclc &newexp lclc &WorkAroundApplesBuggyAssembler &newexp setc &exp &first setc &substr(&newexp,1,1) IF (&newexp = 'x') or (&newexp = 'y') or (&newexp = 'a') GOTO .register IF (&newexp = 'X') or (&newexp = 'Y') or (&newexp = 'A') GOTO .register IF (&first = '(') GOTO .expression .simplevar lda &newexp cmp &value GOTO .dotest mexit .expression &newexp setc &substr(&newexp,2,&len(&newexp)-2) eval &newexp cmp &value GOTO .dotest .register &WorkAroundApplesBuggyAssembler setc &concat('cp',&newexp) .; cp&newexp &value **SIGH!!!!!!** &WorkAroundApplesBuggyAssembler &value GOTO .dotest .dotest IF (&test = '=') GOTO .doeq IF (&test = '<') GOTO .dolt IF (&test = '>=') GOTO .doge IF (&test = '<>') GOTO .done IF (&test = '<=') GOTO .dole IF (&test = '>') GOTO .dogt IF (&test = '') GOTO .dole IF (&test = '') GOTO .doge IF (&test = '') GOTO .done macerr 'IF_: unrecognized comparison ',&test,' (make sure it's not in quotes).' mexit .doeq &cc setc 'eq' GOTO .goto .dolt &cc setc 'lt' GOTO .goto .doge &cc setc 'ge' GOTO .goto .done &cc setc 'ne' GOTO .goto .dole &cc setc 'le' GOTO .goto .dogt &cc setc 'gt' GOTO .goto mexit .goto jump &cc,&goto mexit MEND ;..............................................................................; ; ; jump - Branch on condition code to short/long label ; ; Generic jump macro. If label starts with ! will do long jump else short. ; ;..............................................................................; MACRO &lab jump &cc,&label &lab ; lclc &a &a setc &substr(&label,1,1) IF (&a = '!') GOTO .long b&cc &label mexit .long &a setc &substr(&label,2,&len(&label)-1) j&cc &a mexit MEND ;..............................................................................; ; ; While - expression, test, value, resume ; ; This macro implements a while construct. The expression will be evaluated, ; its value compared to the given value, and if the test fails execution will ; continue at 'resume'. Otherwise execution will continue until an EndWhile ; macro is encountered. ; ; The expression may be a register, simple variable, or complex expression. ; If the 'resume' label is preceeded by a '!' then it is assumed that a long ; branch is necessary. ; ; Sample calls: ; ; While X,'<>',#50 - loop until x register = 50 ; While Var1,'=',Var2 - loop until var1<>var2, then jump long ; While '(Var1.+Var2)','>',Var3 - loop until var1+var2<=var3 ; ; The following test conditions are supported and must be quoted: ; ; '=', '>', '>=', '<', '<=', '<>' ; ; A complex expression must be quoted and placed in paranthesis to work ; correctly. ; ; Note: Up to 10 levels of local while nesting are supported. ; ;..............................................................................; MACRO &lab while_ &exp,&test,&value &lab ; lclc &long .; IF (&nbr(&wcnt) > 0) GOTO .past gbla &wcnt gblc &while[10] gbla &wnum[10] IF (&wcnt = 10) THEN macerr 'Too many levels of nested While_'s (max. 10).' mexit ENDIF .past &wcnt seta &wcnt+1 &while[&wcnt] setc &concat('~A',&i2s(&sysindex)) &wnum[&wcnt] seta &wnum[&wcnt]+1 ~A&i2s(&sysindex) ; if_ &exp,&test,&value,&concat('~B',&i2s(&sysindex)) brl &concat('~W',&concat(&i2s(&wcnt),&i2s(&wnum[&wcnt]))) ~B&i2s(&sysindex) ; mexit MEND ;..............................................................................; ; ; EndWhile ; ; This macro will return control back to the latest while loop encountered. ;..............................................................................; MACRO &lab endwhile_ &lab ; gbla &wcnt gblc &while[10] gbla &wnum[10] IF (&wcnt = 0) THEN macerr 'Unexpected EndWhile_.' mexit ENDIF brl &while[&wcnt] ~W&i2s(&wcnt)&i2s(&wnum[&wcnt]) ; &wcnt seta &wcnt-1 mexit MEND ;..............................................................................; ; ; Repeat ; ; This macro will set a label to the start of a repeat/until loop for the ; current lexical level. ;..............................................................................; MACRO &lab repeat_ &lab ; .; IF (&nbr(&rcnt) > 0) GOTO .past gbla &rcnt gblc &repeat[10] .past &rcnt seta &rcnt+1 &repeat[&rcnt] setc &concat('~A',&i2s(&sysindex)) ~A&i2s(&sysindex) ; mexit MEND ;..............................................................................; ; ; Until &exp,&test,&value ; ; If the expression evaluates to true then exit else return to the ; last seen repeat. ;..............................................................................; MACRO &lab until_ &exp,&test,&value &lab ; gbla &rcnt gblc &repeat[10] if_ &exp,&test,&value,&concat('~B',&i2s(&sysindex)) brl &repeat[&rcnt] ~B&i2s(&sysindex) ; &rcnt seta &rcnt-1 mexit MEND ;..............................................................................; ; ; FOR variable, initial value, final value, step size ; ; This macros implements a primitive FOR type construct. The specified ; variable may be either a register ('X','Y','A') or a memory location. The ; variable is currently assumed to be of word size. It will get loaded with ; the initial value specified. Execution will loop between the FOR and NEXT ; macros until the variable exceeds the final value, each pass through the ; loop the variable or register as the case may be is offset by the given ; step size. Step size may be positive or negative but must be word size. ;..............................................................................; MACRO &lab for_ &var,&init,&final,&step &lab ; .; IF (&nbr(&fcnt) > 0) GOTO .past gbla &fcnt gblc &for[10] gblc &forstep[10] gblc &forfinal[10] gblc &forvar[10] .past &fcnt seta &fcnt+1 &for[&fcnt] setc &concat('~A',&i2s(&sysindex)) &forstep[&fcnt] setc &step &forfinal[&fcnt] setc &final IF (&var = 'x') or (&var = 'X') GOTO .initx IF (&var = 'y') or (&var = 'Y') GOTO .inity lda &init &forvar[&fcnt] setc 'A' IF (&var = 'a') or (&var = 'A') GOTO .quit sta &var &forvar[&fcnt] setc &var GOTO .quit .initx ldx &init &forvar[&fcnt] setc 'X' GOTO .quit .inity ldy &init &forvar[&fcnt] setc 'Y' .quit ~A&i2s(&sysindex) ; mexit MEND ;..............................................................................; ; ; NEXT ; ; See description under FOR. ; ;..............................................................................; MACRO &lab next_ &lab ; gbla &fcnt gblc &for[10] gblc &forstep[10] gblc &forfinal[10] gblc &forvar[10] IF (&forvar[&fcnt] = 'A') GOTO .nextA IF (&forvar[&fcnt] = 'X') GOTO .nextX IF (&forvar[&fcnt] = 'Y') GOTO .nextY lda &forvar[&fcnt] GOTO .nextA .nextX txa GOTO .nextA .nextY tya .nextA IF (&forstep[&fcnt] = '#1') GOTO .incA IF (&forstep[&fcnt] = '#-1') GOTO .decA clc adc &forstep[&fcnt] GOTO .donextA .decA dec a GOTO .donextA .incA inc a .donextA IF (&forvar[&fcnt] = 'X') GOTO .setx IF (&forvar[&fcnt] = 'Y') GOTO .sety IF (&forvar[&fcnt] = 'A') GOTO .checkit sta &forvar[&fcnt] GOTO .checkit .setx tax GOTO .checkit .sety tay GOTO .checkit .checkit cmp &forfinal[&fcnt] bgt ~F&i2s(&sysindex) brl &for[&fcnt] .quit ~F&i2s(&sysindex) ; &fcnt seta &fcnt-1 mexit MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.branch b/appleworksgs/Macros/m16.branch new file mode 100755 index 0000000..3aef8d7 --- /dev/null +++ b/appleworksgs/Macros/m16.branch @@ -0,0 +1 @@ +;..............................................................................; ; ; Bgt & Ble - Branch greater than and branch less than equal ; ; Bgt adrs - Branch if Z flag clear and Carry set ; Ble adrs - Branch if Z flag set or Carry clear ; ;..............................................................................; MACRO bgt &adr beq *+4 bge &adr MEND MACRO ble &adr blt &adr beq &adr MEND ;..............................................................................; ; ; Jcc adrs - Jump (long branch) on condition code macros ; ; Jmi adrs - Branch if N flag set ; Jpl adrs - Branch if N flag clear ; Jeq adrs - Branch if Z flag set ; Jne adrs - Branch if Z flag clear ; Jcs adrs - Branch if carry set ; Jcc adrs - Branch if carry clear ; Jlt adrs - Branch if less than (carry clear) ; Jge adrs - Branch if greater than or equal (carry set) ; Jle adrs - Branch if less than or equal ; Jgt adrs - Branch if greater than ;..............................................................................; MACRO jmi &adr bpl *+5 brl &adr mexit MEND MACRO jpl &adr bmi *+5 brl &adr mexit MEND MACRO jeq &adr bne *+5 brl &adr mexit MEND MACRO jne &adr beq *+5 brl &adr mexit MEND MACRO jcs &adr bcc *+5 brl &adr mexit MEND MACRO jcc &adr bcs *+5 brl &adr mexit MEND MACRO jlt &adr bcs *+5 brl &adr mexit MEND MACRO jge &adr bcc *+5 brl &adr mexit MEND MACRO jle &adr beq ~bra&sysindex bge ~nobra&sysindex ~bra&sysindex brl &adr ~nobra&sysindex mexit MEND MACRO jgt &adr blt ~nobra&sysindex beq ~nobra&sysindex brl &adr ~nobra&sysindex mexit MEND ;..............................................................................; ; ; JTS tableadrs,index - Jump Subroutine Table Short ; BTS tableadrs,index - Jump Table Short ; ; Thess macros implement a short jump to subroutine using the value of the ; accumulator or index to index into the table for the subroutines address. ; ;..............................................................................; MACRO JTS &table,&index IF &nbr(&syslist) 2 THEN lda &index ENDIF asl a tax jsr (&table,x) MEND MACRO BTS &table,&index IF &nbr(&syslist) 2 THEN lda &index ENDIF asl a tax jmp (&table,x) MEND ;..............................................................................; ; ; JTL tableadrs - Jump Subroutine Table Long ; ; This macros implements a long jump to subroutine using the value of the ; accumulator to index into the given table for the subroutines address. ; ;..............................................................................; MACRO JTL &table,&index IF &nbr(&syslist) 2 THEN lda &index ENDIF asl a asl a tax lda &table+1,x sta ~b&sysindex+2 lda &table,x sta ~b&sysindex+1 ~b&sysindex jsl * mexit MEND ******************************************************************** * * AWGS WP module requires a case sensitive jsl to call the * SpellChecker. * * * * Thursday, May 4, 1989 11:16:10 AM ******************************************************************** MACRO &lab Case_Jsl &to &lab Case Object jsl &to Case Off mend \ No newline at end of file diff --git a/appleworksgs/Macros/m16.cmp b/appleworksgs/Macros/m16.cmp new file mode 100755 index 0000000..c734d7c --- /dev/null +++ b/appleworksgs/Macros/m16.cmp @@ -0,0 +1 @@ +;............................................................................; ; ; Compare long word for zero macro ; ; Cpzl addr Cpzl addr:#off ; Cpzl addr:x Cpzl [zp] ; Cpzl addr:y Cpzl [zp]:y ; Cpzl addr:s Cpzl [zp]:off ; Cpzl addr:off Cpzl [zp]:#off ; ;............................................................................; MACRO &lab Cpzl &loc &lab ; lclc &char lcla &offset lclc &rest lclc &disp &char setc &substr(&loc,1,1) &offset seta &pos(':',&loc) IF &offset GOTO .docmpoff IF (&char='[') GOTO .docmpzp lda &loc ora &loc+2 mexit .docmpzp lda &loc ldy #2 ora &loc,y mexit .docmpoff &rest setc &substr(&loc,1,&offset-1) &disp setc &substr(&loc,&offset+1,&len(&loc)-&offset) IF &char='[' GOTO .docmpoffzp IF (&disp='s') or (&disp='x') or (&disp='y') GOTO .docmpoffi ldx &disp &disp setc 'x' .docmpoffi lda &rest,&disp ora &rest+2,&disp mexit .docmpoffzp IF (&disp='y') GOTO .doy ldy &disp .doy lda &rest,y iny iny ora &rest,y mexit MEND *=======================================================================* macro &lab CmpByte &from,&to &lab cmpb &from,&to mend *=======================================================================* macro &lab CmpWord &from,&to &lab cmpw &from,&to mend *=======================================================================* macro &lab CmpLong &from,&to &lab cmpl &from,&to mend *=======================================================================* MACRO &lab Cmpl &from,&to &lab ; lcla &noy1 lcla &noy2 lcla &nox1 lcla &nox2 lcla &ypushed lcla &yinced lcla &xpushed lcla &yhas2 lcla &const1 lcla &addr1 lcla &a1off lcla &a2off lcla &needbra lcla &sameoff lclc &cmpreg lclc &fdisp lclc &tdisp lclc &floc lclc &tloc lclc &fchar lclc &tchar lcla &foffset lcla &toffset lclc &newfrom lclc &newto lcla &num &newfrom setc &from &newto setc &to &fchar setc &substr(&from,1,1) &tchar setc &substr(&to,1,1) &foffset seta &pos(':',&from) &toffset seta &pos(':',&to) IF &foffset=0 GOTO .nofoff &floc setc &substr(&from,1,&foffset-1) &fdisp setc &substr(&from,&foffset+1,&len(&from)-&foffset) .nofoff IF &toffset GOTO .gettoff GOTO .setnox2 .gettoff &tloc setc &substr(&to,1,&toffset-1) &tdisp setc &substr(&to,&toffset+1,&len(&to)-&toffset) IF (&tdisp='s') or (&tdisp='y') or (&tchar='[') GOTO .setnox2 IF (&tdisp='x') GOTO .setnoy2 &a2off seta 1 GOTO .setnoy2 .setnox2 &nox2 seta 1 IF (&tdisp='y') GOTO .notoff .setnoy2 &noy2 seta 1 .notoff IF not (&foffset and &toffset) GOTO .notsame &num seta &pos(&tdisp,&fdisp) IF &num=0 GOTO .notsame IF (&tchar='[') and (&fchar'[') GOTO .notsame IF (&fchar='[') and (&tchar'[') GOTO .notsame &sameoff seta 1 .notsame &cmpreg setc 'a' IF &foffset GOTO .fromoff IF &fchar='[' GOTO .fromzp IF &fchar='#' GOTO .fromimm IF &from='ax' GOTO .fromxhigh IF (&from='ay') or (&from='xy') GOTO .fromyhigh &addr1 seta 1 lda &from+2 GOTO .doto .fromyhigh &cmpreg setc 'y' GOTO .doto .fromxhigh &cmpreg setc 'x' GOTO .doto .fromimm &newfrom setc &substr(&from,2,&len(&from)-1) lda #^&newfrom &const1 seta 1 GOTO .doto .fromzp IF &noy2 GOTO .fromzpnophy phy &ypushed seta 1 .fromzpnophy ldy #2 lda &from,y &yhas2 seta 1 &nox1 seta 1 GOTO .doto .fromoff IF &fdisp='y' GOTO .fromy IF &fchar='[' GOTO .fromzpoff &noy1 seta 1 IF &fdisp='x' GOTO .fromx IF &fdisp='s' GOTO .froms &a1off seta 1 IF &sameoff GOTO .fromoffonly1 IF &a2off GOTO .nofromphx IF not (&nox2) GOTO .fromoffphx &newfrom setc &concat(&floc,':x') GOTO .nofromphx .fromoffonly1 &newto setc &concat(&tloc,':x') &newfrom setc &concat(&floc,':x') GOTO .nofromphx .fromoffphx phx &xpushed seta 1 .nofromphx ldx &fdisp lda &floc+2,x GOTO .doto .fromzpoff &nox1 seta 1 IF &noy2 GOTO .fromzpoffldy phy &ypushed seta 1 .fromzpoffldy ldy &fdisp+2 lda &floc,y GOTO .doto .froms &nox1 seta 1 lda &floc+2,s GOTO .doto .fromy &nox1 seta 1 IF &fchar='[' GOTO .fromyzp lda &floc+2,y GOTO .doto .fromyzp phy iny iny &ypushed seta 1 &yinced seta 1 lda &floc,y IF &tchar='[' GOTO .doto IF not (&noy2) GOTO .doto ply &ypushed seta 0 &yinced seta 0 GOTO .doto .fromx lda &floc+2,x GOTO .doto .doto IF &toffset GOTO .tooff IF &tchar='[' GOTO .tozp IF &tchar='#' GOTO .toimm cp&cmpreg &to+2 GOTO .dolow .toimm &newto setc &substr(&to,2,&len(&to)-1) cp&cmpreg #^&newto GOTO .dolow .tozp IF &yhas2 GOTO .tozpnoload IF &ypushed GOTO .tozpload IF &noy1 or &const1 or &addr1 GOTO .tozpload IF (&fdisp'y') and (&fchar='[') GOTO .tozpload phy &ypushed seta 1 .tozpload ldy #2 .tozpnoload cp&cmpreg &to,y GOTO .dolow .tooff IF &tdisp='x' GOTO .tox IF &tdisp='y' GOTO .toy IF &tdisp='s' GOTO .tos IF &tchar='[' GOTO .tozpoff IF &sameoff GOTO .noloadx IF &xpushed or &a1off GOTO .loadx IF not (&nox1 or &const1 or &addr1) GOTO .tooffphx &newto setc &concat(&tloc,':x') GOTO .loadx .tooffphx phx &xpushed seta 1 .loadx ldx &tdisp .noloadx cp&cmpreg &tloc+2,x GOTO .dolow .tozpoff IF &sameoff GOTO .noloady IF &ypushed GOTO .loady IF &noy1 or &const1 or &addr1 GOTO .loady IF (&fdisp'y') and (&fchar='[') GOTO .loady IF &foffset=0 GOTO .loady phy &ypushed seta 1 .loady ldy &tdisp+2 .noloady cp&cmpreg &tloc,y GOTO .dolow .tos cp&cmpreg &tloc+2,s GOTO .dolow .toy IF &tchar='[' GOTO .toyzp IF not (&ypushed) GOTO .toydo ply &ypushed seta 0 .toydo cp&cmpreg &tloc+2,y GOTO .dolow .toyzp IF &yinced GOTO .toyzpdo IF not (&ypushed) GOTO .toypush ply .toypush phy &ypushed seta 1 iny iny .toyzpdo cp&cmpreg &tloc,y GOTO .dolow .tox IF not (&xpushed) GOTO .toxdo plx &xpushed seta 0 .toxdo cp&cmpreg &tloc+2,x GOTO .dolow .dolow bne ~b&sysindex IF not (&xpushed or &ypushed) GOTO .dolow2 IF not (&xpushed) GOTO .checky plx .checky IF not (&ypushed) GOTO .dolow2 ply .dolow2 &newfrom setc &from IF (&from='ax') or (&from='ay') GOTO .setalow IF not (&from='xy') GOTO .dolow3 &newfrom setc 'x' GOTO .dolow3 .setalow &newfrom setc 'a' .dolow3 cmpw &newfrom,&to IF not (&xpushed or &ypushed) GOTO .finish bra ~a&sysindex .finish ~b&sysindex ; IF (&xpushed or &ypushed) GOTO .doend mexit .doend IF not (&xpushed) GOTO .chky plx .chky IF &ypushed GOTO .gety ~a&sysindex ; mexit .gety ply ~a&sysindex ; mend ******************************************************************** * This macro compares 2 bytes * * Wednesday, April 26, 1989 11:13:20 PM ******************************************************************** MACRO &lab Cmpb &from,&to &lab short m Cmpw &from,&to long m Mend *=======================================================================* MACRO &lab Cmpw &from,&to &lab ; lcla &sameoff lcla &nox2 lcla &noy2 lclc &cmpreg lclc &fdisp lclc &tdisp lclc &floc lclc &tloc lcla &foffset lcla &toffset lclc &fchar lclc &tchar lcla &num lclc &newfrom &newfrom setc &from lcla &ppos &ppos seta &pos('.',&from) IF &ppos=0 GOTO .noeval eval &from &newfrom setc 'a' .noeval &fchar setc &substr(&newfrom,1,1) &tchar setc &substr(&to,1,1) &foffset seta &pos(':',&newfrom) &toffset seta &pos(':',&to) IF &foffset=0 GOTO .nofoff &floc setc &substr(&from,1,&foffset-1) &fdisp setc &substr(&from,&foffset+1,&len(&newfrom)-&foffset) .nofoff IF &toffset GOTO .gettoff GOTO .setnox2 .gettoff &tloc setc &substr(&to,1,&toffset-1) &tdisp setc &substr(&to,&toffset+1,&len(&to)-&toffset) IF (&tdisp='s') or (&tdisp='y') or (&tchar='[') GOTO .setnox2 GOTO .setnoy2 .setnox2 &nox2 seta 1 IF (&tdisp='y') GOTO .notoff .setnoy2 &noy2 seta 1 .notoff IF not (&foffset and &toffset) GOTO .notsame &num seta &pos(&tdisp,&fdisp) IF &num=0 GOTO .notsame IF (&tchar='[') and (&fchar'[') GOTO .notsame IF (&fchar='[') and (&tchar'[') GOTO .notsame &sameoff seta 1 .notsame &cmpreg setc 'a' IF &foffset GOTO .fromoff IF (&newfrom='a') or (&newfrom='x') or (&newfrom='y') GOTO .fromreg IF &fchar='#' AND &pos(&substr(&newfrom,2,1),'<^>')=0 THEN lda #<&substr(&newfrom,2,&len(&newfrom)-1) ELSE lda &newfrom ENDIF GOTO .doto .fromreg &cmpreg setc &newfrom GOTO .doto .fromoff IF (&fdisp='x') or (&fdisp='y') or (&fdisp='s') GOTO .foffreg IF &fchar='[' GOTO .fromoffzp IF (&nox2) GOTO .dofromoff IF not (&tdisp='x') GOTO .dofromoff phx .dofromoff ldx &fdisp lda &concat(&floc,',x') IF &nox2 GOTO .doto IF not (&tdisp='x') GOTO .doto plx GOTO .doto .fromoffzp IF &noy2 GOTO .dofromoffzp phy .dofromoffzp ldy &fdisp lda &concat(&floc,',y') IF &noy2 GOTO .doto ply GOTO .doto .foffreg lda &concat(&floc,',',&fdisp) .doto IF &toffset GOTO .tooff IF &substr(&to,1,1)='#' THEN cp&cmpreg #<&substr(&to,2,&len(&to)-1) ELSE cp&cmpreg &to ENDIF mexit .tooff IF (&tdisp='x') or (&tdisp='y') or (&tdisp='s') GOTO .dotooff IF &tchar='[' GOTO .tooffzp IF &sameoff GOTO .noloadx ldx &tdisp .noloadx cp&cmpreg &concat(&tloc,',x') mexit .tooffzp IF &sameoff GOTO .noloady ldy &tdisp .noloady cp&cmpreg &concat(&tloc,',y') mexit .dotooff cp&cmpreg &concat(&tloc,',',&tdisp) mend *=======================================================================* MACRO &lab Scmpw &from,&to &lab ; lcla &sameoff lcla &nox2 lcla &noy2 lclc &cmpreg lclc &fdisp lclc &tdisp lclc &floc lclc &tloc lcla &foffset lcla &toffset lclc &fchar lclc &tchar lcla &num lclc &newfrom lclc &newto &newfrom setc &from &newto setc &to &fchar setc &substr(&newfrom,1,1) &tchar setc &substr(&newto,1,1) &foffset seta &pos(':',&newfrom) &toffset seta &pos(':',&newto) IF &foffset=0 GOTO .nofoff &floc setc &substr(&newfrom,1,&foffset-1) &fdisp setc &substr(&newfrom,&foffset+1,&len(&newfrom)-&foffset) .nofoff IF &toffset GOTO .gettoff GOTO .setnox2 .gettoff &tloc setc &substr(&newto,1,&toffset-1) &tdisp setc &substr(&newto,&toffset+1,&len(&newto)-&toffset) IF (&tdisp='s') or (&tdisp='y') or (&tchar='[') GOTO .setnox2 GOTO .setnoy2 .setnox2 &nox2 seta 1 IF (&tdisp='y') GOTO .notoff .setnoy2 &noy2 seta 1 .notoff IF not (&foffset and &toffset) GOTO .notsame &num seta &pos(&tdisp,&fdisp) IF &num=0 GOTO .notsame IF (&tchar='[') and (&fchar'[') GOTO .notsame IF (&fchar='[') and (&tchar'[') GOTO .notsame &sameoff seta 1 .notsame &cmpreg setc 'a' IF &foffset GOTO .fromoff IF (&newfrom='a') or (&newfrom='x') or (&newfrom='y') GOTO .fromreg sec lda &newfrom GOTO .doto .fromreg &cmpreg setc &newfrom sec GOTO .doto .fromoff IF (&fdisp='x') or (&fdisp='y') or (&fdisp='s') GOTO .foffreg IF &fchar='[' GOTO .fromoffzp IF (&nox2) GOTO .dofromoff IF not (&tdisp='x') GOTO .dofromoff phx .dofromoff ldx &fdisp &newfrom setc &concat(&floc,',x') sec lda &newfrom IF &nox2 GOTO .doto IF not (&tdisp='x') GOTO .doto plx GOTO .doto .fromoffzp IF &noy2 GOTO .dofromoffzp phy .dofromoffzp ldy &fdisp &newfrom setc &concat(&floc,',y') sec lda &newfrom IF &noy2 GOTO .doto ply GOTO .doto .foffreg &newfrom setc &concat(&floc,',',&fdisp) sec lda &newfrom .doto IF &toffset=0 GOTO .enditall .tooff IF (&tdisp='x') or (&tdisp='y') or (&tdisp='s') GOTO .dotooff IF &tchar='[' GOTO .tooffzp IF &sameoff GOTO .noloadx ldx &tdisp .noloadx &newto setc &concat(&tloc,',x') GOTO .enditall .tooffzp IF &sameoff GOTO .noloady ldy &tdisp .noloady &newto setc &concat(&tloc,',y') GOTO .enditall .dotooff &newto setc &concat(&tloc,',',&tdisp') .enditall sbc &newto beq ~done&sysindex clc bvs ~invert&sysindex bmi ~done&sysindex bra ~greater&sysindex ~invert&sysindex bpl ~done&sysindex ~greater&sysindex sec ~done&sysindex ; MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.eval b/appleworksgs/Macros/m16.eval new file mode 100755 index 0000000..f5c8205 --- /dev/null +++ b/appleworksgs/Macros/m16.eval @@ -0,0 +1 @@ +;..............................................................................; ; ; EVAL - Evaluate word expression to A ; ; eval expression ; ; The first operand in an expression may or may not be present. If it is ; present then the accumulator will be loaded with its value before expression ; evaluation begins. ; ; Sample expressions: ; ; eval 'Var1.+Var2.-Var3.+#10' ; eval '.*Var3./Var4.%Var5' ; ; Note: ; ; Eleven operations are supported +,-,*,/,% (mod), ^ (and), | (or), x (eor), < (asl), ; > (lsr), i (inc), and d (dec). Each of these must be preceded by a '.' and no spaces ; can be present in the expression. The expression should be quoted. Also note that ; both immediate and variable word values may be operands. ; ;..............................................................................; MACRO &lab eval &exp &lab lclc &operand lcla &opstart lclc &newexp IF (&substr(&exp,1,1) = '''') or (&substr(&exp,1,1) = '"') THEN &newexp setc &substr(&exp,2,&len(&exp)-2) ELSE &newexp setc &exp ENDIF &operand setc &substr(&newexp,1,1) IF &operand='.' GOTO .no1op &opstart seta &pos('.',&newexp) IF &opstart>0 GOTO .doexp lda &newexp mexit .doexp &operand setc &substr(&newexp,1,&opstart-1) &newexp setc &substr(&newexp,&opstart,&len(&newexp)-&opstart+1) lda &operand .no1op eval2 &newexp mexit MEND ; ; Eval2 is the heart of the eval macro ; MACRO &lab eval2 &exp &lab ; IF (&nbr(&syslist)=0) GOTO .done lclc &op lclc &operand lclc &rest lcla &restbegin lclc &newexp &newexp setc &exp .start &op setc &substr(&newexp,2,1) &rest setc &substr(&newexp,3,&len(&newexp)-2) &restbegin seta &pos('.',&rest) IF &restbegin>0 GOTO .ok &restbegin seta &len(&rest)+1 .ok &operand setc &substr(&rest,1,&restbegin-1) IF &op='+' GOTO .doadd IF &op='-' GOTO .dosub IF &op='*' GOTO .domul IF &op='/' GOTO .dodiv IF &op='%' GOTO .domod IF &op='^' GOTO .doand IF &op='|' GOTO .door IF &op='x' GOTO .doxor IF &op='<' GOTO .doasl IF &op='>' GOTO .dolsr IF &op='i' GOTO .doinc IF &op='d' GOTO .dodec .done mexit .doadd clc adc &operand GOTO .dorest .dosub sec sbc &operand GOTO .dorest .domul pha pha pha lda &operand pha _Multiply pla plx GOTO .dorest .dodiv pha pha pha lda &operand pha _SDivide pla plx GOTO .dorest .domod pha pha pha lda &operand pha _SDivide plx pla GOTO .dorest .doand and &operand GOTO .dorest .door ora &operand GOTO .dorest .doxor eor &operand GOTO .dorest .doasl asl a GOTO .dorest .dolsr lsr a GOTO .dorest .doinc inc a GOTO .dorest .dodec dec a GOTO .dorest .dorest &restbegin seta &pos('.',&rest) IF &restbegin>0 GOTO .next mexit .next &newexp setc &substr(&rest,&restbegin,&len(&rest)-&restbegin+1) GOTO .start mexit MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.math b/appleworksgs/Macros/m16.math new file mode 100755 index 0000000..3e55287 --- /dev/null +++ b/appleworksgs/Macros/m16.math @@ -0,0 +1 @@ + ;.............................................................................. ; ; StyleWare Macros` ; ; Macros...: AddWord, AddLong, SubWord, SubLong ; Author...: Mike Hibbetts, (2.0 conversion Scott Lindsey) ; Date.....: June 30, 1987 ... Oct 22,1988 ; Version..: 2.0 ; ; The following is a short description of the available addressing ; modes that may be used with the math macros in m16.math. ; ; Notes: 'a', 'x', and 'y' denote the 65816 registers. ; 's' denotes that an operand is to be either pulled or pushed. ; ; For programmer based optimization, it should be noted that all zero ; page indirect indexing is done out of the 'y' register, and all other ; indexing is done out of the 'x' register. So, for example, ; ; AddLong Addr:#4,[zp]:#4,>Long ; is better coded as ; ldy #4 ; AddLong Addr:y,[zp]:y,>Long, ; (it saves on 1 'ldx') ; and ; ; SubLong Addr1:#offset1,>Long:#offset2,Addr3 ; is better coded as ; ldy #offset2 ; SubLong Addr1:#offset1,>Long:y,Addr3. ; (it saves on 3 'ldx' and costs 1 'ldy') ; ; All other optimizations have been done internally to the macros. ;............................................................................. ; ; Where ; ; P = { Addr, Addr:#offset, Addr:offset, Addr:x, Addr:y, ; [zp], [zp]:#offset, [zp]:offset, [zp]:y, zp:s ; Long, Long:#offset, Long:offset, Long:x, s }, ; ; Q = { a, x, y, #const } + P, ; ; R = { #const } + P, and ; ; T = { a, x, y } + P, ; ; all ; ; AddWord Q,R,T ; AddLong Q,R,P ; SubWord Q,R,T ; SubLong Q,R,P ; ; are allowed. ; ;----------------------------------------------------------------------------- MACRO &lab AddWord &term1,&term2,&dest &lab ; Arith 2,adc,clc,&term1,&term2,&dest MEND MACRO &lab Addw &term1,&term2,&dest &lab AddWord &term1,&term2,&dest MEND ;---------------------------------------------------------------------------- MACRO &lab AddLong &term1,&term2,&dest &lab ; Arith 4,adc,clc,&term1,&term2,&dest MEND MACRO &lab AddL &term1,&term2,&dest &lab AddLong &term1,&term2,&dest MEND ;---------------------------------------------------------------------------- MACRO &lab SubWord &term1,&term2,&dest &lab ; Arith 2,sbc,sec,&term1,&term2,&dest MEND MACRO &lab Subw &term1,&term2,&dest &lab SubWord &term1,&term2,&dest MEND ;---------------------------------------------------------------------------- MACRO &lab SubLong &term1,&term2,&dest &lab ; Arith 4,sbc,sec,&term1,&term2,&dest MEND MACRO &lab Subl &term1,&term2,&dest &lab SubLong &term1,&term2,&dest MEND ;---------------------------------------------------------------------------- MACRO Arith &length,&op1,&op2,&term1,&term2,&dest gbla &same gbla &Yinc gblc &lastX gblc &lastY gbla &OFFinc gblc &pushed &same SETA 0 &OFFinc SETA 0 &Yinc SETA 0 &pushed SETC '' &lastX SETC '' &lastY SETC '' lcla &colon lcla &stack1 lcla &pull1 lcla &pull2 lcla &zp1 lcla &zp2 lcla &zp3 lclc &addr1 lclc &off1 lclc &addr2 lclc &off2 lclc &addr3 lclc &off3 lclc &badreg &badreg SETC 'y' lclc &jump1 lclc &jump2 lclc &jump3 IF &substr(&term1,1,1)'[' GOTO .doterm12 &zp1 seta 1 .doterm12 &colon seta &pos(':',&term1) IF &colon=0 GOTO .no1offset &off1 SETC &substr(&term1,&colon+1,&len(&term1)-&colon) &addr1 SETC &substr(&term1,1,&colon-1) GOTO .doterm21 .no1offset &addr1 SETC &term1 .doterm21 IF &substr(&term2,1,1)'[' GOTO .doterm22 &zp2 seta 1 .doterm22 &colon seta &pos(':',&term2) IF &colon=0 GOTO .no2offset &off2 SETC &substr(&term2,&colon+1,&len(&term2)-&colon) &addr2 SETC &substr(&term2,1,&colon-1) GOTO .dodest1 .no2offset &addr2 SETC &term2 .dodest1 IF &substr(&dest,1,1)'[' GOTO .dodest2 &zp3 seta 1 &badreg SETC 'x' .dodest2 &colon seta &pos(':',&dest) IF &colon=0 GOTO .no3offset &off3 SETC &substr(&dest,&colon+1,&len(&dest)-&colon) &addr3 SETC &substr(&dest,1,&colon-1) IF &off3'y' GOTO .start &badreg SETC 'x' GOTO .start .no3offset &addr3 SETC &dest IF &addr3'y' GOTO .start &badreg SETC 'x' .start IF &zp1 GOTO .loadzp1 IF &len(&off1) GOTO .withoff11 IF &addr1='a' GOTO .loadR1 IF &addr1='x' GOTO .loadx1 IF &addr1='y' GOTO .loady1 IF &addr1='s' GOTO .loads1 .; Changed 5/16/89 MSL IF (&substr(&addr1,1,1) = '#') THEN lda #<&substr(&addr1,2,&len(&addr1)-1) ELSE lda &addr1 ENDIF .; &jump1 SETC '.load2' GOTO .loaded1 ; ----------------- .loadx1 txa GOTO .loadR1 .loady1 tya .loadR1 &jump1 SETC '.loadR2' GOTO .loaded1 ; ----------------- .loads1 IF &off2='s' GOTO .loads12 IF &off3='s' GOTO .loads12 IF &length='2' GOTO .loads11 &stack1 seta 1 .loads11 pla &jump1 SETC '.loads2' GOTO .loaded1 ; ----------------- .loads12 lda 1,s &jump1 SETC '.loads22' &pull1 seta 1 GOTO .loaded1 ; ----------------- .loadzp1 IF &len(&off1) GOTO .loadzpo1 lda &addr1 &jump1 SETC '.loadzp2' GOTO .loaded1 ; ----------------- .loadzpo1 IF &off1='y' GOTO .loadzpy1 &jump1 SETC '.loadzpo2' IF (&off2'y') and (&off3'y') GOTO .loadzpo12 phy &pushed SETC 'y' &jump1 SETC '.loadzpo22' .loadzpo12 ldy &off1 lda &addr1,y &lastY SETC &off1 GOTO .loaded1 ; ------------------ .loadzpy1 lda &addr1,&off1 &jump1 SETC '.loadzpy2' GOTO .loaded1 ; ------------------ .withoff11 IF &off1='x' GOTO .loffx1 IF &off1='y' GOTO .loffy1 IF &off1='s' GOTO .loffs1 &jump1 SETC '.loadoff2' IF (&off2'x') and (&off3'x') GOTO .withoff112 phx &pushed SETC 'x' &jump1 SETC '.loadoff22' .withoff112 ldx &off1 lda &addr1,x &lastX SETC &off1 GOTO .loaded1 ; ----------------- .loffx1 lda &addr1,x &jump1 SETC '.loffx2' GOTO .loaded1 ; ------------------- .loffy1 lda &addr1,y &jump1 SETC '.loffy2' GOTO .loaded1 ; ------------------- .loffs1 lda &addr1,s &jump1 SETC '.loffs2' .loaded1 &op2 IF &zp2 GOTO .addzp1 IF &len(&off2) GOTO .withoff12 IF &addr2='s' GOTO .adds11 IF &substr(&addr2,1,1)='#' THEN &op1 #<&substr(&addr2,2,&len(&addr2)-1) ELSE &op1 &addr2 ENDIF &jump2 SETC '.add2' GOTO .added1 ; ----------------- .adds11 STreset &pull2 seta 1 IF &pull1 GOTO .adds12 IF &stack1 GOTO .adds13 &op1 1,s &jump2 SETC '.adds21' GOTO .added1 ; ----------------- .adds12 &op1 1+&length,s &jump2 SETC '.adds22' GOTO .added1 ; ----------------- .adds13 &op1 3,s &jump2 SETC '.adds21' GOTO .added1 ; ----------------- .addzp1 IF &len(&off2) GOTO .addzpo1 &op1 &addr2 &jump2 SETC '.addzp2' GOTO .added1 ; ----------------- .addzpo1 IF &off2='y' GOTO .addzpy1 IF &len(&pushed) GOTO .addzpo12 IF &off3='y' GOTO .addzpo11 IF (&off1'y') or (&length='2') GOTO .addzpo12 .addzpo11 phy &pushed SETC 'y' .addzpo12 DoLoad 1,y,&off2 &op1 &addr2,y &jump2 SETC '.addzpo2' GOTO .added1 ; ------------------ .addzpy1 IF &pushed'y' GOTO .loadzpy12 ply &pushed SETC '' &lastY SETC '' .loadzpy12 &op1 &addr2,&off2 &jump2 SETC '.addzpy2' GOTO .added1 ; ------------------ .withoff12 IF &off2='x' GOTO .aoffx1 IF &off2='y' GOTO .aoffy1 IF &off2='s' GOTO .aoffs1 IF &len(&pushed) GOTO .withoff122 IF &off3='x' GOTO .withoff121 IF (&off1'x') or (&length='2') GOTO .withoff122 .withoff121 phx &pushed SETC 'x' .withoff122 DoLoad 1,x,&off2 &op1 &addr2,x &jump2 SETC '.addoff2' GOTO .added1 ; ----------------- .aoffx1 IF &pushed'x' GOTO .aoffx12 plx &pushed SETC '' &lastX SETC '' .aoffx12 &op1 &addr2,x &jump2 SETC '.aoffx2' GOTO .added1 ; ------------------- .aoffy1 IF &pushed'y' GOTO .aoffy12 ply &pushed SETC '' &lastY SETC '' .aoffy12 &op1 &addr2,y &jump2 SETC '.aoffy2' GOTO .added1 ; ------------------- .aoffs1 STreset &op1 &addr2,s &jump2 SETC '.aoffs2' .added1 IF &zp3 GOTO .storezp1 IF &len(&off3) GOTO .withoff13 IF &addr3='a' GOTO .storeR1 IF &addr3='x' GOTO .storex1 IF &addr3='y' GOTO .storey1 IF &addr3='s' GOTO .stores1 sta &addr3 &jump3 SETC '.store2' GOTO .stored1 ; ------------------ .storex1 tax GOTO .storeR1 .storey1 tay .storeR1 &jump3 SETC '.error1' GOTO .stored1 ; ------------------ .stores1 STreset IF &pull1 or &pull2 GOTO .stores12 IF &stack1 GOTO .stores13 IF &length='2' GOTO .stores111 pha .stores111 pha &jump3 SETC '.stores2' GOTO .stored1 ; ----------------- .stores12 IF &stack1 GOTO .stores14 sta 1,s &jump3 SETC '.stores2' &pull1 seta 0 &pull2 seta 0 GOTO .stored1 ; ----------------- .stores13 pha &jump1 SETC '.loads22' &jump3 SETC '.stores2' GOTO .stored1 ; ----------------- .stores14 sta 3,s &jump3 SETC '.stores2' &pull1 seta 0 &pull2 seta 0 GOTO .stored1 ; ------------------ .storezp1 IF &len(&off3) GOTO .storezpo1 sta &addr3 &jump3 SETC '.storezp2' GOTO .stored1 ; ----------------- .storezpo1 IF &off3='y' GOTO .storezpy1 IF &len(&pushed) or (&length='2') GOTO .storezpo12 IF (&off1'y') and (&off2'y') GOTO .storezpo12 phy &pushed SETC 'y' .storezpo12 DOLoad 1,y,&off3 sta &addr3,y &jump3 SETC '.storezpo2' GOTO .stored1 ; ------------------ .storezpy1 IF &pushed'y' GOTO .storezpy12 ply &pushed SETC '' &lastY SETC '' .storezpy12 sta &addr3,&off3 &jump3 SETC '.storezpy2' GOTO .stored1 ; ------------------ .withoff13 IF &off3='x' GOTO .soffx1 IF &off3='y' GOTO .soffy1 IF &off3='s' GOTO .soffs1 IF &len(&pushed) or (&length='2') GOTO .withoff132 IF (&off1'x') and (&off2'x') GOTO .withoff132 phx &pushed SETC 'x' .withoff132 DoLoad 1,x,&off3 sta &addr3,x &jump3 SETC '.storeoff2' GOTO .stored1 ; ----------------- .soffx1 IF &pushed'x' GOTO .soffx12 plx &pushed SETC '' &lastX SETC '' .soffx12 sta &addr3,x &jump3 SETC '.soffx2' GOTO .stored1 ; ------------------- .soffy1 IF &pushed'y' GOTO .soffy12 ply &pushed SETC '' &lastY SETC '' .soffy12 sta &addr3,y &jump3 SETC '.soffy2' GOTO .stored1 ; ------------------- .soffs1 STreset sta &addr3,s &jump3 SETC '.soffs2' .stored1 IF &length='2' GOTO .stored2 GOTO &jump1 ;-------------------------------------------------------------- .load2 HighByte lda,&addr1 GOTO .loaded2 ; ----------------- .loadR2 lda #0 GOTO .loaded2 ; ----------------- .loads2 STreset pla GOTO .loaded2 ; ----------------- .loads22 STreset lda 3,s GOTO .loaded2 ; ----------------- .loadzp2 IF &len(&pushed) GOTO .loadzp22 IF (&off2'y') and (&off3'y') GOTO .loadzp22 phy &pushed SETC 'y' .loadzp22 DoLoad 1,y,#2 lda &addr1,y GOTO .loaded2 ; ----------------- .loadzpo22 IF &len(&pushed) GOTO .loadzpo2 phy &pushed SETC 'y' .loadzpo2 DoLoad 2,y,&off1 lda &addr1,y GOTO .loaded2 ; ------------------ .loadzpy2 IF &pushed'y' GOTO .loadzpy21 ply &pushed SETC '' &lastY SETC '' .loadzpy21 doY lda &addr1,&off1 GOTO .loaded2 ; ------------------ .loadoff22 IF &len(&pushed) GOTO .loadoff2 phx &pushed SETC 'x' .loadoff2 DoLoad 1,x,&off1 lda &addr1+2,x GOTO .loaded2 ; ----------------- .loffx2 IF &pushed'x' GOTO .loffx21 plx &pushed SETC '' &lastX SETC '' .loffx21 lda &addr1+2,x GOTO .loaded2 ; ------------------- .loffy2 IF &pushed'y' GOTO .loffy21 ply &pushed SETC '' &lastY SETC '' .loffy21 IF &Yinc GOTO .loffy22 lda &addr1+2,y GOTO .loaded2 ; ------------------- .loffy22 lda &addr1,y GOTO .loaded2 ; ------------------- .loffs2 STreset lda &addr1+2,s .loaded2 GOTO &jump2 ;------------------------------ ;------------------------------ .add2 HighByte &op1,&addr2 GOTO .added2 ; ----------------- .adds21 STreset &op1 3,s GOTO .added2 ; ----------------- .adds22 &op1 3+&length,s GOTO .added2 ; ----------------- .addzp2 IF &len(&pushed) or (&off3'y') GOTO .addzp22 phy &pushed SETC 'y' .addzp22 DoLoad 1,y,#2 &op1 &addr2,y GOTO .added2 ; ----------------- .addzpo2 IF &len(&pushed) or (&off3'y') GOTO .addzpo22 phy &pushed SETC 'y' .addzpo22 DoLoad 2,y,&off2 &op1 &addr2,y GOTO .added2 ; ------------------ .addzpy2 IF &pushed'y' GOTO .addzpy22 ply &pushed SETC '' &lastY SETC '' .addzpy22 doY &op1 &addr2,&off2 GOTO .added2 ; ------------------ .addoff2 IF &len(&pushed) or (&off3'x') GOTO .addoff22 phx &pushed SETC 'x' .addoff22 DoLoad 1,x,&off2 &op1 &addr2+2,x GOTO .added2 ; ----------------- .aoffx2 IF &pushed'x' GOTO .aoffx22 plx &pushed SETC '' &lastX SETC '' .aoffx22 &op1 &addr2+2,x GOTO .added2 ; ------------------- .aoffy2 IF &pushed'y' GOTO .aoffy22 ply &pushed SETC '' &lastY SETC '' .aoffy22 IF &Yinc GOTO .aoffy23 &op1 &addr2+2,y GOTO .added2 ; ------------------- .aoffy23 &op1 &addr2,y GOTO .added2 ; ------------------- .aoffs2 STreset &op1 &addr2+2,s .added2 GOTO &jump3 ;------------------------------ ;------------------------------ .error1 MNOTE 'Register cannot hold long integer.',4 GOTO .stored2 ; ------------------ .store2 HighByte sta,&addr3 GOTO .stored2 ; ------------------ .stores2 STreset sta 3,s GOTO .stored2 ; ----------------- .storezp2 DoLoad 1,y,#2 sta &addr3,y GOTO .stored2 ; ----------------- .storezpo2 DoLoad 2,y,&off3 sta &addr3,y GOTO .stored2 ; ------------------ .storezpy2 IF &pushed'y' GOTO .storezpy22 ply &pushed SETC '' &lastY SETC '' .storezpy22 doY sta &addr3,&off3 GOTO .stored2 ; ------------------ .storeoff2 DoLoad 1,x,&off3 sta &addr3+2,x GOTO .stored2 ; ----------------- .soffx2 IF &pushed'x' GOTO .soffx22 plx &pushed SETC '' &lastX SETC '' .soffx22 sta &addr3+2,x GOTO .stored2 ; ------------------- .soffy2 IF &pushed'y' GOTO .soffy22 ply &pushed SETC '' &lastY SETC '' .soffy22 IF &Yinc GOTO .soffy23 sta &addr3+2,y GOTO .stored2 ; ------------------- .soffy23 sta &addr3,y GOTO .stored2 ; ------------------- .soffs2 STreset sta &addr3+2,s .stored2 IF &pull1=0 GOTO .stored210 IF &length='2' GOTO .stored205 pl&badreg .stored205 pl&badreg .stored210 IF &pull2=0 GOTO .stored220 IF &length='2' GOTO .stored215 pl&badreg .stored215 pl&badreg .stored220 MEND ;------------------------------------------------------------------------------ MACRO HighByte &oper,&loc lclc &c lclc &rest IF &substr(&loc,1,1)='#' GOTO .b &oper &loc+2 MEXIT .b &rest SETC &substr(&loc,2,&len(&loc)-1) &oper #^&rest MEND ;-------------------------------------------------------- MACRO DoLoad &half,®,&value gbla &same gbla &OFFinc IF &half='1' GOTO .c IF &substr(&value,1,1)='#' GOTO .a Check ®,&value IF &same GOTO .e ld® &value in® in® &OFFinc seta 1 MEXIT .e IF &OFFinc GOTO .done in® in® &OFFinc seta 1 MEXIT .a Check ®,&value+2 IF &same GOTO .done ld® &value+2 &OFFinc seta 1 MEXIT .c Check ®,&value IF &same GOTO .done ld® &value .done MEND ;----------------------------------------------------- MACRO doY GBLA &Yinc IF &Yinc GOTO .done &Yinc seta 1 iny iny .done MEND ;------------------------------------------------- MACRO STreset GBLC &pushed GBLC &lastX IF &len(&pushed)=0 GOTO .done IF &pushed='y' GOTO .d plx &pushed SETC '' &lastX SETC '' MEXIT .d ply &pushed SETC '' &lastY SETC '' .done MEND ;------------------------------------------------- MACRO Check ®,&string gbla &same gblc &lastX gblc &lastY lcla &search IF ®='y' GOTO .regy IF &len(&lastx)&len(&string) GOTO .nomatchx &search seta &pos(&string,&lastx) IF &search=0 GOTO .nomatchx GOTO .match .regy IF &len(&lastY)&len(&string) GOTO .nomatchy &search seta &pos(&string,&lasty) IF &search=0 GOTO .nomatchy .match &same seta 1 MEXIT .nomatchx &same seta 0 &lastX SETC &string MEXIT .nomatchy &same seta 0 &lastY SETC &string MEND ;------------------------------------------------------ ;............................................................... ; ; Addwl - add word quickly to long word in place ;............................................................... MACRO &lab addwl &a1,&a2 &lab ; IF (&a1='a' or &a1='A') GOTO .a lda &a1 .a clc adc &a2 sta &a2 bcc ~b&sysindex inc &a2+2 ~b&sysindex ; mend ;............................................................... ; ; Subwl - sub word quickly to long word in place ;............................................................... MACRO &lab subwl &a1,&a2 &lab ; IF (&a1='a' or &a1='A') GOTO .a lda &a2 .a sec sbc &a1 sta &a2 bcs ~b&sysindex dec &a2+2 ~b&sysindex ; mend ;------------------------------------------------------ MACRO &label Addwls &arg1,&arg2 &label AddWord &arg1,&arg2,a ldx &arg2+2 bcc ~b&sysindex inx ~b&sysindex phx pha MEND ;------------------------------------------------------ MACRO Mul2 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif asl &op MEND ;----------------------- MACRO Mul4 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif asl &op asl &op MEND ;----------------------- MACRO Mul8 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif asl &op asl &op asl &op MEND ;----------------------- MACRO Mul16 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif asl &op asl &op asl &op asl &op MEND ;----------------------- MACRO Mul32 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif asl &op asl &op asl &op asl &op asl &op MEND ;----------------------- MACRO Div2 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif lsr &op MEND ;----------------------- MACRO Div4 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif lsr &op lsr &op MEND ;----------------------- MACRO Div8 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif lsr &op lsr &op lsr &op MEND ;----------------------- MACRO Div16 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif lsr &op lsr &op lsr &op lsr &op MEND ;----------------------- MACRO Div32 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif lsr &op lsr &op lsr &op lsr &op lsr &op MEND ;----------------------- MACRO Inc4 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif inc &op inc &op inc &op inc &op MEND ;----------------------- MACRO Dec4 ¶m lclc &op if &nbr(&syslist)=0 then &op setc 'a' else &op setc ¶m endif dec &op dec &op dec &op dec &op MEND ;----------------------- MACRO &lab sdiv4 &op moveword &op,a bmi ~b&sysindex lsr a lsr a bra ~c&sysindex ~b&sysindex sec ror a sec ror a ~c&sysindex moveword a,&op MEND ;------------------------------------------------------ ;------------------------------------------------------ ; XOR - renaming for eor ;------------------------------------------------------ MACRO &lab xor &op &lab eor &op MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.move b/appleworksgs/Macros/m16.move new file mode 100755 index 0000000..7ce33c2 --- /dev/null +++ b/appleworksgs/Macros/m16.move @@ -0,0 +1 @@ + ; M16.MOVE Converted APW macros ;--------------------------------------------------------------------------- ; Move a word as a fixedpoint ; MACRO &lab MoveFixWord &from,&to stz &to moveword &from,&to+2 MEND ;-------------------------------------------------------------------------- ; Move a 3 byte address ; MACRO &lab MoveAddr &from,&to lclc &char lclc &newfrom &char setc &substr(&from,1,1) IF &char'#' GOTO .normal &newfrom setc &substr(&from,2,&len(&from)-1) moveword #<&newfrom,&to moveword #>&newfrom,&to+1 mexit .normal moveword &from,&to moveword &from+1,&to+1 MEND ;.........................................................................; MACRO &lab MoveX &from,&to &lab ; lclc &char lclc &from1 lclc &to1 lclc &from2 lclc &to2 &from1 setc &concat(&from,'+4') &to1 setc &concat(&to,'+4') &from2 setc &concat(&from,'+8') &to2 setc &concat(&to,'+8') &char setc &substr(&from,&len(&from),1) IF &char']' GOTO .chk2 &from1 setc &concat(&from,':#4') &from2 setc &concat(&from,':#8') .chk2 &char setc &substr(&to,&len(&to),1) IF &char']' GOTO .domove &to1 setc &concat(&to,':#4') &to2 setc &concat(&to,':#8') .domove movelong &from,&to movelong &from1,&to1 moveword &from2,&to2 MEND ;.........................................................................; MACRO &lab moverect &from,&to &lab ; lclc &char lclc &from1 lclc &to1 &from1 setc &concat(&from,'+4') &to1 setc &concat(&to,'+4') &char setc &substr(&from,&len(&from),1) IF &char']' GOTO .chk2 &from1 setc &concat(&from,':#4') .chk2 &char setc &substr(&to,&len(&to),1) IF &char']' GOTO .domove &to1 setc &concat(&to,':#4') .domove movelong &from,&to movelong &from1,&to1 MEND ;.........................................................................; MACRO &lab movel &from,&to &lab ; movelong &from,&to MEND MACRO &lab movew &from,&to &lab ; moveword &from,&to MEND MACRO &lab moveb &from,&to &lab ; movebyte &from,&to MEND MACRO &lab mover &from,&to &lab MoveRect &from,&to MEND ;.........................................................................; MACRO &lab Movebyte &from,&to &lab lclc &newfrom lcla &ppos &newfrom setc &from &ppos seta &pos('.',&newfrom) IF &ppos=0 GOTO .noeval eval &newfrom &newfrom setc 'a' .noeval shortm MoveWord &newfrom,&to longm MEND ;.........................................................................; MACRO &lab MoveLong &from,&to &lab ; lclc &newfrom &newfrom setc &from IF &newfrom'?' GOTO .notfromdc &newfrom setc 'ax' .notfromdc IF &len(&newfrom)&len(&to) GOTO .doreally lcla &xxp &xxp seta &pos(&to,&newfrom) IF not (&xxp) GOTO .doreally mexit .doreally IF &newfrom's' GOTO .SCont1 pulllong &to mexit .SCont1 IF &to's' GOTO .SCont2 pushlong &newfrom mexit .SCont2 lclc &ldreg lclc &char2 lclc &foo &foo setc &substr(&newfrom,&len(&newfrom),1) &char2 setc &substr(&newfrom,1,1) IF (&to='ax') GOTO .dorpax IF (&to='ay') GOTO .dorpay IF (&to='xy') GOTO .dorpxy GOTO .doreally2 .dorpax IF (&newfrom='xy') GOTO .doxy2ax IF (&newfrom='ay') GOTO .doay2ax GOTO .dorpax2 .doxy2ax txa .doay2ax tyx mexit .dorpax2 &ldreg setc 'x' IF (&char2'[') GOTO .normax IF (&foo']') GOTO .zpoffax moveword &newfrom:#2,x moveword &newfrom,a mexit .zpoffax moveword &newfrom+2,x moveword &newfrom,a mexit .normax moveword &newfrom,a IF &char2='#' GOTO .dorpimm GOTO .dorpadd .dorpay IF (&newfrom='xy') GOTO .doxy2ay IF (&newfrom='ax') GOTO .doax2ay GOTO .dorpay2 .doxy2ay txa mexit .doax2ay txy mexit .dorpay2 &ldreg setc 'y' IF (&char2'[') GOTO .normay IF (&foo']') GOTO .zpoffay moveword &newfrom:#2,x moveword &newfrom,a txy mexit .zpoffay moveword &newfrom+2,x moveword &newfrom,a txy mexit .normay IF (&foo']') GOTO .normxy moveword &newfrom,x moveword &newfrom:#2,a tay mexit .normxy moveword &newfrom,a IF &char2='#' GOTO .dorpimm GOTO .dorpadd .dorpxy IF (&newfrom='ax') GOTO .doax2xy IF (&newfrom='ay') GOTO .doay2xy GOTO .dorpxy2 .doax2xy txy .doay2xy tax mexit .dorpxy2 &ldreg setc 'y' IF (&char2'[') OR (&foo=']') GOTO .normxy lcla &foffset &foffset seta &pos(':',&newfrom) &char2 setc &substr(&newfrom,1,&foffset-1) moveword &newfrom,a tax iny iny lda &char2,y tay mexit .normxy moveword &newfrom,x IF &char2='#' GOTO .dorpimm .dorpadd IF (&foo=']') GOTO .indexed moveword &newfrom+2,&ldreg mexit .indexed moveword &newfrom:#2,&ldreg mexit .dorpimm &char2 setc &substr(&newfrom,2,&len(&newfrom)-1) ld&ldreg #^&char2 mexit .doreally2 lcla &ypushed lcla &xpushed lcla &sameoff lcla &yinced lcla &yhas2 lclc &streg lclc &fdisp lclc &tdisp lclc &floc lclc &tloc lclc &char lclc &fchar lclc &tchar lclc &newto lcla &foffset lcla &toffset lcla &num &fchar setc &substr(&newfrom,1,1) &tchar setc &substr(&to,1,1) &foffset seta &pos(':',&newfrom) &toffset seta &pos(':',&to) &fdisp setc '*' &tdisp setc '*' IF &foffset=0 GOTO .nofoff &floc setc &substr(&newfrom,1,&foffset-1) &fdisp setc &substr(&newfrom,&foffset+1,&len(&newfrom)-&foffset) .nofoff IF &toffset=0 GOTO .notoff &tloc setc &substr(&to,1,&toffset-1) &tdisp setc &substr(&to,&toffset+1,&len(&to)-&toffset) .notoff IF not (&foffset and &toffset) GOTO .notsame &num seta &pos(&tdisp,&fdisp) IF &num=0 GOTO .notsame IF &len(&fdisp)&len(&tdisp) GOTO .notsame IF (&tchar='[') and (&fchar'[') GOTO .notsame IF (&fchar='[') and (&tchar'[') GOTO .notsame &sameoff seta 1 .notsame ; FOO! IF (&newfrom='ax') or (&newfrom='ay') GOTO .regmove IF (&newfrom='xy') GOTO .regmoveflip GOTO .domw .regmove lclc &newfrom2 &newfrom2 setc 'a' &num seta 0 IF &newfrom='ax' GOTO .didy &num seta &pos(']:',&to) IF &num=0 GOTO .didy phy .didy moveword &newfrom2,&to &newfrom2 setc &substr(&newfrom,2,1) &tchar setc &substr(&to,&len(&to),1) IF &tchar']' GOTO .normregmove moveword &newfrom2,&to:#2 mexit .normregmove IF &num=0 GOTO .doney pla iny iny &num seta &pos(']:',&to) &newto setc &substr(&to,1,&num) &newto setc &concat(&newto,',y') sta &newto mexit .doney moveword &newfrom2,&to+2 mexit .regmoveflip lclc &newfrom2 &newfrom setc 'y' &tchar setc &substr(&to,&len(&to),1) &num seta &pos(']:',&to) IF &num=0 GOTO .noy phy &newfrom2 setc 'x' GOTO .didy .noy IF &tchar']' GOTO .normregmove2 moveword &newfrom,&to:#2 GOTO .movefirstreg .normregmove2 moveword &newfrom,&to+2 .movefirstreg &newfrom setc 'x' moveword &newfrom,&to mexit .domw IF (&foffset=0) or (&toffset=0) GOTO .nosave IF (&tdisp='x') or (&tdisp='y') or (&tdisp='s') GOTO .nosave IF (&fdisp='y') and (&tchar='[') GOTO .savey IF (&fdisp='x') and (&tchar'#') and (&tchar'[') GOTO .savex GOTO .nosave .savey phy &ypushed seta 1 GOTO .nosave .savex phx &xpushed seta 1 .nosave MoveWord &newfrom,&to IF &ypushed GOTO .gety IF &xpushed GOTO .getx GOTO .dohigh .gety ply &ypushed seta 0 GOTO .dohigh .getx plx &xpushed seta 0 .dohigh &streg setc 'a' IF &foffset GOTO .fromoff IF &fchar='[' GOTO .fromzp IF &fchar='!' GOTO .fromlocal IF &fchar='#' GOTO .fromimm IF &newfrom='ax' GOTO .fromxhigh IF (&newfrom='ay') or (&newfrom='xy') GOTO .fromyhigh lda &newfrom+2 GOTO .doto .fromyhigh &streg setc 'y' GOTO .doto .fromxhigh &streg setc 'x' GOTO .doto .fromlocal lda #0 GOTO .doto .fromimm &newfrom setc &substr(&newfrom,2,&len(&newfrom)-1) lda #^&newfrom GOTO .doto .fromzp IF &toffset=0 GOTO .fromzpnophy IF &tdisp'y' GOTO .fromzpnophy phy &ypushed seta 1 .fromzpnophy ldy #2 lda &newfrom,y &yhas2 seta 1 GOTO .doto .fromoff IF &fdisp='y' GOTO .fromy IF &fchar='[' GOTO .fromzpoff IF &fdisp='x' GOTO .fromx IF &fdisp='s' GOTO .froms IF (&toffset=0) or (&tchar='[') GOTO .nollx IF (&tdisp='y') or (&tdisp='s') GOTO .nollx IF &sameoff GOTO .nollx ldx &fdisp .nollx lda &floc+2,x GOTO .doto .fromzpoff IF &tdisp'y' GOTO .fromzpoffldy phy &ypushed seta 1 .fromzpoffldy &char setc &substr(&fdisp,1,1) IF &char='#' GOTO .xxximmzp IF &toffset=0 GOTO .fzponoldy IF &sameoff GOTO .fzponoldy IF (&tdisp='y') or (&tchar='[') GOTO .fzpoldy GOTO .fzponoldy .fzpoldy ldy &fdisp .fzponoldy iny iny GOTO .doxxximmzp .xxximmzp ldy &fdisp+2 .doxxximmzp lda &floc,y GOTO .doto .froms lda &floc+2,s GOTO .doto .fromy IF &fchar='[' GOTO .fromyzp lda &floc+2,y GOTO .doto .fromyzp iny iny &yinced seta 1 lda &floc,y GOTO .doto .fromx lda &floc+2,x GOTO .doto .doto IF &toffset GOTO .tooff IF &tchar='[' GOTO .tozp IF &tchar='#' GOTO .toimm st&streg &to+2 mexit .toimm &newto setc &substr(&to,2,&len(&to)-1) st&streg #^&newto mexit .tozp IF &yhas2 GOTO .tozpnoload ldy #2 .tozpnoload st&streg &to,y mexit .tooff IF &tdisp='x' GOTO .tox IF &tdisp='y' GOTO .toy IF &tdisp='s' GOTO .tos IF &tchar='[' GOTO .tozpoff IF (&fchar='[') or (&sameoff) or (&foffset=0) GOTO .noloadx IF (&fdisp='s') or (&fdisp='y') GOTO .noloadx ldx &tdisp .noloadx st&streg &tloc+2,x mexit .tozpoff IF &sameoff GOTO .noloady &char setc &substr(&tdisp,1,1) IF &char='#' GOTO .tozpoffimm IF (&fchar='[') or (&fdisp='y') GOTO .xdoldyx IF &foffset=0 GOTO .xnoldyx GOTO .xnoldyx .xdoldyx ldy &tdisp .xnoldyx iny iny GOTO .noloady .tozpoffimm ldy &tdisp+2 .noloady st&streg &tloc,y mexit .tos st&streg &tloc+2,s mexit .toy IF &tchar='[' GOTO .toyzp IF not (&ypushed) GOTO .toydo ply .toydo IF (&fchar='[') and (&fdisp='y') GOTO .specialy st&streg &tloc+2,y mexit .specialy st&streg &tloc,y mexit .toyzp IF &yinced GOTO .toyzpdo IF not (&ypushed) GOTO .toypush ply .toypush iny iny .toyzpdo st&streg &tloc,y mexit .tox IF not (&xpushed) GOTO .toxdo plx .toxdo st&streg &tloc+2,x mend ;.........................................................................; MACRO &lab MoveWord &from,&to &lab ; IF &from&to GOTO .doreally mexit .doreally lclc &newfrom lcla &ppos &newfrom setc &from &ppos seta &pos('.',&newfrom) IF &ppos=0 GOTO .noeval eval &newfrom &newfrom setc 'a' .noeval IF &newfrom's' GOTO .SCont1 pullword &to mexit .SCont1 IF &to's' GOTO .SCont2 pushword &newfrom mexit .SCont2 lcla &sameoff lcla &nox2 lcla &noy2 lclc &streg lclc &fdisp lclc &tdisp lclc &floc lclc &tloc lcla &foffset lcla &toffset lclc &fchar lclc &tchar lcla &num lclc &trans &fchar setc &substr(&newfrom,1,1) &tchar setc &substr(&to,1,1) &foffset seta &pos(':',&newfrom) &toffset seta &pos(':',&to) IF &foffset=0 GOTO .nofoff &floc setc &substr(&newfrom,1,&foffset-1) &fdisp setc &substr(&newfrom,&foffset+1,&len(&newfrom)-&foffset) .nofoff IF &toffset GOTO .gettoff GOTO .setnox2 .gettoff &tloc setc &substr(&to,1,&toffset-1) &tdisp setc &substr(&to,&toffset+1,&len(&to)-&toffset) IF (&tdisp='s') or (&tdisp='y') or (&tchar='[') GOTO .setnox2 GOTO .setnoy2 .setnox2 &nox2 seta 1 IF (&tdisp='y') GOTO .notoff .setnoy2 &noy2 seta 1 .notoff IF not (&foffset and &toffset) GOTO .notsame &num seta &pos(&tdisp,&fdisp) IF &num=0 GOTO .notsame IF &len(&fdisp)&len(&tdisp) GOTO .notsame IF (&tchar='[') and (&fchar'[') GOTO .notsame IF (&fchar='[') and (&tchar'[') GOTO .notsame &sameoff seta 1 .notsame &streg setc 'a' IF &foffset GOTO .fromoff IF (&newfrom='a') or (&newfrom='x') or (&newfrom='y') GOTO .fromreg IF (&fchar='[') GOTO .fromlda IF (&fchar='!') GOTO .fromlocal IF (&to='x') or (&to='y') GOTO .fromtoreg .fromlda IF &fchar='#' AND &pos(&substr(&newfrom,2,1),'<^>')=0 THEN lda #<&substr(&newfrom,2,&len(&newfrom)-1) ELSE lda &newfrom ENDIF GOTO .doto .fromlocal &floc setc &substr(&newfrom,2,&len(&newfrom)-1) tdc clc adc #&floc GOTO .doto .fromreg &streg setc &newfrom GOTO .doto .fromtoreg IF (&to='x') THEN ldx &newfrom ELSE ldy &newfrom ENDIF MEXIT .fromoff IF (&fdisp='x') or (&fdisp='y') or (&fdisp='s') GOTO .foffreg IF &fchar='[' GOTO .fromoffzp IF (&nox2) GOTO .dofromoff IF not (&tdisp='x') GOTO .dofromoff phx .dofromoff ldx &fdisp lda &concat(&floc,',x') IF &nox2 GOTO .doto IF not (&tdisp='x') GOTO .doto plx GOTO .doto .fromoffzp IF &noy2 GOTO .dofromoffzp phy .dofromoffzp ldy &fdisp lda &concat(&floc,',y') IF &noy2 GOTO .doto ply GOTO .doto .foffreg lda &concat(&floc,',',&fdisp) .doto IF (&to='a') or (&to='x') or (&to='y') GOTO .dotoreg lclc &foo &foo setc &substr(&to,1,1) IF (&foo'[') or (&streg='a') GOTO .notfoo &trans setc &concat('t',&streg,'a') &trans &streg setc 'a' .notfoo IF &toffset GOTO .tooff st&streg &to mexit .dotoreg IF (&newfrom=&to) GOTO .dotoregend IF (&newfrom='a') or (&newfrom='x') or (&newfrom='y') GOTO .dotoreg2 IF (&to='a') GOTO .dotoregend &fdisp setc 'a' GOTO .dotoreg2really .dotoreg2 &fdisp setc &newfrom .dotoreg2really &trans setc &concat('t',&fdisp,&to) &trans .dotoregend mexit .tooff IF (&tdisp='x') or (&tdisp='y') or (&tdisp='s') GOTO .dotooff IF &tchar='[' GOTO .tooffzp IF &sameoff GOTO .noloadx ldx &tdisp .noloadx st&streg &concat(&tloc,',x') mexit .tooffzp IF &sameoff GOTO .noloady ldy &tdisp .noloady st&streg &concat(&tloc,',y') mexit .dotooff st&streg &concat(&tloc,',',&tdisp) mend ;.............................................................................. ; ; Store zero long - stzl ; ; Stzl addr Stzl addr:x Stzl addr:offset Stzl addr:#offset ; ; This macro will do a store zero on both the high and low bytes of a ; long word. ;.............................................................................. MACRO &lab stzl &loc &lab ; lcla &offset lclc &rest lclc &disp &offset seta &pos(':',&loc) IF &offset>2 GOTO .dooff stz &loc stz &loc+2 mexit .dooff &rest setc &substr(&loc,1,&offset-1) &disp setc &substr(&loc,&offset+1,&len(&loc)-&offset) IF &disp='x' GOTO .doit ldx &disp .doit stz &rest,x stz &rest+2,x MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.msl b/appleworksgs/Macros/m16.msl new file mode 100755 index 0000000..cc3987f --- /dev/null +++ b/appleworksgs/Macros/m16.msl @@ -0,0 +1 @@ +;-------------------------------------------------------------------------- ; ; m16.MSL ; ; ; ;--------------------------------------------------------------------------- ; ; WaitMouse ; ; Wait for a click MACRO &lab WaitMouse &lab ; ~b&SYSINDEX pha pushword #0 _Button pla beq ~b&SYSINDEX ~c&SYSINDEX pha pushword #0 _Button pla bne ~c&SYSINDEX MEND ;--------------------------------------------------------------------------- ; ; Break ; MACRO &lab Break ¶m &lab ; IF &nbr(&syslist) GOTO .gotone macerr 'Break macro: no input parameter specified.' mexit .gotone lda >$00C025 IF (¶m='cap') GOTO .gotcaps IF (¶m='caps') GOTO .gotcaps IF (¶m='capslock') GOTO .gotcaps IF (¶m='opt') GOTO .gotopt IF (¶m='option') GOTO .gotopt IF (¶m='closedapple') GOTO .gotopt IF (¶m='fan') GOTO .gotfan IF (¶m='apple') GOTO .gotfan IF (¶m='cmd') GOTO .gotfan IF (¶m='openapple') GOTO .gotfan IF (¶m='shift') GOTO .gotshift IF (¶m='ctl') GOTO .gotctl IF (¶m='control') GOTO .gotctl IF (¶m='ctrl') GOTO .gotctl IF (¶m='cntl') GOTO .gotctl IF (¶m='cntrl') GOTO .gotctl macerr 'Break macro: unable to decipher parameter.' .gotcaps and #%00000100 GOTO .didit .gotopt and #%01000000 GOTO .didit .gotfan and #%10000000 GOTO .didit .gotshift and #%00000001 GOTO .didit .gotctl and #%00000010 .didit beq ~b&SYSINDEX brk ~b&SYSINDEX ; MEND ;--------------------------------------------------------------------------- ; ; IsNil ; ; see if a longword is zero MACRO &lab IsNil ¶m &lab lda ¶m ora ¶m+2 MEND ;--------------------------------------------------------------------------- ; ; SetBorder ; ; set the border colour MACRO &lab SetBorder ¶m &lab lda >$E0C034 IF &nbr(&syslist) GOTO .setit and #$000F inc a and #$000F pha lda >$E0C034 and #$FFF0 ora 1,s sta >$E0C034 pla GOTO .exit .setit anop and #$FFF0 ora ¶m sta >$E0C034 .exit anop MEND MACRO &lab GetBorder &arg &lab lda >$e0c034 and #$f sta &arg MEND ;--------------------------------------------------------------------------- ; ; WaitKey ; ; Wait for any key or for a specific key ; MACRO &lab WaitKey ¶m &lab ; ~b&SYSINDEX lda >$C000 and #$80 beq ~b&SYSINDEX IF &nbr(&syslist) GOTO .specfic sta >$C010 GOTO .exit .specfic anop lda >$C000 sta >$C010 and #$7F cmp ¶m bne ~b&SYSINDEX .exit anop MEND ;--------------------------------------------------------------------------- ; ; Click ; ; click the speaker MACRO &lab Click &lab lda >$00C030 MEND ;--------------------------------------------------------------------------- ; ; SetVol ; ; MACRO &lab SetVol ¶m &lab lda >$00C03C and #$FFF0 ora ¶m sta >$00C03C MEND ;--------------------------------------------------------------------------- ; ; RCall - register Call ; ; MACRO &lab RCall &routine,&in,&out &lab ; lcla &outnum lcla &innum lcla &count lclc &inreg lclc &outreg lclc &inp lclc &outp lclc ® &innum seta &nbr(&in) &outnum seta &nbr(&out) IF ((&innum = 0) and (&in '')) or ((&outnum = 0) and (&out '')) THEN macerr 'RCall macro: all parameters to this macro must be in parentheses.' mexit ENDIF &count seta 1 IF &innum=0 GOTO .call IF &innum<4 GOTO .inloop macerr 'RCall macro: too many inputs (3 maximum)' mexit .inloop &inreg setc &substr(&in[&count],&len(&in[&count])-2,3) IF (&inreg':ax') and (&inreg':xy') and (&inreg':ay') GOTO .in2 ® setc &substr(&in[&count],&len(&in[&count])-1,2) &inp setc &substr(&in[&count],1,&len(&in[&count])-3) movelong &inp,® GOTO .incont .in2 &inreg setc &substr(&in[&count],&len(&in[&count])-1,2) IF (&inreg':a') and (&inreg':x') and (&inreg':y') GOTO .inerr ® setc &substr(&in[&count],&len(&in[&count]),1) &inp setc &substr(&in[&count],1,&len(&in[&count])-2) moveword &inp,® GOTO .incont .inerr macerr "RCall macro: missing input register specification" mexit .incont &count seta &count+1 IF &count&innum GOTO .inloop .call jsl &routine &count seta 1 IF &outnum=0 GOTO .exit IF &outnum<4 GOTO .outloop macerr 'RCall macro: too many outputs (3 maximum)' GOTO .exit .outloop &outreg setc &substr(&out[&count],&len(&out[&count])-2,3) IF (&outreg':ax') and (&outreg':xy') and (&outreg':ay') GOTO .out2 ® setc &substr(&out[&count],&len(&out[&count])-1,2) &outp setc &substr(&out[&count],1,&len(&out[&count])-3) movelong ®,&outp GOTO .outcont .out2 &outreg setc &substr(&out[&count],&len(&out[&count])-1,2) IF (&outreg':a') and (&outreg':x') and (&outreg':y') GOTO .outerr ® setc &substr(&out[&count],&len(&out[&count]),1) &outp setc &substr(&out[&count],1,&len(&out[&count])-2) moveword ®,&outp GOTO .outcont .outerr macerr 'RCall macro: missing output register specification' mexit .outcont &count seta &count+1 IF &count&outnum GOTO .outloop .exit anop MEND ;--------------------------------------------------------------------------- ; ; ABS ; ; MACRO &lab ABS &op &lab ; IF &nbr(&syslist) GOTO .getop .aop tax GOTO .gotop .getop IF (&op='a') GOTO .aop moveword &op,a .gotop bpl ~b&SYSINDEX dec a ; NEG eor #$FFFF IF &nbr(&syslist) GOTO .putop GOTO .exit .putop moveword a,&op .exit ~b&SYSINDEX ; MEND ;--------------------------------------------------------------------------- ; ; NEG ; ; MACRO &lab NEG &op &lab ; IF &nbr(&syslist) GOTO .getop GOTO .gotop .getop IF (&op='a') GOTO .gotop moveword &op,a .gotop dec a eor #$FFFF ; NOT IF &nbr(&syslist) GOTO .putop GOTO .exit .putop moveword a,&op .exit MEND ;--------------------------------------------------------------------------- ; ; Not ; ; MACRO &lab NOT &op &lab ; IF &nbr(&syslist) GOTO .getop GOTO .geta .getop IF (&op='a') GOTO .gotop moveword &op,a GOTO .gotop .geta tay .gotop beq ~b&SYSINDEX lda #0 bra ~c&SYSINDEX ~b&SYSINDEX ; lda #1 ~c&SYSINDEX ; IF &nbr(&syslist) GOTO .putop GOTO .exit .putop moveword a,&op .exit MEND ;--------------------------------------------------------------------------- ; ; BNot ; ; MACRO &lab BNOT &op &lab ; IF &nbr(&syslist) GOTO .getop GOTO .gotop .getop IF (&op='a') GOTO .gotop moveword &op,a .gotop eor #$FFFF IF &nbr(&syslist) GOTO .putop GOTO .exit .putop moveword a,&op .exit MEND ;--------------------------------------------------------------------------- ; ; Swap ; ; MACRO &lab Swap ¶m1,¶m2 &lab moveword ¶m1,x moveword ¶m2,¶m1 moveword x,¶m2 MEND ;--------------------------------------------------------------------------- ; ; SwapL ; ; MACRO &lab SwapL ¶m1,¶m2 &lab pushlong ¶m1 movelong ¶m2,¶m1 pulllong ¶m2 MEND ;--------------------------------------------------------------------------- ; ; dbg - bizarre debugging method using WDM statements... ; ; MACRO &lab dbg &num &lab ; DC.B $42, &num MEND ;---------------------------------------------------------------------- MACRO &lab Mull4 &op &lab clc rol &op rol &op+2 clc rol &op rol &op+2 MEND MACRO MacErr lclc &msg lcla &num lcla &count &num seta &nbr(&syslist) IF (&num = 0) THEN mexit ENDIF &msg setc '' &count seta 1 WHILE (&count &num) DO IF (&substr(&syslist[&count],1,1) = '"') or (&substr(&syslist[&count],1,1) = '''') THEN &msg setc &concat(&msg,&substr(&syslist[&count],2,&len(&syslist[&count])-2)) ELSE &msg setc &concat(&msg,&syslist[&count]) ENDIF &count seta &count+1 ENDWHILE &msg setc &concat(&msg,' Proc: ') &msg setc &concat(&msg,&sysmod) aerror &msg MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.newprodos b/appleworksgs/Macros/m16.newprodos new file mode 100755 index 0000000..d72af00 --- /dev/null +++ b/appleworksgs/Macros/m16.newprodos @@ -0,0 +1 @@ + ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- ; File: M16.ProDos ; ; StyleWare, Inc. ; ; New (10/27/87), Stack Version of ProDOS macros. ; Usage: (e.g.) ; pushlong paramblock ; _OPEN ; ; CLASS 1 string. MACRO &lab STR1 &string lclc &sset &sset SETC &SETTING('STRING') STRING ASIS &lab DC.W &len(&string)-2 ; eliminate enclosing quotes. DC.B &string STRING &sset MEND MACRO &lab _CREATE &lab pea $2001 jsl $E100B0 MEND MACRO &lab _DESTROY &lab pea $2002 jsl $E100B0 MEND MACRO &lab _OS_ShutDown &lab pea $2003 jsl $E100B0 MEND MACRO &lab _CHANGE_PATH &lab pea $2004 jsl $E100B0 MEND MACRO &lab _SET_FILE_INFO &lab pea $2005 jsl $E100B0 MEND MACRO &lab _GET_FILE_INFO &lab pea $2006 jsl $E100B0 MEND MACRO &lab _VOLUME &lab pea $2008 jsl $E100B0 MEND MACRO &lab _SET_PREFIX &lab pea $2009 jsl $E100B0 MEND MACRO &lab _GET_PREFIX &lab pea $200A jsl $E100B0 MEND MACRO &lab _CLEAR_BACKUP_BIT &lab pea $200B jsl $E100B0 MEND MACRO &lab _SET_SYS_PREFS &lab pea $200C jsl $E100B0 MEND MACRO &lab _Null &lab pea $200D jsl $E100B0 MEND MACRO &lab _Expand_Path &lab pea $200E jsl $E100B0 MEND MACRO &lab _Get_SYS_PREFS &lab pea $200F jsl $E100B0 MEND MACRO &lab _OPEN &lab pea $2010 jsl $E100B0 MEND MACRO &lab _NEWLINE &lab pea $2011 jsl $E100B0 MEND MACRO &lab _READ &lab pea $2012 jsl $E100B0 MEND MACRO &lab _WRITE &lab pea $2013 jsl $E100B0 MEND MACRO &lab _CLOSE &lab pea $2014 jsl $E100B0 MEND MACRO &lab _FLUSH &lab pea $2015 jsl $E100B0 MEND MACRO &lab _SET_MARK &lab pea $2016 jsl $E100B0 MEND MACRO &lab _GET_MARK &lab pea $2017 jsl $E100B0 MEND MACRO &lab _SET_EOF &lab pea $2018 jsl $E100B0 MEND MACRO &lab _GET_EOF &lab pea $2019 jsl $E100B0 MEND MACRO &lab _SET_LEVEL &lab pea $201A jsl $E100B0 MEND MACRO &lab _GET_LEVEL &lab pea $201B jsl $E100B0 MEND MACRO &lab _GET_DIR_ENTRY &lab pea $201C jsl $E100B0 MEND MACRO &lab _Begin_Session &lab pea $201D jsl $E100B0 MEND MACRO &lab _End_Session &lab pea $201E jsl $E100B0 MEND MACRO &lab _Session_Status &lab pea $201F jsl $E100B0 MEND MACRO &lab _GET_DEV_NUM &lab pea $2020 jsl $E100B0 MEND MACRO &lab _GET_LAST_DEV &lab pea $2021 jsl $E100B0 MEND MACRO &lab _READ_BLOCK &lab pea $2022 jsl $E100B0 MEND MACRO &lab _WRITE_BLOCK &lab pea $2023 jsl $E100B0 MEND MACRO &lab _FORMAT &lab pea $2024 jsl $E100B0 MEND MACRO &lab _ERASE_DISK &lab pea $2025 jsl $E100B0 MEND MACRO &lab _Reset_Cache &lab pea $2026 jsl $E100B0 MEND MACRO &lab _GETNAME &lab pea $2027 jsl $E100B0 MEND MACRO &lab _GET_BOOT_VOL &lab pea $2028 jsl $E100B0 MEND MACRO &lab _Quit &lab pea $2029 jsl $E100B0 MEND MACRO &lab _GET_VERSION &lab pea $202A jsl $E100B0 MEND MACRO &lab _Get_FST_Info &lab pea $202B jsl $E100B0 MEND MACRO &lab _D_INFO &lab pea $202C jsl $E100B0 MEND MACRO &lab _D_Status &lab pea $202D jsl $E100B0 MEND MACRO &lab _D_Control &lab pea $202E jsl $E100B0 MEND MACRO &lab _D_Read &lab pea $202F jsl $E100B0 MEND MACRO &lab _D_Write &lab pea $2030 jsl $E100B0 MEND MACRO &lab _ALLOC_INTERRUPT &lab pea $2031 jsl $E100B0 MEND MACRO &lab _DEALLOC_INTERRUPT &lab pea $2032 jsl $E100B0 MEND MACRO &lab _Add_Notify_Proc &lab pea $2034 jsl $E100B0 MEND MACRO &lab _Del_Notify_Proc &lab pea $2035 jsl $E100B0 MEND MACRO &lab _D_Rename &lab pea $2036 jsl $E100B0 MEND MACRO &lab _Get_Std_Ref_Num &lab pea $2037 jsl $E100B0 MEND MACRO &lab _Get_Ref_Num &lab pea $2038 jsl $E100B0 MEND MACRO &lab _Get_Ref_Info &lab pea $2039 jsl $E100B0 MEND MACRO &lab ChkBugIn &callnum &lab IF (Developing AND &Type('PDOS')'UNDEFINED ') THEN lda GSBugging bne @1 lda >$C025 and #$C0 ; -opt cmp #$C0 bne @2 @1 call GSOSBug,in=(#1:w,#0:w,&callnum:w,!pblock:l) @2 ENDIF MEND MACRO &lab ChkBugOut &callnum &lab IF (Developing AND &Type('PDOS')'UNDEFINED ') THEN php pha lda GSBugging bne @3 lda >$C025 and #$C0 ; -opt cmp #$C0 bne @4 @3 call GSOSBug,in=(#0:w,err:w,&callnum:w,!pblock:l) @4 pla plp ENDIF MEND MACRO &lab _BindInt &lab pea $2031 jsl $E100B0 MEND MACRO &lab _UnBindInt &lab pea $2032 jsl $E100B0 MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.oldprodos b/appleworksgs/Macros/m16.oldprodos new file mode 100755 index 0000000..f5abf1b --- /dev/null +++ b/appleworksgs/Macros/m16.oldprodos @@ -0,0 +1 @@ +; File: M16.ProDos ; ; ; Copyright Apple Computer, Inc. 1986, 1987, 1988 ; All Rights Reserved ; ; MACRO &lab _CREATE ¶ms &lab jsl $E100A8 DC.W 1 DC.L ¶ms MEND MACRO &lab _DESTROY ¶ms &lab jsl $E100A8 DC.W 2 DC.L ¶ms MEND MACRO &lab _CHANGE_PATH ¶ms &lab jsl $E100A8 DC.W 4 DC.L ¶ms MEND MACRO &lab _SET_FILE_INFO ¶ms &lab jsl $E100A8 DC.W 5 DC.L ¶ms MEND MACRO &lab _GET_FILE_INFO ¶ms &lab jsl $E100A8 DC.W 6 DC.L ¶ms MEND MACRO &lab _VOLUME ¶ms &lab jsl $E100A8 DC.W 8 DC.L ¶ms MEND MACRO &lab _SET_PREFIX ¶ms &lab jsl $E100A8 DC.W 9 DC.L ¶ms MEND MACRO &lab _GET_PREFIX ¶ms &lab jsl $E100A8 DC.W $0A DC.L ¶ms MEND MACRO &lab _CLEAR_BACKUP_BIT ¶ms &lab jsl $E100A8 DC.W $0B DC.L ¶ms MEND MACRO &lab _OPEN ¶ms &lab jsl $E100A8 DC.W $10 DC.L ¶ms MEND MACRO &lab _NEWLINE ¶ms &lab jsl $E100A8 DC.W $11 DC.L ¶ms MEND MACRO &lab _READ ¶ms &lab jsl $E100A8 DC.W $12 DC.L ¶ms MEND MACRO &lab _WRITE ¶ms &lab jsl $E100A8 DC.W $13 DC.L ¶ms MEND MACRO &lab _CLOSE ¶ms &lab jsl $E100A8 DC.W $14 DC.L ¶ms MEND MACRO &lab _FLUSH ¶ms &lab jsl $E100A8 DC.W $15 DC.L ¶ms MEND MACRO &lab _SET_MARK ¶ms &lab jsl $E100A8 DC.W $16 DC.L ¶ms MEND MACRO &lab _GET_MARK ¶ms &lab jsl $E100A8 DC.W $17 DC.L ¶ms MEND MACRO &lab _SET_EOF ¶ms &lab jsl $E100A8 DC.W $18 DC.L ¶ms MEND MACRO &lab _GET_EOF ¶ms &lab jsl $E100A8 DC.W $19 DC.L ¶ms MEND MACRO &lab _SET_LEVEL ¶ms &lab jsl $E100A8 DC.W $1A DC.L ¶ms MEND MACRO &lab _GET_LEVEL ¶ms &lab jsl $E100A8 DC.W $1B DC.L ¶ms MEND MACRO &lab _GET_DIR_ENTRY ¶ms &lab jsl $E100A8 DC.W $1C DC.L ¶ms MEND MACRO &lab _GET_DEV_NUM ¶ms &lab jsl $E100A8 DC.W $20 DC.L ¶ms MEND MACRO &lab _GET_LAST_DEV ¶ms &lab jsl $E100A8 DC.W $21 DC.L ¶ms MEND MACRO &lab _READ_BLOCK ¶ms &lab jsl $E100A8 DC.W $22 DC.L ¶ms MEND MACRO &lab _WRITE_BLOCK ¶ms &lab jsl $E100A8 DC.W $23 DC.L ¶ms MEND MACRO &lab _FORMAT ¶ms &lab jsl $E100A8 DC.W $24 DC.L ¶ms MEND MACRO &lab _ERASE_DISK ¶ms &lab jsl $E100A8 DC.W $25 DC.L ¶ms MEND MACRO &lab _GET_NAME ¶ms &lab jsl $E100A8 DC.W $27 DC.L ¶ms MEND MACRO &lab _GET_PATH_NAME ¶ms &lab jsl $E100A8 DC.W $27 DC.L ¶ms MEND MACRO &lab _GET_BOOT_VOL ¶ms &lab jsl $E100A8 DC.W $28 DC.L ¶ms MEND MACRO &lab _QUIT ¶ms &lab jsl $E100A8 DC.W $29 DC.L ¶ms MEND MACRO &lab _GET_VERSION ¶ms &lab jsl $E100A8 DC.W $2A DC.L ¶ms MEND MACRO &lab _D_INFO ¶ms &lab jsl $E100A8 DC.W $2C DC.L ¶ms MEND MACRO &lab _ALLOC_INTERRUPT ¶ms &lab jsl $E100A8 DC.W $31 DC.L ¶ms MEND MACRO &lab _DEALLOC_INTERRUPT ¶ms &lab jsl $E100A8 DC.W $32 DC.L ¶ms MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.profile b/appleworksgs/Macros/m16.profile new file mode 100755 index 0000000..df1ee83 --- /dev/null +++ b/appleworksgs/Macros/m16.profile @@ -0,0 +1 @@ +;--------------------------------------------------------------------------- ; m16.profile - by Mike Hibbetts ; ; created 2/24/89 MRH ; updated 2/28/89 MRH (silly notational change) ; 3/1/89 KAW changed profiling routines to use jsr/rts instead ; of jsl/rtl when Profile='s' ; added call counts ; added optional suffix to allow multiple copies ; 9/29/89 KAW changed ProfileData to interleave values. ; ; The following macros aid in profiling code on the Apple IIGS by using ; tick counts to determine the amount of time that is spent in a routine. ; The macros will generate code only if the symbol 'Profile' is defined ; and has a non-zero value. (You can asmiigs with the '-d Profile' ; option to create the symbol, or define the symbol in the source.) ; ; If multiple copies of the profiling code are required (e.g. two modules ; each with profiling code, to be linked together), an optional suffix ; argument may be provided to each of the following macros. The suffix, ; which must the same in each case, will distinguish between copies of ; the profiling code ; ; ; Macros: ; ; ProfileData m[,suffix] ; - This needs to be placed in the code exactly once. ; 3*(m+1) long words will be reserved in the code at that ; location. m is the number of indices desired. ; The first long for each index is the total tick count, ; the second is the number of calls, the third is workspace. ; Indices 0m are valid. ; ; ProfileCode [suffix] ; - This needs to be placed in the code exactly once. ; It contains the routines needed by the profiling macros. ; ; ProfileInit [suffix] ; - This needs to be executed after the tools have been ; loaded and started, but before either of the following ; macros is executed. After this macro is executed, the ; information in ProfileData is zero-ed out, but may be ; executed as many times as is desired. ; ; ProfileIn n[,suffix] ; - These two macros need to come in pairs for meaningful ; results. ProfileIn takes the current tick count and puts ; it in the workspace for index n. It also increments ; the call count for index n. [ 0 n m ] ; ; ProfileOut n[,suffix] ; - ProfileOut subtracts the tick count saved by ProfileIn ; from the current tick count, and adds that to the total ; accumulated for index n. ProfileIn and ProfileOut may ; be nested with different indices. [ 0 n m ] ; The routines ProfileIn&suffix and ProfileOut&suffix each have a block ; of spare space at the end. This makes a handy location for punching ; code during debugging. IF &Type('Profile') = 'UNDEFINED ' THEN ; A space is really there! Profile equ 0 ENDIF ;------------------------------------- MACRO ProfileData &NumSlots,&suffix IF Profile THEN ProfileData&suffix PROC EXPORT EXPORT ProfileSize&suffix EXPORT ProfileCount&suffix EXPORT ProfileWS&suffix ProfileSize&suffix equ &NumSlots DS.L 1 ProfileCount&suffix DS.L 1 ProfileWS&suffix DS.L 1 DS.L (ProfileSize&suffix*3) ENDP ENDIF MEND ;------------------------------------- MACRO ProfileCode &suffix IF Profile THEN ProfileIn&suffix PROC EXPORT EXPORT ProfTick1&suffix EXPORT ProfTick2&suffix IMPORT ProfileCount&suffix IMPORT ProfileWS&suffix ProfTick1&suffix lda >000000 ; TickCount sta >ProfileWS&suffix,x ProfTick2&suffix lda >000000 ; TickCount+2 sta >ProfileWS&suffix+2,x lda >ProfileCount&suffix,x ina sta >ProfileCount&suffix,x bne @1 lda >ProfileCount&suffix+2,x ina sta >ProfileCount&suffix+2,x @1 IF Profile='s' THEN rts ELSE rtl ENDIF DS.B 256 ; space ENDP ProfileOut&suffix PROC EXPORT EXPORT ProfTick3&suffix EXPORT ProfTick4&suffix IMPORT ProfileData&suffix IMPORT ProfileWS&suffix ProfTick3&suffix lda >000000 ; TickCount sec sbc >ProfileWS&suffix,x sta >ProfileWS&suffix,x ProfTick4&suffix lda >000000 ; TickCount+2 sbc >ProfileWS&suffix+2,x sta >ProfileWS&suffix+2,x lda >ProfileWS&suffix,x clc adc >ProfileData&suffix,x sta >ProfileData&suffix,x lda >ProfileWS&suffix+2,x adc >ProfileData&suffix+2,x sta >ProfileData&suffix+2,x IF Profile='s' THEN rts ELSE rtl ENDIF DS.B 256 ; space ENDP ENDIF MEND ;------------------------------------- MACRO ProfileInit &suffix IF Profile THEN IMPORT ProfileSize&suffix IMPORT ProfileData&suffix IMPORT ProfTick1&suffix IMPORT ProfTick2&suffix IMPORT ProfTick3&suffix IMPORT ProfTick4&suffix ldx #(ProfileSize&suffix*4)*3 lda #0 profileInitLoop&suffix dex dex sta >ProfileData&suffix,x bne profileInitLoop&suffix pha pha pea 5 _GetAddr lda 1,s sta >ProfTick1&suffix+1 sta >ProfTick3&suffix+1 lda 2,s sta >ProfTick1&suffix+2 sta >ProfTick3&suffix+2 lda 1,s clc adc #2 sta 1,s sta >ProfTick2&suffix+1 sta >ProfTick4&suffix+1 bcc incHighByte&suffix lda 3,s inc a sta 3,s incHighByte&suffix lda 2,s sta >ProfTick2&suffix+2 sta >ProfTick4&suffix+2 pla pla ENDIF MEND ;------------------------------------- MACRO ProfileIn &Slot,&suffix IF Profile THEN IMPORT ProfileIn&suffix ldx #&Slot*4*3 IF Profile='s' THEN jsr ProfileIn&suffix ELSE jsl ProfileIn&suffix ENDIF ENDIF MEND ;------------------------------------- MACRO ProfileOut &Slot,&suffix IF Profile THEN IMPORT ProfileOut&suffix ldx #&Slot*4*3 IF Profile='s' THEN jsr ProfileOut&suffix ELSE jsl ProfileOut&suffix ENDIF ENDIF MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.stack b/appleworksgs/Macros/m16.stack new file mode 100755 index 0000000..19952d2 --- /dev/null +++ b/appleworksgs/Macros/m16.stack @@ -0,0 +1 @@ + *-------------------------------------------------------------------------* * Xtool * * Xtool functions like the macro tool but its input/output/err parameters * are defined before the macro call with the macros in, out, and err. *-------------------------------------------------------------------------* MACRO xtool &toolname,&err lcla &outnum lcla &innum lclc &size lclc &parm lcla &count gbla &xincnt gblc &xin[20] gbla &xoutcnt gblc &xout[20] gbla &xerrflag gblc &xerr &count seta &xoutcnt+1 WHILE (&count>1) DO &count seta &count-1 &size setc &substr(&xout[&count],&len(&xout[&count])-1,2) IF (&size=':r') or (&size=':R') GOTO .rect IF (&size=':l') or (&size=':L') GOTO .long IF (&size=':a') or (&size=':A') GOTO .addr IF (&size=':w') or (&size=':W') GOTO .word IF (&size=':b') or (&size=':B') GOTO .byte macerr 'XTool macro: Output parameter size improperly specified: ',&xout[&count],'' MEXIT .addr pha .byte phb CYCLE .rect pha pha .long pha .word pha ENDWHILE &count seta 0 WHILE (&count<&xincnt) DO &count seta &count+1 &size setc &substr(&xin[&count],&len(&xin[&count])-1,2) &parm setc &substr(&xin[&count],1,&len(&xin[&count])-2) IF (&size=':r') or (&size=':R') GOTO .rect IF (&size=':l') or (&size=':L') GOTO .long IF (&size=':a') or (&size=':A') GOTO .addr IF (&size=':w') or (&size=':W') GOTO .word IF (&size=':b') or (&size=':B') GOTO .byte macerr 'XTool macro: Input parameter size improperly specified: ',&xin[&count],'' MEXIT .rect pushrect &parm CYCLE .long PushLong &parm CYCLE .addr PushAdr &parm CYCLE .word PushWord &parm CYCLE .byte PushByte &parm ENDWHILE &toolname IF &len(&err)=0 GOTO .noname moveword a,&err GOTO .noerr .noname IF &xerrflag=0 GOTO .noerr sta &xerr .noerr &count seta &xoutcnt+1 WHILE (&count>1) DO &count seta &count-1 IF &len(&xout[&count])<3 THEN ; leave it on the stack. CYCLE ENDIF &size setc &substr(&xout[&count],&len(&xout[&count])-1,2) &parm setc &substr(&xout[&count],1,&len(&xout[&count])-2) IF (&size=':r') or (&size=':R') GOTO .rect IF (&size=':l') or (&size=':L') GOTO .long IF (&size=':a') or (&size=':A') GOTO .addr IF (&size=':w') or (&size=':W') GOTO .word IF (&size=':b') or (&size=':B') GOTO .byte macerr 'XTool macro: Output parameter size improperly specified: ',&xout[&count],'' MEXIT .rect pullrect &parm CYCLE .long PullLong &parm CYCLE .addr PullAdr &parm CYCLE .word PullWord &parm CYCLE .byte PullByte &parm ENDWHILE .quit &xerrflag seta 0 &xoutcnt seta 0 &xincnt seta 0 &xerr setc '' MEND *-------------------------------------------------------------------------* * XCall * * XCall functions like the macro Call but its input/output/err parameters * are defined before the macro call with the macros in, out, and err. *-------------------------------------------------------------------------* MACRO xcall &name,&err lcla &outnum lcla &innum lclc &size lclc &parm lcla &count gbla &xincnt gblc &xin[20] gbla &xoutcnt gblc &xout[20] gbla &xerrflag gblc &xerr &count seta &xoutcnt+1 WHILE (&count>1) DO &count seta &count-1 &size setc &substr(&xout[&count],&len(&xout[&count])-1,2) IF (&size=':r') or (&size=':R') GOTO .rect IF (&size=':l') or (&size=':L') GOTO .long IF (&size=':a') or (&size=':A') GOTO .addr IF (&size=':w') or (&size=':W') GOTO .word IF (&size=':b') or (&size=':B') GOTO .byte macerr 'XCall macro: Output parameter size improperly specified: ',&xout[&count],'' MEXIT .addr pha .byte phb CYCLE .rect pha pha .long pha .word pha ENDWHILE &count seta 0 WHILE (&count<&xincnt) DO &count seta &count+1 &size setc &substr(&xin[&count],&len(&xin[&count])-1,2) &parm setc &substr(&xin[&count],1,&len(&xin[&count])-2) IF (&size=':r') or (&size=':R') GOTO .rect IF (&size=':l') or (&size=':L') GOTO .long IF (&size=':a') or (&size=':A') GOTO .addr IF (&size=':w') or (&size=':W') GOTO .word IF (&size=':b') or (&size=':B') GOTO .byte macerr 'XCall macro: Input parameter size improperly specified: ',&xin[&count],'' MEXIT .rect pushrect &parm CYCLE .long PushLong &parm CYCLE .addr PushAdr &parm CYCLE .word PushWord &parm CYCLE .byte PushByte &parm ENDWHILE jsl &name IF &len(&err)=0 GOTO .noname moveword a,&err GOTO .noerr .noname IF &xerrflag=0 GOTO .noerr sta &xerr .noerr &count seta &xoutcnt+1 WHILE (&count>1) DO &count seta &count-1 IF &len(&xout[&count])<3 THEN ; leave it on the stack. CYCLE ENDIF &size setc &substr(&xout[&count],&len(&xout[&count])-1,2) &parm setc &substr(&xout[&count],1,&len(&xout[&count])-2) IF (&size=':r') or (&size=':R') GOTO .rect IF (&size=':l') or (&size=':L') GOTO .long IF (&size=':a') or (&size=':A') GOTO .addr IF (&size=':w') or (&size=':W') GOTO .word IF (&size=':b') or (&size=':B') GOTO .byte macerr 'XCall macro: Output parameter size improperly specified: ',&xin[&count],'' MEXIT .rect pullrect &parm CYCLE .long PullLong &parm CYCLE .addr PullAdr &parm CYCLE .word PullWord &parm CYCLE .byte PullByte &parm ENDWHILE .quit &xerrflag seta 0 &xoutcnt seta 0 &xincnt seta 0 &xerr setc '' MEND *-------------------------------------------------------------------------* MACRO in gblc &xin[20] gbla &xincnt lcla &count lcla ¶ms &count seta 0 ¶ms seta &nbr(&syslist) WHILE (&count<¶ms) DO &count seta &count+1 &xincnt seta &xincnt+1 IF (&xincnt>20) THEN macerr 'Too many input parameters for XCall or XTool.' ENDIF &xin[&xincnt] setc &syslist[&count] ENDWHILE MEND *-------------------------------------------------------------------------* MACRO out gblc &xout[20] gbla &xoutcnt lcla &count lcla ¶ms &count seta 0 ¶ms seta &nbr(&syslist) WHILE (&count<¶ms) DO &count seta &count+1 &xoutcnt seta &xoutcnt+1 IF (&xoutcnt>20) THEN macerr 'Too many output parameters for XCall or XTool.' ENDIF &xout[&xoutcnt] setc &syslist[&count] ENDWHILE MEND *-------------------------------------------------------------------------* MACRO xerr &errlabel gbla &xerrflag gblc &xerr &xerrflag seta 1 &xerr setc &errlabel MEND ;...........................................................................; ; ; generic call subroutine macro ; ; call RoutineName,in=(Parm1:L,Parm2:W),out=(Out1:L,Out2:W),err ; ; This macro will push enough space on the stack for the specified output ; parameters, then push the input parameters in the order given onto stack ; and call the named routine. All parameters must have a size specification ; for this macro to work. The size may be either :w (word) or :l (long). ; ; If an error label is given then the value of the accumulator after the ; call is saved in the given label position. ;...........................................................................; MACRO &lab call &name,&in,&out,&err &lab ; lcla &outnum lcla &innum lcla &count lclc &insize lclc &inparm lclc &outsize lclc &outparm lclc &newout[20] lclc &newin[20] IF (&nbr(&out)=0) THEN IF (&out = '') THEN &outnum seta 0 ELSE &outnum seta 1 &newout[1] setc &out ENDIF ELSE &outnum seta &nbr(&out) WHILE (&outnum 0) DO &newout[&outnum] setc &out[&outnum] &outnum seta &outnum-1 ENDWHILE &outnum seta &nbr(&out) ENDIF IF (&nbr(&in)=0) THEN IF (&in = '') THEN &innum seta 0 ELSE &innum seta 1 &newin[1] setc &in ENDIF ELSE &innum seta &nbr(&in) WHILE (&innum 0) DO &newin[&innum] setc &in[&innum] &innum seta &innum-1 ENDWHILE &innum seta &nbr(&in) ENDIF &count seta &outnum IF &outnum=0 GOTO .nooutput .outloop &outsize setc &substr(&newout[&count],&len(&newout[&count])-1,2) IF (&outsize=':l') or (&outsize=':L') GOTO .long IF (&outsize=':w') or (&outsize=':W') GOTO .word IF (&outsize=':a') or (&outsize=':A') GOTO .addr IF (&outsize=':b') or (&outsize=':B') GOTO .byte IF (&outsize=':r') or (&outsize=':R') GOTO .rect macerr 'Call macro: Parameter size not specified.' mexit .addr pha .byte PushByte a GOTO .xx .rect pha pha .long pha .word pha .xx &count seta &count-1 IF &count GOTO .outloop .nooutput &count seta 1 IF &innum=0 GOTO .noinput .inloop IF &len(&newin[&count])<3 GOTO .nextin &insize setc &substr(&newin[&count],&len(&newin[&count])-1,2) &inparm setc &substr(&newin[&count],1,&len(&newin[&count])-2) IF (&insize=':l') or (&insize=':L') GOTO .long IF (&insize=':w') or (&insize=':W') GOTO .word IF (&insize=':a') or (&insize=':A') GOTO .addr IF (&insize=':b') or (&insize=':B') GOTO .byte IF (&insize=':r') or (&insize=':R') GOTO .rect macerr 'Call macro: Parameter size not specified.' mexit .rect pushrect &inparm GOTO .nextin .addr PushAdr &inparm GOTO .nextin .byte PushByte &inparm GOTO .nextin .long PushLong &inparm GOTO .nextin .word PushWord &inparm .nextin &count seta &count+1 IF &count>&innum GOTO .noinput GOTO .inloop .noinput jsl &name IF &type('&err')='UNDEFINED' GOTO .dopull IF &nbr(&err)=0 THEN IF (&err='') GOTO .dopull moveword a,&err ELSE moveword a,&err[1] ENDIF .dopull &count seta &outnum IF &count>0 GOTO .getout mexit .getout IF &len(&newout[&count])<3 GOTO .nextout &outsize setc &substr(&newout[&count],&len(&newout[&count])-1,2) &outparm setc &substr(&newout[&count],1,&len(&newout[&count])-2) IF (&outsize=':l') or (&outsize=':L') GOTO .long IF (&outsize=':w') or (&outsize=':W') GOTO .word IF (&outsize=':a') or (&outsize=':A') GOTO .addr IF (&outsize=':b') or (&outsize=':B') GOTO .byte IF (&outsize=':r') or (&outsize=':R') GOTO .rect macerr 'Call macro: Parameter size not specified.' mexit .rect pullrect &outparm GOTO .nextout .addr PullAdr &outparm GOTO .nextout .byte PullByte &outparm GOTO .nextout .word PullWord &outparm GOTO .nextout .long PullLong &outparm .nextout &count seta &count-1 IF &count GOTO .getout .quit mexit MEND ;...........................................................................; ; ; generic tool call subroutine macro ; ; tool RoutineName,in=(Parm1:L,Parm2:W),out=(Out1:L,Out2:W),err ; ; This macro will push enough space on the stack for the specified output ; parameters, then push the input parameters in the order given onto stack ; and call the named routine. All parameters must have a size specification ; for this macro to work. The size may be either :w (word) or :l (long). ; ; If an error label is given then the value of the accumulator after the ; call is saved in the given label position. ;...........................................................................; MACRO &lab tool &name,&in,&out,&err &lab ; lcla &outnum lcla &innum lcla &count lclc &insize lclc &inparm lclc &outsize lclc &outparm lclc &newout[20] lclc &newin[20] IF (&nbr(&out)=0) THEN IF (&out = '') THEN &outnum seta 0 ELSE &outnum seta 1 &newout[1] setc &out ENDIF ELSE &outnum seta &nbr(&out) WHILE (&outnum 0) DO &newout[&outnum] setc &out[&outnum] &outnum seta &outnum-1 ENDWHILE &outnum seta &nbr(&out) ENDIF IF (&nbr(&in)=0) THEN IF (&in = '') THEN &innum seta 0 ELSE &innum seta 1 &newin[1] setc &in ENDIF ELSE &innum seta &nbr(&in) WHILE (&innum 0) DO &newin[&innum] setc &in[&innum] &innum seta &innum-1 ENDWHILE &innum seta &nbr(&in) ENDIF &count seta &outnum IF &outnum=0 GOTO .nooutput .outloop &outsize setc &substr(&newout[&count],&len(&newout[&count])-1,2) IF (&outsize=':l') or (&outsize=':L') GOTO .long IF (&outsize=':w') or (&outsize=':W') GOTO .word IF (&outsize=':a') or (&outsize=':A') GOTO .addr IF (&outsize=':b') or (&outsize=':B') GOTO .byte macerr 'Tool macro: Parameter size not specified.' mexit .addr pha .byte PushByte a GOTO .xx .long pha .word pha .xx &count seta &count-1 IF &count GOTO .outloop .nooutput &count seta 1 IF &innum=0 GOTO .noinput .inloop IF &len(&newin[&count])<3 GOTO .nextin &insize setc &substr(&newin[&count],&len(&newin[&count])-1,2) &inparm setc &substr(&newin[&count],1,&len(&newin[&count])-2) IF (&insize=':l') or (&insize=':L') GOTO .long IF (&insize=':w') or (&insize=':W') GOTO .word IF (&insize=':a') or (&insize=':A') GOTO .addr IF (&insize=':b') or (&insize=':B') GOTO .byte macerr 'Tool macro: Input parameter size not specified.' mexit .addr PushAdr &inparm GOTO .nextin .byte PushByte &inparm GOTO .nextin .long PushLong &inparm GOTO .nextin .word PushWord &inparm .nextin &count seta &count+1 IF &count>&innum GOTO .noinput GOTO .inloop .noinput &name IF &type('&err')='UNDEFINED' GOTO .dopull IF &nbr(&err)=0 THEN IF (&err='') GOTO .dopull moveword a,&err ELSE moveword a,&err[1] ENDIF .dopull &count seta &outnum IF &count>0 GOTO .getout mexit .getout IF &len(&newout[&count])<3 GOTO .nextout &outsize setc &substr(&newout[&count],&len(&newout[&count])-1,2) &outparm setc &substr(&newout[&count],1,&len(&newout[&count])-2) IF (&outsize=':l') or (&outsize=':L') GOTO .long IF (&outsize=':w') or (&outsize=':W') GOTO .word IF (&outsize=':a') or (&outsize=':A') GOTO .addr IF (&outsize=':b') or (&outsize=':B') GOTO .byte macerr 'Tool macro: Parameter size not specified.' mexit .addr PullAdr &outparm GOTO .nextout .byte PullByte &outparm GOTO .nextout .word PullWord &outparm GOTO .nextout .long PullLong &outparm .nextout &count seta &count-1 IF &count GOTO .getout .quit mexit MEND *===========================================================================* ;------------------------------------------------------------------------------- MACRO input GBLC &ginput[20] GBLA &gincnt LCLA &count LCLA &limit &count SETA 0 &limit SETA &nbr(&syslist) WHILE (&count<&limit) DO &gincnt SETA &gincnt+1 &count SETA &count+1 &ginput[&gincnt] SETC &syslist[&count] ENDWHILE MEND ;------------------------------------------------------------------------------- MACRO output GBLC &goutput[20] GBLA &goutcnt LCLA &count LCLA &limit &count SETA 0 &limit SETA &nbr(&syslist) WHILE (&count<&limit) DO &goutcnt SETA &goutcnt+1 &count SETA &count+1 &goutput[&goutcnt] SETC &syslist[&count] ENDWHILE MEND ;------------------------------------------------------------------------------- MACRO local GBLC &glocal[40] GBLA &gloccnt LCLA &count LCLA &limit &count SETA 0 &limit SETA &nbr(&syslist) WHILE (&count<&limit) DO &gloccnt SETA &gloccnt+1 &count SETA &count+1 &glocal[&gloccnt] SETC &syslist[&count] ENDWHILE MEND ;------------------------------------------------------------------------------- MACRO error &op1 GBLC &glocal[40] GBLA &gloccnt GBLC &gerror GBLA &reterr &reterr SETA 1 IF &nbr(&syslist)=0 THEN &gerror SETC 'a' MEXIT ENDIF &gerror SETC &op1 IF &op1'a' THEN &gloccnt SETA &gloccnt+1 &glocal[&gloccnt] SETC &concat(&op1,':w') ENDIF MEND ;-------------------------------------------------------------------------; MACRO begin &op1 LCLC &Pname LCLC &length LCLA &loccnt LCLA &locsize LCLA &incnt LCLA &inpsize LCLA &outcnt LCLA &outsize GBLA &inbegin IF (&inbegin = 1) THEN macerr 'Begin without a Return' ENDIF &inbegin seta 1 GBLC &ginput[20] GBLA &gincnt GBLC &goutput[20] GBLA &goutcnt GBLC &glocal[40] GBLA &gloccnt GBLC &gerror GBLA &reterr GBLA &glink GBLA &gbank IF (&gincnt+&goutcnt+&gloccnt=0) GOTO .done ;--------------------Locals IF (&gloccnt=0) GOTO .skip4 &loccnt SETA &gloccnt+1 WHILE (&loccnt>1) DO &loccnt SETA &loccnt-1 &Pname SETC &substr(&glocal[&loccnt],1,&len(&glocal[&loccnt])-2) &length SETC &substr(&glocal[&loccnt],&len(&glocal[&loccnt])-1,2) IF (&substr(&Pname,1,1)'!') THEN IF (&ENTERSYM(&SYSLOCAL,&UPCASE(&PNAME),1+&locsize,0)=0) THEN macerr 'Begin macro: Could not enter label into symbol table.' ENDIF ELSE &Pname SETC &substr(&Pname,2,&len(&Pname)-1) IF (&ENTERSYM(&SYSGLOBAL,&UPCASE(&PNAME),1+&locsize,0)=0) THEN macerr 'Begin macro: Could not enter label into symbol table' ENDIF ENDIF IF (&length=':b') THEN &locsize SETA &locsize+1 CYCLE ELSEIF (&length=':w') THEN &locsize SETA &locsize+2 CYCLE ELSEIF (&length=':a') THEN &locsize SETA &locsize+3 CYCLE ELSEIF (&length=':l') THEN &locsize SETA &locsize+4 CYCLE ELSEIF (&length=':r') THEN &locsize SETA &locsize+8 CYCLE ELSEIF (&length=':x') THEN &locsize SETA &locsize+10 CYCLE ELSE macerr 'Begin macro: Bad local specification "',&PName,'"' MEXIT ENDIF ENDWHILE .skip4 ;--------------------Inputs IF (&gincnt=0) GOTO .skip5 &incnt SETA &gincnt+1 WHILE (&incnt>1) DO &incnt SETA &incnt-1 &Pname SETC &substr(&ginput[&incnt],1,&len(&ginput[&incnt])-2) &length SETC &substr(&ginput[&incnt],&len(&ginput[&incnt])-1,2) IF (&substr(&Pname,1,1)'!') THEN IF (&ENTERSYM(&SYSLOCAL,&UPCASE(&PNAME),6+&locsize+&inpsize,0)=0) THEN macerr 'Begin macro: Could not enter label ',&UPCASE(&PNAME),' into symbol table' ENDIF ELSE &Pname SETC &substr(&Pname,2,&len(&Pname)-1) IF (&ENTERSYM(&SYSGLOBAL,&UPCASE(&PNAME),6+&locsize+&inpsize,0)=0) THEN macerr 'Begin macro: Could not enter label ',&UPCASE(&PNAME),' into symbol table' ENDIF ENDIF IF (&length=':b') THEN &inpsize SETA &inpsize+1 CYCLE ELSEIF (&length=':w') THEN &inpsize SETA &inpsize+2 CYCLE ELSEIF (&length=':a') THEN &inpsize SETA &inpsize+3 CYCLE ELSEIF (&length=':l') THEN &inpsize SETA &inpsize+4 CYCLE ELSEIF (&length=':r') THEN &inpsize SETA &inpsize+8 CYCLE ELSEIF (&length=':x') THEN &inpsize SETA &inpsize+10 CYCLE ELSE macerr 'Begin macro: Bad input specification "',&PName,'"' MEXIT ENDIF ENDWHILE .skip5 &glink SETA 1 ; Change equates to ENTERSYMs to allow multiple begin-returns in a single code segment IF (&ENTERSYM(&SYSLOCAL,'LOCALS',1,0)=0) THEN macerr 'Begin macro: Could not enter LOCALS into symbol table' MEXIT ENDIF IF (&ENTERSYM(&SYSLOCAL,'INPUT',&locsize+5+1,0)=0) THEN macerr 'Begin macro: Could not enter INPUT into symbol table' MEXIT ENDIF IF (&ENTERSYM(&SYSLOCAL,'OUTPUT',&locsize+5+1+&inpsize,0)=0) THEN macerr 'Begin macro: Could not enter OUTPUT into symbol table' MEXIT ENDIF .* locals equ 1 .* input equ &locsize+5+locals .* output equ input+&inpsize phd ; push current DP tsc IF &locsize0 THEN ; make stack space sec ; for local variables sbc #&locsize tcs ENDIF tcd ; set new DP ;--------------------Outputs IF (&goutcnt=0) GOTO .done &outcnt SETA &goutcnt+1 WHILE (&outcnt>1) DO &outcnt SETA &outcnt-1 &Pname SETC &substr(&goutput[&outcnt],1,&len(&goutput[&outcnt])-2) &length SETC &substr(&goutput[&outcnt],&len(&goutput[&outcnt])-1,2) IF (&substr(&Pname,1,1)'!') THEN IF (&ENTERSYM(&SYSLOCAL,&UPCASE(&PNAME),6+&locsize+&inpsize+&outsize,0)=0) THEN macerr 'Begin macro: Could not enter label ',&UPCASE(&PNAME),' into symbol table' ENDIF ELSE &Pname SETC &substr(&Pname,2,&len(&Pname)-1) IF (&ENTERSYM(&SYSGLOBAL,&UPCASE(&PNAME),6+&locsize+&inpsize+&outsize,0)=0) THEN macerr 'Begin macro: Could not enter label ',&UPCASE(&PNAME),' into symbol table' ENDIF ENDIF IF (&length=':b') THEN &outsize SETA &outsize+1 CYCLE ELSEIF (&length=':w') THEN &outsize SETA &outsize+2 CYCLE ELSEIF (&length=':a') THEN &outsize SETA &outsize+3 CYCLE ELSEIF (&length=':l') THEN &outsize SETA &outsize+4 CYCLE ELSEIF (&length=':r') THEN &outsize SETA &outsize+8 CYCLE ELSEIF (&length=':x') THEN &outsize SETA &outsize+10 CYCLE ELSE macerr 'Begin macro: Bad output specification "',&PName,'"' MEXIT ENDIF ENDWHILE .done IF &nbr(&syslist)=0 GOTO .skip6 IF (&op1'+b') AND (&op1'+B') GOTO .skip6 &gbank seta 1 phb phk plb .skip6 MEND ;-------------------------------------------------------------------------- MACRO &lab return &op1 &lab GBLC &gerror GBLA &reterr GBLA &gbank GBLA &glink GBLA &gloccnt GBLA &gincnt GBLA &goutcnt GBLA &inbegin IF (&inbegin=0) THEN macerr 'Return without a Begin' MEXIT ENDIF &inbegin SETA 0 IF &nbr(&syslist) THEN &reterr SETA 1 &gerror SETC &op1 ENDIF IF &gbank THEN plb ENDIF IF &glink THEN IF &reterr THEN IF &gerror'a' THEN ldy &gerror ELSE tay ENDIF ENDIF IF inputoutput THEN lda input-2 ;move return address sta output-2 lda input-3 sta output-3 lda input-5 ; reset old DP tcd tsc ; reset stack pointer clc adc #output-4 tcs ELSE IF input6 THEN tsc ; reset stack pointer clc adc #output-6 tcs ENDIF pld ; reset old DP ENDIF IF &reterr THEN tya cmp #1 ENDIF ELSEIF &reterr THEN ; nolink IF &gerror'a' THEN lda &gerror ENDIF cmp #1 ENDIF rtl &gbank SETA 0 &glink SETA 0 &reterr SETA 0 &gloccnt SETA 0 &gincnt SETA 0 &goutcnt SETA 0 &gerror SETC '' MEND ;--------------------------------------------------------------------------- ; ; Allocate the Local Space on the stack, ; Use Stack Space as the new Zero Page, ; Create labels to the input and output parameters ; if SizeLocals is not specified, does'nt make local space. ; ; link SizeInput [,SizeLocals] or links SizeInput [,SizeLocals] ; ; ; ; (stack before macro) ; ; | output space | ; | _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ; | | ; | input space | ; |_____________________________| ; |_ _| ; |_ RTA _| ; |_____________________________| ; <= SP ; ; ; (stack after macro) ; ; | output space | ; | _ _ _ _ _ _ _ _ _ _ _ _ _ _ | <= output ; | | ; | input space | ; |_____________________________| <= input ; |_ _| ; |_ RTA _| ; |_____________________________| ; |_ old DP _| ; |_____________________________| ; | | ; | local variables | ; | _ _ _ _ _ _ _ _ _ _ _ _ _ _ | ; <= SP <= DP ;...........................................................................; MACRO &lab link &SizeInput,&SizeLocals &lab IF (&nbr(&syslist)=2) GOTO .a LCLC &SizeLocals &SizeLocals SETC 0 .a IF (&type('locals')='EQU') THEN macerr 'Multiple begin statements.' MEXIT ENDIF locals equ 1 input equ &SizeLocals+5+locals output equ input+&SizeInput phd ; push current DP tsc IF &SizeLocals=0 GOTO .b ; make stack space sec ; for local variables sbc #&SizeLocals tcs .b tcd MEND ;............................................................................. ; ; Unlink the Local Space, restore the previous Zero Page, ; Pull the input parameters off the stack, push the RTL address ; Adjust Carry according to Error Status (in accumulator) ; ; unlink_err, unlink ;.............................................................................. MACRO &lab unlink_err &err &lab ; IF &nbr(&syslist) GOTO .here tay ; save 'a' register GOTO .there .here ldy &err .there IF input=output GOTO .a lda input-2 ; move return address sta output-2 lda input-3 sta output-3 lda input-5 ; reset old DP tcd tsc ; reset stack pointer clc adc #output-4 tcs GOTO .b .a IF input=6 GOTO .f tsc ; reset stack pointer clc adc #output-6 tcs .f pld ; reset old DP .b tya ; reset 'a' and status cmp #1 ; register MEND ;------------------------------------------------------------------------------ MACRO &lab unlink &lab ; IF input=output GOTO .a lda input-2 ;move return address sta output-2 lda input-3 sta output-3 lda input-5 ; reset old DP tcd tsc ; reset stack pointer clc adc #output-4 tcs MEXIT .a IF input=6 GOTO .f tsc ; reset stack pointer clc adc #output-6 tcs .f pld ; reset old DP MEND ;............................................................................; ; ; Space long (4 bytes) onto stack ; ; spacelong - push 4 bytes on stack ; ;............................................................................; MACRO &lab spacelong &lab ; pha pha MEND ;............................................................................; ; ; Space word (2 bytes) onto stack ; ; spaceword - push 2 bytes on stack ; ;............................................................................; MACRO &lab spaceword &lab ; pha MEND ;--------------------------------------------------------------------------- ; Push a byte as a word MACRO &lab PushWordByte ¶m moveword ¶m,a and #$FF00 pha MEND ;--------------------------------------------------------------------------- ; Push a word as a long MACRO &lab PushLongWord ¶m pea 0 pushword ¶m MEND ;--------------------------------------------------------------------------- ; Push a word as a fixedpoint MACRO &lab PushFixWord ¶m pushword ¶m pea 0 MEND ;--------------------------------------------------------------------------- ; Pull a fixedpoint as a word MACRO &lab PullFixWord ¶m pla pullword ¶m MEND ;---------------------------------------------------------------------- ; PushRect MACRO &lab pushrect ¶m &lab ; pushlong ¶m+4 pushlong ¶m MEND ;---------------------------------------------------------------------- ; PullRect MACRO &lab pullrect ¶m &lab IF (&nbr(&syslist)=0) OR (¶m='a') THEN pla pla pla pla ELSE pulllong ¶m pulllong ¶m+4 ENDIF MEND ;--------------------------------------------------------------------------- ;............................................................................; ; ; Push aliases ; ;............................................................................; MACRO &lab pushb &loc &lab ; pushbyte &loc MEND MACRO &lab pushw &loc &lab ; pushword &loc MEND MACRO &lab pusha &loc &lab ; pushadr &loc MEND MACRO &lab pushl &loc &lab ; pushlong &loc MEND ;............................................................................; ; ; Pull aliases ; ;............................................................................; MACRO &lab pullb &loc &lab ; pullbyte &loc MEND MACRO &lab pullw &loc &lab ; pullword &loc MEND MACRO &lab pulla &loc &lab ; pulladr &loc MEND MACRO &lab pulll &loc &lab ; pulllong &loc MEND ;............................................................................; ; ; Push 1 byte word on stack macro ; modified 6/8/88, Scott Lindsey ; to fix pushbyte #const ; and pushbyte dp.addr ; problems. ; PushByte addr PushByte addr:#off ; PushByte a PushByte addr:x PushByte [zp] ; PushByte x PushByte addr:y PushByte [zp]:y ; PushByte y PushByte addr:s PushByte [zp]:off ; PushByte #const PushByte addr:off PushByte [zp]:#off ; ;............................................................................; MACRO &lab PushByte &loc &lab ; lclc &char lclc &newloc lcla &ppos &newloc setc &loc IF (&newloc='x') or (&newloc='y') or (&newloc='a') GOTO .doreg sep #%00100000 longa off moveword &newloc,a pha rep #%00100000 longa on MEXIT .doreg sep #%00110000 longa off longi off ph&newloc rep #%00110000 longa on longi on MEND ;............................................................................; ; ; Push 2 byte word on stack macro ; ; Modified 5/88, Scott Lindsey ; to use pei for dp variables. ; ; ; PushWord addr PushWord addr:#off ; PushWord a PushWord addr:x PushWord [zp] ; PushWord x PushWord addr:y PushWord [zp]:y ; PushWord y PushWord addr:s PushWord [zp]:off ; PushWord #const PushWord addr:off PushWord [zp]:#off ; ; Caveat: Since ; Pushword DP ; ; is translated into a 'pei' instruction, ; ; Pushword addr ; ; where addr is an equated address does not work correctly. ; e.g. ; ; Border equ $00C034 ; ; pushword Border ; ; would **not** successfully push the contents of 00/C034 ; ; also note that the accumulator is not affected by pei, ; so the value of what was pushed does not remain in ; A as it used to... this is for DP variables ONLY. ;............................................................................; MACRO &lab PushWord &loc &lab ; lclc &newloc lclc &newloc2 lclc &char lclc &rest lclc &disp lcla &offset lcla &ppos &newloc setc &loc &ppos seta &pos('.',&loc) IF &ppos=0 GOTO .noeval eval &newloc &newloc setc 'a' .noeval IF &newloc <> '?' GOTO .notfromdc &newloc setc 'a' .notfromdc IF &nbr(&syslist)=0 GOTO .dopush IF (&newloc='x') or (&newloc='y') or (&newloc='a') GOTO .doreg &offset seta &pos(':',&newloc) &char setc &substr(&newloc,1,1) IF &offset GOTO .dopushoff IF (&char='#') GOTO .doimm IF (&char='[') or (&char='>') or (&char='$') GOTO .normal &offset seta &pos('+',&newloc) &newloc2 setc &newloc IF &offset GOTO .rmplus GOTO .dopei .rmplus &newloc2 setc &substr(&newloc,1,&offset-1) .dopei .; IF &pos('IMPORT',&type(&newloc2)) GOTO .normal IF &type(&newloc2) = 'EQU' OR &isint(&newloc2) THEN IF &eval(&newloc) < 256 THEN pei &newloc mexit ENDIF ENDIF .; IF &type(&newloc)'EQU' GOTO .normal .; IF not(&findsym(&syslocal,&uc(&newloc))) GOTO .normal .normal &offset seta &pos(':',&newloc) IF &offset GOTO .dopushoff lda &newloc pha mexit .dopushoff &rest setc &substr(&newloc,1,&offset-1) &disp setc &substr(&newloc,&offset+1,&len(&newloc)-&offset) IF (&disp='x') or (&disp='y') or (&disp='s') GOTO .dopushoffi IF (&char='[') GOTO .dopushoffzp ldx &disp lda &rest,x pha mexit .dopushoffi lda &rest,&disp pha mexit .dopushoffzp ldy &disp lda &rest,y pha mexit .dopush pha mexit .doimm &char setc &substr(&newloc,2,1) IF (&char='(') GOTO .doimm2 pea &substr(&newloc,2,&len(&newloc)-1) mexit .doimm2 pea &substr(&newloc,3,&len(&newloc)-3) mexit .doreg ph&newloc MEND ;............................................................................; ; ; Push 3 byte address on stack macro ; ; PushAdr a PushAdr addr:y PushAdr [zp] ; PushAdr #const PushAdr addr:s PushAdr [zp]:y ; PushAdr addr PushAdr addr:off PushAdr [zp]:off ; PushAdr addr:x PushAdr addr:#off PushAdr [zp]:#off ; ;............................................................................; MACRO &lab PushAdr &loc &lab ; lclc &char lclc &rest lclc &disp lcla &offset IF (&nbr(&syslist)=0) or (&loc='a') GOTO .dopush &char setc &substr(&loc,1,1) IF (&char='#') GOTO .doimm &offset seta &pos(':',&loc) IF &offset GOTO .dopushoff IF (&char='[') GOTO .dopushzp lda &loc+1 pha GOTO .dosimple .dopushzp ldy #1 lda &loc,y pha GOTO .dosimple .doimm &rest setc &substr(&loc,2,&len(&loc)-1) lda #(&rest>>8) pha GOTO .dosimple .dosimple phb lda &loc sta 1,s mexit .dopush pha phb mexit .dopushoff &rest setc &substr(&loc,1,&offset-1) &disp setc &substr(&loc,&offset+1,&len(&loc)-&offset) IF (&char='[') GOTO .dopushoffzp IF (&disp='s') GOTO .dopushoffs IF (&disp='x') or (&disp='y') GOTO .dopushoffi ldx &disp &disp setc 'x' .dopushoffi lda &rest+1,&disp pha phb lda &rest,&disp sta 1,s mexit .dopushoffs lda &rest,s tax lda &rest+1,s pha phb txa sta 1,s mexit .dopushoffzp IF (&disp='y') GOTO .dopushoffzpy &char setc &substr(&disp,1,1) IF (&char='#') GOTO .dopushoffzpimm ldy &disp .dopushoffzpy iny GOTO .dopushoffzp2 .dopushoffzpimm ldy &disp+1 .dopushoffzp2 lda &rest,y pha phb dey lda &rest,y sta 1,s MEND ;............................................................................; ; ; Push 4 byte long word on stack macro ; ; Modified 5/88, Scott Lindsey ; to use pei for dp variables. ; ; PushLong a PushLong addr PushLong addr:#off ; PushLong ax PushLong addr:x PushLong [zp] ; PushLong ay PushLong addr:y PushLong [zp]:y ; PushLong xy PushLong addr:s PushLong [zp]:off ; PushLong #const PushLong addr:off PushLong [zp]:#off ; ; Note: If you wish to push the address of a direct page label then use ; the following format: PushLong !label. ; ; Caveat: Since ; Pushlong DP ; ; is translated into two 'pei' instructions, ; ; Pushlong addr ; ; where addr is an equated address does not work correctly. ; e.g. ; ; Border equ $00C034 ; ; pushlong Border ; ; would **not** successfully push the contents of 00/C034 ; ; also note that the accumulator is not affected by pei, ; so the lower word of what was pushed does not remain in ; A as it used to... this is for DP variables ONLY. ; ; ;............................................................................; MACRO &lab PushLong &loc &lab ; lclc &newloc lclc &newloc2 lclc &char lcla &offset lclc &rest lclc &disp &newloc setc &loc IF &newloc<>'?' GOTO .notfromdc &newloc setc 'ax' .notfromdc IF &nbr(&syslist)=0 GOTO .dopush IF (&newloc='a') GOTO .dopush IF (&newloc='ax') GOTO .dopushax IF (&newloc='ay') GOTO .dopushay IF (&newloc='xy') GOTO .dopushxy &char setc &substr(&newloc,1,1) IF (&char='#') GOTO .doimm IF (&char='!') GOTO .dopushlocal &offset seta &pos(':',&newloc) IF &offset GOTO .dopushoff IF (&char='[') GOTO .dopushzp IF (&char='>') or (&char='$') GOTO .normal &offset seta &pos('+',&newloc) &newloc2 setc &newloc IF &offset GOTO .rmplus GOTO .dopei .rmplus &newloc2 setc &substr(&newloc,1,&offset-1) .dopei .; IF &pos('IMPORT',&type(&newloc2)) GOTO .normal IF &type(&newloc2) = 'EQU' OR &isint(&newloc2) THEN IF &eval(&newloc) < 256-2 THEN pei &newloc+2 pei &newloc mexit ENDIF ENDIF .; IF &type(&newloc2)'EQU' GOTO .normal .; IF not(&findsym(&syslocal,&uc(&newloc2))) GOTO .normal .normal lda &newloc+2 pha lda &newloc pha mexit .dopush pha pha mexit .doimm &char setc &substr(&loc,2,1) IF (&char='(') GOTO .doimm2 lclc &immloc &immloc setc &substr(&newloc,2,&len(&newloc)-1) pea &immloc>>16 pea |&immloc mexit .doimm2 lclc &immloc &immloc setc &substr(&newloc,3,&len(&newloc)-3) pea &immloc>>16 pea |&immloc mexit .dopushax phx pha mexit .dopushay phy pha mexit .dopushxy phy phx mexit .dopushzp ldy #2 lda &newloc,y pha lda &newloc pha mexit .dopushoff &rest setc &substr(&newloc,1,&offset-1) &disp setc &substr(&newloc,&offset+1,&len(&newloc)-&offset) IF &char='[' GOTO .dopushoffzp IF (&disp='s') GOTO .dopushoffs IF (&disp='x') or (&disp='y') GOTO .dopushoffi ldx &disp &disp setc 'x' .dopushoffi lda &rest+2,&disp pha lda &rest,&disp pha mexit .dopushoffs lda &rest+2,s pha lda &rest+2,s pha mexit .dopushoffzp IF (&disp='y') GOTO .dopushoffzpy &char setc &substr(&disp,1,1) IF (&char='#') GOTO .dopushoffzpi ldy &disp iny iny lda &rest,y pha ldy &disp lda &rest,y pha mexit .dopushoffzpi ldy &disp+2 lda &rest,y pha ldy &disp lda &rest,y pha mexit .dopushoffzpy iny iny lda &rest,y pha dey dey lda &rest,y pha mexit .dopushlocal &newloc setc &substr(&newloc,2,&len(&newloc)-1) pea $0000 tdc clc adc #&newloc pha MEND ;............................................................................; ; ; Pull 1 byte word off stack macro ; ; PullByte a PullByte addr:x PullByte [zp] ; PullByte x PullByte addr:y PullByte [zp]:y ; PullByte y PullByte addr:off PullByte [zp]:off ; PullByte addr PullByte addr:#off PullByte [zp]:#off ; ;............................................................................; MACRO &lab PullByte &loc &lab ; IF (&loc='x') or (&loc='y') GOTO .doreg sep #%00100000 longa off PullWord &loc rep #%00100000 longa on mexit .doreg sep #%00110000 longa off longi off PullWord &loc rep #%00110000 longa on longi on MEND ;............................................................................; ; ; Pull 2 byte word off stack macro ; ; PullWord addr ; PullWord PullWord addr:x PullWord [zp] ; PullWord a PullWord addr:y PullWord [zp]:y ; PullWord x PullWord addr:off PullWord [zp]:off ; PullWord y PullWord addr:#off PullWord [zp]:#off ; ;............................................................................; MACRO &lab PullWord &loc &lab ; lclc &char lclc &rest lclc &disp lcla &offset lclc &newloc &newloc setc &loc IF &newloc<>'?' GOTO .notfromdc &newloc setc 'a' .notfromdc IF &nbr(&syslist)=0 GOTO .dopull IF (&newloc='x') or (&newloc='y') or (&newloc='a') GOTO .doreg pla &char setc &substr(&newloc,1,1) &offset seta &pos(':',&newloc) IF &offset GOTO .dopulloff sta &newloc mexit .dopulloff &rest setc &substr(&newloc,1,&offset-1) &disp setc &substr(&newloc,&offset+1,&len(&newloc)-&offset) IF (&disp='x') or (&disp='y') or (&disp='s') GOTO .dopulloffi IF (&char='[') GOTO .dopulloffzp ldx &disp &disp setc 'x' .dopulloffi sta &rest,&disp mexit .dopulloffzp ldy &disp sta &rest,y mexit .dopull pla mexit .doreg pl&newloc MEND ;............................................................................; ; ; Pull 3 byte address off stack macro ; ; PullAdr a PullAdr [zp] ; PullAdr addr PullAdr addr:off PullAdr [zp]:y ; PullAdr addr:x PullAdr addr:#off PullAdr [zp]:off ; PullAdr addr:y PullAdr [zp]:#off ; ;............................................................................; MACRO &lab PullAdr &loc &lab ; lclc &char lclc &rest lclc &disp lcla &offset IF (&nbr(&syslist)=0) or (&loc='a') GOTO .dopull &char setc &substr(&loc,1,1) &offset seta &pos(':',&loc) IF &offset GOTO .dopulloff phb pla xba sta &loc IF &char='[' GOTO .dopullzp pla sta &loc+1 mexit .dopullzp ldy #1 pla sta &loc,y mexit .dopull phb pla pla mexit .dopulloff &rest setc &substr(&loc,1,&offset-1) &disp setc &substr(&loc,&offset+1,&len(&loc)-&offset) IF (&char='[') GOTO .dopulloffzp IF (&disp='x') or (&disp='y') GOTO .dopulloffi ldx &disp &disp setc 'x' GOTO .dopulloffi .dopulloffzp IF &disp='y' GOTO .dopulloffzpy ldy &disp .dopulloffzpy phb pla xba sta &rest,y iny pla sta &rest,y mexit .dopulloffi phb pla xba sta &rest,&disp pla sta &rest+1,&disp MEND ;............................................................................; ; ; Pull 4 byte long word off stack macro ; ; PullLong addr ; PullLong a PullLong addr:x PullLong [zp] ; PullLong ax PullLong addr:y PullLong [zp]:y ; PullLong ay PullLong addr:off PullLong [zp]:off ; PullLong xy PullLong addr:#off PullLong [zp]:#off ; ;............................................................................; MACRO &lab PullLong &loc &lab ; lclc &newloc lclc &char lcla &offset lclc &rest lclc &disp &newloc setc &loc IF &newloc <> '?' GOTO .notfromdc &newloc setc 'ax' .notfromdc IF (&nbr(&syslist)=0) or (&newloc='a') GOTO .dopull IF (&newloc='ax') GOTO .dopullax IF (&newloc='ay') GOTO .dopullay IF (&newloc='xy') GOTO .dopullxy &char setc &substr(&newloc,1,1) &offset seta &pos(':',&newloc) IF &offset GOTO .dopulloff IF (&char='[') GOTO .dopullzp pla sta &newloc pla sta &newloc+2 mexit .dopull pla pla mexit .dopullax pla plx mexit .dopullay pla ply mexit .dopullxy plx ply mexit .dopullzp pla sta &newloc pla ldy #2 sta &newloc,y mexit .dopulloff &rest setc &substr(&newloc,1,&offset-1) &disp setc &substr(&newloc,&offset+1,&len(&newloc)-&offset) IF &char='[' GOTO .dopulloffzp IF (&disp='x') or (&disp='y') GOTO .dopulloffi ldx &disp &disp setc 'x' .dopulloffi pla sta &rest,&disp pla sta &rest+2,&disp mexit .dopulloffzp IF (&disp='y') GOTO .dopulloffzpy &char setc &substr(&disp,1,1) IF (&char='#') GOTO .dopulloffzpi pla ldy &disp sta &rest,y pla ldy &disp iny iny sta &rest,y mexit .dopulloffzpi pla ldy &disp sta &rest,y pla ldy &disp+2 sta &rest,y mexit .dopulloffzpy pla sta &rest,y pla iny iny sta &rest,y MEND \ No newline at end of file diff --git a/appleworksgs/Macros/m16.tools b/appleworksgs/Macros/m16.tools new file mode 100755 index 0000000..039bd25 --- /dev/null +++ b/appleworksgs/Macros/m16.tools @@ -0,0 +1 @@ +; File: M16.ACE ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _ACEBootInit &lab ldx #$011D jsl $E10000 MEND MACRO &lab _ACEStartUp &lab ldx #$021D jsl $E10000 MEND MACRO &lab _ACEShutDown &lab ldx #$031D jsl $E10000 MEND MACRO &lab _ACEVersion &lab ldx #$041D jsl $E10000 MEND MACRO &lab _ACEReset &lab ldx #$051D jsl $E10000 MEND MACRO &lab _ACEStatus &lab ldx #$061D jsl $E10000 MEND MACRO &lab _ACEInfo &lab ldx #$071D jsl $E10000 MEND MACRO &lab _ACECompBegin &lab ldx #$0B1D jsl $E10000 MEND MACRO &lab _ACECompress &lab ldx #$091D jsl $E10000 MEND MACRO &lab _ACEExpand &lab ldx #$0A1D jsl $E10000 MEND MACRO &lab _ACEExpBegin &lab ldx #$0C1D jsl $E10000 MEND ; File: M16.ADB ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _ADBBootInit &lab ldx #$0109 jsl $E10000 MEND MACRO &lab _ADBStartUp &lab ldx #$0209 jsl $E10000 MEND MACRO &lab _ADBShutDown &lab ldx #$0309 jsl $E10000 MEND MACRO &lab _ADBVersion &lab ldx #$0409 jsl $E10000 MEND MACRO &lab _ADBReset &lab ldx #$0509 jsl $E10000 MEND MACRO &lab _ADBStatus &lab ldx #$0609 jsl $E10000 MEND MACRO &lab _AbsOff &lab ldx #$1009 jsl $E10000 MEND MACRO &lab _AbsOn &lab ldx #$0F09 jsl $E10000 MEND MACRO &lab _AsyncADBReceive &lab ldx #$0D09 jsl $E10000 MEND MACRO &lab _ClearSRQTable &lab ldx #$1609 jsl $E10000 MEND MACRO &lab _GetAbsScale &lab ldx #$1309 jsl $E10000 MEND MACRO &lab _ReadAbs &lab ldx #$1109 jsl $E10000 MEND MACRO &lab _ReadKeyMicroData &lab ldx #$0A09 jsl $E10000 MEND MACRO &lab _ReadKeyMicroMem &lab ldx #$0B09 jsl $E10000 MEND MACRO &lab _SendInfo &lab ldx #$0909 jsl $E10000 MEND MACRO &lab _SetAbsScale &lab ldx #$1209 jsl $E10000 MEND MACRO &lab _SRQPoll &lab ldx #$1409 jsl $E10000 MEND MACRO &lab _SRQRemove &lab ldx #$1509 jsl $E10000 MEND MACRO &lab _SyncADBReceive &lab ldx #$0E09 jsl $E10000 MEND ; File: M16.AppleTalk ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; ; File: M16.Control ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _CtlBootInit &lab ldx #$0110 jsl $E10000 MEND MACRO &lab _CtlStartUp &lab ldx #$0210 jsl $E10000 MEND MACRO &lab _CtlShutDown &lab ldx #$0310 jsl $E10000 MEND MACRO &lab _CtlVersion &lab ldx #$0410 jsl $E10000 MEND MACRO &lab _CtlReset &lab ldx #$0510 jsl $E10000 MEND MACRO &lab _CtlStatus &lab ldx #$0610 jsl $E10000 MEND MACRO &lab _CtlNewRes &lab ldx #$1210 jsl $E10000 MEND MACRO &lab _DisposeControl &lab ldx #$0A10 jsl $E10000 MEND MACRO &lab _DragControl &lab ldx #$1710 jsl $E10000 MEND MACRO &lab _DragRect &lab ldx #$1D10 jsl $E10000 MEND MACRO &lab _DrawControls &lab ldx #$1010 jsl $E10000 MEND MACRO &lab _DrawOneCtl &lab ldx #$2510 jsl $E10000 MEND MACRO &lab _EraseControl &lab ldx #$2410 jsl $E10000 MEND MACRO &lab _FindControl &lab ldx #$1310 jsl $E10000 MEND MACRO &lab _GetCtlAction &lab ldx #$2110 jsl $E10000 MEND MACRO &lab _GetCtlDPage &lab ldx #$1F10 jsl $E10000 MEND MACRO &lab _GetCtlParams &lab ldx #$1C10 jsl $E10000 MEND MACRO &lab _GetCtlRefCon &lab ldx #$2310 jsl $E10000 MEND MACRO &lab _GetCtlTitle &lab ldx #$0D10 jsl $E10000 MEND MACRO &lab _GetCtlValue &lab ldx #$1A10 jsl $E10000 MEND MACRO &lab _GrowSize &lab ldx #$1E10 jsl $E10000 MEND MACRO &lab _HideControl &lab ldx #$0E10 jsl $E10000 MEND MACRO &lab _HiliteControl &lab ldx #$1110 jsl $E10000 MEND MACRO &lab _KillControls &lab ldx #$0B10 jsl $E10000 MEND MACRO &lab _MoveControl &lab ldx #$1610 jsl $E10000 MEND MACRO &lab _NewControl &lab ldx #$0910 jsl $E10000 MEND MACRO &lab _SetCtlAction &lab ldx #$2010 jsl $E10000 MEND MACRO &lab _SetCtlIcons &lab ldx #$1810 jsl $E10000 MEND MACRO &lab _SetCtlParams &lab ldx #$1B10 jsl $E10000 MEND MACRO &lab _SetCtlRefCon &lab ldx #$2210 jsl $E10000 MEND MACRO &lab _SetCtlTitle &lab ldx #$0C10 jsl $E10000 MEND MACRO &lab _SetCtlValue &lab ldx #$1910 jsl $E10000 MEND MACRO &lab _ShowControl &lab ldx #$0F10 jsl $E10000 MEND MACRO &lab _TestControl &lab ldx #$1410 jsl $E10000 MEND MACRO &lab _TrackControl &lab ldx #$1510 jsl $E10000 MEND MACRO &lab _NewControl2 &lab ldx #$3110 jsl $E10000 MEND MACRO &lab _FindTargetCtl &lab ldx #$2610 jsl $E10000 MEND MACRO &lab _MakeNextCtlTarget &lab ldx #$2710 jsl $E10000 MEND MACRO &lab _MakeThisCtlTarget &lab ldx #$2810 jsl $E10000 MEND MACRO &lab _CallCtlDefProc &lab ldx #$2C10 jsl $E10000 MEND MACRO &lab _NotifyControls &lab ldx #$2D10 jsl $E10000 MEND MACRO &lab _SendEventToCtl &lab ldx #$2910 jsl $E10000 MEND MACRO &lab _GetCtlID &lab ldx #$2A10 jsl $E10000 MEND MACRO &lab _SetCtlID &lab ldx #$2B10 jsl $E10000 MEND MACRO &lab _GetCtlMoreFlags &lab ldx #$2E10 jsl $E10000 MEND MACRO &lab _SetCtlMoreFlags &lab ldx #$2F10 jsl $E10000 MEND MACRO &lab _GetCtlHandleFromID &lab ldx #$3010 jsl $E10000 MEND MACRO &lab _SetCtlParamPtr &lab ldx #$3410 jsl $E10000 MEND MACRO &lab _GetCtlParamPtr &lab ldx #$3510 jsl $E10000 MEND MACRO &lab _CMLoadResource &lab ldx #$3210 jsl $E10000 MEND MACRO &lab _CMReleaseResource &lab ldx #$3310 jsl $E10000 MEND MACRO &lab _InvalCtls &lab ldx #$3710 jsl $E10000 MEND ; File: M16.Desk ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _DeskBootInit &lab ldx #$0105 jsl $E10000 MEND MACRO &lab _DeskStartUp &lab ldx #$0205 jsl $E10000 MEND MACRO &lab _DeskShutDown &lab ldx #$0305 jsl $E10000 MEND MACRO &lab _DeskVersion &lab ldx #$0405 jsl $E10000 MEND MACRO &lab _DeskReset &lab ldx #$0505 jsl $E10000 MEND MACRO &lab _DeskStatus &lab ldx #$0605 jsl $E10000 MEND MACRO &lab _ChooseCDA &lab ldx #$1105 jsl $E10000 MEND MACRO &lab _CloseAllNDAs &lab ldx #$1D05 jsl $E10000 MEND MACRO &lab _CloseNDA &lab ldx #$1605 jsl $E10000 MEND MACRO &lab _CloseNDAByWinPtr &lab ldx #$1C05 jsl $E10000 MEND MACRO &lab _FixAppleMenu &lab ldx #$1E05 jsl $E10000 MEND MACRO &lab _GetDAStrPtr &lab ldx #$1405 jsl $E10000 MEND MACRO &lab _GetNumNDAs &lab ldx #$1B05 jsl $E10000 MEND MACRO &lab _InstallCDA &lab ldx #$0F05 jsl $E10000 MEND MACRO &lab _InstallNDA &lab ldx #$0E05 jsl $E10000 MEND MACRO &lab _OpenNDA &lab ldx #$1505 jsl $E10000 MEND MACRO &lab _RestAll &lab ldx #$0C05 jsl $E10000 MEND MACRO &lab _RestScrn &lab ldx #$0A05 jsl $E10000 MEND MACRO &lab _SaveAll &lab ldx #$0B05 jsl $E10000 MEND MACRO &lab _SaveScrn &lab ldx #$0905 jsl $E10000 MEND MACRO &lab _SetDAStrPtr &lab ldx #$1305 jsl $E10000 MEND MACRO &lab _SystemClick &lab ldx #$1705 jsl $E10000 MEND MACRO &lab _SystemEdit &lab ldx #$1805 jsl $E10000 MEND MACRO &lab _SystemEvent &lab ldx #$1A05 jsl $E10000 MEND MACRO &lab _SystemTask &lab ldx #$1905 jsl $E10000 MEND MACRO &lab _AddToRunQ &lab ldx #$1F05 jsl $E10000 MEND MACRO &lab _RemoveFromRunQ &lab ldx #$2005 jsl $E10000 MEND MACRO &lab _RemoveCDA &lab ldx #$2105 jsl $E10000 MEND MACRO &lab _RemoveNDA &lab ldx #$2205 jsl $E10000 MEND ; File: M16.Dialog ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _DialogBootInit &lab ldx #$0115 jsl $E10000 MEND MACRO &lab _DialogStartUp &lab ldx #$0215 jsl $E10000 MEND MACRO &lab _DialogShutDown &lab ldx #$0315 jsl $E10000 MEND MACRO &lab _DialogVersion &lab ldx #$0415 jsl $E10000 MEND MACRO &lab _DialogReset &lab ldx #$0515 jsl $E10000 MEND MACRO &lab _DialogStatus &lab ldx #$0615 jsl $E10000 MEND MACRO &lab _Alert &lab ldx #$1715 jsl $E10000 MEND MACRO &lab _CautionAlert &lab ldx #$1A15 jsl $E10000 MEND MACRO &lab _CloseDialog &lab ldx #$0C15 jsl $E10000 MEND MACRO &lab _DefaultFilter &lab ldx #$3615 jsl $E10000 MEND MACRO &lab _DialogSelect &lab ldx #$1115 jsl $E10000 MEND MACRO &lab _DisableDItem &lab ldx #$3915 jsl $E10000 MEND MACRO &lab _DlgCopy &lab ldx #$1315 jsl $E10000 MEND MACRO &lab _DlgCut &lab ldx #$1215 jsl $E10000 MEND MACRO &lab _DlgDelete &lab ldx #$1515 jsl $E10000 MEND MACRO &lab _DlgPaste &lab ldx #$1415 jsl $E10000 MEND MACRO &lab _DrawDialog &lab ldx #$1615 jsl $E10000 MEND MACRO &lab _EnableDItem &lab ldx #$3A15 jsl $E10000 MEND MACRO &lab _ErrorSound &lab ldx #$0915 jsl $E10000 MEND MACRO &lab _FindDItem &lab ldx #$2415 jsl $E10000 MEND MACRO &lab _GetAlertStage &lab ldx #$3415 jsl $E10000 MEND MACRO &lab _GetControlDItem &lab ldx #$1E15 jsl $E10000 MEND MACRO &lab _GetDefButton &lab ldx #$3715 jsl $E10000 MEND MACRO &lab _GetDItemBox &lab ldx #$2815 jsl $E10000 MEND MACRO &lab _GetDItemType &lab ldx #$2615 jsl $E10000 MEND MACRO &lab _GetDItemValue &lab ldx #$2E15 jsl $E10000 MEND MACRO &lab _GetFirstDItem &lab ldx #$2A15 jsl $E10000 MEND MACRO &lab _GetIText &lab ldx #$1F15 jsl $E10000 MEND MACRO &lab _GetNewDItem &lab ldx #$3315 jsl $E10000 MEND MACRO &lab _GetNewModalDialog &lab ldx #$3215 jsl $E10000 MEND MACRO &lab _GetNextDItem &lab ldx #$2B15 jsl $E10000 MEND MACRO &lab _HideDItem &lab ldx #$2215 jsl $E10000 MEND MACRO &lab _IsDialogEvent &lab ldx #$1015 jsl $E10000 MEND MACRO &lab _ModalDialog &lab ldx #$0F15 jsl $E10000 MEND MACRO &lab _ModalDialog2 &lab ldx #$2C15 jsl $E10000 MEND MACRO &lab _NewDItem &lab ldx #$0D15 jsl $E10000 MEND MACRO &lab _NewModalDialog &lab ldx #$0A15 jsl $E10000 MEND MACRO &lab _NewModelessDialog &lab ldx #$0B15 jsl $E10000 MEND MACRO &lab _NoteAlert &lab ldx #$1915 jsl $E10000 MEND MACRO &lab _ParamText &lab ldx #$1B15 jsl $E10000 MEND MACRO &lab _RemoveDItem &lab ldx #$0E15 jsl $E10000 MEND MACRO &lab _ResetAlertStage &lab ldx #$3515 jsl $E10000 MEND MACRO &lab _SelIText &lab ldx #$2115 jsl $E10000 MEND MACRO &lab _SelectIText &lab ldx #$2115 jsl $E10000 MEND MACRO &lab _SetDAFont &lab ldx #$1C15 jsl $E10000 MEND MACRO &lab _SetDefButton &lab ldx #$3815 jsl $E10000 MEND MACRO &lab _SetDItemBox &lab ldx #$2915 jsl $E10000 MEND MACRO &lab _SetDItemType &lab ldx #$2715 jsl $E10000 MEND MACRO &lab _SetDItemValue &lab ldx #$2F15 jsl $E10000 MEND MACRO &lab _SetIText &lab ldx #$2015 jsl $E10000 MEND MACRO &lab _ShowDItem &lab ldx #$2315 jsl $E10000 MEND MACRO &lab _StopAlert &lab ldx #$1815 jsl $E10000 MEND MACRO &lab _UpdateDialog &lab ldx #$2515 jsl $E10000 MEND ; File: M16.Event ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _EMBootInit &lab ldx #$0106 jsl $E10000 MEND MACRO &lab _EMStartUp &lab ldx #$0206 jsl $E10000 MEND MACRO &lab _EMShutDown &lab ldx #$0306 jsl $E10000 MEND MACRO &lab _EMVersion &lab ldx #$0406 jsl $E10000 MEND MACRO &lab _EMReset &lab ldx #$0506 jsl $E10000 MEND MACRO &lab _EMStatus &lab ldx #$0606 jsl $E10000 MEND MACRO &lab _Button &lab ldx #$0D06 jsl $E10000 MEND MACRO &lab _DoWindows &lab ldx #$0906 jsl $E10000 MEND MACRO &lab _EventAvail &lab ldx #$0B06 jsl $E10000 MEND MACRO &lab _FakeMouse &lab ldx #$1906 jsl $E10000 MEND MACRO &lab _FlushEvents &lab ldx #$1506 jsl $E10000 MEND MACRO &lab _GetCaretTime &lab ldx #$1206 jsl $E10000 MEND MACRO &lab _GetDblTime &lab ldx #$1106 jsl $E10000 MEND MACRO &lab _GetMouse &lab ldx #$0C06 jsl $E10000 MEND MACRO &lab _GetNextEvent &lab ldx #$0A06 jsl $E10000 MEND MACRO &lab _GetOSEvent &lab ldx #$1606 jsl $E10000 MEND MACRO &lab _OSEventAvail &lab ldx #$1706 jsl $E10000 MEND MACRO &lab _PostEvent &lab ldx #$1406 jsl $E10000 MEND MACRO &lab _SetEventMask &lab ldx #$1806 jsl $E10000 MEND MACRO &lab _SetSwitch &lab ldx #$1306 jsl $E10000 MEND MACRO &lab _StillDown &lab ldx #$0E06 jsl $E10000 MEND MACRO &lab _WaitMouseUp &lab ldx #$0F06 jsl $E10000 MEND MACRO &lab _TickCount &lab ldx #$1006 jsl $E10000 MEND MACRO &lab _GetKeyTranslation &lab ldx #$1B06 jsl $E10000 MEND MACRO &lab _SetKeyTranslation &lab ldx #$1C06 jsl $E10000 MEND MACRO &lab _SetAutoKeyLimit &lab ldx #$1A06 jsl $E10000 MEND ; File: M16.Font ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _FMBootInit &lab ldx #$011B jsl $E10000 MEND MACRO &lab _FMStartUp &lab ldx #$021B jsl $E10000 MEND MACRO &lab _FMShutDown &lab ldx #$031B jsl $E10000 MEND MACRO &lab _FMVersion &lab ldx #$041B jsl $E10000 MEND MACRO &lab _FMReset &lab ldx #$051B jsl $E10000 MEND MACRO &lab _FMStatus &lab ldx #$061B jsl $E10000 MEND MACRO &lab _AddFamily &lab ldx #$0D1B jsl $E10000 MEND MACRO &lab _AddFontVar &lab ldx #$141B jsl $E10000 MEND MACRO &lab _ChooseFont &lab ldx #$161B jsl $E10000 MEND MACRO &lab _CountFamilies &lab ldx #$091B jsl $E10000 MEND MACRO &lab _CountFonts &lab ldx #$101B jsl $E10000 MEND MACRO &lab _FamNum2ItemID &lab ldx #$1B1B jsl $E10000 MEND MACRO &lab _FindFamily &lab ldx #$0A1B jsl $E10000 MEND MACRO &lab _FindFontStats &lab ldx #$111B jsl $E10000 MEND MACRO &lab _FixFontMenu &lab ldx #$151B jsl $E10000 MEND MACRO &lab _FMGetCurFID &lab ldx #$1A1B jsl $E10000 MEND MACRO &lab _FMGetSysFID &lab ldx #$191B jsl $E10000 MEND MACRO &lab _FMSetSysFont &lab ldx #$181B jsl $E10000 MEND MACRO &lab _GetFamInfo &lab ldx #$0B1B jsl $E10000 MEND MACRO &lab _GetFamNum &lab ldx #$0C1B jsl $E10000 MEND MACRO &lab _InstallFont &lab ldx #$0E1B jsl $E10000 MEND MACRO &lab _InstallWithStats &lab ldx #$1C1B jsl $E10000 MEND MACRO &lab _ItemID2FamNum &lab ldx #$171B jsl $E10000 MEND MACRO &lab _LoadFont &lab ldx #$121B jsl $E10000 MEND MACRO &lab _LoadSysFont &lab ldx #$131B jsl $E10000 MEND MACRO &lab _SetPurgeStat &lab ldx #$0F1B jsl $E10000 MEND ; File: M16.IntMath ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _IMBootInit &lab ldx #$010B jsl $E10000 MEND MACRO &lab _IMStartUp &lab ldx #$020B jsl $E10000 MEND MACRO &lab _IMShutDown &lab ldx #$030B jsl $E10000 MEND MACRO &lab _IMVersion &lab ldx #$040B jsl $E10000 MEND MACRO &lab _IMReset &lab ldx #$050B jsl $E10000 MEND MACRO &lab _IMStatus &lab ldx #$060B jsl $E10000 MEND MACRO &lab _Dec2Int &lab ldx #$280B jsl $E10000 MEND MACRO &lab _Dec2Long &lab ldx #$290B jsl $E10000 MEND MACRO &lab _Fix2Frac &lab ldx #$1C0B jsl $E10000 MEND MACRO &lab _Fix2Long &lab ldx #$1B0B jsl $E10000 MEND MACRO &lab _Fix2X &lab ldx #$1E0B jsl $E10000 MEND MACRO &lab _FixATan2 &lab ldx #$170B jsl $E10000 MEND MACRO &lab _FixDiv &lab ldx #$110B jsl $E10000 MEND MACRO &lab _FixMul &lab ldx #$0F0B jsl $E10000 MEND MACRO &lab _FixRatio &lab ldx #$0E0B jsl $E10000 MEND MACRO &lab _FixRound &lab ldx #$130B jsl $E10000 MEND MACRO &lab _Frac2Fix &lab ldx #$1D0B jsl $E10000 MEND MACRO &lab _Frac2X &lab ldx #$1F0B jsl $E10000 MEND MACRO &lab _FracCos &lab ldx #$150B jsl $E10000 MEND MACRO &lab _FracDiv &lab ldx #$120B jsl $E10000 MEND MACRO &lab _FracMul &lab ldx #$100B jsl $E10000 MEND MACRO &lab _FracSin &lab ldx #$160B jsl $E10000 MEND MACRO &lab _FracSqrt &lab ldx #$140B jsl $E10000 MEND MACRO &lab _Hex2Int &lab ldx #$240B jsl $E10000 MEND MACRO &lab _Hex2Long &lab ldx #$250B jsl $E10000 MEND MACRO &lab _HexIt &lab ldx #$2A0B jsl $E10000 MEND MACRO &lab _HiWord &lab ldx #$180B jsl $E10000 MEND MACRO &lab _Int2Dec &lab ldx #$260B jsl $E10000 MEND MACRO &lab _Int2Hex &lab ldx #$220B jsl $E10000 MEND MACRO &lab _Long2Dec &lab ldx #$270B jsl $E10000 MEND MACRO &lab _Long2Fix &lab ldx #$1A0B jsl $E10000 MEND MACRO &lab _Long2Hex &lab ldx #$230B jsl $E10000 MEND MACRO &lab _LongDivide &lab ldx #$0D0B jsl $E10000 MEND MACRO &lab _LongMul &lab ldx #$0C0B jsl $E10000 MEND MACRO &lab _LoWord &lab ldx #$190B jsl $E10000 MEND MACRO &lab _Multiply &lab ldx #$090B jsl $E10000 MEND MACRO &lab _SDivide &lab ldx #$0A0B jsl $E10000 MEND MACRO &lab _UDivide &lab ldx #$0B0B jsl $E10000 MEND MACRO &lab _X2Fix &lab ldx #$200B jsl $E10000 MEND MACRO &lab _X2Frac &lab ldx #$210B jsl $E10000 MEND ; File: M16.LineEdit ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _LEBootInit &lab ldx #$0114 jsl $E10000 MEND MACRO &lab _LEStartUp &lab ldx #$0214 jsl $E10000 MEND MACRO &lab _LEShutDown &lab ldx #$0314 jsl $E10000 MEND MACRO &lab _LEVersion &lab ldx #$0414 jsl $E10000 MEND MACRO &lab _LEReset &lab ldx #$0514 jsl $E10000 MEND MACRO &lab _LEStatus &lab ldx #$0614 jsl $E10000 MEND MACRO &lab _LEActivate &lab ldx #$0F14 jsl $E10000 MEND MACRO &lab _LEClick &lab ldx #$0D14 jsl $E10000 MEND MACRO &lab _LECopy &lab ldx #$1314 jsl $E10000 MEND MACRO &lab _LECut &lab ldx #$1214 jsl $E10000 MEND MACRO &lab _LEDeactivate &lab ldx #$1014 jsl $E10000 MEND MACRO &lab _LEDelete &lab ldx #$1514 jsl $E10000 MEND MACRO &lab _LEDispose &lab ldx #$0A14 jsl $E10000 MEND MACRO &lab _LEFromScrap &lab ldx #$1914 jsl $E10000 MEND MACRO &lab _LEGetScrapLen &lab ldx #$1C14 jsl $E10000 MEND MACRO &lab _LEGetTextHand &lab ldx #$2214 jsl $E10000 MEND MACRO &lab _LEGetTextLen &lab ldx #$2314 jsl $E10000 MEND MACRO &lab _LEIdle &lab ldx #$0C14 jsl $E10000 MEND MACRO &lab _LEInsert &lab ldx #$1614 jsl $E10000 MEND MACRO &lab _LEKey &lab ldx #$1114 jsl $E10000 MEND MACRO &lab _LENew &lab ldx #$0914 jsl $E10000 MEND MACRO &lab _LEPaste &lab ldx #$1414 jsl $E10000 MEND MACRO &lab _LEScrapHandle &lab ldx #$1B14 jsl $E10000 MEND MACRO &lab _LESetCaret &lab ldx #$1F14 jsl $E10000 MEND MACRO &lab _LESetHilite &lab ldx #$1E14 jsl $E10000 MEND MACRO &lab _LESetJust &lab ldx #$2114 jsl $E10000 MEND MACRO &lab _LESetScrapLen &lab ldx #$1D14 jsl $E10000 MEND MACRO &lab _LESetSelect &lab ldx #$0E14 jsl $E10000 MEND MACRO &lab _LESetText &lab ldx #$0B14 jsl $E10000 MEND MACRO &lab _LETextBox &lab ldx #$1814 jsl $E10000 MEND MACRO &lab _LETextBox2 &lab ldx #$2014 jsl $E10000 MEND MACRO &lab _LEToScrap &lab ldx #$1A14 jsl $E10000 MEND MACRO &lab _LEUpdate &lab ldx #$1714 jsl $E10000 MEND MACRO &lab _GetLEDefProc &lab ldx #$2414 jsl $E10000 MEND ; File: M16.List ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _ListBootInit &lab ldx #$011C jsl $E10000 MEND MACRO &lab _ListStartup &lab ldx #$021C jsl $E10000 MEND MACRO &lab _ListShutDown &lab ldx #$031C jsl $E10000 MEND MACRO &lab _ListVersion &lab ldx #$041C jsl $E10000 MEND MACRO &lab _ListReset &lab ldx #$051C jsl $E10000 MEND MACRO &lab _ListStatus &lab ldx #$061C jsl $E10000 MEND MACRO &lab _CreateList &lab ldx #$091C jsl $E10000 MEND MACRO &lab _DrawMember &lab ldx #$0C1C jsl $E10000 MEND MACRO &lab _GetListDefProc &lab ldx #$0E1C jsl $E10000 MEND MACRO &lab _NewList &lab ldx #$101C jsl $E10000 MEND MACRO &lab _NextMember &lab ldx #$0B1C jsl $E10000 MEND MACRO &lab _ResetMember &lab ldx #$0F1C jsl $E10000 MEND MACRO &lab _SelectMember &lab ldx #$0D1C jsl $E10000 MEND MACRO &lab _SortList &lab ldx #$0A1C jsl $E10000 MEND MACRO &lab _DrawMember2 &lab ldx #$111C jsl $E10000 MEND MACRO &lab _NextMember2 &lab ldx #$121C jsl $E10000 MEND MACRO &lab _ResetMember2 &lab ldx #$131C jsl $E10000 MEND MACRO &lab _SelectMember2 &lab ldx #$141C jsl $E10000 MEND MACRO &lab _SortList2 &lab ldx #$151C jsl $E10000 MEND MACRO &lab _NewList2 &lab ldx #$161C jsl $E10000 MEND ; File: M16.Loader ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _LoaderInitialization &lab ldx #$0111 jsl $E10000 MEND MACRO &lab _LoaderStartUp &lab ldx #$0211 jsl $E10000 MEND MACRO &lab _LoaderShutDown &lab ldx #$0311 jsl $E10000 MEND MACRO &lab _LoaderVersion &lab ldx #$0411 jsl $E10000 MEND MACRO &lab _LoaderReset &lab ldx #$0511 jsl $E10000 MEND MACRO &lab _LoaderStatus &lab ldx #$0611 jsl $E10000 MEND MACRO &lab _GetLoadSegInfo &lab ldx #$0F11 jsl $E10000 MEND MACRO &lab _GetUserID &lab ldx #$1011 jsl $E10000 MEND MACRO &lab _GetUserID2 &lab ldx #$2111 jsl $E10000 MEND MACRO &lab _InitialLoad &lab ldx #$0911 jsl $E10000 MEND MACRO &lab _InitialLoad2 &lab ldx #$2011 jsl $E10000 MEND MACRO &lab _LGetPathname &lab ldx #$1111 jsl $E10000 MEND MACRO &lab _LGetPathname2 &lab ldx #$2211 jsl $E10000 MEND MACRO &lab _GetPathname &lab ldx #$1111 jsl $E10000 MEND MACRO &lab _GetPathname2 &lab ldx #$2211 jsl $E10000 MEND MACRO &lab _RenamePathname &lab ldx #$1311 jsl $E10000 MEND MACRO &lab _LoadSegName &lab ldx #$0D11 jsl $E10000 MEND MACRO &lab _LoadSegNum &lab ldx #$0B11 jsl $E10000 MEND MACRO &lab _Restart &lab ldx #$0A11 jsl $E10000 MEND MACRO &lab _UnloadSeg &lab ldx #$0E11 jsl $E10000 MEND MACRO &lab _UnloadSegNum &lab ldx #$0C11 jsl $E10000 MEND MACRO &lab _UserShutDown &lab ldx #$1211 jsl $E10000 MEND ; File: M16.Locator ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _TLBootInit &lab ldx #$0101 jsl $E10000 MEND MACRO &lab _TLStartUp &lab ldx #$0201 jsl $E10000 MEND MACRO &lab _TLShutDown &lab ldx #$0301 jsl $E10000 MEND MACRO &lab _TLVersion &lab ldx #$0401 jsl $E10000 MEND MACRO &lab _TLReset &lab ldx #$0501 jsl $E10000 MEND MACRO &lab _TLStatus &lab ldx #$0601 jsl $E10000 MEND MACRO &lab _GetFuncPtr &lab ldx #$0B01 jsl $E10000 MEND MACRO &lab _GetTSPtr &lab ldx #$0901 jsl $E10000 MEND MACRO &lab _GetWAP &lab ldx #$0C01 jsl $E10000 MEND MACRO &lab _LoadOneTool &lab ldx #$0F01 jsl $E10000 MEND MACRO &lab _LoadTools &lab ldx #$0E01 jsl $E10000 MEND MACRO &lab _MessageCenter &lab ldx #$1501 jsl $E10000 MEND MACRO &lab _RestoreTextState &lab ldx #$1401 jsl $E10000 MEND MACRO &lab _SaveTextState &lab ldx #$1301 jsl $E10000 MEND MACRO &lab _SetDefaultTPT &lab ldx #$1601 jsl $E10000 MEND MACRO &lab _SetTSPtr &lab ldx #$0A01 jsl $E10000 MEND MACRO &lab _SetWAP &lab ldx #$0D01 jsl $E10000 MEND MACRO &lab _TLMountVolume &lab ldx #$1101 jsl $E10000 MEND MACRO &lab _TLTextMountVolume &lab ldx #$1201 jsl $E10000 MEND MACRO &lab _UnloadOneTool &lab ldx #$1001 jsl $E10000 MEND MACRO &lab _StartUpTools &lab ldx #$1801 jsl $E10000 MEND MACRO &lab _ShutDownTools &lab ldx #$1901 jsl $E10000 MEND MACRO &lab _MessageByName &lab ldx #$1701 jsl $E10000 MEND ; File: M16.Memory ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _MMBootInit &lab ldx #$0102 jsl $E10000 MEND MACRO &lab _MMStartUp &lab ldx #$0202 jsl $E10000 MEND MACRO &lab _MMShutDown &lab ldx #$0302 jsl $E10000 MEND MACRO &lab _MMVersion &lab ldx #$0402 jsl $E10000 MEND MACRO &lab _MMReset &lab ldx #$0502 jsl $E10000 MEND MACRO &lab _MMStatus &lab ldx #$0602 jsl $E10000 MEND MACRO &lab _BlockMove &lab ldx #$2B02 jsl $E10000 MEND MACRO &lab _CheckHandle &lab ldx #$1E02 jsl $E10000 MEND MACRO &lab _CompactMem &lab ldx #$1F02 jsl $E10000 MEND MACRO &lab _DisposeAll &lab ldx #$1102 jsl $E10000 MEND MACRO &lab _DisposeHandle &lab ; DEBUG DEBUG DEBUG DEBUG DEBUG DEBUG IMPORT D_DisposeHandle jsl >D_DisposeHandle ; ldx #$1002 ; jsl $E10000 MEND MACRO &lab _FindHandle &lab ldx #$1A02 jsl $E10000 MEND MACRO &lab _FreeMem &lab ldx #$1B02 jsl $E10000 MEND MACRO &lab _GetHandleSize &lab ldx #$1802 jsl $E10000 MEND MACRO &lab _HandToHand &lab ldx #$2A02 jsl $E10000 MEND MACRO &lab _HandToPtr &lab ldx #$2902 jsl $E10000 MEND MACRO &lab _HLock &lab ldx #$2002 jsl $E10000 MEND MACRO &lab _HLockAll &lab ldx #$2102 jsl $E10000 MEND MACRO &lab _HUnlock &lab ldx #$2202 jsl $E10000 MEND MACRO &lab _HUnlockAll &lab ldx #$2302 jsl $E10000 MEND MACRO &lab _MaxBlock &lab ldx #$1C02 jsl $E10000 MEND MACRO &lab _NewHandle &lab ldx #$0902 jsl $E10000 MEND MACRO &lab _PtrToHand &lab ldx #$2802 jsl $E10000 MEND MACRO &lab _PurgeAll &lab ldx #$1302 jsl $E10000 MEND MACRO &lab _PurgeHandle &lab ldx #$1202 jsl $E10000 MEND MACRO &lab _RealFreeMem &lab ldx #$2F02 jsl $E10000 MEND MACRO &lab _ReallocHandle &lab ldx #$0A02 jsl $E10000 MEND MACRO &lab _RestoreHandle &lab ldx #$0B02 jsl $E10000 MEND MACRO &lab _SetHandleSize &lab ldx #$1902 jsl $E10000 MEND MACRO &lab _SetPurge &lab ldx #$2402 jsl $E10000 MEND MACRO &lab _SetPurgeAll &lab ldx #$2502 jsl $E10000 MEND MACRO &lab _TotalMem &lab ldx #$1D02 jsl $E10000 MEND MACRO &lab _AddToOOMQueue &lab ldx #$0C02 jsl $E10000 MEND MACRO &lab _DeleteFromOOMQueue &lab ldx #$0D02 jsl $E10000 MEND ; File: M16.Menu ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _MenuBootInit &lab ldx #$010F jsl $E10000 MEND MACRO &lab _MenuStartUp &lab ldx #$020F jsl $E10000 MEND MACRO &lab _MenuShutDown &lab ldx #$030F jsl $E10000 MEND MACRO &lab _MenuVersion &lab ldx #$040F jsl $E10000 MEND MACRO &lab _MenuReset &lab ldx #$050F jsl $E10000 MEND MACRO &lab _MenuStatus &lab ldx #$060F jsl $E10000 MEND MACRO &lab _CalcMenuSize &lab ldx #$1C0F jsl $E10000 MEND MACRO &lab _CheckMItem &lab ldx #$320F jsl $E10000 MEND MACRO &lab _CountMItems &lab ldx #$140F jsl $E10000 MEND MACRO &lab _DeleteMenu &lab ldx #$0E0F jsl $E10000 MEND MACRO &lab _DeleteMItem &lab ldx #$100F jsl $E10000 MEND MACRO &lab _DisableMItem &lab ldx #$310F jsl $E10000 MEND MACRO &lab _DisposeMenu &lab ldx #$2E0F jsl $E10000 MEND MACRO &lab _DrawMenuBar &lab ldx #$2A0F jsl $E10000 MEND MACRO &lab _EnableMItem &lab ldx #$300F jsl $E10000 MEND MACRO &lab _FixMenuBar &lab ldx #$130F jsl $E10000 MEND MACRO &lab _FlashMenuBar &lab ldx #$0C0F jsl $E10000 MEND MACRO &lab _GetBarColors &lab ldx #$180F jsl $E10000 MEND MACRO &lab _GetMenuBar &lab ldx #$0A0F jsl $E10000 MEND MACRO &lab _GetMenuFlag &lab ldx #$200F jsl $E10000 MEND MACRO &lab _GetMenuMgrPort &lab ldx #$1B0F jsl $E10000 MEND MACRO &lab _GetMenuTitle &lab ldx #$220F jsl $E10000 MEND MACRO &lab _GetMHandle &lab ldx #$160F jsl $E10000 MEND MACRO &lab _GetMItem &lab ldx #$250F jsl $E10000 MEND MACRO &lab _GetMItemFlag &lab ldx #$270F jsl $E10000 MEND MACRO &lab _GetMItemMark &lab ldx #$340F jsl $E10000 MEND MACRO &lab _GetMItemStyle &lab ldx #$360F jsl $E10000 MEND MACRO &lab _GetMTitleStart &lab ldx #$1A0F jsl $E10000 MEND MACRO &lab _GetMTitleWidth &lab ldx #$1E0F jsl $E10000 MEND MACRO &lab _GetSysBar &lab ldx #$110F jsl $E10000 MEND MACRO &lab _HiliteMenu &lab ldx #$2C0F jsl $E10000 MEND MACRO &lab _InitPalette &lab ldx #$2F0F jsl $E10000 MEND MACRO &lab _InsertMenu &lab ldx #$0D0F jsl $E10000 MEND MACRO &lab _InsertMItem &lab ldx #$0F0F jsl $E10000 MEND MACRO &lab _MenuGlobal &lab ldx #$230F jsl $E10000 MEND MACRO &lab _MenuKey &lab ldx #$090F jsl $E10000 MEND MACRO &lab _MenuNewRes &lab ldx #$290F jsl $E10000 MEND MACRO &lab _MenuRefresh &lab ldx #$0B0F jsl $E10000 MEND MACRO &lab _MenuSelect &lab ldx #$2B0F jsl $E10000 MEND MACRO &lab _NewMenu &lab ldx #$2D0F jsl $E10000 MEND MACRO &lab _NewMenuBar &lab ldx #$150F jsl $E10000 MEND MACRO &lab _SetBarColors &lab ldx #$170F jsl $E10000 MEND MACRO &lab _SetMenuBar &lab ldx #$390F jsl $E10000 MEND MACRO &lab _SetMenuFlag &lab ldx #$1F0F jsl $E10000 MEND MACRO &lab _SetMenuID &lab ldx #$370F jsl $E10000 MEND MACRO &lab _SetMenuTitle &lab ldx #$210F jsl $E10000 MEND MACRO &lab _SetMItem &lab ldx #$240F jsl $E10000 MEND MACRO &lab _SetMItemBlink &lab ldx #$280F jsl $E10000 MEND MACRO &lab _SetMItemFlag &lab ldx #$260F jsl $E10000 MEND MACRO &lab _SetMItemID &lab ldx #$380F jsl $E10000 MEND MACRO &lab _SetMItemMark &lab ldx #$330F jsl $E10000 MEND MACRO &lab _SetMItemName &lab ldx #$3A0F jsl $E10000 MEND MACRO &lab _SetMItemStyle &lab ldx #$350F jsl $E10000 MEND MACRO &lab _SetMTitleStart &lab ldx #$190F jsl $E10000 MEND MACRO &lab _SetMTitleWidth &lab ldx #$1D0F jsl $E10000 MEND MACRO &lab _SetSysBar &lab ldx #$120F jsl $E10000 MEND MACRO &lab _PopUpMenuSelect &lab ldx #$3C0F jsl $E10000 MEND MACRO &lab _GetPopUpDefProc &lab ldx #$3B0F jsl $E10000 MEND MACRO &lab _DrawPopUp &lab ldx #$3D0F jsl $E10000 MEND MACRO &lab _NewMenuBar2 &lab ldx #$430F jsl $E10000 MEND MACRO &lab _NewMenu2 &lab ldx #$3E0F jsl $E10000 MEND MACRO &lab _InsertMItem2 &lab ldx #$3F0F jsl $E10000 MEND MACRO &lab _SetMenuTitle2 &lab ldx #$400F jsl $E10000 MEND MACRO &lab _SetMItem2 &lab ldx #$410F jsl $E10000 MEND MACRO &lab _SetMItemName2 &lab ldx #$420F jsl $E10000 MEND MACRO &lab _HideMenuBar &lab ldx #$450F jsl $E10000 MEND MACRO &lab _ShowMenuBar &lab ldx #$460F jsl $E10000 MEND ; File: M16.Midi ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _MidiBootInit &lab ldx #$0120 jsl $E10000 MEND MACRO &lab _MidiStartUp &lab ldx #$0220 jsl $E10000 MEND MACRO &lab _MidiShutDown &lab ldx #$0320 jsl $E10000 MEND MACRO &lab _MidiVersion &lab ldx #$0420 jsl $E10000 MEND MACRO &lab _MidiReset &lab ldx #$0520 jsl $E10000 MEND MACRO &lab _MidiStatus &lab ldx #$0620 jsl $E10000 MEND MACRO &lab _MidiClock &lab ldx #$0B20 jsl $E10000 MEND MACRO &lab _MidiControl &lab ldx #$0920 jsl $E10000 MEND MACRO &lab _MidiDevice &lab ldx #$0A20 jsl $E10000 MEND MACRO &lab _MidiInfo &lab ldx #$0C20 jsl $E10000 MEND MACRO &lab _MidiInputPoll &lab jsl #$E11DD8 MEND MACRO &lab _MidiReadPacket &lab ldx #$0D20 jsl $E10000 MEND MACRO &lab _MidiWritePacket &lab ldx #$0E20 jsl $E10000 MEND ; File: M16.MiscTool ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _MTBootInit &lab ldx #$0103 jsl $E10000 MEND MACRO &lab _MTStartUp &lab ldx #$0203 jsl $E10000 MEND MACRO &lab _MTShutDown &lab ldx #$0303 jsl $E10000 MEND MACRO &lab _MTVersion &lab ldx #$0403 jsl $E10000 MEND MACRO &lab _MTReset &lab ldx #$0503 jsl $E10000 MEND MACRO &lab _MTStatus &lab ldx #$0603 jsl $E10000 MEND MACRO &lab _ClampMouse &lab ldx #$1C03 jsl $E10000 MEND MACRO &lab _ClearMouse &lab ldx #$1B03 jsl $E10000 MEND MACRO &lab _ClrHeartBeat &lab ldx #$1403 jsl $E10000 MEND MACRO &lab _DeleteID &lab ldx #$2103 jsl $E10000 MEND MACRO &lab _DelHeartBeat &lab ldx #$1303 jsl $E10000 MEND MACRO &lab _FWEntry &lab ldx #$2403 jsl $E10000 MEND MACRO &lab _GetAbsClamp &lab ldx #$2B03 jsl $E10000 MEND MACRO &lab _GetAddr &lab ldx #$1603 jsl $E10000 MEND MACRO &lab _GetIRQEnable &lab ldx #$2903 jsl $E10000 MEND MACRO &lab _GetMouseClamp &lab ldx #$1D03 jsl $E10000 MEND MACRO &lab _GetNewID &lab ldx #$2003 jsl $E10000 MEND MACRO &lab _GetTick &lab ldx #$2503 jsl $E10000 MEND MACRO &lab _GetVector &lab ldx #$1103 jsl $E10000 MEND MACRO &lab _HomeMouse &lab ldx #$1A03 jsl $E10000 MEND MACRO &lab _InitMouse &lab ldx #$1803 jsl $E10000 MEND MACRO &lab _IntSource &lab ldx #$2303 jsl $E10000 MEND MACRO &lab _Munger &lab ldx #$2803 jsl $E10000 MEND MACRO &lab _PackBytes &lab ldx #$2603 jsl $E10000 MEND MACRO &lab _PosMouse &lab ldx #$1E03 jsl $E10000 MEND MACRO &lab _ReadAsciiTime &lab ldx #$0F03 jsl $E10000 MEND MACRO &lab _ReadBParam &lab ldx #$0C03 jsl $E10000 MEND MACRO &lab _ReadBRam &lab ldx #$0A03 jsl $E10000 MEND MACRO &lab _ReadMouse &lab ldx #$1703 jsl $E10000 MEND MACRO &lab _ReadTimeHex &lab ldx #$0D03 jsl $E10000 MEND MACRO &lab _ServeMouse &lab ldx #$1F03 jsl $E10000 MEND MACRO &lab _SetAbsClamp &lab ldx #$2A03 jsl $E10000 MEND MACRO &lab _SetHeartBeat &lab ldx #$1203 jsl $E10000 MEND MACRO &lab _SetMouse &lab ldx #$1903 jsl $E10000 MEND MACRO &lab _SetVector &lab ldx #$1003 jsl $E10000 MEND MACRO &lab _StatusID &lab ldx #$2203 jsl $E10000 MEND MACRO &lab _SysBeep &lab ldx #$2C03 jsl $E10000 MEND MACRO &lab _SysFailMgr &lab ldx #$1503 jsl $E10000 MEND MACRO &lab _UnPackBytes &lab ldx #$2703 jsl $E10000 MEND MACRO &lab _WriteBParam &lab ldx #$0B03 jsl $E10000 MEND MACRO &lab _WriteBRam &lab ldx #$0903 jsl $E10000 MEND MACRO &lab _WriteTimeHex &lab ldx #$0E03 jsl $E10000 MEND MACRO &lab _AddToQueue &lab ldx #$2E03 jsl $E10000 MEND MACRO &lab _DeleteFromQueue &lab ldx #$2F03 jsl $E10000 MEND MACRO &lab _SetInterruptState &lab ldx #$3003 jsl $E10000 MEND MACRO &lab _GetInterruptState &lab ldx #$3103 jsl $E10000 MEND MACRO &lab _GetIntStateRecSize &lab ldx #$3203 jsl $E10000 MEND MACRO &lab _ReadMouse2 &lab ldx #$3303 jsl $E10000 MEND MACRO &lab _GetCodeResConverter &lab ldx #$3403 jsl $E10000 MEND MACRO &lab _GetRomResource &lab ldx #$3503 jsl $E10000 MEND ; File: M16.NoteSeq ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _SeqBootInit &lab ldx #$011A jsl $E10000 MEND MACRO &lab _SeqStartUp &lab ldx #$021A jsl $E10000 MEND MACRO &lab _SeqShutDown &lab ldx #$031A jsl $E10000 MEND MACRO &lab _SeqVersion &lab ldx #$041A jsl $E10000 MEND MACRO &lab _SeqReset &lab ldx #$051A jsl $E10000 MEND MACRO &lab _SeqStatus &lab ldx #$061A jsl $E10000 MEND MACRO &lab _SeqAllNotesOff &lab ldx #$0D1A jsl $E10000 MEND MACRO &lab _ClearIncr &lab ldx #$0A1A jsl $E10000 MEND MACRO &lab _GetLoc &lab ldx #$0C1A jsl $E10000 MEND MACRO &lab _GetTimer &lab ldx #$0B1A jsl $E10000 MEND MACRO &lab _SetIncr &lab ldx #$091A jsl $E10000 MEND MACRO &lab _SetInstTable &lab ldx #$121A jsl $E10000 MEND MACRO &lab _SetTrkInfo &lab ldx #$0E1A jsl $E10000 MEND MACRO &lab _StartInts &lab ldx #$131A jsl $E10000 MEND MACRO &lab _StartSeq &lab ldx #$0F1A jsl $E10000 MEND MACRO &lab _StepSeq &lab ldx #$101A jsl $E10000 MEND MACRO &lab _StopInts &lab ldx #$141A jsl $E10000 MEND MACRO &lab _StopSeq &lab ldx #$111A jsl $E10000 MEND MACRO &lab _StartSeqRel &lab ldx #$151A jsl $E10000 MEND ; File: M16.NoteSyn ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _NSBootInit &lab ldx #$0119 jsl $E10000 MEND MACRO &lab _NSStartUp &lab ldx #$0219 jsl $E10000 MEND MACRO &lab _NSShutDown &lab ldx #$0319 jsl $E10000 MEND MACRO &lab _NSVersion &lab ldx #$0419 jsl $E10000 MEND MACRO &lab _NSReset &lab ldx #$0519 jsl $E10000 MEND MACRO &lab _NSStatus &lab ldx #$0619 jsl $E10000 MEND MACRO &lab _AllNotesOff &lab ldx #$0D19 jsl $E10000 MEND MACRO &lab _AllocGen &lab ldx #$0919 jsl $E10000 MEND MACRO &lab _DeallocGen &lab ldx #$0A19 jsl $E10000 MEND MACRO &lab _NoteOff &lab ldx #$0C19 jsl $E10000 MEND MACRO &lab _NoteOn &lab ldx #$0B19 jsl $E10000 MEND MACRO &lab _NSSetUpdateRate &lab ldx #$0E19 jsl $E10000 MEND MACRO &lab _NSSetUserUpdateRtn &lab ldx #$0F19 jsl $E10000 MEND ; File: M16.Print ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _PMBootInit &lab ldx #$0113 jsl $E10000 MEND MACRO &lab _PMStartUp &lab ldx #$0213 jsl $E10000 MEND MACRO &lab _PMShutDown &lab ldx #$0313 jsl $E10000 MEND MACRO &lab _PMVersion &lab ldx #$0413 jsl $E10000 MEND MACRO &lab _PMReset &lab ldx #$0513 jsl $E10000 MEND MACRO &lab _PMStatus &lab ldx #$0613 jsl $E10000 MEND MACRO &lab _LLDBitMap &lab ldx #$1C13 jsl $E10000 MEND MACRO &lab _LLDControl &lab ldx #$1B13 jsl $E10000 MEND MACRO &lab _LLDShutDown &lab ldx #$1A13 jsl $E10000 MEND MACRO &lab _LLDStartUp &lab ldx #$1913 jsl $E10000 MEND MACRO &lab _LLDText &lab ldx #$1D13 jsl $E10000 MEND MACRO &lab _PMLoadDriver &lab ldx #$3513 jsl $E10000 MEND MACRO &lab _PMUnloadDriver &lab ldx #$3413 jsl $E10000 MEND MACRO &lab _PrChoosePrinter &lab ldx #$1613 jsl $E10000 MEND MACRO &lab _PrChooser &lab ldx #$1613 jsl $E10000 MEND MACRO &lab _PrCloseDoc &lab ldx #$0F13 jsl $E10000 MEND MACRO &lab _PrClosePage &lab ldx #$1113 jsl $E10000 MEND MACRO &lab _PrDefault &lab ldx #$0913 jsl $E10000 MEND MACRO &lab _PrDriverVer &lab ldx #$2313 jsl $E10000 MEND MACRO &lab _PrError &lab ldx #$1413 jsl $E10000 MEND MACRO &lab _PrJobDialog &lab ldx #$0C13 jsl $E10000 MEND MACRO &lab _PrOpenDoc &lab ldx #$0E13 jsl $E10000 MEND MACRO &lab _PrOpenPage &lab ldx #$1013 jsl $E10000 MEND MACRO &lab _PrPicFile &lab ldx #$1213 jsl $E10000 MEND MACRO &lab _PrPixelMap &lab ldx #$0D13 jsl $E10000 MEND MACRO &lab _PrPortVer &lab ldx #$2413 jsl $E10000 MEND MACRO &lab _PrSetError &lab ldx #$1513 jsl $E10000 MEND MACRO &lab _PrStlDialog &lab ldx #$0B13 jsl $E10000 MEND MACRO &lab _PrValidate &lab ldx #$0A13 jsl $E10000 MEND MACRO &lab _PrSetDocName &lab ldx #$3713 jsl $E10000 MEND MACRO &lab _PrGetDocName &lab ldx #$3613 jsl $E10000 MEND MACRO &lab _PrGetPgOrientation &lab ldx #$3813 jsl $E10000 MEND MACRO &lab _PrGetPrinterSpecs &lab ldx #$1813 jsl $E10000 MEND MACRO &lab _PrGetZoneName &lab ldx #$2513 jsl $E10000 MEND MACRO &lab _PrGetPrinterDvrName &lab ldx #$2813 jsl $E10000 MEND MACRO &lab _PrGetPortDvrName &lab ldx #$2913 jsl $E10000 MEND MACRO &lab _PrGetUserName &lab ldx #$2A13 jsl $E10000 MEND MACRO &lab _PrGetNetworkName &lab ldx #$2B13 jsl $E10000 MEND ; File: M16.QDAux ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _QDAuxBootInit &lab ldx #$0112 jsl $E10000 MEND MACRO &lab _QDAuxStartUp &lab ldx #$0212 jsl $E10000 MEND MACRO &lab _QDAuxShutDown &lab ldx #$0312 jsl $E10000 MEND MACRO &lab _QDAuxVersion &lab ldx #$0412 jsl $E10000 MEND MACRO &lab _QDAuxReset &lab ldx #$0512 jsl $E10000 MEND MACRO &lab _QDAuxStatus &lab ldx #$0612 jsl $E10000 MEND MACRO &lab _CopyPixels &lab ldx #$0912 jsl $E10000 MEND MACRO &lab _DrawIcon &lab ldx #$0B12 jsl $E10000 MEND MACRO &lab _SpecialRect &lab ldx #$0C12 jsl $E10000 MEND MACRO &lab _WaitCursor &lab ldx #$0A12 jsl $E10000 MEND MACRO &lab _SeedFill &lab ldx #$0D12 jsl $E10000 MEND MACRO &lab _CalcMask &lab ldx #$0E12 jsl $E10000 MEND MACRO &lab _PicComment &lab ldx #$B804 jsl $E10000 MEND MACRO &lab _ClosePicture &lab ldx #$B904 jsl $E10000 MEND MACRO &lab _DrawPicture &lab ldx #$BA04 jsl $E10000 MEND MACRO &lab _KillPicture &lab ldx #$BB04 jsl $E10000 MEND MACRO &lab _OpenPicture &lab ldx #$B704 jsl $E10000 MEND ; File: M16.Quickdraw ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _QDBootInit &lab ldx #$0104 jsl $E10000 MEND MACRO &lab _QDStartUp &lab ldx #$0204 jsl $E10000 MEND MACRO &lab _QDShutDown &lab ldx #$0304 jsl $E10000 MEND MACRO &lab _QDVersion &lab ldx #$0404 jsl $E10000 MEND MACRO &lab _QDReset &lab ldx #$0504 jsl $E10000 MEND MACRO &lab _QDStatus &lab ldx #$0604 jsl $E10000 MEND MACRO &lab _AddPt &lab ldx #$8004 jsl $E10000 MEND MACRO &lab _CharBounds &lab ldx #$AC04 jsl $E10000 MEND MACRO &lab _CharWidth &lab ldx #$A804 jsl $E10000 MEND MACRO &lab _ClearScreen &lab ldx #$1504 jsl $E10000 MEND MACRO &lab _ClipRect &lab ldx #$2604 jsl $E10000 MEND MACRO &lab _ClosePoly &lab ldx #$C204 jsl $E10000 MEND MACRO &lab _ClosePort &lab ldx #$1A04 jsl $E10000 MEND MACRO &lab _CloseRgn &lab ldx #$6E04 jsl $E10000 MEND MACRO &lab _CopyRgn &lab ldx #$6904 jsl $E10000 MEND MACRO &lab _CStringBounds &lab ldx #$AE04 jsl $E10000 MEND MACRO &lab _CStringWidth &lab ldx #$AA04 jsl $E10000 MEND MACRO &lab _DiffRgn &lab ldx #$7304 jsl $E10000 MEND MACRO &lab _DisposeRgn &lab ldx #$6804 jsl $E10000 MEND MACRO &lab _DrawChar &lab ldx #$A404 jsl $E10000 MEND MACRO &lab _DrawCString &lab ldx #$A604 jsl $E10000 MEND MACRO &lab _DrawString &lab ldx #$A504 jsl $E10000 MEND MACRO &lab _DrawText &lab ldx #$A704 jsl $E10000 MEND MACRO &lab _NotEmptyRect &lab ldx #$5204 jsl $E10000 MEND MACRO &lab _EmptyRgn &lab ldx #$7804 jsl $E10000 MEND MACRO &lab _EqualPt &lab ldx #$8304 jsl $E10000 MEND MACRO &lab _EqualRect &lab ldx #$5104 jsl $E10000 MEND MACRO &lab _EqualRgn &lab ldx #$7704 jsl $E10000 MEND MACRO &lab _EraseArc &lab ldx #$6404 jsl $E10000 MEND MACRO &lab _EraseOval &lab ldx #$5A04 jsl $E10000 MEND MACRO &lab _ErasePoly &lab ldx #$BE04 jsl $E10000 MEND MACRO &lab _EraseRect &lab ldx #$5504 jsl $E10000 MEND MACRO &lab _EraseRgn &lab ldx #$7B04 jsl $E10000 MEND MACRO &lab _EraseRRect &lab ldx #$5F04 jsl $E10000 MEND MACRO &lab _FillArc &lab ldx #$6604 jsl $E10000 MEND MACRO &lab _FillOval &lab ldx #$5C04 jsl $E10000 MEND MACRO &lab _FillPoly &lab ldx #$C004 jsl $E10000 MEND MACRO &lab _FillRect &lab ldx #$5704 jsl $E10000 MEND MACRO &lab _FillRgn &lab ldx #$7D04 jsl $E10000 MEND MACRO &lab _FillRRect &lab ldx #$6104 jsl $E10000 MEND MACRO &lab _ForceBufDims &lab ldx #$CC04 jsl $E10000 MEND MACRO &lab _FrameArc &lab ldx #$6204 jsl $E10000 MEND MACRO &lab _FrameOval &lab ldx #$5804 jsl $E10000 MEND MACRO &lab _FramePoly &lab ldx #$BC04 jsl $E10000 MEND MACRO &lab _FrameRect &lab ldx #$5304 jsl $E10000 MEND MACRO &lab _FrameRgn &lab ldx #$7904 jsl $E10000 MEND MACRO &lab _FrameRRect &lab ldx #$5D04 jsl $E10000 MEND MACRO &lab _GetAddress &lab ldx #$0904 jsl $E10000 MEND MACRO &lab _GetArcRot &lab ldx #$B104 jsl $E10000 MEND MACRO &lab _GetBackColor &lab ldx #$A304 jsl $E10000 MEND MACRO &lab _GetBackPat &lab ldx #$3504 jsl $E10000 MEND MACRO &lab _GetCharExtra &lab ldx #$D504 jsl $E10000 MEND MACRO &lab _GetClip &lab ldx #$2504 jsl $E10000 MEND MACRO &lab _GetClipHandle &lab ldx #$C704 jsl $E10000 MEND MACRO &lab _GetColorEntry &lab ldx #$1104 jsl $E10000 MEND MACRO &lab _GetColorTable &lab ldx #$0F04 jsl $E10000 MEND MACRO &lab _GetCursorAdr &lab ldx #$8F04 jsl $E10000 MEND MACRO &lab _GetFGSize &lab ldx #$CF04 jsl $E10000 MEND MACRO &lab _GetFont &lab ldx #$9504 jsl $E10000 MEND MACRO &lab _GetFontFlags &lab ldx #$9904 jsl $E10000 MEND MACRO &lab _GetFontGlobals &lab ldx #$9704 jsl $E10000 MEND MACRO &lab _GetFontID &lab ldx #$D104 jsl $E10000 MEND MACRO &lab _GetFontInfo &lab ldx #$9604 jsl $E10000 MEND MACRO &lab _GetFontLore &lab ldx #$D904 jsl $E10000 MEND MACRO &lab _GetForeColor &lab ldx #$A104 jsl $E10000 MEND MACRO &lab _GetGrafProcs &lab ldx #$4504 jsl $E10000 MEND MACRO &lab _GetMasterSCB &lab ldx #$1704 jsl $E10000 MEND MACRO &lab _GetPen &lab ldx #$2904 jsl $E10000 MEND MACRO &lab _GetPenMask &lab ldx #$3304 jsl $E10000 MEND MACRO &lab _GetPenMode &lab ldx #$2F04 jsl $E10000 MEND MACRO &lab _GetPenPat &lab ldx #$3104 jsl $E10000 MEND MACRO &lab _GetPenSize &lab ldx #$2D04 jsl $E10000 MEND MACRO &lab _GetPenState &lab ldx #$2B04 jsl $E10000 MEND MACRO &lab _GetPicSave &lab ldx #$3F04 jsl $E10000 MEND MACRO &lab _GetPixel &lab ldx #$8804 jsl $E10000 MEND MACRO &lab _GetPolySave &lab ldx #$4304 jsl $E10000 MEND MACRO &lab _GetPort &lab ldx #$1C04 jsl $E10000 MEND MACRO &lab _GetPortLoc &lab ldx #$1E04 jsl $E10000 MEND MACRO &lab _GetPortRect &lab ldx #$2004 jsl $E10000 MEND MACRO &lab _GetRgnSave &lab ldx #$4104 jsl $E10000 MEND MACRO &lab _GetROMFont &lab ldx #$D804 jsl $E10000 MEND MACRO &lab _GetSCB &lab ldx #$1304 jsl $E10000 MEND MACRO &lab _GetSpaceExtra &lab ldx #$9F04 jsl $E10000 MEND MACRO &lab _GetStandardSCB &lab ldx #$0C04 jsl $E10000 MEND MACRO &lab _GetSysField &lab ldx #$4904 jsl $E10000 MEND MACRO &lab _GetSysFont &lab ldx #$B304 jsl $E10000 MEND MACRO &lab _GetTextFace &lab ldx #$9B04 jsl $E10000 MEND MACRO &lab _GetTextMode &lab ldx #$9D04 jsl $E10000 MEND MACRO &lab _GetTextSize &lab ldx #$D304 jsl $E10000 MEND MACRO &lab _GetUserField &lab ldx #$4704 jsl $E10000 MEND MACRO &lab _GetVisHandle &lab ldx #$C904 jsl $E10000 MEND MACRO &lab _GetVisRgn &lab ldx #$B504 jsl $E10000 MEND MACRO &lab _GlobalToLocal &lab ldx #$8504 jsl $E10000 MEND MACRO &lab _GrafOff &lab ldx #$0B04 jsl $E10000 MEND MACRO &lab _GrafOn &lab ldx #$0A04 jsl $E10000 MEND MACRO &lab _HideCursor &lab ldx #$9004 jsl $E10000 MEND MACRO &lab _HidePen &lab ldx #$2704 jsl $E10000 MEND MACRO &lab _InflateTextBuffer &lab ldx #$D704 jsl $E10000 MEND MACRO &lab _InitColorTable &lab ldx #$0D04 jsl $E10000 MEND MACRO &lab _InitCursor &lab ldx #$CA04 jsl $E10000 MEND MACRO &lab _InitPort &lab ldx #$1904 jsl $E10000 MEND MACRO &lab _InsetRect &lab ldx #$4C04 jsl $E10000 MEND MACRO &lab _InsetRgn &lab ldx #$7004 jsl $E10000 MEND MACRO &lab _InvertArc &lab ldx #$6504 jsl $E10000 MEND MACRO &lab _InvertOval &lab ldx #$5B04 jsl $E10000 MEND MACRO &lab _InvertPoly &lab ldx #$BF04 jsl $E10000 MEND MACRO &lab _InvertRect &lab ldx #$5604 jsl $E10000 MEND MACRO &lab _InvertRgn &lab ldx #$7C04 jsl $E10000 MEND MACRO &lab _InvertRRect &lab ldx #$6004 jsl $E10000 MEND MACRO &lab _KillPoly &lab ldx #$C304 jsl $E10000 MEND MACRO &lab _Line &lab ldx #$3D04 jsl $E10000 MEND MACRO &lab _LineTo &lab ldx #$3C04 jsl $E10000 MEND MACRO &lab _LocalToGlobal &lab ldx #$8404 jsl $E10000 MEND MACRO &lab _MapPoly &lab ldx #$C504 jsl $E10000 MEND MACRO &lab _MapPt &lab ldx #$8A04 jsl $E10000 MEND MACRO &lab _MapRect &lab ldx #$8B04 jsl $E10000 MEND MACRO &lab _MapRgn &lab ldx #$8C04 jsl $E10000 MEND MACRO &lab _Move &lab ldx #$3B04 jsl $E10000 MEND MACRO &lab _MovePortTo &lab ldx #$2204 jsl $E10000 MEND MACRO &lab _MoveTo &lab ldx #$3A04 jsl $E10000 MEND MACRO &lab _NewRgn &lab ldx #$6704 jsl $E10000 MEND MACRO &lab _ObscureCursor &lab ldx #$9204 jsl $E10000 MEND MACRO &lab _OffsetPoly &lab ldx #$C404 jsl $E10000 MEND MACRO &lab _OffsetRect &lab ldx #$4B04 jsl $E10000 MEND MACRO &lab _OffsetRgn &lab ldx #$6F04 jsl $E10000 MEND MACRO &lab _OpenPoly &lab ldx #$C104 jsl $E10000 MEND MACRO &lab _OpenPort &lab ldx #$1804 jsl $E10000 MEND MACRO &lab _OpenRgn &lab ldx #$6D04 jsl $E10000 MEND MACRO &lab _PaintArc &lab ldx #$6304 jsl $E10000 MEND MACRO &lab _PaintOval &lab ldx #$5904 jsl $E10000 MEND MACRO &lab _PaintPixels &lab ldx #$7F04 jsl $E10000 MEND MACRO &lab _PaintPoly &lab ldx #$BD04 jsl $E10000 MEND MACRO &lab _PaintRect &lab ldx #$5404 jsl $E10000 MEND MACRO &lab _PaintRgn &lab ldx #$7A04 jsl $E10000 MEND MACRO &lab _PaintRRect &lab ldx #$5E04 jsl $E10000 MEND MACRO &lab _PenNormal &lab ldx #$3604 jsl $E10000 MEND MACRO &lab _PPToPort &lab ldx #$D604 jsl $E10000 MEND MACRO &lab _Pt2Rect &lab ldx #$5004 jsl $E10000 MEND MACRO &lab _PtInRect &lab ldx #$4F04 jsl $E10000 MEND MACRO &lab _PtInRgn &lab ldx #$7504 jsl $E10000 MEND MACRO &lab _Random &lab ldx #$8604 jsl $E10000 MEND MACRO &lab _RectInRgn &lab ldx #$7604 jsl $E10000 MEND MACRO &lab _RectRgn &lab ldx #$6C04 jsl $E10000 MEND MACRO &lab _RestoreBufDims &lab ldx #$CE04 jsl $E10000 MEND MACRO &lab _SaveBufDims &lab ldx #$CD04 jsl $E10000 MEND MACRO &lab _ScalePt &lab ldx #$8904 jsl $E10000 MEND MACRO &lab _ScrollRect &lab ldx #$7E04 jsl $E10000 MEND MACRO &lab _SectRect &lab ldx #$4D04 jsl $E10000 MEND MACRO &lab _SectRgn &lab ldx #$7104 jsl $E10000 MEND MACRO &lab _SetAllSCBs &lab ldx #$1404 jsl $E10000 MEND MACRO &lab _SetArcRot &lab ldx #$B004 jsl $E10000 MEND MACRO &lab _SetBackColor &lab ldx #$A204 jsl $E10000 MEND MACRO &lab _SetBackPat &lab ldx #$3404 jsl $E10000 MEND MACRO &lab _SetBufDims &lab ldx #$CB04 jsl $E10000 MEND MACRO &lab _SetCharExtra &lab ldx #$D404 jsl $E10000 MEND MACRO &lab _SetClip &lab ldx #$2404 jsl $E10000 MEND MACRO &lab _SetClipHandle &lab ldx #$C604 jsl $E10000 MEND MACRO &lab _SetColorEntry &lab ldx #$1004 jsl $E10000 MEND MACRO &lab _SetColorTable &lab ldx #$0E04 jsl $E10000 MEND MACRO &lab _SetCursor &lab ldx #$8E04 jsl $E10000 MEND MACRO &lab _SetEmptyRgn &lab ldx #$6A04 jsl $E10000 MEND MACRO &lab _SetFont &lab ldx #$9404 jsl $E10000 MEND MACRO &lab _SetFontFlags &lab ldx #$9804 jsl $E10000 MEND MACRO &lab _SetFontID &lab ldx #$D004 jsl $E10000 MEND MACRO &lab _SetForeColor &lab ldx #$A004 jsl $E10000 MEND MACRO &lab _SetGrafProcs &lab ldx #$4404 jsl $E10000 MEND MACRO &lab _SetIntUse &lab ldx #$B604 jsl $E10000 MEND MACRO &lab _SetMasterSCB &lab ldx #$1604 jsl $E10000 MEND MACRO &lab _SetOrigin &lab ldx #$2304 jsl $E10000 MEND MACRO &lab _SetPenMask &lab ldx #$3204 jsl $E10000 MEND MACRO &lab _SetPenMode &lab ldx #$2E04 jsl $E10000 MEND MACRO &lab _SetPenPat &lab ldx #$3004 jsl $E10000 MEND MACRO &lab _SetPenSize &lab ldx #$2C04 jsl $E10000 MEND MACRO &lab _SetPenState &lab ldx #$2A04 jsl $E10000 MEND MACRO &lab _SetPicSave &lab ldx #$3E04 jsl $E10000 MEND MACRO &lab _SetPolySave &lab ldx #$4204 jsl $E10000 MEND MACRO &lab _SetPort &lab ldx #$1B04 jsl $E10000 MEND MACRO &lab _SetPortLoc &lab ldx #$1D04 jsl $E10000 MEND MACRO &lab _SetPortRect &lab ldx #$1F04 jsl $E10000 MEND MACRO &lab _SetPortSize &lab ldx #$2104 jsl $E10000 MEND MACRO &lab _SetPt &lab ldx #$8204 jsl $E10000 MEND MACRO &lab _SetRandSeed &lab ldx #$8704 jsl $E10000 MEND MACRO &lab _SetRect &lab ldx #$4A04 jsl $E10000 MEND MACRO &lab _SetRectRgn &lab ldx #$6B04 jsl $E10000 MEND MACRO &lab _SetRgnSave &lab ldx #$4004 jsl $E10000 MEND MACRO &lab _SetSCB &lab ldx #$1204 jsl $E10000 MEND MACRO &lab _SetSolidBackPat &lab ldx #$3804 jsl $E10000 MEND MACRO &lab _SetSolidPenPat &lab ldx #$3704 jsl $E10000 MEND MACRO &lab _SetSpaceExtra &lab ldx #$9E04 jsl $E10000 MEND MACRO &lab _SetStdProcs &lab ldx #$8D04 jsl $E10000 MEND MACRO &lab _SetSysField &lab ldx #$4804 jsl $E10000 MEND MACRO &lab _SetSysFont &lab ldx #$B204 jsl $E10000 MEND MACRO &lab _SetTextFace &lab ldx #$9A04 jsl $E10000 MEND MACRO &lab _SetTextMode &lab ldx #$9C04 jsl $E10000 MEND MACRO &lab _SetTextSize &lab ldx #$D204 jsl $E10000 MEND MACRO &lab _SetUserField &lab ldx #$4604 jsl $E10000 MEND MACRO &lab _SetVisHandle &lab ldx #$C804 jsl $E10000 MEND MACRO &lab _SetVisRgn &lab ldx #$B404 jsl $E10000 MEND MACRO &lab _ShowCursor &lab ldx #$9104 jsl $E10000 MEND MACRO &lab _ShowPen &lab ldx #$2804 jsl $E10000 MEND MACRO &lab _SolidPattern &lab ldx #$3904 jsl $E10000 MEND MACRO &lab _StringBounds &lab ldx #$AD04 jsl $E10000 MEND MACRO &lab _StringWidth &lab ldx #$A904 jsl $E10000 MEND MACRO &lab _SubPt &lab ldx #$8104 jsl $E10000 MEND MACRO &lab _TextBounds &lab ldx #$AF04 jsl $E10000 MEND MACRO &lab _TextWidth &lab ldx #$AB04 jsl $E10000 MEND MACRO &lab _UnionRect &lab ldx #$4E04 jsl $E10000 MEND MACRO &lab _UnionRgn &lab ldx #$7204 jsl $E10000 MEND MACRO &lab _XorRgn &lab ldx #$7404 jsl $E10000 MEND ; File: M16.Resources ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _ResourceBootInit &lab ldx #$011E jsl $E10000 MEND MACRO &lab _ResourceStartup &lab ldx #$021E jsl $E10000 MEND MACRO &lab _ResourceShutdown &lab ldx #$031E jsl $E10000 MEND MACRO &lab _ResourceVersion &lab ldx #$041E jsl $E10000 MEND MACRO &lab _ResourceReset &lab ldx #$051E jsl $E10000 MEND MACRO &lab _ResourceStatus &lab ldx #$061E jsl $E10000 MEND MACRO &lab _AddResource &lab ldx #$0C1E jsl $E10000 MEND MACRO &lab _CloseResourceFile &lab ldx #$0B1E jsl $E10000 MEND MACRO &lab _CountResources &lab ldx #$221E jsl $E10000 MEND MACRO &lab _CountTypes &lab ldx #$201E jsl $E10000 MEND MACRO &lab _CreateResourceFile &lab ldx #$091E jsl $E10000 MEND MACRO &lab _DetachResource &lab ldx #$181E jsl $E10000 MEND MACRO &lab _GetCurResourceApp &lab ldx #$141E jsl $E10000 MEND MACRO &lab _GetCurResourceFile &lab ldx #$121E jsl $E10000 MEND MACRO &lab _GetIndResource &lab ldx #$231E jsl $E10000 MEND MACRO &lab _GetIndType &lab ldx #$211E jsl $E10000 MEND MACRO &lab _GetMapHandle &lab ldx #$261E jsl $E10000 MEND MACRO &lab _GetOpenFileRefNum &lab ldx #$1F1E jsl $E10000 MEND MACRO &lab _GetResourceAttr &lab ldx #$1B1E jsl $E10000 MEND MACRO &lab _GetResourceSize &lab ldx #$1D1E jsl $E10000 MEND MACRO &lab _HomeResourceFile &lab ldx #$151E jsl $E10000 MEND MACRO &lab _LoadAbsResource &lab ldx #$1B1E jsl $E10000 MEND MACRO &lab _LoadResource &lab ldx #$0E1E jsl $E10000 MEND MACRO &lab _MarkResourceChange &lab ldx #$101E jsl $E10000 MEND MACRO &lab _MatchResourceHandle &lab ldx #$1E1E jsl $E10000 MEND MACRO &lab _OpenResourceFile &lab ldx #$0A1E jsl $E10000 MEND MACRO &lab _ReleaseResource &lab ldx #$171E jsl $E10000 MEND MACRO &lab _RemoveResource &lab ldx #$0F1E jsl $E10000 MEND MACRO &lab _ResourceConverter &lab ldx #$281E jsl $E10000 MEND MACRO &lab _SetCurResourceApp &lab ldx #$131E jsl $E10000 MEND MACRO &lab _SetCurResourceFile &lab ldx #$111E jsl $E10000 MEND MACRO &lab _SetResourceAttr &lab ldx #$1C1E jsl $E10000 MEND MACRO &lab _SetResourceFileDepth &lab ldx #$251E jsl $E10000 MEND MACRO &lab _SetResourceID &lab ldx #$1A1E jsl $E10000 MEND MACRO &lab _SetResourceLoad &lab ldx #$241E jsl $E10000 MEND MACRO &lab _UniqueResourceID &lab ldx #$191E jsl $E10000 MEND MACRO &lab _UpdateResourceFile &lab ldx #$0D1E jsl $E10000 MEND MACRO &lab _WriteResource &lab ldx #$161E jsl $E10000 MEND ;----------------------------------------------------------- ; FILE: M16.SANE ; ; ; Copyright Apple Computer, Inc. 1986-88 ; All Rights Reserved ; ; ; ; These macros give assembly language access to 65816 SANE. ; NOTE: To use these macros you must also include E16.SANE in your ; source file. ;----------------------------------------------------------- ; Operation macros: operands should already be on the stack, ; with the destination address on top. Generally the suffix ; X, D, S, C, I, or L determines the format of the source ; operand - extended, double, single, comp, integer or longint. ;----------------------------------------------------------- ; ;----------------------------------------------------------- ; Toolset macros. ;----------------------------------------------------------- ; MACRO &lab _SANEBootInit &lab ldx #$010A jsl $E10000 MEND MACRO &lab _SANEStartup &lab ldx #$020A jsl $E10000 MEND MACRO &lab _SANEShutDown &lab ldx #$030A jsl $E10000 MEND MACRO &lab _SANEVersion &lab ldx #$040A jsl $E10000 MEND MACRO &lab _SANEReset &lab ldx #$050A jsl $E10000 MEND MACRO &lab _SANEStatus &lab ldx #$060A jsl $E10000 MEND MACRO &lab _SANEFP816 &lab ldx #$090A jsl $E10000 MEND MACRO &lab _SANEDecStr816 &lab ldx #$0A0A jsl $E10000 MEND MACRO &lab _SANEElems816 &lab ldx #$0B0A jsl $E10000 MEND ;----------------------------------------------------------- ; Addition. ;----------------------------------------------------------- MACRO &lab FADDX &lab FOPRF FFEXT+FOADD MEND MACRO &lab FADDD &lab FOPRF FFDBL+FOADD MEND MACRO &lab FADDS &lab FOPRF FFSGL+FOADD MEND MACRO &lab FADDC &lab FOPRF FFCOMP+FOADD MEND MACRO &lab FADDI &lab FOPRF FFINT+FOADD MEND MACRO &lab FADDL &lab FOPRF FFLNG+FOADD MEND ;----------------------------------------------------------- ; Subtraction. ;----------------------------------------------------------- MACRO &lab FSUBX &lab FOPRF FFEXT+FOSUB MEND MACRO &lab FSUBD &lab FOPRF FFDBL+FOSUB MEND MACRO &lab FSUBS &lab FOPRF FFSGL+FOSUB MEND MACRO &lab FSUBC &lab FOPRF FFCOMP+FOSUB MEND MACRO &lab FSUBI &lab FOPRF FFINT+FOSUB MEND MACRO &lab FSUBL &lab FOPRF FFLNG+FOSUB MEND ;----------------------------------------------------------- ; Multiplication. ;----------------------------------------------------------- MACRO &lab FMULX &lab FOPRF FFEXT+FOMUL MEND MACRO &lab FMULD &lab FOPRF FFDBL+FOMUL MEND MACRO &lab FMULS &lab FOPRF FFSGL+FOMUL MEND MACRO &lab FMULC &lab FOPRF FFCOMP+FOMUL MEND MACRO &lab FMULI &lab FOPRF FFINT+FOMUL MEND MACRO &lab FMULL &lab FOPRF FFLNG+FOMUL MEND ;----------------------------------------------------------- ; Division. ;----------------------------------------------------------- MACRO &lab FDIVX &lab FOPRF FFEXT+FODIV MEND MACRO &lab FDIVD &lab FOPRF FFDBL+FODIV MEND MACRO &lab FDIVS &lab FOPRF FFSGL+FODIV MEND MACRO &lab FDIVC &lab FOPRF FFCOMP+FODIV MEND MACRO &lab FDIVI &lab FOPRF FFINT+FODIV MEND MACRO &lab FDIVL &lab FOPRF FFLNG+FODIV MEND ;----------------------------------------------------------- ; Square root. ;----------------------------------------------------------- MACRO &lab FSQRTX &lab FOPRF FOSQRT MEND ;----------------------------------------------------------- ; Round to integer, according to the current rounding mode. ;----------------------------------------------------------- MACRO &lab FRINTX &lab FOPRF FORTI MEND ;----------------------------------------------------------- ; Truncate to integer, using round toward zero. ;----------------------------------------------------------- MACRO &lab FTINTX &lab FOPRF FOTTI MEND ;----------------------------------------------------------- ; Remainder. ;----------------------------------------------------------- MACRO &lab FREMX &lab FOPRF FFEXT+FOREM MEND MACRO &lab FREMD &lab FOPRF FFDBL+FOREM MEND MACRO &lab FREMS &lab FOPRF FFSGL+FOREM MEND MACRO &lab FREMC &lab FOPRF FFCOMP+FOREM MEND MACRO &lab FREMI &lab FOPRF FFINT+FOREM MEND MACRO &lab FREML &lab FOPRF FFLNG+FOREM MEND ;----------------------------------------------------------- ; Logb. ;----------------------------------------------------------- MACRO &lab FLOGBX &lab FOPRF FOLOGB MEND ;----------------------------------------------------------- ; Scalb. ;----------------------------------------------------------- MACRO &lab FSCALBX &lab FOPRF FOSCALB MEND ;----------------------------------------------------------- ; Copy-sign. ;----------------------------------------------------------- MACRO &lab FCPYSGNX &lab FOPRF FFEXT+FOCPYSGN MEND MACRO &lab FCPYSGND &lab FOPRF FFDBL+FOCPYSGN MEND MACRO &lab FCPYSGNS &lab FOPRF FFSGL+FOCPYSGN MEND MACRO &lab FCPYSGNC &lab FOPRF FFCOMP+FOCPYSGN MEND MACRO &lab FCPYSGNI &lab FOPRF FFINT+FOCPYSGN MEND MACRO &lab FCPYSGNL &lab FOPRF FFLNG+FOCPYSGN MEND ;----------------------------------------------------------- ; Negate. ;----------------------------------------------------------- MACRO &lab FNEGX &lab FOPRF FONEG MEND ;----------------------------------------------------------- ; Absolute value. ;----------------------------------------------------------- MACRO &lab FABSX &lab FOPRF FOABS MEND ;----------------------------------------------------------- ; Next-after. NOTE: both operands are of the ; the same format, as specified by the usual suffix. ;----------------------------------------------------------- MACRO &lab FNEXTS &lab FOPRF FFSGL+FONEXT MEND MACRO &lab FNEXTD &lab FOPRF FFDBL+FONEXT MEND MACRO &lab FNEXTX &lab FOPRF FFEXT+FONEXT MEND ;----------------------------------------------------------- ; Conversion to extended. ;----------------------------------------------------------- MACRO &lab FX2X &lab FOPRF FFEXT+FOZ2X MEND MACRO &lab FD2X &lab FOPRF FFDBL+FOZ2X MEND MACRO &lab FS2X &lab FOPRF FFSGL+FOZ2X MEND MACRO ; 16-bit integer, by address &lab FI2X &lab FOPRF FFINT+FOZ2X MEND MACRO ; 32-bit integer, by address &lab FL2X &lab FOPRF FFLNG+FOZ2X MEND MACRO &lab FC2X &lab FOPRF FFCOMP+FOZ2X MEND ;----------------------------------------------------------- ; Conversion from extended. ;----------------------------------------------------------- MACRO &lab FX2D &lab FOPRF FFDBL+FOX2Z MEND MACRO &lab FX2S &lab FOPRF FFSGL+FOX2Z MEND MACRO &lab FX2I &lab FOPRF FFINT+FOX2Z MEND MACRO &lab FX2L &lab FOPRF FFLNG+FOX2Z MEND MACRO &lab FX2C &lab FOPRF FFCOMP+FOX2Z MEND ;----------------------------------------------------------- ; Binary to decimal conversion. ;----------------------------------------------------------- MACRO &lab FX2DEC &lab FOPRF FFEXT+FOB2D MEND MACRO &lab FD2DEC &lab FOPRF FFDBL+FOB2D MEND MACRO &lab FS2DEC &lab FOPRF FFSGL+FOB2D MEND MACRO &lab FC2DEC &lab FOPRF FFCOMP+FOB2D MEND MACRO &lab FI2DEC &lab FOPRF FFINT+FOB2D MEND MACRO &lab FL2DEC &lab FOPRF FFLNG+FOB2D MEND ;----------------------------------------------------------- ; Decimal to binary conversion. ;----------------------------------------------------------- MACRO &lab FDEC2X &lab FOPRF FFEXT+FOD2B MEND MACRO &lab FDEC2D &lab FOPRF FFDBL+FOD2B MEND MACRO &lab FDEC2S &lab FOPRF FFSGL+FOD2B MEND MACRO &lab FDEC2C &lab FOPRF FFCOMP+FOD2B MEND MACRO &lab FDEC2I &lab FOPRF FFINT+FOD2B MEND MACRO &lab FDEC2L &lab FOPRF FFLNG+FOD2B MEND ;----------------------------------------------------------- ; Compare, not signaling invalid on unordered. ;----------------------------------------------------------- MACRO &lab FCMPX &lab FOPRF FFEXT+FOCMP MEND MACRO &lab FCMPD &lab FOPRF FFDBL+FOCMP MEND MACRO &lab FCMPS &lab FOPRF FFSGL+FOCMP MEND MACRO &lab FCMPC &lab FOPRF FFCOMP+FOCMP MEND MACRO &lab FCMPI &lab FOPRF FFINT+FOCMP MEND MACRO &lab FCMPL &lab FOPRF FFLNG+FOCMP MEND ;----------------------------------------------------------- ; Compare, signaling invalid on unordered. ;----------------------------------------------------------- MACRO &lab FCPXX &lab FOPRF FFEXT+FOCPX MEND MACRO &lab FCPXD &lab FOPRF FFDBL+FOCPX MEND MACRO &lab FCPXS &lab FOPRF FFSGL+FOCPX MEND MACRO &lab FCPXC &lab FOPRF FFCOMP+FOCPX MEND MACRO &lab FCPXI &lab FOPRF FFINT+FOCPX MEND MACRO &lab FCPXL &lab FOPRF FFLNG+FOCPX MEND ;----------------------------------------------------------- ; The following macros define a set of so-called floating ; branches. They presume that the appropriate compare ; operation, macro FCMPz or FCPXz, precedes. ;---------------------------------------------------------- MACRO ; branch equal &lab FBEQ &N1 &lab BEQ &N1 MEND MACRO ; branch less &lab FBLT &N1 &lab BMI &N1 MEND MACRO ; branch less or equal &lab FBLE &N1 &lab BMI &N1 BEQ &N1 MEND MACRO ; branch greater &lab FBGT &N1 &lab BVS &N1 MEND MACRO ; branch greater or equal &lab FBGE &N1 &lab BVS &N1 BEQ &N1 MEND MACRO ; branch less or unordered &lab FBULT &N1 &lab BMI &N1 BVS *+4 BNE &N1 MEND MACRO ; branch unordered, less, or equal &lab FBULE &N1 &lab BMI &N1 BEQ &N1 BVC &N1 MEND MACRO ; branch unordered or greater &lab FBUGT &N1 &lab BVS &N1 BMI *+4 BNE &N1 MEND MACRO ; branch unordered, greater, or equal &lab FBUGE &N1 &lab BVS &N1 BEQ &N1 BPL &N1 MEND MACRO ; branch unordered &lab FBU &N1 &lab BVS *+6 BMI *+4 BNE &N1 MEND MACRO ; branch ordered &lab FBO &N1 &lab BMI &N1 BVS &N1 BEQ &N1 MEND MACRO ; branch not equal &lab FBNE &N1 &lab BMI &N1 BVS &N1 BNE &N1 MEND MACRO ; branch unordered or equal &lab FBUE &N1 &lab BEQ &N1 BMI *+4 BVC &N1 MEND MACRO ; branch less or greater &lab FBLG &N1 &lab BMI &N1 BVS &N1 MEND MACRO &lab FCLASSS &lab FOPRF FFSGL+FOCLASS MEND MACRO &lab FCLASSD &lab FOPRF FFDBL+FOCLASS MEND MACRO &lab FCLASSX &lab FOPRF FFEXT+FOCLASS MEND MACRO &lab FCLASSC &lab FOPRF FFCOMP+FOCLASS MEND MACRO &lab FCLASSI &lab FOPRF FFINT+FOCLASS MEND MACRO &lab FCLASSL &lab FOPRF FFLNG+FOCLASS MEND ;----------------------------------------------------------- ; The following macros provide branches based on the ; the result of a FCLASSz macro. ;----------------------------------------------------------- MACRO ; branch signaling NaN &lab FBSNAN &N1 &lab TXA ASL A CMP #2*FCSNAN BEQ &N1 MEND MACRO ; branch quiet NaN &lab FBQNAN &N1 &lab TXA ASL A CMP #2*FCQNAN BEQ &N1 MEND MACRO ; branch infinite &lab FBINF &N1 &lab TXA ASL A CMP #2*FCINF BEQ &N1 MEND MACRO ; branch zero &lab FBZERO &N1 &lab TXA ASL A CMP #2*FCZERO BEQ &N1 MEND MACRO ; branch normal &lab FBNORM &N1 &lab TXA ASL A BEQ &N1 MEND MACRO ; branch denormal &lab FBDENORM &N1 &lab TXA ASL A CMP #2*FCDENORM BEQ &N1 MEND MACRO ; branch non-zero num (norm or denorm) &lab FBNZENUM &N1 &lab TXA XBA ASL A BCC &N1 MEND MACRO ; branch number (zero, norm, or denorm) &lab FBNUM &N1 &lab TXA INC A XBA ASL A BCC &N1 MEND MACRO ; branch minus sign &lab FBMINUS &N1 &lab BMI &N1 MEND MACRO ; branch plus sign &lab FBPLUS &N1 &lab BPL &N1 MEND ;----------------------------------------------------------- ; Get and set environment. ;----------------------------------------------------------- MACRO &lab FGETENV &lab FOPRF FOGETENV MEND MACRO &lab FSETENV &lab FOPRF FOSETENV MEND ;----------------------------------------------------------- ; Test and set exception. ;----------------------------------------------------------- MACRO &lab FTESTXCP &lab FOPRF FOTESTXCP MEND MACRO &lab FSETXCP &lab FOPRF FOSETXCP MEND ;---------------------------------------------------------- ; Procedure entry and exit. ;---------------------------------------------------------- MACRO &lab FPROCENTRY &lab FOPRF FOPROCENTRY MEND MACRO &lab FPROCEXIT &lab FOPRF FOPROCEXIT MEND ;----------------------------------------------------------- ; Get and set halt vector. ;----------------------------------------------------------- MACRO &lab FGETHV &lab FOPRF FOGETHV MEND MACRO &lab FSETHV &lab FOPRF FOSETHV MEND ;----------------------------------------------------------- ; Elementary function macros. ;----------------------------------------------------------- MACRO ; natural (base-e) log &lab FLNX &lab FOPRE FOLNX MEND MACRO ; base-2 log &lab FLOG2X &lab FOPRE FOLOG2X MEND MACRO ; ln (1 + x) &lab FLN1X &lab FOPRE FOLN1X MEND MACRO ; log2 (1 + x) &lab FLOG21X &lab FOPRE FOLOG21X MEND MACRO ; base-e exponential &lab FEXPX &lab FOPRE FOEXPX MEND MACRO ; base-2 exponential &lab FEXP2X &lab FOPRE FOEXP2X MEND MACRO ; exp (x) - 1 &lab FEXP1X &lab FOPRE FOEXP1X MEND MACRO ; exp2 (x) - 1 &lab FEXP21X &lab FOPRE FOEXP21X MEND MACRO ; integer exponential &lab FXPWRI &lab FOPRE FOXPWRI MEND MACRO ; general exponential &lab FXPWRY &lab FOPRE FOXPWRY MEND MACRO ; compound &lab FCOMPOUND &lab FOPRE FOCOMPOUND MEND MACRO ; annuity &lab FANNUITY &lab FOPRE FOANNUITY MEND MACRO ; arctangent &lab FATANX &lab FOPRE FOATANX MEND MACRO ; sine &lab FSINX &lab FOPRE FOSINX MEND MACRO ; cosine &lab FCOSX &lab FOPRE FOCOSX MEND MACRO ; tangent &lab FTANX &lab FOPRE FOTANX MEND MACRO ; random number generator &lab FRANDX &lab FOPRE FORANDX MEND ;----------------------------------------------------------- ; Scanner and formatter function macros. ;----------------------------------------------------------- MACRO ; Pascal string to decimal record &lab FPSTR2DEC &lab FOPRD FOPSTR2DEC MEND MACRO ; C string to decimal record &lab FCSTR2DEC &lab FOPRD FOCSTR2DEC MEND MACRO ; decimal record to (Pascal) string &lab FDEC2STR &lab FOPRD FODEC2STR MEND ;----------------------------------------------------------- ; Auxiliary macros. ;----------------------------------------------------------- MACRO ; call FP &lab FOPRF &N1 &lab PEA &N1 LDX #SANEtsNum+256*FPNum JSL $E10000 MEND MACRO ; call DecStr &lab FOPRD &N1 &lab PEA &N1 LDX #SANEtsNum+256*DecStrNum JSL $E10000 MEND MACRO ; call Elems &lab FOPRE &N1 &lab PEA &N1 LDX #SANEtsNum+256*ElemNum JSL $E10000 MEND ; File: M16.Scheduler ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _SchBootInit &lab ldx #$0107 jsl $E10000 MEND MACRO &lab _SchStartUp &lab ldx #$0207 jsl $E10000 MEND MACRO &lab _SchShutDown &lab ldx #$0307 jsl $E10000 MEND MACRO &lab _SchVersion &lab ldx #$0407 jsl $E10000 MEND MACRO &lab _SchReset &lab ldx #$0507 jsl $E10000 MEND MACRO &lab _SchStatus &lab ldx #$0607 jsl $E10000 MEND MACRO &lab _SchAddTask &lab ldx #$0907 jsl $E10000 MEND MACRO &lab _SchFlush &lab ldx #$0A07 jsl $E10000 MEND ; File: M16.Scrap ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _ScrapBootInit &lab ldx #$0116 jsl $E10000 MEND MACRO &lab _ScrapStartUp &lab ldx #$0216 jsl $E10000 MEND MACRO &lab _ScrapShutDown &lab ldx #$0316 jsl $E10000 MEND MACRO &lab _ScrapVersion &lab ldx #$0416 jsl $E10000 MEND MACRO &lab _ScrapReset &lab ldx #$0516 jsl $E10000 MEND MACRO &lab _ScrapStatus &lab ldx #$0616 jsl $E10000 MEND MACRO &lab _GetScrap &lab ldx #$0D16 jsl $E10000 MEND MACRO &lab _GetScrapCount &lab ldx #$1216 jsl $E10000 MEND MACRO &lab _GetScrapHandle &lab ldx #$0E16 jsl $E10000 MEND MACRO &lab _GetScrapPath &lab ldx #$1016 jsl $E10000 MEND MACRO &lab _GetScrapSize &lab ldx #$0F16 jsl $E10000 MEND MACRO &lab _GetScrapState &lab ldx #$1316 jsl $E10000 MEND MACRO &lab _LoadScrap &lab ldx #$0A16 jsl $E10000 MEND MACRO &lab _PutScrap &lab ldx #$0C16 jsl $E10000 MEND MACRO &lab _SetScrapPath &lab ldx #$1116 jsl $E10000 MEND MACRO &lab _UnloadScrap &lab ldx #$0916 jsl $E10000 MEND MACRO &lab _ZeroScrap &lab ldx #$0B16 jsl $E10000 MEND ; File: M16.Shell ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _GET_LINFO ¶ms &lab jsl $E100A8 DC.W $0101 DC.L ¶ms MEND MACRO &lab _SET_LINFO ¶ms &lab jsl $E100A8 DC.W $0102 DC.L ¶ms MEND MACRO &lab _GET_LANG ¶ms &lab jsl $E100A8 DC.W $0103 DC.L ¶ms MEND MACRO &lab _SET_LANG ¶ms &lab jsl $E100A8 DC.W $0104 DC.L ¶ms MEND MACRO &lab _ERROR ¶ms &lab jsl $E100A8 DC.W $0105 DC.L ¶ms MEND MACRO &lab _SET_VAR ¶ms &lab jsl $E100A8 DC.W $0106 DC.L ¶ms MEND MACRO &lab _VERSION ¶ms &lab jsl $E100A8 DC.W $0107 DC.L ¶ms MEND MACRO &lab _READ_INDEXED ¶ms &lab jsl $E100A8 DC.W $0108 DC.L ¶ms MEND MACRO &lab _INIT_WILDCARD ¶ms &lab jsl $E100A8 DC.W $0109 DC.L ¶ms MEND MACRO &lab _NEXT_WILDCARD ¶ms &lab jsl $E100A8 DC.W $010A DC.L ¶ms MEND MACRO &lab _GET_VAR ¶ms &lab jsl $E100A8 DC.W $010B DC.L ¶ms MEND MACRO &lab _EXECUTE ¶ms &lab jsl $E100A8 DC.W $010D DC.L ¶ms MEND MACRO &lab _DIRECTION ¶ms &lab jsl $E100A8 DC.W $010F DC.L ¶ms MEND MACRO &lab _REDIRECT ¶ms &lab jsl $E100A8 DC.W $0110 DC.L ¶ms MEND MACRO &lab _STOP ¶ms &lab jsl $E100A8 DC.W $0113 DC.L ¶ms MEND MACRO &lab _WRITE_CONSOLE ¶ms &lab jsl $E100A8 DC.W $011A DC.L ¶ms MEND ; File: M16.Sound ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _SoundBootInit &lab ldx #$0108 jsl $E10000 MEND MACRO &lab _SoundStartUp &lab ldx #$0208 jsl $E10000 MEND MACRO &lab _SoundShutDown &lab ldx #$0308 jsl $E10000 MEND MACRO &lab _SoundVersion &lab ldx #$0408 jsl $E10000 MEND MACRO &lab _SoundReset &lab ldx #$0508 jsl $E10000 MEND MACRO &lab _SoundToolStatus &lab ldx #$0608 jsl $E10000 MEND MACRO &lab _FFGeneratorStatus &lab ldx #$1108 jsl $E10000 MEND MACRO &lab _FFSoundDoneStatus &lab ldx #$1408 jsl $E10000 MEND MACRO &lab _FFSoundStatus &lab ldx #$1008 jsl $E10000 MEND MACRO &lab _FFStartSound &lab ldx #$0E08 jsl $E10000 MEND MACRO &lab _FFStopSound &lab ldx #$0F08 jsl $E10000 MEND MACRO &lab _GetSoundVolume &lab ldx #$0C08 jsl $E10000 MEND MACRO &lab _GetTableAddress &lab ldx #$0B08 jsl $E10000 MEND MACRO &lab _ReadRamBlock &lab ldx #$0A08 jsl $E10000 MEND MACRO &lab _SetSoundMIRQV &lab ldx #$1208 jsl $E10000 MEND MACRO &lab _SetSoundVolume &lab ldx #$0D08 jsl $E10000 MEND MACRO &lab _SetUserSoundIRQV &lab ldx #$1308 jsl $E10000 MEND MACRO &lab _WriteRamBlock &lab ldx #$0908 jsl $E10000 MEND MACRO &lab _FFSetUpSound &lab ldx #$1508 jsl $E10000 MEND MACRO &lab _FFStartPlaying &lab ldx #$1608 jsl $E10000 MEND MACRO &lab _SetDOCReg &lab ldx #$1708 jsl $E10000 MEND MACRO &lab _ReadDOCReg &lab ldx #$1808 jsl $E10000 MEND ; File: M16.StdFile ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _SFBootInit &lab ldx #$0117 jsl $E10000 MEND MACRO &lab _SFStartUp &lab ldx #$0217 jsl $E10000 MEND MACRO &lab _SFShutDown &lab ldx #$0317 jsl $E10000 MEND MACRO &lab _SFVersion &lab ldx #$0417 jsl $E10000 MEND MACRO &lab _SFReset &lab ldx #$0517 jsl $E10000 MEND MACRO &lab _SFStatus &lab ldx #$0617 jsl $E10000 MEND MACRO &lab _SFAllCaps &lab ldx #$0D17 jsl $E10000 MEND MACRO &lab _SFGetFile &lab ldx #$0917 jsl $E10000 MEND MACRO &lab _SFGetFile2 &lab ldx #$0E17 jsl $E10000 MEND MACRO &lab _SFMultiGet2 &lab ldx #$1417 jsl $E10000 MEND MACRO &lab _SFPGetFile &lab ldx #$0B17 jsl $E10000 MEND MACRO &lab _SFPGetFile2 &lab ldx #$1017 jsl $E10000 MEND MACRO &lab _SFPMultiGet2 &lab ldx #$1517 jsl $E10000 MEND MACRO &lab _SFPPutFile &lab ldx #$0C17 jsl $E10000 MEND MACRO &lab _SFPPutFile2 &lab ldx #$1117 jsl $E10000 MEND MACRO &lab _SFPutFile &lab ldx #$0A17 jsl $E10000 MEND MACRO &lab _SFPutFile2 &lab ldx #$0F17 jsl $E10000 MEND MACRO &lab _SFShowInvisible &lab ldx #$1217 jsl $E10000 MEND MACRO &lab _SFReScan &lab ldx #$1317 jsl $E10000 MEND ; File: M16.TextEdit ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _TEBootInit &lab ldx #$0122 jsl $E10000 MEND MACRO &lab _TEStartup &lab ldx #$0222 jsl $E10000 MEND MACRO &lab _TEShutdown &lab ldx #$0322 jsl $E10000 MEND MACRO &lab _TEVersion &lab ldx #$0422 jsl $E10000 MEND MACRO &lab _TEReset &lab ldx #$0522 jsl $E10000 MEND MACRO &lab _TEStatus &lab ldx #$0622 jsl $E10000 MEND MACRO &lab _TEActivate &lab ldx #$0F22 jsl $E10000 MEND MACRO &lab _TEClear &lab ldx #$1922 jsl $E10000 MEND MACRO &lab _TEClick &lab ldx #$1122 jsl $E10000 MEND MACRO &lab _TECut &lab ldx #$1622 jsl $E10000 MEND MACRO &lab _TECopy &lab ldx #$1722 jsl $E10000 MEND MACRO &lab _TEDeactivate &lab ldx #$1022 jsl $E10000 MEND MACRO &lab _TEGetDefProc &lab ldx #$2222 jsl $E10000 MEND MACRO &lab _TEGetHooks &lab ldx #$2022 jsl $E10000 MEND MACRO &lab _TEGetSelection &lab ldx #$1C22 jsl $E10000 MEND MACRO &lab _TEGetSelectionStyle &lab ldx #$1E22 jsl $E10000 MEND MACRO &lab _TEGetText &lab ldx #$0C22 jsl $E10000 MEND MACRO &lab _TEGetTextInfo &lab ldx #$0D22 jsl $E10000 MEND MACRO &lab _TEIdle &lab ldx #$0E22 jsl $E10000 MEND MACRO &lab _TEInsert &lab ldx #$1A22 jsl $E10000 MEND MACRO &lab _TEInsertPageBreak &lab ldx #$1522 jsl $E10000 MEND MACRO &lab _TEKey &lab ldx #$1422 jsl $E10000 MEND MACRO &lab _TEKill &lab ldx #$0A22 jsl $E10000 MEND MACRO &lab _TENew &lab ldx #$0922 jsl $E10000 MEND MACRO &lab _TEPaintText &lab ldx #$1322 jsl $E10000 MEND MACRO &lab _TEPaste &lab ldx #$1822 jsl $E10000 MEND MACRO &lab _TEReplace &lab ldx #$1B22 jsl $E10000 MEND MACRO &lab _TESetHooks &lab ldx #$2122 jsl $E10000 MEND MACRO &lab _TESetSelection &lab ldx #$1D22 jsl $E10000 MEND MACRO &lab _TESetText &lab ldx #$0B22 jsl $E10000 MEND MACRO &lab _TEStyleChange &lab ldx #$1F22 jsl $E10000 MEND MACRO &lab _TEUpdate &lab ldx #$1222 jsl $E10000 MEND ; File: M16.TextTool ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _TextBootInit &lab ldx #$010C jsl $E10000 MEND MACRO &lab _TextStartUp &lab ldx #$020C jsl $E10000 MEND MACRO &lab _TextShutDown &lab ldx #$030C jsl $E10000 MEND MACRO &lab _TextVersion &lab ldx #$040C jsl $E10000 MEND MACRO &lab _TextReset &lab ldx #$050C jsl $E10000 MEND MACRO &lab _TextStatus &lab ldx #$060C jsl $E10000 MEND MACRO &lab _CtlTextDev &lab ldx #$160C jsl $E10000 MEND MACRO &lab _ErrWriteBlock &lab ldx #$1F0C jsl $E10000 MEND MACRO &lab _ErrWriteChar &lab ldx #$190C jsl $E10000 MEND MACRO &lab _ErrWriteCString &lab ldx #$210C jsl $E10000 MEND MACRO &lab _ErrWriteLine &lab ldx #$1B0C jsl $E10000 MEND MACRO &lab _ErrWriteString &lab ldx #$1D0C jsl $E10000 MEND MACRO &lab _GetErrGlobals &lab ldx #$0E0C jsl $E10000 MEND MACRO &lab _GetErrorDevice &lab ldx #$140C jsl $E10000 MEND MACRO &lab _GetInGlobals &lab ldx #$0C0C jsl $E10000 MEND MACRO &lab _GetInputDevice &lab ldx #$120C jsl $E10000 MEND MACRO &lab _GetOutGlobals &lab ldx #$0D0C jsl $E10000 MEND MACRO &lab _GetOutputDevice &lab ldx #$130C jsl $E10000 MEND MACRO &lab _InitTextDev &lab ldx #$150C jsl $E10000 MEND MACRO &lab _ReadChar &lab ldx #$220C jsl $E10000 MEND MACRO &lab _ReadLine &lab ldx #$240C jsl $E10000 MEND MACRO &lab _SetErrGlobals &lab ldx #$0B0C jsl $E10000 MEND MACRO &lab _SetErrorDevice &lab ldx #$110C jsl $E10000 MEND MACRO &lab _SetInGlobals &lab ldx #$090C jsl $E10000 MEND MACRO &lab _SetInputDevice &lab ldx #$0F0C jsl $E10000 MEND MACRO &lab _SetOutGlobals &lab ldx #$0A0C jsl $E10000 MEND MACRO &lab _SetOutputDevice &lab ldx #$100C jsl $E10000 MEND MACRO &lab _StatusTextDev &lab ldx #$170C jsl $E10000 MEND MACRO &lab _TextReadBlock &lab ldx #$230C jsl $E10000 MEND MACRO &lab _TextWriteBlock &lab ldx #$1E0C jsl $E10000 MEND MACRO &lab _WriteChar &lab ldx #$180C jsl $E10000 MEND MACRO &lab _WriteCString &lab ldx #$200C jsl $E10000 MEND MACRO &lab _WriteLine &lab ldx #$1A0C jsl $E10000 MEND MACRO &lab _WriteString &lab ldx #$1C0C jsl $E10000 MEND ; File: M16.Types ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; ; File: M16.Video ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _VDBootInit &lab ldx #$0121 jsl $E10000 MEND MACRO &lab _VDStartUp &lab ldx #$0221 jsl $E10000 MEND MACRO &lab _VDShutdown &lab ldx #$0321 jsl $E10000 MEND MACRO &lab _VDVersion &lab ldx #$0421 jsl $E10000 MEND MACRO &lab _VDReset &lab ldx #$0521 jsl $E10000 MEND MACRO &lab _VDStatus &lab ldx #$0621 jsl $E10000 MEND MACRO &lab _VDGetFeatures &lab ldx #$1B21 jsl $E10000 MEND MACRO &lab _VDInControl &lab ldx #$1C21 jsl $E10000 MEND MACRO &lab _VDInStatus &lab ldx #$0921 jsl $E10000 MEND MACRO &lab _VDInSetStd &lab ldx #$0A21 jsl $E10000 MEND MACRO &lab _VDInGetStd &lab ldx #$0B21 jsl $E10000 MEND MACRO &lab _VDInConvAdj &lab ldx #$0C21 jsl $E10000 MEND MACRO &lab _VDKeyControl &lab ldx #$0D21 jsl $E10000 MEND MACRO &lab _VDKeyStatus &lab ldx #$0E21 jsl $E10000 MEND MACRO &lab _VDKeySetKCol &lab ldx #$0F21 jsl $E10000 MEND MACRO &lab _VDKeyGetRCol &lab ldx #$1021 jsl $E10000 MEND MACRO &lab _VDKeyGetGCol &lab ldx #$1121 jsl $E10000 MEND MACRO &lab _VDKeyGetBCol &lab ldx #$1221 jsl $E10000 MEND MACRO &lab _VDKeySetKDiss &lab ldx #$1321 jsl $E10000 MEND MACRO &lab _VDKeyGetKDiss &lab ldx #$1421 jsl $E10000 MEND MACRO &lab _VDKeySetNKDiss &lab ldx #$1521 jsl $E10000 MEND MACRO &lab _VDKeyGetNKDiss &lab ldx #$1621 jsl $E10000 MEND MACRO &lab _VDOutSetStd &lab ldx #$1721 jsl $E10000 MEND MACRO &lab _VDOutGetStd &lab ldx #$1821 jsl $E10000 MEND MACRO &lab _VDOutControl &lab ldx #$1921 jsl $E10000 MEND MACRO &lab _VDOutStatus &lab ldx #$1A21 jsl $E10000 MEND MACRO &lab _VDGGControl &lab ldx #$1D21 jsl $E10000 MEND MACRO &lab _VDGGStatus &lab ldx #$1E21 jsl $E10000 MEND ; File: M16.Window ; ; ; Copyright Apple computer, Inc. 1986-89 ; All Rights Reserved ; ; MACRO &lab _AlertWindow &lab ldx #$590E jsl $E10000 MEND MACRO &lab _DrawInfoBar &lab ldx #$550E jsl $E10000 MEND MACRO &lab _EndFrameDrawing &lab ldx #$5B0E jsl $E10000 MEND MACRO &lab _GetWindowMgrGlobals &lab ldx #$580E jsl $E10000 MEND MACRO &lab _ResizeWindow &lab ldx #$5C0E jsl $E10000 MEND MACRO &lab _StartFrameDrawing &lab ldx #$5A0E jsl $E10000 MEND MACRO &lab _WindBootInit &lab ldx #$010E jsl $E10000 MEND MACRO &lab _WindStartUp &lab ldx #$020E jsl $E10000 MEND MACRO &lab _WindShutDown &lab ldx #$030E jsl $E10000 MEND MACRO &lab _WindVersion &lab ldx #$040E jsl $E10000 MEND MACRO &lab _WindReset &lab ldx #$050E jsl $E10000 MEND MACRO &lab _WindStatus &lab ldx #$060E jsl $E10000 MEND MACRO &lab _BeginUpdate &lab ldx #$1E0E jsl $E10000 MEND MACRO &lab _BringToFront &lab ldx #$240E jsl $E10000 MEND MACRO &lab _CheckUpdate &lab ldx #$0A0E jsl $E10000 MEND MACRO &lab _CloseWindow &lab ldx #$0B0E jsl $E10000 MEND MACRO &lab _Desktop &lab ldx #$0C0E jsl $E10000 MEND MACRO &lab _DragWindow &lab ldx #$1A0E jsl $E10000 MEND MACRO &lab _EndInfoDrawing &lab ldx #$510E jsl $E10000 MEND MACRO &lab _EndUpdate &lab ldx #$1F0E jsl $E10000 MEND MACRO &lab _FindWindow &lab ldx #$170E jsl $E10000 MEND MACRO &lab _FrontWindow &lab ldx #$150E jsl $E10000 MEND MACRO &lab _GetContentDraw &lab ldx #$480E jsl $E10000 MEND MACRO &lab _GetContentOrigin &lab ldx #$3E0E jsl $E10000 MEND MACRO &lab _GetContentRgn &lab ldx #$2F0E jsl $E10000 MEND MACRO &lab _GetDataSize &lab ldx #$400E jsl $E10000 MEND MACRO &lab _GetDefProc &lab ldx #$310E jsl $E10000 MEND MACRO &lab _GetFirstWindow &lab ldx #$520E jsl $E10000 MEND MACRO &lab _GetFrameColor &lab ldx #$100E jsl $E10000 MEND MACRO &lab _GetInfoDraw &lab ldx #$4A0E jsl $E10000 MEND MACRO &lab _GetInfoRefCon &lab ldx #$350E jsl $E10000 MEND MACRO &lab _GetMaxGrow &lab ldx #$420E jsl $E10000 MEND MACRO &lab _GetNextWindow &lab ldx #$2A0E jsl $E10000 MEND MACRO &lab _GetPage &lab ldx #$460E jsl $E10000 MEND MACRO &lab _GetRectInfo &lab ldx #$4F0E jsl $E10000 MEND MACRO &lab _GetScroll &lab ldx #$440E jsl $E10000 MEND MACRO &lab _GetStructRgn &lab ldx #$2E0E jsl $E10000 MEND MACRO &lab _GetSysWFlag &lab ldx #$4C0E jsl $E10000 MEND MACRO &lab _GetUpdateRgn &lab ldx #$300E jsl $E10000 MEND MACRO &lab _GetWControls &lab ldx #$330E jsl $E10000 MEND MACRO &lab _GetWFrame &lab ldx #$2C0E jsl $E10000 MEND MACRO &lab _GetWKind &lab ldx #$2B0E jsl $E10000 MEND MACRO &lab _GetWMgrPort &lab ldx #$200E jsl $E10000 MEND MACRO &lab _GetWRefCon &lab ldx #$290E jsl $E10000 MEND MACRO &lab _GetWTitle &lab ldx #$0E0E jsl $E10000 MEND MACRO &lab _GetZoomRect &lab ldx #$370E jsl $E10000 MEND MACRO &lab _GrowWindow &lab ldx #$1B0E jsl $E10000 MEND MACRO &lab _HideWindow &lab ldx #$120E jsl $E10000 MEND MACRO &lab _HiliteWindow &lab ldx #$220E jsl $E10000 MEND MACRO &lab _InvalRect &lab ldx #$3A0E jsl $E10000 MEND MACRO &lab _InvalRgn &lab ldx #$3B0E jsl $E10000 MEND MACRO &lab _MoveWindow &lab ldx #$190E jsl $E10000 MEND MACRO &lab _NewWindow &lab ldx #$090E jsl $E10000 MEND MACRO &lab _PinRect &lab ldx #$210E jsl $E10000 MEND MACRO &lab _RefreshDesktop &lab ldx #$390E jsl $E10000 MEND MACRO &lab _SelectWindow &lab ldx #$110E jsl $E10000 MEND MACRO &lab _SendBehind &lab ldx #$140E jsl $E10000 MEND MACRO &lab _SetContentDraw &lab ldx #$490E jsl $E10000 MEND MACRO &lab _SetContentOrigin &lab ldx #$3F0E jsl $E10000 MEND MACRO &lab _SetContentOrigin2 &lab ldx #$570E jsl $E10000 MEND MACRO &lab _SetDataSize &lab ldx #$410E jsl $E10000 MEND MACRO &lab _SetDefProc &lab ldx #$320E jsl $E10000 MEND MACRO &lab _SetFrameColor &lab ldx #$0F0E jsl $E10000 MEND MACRO &lab _SetInfoDraw &lab ldx #$160E jsl $E10000 MEND MACRO &lab _SetInfoRefCon &lab ldx #$360E jsl $E10000 MEND MACRO &lab _SetMaxGrow &lab ldx #$430E jsl $E10000 MEND MACRO &lab _SetOriginMask &lab ldx #$340E jsl $E10000 MEND MACRO &lab _SetPage &lab ldx #$470E jsl $E10000 MEND MACRO &lab _SetScroll &lab ldx #$450E jsl $E10000 MEND MACRO &lab _SetSysWindow &lab ldx #$4B0E jsl $E10000 MEND MACRO &lab _SetWFrame &lab ldx #$2D0E jsl $E10000 MEND MACRO &lab _SetWindowIcons &lab ldx #$4E0E jsl $E10000 MEND MACRO &lab _SetWRefCon &lab ldx #$280E jsl $E10000 MEND MACRO &lab _SetWTitle &lab ldx #$0D0E jsl $E10000 MEND MACRO &lab _SetZoomRect &lab ldx #$380E jsl $E10000 MEND MACRO &lab _ShowHide &lab ldx #$230E jsl $E10000 MEND MACRO &lab _ShowWindow &lab ldx #$130E jsl $E10000 MEND MACRO &lab _SizeWindow &lab ldx #$1C0E jsl $E10000 MEND MACRO &lab _StartDrawing &lab ldx #$4D0E jsl $E10000 MEND MACRO &lab _StartInfoDrawing &lab ldx #$500E jsl $E10000 MEND MACRO &lab _TaskMaster &lab ldx #$1D0E jsl $E10000 MEND MACRO &lab _TrackGoAway &lab ldx #$180E jsl $E10000 MEND MACRO &lab _TrackZoom &lab ldx #$260E jsl $E10000 MEND MACRO &lab _ValidRect &lab ldx #$3C0E jsl $E10000 MEND MACRO &lab _ValidRgn &lab ldx #$3D0E jsl $E10000 MEND MACRO &lab _WindDragRect &lab ldx #$530E jsl $E10000 MEND MACRO &lab _WindNewRes &lab ldx #$250E jsl $E10000 MEND MACRO &lab _WindowGlobal &lab ldx #$560E jsl $E10000 MEND MACRO &lab _ZoomWindow &lab ldx #$270E jsl $E10000 MEND MACRO &lab _TaskMasterDA &lab ldx #$5F0E jsl $E10000 MEND MACRO &lab _CompileText &lab ldx #$600E jsl $E10000 MEND MACRO &lab _NewWindow2 &lab ldx #$610E jsl $E10000 MEND MACRO &lab _ErrorWindow &lab ldx #$620E jsl $E10000 MEND \ No newline at end of file diff --git a/appleworksgs/PL/PL.equ b/appleworksgs/PL/PL.equ new file mode 100755 index 0000000..8c0565a --- /dev/null +++ b/appleworksgs/PL/PL.equ @@ -0,0 +1 @@ + ;------------------------------------------ ; ; Equates from procedure P_ATTRData ; ;------------------------------------------ P_MenuColor equ 9 P_MenuStyle equ 8 P_MenuSize equ 7 P_MenuFont equ 6 P_MenuFormat equ 5 P_MenuArrange equ $A P_MenuOptions equ 4 P_MenuEdit equ 3 P_MenuFile equ 2 P_MenuApple equ 1 P_FrontBit equ 1<<0 P_BackBit equ 1<<1 P_FlipHBit equ 1<<2 P_FlipVBit equ 1<<3 P_RotLBit equ 1<<4 P_RotRBit equ 1<<5 P_DefaultArrange equ %000000 P_AllArrange equ %111111 P_ObjArrange equ %111111 P_ViewPageBit equ 1<<0 P_HidePaletteBit equ 1<<1 P_HideRulerBit equ 1<<2 P_HideGuideBit equ 1<<3 P_SetGuideBit equ 1<<4 P_LockGuideBit equ 1<<5 P_MagGuideBit equ 1<<6 P_GoToPageBit equ 1<<7 P_SetNumBit equ 1<<8 P_UseTempBit equ 1<<9 P_DblPageBit equ 1<<10 P_AllOptions equ %0000011111111111 P_DefaultOpt equ %0000011111111111 P_ViewPageItem equ $401 P_HidePaletteItem equ $402 P_HideRulerItem equ $403 P_HideGuideItem equ $404 P_SetGuideItem equ $405 P_LockGuideItem equ $406 P_MagGuideItem equ $407 P_GotoPageItem equ $408 P_SetNumItem equ $409 P_UseTempItem equ $40A P_DblPageItem equ $40B P_AllText equ %11111111 P_DefaultText equ %11111111 P_LeftBit equ 1<<0 P_CenterBit equ 1<<1 P_RightBit equ 1<<2 P_FullBit equ 1<<3 P_SingleSpBit equ 1<<4 P_1_5SpBit equ 1<<5 P_DoubleSpBit equ 1<<6 P_SetSpBit equ 1<<7 P_LeftItem equ $501 P_CenterItem equ $502 P_RightItem equ $503 P_FullItem equ $504 P_SingleItem equ $505 P_DoubleItem equ $506 P_TripleItem equ $507 P_SetSItem equ $508 P_SelectAllBit equ 1<<(5) P_DuplicateBit equ 1<<(5+1) P_InsertBit equ 1<<(5+2) P_DeleteBit equ 1<<(5+3) P_DefaultEdit equ %0000000110101000 P_ObjEdit equ %0000000001010110 P_TextEdit equ %0000000000010110 P_EditAll equ %0000000111111111 ;------------------------------------------ ; ; Equates from procedure P_Data ; ;------------------------------------------ P_WinTop equ 27 P_WinLeft equ 4 P_WinHeight equ 171 P_WinWidth equ 632 P_ScrollHeight equ 12 P_ScrollWidth equ 26 P_HScrollL equ 5 P_VScrollT equ -1 P_MinHeight equ 80 P_MinWidth equ 280 CheckMark equ 18 LIGHTGRAY equ 3 DARKGRAY equ 12 LIGHTGREY equ 3 DARKGREY equ 12 P_VERSNUM equ $770A ; $77='w'=id, $0A = file version P_ID equ $77 P_VNum equ $0A P_DecimalTab equ -1 ; ick!! This is for sideways compatibility w/ WP P_LeftTab equ 0 P_RightTab equ 1 P_IndentTab equ 2 P_MaxTabCount equ 10 P_MinTabDist equ 10 P_MaxPages equ 99 RulerGuide equ 0 ColGuide equ 1 MargGuide equ 2 P_NoUndo equ 0 P_MoveUndo equ 1 P_StretchUndo equ 2 P_CropUndo equ 3 P_FillUndo equ 4 P_PenSizeUndo equ 5 P_FontIDUndo equ 6 P_FontUndo equ 7 P_StyleUndo equ 8 P_SizeUndo equ 9 P_ColorUndo equ 10 P_ClearObjUndo equ 11 P_CutObjUndo equ 12 P_GuideUndo equ 13 P_ClearTextUndo equ 14 P_CutTextUndo equ 15 P_TypeUndo equ 16 ; From P_RulerData --------------------- P_MIN_VPIX equ 2 P_MIN_HPIX equ 4 P_HRulWdth equ 16 P_HRulLength equ 640 P_HRulTop equ 0 P_HRulLeft equ 79 P_HRulOffset equ 79 P_VRulWdth equ 39 P_VRulLength equ 200 P_VRulLeft equ 39 P_VRulTop equ P_HRulTop+P_HRulWdth P_TabWTop equ P_HRulTop P_TabWBottom equ P_VRulTop P_TabWLeft equ P_VRulLeft P_TabWRight equ P_HRulLeft V_NUM EQU 42 H_NUM EQU 7 MIN_V_NPIX EQU 8 MIN_H_NPIX EQU 20 ; From PICON.s ---------- P_MaxVisPages equ 5 P_ControlWidth equ 18 P_PageWidth equ 26 P_SpaceWidth equ 5 ;------------------------------------------ ; ; Equates from procedure P_ObjData ; ;------------------------------------------ P_ARROW EQU 0 P_ALPHA EQU 1 P_PAGETOOL EQU 2 P_DATETOOL EQU 3 P_STRLINE EQU 4 P_LINE EQU 5 P_RECTANGLE EQU 6 P_ROUNDRECT EQU 7 P_CIRCLE EQU 8 P_PICTURE EQU 9 P_MOVEMENT EQU 10 ; when you're dragging objects about... P_Next equ 0 ; This must be the first field P_Prev equ 4 ; Previous object P_Type equ 8 ; The object type P_Selected equ 10 ; Object is selected P_Deleted equ 12 ; True if object has been deleted P_UndoData equ 14 ; Used by undo P_ObjRect equ 16 ; Object rectangle P_RTop equ 16 P_RLeft equ 18 P_RBottom equ 20 P_RRight equ 22 P_TRect equ 24 P_PageNo equ 32 P_ParagHdl equ 34 P_NThread equ 38 P_PThread equ 42 P_StartParag equ 46 P_StartLine equ 48 P_EndParag equ 50 P_EndLine equ 52 P_ThreadNo equ 54 ;Number in the thread P_TextObjSize equ 56 P_ObjColor equ 24 P_PenSize equ 26 P_ObjFilled equ 28 P_ItemColor equ 24 ; Same equate as P_ObjColor P_ItemFontID equ 26 P_ItemJust equ 30 P_CopyPage equ 32 ; Page number copied from P_PictRect equ 24 ; Same offset as TextRect P_PictHandle equ 32 PL_SelRect equ 0 PL_DeselectAll equ 1 PL_SelectAll equ 2 PL_FixTObj equ 3 PL_OffsetObj equ 4 PL_AddUpdate equ 5 PL_ClrUndoData equ 6 PL_SetUndoData equ 7 PL_CpyUndoData equ 8 P_FillAttr equ 0 P_PenSizeAttr equ 1 P_ColorAttr equ 2 P_FontAttr equ 3 P_StyleAttr equ 4 P_SizeAttr equ 5 P_TLHdl equ 1 ; Top Left P_BRHdl equ 2 ; Bottom Right P_BLHdl equ 3 ; Bottom Left P_TRHdl equ 4 ; TopRight ;------------------------------------------ ; ; Equates from procedure T_Data ; ;------------------------------------------ T_FontFl equ 1<<0 T_StyleFl equ 1<<1 T_SizeFl equ 1<<2 T_ColorFl equ 1<<3 ;------------------------------------------ ; ; Equates from procedure T_TextEqu ; ;------------------------------------------ ; Paragraph Info ; All the equs are offset by two bytes to make up for the paragraph count ; at the beginning of the paragraph array. T_ParagCount EQU 0 T_TextBlock EQU 2 T_ParOffset EQU 6 T_ParStart EQU 8 T_RulerHdl EQU 10 T_ParHeight EQU 14 T_LinesHdl EQU 16 T_LineCount EQU 20 T_ObjHdl EQU 22 T_ParInfoSize EQU 24 ;This is correct!! T_ParsUsing EQU 0 T_RulBits EQU 2 T_NotUsed EQU 4 T_TabCount EQU 6 T_Indent EQU 8 T_TabArray EQU 12 T_RulerInfoSize EQU 52 T_Offset EQU 0 T_Length EQU 2 T_LineWidth EQU 4 T_Ascent EQU 6 T_Descent EQU 7 T_LineInfoSize EQU 8 T_DefDataSize EQU 12 T_BlockHdrSize EQU 4 ; Size of the header T_BlockSize EQU 0 T_TextSize EQU 2 T_ParFont EQU 0 T_ParStyle EQU 2 T_ParSize EQU 3 T_ParColor EQU 4 T_ParHeader EQU 7 T_FontChange EQU 1 T_StyleChange EQU 2 T_SizeChange EQU 3 T_ColorChange EQU 4 T_MaxChange EQU 7 T_Single EQU 1<<0 T_Double EQU 1<<1 T_Triple EQU 1<<2 T_Widow EQU 1<<3 T_Left EQU 1<<4 T_Center EQU 1<<5 T_Right EQU 1<<6 T_Full EQU 1<<7 T_GetCustSpace EQU $3f ;Use on upper byte T_CustSpace EQU 1<<14 T_MarkBit EQU 1<<15 T_AllSpacing EQU T_Single+T_Double+T_Triple+T_CustSpace T_NoSpacing EQU T_Left+T_Center+T_Right+T_Full T_AllJust EQU T_Left+T_Center+T_Right+T_Full T_NoJust EQU $ffff-T_AllJust T_KillWidow EQU $ffff-T_Widow T_ClearMark EQU $ffff-T_MarkBit T_DecTab EQU -1 T_LeftTab EQU 0 T_RightTab EQU 1 T_IndentTab EQU 3 T_ChangeSpace EQU 0 T_ChangeJust EQU 1 T_ChangeIndent EQU 2 T_ChangeTabs EQU 3 T_FirstLine EQU 1<<0 T_LastLine EQU 1<<1 \ No newline at end of file diff --git a/appleworksgs/PL/PL.link b/appleworksgs/PL/PL.link new file mode 100755 index 0000000..608c132 --- /dev/null +++ b/appleworksgs/PL/PL.link @@ -0,0 +1 @@ + -lseg:dynamic PL Source:AWGS:PL:Obj:pl.o Source:AWGS:PL:Obj:pdata.o Source:AWGS:PL:Obj:picon.o Source:AWGS:PL:Obj:putil.o Source:AWGS:PL:Obj:poptions.o Source:AWGS:PL:Obj:pfile.o Source:AWGS:PL:Obj:pprint.o Source:AWGS:PL:Obj:ptool.o Source:AWGS:PL:Obj:pmouse.o Source:AWGS:PL:Obj:pobject.o Source:AWGS:PL:Obj:pobjutil.o Source:AWGS:PL:Obj:plist.o Source:AWGS:PL:Obj:pmove.o Source:AWGS:PL:Obj:ppage.o Source:AWGS:PL:Obj:pruler.o Source:AWGS:PL:Obj:pupdate.o Source:AWGS:PL:Obj:pmenus.o Source:AWGS:PL:Obj:pedit.o Source:AWGS:PL:Obj:pundo.o Source:AWGS:PL:Obj:parrange.o Source:AWGS:PL:Obj:pscroll.o Source:AWGS:PL:Obj:pguide.o Source:AWGS:PL:Obj:pdrag.o Source:AWGS:PL:Obj:ptab.o Source:AWGS:PL:Obj:main.o Source:AWGS:PL:Obj:prim.o Source:AWGS:PL:Obj:prim2.o Source:AWGS:PL:Obj:tutil.o Source:AWGS:PL:Obj:tdraw.o Source:AWGS:PL:Obj:click.o Source:AWGS:PL:Obj:key.o Source:AWGS:PL:Obj:edit.o Source:AWGS:PL:Obj:format.o Source:AWGS:PL:Obj:truler.o Source:AWGS:PL:Obj:tcntl.o -lseg:dynamic PL2 Source:AWGS:PL:Obj:pruler2.o Source:AWGS:PL:Obj:putil2.o Source:AWGS:PL:Obj:pobjutil2.o Source:AWGS:PL:Obj:tscrap.o Source:AWGS:PL:Obj:tutil2.o -lseg PLSCRAP Source:AWGS:PL:Obj:pscrap.o Source:AWGS:PL:Obj:strings.o \ No newline at end of file diff --git a/appleworksgs/PL/Src/CLICK.S b/appleworksgs/PL/Src/CLICK.S new file mode 100755 index 0000000..acb8254 --- /dev/null +++ b/appleworksgs/PL/Src/CLICK.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_IsAlphaNum IMPORT D_IsDigit IMPORT D_IsLetter IMPORT P_KillUndo IMPORT P_Local2PL IMPORT P_TrackCursor IMPORT T_ClickCount IMPORT T_Dot IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_DotPixs IMPORT T_DrawRuler IMPORT T_EraseCaret IMPORT T_GetLinePtr IMPORT T_GetTextPtr IMPORT T_InvSelect IMPORT T_InvertArea IMPORT T_JunkLeft IMPORT T_JunkRight IMPORT T_LastOffset IMPORT T_LastParag IMPORT T_Mark IMPORT T_MarkLine IMPORT T_MarkObj IMPORT T_MarkOffset IMPORT T_MarkParag IMPORT T_MarkPixs IMPORT T_NextChar IMPORT T_Offset2Pix IMPORT T_Pt2Offset IMPORT T_TextSelect ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_InWord ENTRY T_SelectLine ENTRY T_SelectWord ENTRY T_WordBounds ;-------------------------------------------------------------------------- ; ; T_SwapDotMark () ; T_SwapDotMark PROC EXPORT ;Using T_Data lda T_DotParag ldx T_MarkParag sta T_MarkParag stx T_DotParag lda T_DotOffset ldx T_MarkOffset sta T_MarkOffset stx T_DotOffset lda T_DotLine ldx T_MarkLine sta T_MarkLine stx T_DotLine lda T_DotPixs ldx T_MarkPixs sta T_MarkPixs stx T_DotPixs pushlong T_DotObj movelong T_MarkObj,T_DotObj pulllong T_MarkObj rtl ENDP ;------------------------------------------------------------------------------; ; ; T_Click (ObjHdl:l; Pt:l; ModFlags:w; Click:w) ; ; ThePoint should be in local coordinates. T_Click PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT ObjHdl:l,Pt:l,ModFlags:w,Click:w LOCAL ObjPtr:l LOCAL NewParag:w,NewLine:w,NewOffset:w,NewPixs:w,NewObj:l LOCAL EndPixs:w,EndPos:w,StartPixs:w,StartPos:w BEGIN jsl P_KillUndo jsl T_EraseCaret in ObjHdl:l,Pt:l out NewParag:w,NewOffset:w,NewLine:w,NewPixs:w xcall T_Pt2Offset movelong ObjHdl,NewObj lda Click cmp #1 jeq SingleClick cmpw NewParag,T_LastParag bne SingleClick cmpw NewOffset,T_LastOffset bne SingleClick lda T_ClickCount beq SingleClick cmp #1 beq DoubleClick TripleClick inc T_ClickCount inc T_TextSelect jsl T_InvSelect spacelong spacelong pushword NewParag pushword NewLine jsl T_SelectLine bra InitSelect DoubleClick inc T_ClickCount inc T_TextSelect jsl T_InvSelect spacelong spacelong pushword NewParag pushword NewOffset pushword NewLine jsl T_SelectWord InitSelect pullword T_MarkPixs pullword T_MarkOffset pullword T_DotPixs pullword T_DotOffset moveword NewParag,T_DotParag moveword a,T_MarkParag moveword NewLine,T_DotLine moveword a,T_MarkLine inc T_TextSelect jsl T_InvSelect brl DragLoop SingleClick moveword #1,T_ClickCount lda ModFlags and #ShiftKey beq ShiftUp lda T_TextSelect beq _NoSelect cmpw NewParag,T_DotParag blt Swap cmpw NewOffset,T_DotOffset bge ToAdd Swap jsl T_SwapDotMark ToAdd brl AddSelect _NoSelect movelong T_Dot,T_Mark movelong T_Dot+4,T_Mark+4 movelong T_Dot+8,T_Mark+8 brl AddSelect ShiftUp jsl T_InvSelect moveword NewParag,T_DotParag sta T_MarkParag moveword NewOffset,T_DotOffset sta T_MarkOffset moveword NewLine,T_DotLine sta T_MarkLine moveword NewPixs,T_DotPixs sta T_MarkPixs movelong NewObj,T_DotObj movelong NewObj,T_MarkObj DragLoop tool _StillDown,in=(#0:w),out=(a:w) jeq Up tool _GetMouse,in=(!Pt:l) call P_TrackCursor,in=(!Pt:l) rcall P_Local2PL,in=(Pt:ax),out=(Pt:ax) in ObjHdl:l,Pt:l out NewParag:w,NewOffset:w,NewLine:w,NewPixs:w xcall T_Pt2Offset lda T_ClickCount cmp #1 beq AddSelect cmp #2 beq ByWord ByLine spacelong spacelong pushword NewParag pushword NewLine jsl T_SelectLine bra SetNew ByWord spacelong spacelong pushword NewParag pushword NewOffset pushword NewLine jsl T_SelectWord SetNew pullword EndPixs pullword EndPos pullword StartPixs pullword StartPos cmpw StartPos,T_Dot blt GoingUp moveword EndPos,NewOffset moveword EndPixs,NewPixs bra AddSelect GoingUp moveword StartPos,NewOffset moveword StartPixs,NewPixs AddSelect in T_MarkObj:l,T_MarkParag:w,T_MarkLine:w,T_MarkPixs:w in NewObj:l,NewParag:w,NewLine:w,NewPixs:w xcall T_InvertArea movelong NewObj,T_MarkObj moveword NewParag,T_MarkParag moveword NewOffset,T_MarkOffset moveword NewLine,T_MarkLine moveword NewPixs,T_MarkPixs brl DragLoop Up moveword NewOffset,T_LastOffset moveword NewParag,T_LastParag stz T_TextSelect cmpw T_DotParag,T_MarkParag beq SameParag blt InOrder bra DoSwap SameParag rcall T_JunkRight,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffset cmpw T_DotOffset,T_MarkOffset beq NoSelect2 blt InOrder DoSwap jsl T_SwapDotMark InOrder inc T_TextSelect rcall T_JunkLeft,in=(T_MarkParag:a,T_MarkOffset:x) sta T_MarkOffset ; Cmpw T_DotOffSet,#T_ParHeader ; bne DoJunkLeft rcall T_JunkRight,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffset bra DoRuler NoSelect2 DoJunkLeft rcall T_JunkLeft,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffset DoRuler call T_DrawRuler Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_SelectWord (Parag:w,Pos:w,Q_Line:w): StartPos:w,StartPixs:w,EndPos:w,EndPixs:w ; T_SelectWord PROC EXPORT ;Using T_Data INPUT Parag:w,Pos:w,Q_Line:w OUTPUT StartPos:w,StartPixs:w,EndPos:w,EndPixs:w BEGIN in Parag:w,Pos:w,Q_Line:w out StartPos:w,EndPos:w xcall T_WordBounds in T_DotObj:l,Parag:w,StartPos:w,Q_Line:w out StartPixs:w xcall T_Offset2Pix in T_DotObj:l,Parag:w,EndPos:w,Q_Line:w out EndPixs:w xcall T_Offset2Pix Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; ; T_WordBounds (ParagNo:w,Offset:w,LineNo:w) : StartOffset:w,EndOffset:w ; ; 'Word' is explicitly defined in Apple's Human Interface ; Guidelines, with the exception that words are ; necessarily confined to a single Q_Line. ; T_WordBounds PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,Offset:w,LineNo:w OUTPUT StartOffset:w,EndOffset:w LOCAL LinePtr:l,TextPtr:l,CurOffset:w,Started:w LOCAL GotLetter:w,GotDigit:w BEGIN rcall T_GetLinePtr,in=(ParagNo:a,LineNo:x),out=(LinePtr:ax) moveword [LinePtr],StartOffset addword a,[LinePtr]:#T_Length,EndOffset rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) moveword StartOffset,CurOffset stz Started ldy StartOffset lda [TextPtr],y and #$ff cmp #CR jeq GotWord ; Loop through the characters in the current Q_Line CLoop jsl T_InWord bcs NotNormal stz GotLetter stz GotDigit jsl D_IsLetter bcs NotLetter inc GotLetter bra NotDigit NotLetter jsl D_IsDigit bcs NotDigit inc GotDigit NotDigit lda Started ; am I in the middle of a word? jne GetNext inc Started ; if not, I am now! bra GotStart notnormal cmp #'''' beq @1 cmp #'' bne notapostrophe @1 lda GotDigit ora GotLetter beq Alone rcall T_NextChar,in=(ParagNo:a,CurOffset:x),out=(a:y) lda [TextPtr],y and #$ff jsl D_IsDigit bcc GetNext jsl D_IsLetter bcc GetNext bra Alone NotApostrophe cmp #'.' bne NotPeriod rcall T_NextChar,in=(ParagNo:a,CurOffset:x),out=(a:y) lda [TextPtr],y and #$ff jsl D_IsDigit bcs Alone lda Started bne GetNext inc Started bra GotStart NotPeriod cmp #',' bne NotComma lda GotDigit beq Alone rcall T_NextChar,in=(ParagNo:a,CurOffset:x),out=(a:y) lda [TextPtr],y and #$ff jsl D_IsDigit bcc GetNext NotComma cmp #$CA ; non-breaking space. bne alone lda Started bne GetNext inc Started bra GotStart Alone stz Started GotStart ldy CurOffset cpy Offset bge GotWord sty StartOffset GetNext ldy CurOffset cpy EndOffset ; have I reached the end of the Q_Line? bgt GotWord ; if so, stop no matter what. rcall T_NextChar,in=(ParagNo:a,CurOffset:x),out=(CurOffset:a) tay lda [TextPtr],y and #$ff cmp #CR ; repeat unless at the end of the jne CLoop ; current paragraph. GotWord moveword CurOffset,EndOffset RETURN ENDP ;------------------------------------------------------------------------------ ; ; Can the char in A be part of a word (no matter what)? ; ; T_InWord PROC EXPORT jsl D_IsAlphaNum bcc yes_w cmp #'-' beq yes_w cmp #'$' beq yes_w cmp #'%' beq yes_w cmp #'' beq yes_w cmp #'' beq yes_w cmp #'' beq yes_w cmp #'' beq yes_w sec rtl yes_w clc rtl ENDP ;------------------------------------------------------------------------------ ; ; T_SelectLine (ParagNo:w,LineNo:w) : StartPos:w,StartPixs:w,EndPos:w,EndPixs:w ; T_SelectLine PROC EXPORT ;Using T_TextEqu ;Using T_Data INPUT ParagNo:w,LineNo:w OUTPUT StartPos:w,StartPixs:w,EndPos:w,EndPixs:w LOCAL LinePtr:l BEGIN rcall T_GetLinePtr,in=(ParagNo:a,LineNo:x),out=(LinePtr:ax) moveword [LinePtr],StartPos addword a,[LinePtr]:#T_Length,EndPos in T_DotObj:l,ParagNo:w,EndPos:w,LineNo:w out EndPixs:w xcall T_Offset2Pix stz StartPixs RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/EDIT.S b/appleworksgs/PL/Src/EDIT.S new file mode 100755 index 0000000..38fccc2 --- /dev/null +++ b/appleworksgs/PL/Src/EDIT.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_BeachBall IMPORT X_CopyOneHandle IMPORT D_Deref IMPORT D_FastMult IMPORT D_GrowHandle IMPORT D_NeedHand IMPORT P_CheckHand IMPORT P_FixMenus IMPORT T_ClearRulers IMPORT T_CopyParEnd IMPORT T_CurColor IMPORT T_CurFont IMPORT T_CurParHdl IMPORT T_CurStyle IMPORT T_DeletePars IMPORT T_DotLine IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_FixParag IMPORT T_GetObjBound IMPORT T_GetParPtr IMPORT T_GetParSize IMPORT T_GetTextPtr IMPORT T_InvSelect IMPORT T_JunkLeft IMPORT T_JunkRight IMPORT T_LessRoom IMPORT T_MarkOffset IMPORT T_MarkParag IMPORT T_MulParag IMPORT T_NewParHdl IMPORT T_NewPars IMPORT T_PastePar IMPORT T_SetRulers IMPORT T_TextSelect IMPORT T_TrackFont IMPORT T_UnuseRuler IMPORT T_UpdatePars IMPORT P_RedoFlag IMPORT T_InsertFont ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_ClearPrim ENTRY T_CopyPrim ENTRY T_CopyText ENTRY T_MakeParStyle ;------------------------------------------------------------------------------ ; ; T_Clear () ; T_Clear PROC EXPORT ;Using T_Data ;Using T_TextEqu LOCAL CharCount:w,Temp:w,Ptr:l,StyleCount:w,DotPtr:l BEGIN jsl T_InvSelect pushword T_DotOffSet lda T_TextSelect jeq Exit jsl T_MakeParStyle cmpw T_DotOffset,#T_ParHeader beq NoJunk rcall T_JunkLeft,in=(T_MarkParag:a,T_MarkOffset:x) sta T_MarkOffset NoJunk rcall T_JunkRight,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffset in T_DotParag:w,T_DotOffset:w,T_MarkParag:w,T_MarkOffset:w out CharCount:w xcall T_ClearPrim bcs Exit stz T_TextSelect call T_FixParag,in=(T_DotParag:w,T_DotLine:w,CharCount:w) jsl P_FixMenus Exit pullword T_DotOffSet RETURN ENDP ******************************************************************** * * * T_MakeParStyle * This routine takes any style changes at the end of a selection (T_MarkOffSet) * and puts them in the parheader. * * Wednesday, September 6, 1989 4:44:21 PM (SFS) ******************************************************************** T_MakeParStyle PROC EXPORT LOCAL Temp:w,Ptr:l,StyleCount:w,DotPtr:l BEGIN cmpw T_DotOffset,#T_ParHeader bne Exit moveword T_MarkOffSet,Temp rcall T_JunkRight,in=(T_MarkParag:a,T_MarkOffset:x) sta T_MarkOffSet cmp Temp beq Exit subword T_MarkOffSet,Temp,StyleCount rcall T_GetTextPtr,in=(T_MarkParag:a),out=(Ptr:ax) rcall T_GetTextPtr,in=(T_DotParag:a),out=(DotPtr:ax) FontLoop ldy Temp lda [ptr],y jsr MakeMasterFont lda StyleCount bne FontLoop Exit Return MakeMasterFont and #$ff Shortm asl a tax iny lda [Ptr],y ;get the change value jmp (JumpTable,x) DoFont ldy #T_ParFont sta [DotPtr],y iny inc temp phy ldy temp iny lda [Ptr],y ply dec StyleCount bra AllDone DoStyle ldy #T_ParStyle bra AllDone DoSize ldy #T_ParSize bra AllDone DoColor ldy #T_ParColor AllDone sta [DotPtr],y inc temp inc temp dec StyleCount dec StyleCount Next longm rts JumpTable ds.b 2 ;nothing dc.w DoFont dc.w DoStyle dc.w DoSize dc.w Docolor EndP ;------------------------------------------------------------------------------ ; ; T_Paste (PasteHdl:l,MoveDot:w) ; T_Paste PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT PasteHdl:l,MoveDot:w LOCAL Ptr:l,NewTextHdl:l,RulerHdl:l,FirstRuler:l,NewPCount:w LOCAL Hdl:l,Dest:l,CharCount:w,BytesLess:w,CopySize:w LOCAL ParagPtr:l,TextBlock:l,TPtr:l,Offset:w LOCAL SPar:w,NewParag:w,NewOffset:w LOCAL ParagPtr1:l,ParagPtr2:l,ParOffset1:w,ParOffset2:w,ParagNo:w LOCAL TextHdl1:l,TextHdl2:l,TextPtr1:l,TextPtr2:l,OldTextHdl:l LOCAL TextSize1:w,TextSize2:w,ParDiff:w LOCAL TempHdl:l,TempPtr:l,OldDot:w ERROR Err BEGIN stz Err jsl T_Clear * This prevents style changes from leaking over into other text. (SFS 8/30/89) DoJunk moveword T_DotOffSet,OldDot rcall T_JunkRight,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffset NoJunk moveword T_DotParag,SPar movelong [PasteHdl],Ptr movelong [Ptr]:#T_TextBlock,NewTextHdl movelong [Ptr]:#T_RulerHdl,FirstRuler cmpw T_DotOffset,#T_ParHeader bne NotStart rcall T_GetParPtr,in=(SPar:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_RulerHdl,RulerHdl movelong FirstRuler,[ParagPtr]:#T_RulerHdl rcall T_UnuseRuler,in=(RulerHdl:ax) bra DoIt NotStart rcall T_UnuseRuler,in=(FirstRuler:ax) DoIt movelong [PasteHdl],Ptr subword [Ptr],#1,NewPCount bne MakeNew in SPar:w,T_DotOffset:w,NewTextHdl:l out CharCount:w xcall T_PastePar addword a,T_DotOffset,T_MarkOffset lda MoveDot beq NoMove moveword T_MarkOffset,T_DotOffset NoMove call T_FixParag,in=(SPar:w,T_DotLine:w,CharCount:w) brl Exit MakeNew lda SPar inc a sta NewParag movelong T_CurParHdl,TempHdl movelong [TempHdl],TempPtr moveword [TempPtr],a dec a cmp NewParag bge ValidPar dec NewParag ValidPar ; Make sure that the text from the paragraph with the insertion point ; is in a different text block than the text from the next paragraph. rcall T_GetParPtr,in=(SPar:a),out=(ParagPtr1:ax) rcall T_GetParPtr,in=(NewParag:a),out=(ParagPtr2:ax) movelong [ParagPtr1]:#T_TextBlock,TextHdl1 movelong [ParagPtr2]:#T_TextBlock,TextHdl2 moveword [ParagPtr1]:#T_ParOffset,ParOffset1 moveword [ParagPtr2]:#T_ParOffset,ParOffset2 cmpl TextHdl1,TextHdl2 jne Okay ; Allocate the new text block movelong [TextHdl1],TextPtr1 moveword [TextPtr1]:#T_TextSize,TextSize1 subword a,ParOffset2,TextSize2 subword TextSize1,TextSize2,TextSize1 addword TextSize2,#T_BlockHdrSize,TextSize2 call D_NeedHand,in=(#0:w,TextSize2:w),out=(TextHdl2:l) ; Fill in the new text block movelong [TextHdl2],TextPtr2 moveword TextSize2,[TextPtr2] moveword a,[TextPtr2]:#T_TextSize movelong [TextHdl1],TextPtr1 addwl ParOffset2,TextPtr1 addwl #T_BlockHdrSize,TextPtr2 subword TextSize2,#4,TextSize2 tool _BlockMove,in=(TextPtr1:l,TextPtr2:l,#0:w,TextSize2:w) ; Adjust the paragraphs starting at NewParag subword ParOffset2,#T_BlockHdrSize,ParDiff moveword NewParag,ParagNo Loop rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr2:ax) movelong [ParagPtr2]:#T_TextBlock,OldTextHdl cmpl TextHdl1,OldTextHdl bne EndLoop movelong TextHdl2,[ParagPtr2]:#T_TextBlock subword [ParagPtr2]:#T_ParOffset,ParDiff,[ParagPtr2]:#T_ParOffset inc ParagNo bra Loop EndLoop ; Shrink the old text block movelong [TextHdl1],TextPtr1 moveword TextSize1,[TextPtr1] moveword a,[TextPtr1]:#T_TextSize tool _SetHandleSize,in=(#0:w,TextSize1:w,TextHdl1:l) Okay ; Handle the first paragraph ; Copy the end of it, delete it, and paste in D_New stuff. call T_CopyParEnd,in=(SPar:w,T_DotOffset:w),out=(Hdl:l) rcall T_GetParSize,in=(SPar:a),out=(a:a) subword a,T_DotOffset,a dec a ;Keep CR sta BytesLess call T_LessRoom,in=(SPar:w,T_DotOffset:w,BytesLess:w) in SPar:w,T_DotOffset:w,NewTextHdl:l out a:w xcall T_PastePar ; Make room for D_New paragraphs and copy them in moveword SPar,NewParag inc NewParag call T_NewPars,in=(NewParag:w,NewPCount:w) movelong [PasteHdl],Ptr addlong Ptr,#T_ParInfoSize+2,s rcall T_GetParPtr,in=(NewParag:a),out=(Dest:ax) addlong Dest,#2,s rcall D_FastMult,in=(NewPCount:x,#T_ParInfoSize:y),out=(CopySize:a) pushword #0 pushword a _BlockMove ; Handle the paragraph part that got put into Hdl by appending it to the ; last paragraph addword SPar,NewPCount,NewParag rcall T_GetParPtr,in=(NewParag:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_TextBlock,TextBlock movelong [TextBlock],TPtr subword [TPtr]:#T_TextSize,#5,NewOffset ;No CR call T_PastePar,in=(NewParag:w,NewOffset:w,Hdl:l),out=(a:w) lda P_RedoFlag bne N1 moveword NewParag,T_MarkParag moveword NewOffset,T_MarkOffset N1 lda MoveDot beq NoMove1 moveword NewParag,T_DotParag moveword NewOffset,T_DotOffset bra NoMove2 NoMove1 moveword OldDot,T_DotOffSet NoMove2 call T_UpdatePars,in=(SPar:w,NewParag:w) Exit tool _DisposeHandle,in=(PasteHdl:l) stz P_RedoFlag RETURN ENDP ;------------------------------------------------------------------------------; ; ; T_Copy () : CopyHdl:l ; T_Copy PROC EXPORT ;Using P_ObjData ;Using T_Data OUTPUT CopyHdl:l LOCAL Start:w,End:w,Amount:w,Ptr:l ERROR Err BEGIN stzl CopyHdl lda T_TextSelect beq Exit pushword T_DotOffset * this garruantees that the correct style changes are always copied (SFS 8/30/89) rcall T_JunkRight,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffset in T_CurParHdl:l,T_DotParag:w,T_DotOffset:w in T_MarkParag:w,T_MarkOffset:w out CopyHdl:l xerr Err xcall T_CopyPrim pullword T_DotOffset Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_ClearPrim (SPar:w,SOffset:w,EPar:w,EOffset:w) : CharCount:w ; T_ClearPrim PROC EXPORT ;Using T_TextEqu ;Using T_Data INPUT SPar:w,SOffset:w,EPar:w,EOffset:w OUTPUT CharCount:w ERROR Err LOCAL ParCount:w,Hdl:l LOCAL Bytes:w,ParagPtr:l BEGIN stz Err subword EPar,SPar,ParCount bne Case2 ; No CRs are being deleted. Just use LessRoom subword EOffset,SOffset,Bytes call T_LessRoom,in=(SPar:w,SOffset:w,Bytes:w) brl Exit Case2 call T_CopyParEnd,in=(EPar:w,EOffset:w),out=(Hdl:l),err=(Err) bcs Exit addword SPar,#1,s pushword ParCount jsl T_DeletePars rcall T_GetParSize,in=(SPar:a),out=(a:a) dec a ; remove CR subword a,SOffset,Bytes call T_LessRoom,in=(SPar:w,SOffset:w,Bytes:w) call T_PastePar,in=(SPar:w,SOffset:w,Hdl:l),out=(CharCount:w) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; T_CopyPrim (SrcHdl:l,SPar:w,SOffset:w,EPar:w,EOffset:w): ParagHdl:l ; T_CopyPrim PROC EXPORT ;Using T_TextEqu ;Using T_Data INPUT SrcHdl:l,SPar:w,SOffset:w,EPar:w,EOffset:w OUTPUT ParagHdl:l ERROR Err LOCAL ParagPtr:l,SrcPtr:l,TextBlock:l,RulerHdl:l,NewRuler:l LOCAL CurBlock:l,Ptr:l,CurPar:w,NPar:w,LPar:w LOCAL ByteCount:w,Size:w,PCount:w,StartOffset:w LOCAL DotBlock:l,MarkBlock:l,ParSize:w,ParOffset:w LOCAL Estimate:l BEGIN stzl ParagHdl moveword SPar,CurPar moveword #100,Estimate stz Estimate+2 EstLoop rcall T_GetParSize,in=(SPar:a),out=(a:a) addword a,#78,a addwl a,Estimate inc CurPar cmpw EPar,CurPar bge EstLoop call P_CheckHand,in=(Estimate:l),err=(Err) jcs Exit subword EPar,SPar,LPar inc a sta PCount jsl T_MulParag sta ByteCount addword a,#2,a call D_NeedHand,in=(#0:w,a:w),out=(ParagHdl:l) rcall D_Deref,in=(ParagHdl:ax),out=(ParagPtr:ax) moveword PCount,[ParagPtr] ;set ParagCount movelong [SrcHdl],SrcPtr lda SPar jsl T_MulParag addword a,#2,a addlong a,SrcPtr,s addlong #2,ParagPtr,s pushword #0 pushword ByteCount _BlockMove rcall T_GetTextPtr,in=(SPar:a),out=(ax:ax) call T_TrackFont,in=(ax:l,SOffset:w) ; Make room for paragraph header subword SOffset,#T_ParHeader,SOffset cmpw PCount,#1 bne NotOne in SPar:w,SOffset:w,EOffset:w,#0:l,#1:w out DotBlock:l,a:w xcall T_CopyText brl Cont NotOne rcall T_GetParSize,in=(SPar:a),out=(ParSize:a) in SPar:w,SOffset:w,ParSize:w,#0:l,#0:w out DotBlock:l,a:w xcall T_CopyText in EPar:w,#0:w,EOffset:w,#0:l,#1:w out MarkBlock:l,a:w xcall T_CopyText Cont movelong [DotBlock],Ptr moveword T_CurFont,[Ptr]:#4 moveword T_CurStyle,[Ptr]:#6 movebyte T_CurColor,[Ptr]:#8 movelong DotBlock,[ParagPtr]:#T_TextBlock moveword #4,[ParagPtr]:#T_ParOffset moveword SPar,CurPar stzl CurBlock ParLoop jsl D_BeachBall ; Copy the Q_Text if not the first or last par lda CurPar cmp SPar beq CopyRuler cmp EPar beq DoLast rcall T_GetParSize,in=(CurPar:a),out=(ParSize:a) in CurPar:w,#0:w,ParSize:w,CurBlock:l,#0:w out CurBlock:l,ParOffset:w xcall T_CopyText movelong CurBlock,[ParagPtr]:#T_TextBlock moveword ParOffset,[ParagPtr]:#T_ParOffset bra CopyRuler DoLast movelong MarkBlock,[ParagPtr]:#T_TextBlock moveword #4,[ParagPtr]:#T_ParOffset ; Copy the ruler if necessary CopyRuler movelong [ParagPtr]:#T_RulerHdl,RulerHdl lda RulerHdl+2 and #$8000 bne Copied call X_CopyOneHandle,in=(RulerHdl:l),out=(NewRuler:l) pushlong T_CurParHdl movelong ParagHdl,T_CurParHdl subword CurPar,SPar,NPar call T_SetRulers,in=(NewRuler:l,RulerHdl:l,NPar:w,LPar:w,#0:w) pulllong T_CurParHdl Copied movelong #0,[ParagPtr]:#T_LinesHdl addwl #T_ParInfoSize,ParagPtr inc CurPar cmpw CurPar,EPar jle ParLoop tool _HUnlock,in=(ParagHdl:l) ; Clean up marks pushlong T_CurParHdl movelong ParagHdl,T_CurParHdl call T_ClearRulers,in=(#0:w,LPar:w) pulllong T_CurParHdl Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_CopyText (ParagNo:w,Start:w,End:w,TextBlock:l,AddCR:w) : D_NewText:l ; ; Only works on the current Q_Text thread. ; Assumes the Q_Text fits in the block. T_CopyText PROC EXPORT INPUT ParagNo:w,Start:w,End:w INPUT TextBlock:l,AddCR:w OUTPUT D_NewText:l,ParOffset:w LOCAL TextPtr:l,BPtr:l,AddSize:w,OldSize:w,NewSize:w BEGIN subword End,Start,a ldy AddCR beq No inc a No sta AddSize cpzl TextBlock bne Made NewBlock call D_NeedHand,in=(#4:l),out=(TextBlock:l) jcs Exit moveword #4,OldSize bra AddIt Made movelong [TextBlock],BPtr moveword [BPtr],OldSize addword a,AddSize,a bcs NewBlock cmp #$C00 bge NewBlock AddIt addword AddSize,OldSize,NewSize call D_GrowHandle,in=(#0:w,a:w,TextBlock:l) bcs Exit rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) lda Start addlong a,TextPtr,s ;Src movelong [TextBlock],BPtr lda OldSize addlong a,BPtr,s ;Dest pushword #0 pushword AddSize _BlockMove moveword NewSize,[BPtr] moveword a,[BPtr]:#2 lda AddCR beq No2 ldy NewSize dey movebyte #CR,[BPtr]:y No2 movelong TextBlock,D_NewText subword NewSize,AddSize,ParOffset Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_CpyOrClrObj (ObjPtr:l,D_DoCopy:w) : CopyHdl:l ; ; Makes a copy of the Q_Text for the object or clears it from the Q_Text thread, ; depending on whether D_DoCopy is set or not. T_CpyOrClrObj PROC EXPORT ;Using P_ObjData ;Using T_Data INPUT ObjPtr:l,D_DoCopy:w OUTPUT CopyHdl:l ERROR Err LOCAL SPar:w,SOffset:w,EPar:w,EOffset:w,IsEmpty:w BEGIN +B stz Err pushlong T_CurParHdl movelong [ObjPtr]:#P_ParagHdl,T_CurParHdl call T_GetObjBound,in=(ObjPtr:l,#1:w),out=(SPar:w,SOffset:w) call T_GetObjBound,in=(ObjPtr:l,#0:w),out=(EPar:w,EOffset:w) stz IsEmpty cmpw SPar,EPar bne NotEmpty cmpw SOffset,EOffset bne NotEmpty inc IsEmpty NotEmpty lda D_DoCopy bne @Copy lda IsEmpty bne Exit call T_ClearPrim,in=(SPar:w,SOffset:w,EPar:w,EOffset:w),out=(a:w) bra Exit @Copy lda IsEmpty bne MakeNew in T_CurParHdl:l,SPar:w,SOffset:w,EPar:w,EOffset:w out CopyHdl:l xerr Err xcall T_CopyPrim bra Exit MakeNew call T_NewParHdl,out=(CopyHdl:l) Exit pulllong T_CurParHdl RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/FORMAT.S b/appleworksgs/PL/Src/FORMAT.S new file mode 100755 index 0000000..056d953 --- /dev/null +++ b/appleworksgs/PL/Src/FORMAT.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_CheckMenuFID IMPORT D_IsLetter IMPORT D_ToLowerTable IMPORT D_ToUpperTable IMPORT P_BuildUndo IMPORT P_SetFormat IMPORT T_BumpParags IMPORT T_CalcFBytes IMPORT T_CurColor IMPORT T_CurFont IMPORT T_CurSize IMPORT T_CurStyle IMPORT T_DoRoom IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_FontFlags IMPORT T_GetParPtr IMPORT T_GetParSize IMPORT T_GetRulBits IMPORT T_GetTextPtr IMPORT T_JunkLeft IMPORT T_JunkRight IMPORT T_MarkLine IMPORT T_MarkObj IMPORT T_MarkOffset IMPORT T_MarkParag IMPORT T_NewAddStyle IMPORT T_NewColor IMPORT T_NewFont IMPORT T_NewSize IMPORT T_NewSubStyle IMPORT T_NextChar IMPORT T_Offset2Line IMPORT T_PrevChar IMPORT T_RecutParag IMPORT T_Refresh IMPORT T_TextSelect IMPORT T_TrackFont IMPORT T_WriteFBytes ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_ChangeCase ENTRY T_IsSpace ;------------------------------------------------------------------------------ ; ; T_UpdatePars (SPar:w,EPar:w) ; T_UpdatePars PROC EXPORT ;Using T_Data ;Using T_TextEqu input SPar:w,EPar:w local ParagPtr:l,ObjHdl:l,VertPos:w begin rcall T_GetParPtr,in=(SPar:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_ObjHdl,ObjHdl moveword [ParagPtr]:#T_ParStart,VertPos ParLoop in ObjHdl:l,SPar:w,VertPos:w out ObjHdl:l,VertPos:w xcall T_RecutParag rcall T_GetParPtr,in=(SPar:a),out=(ParagPtr:ax) tool _DisposeHandle,in=([ParagPtr]:#T_LinesHdl:l) movelong #0,[ParagPtr]:#T_LinesHdl inc SPar cmpw EPar,SPar bge ParLoop Bump call T_BumpParags,in=(SPar:w,ObjHdl:l,VertPos:w,#0:w) lda T_TextSelect beq No in T_DotParag:w,T_DotOffset:w out T_DotObj:l,T_DotLine:w xcall T_Offset2Line in T_MarkParag:w,T_MarkOffset:w out T_MarkObj:l,T_MarkLine:w xcall T_Offset2Line No call T_Refresh return ENDP ;------------------------------------------------------------------------------- ; ; T_DoChange (ChangeByte:w,Data:w,Data2:w) ; T_DoChange PROC EXPORT ;Using T_Data ;Using T_TextEqu input ChangeByte:w,Data:w,Data2:w local CurPar:w,TextPtr:l begin moveword T_DotParag,CurPar ldy T_DotOffset cpy #T_ParHeader+1 blt ParLoop rcall T_GetTextPtr,in=(CurPar:a),out=(TextPtr:ax) ldy T_DotOffset jsr FlipStuff inc CurPar ParLoop lda CurPar cmp T_MarkParag bgt EndLoop rcall T_GetTextPtr,in=(a:a),out=(TextPtr:ax) ldy #T_ParHeader jsr FlipStuff lda ChangeByte dec a asl a tax lda Table,x tay jsr (JumpTable,x) inc CurPar bra ParLoop EndLoop return FlipStuff CharLoop cmpw CurPar,T_MarkParag blt Skip cpy T_MarkOffset bge EndLoop2 Skip lda [TextPtr],y iny and #$ff cmp #CR beq EndLoop2 cmp ChangeByte beq FlipIt cmp #T_ColorChange+1 bge CharLoop iny cmp #T_FontChange bne CharLoop iny bra CharLoop EndLoop2 rts FlipIt lda ChangeByte dec a asl a tax jsr (JumpTable,x) iny bra CharLoop DoFont moveword Data,[TextPtr]:y iny rts DoStyle shortm lda Data ora Data2 beq SetStyle lda Data2 eor #$ff and [TextPtr],y ora Data SetStyle sta [TextPtr],y longm rts DoSize DoColor shortm moveword Data,[TextPtr]:y longm rts JumpTable DC.W DoFont DC.W DoStyle DC.W DoSize DC.W DoColor Table DC.W 0 DC.W 2 DC.W 3 DC.W 4 ENDP ;----------------------------------------------------------------------------- ; ; T_InsertFont (ParagNo:w,Offset:w,Mode:w) : Room:w ; ; If Mode is true, the style is set to T_NewAddStyle. Otherwise T_NewAddStyle ; is added and T_NewSubStyle is subtracted. T_InsertFont PROC EXPORT ;Using T_Data ;Using T_TextEqu input ParagNo:w,Offset:w,Mode:w OUTPUT Room:w local LeftOffset:w,RightOffset:w,SFlag:w,EFlag:w local LeftFont:l,RightFont:l,LeftColor:w,RightColor:w local TextPtr:l begin stz SFlag stz EFlag stz Room rcall T_JunkLeft,in=(ParagNo:a,Offset:x),out=(LeftOffset:a) cmp #T_ParHeader bne DoRight inc SFlag DoRight rcall T_JunkRight,in=(ParagNo:a,Offset:x),out=(RightOffset:a) rcall T_GetParSize,in=(ParagNo:a),out=(a:a) dec a cmp RightOffset bne DoTrack inc EFlag DoTrack rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) call T_TrackFont,in=(TextPtr:l,LeftOffset:w) movelong T_CurFont,LeftFont moveword T_CurColor,LeftColor call T_TrackFont,in=(TextPtr:l,RightOffset:w) movelong T_CurFont,RightFont moveword T_CurColor,RightColor ; Check Font lda T_FontFlags and #T_FontFl beq DidFont moveword T_NewFont,RightFont ldy SFlag beq DidFont moveword a,[TextPtr]:#T_ParFont DidFont ; Check Style lda T_FontFlags and #T_StyleFl beq DidStyle shortm lda Mode beq Normal lda T_NewAddStyle bra StoreStyle Normal lda T_NewAddStyle ora T_NewSubStyle beq StoreStyle lda RightFont+2 ora T_NewAddStyle sta RightFont+2 lda T_NewSubStyle eor #$ff and RightFont+2 StoreStyle sta RightFont+2 ldy SFlag beq Long1 moveword a,[TextPtr]:#T_ParStyle Long1 longm DidStyle ; Check Size lda T_FontFlags and #T_SizeFl beq DidSize shortm moveword T_NewSize,RightFont+3 ldy SFlag beq Long2 moveword a,[TextPtr]:#T_ParSize Long2 longm DidSize ; Do color lda T_FontFlags and #T_ColorFl beq DidColor shortm moveword T_NewColor,RightColor ldy SFlag beq Long3 moveword a,[TextPtr]:#T_ParColor Long3 longm DidColor lda SFlag bne Exit lda EFlag bne Exit in LeftFont:l,LeftColor:w,RightFont:l,RightColor:w out a:w xcall T_CalcFBytes addword a,LeftOffset,a subword a,RightOffset,Room ;Room = Bytes-(RightOffset-LeftOffset) call T_DoRoom,in=(ParagNo:w,LeftOffset:w,Room:w) rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) addwl LeftOffset,TextPtr in TextPtr:l,LeftFont:l,LeftColor:w,RightFont:l,RightColor:w xcall T_WriteFBytes Exit return ENDP ;------------------------------------------------------------------------------- ; ; T_ChangeFont () ; T_ChangeFont PROC EXPORT ;Using T_Data ;Using T_TextEqu local TextPtr:l,Offset:w,Room:w local EndFont:l,EndStyle:w,EndSize:w,EndColor:w begin call P_BuildUndo,in=(#0:w) rcall T_GetTextPtr,in=(T_MarkParag:a),out=(TextPtr:ax) rcall T_JunkRight,in=(T_MarkParag:a,T_MarkOffset:x),out=(Offset:a) call T_TrackFont,in=(TextPtr:l,Offset:w) moveword T_CurFont,EndFont shortm moveword T_CurStyle,EndStyle moveword T_CurSize,EndSize longm moveword T_CurColor,EndColor in T_DotParag:w,T_DotOffset:w,#0:w out Room:w xcall T_InsertFont addword a,T_DotOffset,T_DotOffset cmpw T_DotParag,T_MarkParag bne NotSame addword Room,T_MarkOffset,T_MarkOffset NotSame lda T_FontFlags and #T_FontFl beq TryStyle call T_DoChange,in=(#T_FontChange:w,T_NewFont:w,#0:w) TryStyle lda T_FontFlags and #T_StyleFl beq TrySize in #T_StyleChange:w,T_NewAddStyle:w,T_NewSubStyle:w xcall T_DoChange TrySize lda T_FontFlags and #T_SizeFl beq TryColor call T_DoChange,in=(#T_SizeChange:w,T_NewSize:w,#0:w) TryColor lda T_FontFlags and #T_ColorFl beq DidChanges call T_DoChange,in=(#T_ColorChange:w,T_NewColor:w,#0:w) DidChanges moveword EndFont,T_NewFont shortm moveword EndStyle,T_NewAddStyle moveword EndSize,T_NewSize moveword EndColor,T_NewColor longm call T_InsertFont,in=(T_MarkParag:w,T_MarkOffset:w,#1:w),out=(a:w) stz T_FontFlags call T_UpdatePars,in=(T_DotParag:w,T_MarkParag:w) return ENDP ;------------------------------------------------------------------------------- ; ; T_RangeFont () ; T_RangeFont PROC EXPORT ;Using T_Data ;Using T_TextEqu local TextPtr:l,ParagNo:w,Offset:w,OrStyles:w,AndStyles:w local Just:w,Spacing:w,RulBits:w,StyleMask:w begin moveword T_DotParag,ParagNo rcall T_GetRulBits,in=(a:a),out=(RulBits:a) and #T_AllJust sta Just lda RulBits and #T_AllSpacing sta Spacing rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) lda T_TextSelect jne DoSelect call T_TrackFont,in=(TextPtr:l,T_DotOffset:w) ; Check for any D_New font changes lda T_FontFlags jeq CheckIt and #T_FontFl beq NoFont moveword T_NewFont,T_CurFont NoFont lda T_FontFlags and #T_StyleFl beq NoStyle movebyte T_NewAddStyle,T_CurStyle NoStyle lda T_FontFlags and #T_SizeFl beq NoSize movebyte T_NewSize,T_CurSize NoSize lda T_FontFlags and #T_ColorFl beq NoColor moveword T_NewColor,T_CurColor NoColor brl CheckIt DoSelect rcall T_JunkRight,in=(ParagNo:a,T_DotOffset:x),out=(Offset:a) call T_TrackFont,in=(TextPtr:l,Offset:w) shortm moveword T_CurStyle,OrStyles moveword a,AndStyles longm NextChar cmpw ParagNo,T_MarkParag blt Okay cmpw Offset,T_MarkOffset jge Done Okay moveword [TextPtr]:Offset,a inc Offset and #$ff cmp #CR beq NextParag cmp #T_ColorChange+1 bge NextChar asl a tax jmp (JumpTable,x) DoFont cmpw [TextPtr]:Offset,T_CurFont beq SameFont moveword #$FFFF,T_CurFont SameFont inc Offset inc Offset brl NextChar DoStyle shortm ldy Offset moveword [TextPtr]:y,T_CurStyle ora OrStyles sta OrStyles moveword [TextPtr]:y,a and AndStyles sta AndStyles longm inc Offset brl NextChar DoSize shortm cmpw [TextPtr]:Offset,T_CurSize beq SameSize moveword #$FF,T_CurSize SameSize longm inc Offset brl NextChar DoColor shortm cmpw [TextPtr]:Offset,T_CurColor beq SameColor moveword #$FF,T_CurColor SameColor longm inc Offset brl NextChar NextParag inc ParagNo cmpw ParagNo,T_MarkParag blt Okay2 cmpw T_MarkOffset,#T_ParHeader jeq Done Okay2 rcall T_GetRulBits,in=(ParagNo:a),out=(RulBits:a) and #T_AllJust cmp Just beq JustSame stz Just JustSame lda RulBits and #T_AllSpacing cmp Spacing beq SpaceSame stz Spacing SpaceSame rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) cmpw [TextPtr],T_CurFont beq SameFont2 moveword #$FFFF,T_CurFont SameFont2 shortm ldy #T_ParStyle moveword [TextPtr]:y,T_CurStyle ora OrStyles sta OrStyles moveword [TextPtr]:y,a and AndStyles sta AndStyles cmpw [TextPtr]:#T_ParSize,T_CurSize beq SameSize2 moveword #$FF,T_CurSize SameSize2 cmpw [TextPtr]:#T_ParColor,T_CurColor beq SameColor2 moveword #$FF,T_CurColor SameColor2 longm moveword #T_ParHeader,Offset brl NextChar Done shortm lda OrStyles beq StyleSet moveword #$ff,T_CurStyle lda AndStyles beq StyleSet sta T_CurStyle StyleSet longm CheckIt call D_CheckMenuFID,in=(T_CurFont:l,T_CurColor:w) call P_SetFormat,in=(Just:w,Spacing:w) return JumpTable DC.W NextChar DC.W DoFont DC.W DoStyle DC.W DoSize DC.W DoColor ENDP ;------------------------------------------------------------------------------ ; ; T_Upper () ; T_Lower () ; T_Capit () ; T_Lower PROC EXPORT ;Using T_Data ;Using T_TextEqu EXPORT T_Upper EXPORT T_Capit EXPORT T_ChangeCase LOWER equ 0 UPPER equ 1 CAPIT equ 2 moveword #LOWER,>What bra T_ChangeCase T_Upper ; moveword #UPPER,>What bra T_ChangeCase T_Capit ; moveword #CAPIT,>What T_ChangeCase ; local TextPtr:l,CurOffset:w,CurParag:w,First:w,Char:w begin +b call P_BuildUndo,in=(#0:w) moveword T_DotOffset,CurOffset moveword T_DotParag,CurParag rcall T_GetTextPtr,in=(a:a),out=(TextPtr:ax) cmpw What,#Capit bne StartLoop stz First rcall T_PrevChar,in=(T_DotParag:a,T_DotOffset:x) tay beq ItsFirst lda [TextPtr],y and #$ff jsl T_IsSpace bcc StartLoop ItsFirst inc First bra StartLoop ; Loop through the selected characters Loop cmpw Char,#CR bne SamePar inc CurParag rcall T_GetTextPtr,in=(CurParag:a),out=(TextPtr:ax) moveword #T_ParHeader,CurOffset bra StartLoop SamePar ; BOGUS -- NextChar rcall T_NextChar,in=(CurParag:a,CurOffset:x),out=(CurOffset:a) StartLoop moveword [TextPtr]:CurOffset,a and #$ff sta Char cmpw CurParag,T_MarkParag blt CheckChar cmpw CurOffset,T_MarkOffset bge Update CheckChar rcall T_IsSpace,in=(Char:a) bcs IsSpace tax ldy What cpy #UPPER beq Up cpy #LOWER beq Down ldy First bne Up Down lda >D_ToLowerTable,x bra Cased Up lda >D_ToUpperTable,x Cased movebyte a,[TextPtr]:CurOffset stz First brl Loop IsSpace moveword #1,First brl Loop Update call T_UpdatePars,in=(T_DotParag:w,T_MarkParag:w) return What DS.B 2 ENDP ;------------------------------------------------------------------------------- ; ; T_IsSpace (Char:a) ; T_IsSpace PROC EXPORT cmp #32 beq GSpace cmp #TAB beq GSpace cmp #CR beq GSpace clc GSpace rtl ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/KEY.S b/appleworksgs/PL/Src/KEY.S new file mode 100755 index 0000000..9143f10 --- /dev/null +++ b/appleworksgs/PL/Src/KEY.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT P_BuildType IMPORT P_BuildUndo IMPORT P_FixMenus IMPORT P_Page IMPORT T_CalcFBytes IMPORT T_Clear IMPORT T_ClearBottom IMPORT T_CopyParEnd IMPORT T_CurColor IMPORT T_CurFont IMPORT T_CurStyleSize IMPORT T_CutParag IMPORT T_DeletePars IMPORT T_DoControl IMPORT T_DoRoom IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_DrawOneLine IMPORT T_DrawParag IMPORT T_DrawRuler IMPORT T_EraseCaret IMPORT T_FontFlags IMPORT T_GetParPtr IMPORT T_GetParSize IMPORT T_GetTextPtr IMPORT T_InsertFont IMPORT T_JunkRight IMPORT T_LockLines IMPORT T_MakeRoom IMPORT T_MovedDot IMPORT T_NewAddStyle IMPORT T_NewColor IMPORT T_NewFont IMPORT T_NewPars IMPORT T_NewSize IMPORT T_Offset2Line IMPORT T_OffsetPCount IMPORT T_PadThread IMPORT T_PastePar IMPORT T_PrevChar IMPORT T_RecutParag IMPORT T_TextSelect IMPORT T_TopLine IMPORT T_TrackFont IMPORT T_UseRuler IMPORT T_WriteFBytes IMPORT T_JunkLeft IMPORT T_JunkRight ;----------------------------------------------------------------------------- ; ; T_BumpParags (ParagNo:w; ObjHdl:l; ParStart:w; DoDraw:w); ; ; The starting position of ParagNo has changed. I need to recalculate all ; the paragraphs below this one until a paragraph doesn't move and D_Update the ; ones that are currently on the screen. ; ; ObjHdl is the object that ParagNo starts in. ; ParStart is the pixel count from the top of ObjHdl to the top of ParagNo. T_BumpParags PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,ObjHdl:l,ParStart:w,DoDraw:w LOCAL ParagPtr:l,ParagCount:w LOCAL ObjPtr:l,MaxVert:w,ParEnd:w LOCAL OldObj:l,OldParStart:w,OldParHeight:w BEGIN rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) moveword [ParagPtr],ParagCount movelong [ObjHdl],ObjPtr subword [ObjPtr]:#P_TRect+4,[ObjPtr]:#P_TRect,MaxVert ParLoop lda ParagNo cmp ParagCount jge EraseBottom rcall T_GetParPtr,in=(a:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_ObjHdl,OldObj moveword [ParagPtr]:#T_ParStart,OldParStart moveword [ParagPtr]:#T_ParHeight,OldParHeight cmpl ObjHdl,OldObj bne Recut cmpw ParStart,OldParStart jeq Done ; If it used to cross object boundaries, recut it. addword OldParStart,OldParHeight,a cmp MaxVert bge Recut ; If it crosses object boundaries for D_New ParStart, recut it. addword ParStart,OldParHeight,a sta ParEnd cmp MaxVert bge Recut ; Set the ParStart since it could have changed and redraw paragraph rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) moveword ParStart,[ParagPtr]:#T_ParStart lda DoDraw beq NextPar in ParagNo:w,#0:w,[ParagPtr]:#T_LineCount:w,ParStart:w xcall T_DrawParag bra NextPar Recut in ObjHdl:l,ParagNo:w,ParStart:w out ObjHdl:l,ParEnd:w xcall T_RecutParag lda DoDraw beq NoDraw in ParagNo:w,#0:w,[ParagPtr]:#T_LineCount:w,ParStart:w xcall T_DrawParag NoDraw movelong [ObjHdl],ObjPtr subword [ObjPtr]:#P_TRect+4,[ObjPtr]:#P_TRect,MaxVert NextPar moveword ParEnd,ParStart inc ParagNo brl ParLoop EraseBottom call T_PadThread,in=(ObjHdl:l,ParStart:w) lda DoDraw beq Done call T_ClearBottom,in=(ObjHdl:l,ParStart:w,P_Page:w) Done jsl T_MovedDot Exit RETURN ENDP ;---------------------------------------------------------------------------- ; ; T_CmpLines (LHdl1:l,LHdl2:l,LCount1:w,LCount2:w,Bytes:w) : ; FirstLine:w,LastLine:w ; T_CmpLines PROC EXPORT ;Using T_TextEqu ;Using T_Data INPUT LHdl1:l,LHdl2:l INPUT LCount1:w,LCount2:w INPUT Bytes:w OUTPUT FirstLine:w,LastLine:w LOCAL LPtr1:l,LPtr2:l,LineNo:w LOCAL TotLength1:w,TotLength2:w BEGIN movelong [LHdl1],LPtr1 movelong [LHdl2],LPtr2 stz TotLength1 stz TotLength2 stz LineNo FirstLoop ldy #T_Length addword [LPtr1]:y,TotLength1,TotLength1 addword [LPtr2]:y,TotLength2,TotLength2 cmpw TotLength1,TotLength2 bne Different lda LineNo inc a cmp LCount1 beq NoMore cmp LCount2 beq NoMore sta LineNo addwl #T_LineInfoSize,LPtr1 addwl #T_LineInfoSize,LPtr2 bra FirstLoop NoMore moveword LineNo,FirstLine lda LCount2 dec a sta LastLine brl Exit Different moveword LineNo,FirstLine sta LastLine cmpw LCount1,LCount2 bne NoMore2 addword TotLength2,Bytes,TotLength2 cmpw TotLength1,TotLength2 beq Exit SecLoop lda LineNo inc a cmp LCount1 beq NoMore2 cmp LCount2 beq NoMore2 sta LineNo addwl #T_LineInfoSize,LPtr1 addwl #T_LineInfoSize,LPtr2 ldy #T_Length addword [LPtr1]:y,TotLength1,TotLength1 addword [LPtr2]:y,TotLength2,TotLength2 cmpw TotLength1,TotLength2 bne SecLoop Same moveword LineNo,LastLine bra Exit NoMore2 lda LCount2 dec a sta LastLine Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_FixParag (ParagNo:w,LineNo:w,CharCount:w) ; T_FixParag PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,LineNo:w,CharCount:w LOCAL ParagPtr:l,OldLinesHdl:l,LinesHdl:l LOCAL OldCount:w,NewCount:w,FirstLine:w,LastLine:w LOCAL EndVert:w,EndObjHdl:l,VertPos:w BEGIN rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_LineCount,OldCount rcall T_LockLines,in=(ParagNo:a),out=(OldLinesHdl:ax) ; Cut Paragraph in [ParagPtr]:#T_ObjHdl:l,ParagNo:w,[ParagPtr]:#T_ParStart:w out EndObjHdl:l,EndVert:w xcall T_CutParag rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_LinesHdl,LinesHdl moveword [ParagPtr]:#T_LineCount,NewCount ; Compare the lines in OldLinesHdl:l,LinesHdl:l,OldCount:w,NewCount:w,CharCount:w out FirstLine:w,LastLine:w xcall T_CmpLines tool _DisposeHandle,in=(OldLinesHdl:l) tool _HUnlock,in=(LinesHdl:l) cmpw LineNo,FirstLine bge Okay sta FirstLine Okay call T_TopLine,in=(ParagNo:w,FirstLine:w),out=(a:l,VertPos:w) inc LastLine call T_DrawParag,in=(ParagNo:w,FirstLine:w,LastLine:w,VertPos:w) inc ParagNo call T_BumpParags,in=(ParagNo:w,EndObjHdl:l,EndVert:w,#1:w) RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_InsertCR () ; T_InsertCR PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using P_Data LOCAL TextPtr:l,ParagPtr:l,ParOffset:w LOCAL EndObjHdl:l,MidVert:w,EndVert:w,RulerHdl:l LOCAL VertLPos:w,LastLine:w,BogusHdl:l BEGIN call P_BuildType jsl T_Clear rcall T_JunkRight,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffSet call T_MakeRoom,in=(T_DotParag:w,T_DotOffset:w,#T_ParHeader+1:w) rcall T_GetTextPtr,in=(T_DotParag:a),out=(TextPtr:ax) call T_TrackFont,in=(TextPtr:l,T_DotOffset:w) addwl T_DotOffset,TextPtr moveword #CR,[TextPtr] moveword T_CurFont,[TextPtr]:#T_ParFont+1 moveword T_CurStyleSize,[TextPtr]:#T_ParStyle+1 shortm moveword T_CurColor,[TextPtr]:#T_ParColor+1 longm ; Make D_New paragraph call T_NewPars,in=(T_DotParag:w,#1:w) call T_OffsetPCount,in=(T_DotObj:l,#1:w) ; 1st paragraph -- Recut it and then draw the last Q_Line. rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_ParOffset,ParOffset in [ParagPtr]:#T_ObjHdl:l,T_DotParag:w,[ParagPtr]:#T_ParStart:w out EndObjHdl:l,MidVert:w xcall T_RecutParag rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_LineCount,a dec a sta LastLine call T_TopLine,in=(T_DotParag:w,LastLine:w),out=(a:l,VertLPos:w) in T_DotParag:w,LastLine:w,T_DotObj:l,VertLPos:w xcall T_DrawOneLine ; 2nd paragraph -- ; Set ParOffset,ParStart and use the ruler. inc T_DotParag rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) addword ParOffset,T_DotOffset,a inc a moveword a,[ParagPtr]:#T_ParOffset movelong EndObjHdl,[ParagPtr]:#T_ObjHdl moveword MidVert,[ParagPtr]:#T_ParStart movelong #0,[ParagPtr]:#T_LinesHdl movelong [ParagPtr]:#T_RulerHdl,RulerHdl rcall T_UseRuler,in=(RulerHdl:ax) in EndObjHdl:l,T_DotParag:w,MidVert:w out EndObjHdl:l,EndVert:w xcall T_RecutParag rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) in T_DotParag:w,#0:w,[ParagPtr]:#T_LineCount:w,MidVert:w xcall T_DrawParag moveword #T_ParHeader,T_DotOffset ; Bump stuff. lda T_DotParag inc a call T_BumpParags,in=(a:w,EndObjHdl:l,EndVert:w,#1:w) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_DeleteCR () ; T_DeleteCR PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using P_Data LOCAL Hdl:l,NewOffset:w,CharCount:w LOCAL ParagPtr:l,LastLine:w BEGIN lda T_DotParag beq Exit call P_BuildUndo,in=(#P_NoUndo:w) call T_CopyParEnd,in=(T_DotParag:w,#T_ParHeader:w),out=(Hdl:l) bcs Exit lda T_DotParag dec a rcall T_GetParSize,in=(a:a),out=(a:a) dec a sta NewOffset call T_DeletePars,in=(T_DotParag:w,#1:w) dec T_DotParag in T_DotParag:w,NewOffset:w,Hdl:l out CharCount:w xcall T_PastePar moveword NewOffset,T_DotOffset rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) subword [ParagPtr]:#T_LineCount,#1,LastLine call T_FixParag,in=(T_DotParag:w,LastLine:w,CharCount:w) call T_DrawRuler jsl P_FixMenus Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; T_DeleteChar () ; ; Deletes the character to the left of T_DotOffset. T_DeleteChar PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using P_Data LOCAL LOffset:w,ROffset:w,TextPtr:l LOCAL LeftFont:l,LeftColor:w,RightFont:l,RightColor:w LOCAL Room:w BEGIN rcall T_PrevChar,in=(T_DotParag:a,T_DotOffset:x),out=(LOffset:a) cmp #0 bne DoChar jsl T_DeleteCR brl Exit DoChar call P_BuildUndo,in=(#P_NoUndo:w) rcall T_JunkRight,in=(T_DotParag:a,T_DotOffset:x),out=(ROffset:a) rcall T_GetTextPtr,in=(T_DotParag:a),out=(TextPtr:ax) call T_TrackFont,in=(TextPtr:l,LOffset:w) movelong T_CurFont,LeftFont moveword T_CurColor,LeftColor call T_TrackFont,in=(TextPtr:l,ROffset:w) movelong T_CurFont,RightFont moveword T_CurColor,RightColor in LeftFont:l,LeftColor:w,RightFont:l,RightColor:w out a:w xcall T_CalcFBytes ;Room = Bytes-(RightOffset-LeftOffset) addword a,LOffset,a subword a,ROffset,Room call T_DoRoom,in=(T_DotParag:w,LOffset:w,Room:w) rcall T_GetTextPtr,in=(T_DotParag:a),out=(TextPtr:ax) addwl LOffset,TextPtr in TextPtr:l,LeftFont:l,LeftColor:w,RightFont:l,RightColor:w xcall T_WriteFBytes moveword LOffset,T_DotOffset ; This is a hack to prevent bug #1626, so that if you are at the beginning of ; a Q_Line, the previous Q_Line will get updated correctly. in T_DotParag:w,T_DotOffset:w out T_DotObj:l,T_DotLine:w xcall T_Offset2Line call T_FixParag,in=(T_DotParag:w,T_DotLine:w,Room:w) jsl P_FixMenus Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_InsertChars (ObjHdl:l,LineNo:w,ParagNo:w,Offset:w,CharsPtr:l,Bytes:w) ; T_InsertChars PROC EXPORT ;Using P_Data ;Using T_Data ;Using T_TextEqu INPUT ObjHdl:l,LineNo:w INPUT ParagNo:w,Offset:w INPUT CharsPtr:l,Bytes:w LOCAL TextPtr:l,ObjPtr:l,CharsWidth:l,LineWidth:w LOCAL LinePtr:l,VertPos:w,EndOffset:w,EndFont:l,EndColor:w BEGIN jsl P_BuildType jsl T_Clear call T_MakeRoom,in=(ParagNo:w,Offset:w,Bytes:w) rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) pushlong CharsPtr lda Offset addlong a,TextPtr,s pushword #0 pushword Bytes _BlockMove lda T_FontFlags beq NoChange addword Offset,Bytes,EndOffset rcall T_JunkRight,in=(ParagNo:a,EndOffset:x),out=(EndOffset:a) call T_TrackFont,in=(TextPtr:l,EndOffset:w) movelong T_CurFont,EndFont moveword T_CurColor,EndColor call T_InsertFont,in=(ParagNo:w,Offset:w,#1:w),out=(a:w) addword a,Offset,a addword a,Bytes,Offset moveword EndFont,T_NewFont shortm moveword EndFont+2,T_NewAddStyle moveword EndFont+3,T_NewSize longm moveword EndColor,T_NewColor call T_InsertFont,in=(ParagNo:w,Offset:w,#1:w),out=(a:w) stz T_FontFlags bra FixIt NoChange addword Offset,Bytes,Offset FixIt moveword Offset,T_DotOffset call T_FixParag,in=(ParagNo:w,LineNo:w,Bytes:w) Exit RETURN ENDP ;------------------------------------------------------------------------------; ; ; T_Key (EvtPtr:l) ; T_Key PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT EvtPtr:l LOCAL ParagPtr:l,LinesHdl:l,LinePtr:l LOCAL Char:w,CharCount:w,CharBuf:r LOCAL MoreEvtRec:r,EvtRec:r,Src:l LOCAL CharsWidth:w,LineWidth:w,TextPtr:l,SpaceCount:w BEGIN moverect [EvtPtr],EvtRec moverect [EvtPtr]:#8,EvtRec+8 lda EvtRec+2 and #$ff sta Char cmp #SPACE beq SkipApple lda EvtRec+14 and #AppleKey jne Exit SkipApple _ObscureCursor jsl T_EraseCaret ; lda Char ; cmp #$24 ; jeq SpecChar1 ; cmp #$21 ; jeq SpecChar2 ; cmp #$23 ; jeq SpecChar3 lda Char cmp #$7F jeq Delete cmp #SPACE bge InsertChars cmp #TAB beq InsertChars cmp #CR bne DoControl jsl T_InsertCR bra ToExit DoControl call T_DoControl,in=(Char:w,EvtRec+14:w) ToExit brl Exit InsertChars stz CharCount stz SpaceCount SuckChars cmpw Char,#SPACE bne DidSpace lda EvtRec+14 and #appleKey bne Sticky lda EvtRec+14 and #optionKey beq DidSpace Sticky moveword #$CA,Char DidSpace lda Char ldx CharCount sta CharBuf,x inx stx CharCount cpx #8 beq NoMore cmp #CR beq NoMore tool _OSEventAvail,in=(#%101110:w,!EvtRec:l),out=(a:w) beq NoMore lda EvtRec cmp #3 ; key event beq KeyEvent cmp #5 ; auto-key event bne NoMore KeyEvent lda EvtRec+2 and #$ff cmp #$7F beq NoMore cmp #SPACE blt NoMore tool _GetOSEvent,in=(#%101000:w,!EvtRec:l),out=(a:w) lda EvtRec+2 and #$ff sta Char brl SuckChars NoMore in T_DotObj:l,T_DotLine:w,T_DotParag:w,T_DotOffset:w in !CharBuf:l,CharCount:w xcall T_InsertChars bra Exit ; Delete the previous chararcter Delete lda T_TextSelect beq NoClear call P_BuildUndo,in=(#P_ClearTextUndo:w) jsl T_Clear bra Exit NoClear jsl T_DeleteChar Exit RETURN ;specChar1 anop ; pushlong T_CurParHdl ; jsl T_DebugThread ; bra Exit ; ;specChar2 anop ; lda T_BrkFlag ; beq Set ; stz T_BrkFlag ; bra Exit ;set inc T_BrkFlag ; bra Exit ; ;specChar3 anop ; ; pushlong T_DotObj ; jsl T_DebugTextObj ; brl Exit ; ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/MAIN.S b/appleworksgs/PL/Src/MAIN.S new file mode 100755 index 0000000..03b36a3 --- /dev/null +++ b/appleworksgs/PL/Src/MAIN.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_BitMapChanged IMPORT D_BitMapPtr IMPORT D_ClearBitMap IMPORT D_Deref IMPORT P_AddThreadRgn IMPORT P_CheckHand IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_DoThread IMPORT P_DrawContent IMPORT P_DrawHandles IMPORT P_ErrorAlert IMPORT P_FixMenus IMPORT P_FixSpecRect IMPORT P_HideTabs IMPORT P_KillUndo IMPORT P_Page IMPORT P_PageMode IMPORT P_Placing IMPORT P_ThreadDir IMPORT P_ThreadHdl IMPORT D_RectZap IMPORT T_BlinkCaret IMPORT T_Click IMPORT T_GetParPtr IMPORT T_InvSelect IMPORT T_NewParHdl IMPORT T_OffThread IMPORT T_PadThread IMPORT T_Pt2Offset IMPORT T_RecutParag ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_CInterval ENTRY T_CaretDrawn ENTRY T_CaretTime ENTRY T_ClickCount ENTRY T_ClipThread ENTRY T_CurParHdl ENTRY T_Editing ENTRY T_FontFlags ENTRY T_ReThread ENTRY T_Refresh ENTRY T_RulDrawn ENTRY T_TextSelect ENTRY T_ThreadRgn ;----------------------------------------------------------------------------- ; ; T_New (ObjHdl:l,ParagHdl:l) ; ; Returns any errors. ObjHdl should be X_Locked when T_New is called. T_New PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu input ObjHdl:l,ParagHdl:l local ObjPtr:l,ParagPtr:l,PThread:l,ReThreadHdl:l,TempPtr:l error Err begin stz Err movelong [ObjHdl],ObjPtr call P_FixSpecRect,in=(ObjPtr:l) ; Make a D_New parag array if neccessary cpzl ParagHdl bne ThreadExists call T_NewParHdl,out=(ParagHdl:l),err=(Err) jcs Exit ThreadExists movelong ParagHdl,[ObjPtr]:#P_ParagHdl moveword P_Page,[ObjPtr]:#P_PageNo moveword #0,[ObjPtr]:#P_NThread moveword a,[ObjPtr]:#P_NThread+2 moveword a,[ObjPtr]:#P_PThread moveword a,[ObjPtr]:#P_PThread+2 ; Do threading lda P_Placing beq NoThread cpzl P_ThreadHdl beq NoThread rcall D_Deref,in=(P_ThreadHdl:ax),out=(TempPtr:ax) cmpw [TempPtr]:#P_PageNo,P_Page bne NoHand1 call P_DrawHandles,in=(TempPtr:l) NoHand1 call P_DoThread,in=(P_ThreadHdl:l,ObjHdl:l,P_ThreadDir:w) cmpw [TempPtr]:#P_PageNo,P_Page bne NoHand2 call P_DrawHandles,in=(TempPtr:l) NoHand2 tool _HUnlock,in=(P_ThreadHdl:l) NoThread ; Setup and rethread movelong [ObjPtr]:#P_PThread,PThread cpzl PThread bne PrevExists movelong ObjHdl,ReThreadHdl movelong [ParagHdl],ParagPtr movelong ObjHdl,[ParagPtr]:#T_ObjHdl lda #0 moveword a,[ParagPtr]:#T_ParStart moveword a,[ObjPtr]:#P_StartParag moveword a,[ObjPtr]:#P_StartLine lda #$FFFF moveword a,[ObjPtr]:#P_EndParag moveword a,[ObjPtr]:#P_EndLine bra Done PrevExists movelong PThread,ReThreadHdl Done call T_ReThread,in=(ReThreadHdl:l) Exit return ENDP ;------------------------------------------------------------------------------- ; ; T_ReThread (ObjHdl:l) ; T_ReThread PROC EXPORT ;Using P_ObjData ;Using T_Data ;Using T_TextEqu input ObjHdl:l local ObjPtr:l,ParagHdl:l,ParagPtr:l local ParagNo:w,ParagCount:w,VertPos:w error Err begin +b stz Err ; D_Save on stack pushlong T_CurParHdl movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_ParagHdl,ParagHdl movelong ParagHdl,T_CurParHdl rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) moveword [ParagPtr],ParagCount cpzl [ObjPtr]:#P_PThread bne NotStart lda #0 moveword a,[ObjPtr]:#P_StartParag moveword a,[ObjPtr]:#P_StartLine sta ParagNo sta VertPos bra ParagLoop NotStart moveword [ObjPtr]:#P_StartParag,ParagNo bpl NotEnd moveword ParagCount,ParagNo NotEnd lda ParagNo beq NoDec dec ParagNo NoDec rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_ObjHdl,ObjHdl moveword [ParagPtr]:#T_ParStart,VertPos ParagLoop in ObjHdl:l,ParagNo:w,VertPos:w out ObjHdl:l,VertPos:w xcall T_RecutParag rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) tool _DisposeHandle,in=([ParagPtr]:#T_LinesHdl:l) movelong #0,[ParagPtr]:#T_LinesHdl moveword [ParagPtr]:#T_LineCount,a inc ParagNo cmpw ParagNo,ParagCount blt ParagLoop call T_PadThread,in=(ObjHdl:l,VertPos:w) ; Restore from stack Done pulllong T_CurParHdl return ENDP ;----------------------------------------------------------------------------- ; ; T_Activate (ObjHdl:l,Pt:l) : Drawn:w ; ; ThePoint should be in local coordinates. ; T_Activate PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data input ObjHdl:l,Pt:l output Drawn:w local ObjPtr:l,Start:l,End:l local NewParag:w,NewOffset:w,NewLine:w,NewPixs:w begin stz Drawn lda P_PageMode jne Exit call P_CheckHand,in=(#$8000:l) bcc Cont call P_ErrorAlert,in=(#1:w) brl Exit Cont movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_StartParag,Start movelong [ObjPtr]:#P_EndParag,End movelong [ObjPtr]:#P_ParagHdl,T_CurParHdl inc T_Editing stz T_ClickCount stz T_TextSelect stzl T_RulDrawn tool _GetCaretTime,out=(T_CInterval:l) tool _SetPort,in=(P_CurrentWin:l) call P_KillUndo cmpl Start,End beq Deactivate in ObjHdl:l,Pt:l out NewParag:w,NewOffset:w,NewLine:w,NewPixs:w xcall T_Pt2Offset call T_OffThread,in=(NewParag:w,NewLine:w),out=(a:w) bne Deactivate tool _NewRgn,out=(T_ThreadRgn:l) call T_ClipThread,in=(ObjHdl:l) jsl T_Refresh call T_Click,in=(ObjHdl:l,Pt:l,#0:w,#0:w) inc Drawn Exit return Deactivate stz T_Editing stzl T_CurParHdl bra Exit ENDP ;----------------------------------------------------------------------------- ; ; T_Deactivate (Refresh:w,OffScreen:w) ; ; Refresh - Refreshes the screen if true. T_Deactivate PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data input Refresh:w,OffScreen:w begin lda T_Editing beq Exit jsl P_KillUndo jsl T_InvSelect jsl P_HideTabs stz T_Editing stz T_FontFlags stzl T_CurParHdl tool _DisposeRgn,in=(T_ThreadRgn:l) lda Refresh beq DoMenus lda OffScreen beq On jsl T_Refresh bra DoMenus On call P_DrawContent,in=(#P_ContentRect:l,#0:w) DoMenus jsl P_FixMenus Exit return ENDP ;------------------------------------------------------------------------------ ; ; T_ClipThread (ObjHdl:l) ; T_ClipThread PROC EXPORT ;Using P_ObjData ;Using T_Data input ObjHdl:l local ThreadHdl:l,ThreadPtr:l,PThread:l begin lda T_Editing beq Exit cpzl [ObjHdl] bne DoIt ;if zero not valid tool _SetEmptyRgn,in=(T_ThreadRgn:l) bra Exit DoIt movelong ObjHdl,ThreadHdl Loop movelong [ThreadHdl],ThreadPtr movelong [ThreadPtr]:#P_PThread,PThread cpzl PThread beq EndLoop movelong PThread,ThreadHdl bra Loop EndLoop tool _SetEmptyRgn,in=(T_ThreadRgn:l) call P_AddThreadRgn,in=(ThreadHdl:l,T_ThreadRgn:l) Exit return ENDP ;----------------------------------------------------------------------------- ; ; T_Refresh () ; T_Refresh PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using D_GlobalData local Port:l,Q_Rect:r begin movelong P_CurrentWin,Port pushlong [Port]:#2 ;D_Save BitMap Ptr movelong >D_BitMapPtr,[Port]:#2 moverect P_ContentRect,Q_Rect tool _LocalToGlobal,in=(!Q_Rect:l) tool _LocalToGlobal,in=(!Q_Rect+4:l) call D_ClearBitMap,in=(!Q_Rect:l) call P_DrawContent,in=(#P_ContentRect:l,#0:w) tool _HideCursor call D_RectZap,in=(!Q_Rect:l) tool _ShowCursor pulllong [Port]:#2 ;Restore BitMap Ptr moveword #1,>D_BitMapChanged return ENDP ;----------------------------------------------------------------------------- ; ; T_Idle (TickCount:l) ; T_Idle PROC EXPORT ;Using P_Data ;Using T_Data input TickCount:l local Diff:l,CTime:l begin lda T_TextSelect bne Exit sublong TickCount,T_CaretTime,Diff cmpl Diff,T_CInterval bcc Exit movelong TickCount,T_CaretTime jsl T_BlinkCaret lda T_CaretDrawn eor #1 sta T_CaretDrawn Exit return ENDP ;------------------------------------------------------------------------------ ; ; T_Data ; T_Data PROC EXPORT EXPORT T_Editing EXPORT T_CurParHdl EXPORT T_TextSelect EXPORT T_RulDrawn EXPORT T_RulObj EXPORT T_ThreadRgn EXPORT T_CurRulHdl EXPORT T_CurRulPtr EXPORT T_CurRulBits EXPORT T_CurIndent EXPORT T_Dot EXPORT T_DotParag EXPORT T_DotOffset EXPORT T_DotLine EXPORT T_DotPixs EXPORT T_DotObj EXPORT T_Mark EXPORT T_MarkParag EXPORT T_MarkOffset EXPORT T_MarkLine EXPORT T_MarkPixs EXPORT T_MarkObj EXPORT T_FontFlags EXPORT T_NewFont EXPORT T_NewAddStyle EXPORT T_NewSubStyle EXPORT T_NewSize EXPORT T_NewColor EXPORT T_CurFont EXPORT T_CurStyleSize EXPORT T_CurStyle EXPORT T_CurSize EXPORT T_CurColor EXPORT T_MaxAscent EXPORT T_MaxDescent EXPORT T_ScalePort EXPORT T_ScaleLocInfo EXPORT T_ScaleRect EXPORT T_LastPos EXPORT T_LastParag EXPORT T_LastOffset EXPORT T_CInterval EXPORT T_CaretTime EXPORT T_CaretDrawn EXPORT T_ClickCount EXPORT T_BrkFlag T_Editing DS.B 2 ; True if editing T_CurParHdl DS.B 4 ; Current thread being operated on T_TextSelect DS.B 2 ; True if Q_Text is selected T_RulDrawn DS.B 4 ; Current ruler drawn T_RulObj DS.B 4 ; Object T_RulDraw is in T_ThreadRgn DS.B 4 ; Rgn for thread being edited T_CurRulHdl DS.B 4 ;Vars set by T_LockRuler T_CurRulPtr DS.B 4 T_CurRulBits DS.B 2 T_CurIndent DS.B 2 T_Dot T_DotParag DS.B 2 T_DotOffset DS.B 2 T_DotLine DS.B 2 T_DotPixs DS.B 2 T_DotObj DS.B 4 T_Mark T_MarkParag DS.B 2 T_MarkOffset DS.B 2 T_MarkLine DS.B 2 T_MarkPixs DS.B 2 T_MarkObj DS.B 4 T_FontFlags DS.B 2 T_NewFont DS.B 2 ;The D_New font T_NewAddStyle DS.B 2 ;D_New styles to add T_NewSubStyle DS.B 2 ;D_New styles to subtract T_NewSize DS.B 2 ;D_New Size T_NewColor DS.B 2 ;NewColor T_CurFont DS.B 2 T_CurStyleSize T_CurStyle DS.B 1 T_CurSize DS.B 1 T_CurColor DS.B 2 T_MaxAscent DS.B 2 T_MaxDescent DS.B 2 T_ScalePort DS.B 4 T_ScaleLocInfo DC.W $80 ;PortSCB DC.L 0 ;PixelImagePtr DC.W 320 ;Width T_ScaleRect DC.W 0,0,100,1280 ;BoundsRect T_LastPos ; ; Last caret position T_LastParag DS.B 2 T_LastOffset DS.B 2 T_CInterval DS.B 4 ; Time between caret blinks T_CaretTime DC.L 0 ; Last time caret was drawn T_CaretDrawn DC.W 0 T_ClickCount DS.B 2 T_BrkFlag DC.W 0 ENDP ;----------------------------------------------------------------------------- ; T_TextEqu T_TextEqu PROC EXPORT ; Paragraph Info ; RulerInfo ; Q_Line Info ; Q_Text Block Header ; RulBits stuff ENDP ;----------------------------------------------------------------------------- ; ; ParagHdl --> ParagCount ; Array [1..ParagCount] of ParagInfo ; ; ParagInfo ; TextBlock : long; -- Handle to Q_Text block ; ParOffset : word; -- Offset within Q_Text block ; ParStart : word; -- Top pixel count of paragraph ; RulerHdl : long; -- Handle to ruler ; ParHeight : word; -- Pixel height of paragraph ; LinesHdl : long; -- Handle to lines array ; LineCount : word; -- Number of lines ; ObjHdl : long; -- Object with first Q_Line of parag. ; ; ; RulerInfo ; ParsUsing : word; ; RulBits : word; ; NotUsed : word; ; TabCount : word; ; Does not include Indent. ; Indent : long; ; TabArray : 40 bytes ; ; ; ; LineInfo ; Offset : word; ; Length : word; ; LineWidth : word; ; Ascent : byte; ; Descent : byte; ; END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PARRANGE.S b/appleworksgs/PL/Src/PARRANGE.S new file mode 100755 index 0000000..da4ad65 --- /dev/null +++ b/appleworksgs/PL/Src/PARRANGE.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_Deref IMPORT D_LoadSegment IMPORT Q_ManglePict IMPORT Q_ManglePoint IMPORT D_MemoryError IMPORT P_AddObjRgn IMPORT P_BoundsRect IMPORT P_BuildUndo IMPORT P_DrawRgn IMPORT P_FixRect IMPORT P_FixSpecRect IMPORT P_InsertObj IMPORT P_LastObj IMPORT P_ObjList IMPORT P_PrintHand IMPORT P_RemoveObj IMPORT T_ReThread IMPORT D_UnloadSegment ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_DoRotate ENTRY P_RotateRect ;------------------------------------------------------------------------- ; ; P_BringFront () ; P_BringFront PROC EXPORT ;Using P_Data ;Using P_ObjData local ObjHdl:l,PlaceHdl:l,ObjPtr:l,NextObj:l,UpdateRgn:l begin +b call P_BuildUndo,in=(#P_NoUndo:w) tool _NewRgn,out=(UpdateRgn:l) movelong P_ObjList,ObjHdl stzl PlaceHdl Loop cpzl ObjHdl beq EndLoop movelong [ObjHdl],ObjPtr movelong [ObjPtr],NextObj moveword [ObjPtr]:#P_Selected,a beq NoChange tool _HLock,in=(ObjHdl:l) call P_AddObjRgn,in=(ObjPtr:l,UpdateRgn:l) tool _HUnlock,in=(ObjHdl:l) call P_RemoveObj,in=(ObjHdl:l) call P_InsertObj,in=(ObjHdl:l,PlaceHdl:l) movelong ObjHdl,PlaceHdl NoChange movelong NextObj,ObjHdl bra Loop EndLoop call P_DrawRgn,in=(UpdateRgn:l) return ENDP ;------------------------------------------------------------------------- ; ; P_SendBack () P_SendBack PROC EXPORT ;Using P_Data ;Using P_ObjData local ObjHdl:l,ObjPtr:l,NextObj:l,UpdateRgn:l,LastObj:l begin +b call P_BuildUndo,in=(#P_NoUndo:w) tool _NewRgn,out=(UpdateRgn:l) movelong P_ObjList,ObjHdl movelong P_LastObj,LastObj cpzl ObjHdl beq EndLoop Loop movelong [ObjHdl],ObjPtr movelong [ObjPtr],NextObj moveword [ObjPtr]:#P_Selected,a beq NoChange tool _HLock,in=(ObjHdl:l) call P_AddObjRgn,in=(ObjPtr:l,UpdateRgn:l) call P_RemoveObj,in=(ObjHdl:l) call P_InsertObj,in=(ObjHdl:l,P_LastObj:l) NoChange cmpl ObjHdl,LastObj beq EndLoop movelong NextObj,ObjHdl bra Loop EndLoop call P_DrawRgn,in=(UpdateRgn:l) Exit return ENDP ;--------------------------------------------------------------------------- ; ; P_FlipHoriz () ; P_FlipHoriz PROC EXPORT begin call P_DoRotate,in=(#0:w) return ENDP ;--------------------------------------------------------------------------- ; ; P_FlipVert () ; P_FlipVert PROC EXPORT begin call P_DoRotate,in=(#1:w) return ENDP ;--------------------------------------------------------------------------- ; ; P_RotateLeft ; P_RotateLeft PROC EXPORT begin call P_DoRotate,in=(#3:w) return ENDP ;--------------------------------------------------------------------------- ; ; P_RotateRight ; P_RotateRight PROC EXPORT begin call P_DoRotate,in=(#2:w) return ENDP ;------------------------------------------------------------------------------ ; ; P_DoRotate (Verb:w) ; P_DoRotate PROC EXPORT ;Using P_Data ;Using P_ObjData input Verb:w local ObjHdl:l,ObjPtr:l,UpdateRgn:l,UnionRect:r local PrintHdl:l,PrintPtr:l,Scale:l,ObjType:w local PictHdl1:l,PictHdl2:l begin +b call D_LoadSegment,in=(#segPict:w,#4:w),out=(a:l) jcs _MemErr call P_BuildUndo,in=(#P_NoUndo:w) movelong P_PrintHand,PrintHdl movelong [PrintHdl],PrintPtr tool _FixRatio,in=([PrintPtr]:#6:w,[PrintPtr]:#4:w),out=(Scale:l) movelong P_ObjList,ObjHdl call P_BoundsRect,in=(P_ObjList:l,!UnionRect:l),out=(a:w) tool _NewRgn,out=(UpdateRgn:l) movelong P_ObjList,ObjHdl Loop cpzl ObjHdl jeq EndLoop rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) moveword [ObjPtr]:#P_Selected,a jeq NextObj call P_AddObjRgn,in=(ObjPtr:l,UpdateRgn:l) moveword [ObjPtr]:#P_Type,ObjType cmp #P_PICTURE jne NotPict movelong [ObjPtr]:#P_PictHandle,PictHdl1 call Q_ManglePict,in=(PictHdl1:l,Verb:w),out=(PictHdl2:l) bcc NoErr jsl D_MemoryError brl NextObj NoErr tool _KillPicture,in=(PictHdl1:l) movelong PictHdl2,[ObjPtr]:#P_PictHandle addlong ObjPtr,#P_PictRect,s pushlong !UnionRect pushword Verb pushword ObjType jsl P_RotateRect NotPict addlong ObjPtr,#P_ObjRect,s pushlong !UnionRect pushword Verb pushword ObjType jsl P_RotateRect call P_FixSpecRect,in=(ObjPtr:l) cmpw ObjType,#P_ALPHA bne NotAlpha call T_ReThread,in=(ObjHdl:l) NotAlpha call P_AddObjRgn,in=(ObjPtr:l,UpdateRgn:l) NextObj tool _HUnlock,in=(ObjHdl:l) movelong [ObjPtr],ObjHdl brl Loop EndLoop call D_UnloadSegment,in=(#segPict:w,#4:w) call P_DrawRgn,in=(UpdateRgn:l) Exit return _MemErr jsl D_MemoryError bra Exit ENDP ;------------------------------------------------------------------------------ ; ; P_RotateRect (RectPtr:l,RectPtr2:l,Opcode:w) ; P_RotateRect PROC EXPORT ;Using P_Data ;Using P_ObjData input RectPtr:l,RectPtr2:l,Opcode:w,ObjType:w begin in [RectPtr]:l,RectPtr2:l,OpCode:w,P_PrintHand:l out [RectPtr]:l xcall Q_ManglePoint in [RectPtr]:#4:l,RectPtr2:l,OpCode:w,P_PrintHand:l out [RectPtr]:#4:l xcall Q_ManglePoint call P_FixRect,in=(RectPtr:l,ObjType:w,#0:w,#0:w) return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PDBG.S b/appleworksgs/PL/Src/PDBG.S new file mode 100755 index 0000000..d0595f2 --- /dev/null +++ b/appleworksgs/PL/Src/PDBG.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY AbortButton ENTRY AbortText ENTRY BreakButton ENTRY BreakText ENTRY ButtonTxt ENTRY CancelBut ENTRY CancelTxt ENTRY Debug ENTRY DebugMsg ENTRY Int1 ENTRY Int1MsgSTART ENTRY Int2 ENTRY Int2MsgSTART ENTRY OKBut ;keep obj/pdbg INCLUDE 'mac/pdbg.mac' INCLUDE 'tools/pdbgtool.s' ; ; File contains: ; BrakeCheck (brk if option key is down) ; WaitMouse (wait for mouse click) ; Debug (alert w/ various output/tracing...) ; DebugNum (alert prints 1 longint) ; ;--------------------------------------------------------------------------- ; ; BrakeCheck ; BrakeCheck PROC EXPORT EXPORT P_BrakeCheck P_BrakeCheck ; ;Using P_DATA input TheStr:l begin Exit return ENDP ;--------------------------------------------------------------------------- ; ; DebugNum(num:long) ; DebugNum PROC EXPORT ;Using DebugData input var:l begin ; spacelong ; _GetPort ; ; movelong #Generic,DebugMsgText ; ; tool _Long2Hex,in=(var:l,#Int1MsgText:l,#8:w) ; ; call D_SetCursor,in=(#0:w) ; spaceword ; pushlong #SimpAlert ; pushlong #0 ; _Alert ; pla ; ; _SetPort return ENDP ;--------------------------------------------------------------------------- ; ; CkErr ; CkErr PROC EXPORT local foo:b error err tax bcc Borrring begin +b pushlong #ErrString pushword #0 phx stx err lda foo+5 and #$FF pha lda foo+3 pha pushlong #0 jsl Debug return Borrring rtl ErrString STR 'Error / Location:' ENDP ;---------------------------------------------------------------------- ; Debug(msg:ptr; var1:long; var2:long; routine:addr) ; ; USAGE: prints out string located at msg (if zero, prints ; default msg). Prints var1,2 in hex. ; OK button: call routine (if not zero) ; Cancel button: don't call routine ; Abort button: attempt to shut down program ; Break button: execute a brk instruction ; Debug PROC EXPORT ;Using DebugData input Msg:l,var1:l,var2:l,NextRoutine:l begin _SysBeep _SysBeep _SysBeep ; lda Msg ; cmp Msg+2 ; bne Cont ; ; movelong #Generic,Msg ; ;Cont lda (Msg) ; and #$00FF ; sta DebugMsgLen ; movelong Msg,DebugMsgText ; ; pushlong var1 ; pushlong #Int1MsgText ; pushword #8 ; _Long2Hex ; ; pushlong var2 ; pushlong #Int2MsgText ; pushword #8 ; _Long2Hex ; ; spacelong ; _GetPort ; ; call D_SetCursor,in=(#0:w) ; spaceword ; pushlong #DebugAlert ; pushlong #0 ; _Alert ; pla ; ; cmp #2 ; abort msg ; beq die ; cmp #4 ; bne DontDie ; brk ; brl bye ; after the break... (ha!) ;DontDie cmp #1 ; continue w/ debug ; jne bye ; ; lda NextRoutine ; ora NextRoutine+2 ; jeq bye ; ; _SetPort ; pushlong var1 ; pushlong var2 ; ;; ; Hack!!!!! ; lda NextRoutine ; sta Foo+1 ; lda Nextroutine+1 ; sta Foo+2 ; ;Foo jsl ; ; jsl nextroutine ; jmp bye ; ; ;die anop ; _DeskShutdown ; _FMShutdown ; _SFShutdown ; _CtlShutdown ; _DialogShutdown ; _EMShutdown ; _LEShutdown ; _MenuShutdown ; _WindShutdown ; _QDAuxShutdown ; _QDShutdown ; _MTShutdown ; ; PushWord #1 ; _MMShutdown ; _TLShutdown ; ; _Quit DbgQuitParams ; ; ; ;bye _SetPort return ENDP ;--------------------------------------------------------------------------- ; ; PutNum ; PutNum PROC EXPORT input num:w local rgn:l begin +b ; spacelong ; _GetClipHandle ; ; spacelong ; _NewRgn ; pulllong rgn ; ; pushlong rgn ; _SetClipHandle ; ; pushlong #D_BoxRect ; _ClipRect ; ; pushword num ; pushlong #TheSTR ; pushword #4 ; _Int2Hex ; ; pushlong #TheSTR ; pushword #4 ; pushlong #D_BoxRect ; pushword #0 ; _LETextBox ; ; pushlong rgn ; _DisposeRgn ; ; _SetClipHandle ; return ;TheSTR DS 4 ;D_BoxRect DC i'152,1,162,36' ENDP ;---------------------------------------------------------------------- ; DebugData PROC EXPORT EXPORT Generic EXPORT DebugAlert EXPORT OKBut EXPORT ButtonTxt EXPORT AbortButton EXPORT AbortText EXPORT CancelBut EXPORT CancelTxt EXPORT BreakButton EXPORT BreakText EXPORT DebugMsg EXPORT DebugMsgText EXPORT DebugMsgLen EXPORT Int1 EXPORT Int1Msg EXPORT Int1MsgSTART EXPORT Int1MsgText EXPORT Int2 EXPORT Int2Msg EXPORT Int2MsgSTART EXPORT Int2MsgText EXPORT DbgQuitParams EXPORT SimpAlert Generic STR 'DEBUG:' ;Generic STR 'Message? We don''''t need no stinking message!' DebugAlert DC.W 90,140,144,500 DC.W 729 ; a 'unique' ID DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.L OKBut DC.L CancelBut DC.L AbortButton DC.L BreakButton DC.L DebugMsg DC.L Int1 DC.L Int2 DC.L 0 ; terminator OKBut DC.W 1 DC.W 36,295,49,355 DC.W $000A ; Button DC.L ButtonTxt DC.W 0 DC.W 0 DC.L 0 ButtonTxt STR 'Cont.' AbortButton DC.W 2 DC.W 36,165,49,225 DC.W $000A DC.L AbortText DC.W 0 DC.W 0 DC.L 0 AbortText STR 'Abort' CancelBut DC.W 3 DC.W 36,230,49,290 DC.W $000A DC.L CancelTxt DC.W 0 DC.W 0 DC.L 0 CancelTxt STR 'Cancel' BreakButton DC.W 4 DC.W 36,100,49,160 DC.W $000A DC.L BreakText DC.W 0 DC.W 0 DC.L 0 BreakText STR 'Break' DebugMsg DC.W 5 DC.W 10,10,23,350 DC.W $800F DebugMsgText DC.L 0 DebugMsgLen DC.W 0 Int1 DC.W 6 DC.W 23,10,36,150 DC.W $800F Int1Msg DC.L Int1MsgSTART DC.W 0 Int1MsgSTART DC.B 10 DC.B '0x' Int1MsgText DS.B 8 Int2 DC.W 7 DC.W 36,10,49,99 DC.W $800F Int2Msg DC.L Int2MsgSTART DC.W 0 Int2MsgSTART DC.B 10 DC.B '0x' Int2MsgText DS.B 8 DbgQuitParams DC.L 0 DC.W $0000 SimpAlert DC.W 40,140,94,500 DC.W 934 ; a 'unique' ID DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.L OKBut DC.L DebugMsg DC.L Int1 DC.L 0 ; terminator ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PDRAG.S b/appleworksgs/PL/Src/PDRAG.S new file mode 100755 index 0000000..d2c3fc4 --- /dev/null +++ b/appleworksgs/PL/Src/PDRAG.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_Deref IMPORT D_NeedHand IMPORT P_AddGuide IMPORT P_ContentRect IMPORT P_FixPt IMPORT P_H IMPORT P_PageMode IMPORT P_RoundGuide IMPORT P_Traverse IMPORT P_V IMPORT D_UnLock IMPORT P_PaperRect IMPORT P_FullPaperRect ; pdrag.s ; Notes for D_DrawProc: ; newpt of -1,-1 says to get rid of the old drawing & nothing else ; newpt == oldpt says to get rid of old, then redraw it for real. ; need to clip as necessary. ;--------------------------------------------------------------------------- ; ; P_DragStuff (OldPt:l, starting D_MouseDown Q_Point ; Array:l, array HANDLE of guides/tabs ; Count:w, Number of items currently in array. ; D_DrawProc:l, procedure/function to draw tab/guide ; TabType:w, L/D/R ; Vert:w, Vertical Guide? ; Max:w, Maximum pixel position for valid whatever ; Min:w, Minimum ' ' ' ' " ; Erase:w Erase an old whatever first? ; ; ----> NewCount, NewArrayHdl, NewPt P_DragStuff PROC EXPORT ;Using P_Data local adjpt:l,hoffset:w,voffset:w local newpt:l,tmp:l,ptr:l,ppi:l input oldpt:l,count:w,array:l,D_DrawProc:l,tabtype:w input vert:w,max:w,min:w,dist:w,erase:w output newcount:w,amt:w error err begin stz err lda oldpt+2 and #$FFFE sta oldpt+2 moveaddr D_DrawProc,DrawIt+1 ; patch in the functional moveaddr D_DrawProc,DrawIt2+1 ; parameter. moveaddr D_DrawProc,DrawIt3+1 subword P_V,P_ContentRect,voffset ; correct for subword P_H,P_ContentRect+2,a ; scrolled-over-ness and #$FFFE ; make sure it's even sta hoffset ; pixelized, to be safe... lda vert bne VertMaxMin moveword max,newpt jsr AdjustPt moveword amt,max moveword min,newpt jsr AdjustPt moveword amt,min bra DidMaxMin VertMaxMin moveword max,newpt+2 jsr AdjustPt moveword amt,max moveword min,newpt+2 jsr AdjustPt moveword amt,min DidMaxMin lda count beq StartDrag rcall D_Deref,in=(array:ax),out=(ptr:ax) StartDrag lda erase beq DragLoop movelong #-1,newpt brl OKDraw DragLoop tool _GetMouse,in=(!newpt:l) lda newpt+2 and #$FFFE sta newpt+2 lda vert ; Only redraw beq HorizCmp ; when vertical cmpw oldpt+2,newpt+2 ; or horizontal jeq ContLoop ; changes, as bra DoneCmp ; is appropriate HorizCmp cmpw oldpt,newpt ; . jeq ContLoop ; : DoneCmp jsr AdjustPt ; Check to see if it is too D_Close to another one... lda count beq OKDraw call P_Traverse,in=(array:l,amt:w,#4:w,count:w),out=(tmp:w) lsr a lsr a cmp count bge CheckLesser addword amt,dist,a scmpw a,[ptr]:tmp bge DontMove CheckLesser subword amt,dist,y subword tmp,#4,tmp bmi OKDraw tya scmpw a,[ptr]:tmp ble DontMove OKDraw pushlong oldpt pushlong newpt pushword tabtype pushword vert DrawIt jsl * bra ContLoop DontMove movelong oldpt,newpt bra CheckDown ContLoop movelong newpt,oldpt CheckDown tool _StillDown,in=(#0:w),out=(a:w) jne DragLoop PutDown movelong newpt,oldpt jsr AdjustPt scmpw amt,min jlt NoDice scmpw max,amt jlt NoDice lda count beq NeedNew rcall D_UnLock,in=(array:ax) bra Unlocked NeedNew call D_NeedHand,in=(#4:l),out=(array:l) movelong [array],ptr movelong #0,[ptr] Unlocked lda P_PageMode beq DoAddG ; Round call P_RoundGuide,in=(amt:w,vert:w),out=(amt:w) moveword amt,newpt moveword amt,newpt+2 rcall P_FixPt,in=(newpt:ax),out=(newpt:ax) pushlong oldpt pushlong newpt pushword tabtype pushword vert DrawIt3 jsl * movelong newpt,oldpt DoAddG in amt:w,array:l,count:w,tabtype:w out count:w xerr err xcall P_AddGuide bra Dice NoDice movelong #-1,newpt Dice pushlong oldpt pushlong newpt pushword tabtype pushword vert DrawIt2 jsl * moveword count,newcount return ;------------------------- ; ; AdjustPt (local routine) ; adjust a Q_Point for drawing ; AdjustPt addword newpt,voffset,adjpt addword newpt+2,hoffset,adjpt+2 lda P_PageMode beq DidMap subword adjpt,voffset,adjpt subword adjpt+2,hoffset,adjpt+2 tool _MapPt,in=(!adjpt:l,#P_FullPaperRect:l,#P_PaperRect:l) DidMap lda vert beq HorizAmt lda adjpt+2 ; and #$FFFE ; Q_Mask to even pixel sta amt bra DidHV HorizAmt moveword adjpt,amt DidHV rts ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PEDIT.S b/appleworksgs/PL/Src/PEDIT.S new file mode 100755 index 0000000..41a8cf5 --- /dev/null +++ b/appleworksgs/PL/Src/PEDIT.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' include 'scrap.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_ClosePicture IMPORT D_CheckPurge IMPORT X_CopyOneHandle IMPORT X_CopyThread IMPORT D_Deref IMPORT X_DisposeScrap IMPORT X_DisposeThread IMPORT D_KillFont IMPORT D_MemoryError IMPORT P_BoundsRect IMPORT P_BuildUndo IMPORT P_CheckHand IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_DefFont IMPORT P_DefSize IMPORT P_DefStyle IMPORT P_DelObjList IMPORT P_DelObjects IMPORT P_DeselectAll IMPORT P_DrawObject IMPORT P_DrawRgn IMPORT P_Entry IMPORT P_errorAlert IMPORT P_FixMenus IMPORT P_FixRect IMPORT P_GetPictSize IMPORT P_HotRect IMPORT P_ImportHdl IMPORT P_ImportType IMPORT P_LastObj IMPORT P_ListOp IMPORT P_LoadWindowStuff IMPORT P_local2PL IMPORT P_NewObj IMPORT P_NewTool IMPORT P_NotActive IMPORT P_ObjList IMPORT P_PL2local IMPORT P_Page IMPORT P_PageMode IMPORT P_PastePt IMPORT P_Placing IMPORT P_ThreadDir IMPORT P_ThreadHdl IMPORT X_PostScrap IMPORT D_ScreenPort IMPORT X_SwitchFont IMPORT T_Clear IMPORT T_Copy IMPORT T_CpyOrClrObj IMPORT T_CurParHdl IMPORT T_Deactivate IMPORT T_Dot IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_DrawRuler IMPORT T_Editing IMPORT T_GetParSize IMPORT T_InvSelect IMPORT T_Mark IMPORT T_MarkLine IMPORT T_MarkObj IMPORT T_MarkOffset IMPORT T_MarkParag IMPORT T_Offset2Line IMPORT T_PL2WPText IMPORT T_Paste IMPORT T_ReThread IMPORT T_TextSelect IMPORT T_WP2PLText ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_AddObjList ENTRY P_ClearPrim ENTRY P_Copy ENTRY P_CopyObjList ENTRY P_CopyPrim ENTRY P_DrawImage ENTRY P_GetCenter ENTRY P_KillImport ;------------------------------------------------------------------------------ ; ; P_Cut (Window:l) : ImageRoutine:l ; P_Cut PROC EXPORT ;Using P_Data ;Using T_Data ;Using X_ClipData input Window:l output ImageRoutine:l local SType:w,ScrapHdl:l error Err begin +b in Window:l out ImageRoutine:l,SType:w,ScrapHdl:l xerr Err xcall P_Copy bcs Exit call X_PostScrap,in=(SType:w,ScrapHdl:l) call P_ClearPrim,in=(#1:w) Exit return ENDP ;------------------------------------------------------------------------------ ; ; P_Copy (Window:l) : ImageRoutine:l,SType:w,ScrapHdl:l ; P_Copy PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using X_ClipData input Window:l output ImageRoutine:l,SType:w,ScrapHdl:l error Err begin +b jsl P_Entry stz Err stz SType stzl ImageRoutine call P_BuildUndo,in=(#P_NoUndo:w) lda T_Editing beq NotText lda T_TextSelect beq Exit call T_Copy,out=(ScrapHdl:l),err=(Err) bcs Exit call T_PL2WPText,in=(ScrapHdl:l) moveword #WPText,SType bra Exit NotText call P_CopyPrim,out=(ScrapHdl:l),err=(Err) bcs Exit cpzl ScrapHdl beq Exit moveword #PLPict,SType movelong #P_DrawImage,ImageRoutine Exit return ENDP ;------------------------------------------------------------------------------ ; ; P_Paste (Window:l,ScrapHdl:l,X_ScrapType:w,PasteType:w,Where:l) ; ; Window - Window to paste into ; ScrapHdl - Handle to the scrap ; X_ScrapType - The type of scrap ; PasteType - 0:from menu; 1:directional; 2:import ; Where - Used if paste is directional P_Paste PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using X_ClipData input Window:l,ScrapHdl:l,X_ScrapType:w,PasteType:w,Where:l local ObjRect:r,Vert:w,Horiz:w,MidPt:w,Pt:l local Hdl:l,Ptr:l,PCount:w,OldWindow:l,OldEditing:w error Err begin +b stz Err movelong P_CurrentWin,OldWindow cmpl Window,P_CurrentWin beq Active inc P_NotActive call P_LoadWindowStuff,in=(Window:l) moveword T_Editing,OldEditing stz T_Editing Active jsl P_Entry call P_BuildUndo,in=(#P_NoUndo:w) jsl P_KillImport cmpw PasteType,#1 bne NotDir rcall P_local2PL,in=(Where:ax),out=(Where:ax) bra WhereSet NotDir rcall P_GetCenter,out=(Where:ax) WhereSet cmpw X_ScrapType,#WPTEXT jeq PasteText call T_Deactivate,in=(#1:w,#1:w) lda X_ScrapType cmp #PICT beq PastePict cmp #PLPICT jeq PasteObj brl Done PastePict lda PasteType cmp #2 jeq ImportPict call P_GetPictSize,in=(ScrapHdl:l),out=(Pt:l) lsr Pt lsr Pt+2 subword Where,Pt,ObjRect subword Where+2,Pt+2,ObjRect+2 lda P_PageMode bne MakePictObj lda ObjRect bpl TryLeft stz ObjRect TryLeft lda ObjRect+2 bpl MakePictObj stz ObjRect+2 ; Make D_New object code set the obj bounds from the picture MakePictObj movelong ObjRect,ObjRect+4 call P_NewTool,in=(#P_ARROW:w,#1:w) call P_NewObj,in=(#P_PICTURE:w,!ObjRect:l,ScrapHdl:l),out=(a:l) brl Done ImportPict inc P_Placing moveword #1,P_ImportType movelong ScrapHdl,P_ImportHdl stzl P_ThreadHdl brl Done PasteObj cmpw PasteType,#1 bne NotDir2 movelong Where,P_PastePt NotDir2 call P_NewTool,in=(#P_ARROW:w,#1:w) call P_AddObjList,in=(ScrapHdl:l) brl Done PasteText movelong [ScrapHdl],Ptr moveword [Ptr],PCount cmp #2500 blt Okay call P_errorAlert,in=(#0:w) brl KillScrap Okay ; Convert the scrap type in P_DefSize:b,P_DefStyle:b,P_DefFont:w,#0:w,ScrapHdl:l xcall X_SwitchFont call T_WP2PLText,in=(ScrapHdl:l),err=(Err) jcs KillScrap lda T_Editing bne InsertText cmpw PasteType,#2 beq ImportText ; Make a D_New Q_Text object and thread NewTextObj subword Where,#30,ObjRect addword Where,#30,ObjRect+4 subword Where+2,#100,ObjRect+2 addword Where+2,#100,ObjRect+6 call P_NewTool,in=(#P_ARROW:w,#1:w) call P_NewObj,in=(#P_ALPHA:w,!ObjRect:l,ScrapHdl:l),out=(a:l) brl Done ImportText inc P_Placing stz P_ImportType stzl P_ThreadHdl stz P_ThreadDir movelong ScrapHdl,P_ImportHdl bra Done InsertText call P_CheckHand,in=(#$8000:l),err=(Err) bcc Okay2 call P_errorAlert,in=(#1:w) call X_DisposeThread,in=(ScrapHdl:l,#1:w) bra Done Okay2 movelong T_CurParHdl,Hdl movelong [Hdl],Ptr addword [Ptr],PCount,a cmp #2500 blt Okay3 call P_errorAlert,in=(#0:w) call X_DisposeThread,in=(ScrapHdl:l,#1:w) bra Done Okay3 call T_Paste,in=(ScrapHdl:l,#1:w) bra Done KillScrap call X_DisposeScrap,in=(X_ScrapType:w,ScrapHdl:l) Done jsl P_FixMenus lda P_NotActive beq Exit moveword OldEditing,T_Editing call P_LoadWindowStuff,in=(OldWindow:l) stz P_NotActive Exit return ENDP ;------------------------------------------------------------------------------ ; ; P_Clear () ; P_Clear PROC EXPORT begin +b jsl P_Entry call P_ClearPrim,in=(#0:w) return ENDP ;------------------------------------------------------------------------------ ; ; P_ClearPrim (D_DoCut:w) ; P_ClearPrim PROC EXPORT ;Using P_Data ;Using T_Data input D_DoCut:w begin lda T_Editing beq DoObj lda D_DoCut bne @Cut pushword #P_ClearTextUndo bra Build @Cut pushword #P_CutTextUndo Build jsl P_BuildUndo jsl T_Clear bra Exit DoObj lda D_DoCut bne Cut2 pushword #P_ClearObjUndo bra Build2 Cut2 pushword #P_CutObjUndo Build2 jsl P_BuildUndo call P_DelObjects,in=(#0:w) Exit jsl P_FixMenus return ENDP ;------------------------------------------------------------------------------ ; ; P_SelectAll () ; P_SelectAll PROC EXPORT ;Using P_DATA ;Using P_OBJDATA ;Using T_Data local ParagHdl:l,ParagPtr:l begin +b jsl P_Entry lda T_Editing jeq SelObject call P_BuildUndo,in=(#0:w) jsl T_InvSelect stz T_DotParag moveword #7,T_DotOffset movelong T_CurParHdl,ParagHdl movelong [ParagHdl],ParagPtr lda [ParagPtr] dec a sta T_MarkParag rcall T_GetParSize,in=(a:a),out=(a:a) dec a ; No CR sta T_MarkOffset in T_DotParag:w,T_DotOffset:w out T_DotObj:l,T_DotLine:w xcall T_Offset2Line in T_MarkParag:w,T_MarkOffset:w out T_MarkObj:l,T_MarkLine:w xcall T_Offset2Line call T_DrawRuler cmpl T_Dot,T_Mark beq Exit moveword #1,T_TextSelect jsl T_InvSelect bra Exit SelObject call P_NewTool,in=(#P_Arrow:w,#1:w) call P_ListOp,in=(P_ObjList:l,#PL_SelectAll:w,#0:l,#0:l) Exit jsl P_FixMenus return ENDP ;------------------------------------------------------------------------------ ; ; P_Duplicate () ; P_Duplicate PROC EXPORT ;Using P_Data ;Using P_ObjData local ObjList:l begin +b jsl P_Entry call P_BuildUndo,in=(#P_NoUndo:w) call P_CopyPrim,out=(ObjList:l) bcs _MemErr call P_AddObjList,in=(ObjList:l) Exit return _MemErr jsl D_MemoryError bra Exit ENDP ;------------------------------------------------------------------------------ ; ; P_CopyPrim (): ObjList:l ; P_CopyPrim PROC EXPORT ;Using P_Data ;Using P_ObjData output ObjList:l error Err begin call P_CopyObjList,in=(P_ObjList:l,#1:w),out=(ObjList:l),err=(Err) bcs Exit call P_BoundsRect,in=(ObjList:l,#P_HotRect:l),out=(a:w) ; Set P_PastePt to middle of the bounds rectangle plus an offset addword P_HotRect,P_HotRect+4,a lsr a addword a,#6,P_PastePt addword P_HotRect+2,P_HotRect+6,a lsr a addword a,#12,P_PastePt+2 ; Offset object list to start at (0,0) pushlong ObjList pushword #PL_OffsetObj subword #0,P_HotRect+2,s subword #0,P_HotRect,s pushlong #0 jsl P_ListOp lda P_PageMode beq Exit call P_FixRect,in=(#P_HotRect:l,#P_RECTANGLE:w,#1:w,#0:w) Exit return ENDP ;----------------------------------------------------------------------------- ; ; P_CopyObjList (ObjHdl:l,CopyData:w) : CopyList:l ; ; If CopyData is true, any handles hanging off the object are also copied. P_CopyObjList PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu input ObjHdl:l,CopyData:w output CopyList:l error Err local ObjPtr:l,NewObj:l,NewPtr:l,LastObj:l,LastPtr:l local ObjNo:w,Size:l,ParagHdl:l,PictHdl:l,PictSize:l local SPar:w,EPar:w,SOffset:w,EOffset:w,Q_Line:w,LinePtr:l begin +b stz Err stzl CopyList stzl LastObj stz ObjNo WhileLoop cpzl ObjHdl jeq EndLoop rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) moveword [ObjPtr]:#P_Selected,a jeq NextObject call X_CopyOneHandle,in=(ObjHdl:l),out=(NewObj:l),err=(err) jcs CleanUp lda CopyData jeq DidObject ; If its a Q_Text object, call X_CopyWPScrap ; If its a picture, copy the PictHdl moveword [ObjPtr]:#P_Type,a cmp #P_ALPHA jne TryPict ; If this is the only object in the thread, I can copy it all. ; Otherwise I need to call T_Copy with the proper Dot and D_Mark. movelong [ObjPtr]:#P_ParagHdl,ParagHdl cpzl [ObjPtr]:#P_PThread bne PartCopy cpzl [ObjPtr]:#P_NThread bne PartCopy call X_CopyThread,in=(ParagHdl:l,#1:w),out=(ParagHdl:l),err=(Err) jcs PreCleanUp bra SetParHdl PartCopy call T_CpyOrClrObj,in=(ObjPtr:l,#1:w),out=(ParagHdl:l) SetParHdl movelong [NewObj],NewPtr movelong ParagHdl,[NewPtr]:#P_ParagHdl lda #0 moveword a,[NewPtr]:#P_PThread moveword a,[NewPtr]:#P_PThread+2 moveword a,[NewPtr]:#P_NThread moveword a,[NewPtr]:#P_NThread+2 bra DidObject TryPict cmp #P_PICTURE bne DidObject in [ObjPtr]:#P_PictHandle:l out PictHdl:l xerr Err xcall X_CopyOneHandle jcs PreCleanUp movelong [NewObj],NewPtr movelong PictHdl,[NewPtr]:#P_PictHandle DidObject ; Set CopyList if its the first object cpzl CopyList bne Set movelong NewObj,CopyList Set ; Maintain the links movelong [NewObj],NewPtr movelong LastObj,[NewPtr]:#P_Prev movelong #0,[NewPtr]:#P_Next cpzl LastObj beq First movelong [LastObj],LastPtr movelong NewObj,[LastPtr]:#P_Next First moveword ObjNo,[NewPtr]:#P_UndoData movelong NewObj,LastObj NextObject tool _HUnlock,in=(ObjHdl:l) inc ObjNo movelong [ObjPtr],ObjHdl brl WhileLoop EndLoop Exit return PreCleanUp tool _DisposeHandle,in=(NewObj:l) CleanUp call P_DelObjList,in=(CopyList:l,CopyData:w,#1:w) stzl CopyList bra Exit ENDP ;------------------------------------------------------------------------------ ; ; P_AddObjList (ObjList:l) P_AddObjList PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data input ObjList:l local CurObj:l,CurPtr:l,NextObj:l,ObjHdl:l,ObjPtr:l local RgnHdl:l,ScreenRect:r,BRect:r,Pt:l begin jsl P_DeselectAll cpzl ObjList jeq Exit ; Make sure PastePt is on screen rcall P_PL2local,in=(P_PastePt:ax),out=(Pt:ax) tool _PtInRect,in=(!Pt:l,#P_ContentRect:l),out=(a:w) bne OnScreen rcall P_GetCenter,out=(P_PastePt:ax) OnScreen ; Set Pt to offset each object to call P_BoundsRect,in=(ObjList:l,!BRect:l),out=(a:w) lsr BRect+4 subword P_PastePt,BRect+4,Pt lsr BRect+6 subword P_PastePt+2,BRect+6,Pt+2 ; Offset object list call P_ListOp,in=(ObjList:l,#PL_OffsetObj:w,Pt:l,#0:l) tool _NewRgn,out=(RgnHdl:l) call P_ListOp,in=(ObjList:l,#PL_AddUpdate:w,RgnHdl:l,#0:l) movelong ObjList,CurObj Loop movelong [CurObj],CurPtr movelong [CurPtr],NextObj cmpw [CurPtr]:#P_Type,#P_ALPHA bne Next lda #0 moveword a,[CurPtr]:#P_PThread moveword a,[CurPtr]:#P_PThread+2 moveword a,[CurPtr]:#P_NThread moveword a,[CurPtr]:#P_NThread+2 moveword a,[CurPtr]:#P_StartParag moveword a,[CurPtr]:#P_StartLine moveword P_Page,[CurPtr]:#P_PageNo call T_ReThread,in=(CurObj:l) Next cpzl NextObj beq EndLoop movelong NextObj,CurObj bra Loop EndLoop movelong [CurObj],CurPtr movelong P_ObjList,[CurPtr]:#P_Next cpzl P_ObjList beq NoObjects movelong P_ObjList,ObjHdl movelong [ObjHdl],ObjPtr movelong CurObj,[ObjPtr]:#P_Prev bra SetList NoObjects movelong CurObj,P_LastObj SetList movelong ObjList,P_ObjList call P_DrawRgn,in=(RgnHdl:l) addword P_PastePt,#6,P_PastePt addword P_PastePt+2,#12,P_PastePt+2 Exit return ENDP ;------------------------------------------------------------------------------- ; ; P_GetCenter () : Q_center:ax ; ; Gets the Q_center of the screen and returns it in D_PL Coordinates. P_GetCenter PROC EXPORT ;Using P_Data addword P_ContentRect+2,P_ContentRect+6,a lsr a tax addword P_ContentRect,P_ContentRect+4,a lsr a rcall P_local2PL,in=(ax:ax),out=(ax:ax) rtl ENDP ;------------------------------------------------------------------------------ ; ; P_DrawImage (Where:l) ; P_DrawImage PROC EXPORT ;Using P_Data input Where:l local Q_Rect:r,Tmp:w begin +b subword P_HotRect+4,P_HotRect,a lsr a sta Tmp subword Where,Tmp,Q_Rect addword Where,Tmp,Q_Rect+4 subword P_HotRect+6,P_HotRect+2,a lsr a sta Tmp subword Where+2,Tmp,Q_Rect+2 addword Where+2,Tmp,Q_Rect+6 cmpw Q_Rect,Q_Rect+4 beq Q_Line cmpw Q_Rect+2,Q_Rect+6 beq Q_Line tool _FrameRect,in=(!Q_Rect:l) bra Exit Q_Line tool _MoveTo,in=(Q_Rect:l) tool _LineTo,in=(Q_Rect+4:l) Exit return ENDP ;------------------------------------------------------------------------------ ; ; P_MakePict (ObjHdl:l) : PictHdl:l ; ; This routine makes a picture out of an object list. ; It can be called when I get a convert scrap message routine from the ; driver or when I get unloaded. P_MakePict PROC EXPORT ;Using D_GlobalData ;Using P_ObjData ;Using P_Data ;Using T_Data input ObjHdl:l output PictHdl:l error Err local PicFrame:r,ObjPtr:l,LastObj:l,OldPort:l,ClipRgn:l begin +b stz Err pushword P_PageMode stz P_PageMode ; Get the bounding Q_Rect call P_BoundsRect,in=(ObjHdl:l,!PicFrame:l),out=(a:w) call P_FixRect,in=(!PicFrame:l,#P_RECTANGLE:w,#0:w,#1:w) ; Get the last object, so I can draw them back to front. Loop movelong ObjHdl,LastObj movelong [ObjHdl],ObjPtr movelong [ObjPtr],ObjHdl cpzl ObjHdl bne Loop tool _GetPort,out=(OldPort:l) tool _SetPort,in=(>D_ScreenPort:l) jsl D_KillFont tool _NewRgn,out=(ClipRgn:l) tool _GetClip,in=(ClipRgn:l) tool _ClipRect,in=(!PicFrame:l) tool _OpenPicture,in=(!PicFrame:l),out=(PictHdl:l),err=(Err) bcs RestorePort tool _SetFontFlags,in=(#4:w) tool _SetTextMode,in=(#modeForeCopy:w) ; Draw the objects movelong LastObj,ObjHdl WhileLoop cpzl ObjHdl beq EndLoop call P_DrawObject,in=(ObjHdl:l,#1:w),err=err bcs endloop movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_Prev,ObjHdl bra WhileLoop EndLoop jsl D_ClosePicture bcc @ok @picErr lda #$201 bra @bad @ok lda err bne @bad jsl D_CheckPurge bcc RestorePort @bad sta Err tool _KillPicture,in=(PictHdl:l) jsl D_CheckPurge RestorePort tool _PenNormal tool _SetClip,in=(ClipRgn:l) tool _SetPort,in=(OldPort:l) pullword P_PageMode return ENDP ;------------------------------------------------------------------------------ ; ; P_KillImport () ; ; Kills a pending import or thread operation. P_KillImport PROC EXPORT ;Using P_Data begin lda P_Placing beq Exit stz P_Placing cpzl P_ThreadHdl bne ZeroStuff lda P_ImportType beq Q_Text tool _DisposeHandle,in=(P_ImportHdl:l) bra ZeroStuff Q_Text call X_DisposeThread,in=(P_ImportHdl:l,#1:w) ZeroStuff stzl P_ThreadHdl stzl P_ImportHdl Exit return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PFILE.S b/appleworksgs/PL/Src/PFILE.S new file mode 100755 index 0000000..9e04195 --- /dev/null +++ b/appleworksgs/PL/Src/PFILE.S @@ -0,0 +1 @@ +***************************************************************************************************** ; PL I/O Routines ; ; This file contains the routines used by PL to open and save documents. ; ***************************************************************************************************** load 'macros.dump' include 'driver.equ' include 'pl.equ' IMPORT D_BeachBall IMPORT D_Deref IMPORT D_DestroyByRef IMPORT D_FastMult IMPORT D_NeedHand IMPORT D_Read2 IMPORT D_ReadHandle2 IMPORT D_SetCursor IMPORT D_UnLock IMPORT D_Write2 IMPORT D_WriteHandle2 IMPORT P_CheckHand IMPORT P_CurrentWin IMPORT P_ErrorAlert IMPORT P_Header IMPORT P_HeaderSize IMPORT P_HorizGCount IMPORT P_HorizGuides IMPORT P_InitDoc IMPORT P_KillPage IMPORT P_LastObj IMPORT P_LoadPage IMPORT P_LoadWindowStuff IMPORT P_MergeGuides IMPORT P_NotActive IMPORT P_OBJSIZES IMPORT P_ObjList IMPORT P_PInfoSize IMPORT P_Page IMPORT P_PageArray IMPORT P_PageCount IMPORT P_SavePage IMPORT P_SaveWindowStuff IMPORT P_ShowDoc IMPORT P_UseTemplate IMPORT P_Version IMPORT P_VertGCount IMPORT P_VertGuides IMPORT T_ReThread IMPORT X_ReadWPScrap IMPORT X_WriteWPScrap IMPORT X_DisposeThread ***************************************************************************************************** ; P_Thread2Pair ( ThreadHdl:long ): PageNo:word, ObjNo:word ; ; This routine is called to determine the page and object number for a given text thread. The page ; and object numbers will be used when saving to disk to replace the handles. These values can be ; used on an Open to correctly relink the new handles in the same way. P_Thread2Pair PROC EXPORT ;Using P_Data ;Using P_ObjData input ThreadHdl:l output PageNo:w,ObjNo:w local Hdl:l,Ptr:l,ThreadPtr:l,ObjHdl:l,ObjPtr:l,Offset:l begin ; If thread handle is NIL then blow it off. cpzl ThreadHdl beq NoThread ; Get page number from the thread. movelong [ThreadHdl],ThreadPtr moveword [ThreadPtr]:#P_PageNo,PageNo ; Get pointer to page entry in the page array. tool _Multiply,in=(PageNo:w,#P_PInfoSize:w),out=(Offset:l) movelong P_PageArray,Hdl movelong [Hdl],Ptr addlong Ptr,Offset,Ptr ; Scan page object list to see if we can find the thread we are looking for. Get its object number. movelong [Ptr],ObjHdl stz ObjNo loop cmpl ObjHdl,ThreadHdl beq exit movelong [ObjHdl],ObjPtr movelong [ObjPtr],ObjHdl inc ObjNo bra loop ; The thread was NIL so return page number and object number of -1. NoThread moveword #-1,PageNo sta ObjNo exit return ENDP ***************************************************************************************************** ; P_Pair2Thread ( PageNo:word, ObjNo:word ): ThreadHdl:long ; ; This routine is called to determine the text thread corresponding to the given text object for ; the given page. P_Pair2Thread PROC EXPORT ;Using P_Data ;Using P_ObjData input PageNo:w,ObjNo:w output ObjHdl:l local Hdl:l,Ptr:l,ObjPtr:l,Offset:l begin ; If page number is -1 then no thread exists for this page object; return NIL. cmpw PageNo,#-1 beq NoThread ; Get pointer to page entry in the page array. tool _Multiply,in=(PageNo:w,#P_PInfoSize:w),out=(Offset:l) movelong P_PageArray,Hdl movelong [Hdl],Ptr addlong Ptr,Offset,Ptr ; Scan object array for the given page to find the object handle for the given object number. movelong [Ptr],ObjHdl ldx #0 loop cpx ObjNo beq exit movelong [ObjHdl],ObjPtr movelong [ObjPtr],ObjHdl inx bra loop ; No thread exists for this page/object return NIL. NoThread stzl ObjHdl exit return ENDP ***************************************************************************************************** ; P_SetParag ( ObjectPtr:long ) ; ; This routine is called to put the given objects paragraph handle into all the text threads in ; its linked list. P_SetParag PROC EXPORT ;Using P_ObjData input objptr:l local objhdl:l,paraghdl:l begin movelong [objptr]:#P_ParagHdl,paraghdl objloop cpzl [objptr]:#P_NThread beq exit movelong [objptr]:#P_NThread,objhdl movelong [objhdl],objptr movelong paraghdl,[objptr]:#P_ParagHdl bra objloop exit return ENDP ***************************************************************************************************** ; P_OpenDoc ( FileId:word, WindowPtr:long ) ; ; This routine will handle reading in a page layout document with the given file reference. The ; file has already been opened by the driver and the file mark moved to the start of the document ; data. Memory or file I/O errors are returned to the driver which will handle closing the file and ; alerting the user. P_OpenDoc PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using D_IOData ;Using P_RulerData input fileid:w,window:l local page:w,pagecount:w,oldpage:w,tmp:l,tmphdl:l local oldwin:l,tmpobj:l,objptr:l,xhdl:l,xtype:w local xobj:l,xobjhdl:l,table:l,refcon:l,lastpage:w ; these 4 variables are clustered. Do not rearrange or seperate. local templ:w,hguide:w,vguide:w,count:w error err begin +b ; Clear local variables and put up the watch cursor. stzl tmp stzl tmphdl stzl xobj stzl xobjhdl stzl table stzl refcon stzl oldwin stzl tmpobj stzl objptr stz pagecount call D_SetCursor,in=(#WatchCursor:w) ; Page out current window information. Set table to point to table of object sizes. movelong P_CurrentWin,oldwin call P_SaveWindowStuff,in=(oldwin:l) movelong #P_OBJSIZES,table ; If we can't get 32k then probably shouldn't be trying to open a document. Return driver a memory ; error. call P_CheckHand,in=(#$8000:l),err=(err) jcs exit ; Read header information for the file. If read error then return with error to driver. call D_Read2,in=(fileid:w,#P_Header:l,#P_HeaderSize:l),out=(ax:l),err=(err) jcs exit ; Check if PL id present in file if not then this file must be damaged or not a real PL file. Since ; we are handling the error return -1 to the driver. jsr chkversion jcs exit ; Traverse the document page by page, object by object... ; File looks OK so far; clear error status and get temp object for use in loading file. If we can't ; get it return to the driver with a mem error, else lock down the temp object and clear the temp ; object handle variable. stz err call D_NeedHand,in=(#P_TextObjSize:l),out=(xobjhdl:l),err=(err) jcs exit rcall D_Deref,in=(xobjhdl:ax),out=(xobj:ax) movelong #0,xhdl ; Initialize the document structure. Get refcon in case we need to dispose it on error. call P_InitDoc,in=(window:l),out=(refcon:l),err=err jcs killxobj ; Initialize pagecount (including master pages) and current/last page. addword P_PageCount,#2,pagecount moveword #-1,page sta lastpage ; Try to allocate a page array large enough to hold all the pages in the document. If we can't then ; dispose of the temp object and the refcon we allocated. spacelong tool _Multiply,in=(#P_PInfoSize:w,pagecount:w),out=(:l) call D_NeedHand,err=(err) pulllong P_PageArray jcs killrefcon ; Remember what the old page used to be. Clear loop variables and bump to next page and last page. moveword P_Page,oldpage pageloop stzl P_HorizGuides stzl P_VertGuides stzl P_ObjList stzl P_LastObj inc page inc lastpage ; Read count, vguide, hguide and templ in one call. If error reading then dispose of all pages read ; so far, refcon, and xobj before returning mem error to the driver. Set global based on values read. call D_Read2,in=(fileid:w,!count:l,#8:l),out=(ax:l),err=(err) jcs killpages moveword vguide,P_VertGCount moveword hguide,P_HorizGCount moveword templ,P_UseTemplate ; Read in objects from file. objloop jsl D_BeachBall dec count jmi doneobj ; Get object information. If error then dispose of all memory allocated so far. stzl xhdl call D_Read2,in=(fileid:w,xobj:l,#P_TextObjSize:l),out=(ax:l),err=(err) jcs killpages ; Check if object type is text object. If so check if text object has a thread associated with it. ; If not then ready to add object to page layout, else read in text thread for the object. cmpw [xobj]:#P_Type,#P_ALPHA bne CkPict cmpw [xobj]:#P_PThread,#-1 jne DidObj call X_ReadWPScrap,in=(FileId:w,#1:w),out=(tmp:l),err=err jcs killpages ; Put text thread into the temp object. Unlock the text thread since read WP returns it locked. movelong tmp,xhdl moveword #P_Alpha,xtype movelong xhdl,[xobj]:#P_ParagHdl rcall D_UnLock,in=(xhdl:ax) bra DidObj ; Check if object type is PICT. If so read in PICT handle. CkPict cmp #P_PICTURE bne DidObj call D_ReadHandle2,in=(fileid:w),out=(tmp:l),err=(err) jcs killpages ; Put picture handle in temp object. Unlock the pict handle since read handle returns it locked. movelong tmp,xhdl moveword #P_Picture,xtype movelong xhdl,[xobj]:#P_PictHandle rcall D_UnLock,in=(xhdl:ax) ; Xobj now has entire object including picture or text thread handles. Check if valid object type ; if not the file must be corrupt; warn user and dispose of all memory so far allocated. DidObj cmpw [xobj]:#P_Type,#P_Picture+1 blt oktype moveword #-1,err call P_ErrorAlert,in=(#2:w) brl killpages ; Make copy of temp object to put in the data structure. If memory error then dispose of all memory ; so far allocated and return with mem error. { use table to determine true size needed for object } oktype dec a asl a asl a tay movelong [table]:y,tmp call D_NeedHand,in=(tmp:l),out=(tmphdl:l),err=(err) jcs killpages tool _BlockMove,in=(xobj:l,[tmphdl]:l,tmp:l) stzl xhdl ; Get pointer to new object. Add object to linked list. movelong [tmphdl],tmp IsNil P_ObjList bne NotFirst movelong tmphdl,P_ObjList movelong tmphdl,P_LastObj movelong #0,[tmp] movelong #0,[tmp]:#P_Prev bra DidInsert NotFirst movelong P_LastObj,[tmp]:#P_Prev movelong #0,[tmp] movelong tmphdl,P_LastObj movelong [tmp]:#P_Prev,tmphdl movelong [tmphdl],tmp movelong P_LastObj,[tmp] DidInsert brl objloop ; Object successfully added to page data structure. If horz. guides exists then read its handle. doneobj lda hguide beq CkVguide call D_ReadHandle2,in=(fileid:w),out=(P_HorizGuides:l),err=(err) bcc GotH stzl P_HorizGuides brl killpages GotH rcall D_UnLock,in=(P_HorizGuides:ax) ; If vert. guides exist then read its handle. CkVguide lda vguide beq DidGuides call D_ReadHandle2,in=(fileid:w),out=(P_VertGuides:l),err=(err) bcc GotV stzl P_VertGuides brl killguides GotV rcall D_UnLock,in=(P_VertGuides:ax) ; Save page information. And go back for any remaining pages to be loaded. DidGuides call P_SavePage,in=(page:w) dec pagecount jne pageloop ; Verify that file is still valid by checking version numbers. call D_Read2,in=(fileid:w,#P_Header:l,#2:l),out=(ax:l),err=(err) jcs gokillgs jsr chkversion gokillgs jcs killguides stz err ; File completely read in. Now repair threads so they use real handles instead of page number and ; object number offsets. ; Repair threads, part I. Loop through all objects on all pages updating their next & previous thread ; handles if they are text objects. addword P_PageCount,#2,pagecount moveword #-1,page pageloop2 inc page call P_LoadPage,in=(page:w) stz count movelong P_ObjList,tmpobj objloop2 jsl D_BeachBall IsNil tmpobj jeq doneobj2 rcall D_Deref,in=(tmpobj:ax),out=(objptr:ax) cmpw [objptr]:#P_Type,#P_ALPHA bne DidText call P_Pair2Thread,in=([objptr]:#P_PThread:l),out=([objptr]:#P_PThread:l) call P_Pair2Thread,in=([objptr]:#P_NThread:l),out=([objptr]:#P_NThread:l) DidText rcall D_UnLock,in=(tmpobj:ax) movelong [objptr],tmpobj brl objloop2 doneobj2 call P_SavePage,in=(page:w) dec pagecount jne pageloop2 ; Repair threads, part II. Loop through all objects on all pages and if object is a text object then ; set the paragraph blocks for all objects in the list then rethread the object. addword P_PageCount,#2,pagecount moveword #-1,page pageloop3 inc page call P_LoadPage,in=(page:w) stz count movelong P_ObjList,tmpobj objloop3 jsl D_BeachBall IsNil tmpobj jeq doneobj3 rcall D_Deref,in=(tmpobj:ax),out=(objptr:ax) cmpw [objptr]:#P_Type,#P_ALPHA jne DidText3 cpzl [objptr]:#P_PThread bne DidText3 call P_SetParag,in=(objptr:l) call T_ReThread,in=(tmpobj:l) DidText3 rcall D_UnLock,in=(tmpobj:ax) movelong [objptr],tmpobj brl objloop3 doneobj3 call P_SavePage,in=(page:w) dec pagecount jne pageloop3 ; Successfully loaded file get ready to show document. Load the original page that document was saved ; on and merge guides. Then dispose of xobj. call P_ShowDoc,in=(window:l),err=(err) bcs killpages call P_LoadPage,in=(oldpage:w) call P_MergeGuides brl killxobj ; Error loading file so dispose of memory we have allocated. killguides lda hguide beq killvguide cpzl P_HorizGuides beq killvguide tool _DisposeHandle,in=(P_HorizGuides:l) killvguide lda vguide beq killpages cpzl P_VertGuides beq killpages tool _DisposeHandle,in=(P_VertGuides:l) killpages call P_SavePage,in=(page:w) riploop jsl D_BeachBall call P_KillPage,in=(lastpage:w,#1:w) dec lastpage bpl riploop killparray tool _DisposeHandle,in=(P_PageArray:l) ; Error loading file so dispose of memory we have allocated. killrefcon tool _DisposeHandle,in=(RefCon:l) killxobj tool _DisposeHandle,in=(xobjhdl:l) ; If paragraph handle exists in the temp object make sure to dispose of it too. cpzl xhdl beq exit cmpw xtype,#P_Picture beq killpict call X_DisposeThread,in=(xhdl:l,#1:w) bra exit killpict tool _KillPicture,in=(xhdl:l) ; Restore old window before returning. exit call P_LoadWindowStuff,in=(oldwin:l) return ;...................................................................................................; ; Check if PL id present in file if not then this file must be damaged or not a real PL file. Since ; we are handling the error return -1 to the driver. chkversion moveword #-1,err lda P_Version xba and #$FF cmp #P_ID beq CkVers1 ldx #2 bra doalert ; Warn user that this version of file cannot be loaded. CkVers1 lda P_Version and #$FF cmp #P_VNum beq chkvok ldx #3 doalert call P_ErrorAlert,in=(x:w) sec rts chkvok clc rts ;...................................................................................................; ENDP ;--------------------------------------------------------------------------- ; ; P_SaveDoc (Fileid:w,Winptr:l,BogusType:w) ; P_SaveDoc PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using D_IOData ;Using D_GlobalData input fileid:w,winptr:l,bogusType:w local oldwin:l,oldpage:w local xobjhdl:l,xobj:l,pagecount:w,page:w local tmpobj:l,objptr:l ; these 4 variables are clustered. Do not rearrange or seperate. local templ:w,hguide:w,vguide:w,count:w ; error err begin +b call D_SetCursor,in=(#WatchCursor:w) cmpl WinPtr,P_CurrentWin beq Active inc P_NotActive Active movelong P_CurrentWin,oldwin call P_LoadWindowStuff,in=(winptr:l) moveword P_Page,oldpage call P_SavePage,in=(P_Page:w) moveword #P_VersNum,P_Version call D_Write2,in=(fileid:w,#P_Header:l,#P_HeaderSize:l),out=(ax:l),err=(err) jcs Whoops ;** ; ;************************************ ; Traverse the document, page by page ; object by object call D_NeedHand,in=(#P_TextObjSize:l),out=(xobjhdl:l),err=(err) jcs Whoops ;** rcall D_Deref,in=(xobjhdl:ax),out=(xobj:ax) addword P_PageCount,#2,pagecount moveword #-1,page pageloop inc page call P_LoadPage,in=(page:w) stz count movelong P_ObjList,tmpobj countloop IsNil tmpobj beq gotcount inc count movelong [tmpobj],objptr movelong [objptr],tmpobj bra countloop gotcount moveword P_VertGCount,vguide moveword P_HorizGCount,hguide moveword P_UseTemplate,templ call D_Write2,in=(fileid:w,!count:l,#8:l),out=(ax:l),err=(err) jcs Whoops ;** movelong P_ObjList,tmpobj objloop IsNil tmpobj jeq doneobj rcall D_Deref,in=(tmpobj:ax),out=(objptr:ax) cmpw [objptr]:#P_Type,#P_ALPHA jne CkPict tool _BlockMove,in=(objptr:l,xobj:l,#P_TextObjSize:l) in [xobj]:#P_PThread:l out [xobj]:#P_PThread:l xcall P_Thread2Pair in [xobj]:#P_NThread:l out [xobj]:#P_NThread:l xcall P_Thread2Pair call D_Write2,in=(fileid:w,xobj:l,#P_TextObjSize:l),out=(ax:l),err=(err) jcs Whoops ;** moveword [objptr]:#P_PThread,a iny iny ora [objptr],y jne DidObj call X_WriteWPScrap,in=(fileid:w,[xobj]:#P_ParagHdl:l,#1:w),err=(err) jcs whoops ;** brl DidObj CkPict cmp #P_PICTURE bne NormObj call D_Write2,in=(fileid:w,objptr:l,#P_TextObjSize:l),out=(ax:l),err=(err) jcs Whoops ;** call D_WriteHandle2,in=(fileid:w,[objptr]:#P_PictHandle:l),err=(err) jcs Whoops ;** pushlong [objptr]:#P_PictHandle _HUnlock bra DidObj NormObj call D_Write2,in=(fileid:w,objptr:l,#P_TextObjSize:l),out=(ax:l),err=(err) jcs Whoops ;** DidObj rcall D_UnLock,in=(tmpobj:ax) movelong [objptr],tmpobj brl objloop doneobj lda hguide beq CkVguide call D_WriteHandle2,in=(fileid:w,P_HorizGuides:l),err=(err) jcs Whoops ;** rcall D_UnLock,in=(P_HorizGuides:ax) CkVguide lda vguide beq DidGuides call D_WriteHandle2,in=(fileid:w,P_VertGuides:l),err=(err) jcs Whoops ;** rcall D_UnLock,in=(P_VertGuides:ax) DidGuides dec pagecount jne pageloop call D_Write2,in=(fileid:w,#P_Header:l,#2:l),out=(ax:l),err=(err) ; bcs Whoops ;** ; ; bra exit whoops ; The driver now does all file cleanup! exit tool _DisposeHandle,in=(xobjhdl:l) call P_LoadPage,in=(oldpage:w) call P_LoadWindowStuff,in=(oldwin:l) stz P_NotActive return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PGUIDE.S b/appleworksgs/PL/Src/PGUIDE.S new file mode 100755 index 0000000..646d8b7 --- /dev/null +++ b/appleworksgs/PL/Src/PGUIDE.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT Asc2Fix IMPORT D_CloseDialog IMPORT D_DecimalOnly IMPORT D_Deref IMPORT Fix2Asc IMPORT D_GetNewModalDialog IMPORT D_NeedHand IMPORT P_AddGuide IMPORT P_AllHGCount IMPORT P_AllHGuides IMPORT P_AllVGCount IMPORT P_AllVGuides IMPORT P_BuildUndo IMPORT P_ContentRect IMPORT P_DefSize IMPORT P_DeleteData IMPORT P_DoScritch IMPORT P_DragStuff IMPORT P_ExplodeGuide IMPORT P_FindGuide IMPORT P_Fix2Int IMPORT P_FixPt IMPORT P_H IMPORT P_HorizGCount IMPORT P_HorizGuides IMPORT P_Local2PL IMPORT P_LockGuides IMPORT P_MergeGuides IMPORT P_OldIdlePt IMPORT P_PageMode IMPORT P_PageRect IMPORT P_PaperRect IMPORT P_PrintHand IMPORT P_SGuideDlog IMPORT P_TrackMaskHorz IMPORT P_TrackMaskVert IMPORT P_TrackOn IMPORT P_V IMPORT P_VRulRect IMPORT P_VertGCount IMPORT P_VertGuides IMPORT P_VisGuides IMPORT D_Set4Pat IMPORT D_SetCursor IMPORT D_UnLock IMPORT D_FastMult IMPORT P_FullPaperRect IMPORT D_UseStdColors ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_DrawAGuide ENTRY P_KillOldGuides ; pguide.s ;----------------------------------------------------------------------------- ; ; P_NewGuide (Vert:w) ; P_NewGuide PROC EXPORT ;Using P_Data input Vert:w local Amount:w,Count:w,Offset:w,guiderect:r local Max:w,Min:w,array:l,dist:w,tmprect:r local amt:l,newcount:w error err begin stz err lda vert bne SetVert call D_SetCursor,in=(#UpDownCursor:w) bra DidCursor SetVert call D_SetCursor,in=(#LeftRightCursor:w) DidCursor movelong P_ContentRect+4,tmprect+4 stz tmprect moveword P_VRulRect+2,tmprect+2 tool _ClipRect,in=(!tmprect:l) lda vert bne VertArray moveword P_AllHGCount,Count movelong P_AllHGuides,array moveword P_ContentRect,Min moveword P_ContentRect+4,Max moveword #2,dist bra DidArrays VertArray moveword P_AllVGCount,Count movelong P_AllVGuides,array moveword P_ContentRect+2,Min moveword P_ContentRect+6,Max moveword #4,dist DidArrays in #641:w,#201:w,count:w,array:l,#P_DrawAGuide:l,#RulerGuide:w in Vert:w,Max:w,Min:w,dist:w,#0:w out newcount:w,amt:w xerr err xcall P_DragStuff call P_BuildUndo,in=(#P_GuideUndo:w) cmpw count,newcount beq DidMove lda vert beq GetHoriz movelong P_VertGuides,array moveword P_VertGCount,count bra DidArrays2 GetHoriz movelong P_HorizGuides,array moveword P_HorizGCount,count DidArrays2 bne Unlocked NeedNew call D_NeedHand,in=(#4:l),out=(array:l) Unlocked ; ; Place it in the array. in amt:w,array:l,count:w,#RulerGuide:w out a:w xerr err xcall P_AddGuide done lda vert beq HorizCount inc P_VertGCount inc P_AllVGCount movelong array,P_VertGuides bra DidMove HorizCount inc P_HorizGCount inc P_AllHGCount movelong array,P_HorizGuides DidMove exit call P_MergeGuides tool _ClipRect,in=(#P_ContentRect:l) return ENDP ;----------------------------------------------------------------------------- ; ; P_MoveGuide (Pt:l) -- localized Q_Point ; ; D_MouseDown at Pt. ; Look through page's guidelists to see if it should be dragged. ; If so, rip it out of the master guidelist, then call the drag ; routine with the master guidelist. Rip it out of the page ; guide list and re-insert it if it still exists. ; ; DragStuff needs to return a Q_Point. Guide existance can be checked ; by looking at the input/output count. The returned Q_Point is used ; for insertion into the page's guidelist. ; P_MoveGuide PROC EXPORT ;Using P_Data input Pt:l output MovedIt:w local vert:w,offset:w,array:l,count:w local amt:w,newcount:w,OrigPt:l local Max:w,Min:w,Dist:w local tmprect:r,NewPt:l local _p_array:l,_p_count:w local hwidth:w,vwidth:w,guidetype:w error err begin ; Q_Point needs to be 'widened' to check 1 pixel above & below, ; 2 Q_Pixels each to the left & right? ; needs to coincide w/ draggings nearness checking. stz MovedIt lda P_LockGuides ; Don't drag if guides are X_Locked jne exit lda P_VisGuides ; or hidden. jeq exit moveword #2,vwidth moveword #1,hwidth movelong Pt,OrigPt lda P_PageMode beq DidMap asl vwidth asl vwidth ; ;** ? asl hwidth inc hwidth ; check vertical guides DidMap moveword #1,vert movelong P_VertGuides,array moveword P_VertGCount,count moveword Pt+2,amt moveword P_ContentRect+2,Min moveword P_ContentRect+6,Max moveword #4,dist in array:l,count:w,amt:w,vwidth:w,#-1:w out offset:w,Pt+2:w,guidetype:w xcall P_FindGuide lda offset bpl Removal ; check horizontal guides stz vert movelong P_HorizGuides,array moveword P_HorizGCount,count moveword Pt,amt moveword P_ContentRect,Min moveword P_ContentRect+4,Max moveword #2,dist in array:l,count:w,amt:w,hwidth:w,#-1:w out offset:w,Pt:w,guidetype:w xcall P_FindGuide lda offset bpl Removal brl exit ; remove it. Removal call P_BuildUndo,in=(#P_GuideUndo:w) lda count dec a bne DeleteIt tool _DisposeHandle,in=(array:l) stzl array stz count bra Deleted DeleteIt call P_DeleteData,in=(array:l,offset:w,#1:w,#4:w,count:w),err=(err) dec count Deleted moverect P_ContentRect,tmprect lda vert beq DoHoriz dec P_VertGCount rcall P_FixPt,in=(Pt:ax,#1:y),out=(NewPt:ax) stx tmprect+2 inx stx tmprect+6 bra DidUnMap DoHoriz dec P_HorizGCount rcall P_FixPt,in=(Pt:ax,#0:y),out=(NewPt:ax) sta tmprect inc a sta tmprect+4 DidUnmap ; re-merge call P_MergeGuides lda vert beq HorizMerge movelong P_AllVGuides,_p_array moveword P_AllVGCount,_p_count bra DidMerge HorizMerge movelong P_AllHGuides,_p_array moveword P_AllHGCount,_p_count DidMerge tool _EraseRect,in=(!tmprect:l) tool _InvalRect,in=(!tmprect:l) movelong P_ContentRect+4,tmprect+4 stz tmprect moveword P_VRulRect+2,tmprect+2 tool _ClipRect,in=(!tmprect:l) lda P_TrackOn beq DidScritch call P_DoScritch,in=(P_OldIdlePt:l) stz P_TrackOn DidScritch lda vert bne DoLeftRight call D_SetCursor,in=(#UpDownCursor:w) bra DidCurse DoLeftRight call D_SetCursor,in=(#LeftRightCursor:w) DidCurse ; drag it. in #641:w,#201:w,_p_count:w,_p_array:l,#P_DrawAGuide:l,guidetype:w in Vert:w,Max:w,Min:w,dist:w,#0:w out newcount:w,amt:w xerr err xcall P_DragStuff inc MovedIt cmpw _p_count,newcount beq DidMove lda count bne Unlocked NeedNew call D_NeedHand,in=(#4:l),out=(array:l) Unlocked ; ; Place it in the array. in amt:w,array:l,count:w,guidetype:w out a:w xerr err xcall P_AddGuide done lda vert beq HorizCount inc P_VertGCount inc P_AllVGCount movelong array,P_VertGuides bra DidMove HorizCount inc P_HorizGCount inc P_AllHGCount movelong array,P_HorizGuides DidMove call P_MergeGuides tool _ClipRect,in=(#P_ContentRect:l) exit return ENDP ;------------------------------------------------------------------------------ ; ; P_DrawGuides (RectPtr:l) ; P_DrawGuides PROC EXPORT ;Using P_Data input RectPtr:l local Ptr:l,Count:w,H:w,V:w,offset:l begin ThePt equ V subword P_ContentRect,P_V,offset subword P_ContentRect+2,P_H,offset+2 lda P_AllVGCount beq DoHoriz ; draw vertical guides rcall D_Deref,in=(P_AllVGuides:ax),out=(Ptr:ax) stz Count VLoop lda Count cmp P_AllVGCount bge DoneVert asl a asl a tay moveword [Ptr]:y,H lda P_PageMode beq NormV tool _MapPt,in=(!ThePt:l,#P_PaperRect:l,#P_FullPaperRect:l) bra ShowV NormV addword H,offset+2,H ShowV call P_DrawAGuide,in=(#-1:l,H:w,#0:w,#-1:w,#1:w) inc Count bra VLoop DoneVert rcall D_UnLock,in=(P_AllVGuides:ax) ; draw horizontal guides DoHoriz lda P_AllHGCount beq Exit rcall D_Deref,in=(P_AllHGuides:ax),out=(Ptr:ax) stz Count HLoop lda Count cmp P_AllHGCount bge DoneHoriz asl a asl a tay moveword [Ptr]:y,V lda P_PageMode beq NormH tool _MapPt,in=(!ThePt:l,#P_PaperRect:l,#P_FullPaperRect:l) bra ShowH NormH addword V,offset,V ShowH call P_DrawAGuide,in=(#-1:l,#0:w,V:w,#-1:w,#0:w) inc Count bra HLoop DoneHoriz rcall D_UnLock,in=(P_AllHGuides:ax) Exit _PenNormal return ENDP ;--------------------------------------------------------------------------- ; ; P_DrawAGuide ; ; Notes for D_DrawProc: ; ; newpt of -1,-1 says to get rid of the old drawing & nothing else ; ; newpt == oldpt says to get rid of old, then redraw it for real. ; ; oldpt == -1,-1 says just draw it ; ; need to clip as necessary before calling this. ; Coordinates are in WINDOW local -- not offset nor scaled. ; P_DrawAGuide PROC EXPORT ;Using P_Data input oldpt:l,newpt:l,type:w,vert:w local tmprect:r begin movelong P_ContentRect+4,tmprect+4 call D_Set4Pat,in=(#Black:w) tool _SetPenSize,in=(#1:w,#1:w) tool _SetPenMode,in=(#notXOR:w) lda vert beq MaskVert tool _SetPenMask,in=(#P_TrackMaskVert:l) bra DidMask MaskVert tool _SetPenMask,in=(#P_TrackMaskHorz:l) DidMask ; ; UnDraw the old first... cmpl oldpt,#-1 beq DrawNew DoErase lda vert bne EraseV tool _MoveTo,in=(P_VRulRect+2:w,OldPt:w) tool _LineTo,in=(P_ContentRect+6:w,OldPt:w) bra DidOld EraseV tool _MoveTo,in=(OldPt+2:w,#0:w) tool _LineTo,in=(OldPt+2:w,P_ContentRect+4:w) DidOld ; ; Now the D_New... DrawNew cmpl newpt,#-1 jeq exit cmpl newpt,oldpt bne DrawIt ; ; Do send to back stuff.... moverect P_ContentRect,tmprect lda vert bne SendBackV moveword NewPt,tmprect inc a sta tmprect+4 bra SendIt SendBackV moveword NewPt+2,tmprect+2 inc a sta tmprect+6 SendIt tool _EraseRect,in=(!tmprect:l) tool _InvalRect,in=(!tmprect:l) brl exit DrawIt cmpl OldPt,#-1 bne Clipped tool _SetPenMode,in=(#modeCOPY:w) Clipped lda vert bne ShowV tool _MoveTo,in=(P_VRulRect+2:w,NewPt:w) tool _LineTo,in=(P_ContentRect+6:w,NewPt:w) bra Exit ShowV tool _MoveTo,in=(NewPt+2:w,#0:w) tool _LineTo,in=(NewPt+2:w,P_ContentRect+4:w) exit _PenNormal return ENDP ;--------------------------------------------------------------------------- ; ; P_SetGuides ; ; 1 = OK, 2 = Cancel ; ; 4 = LR LineEdit ; 5 = TB LineEdit ; 6 = Col LineEdit ; 7 = CS LineEdit ; ; 8 = LR 0.25 inch ; 9 = 0.5 inch ; 10 = LE control ; ; 12 = TB 0.25 inch ; 13 = 0.5 inch ; 14 = LE control ; ; 16 = Col 1 ; 17 = 2 ; 18 = LE control ; ; 20 = CS 0.25 inch ; 21 = 0.5 inch ; 22 = LE control ; ; 24-27 Static Q_Text P_SetGuides PROC EXPORT ;Using P_Data local result:w,TheDlog:l,anItem:w,ptr:l,hdl:l local vert:l,horz:l,tmp:l local vfrac:l,hfrac:l,cols:w local colspace:w,colwidth:w,margwidth:w local str:r,inches:l begin +b ; Dialog item #'s LRLE equ 4 TBLE equ 5 ColLE equ 6 CSLE equ 7 LR1 equ 8 LR2 equ 9 LR3 equ 10 TB1 equ 12 TB2 equ 13 TB3 equ 14 Col1 equ 16 Col2 equ 17 Col3 equ 18 CS1 equ 20 CS2 equ 21 CS3 equ 22 FirstStat equ 24 LastLE equ 7 jsl D_UseStdColors call D_GetNewModalDialog,in=(#P_SGuideDlog:l),out=(TheDlog:l) ; set defaults according to print record ?? movelong P_PrintHand,tmp movelong [tmp],ptr moveword [ptr]:#4,vert moveword [ptr]:#6,horz subword P_PageRect,P_PaperRect,tmp tool _FixDiv,in=(tmp:w,#0:w,vert:w,#0:w),out=(vfrac:l) subword P_PageRect+2,P_PaperRect+2,tmp tool _FixDiv,in=(tmp:w,#0:w,horz:w,#0:w),out=(hfrac:l) ; Now check horz and vert to see if they are .25 or .5" ; if so, D_Activate the appropriate control. If not, set ; the Q_Text to reflect the real page Q_Rect & D_Activate the ; LE's ctl. ; horizontal cmpl hfrac,#$00004000 beq DoHQuarter cmpl hfrac,#$00008000 beq DoHHalf DoHLE call Fix2Asc,in=(hfrac:l,!str:l) tool _SetIText,in=(TheDlog:l,#LRLE:w,!str:l) tool _SetDItemValue,in=(#1:w,TheDlog:l,#LR3:w) tool _SelIText,in=(TheDlog:l,#LRLE:w,#0:w,#4:w) bra DidH DoHQuarter tool _SetDItemValue,in=(#1:w,TheDlog:l,#LR1:w) bra DoneH DoHHalf tool _SetDItemValue,in=(#1:w,TheDlog:l,#LR2:w) DoneH tool _SelIText,in=(TheDlog:l,#LRLE:w,#4:w,#4:w) DidH ; vertical cmpl vfrac,#$00004000 beq DoVQuarter cmpl vfrac,#$00008000 beq DoVHalf DoVLE call Fix2Asc,in=(vfrac:l,!str:l) tool _SetIText,in=(TheDlog:l,#TBLE:w,!str:l) tool _SetDItemValue,in=(#1:w,TheDlog:l,#TB3:w) bra DoneV DoVQuarter tool _SetDItemValue,in=(#1:w,TheDlog:l,#TB1:w) bra DoneV DoVHalf tool _SetDItemValue,in=(#1:w,TheDlog:l,#TB2:w) DoneV Loop tool _ModalDialog,in=(#D_DecimalOnly+$80000000:l),out=(result:w) beq Loop cmp #OK beq Add cmp #Cancel jeq QuitDlog cmp #LastLE+1 blt Loop cmp #FirstStat bge Loop tool _SetDItemValue,in=(#1:w,TheDlog:l,result:w) cmpw result,#LR3 beq LEActive cmp #TB3 beq LEActive cmp #Col3 beq LEActive cmp #CS3 beq LEActive bra Loop ; ; 4 rctl's w/ LE's need to D_Activate that LE if selected! ; 10 -> 4, 14 -> 5, 18 -> 6, 22 -> 7. ; LEActive lsr a inc a lsr a inc a sta anItem tool _SelIText,in=(TheDlog:l,anItem:w,#0:w,#4:w) bra Loop ; ; Add necessary guides, after deleting old marked guides Add call P_KillOldGuides ; Top Margin tool _GetDItemValue,in=(TheDlog:l,#TB1:w),out=(a:w) beq Ck5TopB movelong #$00004000,inches ; 1/4" bra DoTopB Ck5TopB tool _GetDItemValue,in=(TheDlog:l,#TB2:w),out=(a:w) beq CkLETopB movelong #$00008000,inches ; 1/2" bra DoTopB CkLETopB tool _GetIText,in=(TheDLog:l,#TBLE:w,!str:l) call Asc2Fix,in=(!str:l),out=(inches:l) bcs Margins DoTopB lda P_HorizGCount bne GotNewH call D_NeedHand,in=(#4:l),out=(P_HorizGuides:l) GotNewH spacelong pushfixword vert pushlong inches _FixMul rcall P_Fix2Int,in=(s:ax),out=(vert:a) in a:w,P_HorizGuides:l,P_HorizGCount:w,#MargGuide:w out P_HorizGCount:w xcall P_AddGuide ; Bottom Margin subword P_PaperRect+4,vert,a in a:w,P_HorizGuides:l,P_HorizGCount:w,#MargGuide:w out P_HorizGCount:w xcall P_AddGuide ; Left Margin Margins tool _GetDItemValue,in=(TheDlog:l,#LR1:w),out=(a:w) beq Ck5LR movelong #$00004000,inches ; 1/4" bra DoLR Ck5LR tool _GetDItemValue,in=(TheDlog:l,#LR2:w),out=(a:w) beq CkLELR movelong #$00008000,inches ; 1/2" bra DoLR CkLELR tool _GetIText,in=(TheDLog:l,#LRLE:w,!str:l) call Asc2Fix,in=(!str:l),out=(inches:l) bcs Columns DoLR lda P_VertGCount bne GotNewV call D_NeedHand,in=(#4:l),out=(P_VertGuides:l) GotNewV spacelong pushfixword horz pushlong inches _FixMul rcall P_Fix2Int,in=(s:ax),out=(margwidth:a) and #$FFFE in a:w,P_VertGuides:l,P_VertGCount:w,#MargGuide:w out P_VertGCount:w xcall P_AddGuide ; Right Margin subword P_PaperRect+6,margwidth,a and #$FFFE in a:w,P_VertGuides:l,P_VertGCount:w,#MargGuide:w out P_VertGCount:w xcall P_AddGuide ; Column guides.... Columns tool _GetDItemValue,in=(TheDlog:l,#Col1:w),out=(a:w) jne QuitDlog ; w/ 1 col, no col-guides necess Ck2Col tool _GetDItemValue,in=(TheDlog:l,#Col2:w),out=(a:w) beq CkLECol moveword #2,cols bra DoCol CkLECol tool _GetIText,in=(TheDLog:l,#ColLE:w,!cols:l) tool _Dec2Int,in=(!cols+1:l,#1:w,#0:w),out=(cols:w) jcs QuitDlog DoCol tool _GetDItemValue,in=(TheDlog:l,#CS1:w),out=(a:w) beq Ck5CW movelong #$00004000,inches ; 1/4" bra DoCW Ck5CW tool _GetDItemValue,in=(TheDlog:l,#CS2:w),out=(a:w) beq CkLECW movelong #$00008000,inches ; 1/2" bra DoCW CkLECW tool _GetIText,in=(TheDLog:l,#CSLE:w,!str:l) call Asc2Fix,in=(!str:l),out=(inches:l) jcs QuitDlog DoCW spacelong pushfixword horz pushlong inches _FixMul rcall P_Fix2Int,in=(s:ax),out=(colspace:a) ; colwidth = (pagewidth - 2*marginwidth - (cols-1)*colspace) / cols. lda margwidth asl a sta tmp subword P_PaperRect+6,tmp,tmp lda cols dec a rcall D_FastMult,in=(a:x,colspace:y),out=(tmp+2:a) subword tmp,tmp+2,tmp tool _UDivide,in=(tmp:w,cols:w),out=(y:w,colwidth:w) moveword margwidth,tmp ColLoop dec cols beq QuitDlog addword tmp,colwidth,tmp and #$FFFE in a:w,P_VertGuides:l,P_VertGCount:w,#ColGuide:w out P_VertGCount:w xcall P_AddGuide addword tmp,colspace,tmp and #$FFFE in a:w,P_VertGuides:l,P_VertGCount:w,#ColGuide:w out P_VertGCount:w xcall P_AddGuide bra ColLoop QuitDlog call D_CloseDialog,in=(TheDlog:l) cmpw result,#Cancel beq exit call P_MergeGuides tool _EraseRect,in=(#P_ContentRect:l) tool _InvalRect,in=(#P_ContentRect:l) exit return ENDP ;--------------------------------------------------------------------------- ; ; P_KillOldGuides ; P_KillOldGuides PROC EXPORT ;Using P_Data local array:l,count:w,offset:w begin lda P_VertGCount jeq DoHoriz rcall D_Deref,in=(P_VertGuides:ax),out=(array:ax) moveword P_VertGCount,count dec a asl a asl a ina ina sta offset KillVLoop cmpw [array]:offset,#RulerGuide bne KillV subword offset,#4,offset bra ContV KillV rcall D_UnLock,in=(P_VertGuides:ax) ; ick!!! dec offset dec offset in P_VertGuides:l,offset:w,#1:w,#4:w,P_VertGCount:w xcall P_DeleteData rcall D_Deref,in=(P_VertGuides:ax),out=(array:ax) ; doubly so. dec P_VertGCount dec offset dec offset ContV lda offset bpl KillVLoop rcall D_UnLock,in=(P_VertGuides:ax) lda P_VertGCount bne DoHoriz tool _DisposeHandle,in=(P_VertGuides:l) stzl P_VertGuides DoHoriz lda P_HorizGCount jeq exit rcall D_Deref,in=(P_HorizGuides:ax),out=(array:ax) moveword P_HorizGCount,count dec a asl a asl a ina ina sta offset KillHLoop cmpw [array]:offset,#RulerGuide bne KillH subword offset,#4,offset bra ContH KillH rcall D_UnLock,in=(P_HorizGuides:ax) ; ick!!! dec offset dec offset in P_HorizGuides:l,offset:w,#1:w,#4:w,P_HorizGCount:w xcall P_DeleteData rcall D_Deref,in=(P_HorizGuides:ax),out=(array:ax) ; doubly so. dec P_HorizGCount dec offset dec offset ContH lda offset bpl KillHLoop rcall D_UnLock,in=(P_HorizGuides:ax) lda P_HorizGCount bne exit tool _DisposeHandle,in=(P_HorizGuides:l) stzl P_HorizGuides exit return ENDP ;--------------------------------------------------------------------------- ; ; P_ExplodeRect(pt:l,recptr:l) pt is in D_PL coords. ; P_ExplodeRect PROC EXPORT ;Using P_Data input pt:l,rectptr:l local ptr:l,hdl:l,tmppt:l error err begin moveword #1,err rcall P_Local2PL,in=(P_PageRect:ax),out=(tmppt:ax) subword pt,tmppt,a jmi quit subword pt+2,tmppt+2,a jmi quit rcall P_Local2PL,in=(P_PageRect+4:ax),out=(tmppt:ax) subword tmppt,pt,a jmi quit jeq quit cmp P_DefSize jlt quit subword tmppt+2,pt+2,a jmi quit jeq quit DoTop in P_AllHGuides:l,P_AllHGCount:w,pt:w,#-1:w,#-1:w out [rectptr]:w xcall P_ExplodeGuide bcc DoBottom cmpw pt,P_PageRect jlt quit moveword P_PageRect,[rectptr] DoBottom in P_AllHGuides:l,P_AllHGCount:w,pt:w,#-1:w,#1:w out [rectptr]:#4:w xcall P_ExplodeGuide bcc DoLeft cmpw P_PageRect+4,pt jlt quit subword P_PageRect+4,#1,[rectptr]:#4 DoLeft in P_AllVGuides:l,P_AllVGCount:w,pt+2:w,#-1:w,#-1:w out [rectptr]:#2:w xcall P_ExplodeGuide bcc DoRight cmpw pt+2,P_PageRect+2 jlt quit moveword P_PageRect+2,[rectptr]:#2 DoRight in P_AllVGuides:l,P_AllVGCount:w,pt+2:w,#-1:w,#1:w out [rectptr]:#6:w xcall P_ExplodeGuide bcc exit cmpw P_PageRect+6,pt+2 blt quit subword P_PageRect+6,#4,[rectptr]:#6 exit stz err ldy #6 addword [rectptr]:y,#2,[rectptr]:y ldy #4 addword [rectptr]:y,#1,[rectptr]:y quit return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PLIST.S b/appleworksgs/PL/Src/PLIST.S new file mode 100755 index 0000000..7c5c1e2 --- /dev/null +++ b/appleworksgs/PL/Src/PLIST.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_Deref IMPORT P_AddObjRgn IMPORT P_DrawRgn IMPORT P_ObjList IMPORT P_RemoveObj IMPORT P_ToolType IMPORT T_Dispose ;-------------------------------------------------------------------------- ; ; P_SetObjAttr (Attr:w; NewValue:w) ; P_SetObjAttr PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT Attr:w,NewValue:w LOCAL ObjHdl:l,ObjPtr:l,UpdateRgn:l,ObjType:w BEGIN lda P_ToolType jne Exit tool _NewRgn,out=(UpdateRgn:l) movelong P_ObjList,ObjHdl WhileLoop cpzl ObjHdl jeq EndLoop rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) moveword [ObjPtr]:#P_Selected,a jeq NextObject moveword [ObjPtr]:#P_Type,ObjType cmp #P_ALPHA jeq NextObject lda Attr asl a tax jmp (JumpTable,x) ChangeFill lda ObjType cmp #P_RECTANGLE blt NextObject cmp #P_CIRCLE+1 bge NextObject moveword NewValue,[ObjPtr]:#P_ObjFilled bra AddObj ChangePen cmpw ObjType,#P_CIRCLE+1 bge NextObject call P_AddObjRgn,in=(ObjPtr:l,UpdateRgn:l) moveword NewValue,[ObjPtr]:#P_PenSize bra AddObj ChangeColor cmpw ObjType,#P_PICTURE bge NextObject moveword NewValue,[ObjPtr]:#P_ObjColor bra AddObj ChangeFont jsr IsPageDate bcc NextObject moveword NewValue,[ObjPtr]:#P_ItemFontID bra AddObj ChangeStyle jsr IsPageDate bcc NextObject movebyte NewValue,[ObjPtr]:#P_ItemFontID+2 bra AddObj ChangeSize jsr IsPageDate bcc NextObject movebyte NewValue,[ObjPtr]:#P_ItemFontID+3 AddObj call P_AddObjRgn,in=(ObjPtr:l,UpdateRgn:l) NextObject tool _HUnlock,in=(ObjHdl:l) movelong [ObjPtr],ObjHdl brl WhileLoop EndLoop call P_DrawRgn,in=(UpdateRgn:l) Exit RETURN ; Returns with carry set if it is a page or date object IsPageDate lda ObjType cmp #P_PAGETOOL blt @Clear cmp #P_DATETOOL+1 bge @Clear sec rts @Clear clc rts JumpTable DC.W ChangeFill DC.W ChangePen DC.W ChangeColor DC.W ChangeFont DC.W ChangeStyle DC.W ChangeSize ENDP ;----------------------------------------------------------------------------- ; ; P_SetDelFlag (Value:w) ; P_SetDelFlag PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT Value:w LOCAL ObjHdl:l,ObjPtr:l BEGIN movelong P_ObjList,ObjHdl ObjLoop cpzl ObjHdl beq Exit movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_Selected,a beq NextObj moveword Value,[ObjPtr]:#P_Deleted NextObj movelong [ObjPtr],ObjHdl bra ObjLoop Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_DelMarkObj () ; ; Deletes are objects that are marked as deleted from the object list. P_DelMarkObj PROC EXPORT ;Using P_Data ;Using P_ObjData LOCAL ObjHdl:l,ObjPtr:l,NextObj:l BEGIN movelong P_ObjList,ObjHdl While cpzl ObjHdl jeq EndWhile movelong [ObjHdl],ObjPtr movelong [ObjPtr],NextObj moveword [ObjPtr]:#P_Deleted,a beq TryNext ; need to do more if Q_Text object or picture moveword [ObjPtr]:#P_Type,a cmp #P_Alpha bne NotAlpha call T_Dispose,in=(ObjHdl:l,#0:w) bra Dispose NotAlpha cmp #P_PICTURE bne Dispose tool _KillPicture,in=([ObjPtr]:#P_PictHandle:l) Dispose call P_RemoveObj,in=(ObjHdl:l) tool _DisposeHandle,in=(ObjHdl:l) TryNext movelong NextObj,ObjHdl brl While EndWhile RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PMENUS.S b/appleworksgs/PL/Src/PMENUS.S new file mode 100755 index 0000000..cf5fb12 --- /dev/null +++ b/appleworksgs/PL/Src/PMENUS.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_CheckMenuFID IMPORT D_CurColor IMPORT D_CurMenuFont IMPORT D_DisableMItems IMPORT D_EnableMItems IMPORT P_BuildUndo IMPORT P_CurrentWin IMPORT P_DPTempl IMPORT P_DblPage IMPORT P_DefColor IMPORT P_DefFont IMPORT P_DefJust IMPORT P_DefSize IMPORT P_DefSpacing IMPORT P_DefStyle IMPORT P_DoSpacingDlog IMPORT P_ForceUpdate IMPORT P_HGuides IMPORT P_HPalette IMPORT P_HRulers IMPORT P_IsObjSel IMPORT P_LGuides IMPORT P_LockGuides IMPORT P_MagGuides IMPORT P_NPage IMPORT P_NTemplate IMPORT P_NotActive IMPORT P_Page IMPORT P_PageCount IMPORT P_PageMode IMPORT P_SGuides IMPORT P_SPTempl IMPORT P_SPalette IMPORT P_SRulers IMPORT P_SetObjAttr IMPORT P_ULGuides IMPORT P_UTemplate IMPORT P_UseTemplate IMPORT P_VPage IMPORT P_VisGuides IMPORT P_VisPalette IMPORT P_VisRuler IMPORT T_ChangeFont IMPORT T_ChangeRuls IMPORT T_DotParag IMPORT T_Editing IMPORT T_FontFlags IMPORT T_GetRulBits IMPORT T_NewAddStyle IMPORT T_NewColor IMPORT T_NewFont IMPORT T_NewSize IMPORT T_NewSubStyle IMPORT T_RangeFont IMPORT T_TextSelect IMPORT D_TextSelectOff IMPORT D_TextSelectOn ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_ChangeJust ENTRY P_ChangeSpace ENTRY P_GetMJust ENTRY P_GetMSpacing ENTRY P_SetFormat ;--------------------------------------------------------------------------- ; ; P_FixSpecMenu() ; ; Do miscellaneous menu checking / hilighting / Q_Text changing ; P_FixSpecMenu PROC EXPORT ;Using P_AttrData ;Using P_Data begin ; Fit in window / Normal view lda P_PageMode bne GoFull pushlong #P_VPage bra DoTempl GoFull pushlong #P_NPage DoTempl tool _SetMItem,in=(:l,#P_ViewPageItem:w) ; Show / hide guides DoVisG lda P_VisGuides bne MakeVisG call D_DisableMItems,in=(#P_LockGuideBit:w,#P_MenuOptions:w) call D_DisableMItems,in=(#P_MagGuideBit:w,#P_MenuOptions:w) pushlong #P_SGuides bra Lock MakeVisG call D_EnableMItems,in=(#P_LockGuideBit:w,#P_MenuOptions:w) call D_EnableMItems,in=(#P_MagGuideBit:w,#P_MenuOptions:w) pushlong #P_HGuides ; Lock / D_UnLock guides Lock tool _SetMItem,in=(:l,#P_HideGuideItem:w) lda P_LockGuides bne Lockit pushlong #P_LGuides bra DoVisR Lockit pushlong #P_ULGuides ; Show / Hide ruler DoVisR tool _SetMItem,in=(:l,#P_LockGuideItem:w) lda P_VisRuler bne MakeVisR pushlong #P_SRulers bra DoVisP MakeVisR pushlong #P_HRulers ; Show / hide palette DoVisP tool _SetMItem,in=(:l,#P_HideRulerItem:w) lda P_VisPalette bne MakeVisP pushlong #P_SPalette bra CkMag MakeVisP pushlong #P_HPalette CkMag tool _SetMItem,in=(:l,#P_HidePaletteItem:w) ; Check / Uncheck magnetic guides lda P_MagGuides bne MakeMag pushword #0 bra GotMag MakeMag pushword #'' GotMag tool _SetMItemMark,in=(:w,#P_MagGuideItem:w) ; Enable / disable Insert Page(s) cmpw P_PageCount,#P_MaxPages blt EnableInsert call D_DisableMItems,in=(#P_InsertBit:w,#P_MenuEdit:w) bra DidInsert EnableInsert call D_EnableMItems,in=(#P_InsertBit:w,#P_MenuEdit:w) ; (Don't) Use Master Page DidInsert lda P_DblPage bne GoSingle pushlong #P_DPTempl bra DoUse GoSingle pushlong #P_SPTempl DoUse tool _SetMItem,in=(:l,#P_DblPageItem:w) lda P_UseTemplate bne DontUse pushlong #P_UTemplate bra exit DontUse pushlong #P_NTemplate exit tool _SetMItem,in=(:l,#P_UseTempItem:w) cmpw P_Page,#2 bge DoEnable call D_DisableMItems,in=(#P_UseTempBit:w,#P_MenuOptions:w) bra DoCalc DoEnable call D_EnableMItems,in=(#P_UseTempBit:w,#P_MenuOptions:w) DoCalc tool _CalcMenuSize,in=(#0:w,#0:w,#4:w) return ENDP ;--------------------------------------------------------------------------- ; ; P_FixMenus () ; P_FixMenus PROC EXPORT ;Using P_Data ;Using P_AttrData ;Using T_Data LOCAL MenuFontID:l BEGIN lda P_NotActive jne Exit lda T_Editing beq NotActive lda T_TextSelect beq @NoSelect jsl D_TextSelectOn bra Range @NoSelect jsl D_TextSelectOff Range jsl T_RangeFont brl Exit NotActive jsl D_TextSelectOff moveword P_DefFont,MenuFontID shortm moveword P_DefStyle,MenuFontID+2 moveword P_DefSize,MenuFontID+3 longm call D_CheckMenuFID,in=(MenuFontID:l,P_DefColor:w) call P_SetFormat,in=(P_DefJust:w,P_DefSpacing:w) call P_IsObjSel,out=(a:w) beq TurnOff call D_EnableMItems,in=(#P_ObjArrange:w,#P_MenuArrange:w) call D_EnableMItems,in=(#P_ObjEdit:w,#P_MenuEdit:w) bra exit TurnOff call D_DisableMItems,in=(#P_ObjArrange:w,#P_MenuArrange:w) call D_DisableMItems,in=(#P_ObjEdit:w,#P_MenuEdit:w) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_SetFormat (Just:w,Spacing:w) ; P_SetFormat PROC EXPORT ;Using P_Data ;Using P_AttrData INPUT Just:w,Spacing:w BEGIN tool _SetMItemMark,in=(#0:w,#P_LeftItem:w) tool _SetMItemMark,in=(#0:w,#P_CenterItem:w) tool _SetMItemMark,in=(#0:w,#P_RightItem:w) tool _SetMItemMark,in=(#0:w,#P_FullItem:w) lda Just beq NoJust pushword #'' jsl P_GetMJust addword a,#P_LeftItem,s _SetMItemMark NoJust tool _SetMItemMark,in=(#0:w,#P_SingleItem:w) tool _SetMItemMark,in=(#0:w,#P_DoubleItem:w) tool _SetMItemMark,in=(#0:w,#P_TripleItem:w) tool _SetMItemMark,in=(#0:w,#P_SetSItem:w) lda Spacing beq NoSpacing pushword #'' jsl P_GetMSpacing addword a,#P_SingleItem,s _SetMItemMark NoSpacing RETURN ENDP ;------------------------------------------------------------------------------- ; ; P_GetMJust (Just:a) : MenuJust:a ; P_GetMJust PROC EXPORT ;Using T_TextEqu ldx #0 tay and #T_Left bne Exit inx tya and #T_Center bne Exit inx tya and #T_Right bne Exit inx Exit txa rtl ENDP ;------------------------------------------------------------------------------- ; ; P_GetMSpacing (Spacing:a) : MenuSpacing:a ; P_GetMSpacing PROC EXPORT ;Using T_TextEqu tay and #T_CustSpace bne Custom ldx #0 tya and #T_Single bne Exit inx tya and #T_Double bne Exit inx Exit txa rtl Custom lda #3 rtl ENDP ;--------------------------------------------------------------------------- ; ; P_Left ; P_Left PROC EXPORT ;Using P_AttrData ;Using T_TextEqu begin pushword #T_Left jsl P_ChangeJust return ENDP ;--------------------------------------------------------------------------- ; ; P_Center ; P_Center PROC EXPORT ;Using P_AttrData ;Using T_TextEqu begin pushword #T_Center jsl P_ChangeJust return ENDP ;--------------------------------------------------------------------------- ; ; P_Right ; P_Right PROC EXPORT ;Using P_AttrData ;Using T_TextEqu begin pushword #T_Right jsl P_ChangeJust return ENDP ;--------------------------------------------------------------------------- ; ; P_Full ; P_Full PROC EXPORT ;Using P_AttrData ;Using T_TextEqu begin pushword #T_Full jsl P_ChangeJust return ENDP ;------------------------------------------------------------------------------- ; ; P_ChangeJust (Just:w) ; P_ChangeJust PROC EXPORT ;Using P_DATA ;Using T_Data ;Using T_TextEqu INPUT Just:w BEGIN +b lda T_Editing beq SetDefault call T_ChangeRuls,in=(#T_ChangeJust:w,Just:w,#0:l) bra DoFix SetDefault moveword Just,P_DefJust DoFix jsl P_FixMenus RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_SingleSpace ; P_SingleSpace PROC EXPORT ;Using T_TextEqu begin call P_ChangeSpace,in=(#T_Single:w) return ENDP ;--------------------------------------------------------------------------- ; ; P_DoubleSpace ; P_DoubleSpace PROC EXPORT ;Using T_TextEqu begin call P_ChangeSpace,in=(#T_Double:w) return ENDP ;--------------------------------------------------------------------------- ; ; P_TripleSpace ; P_TripleSpace PROC EXPORT ;Using T_TextEqu begin call P_ChangeSpace,in=(#T_Triple:w) return ENDP ;--------------------------------------------------------------------------- ; ; P_SetSpacing ; P_SetSpacing PROC EXPORT ;Using T_TextEqu ;Using P_Data ;Using T_Data LOCAL LineHeight:w,Spacing:w BEGIN +b call P_ForceUpdate,in=(P_CurrentWin:l) moveword #16,LineHeight moveword P_DefSpacing,Spacing lda T_Editing beq UseDefault rcall T_GetRulBits,in=(T_DotParag:a),out=(Spacing:a) UseDefault lda Spacing and #T_CustSpace beq DoCall lda Spacing xba and #T_GetCustSpace inc a sta LineHeight DoCall call P_DoSpacingDlog,in=(LineHeight:w),out=(a:w) beq Exit dec a xba ora #T_CustSpace call P_ChangeSpace,in=(a:w) Exit return ENDP ;------------------------------------------------------------------------------ ; ; P_ChangeSpace (Spacing:w) ; P_ChangeSpace PROC EXPORT ;Using P_Data ;Using T_Data ;Using T_TextEqu INPUT Spacing:w BEGIN +b lda T_Editing beq SetDefault call T_ChangeRuls,in=(#T_ChangeSpace:w,Spacing:w,#0:l) bra DoFix SetDefault moveword Spacing,P_DefSpacing DoFix jsl P_FixMenus RETURN ENDP ;------------------------------------------------------------------------------- ; ; P_DoFont (NewFont:w) ; P_DoFont PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data INPUT Font:w BEGIN +b lda T_Editing beq SetDefault lda T_FontFlags ora #T_FontFl sta T_FontFlags moveword Font,T_NewFont lda T_TextSelect beq FixIt jsl T_ChangeFont bra FixIt SetDefault moveword Font,P_DefFont call P_IsObjSel,out=(a:w) beq FixIt call P_BuildUndo,in=(#P_FontUndo:w) call P_SetObjAttr,in=(#P_FontAttr:w,P_DefFont:w) FixIt jsl P_FixMenus RETURN ENDP ;------------------------------------------------------------------------------- ; ; P_ChangeAll (FontID:l) ; P_ChangeAll PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data INPUT FontID:l BEGIN +b call P_ForceUpdate,in=(P_CurrentWin:l) lda T_Editing beq SetDefault lda T_FontFlags ora #T_FontFl ora #T_StyleFl ora #T_SizeFl sta T_FontFlags moveword FontID,T_NewFont shortm moveword FontID+2,T_NewAddStyle moveword FontID+3,T_NewSize longm stz T_NewSubStyle lda T_TextSelect beq FixIt jsl T_ChangeFont bra FixIt SetDefault moveword FontID,P_DefFont shortm moveword FontID+2,P_DefStyle moveword FontID+3,P_DefSize longm call P_IsObjSel,out=(a:w) beq FixIt call P_BuildUndo,in=(#P_FontIDUndo:w) call P_SetObjAttr,in=(#P_FontAttr:w,P_DefFont:w) call P_SetObjAttr,in=(#P_StyleAttr:w,P_DefStyle:w) call P_SetObjAttr,in=(#P_SizeAttr:w,P_DefSize:w) FixIt jsl P_FixMenus RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_DoStyle (Style:w) ; P_DoStyle PROC EXPORT ;Using D_MenuData ;Using P_Data ;Using P_ObjData ;Using T_Data INPUT Style:w LOCAL MenuStyle:w,NewStyle:w,StyleAdd:w,StyleSub:w BEGIN +b ;NoSub equ $FF-SubScript ;NoSuper equ $FF-SuperScript lda >D_CurMenuFont+2 and #$ff sta MenuStyle lda T_Editing beq @NoEdit lda T_FontFlags ora #T_StyleFl sta T_FontFlags lda T_TextSelect jne Selected @NoEdit ; No Q_Text is selected stz NewStyle lda Style jeq NotSub lda MenuStyle eor Style sta NewStyle lda Style and #SuperScript beq NotSuper lda NewStyle ; and #NoSub and #$FF-SubScript sta NewStyle NotSuper lda Style and #SubScript beq NotSub lda NewStyle ; and #NoSuper and #$FF-SuperScript sta NewStyle NotSub moveword NewStyle,T_NewAddStyle lda T_Editing jne FixIt ; Set default style moveword NewStyle,P_DefStyle call P_IsObjSel,out=(a:w) beq NoObj call P_BuildUndo,in=(#P_StyleUndo:w) call P_SetObjAttr,in=(#P_StyleAttr:w,P_DefStyle:w) NoObj brl FixIt Selected stz StyleAdd stz StyleSub lda Style beq NotSub2 cmpw MenuStyle,#$ff beq SetOn and Style sta StyleSub SetOn lda Style eor StyleSub sta StyleAdd and #SuperScript beq NotSuper2 lda StyleSub ora #SubScript sta StyleSub NotSuper2 lda StyleAdd and #SubScript beq NotSub2 lda StyleSub ora #SuperScript sta StyleSub NotSub2 moveword StyleAdd,T_NewAddStyle moveword StyleSub,T_NewSubStyle jsl T_ChangeFont FixIt jsl P_FixMenus RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_DoSize (Size:w) ; P_DoSize PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data INPUT Size:w BEGIN +b lda T_Editing beq SetDefault lda T_FontFlags ora #T_SizeFl sta T_FontFlags movebyte Size,T_NewSize lda T_TextSelect beq FixIt jsl T_ChangeFont bra FixIt SetDefault moveword Size,P_DefSize call P_IsObjSel,out=(a:w) beq FixIt call P_BuildUndo,in=(#P_SizeUndo:w) call P_SetObjAttr,in=(#P_SizeAttr:w,P_DefSize:w) FixIt jsl P_FixMenus RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_DoColor (Color:w) ; P_DoColor PROC EXPORT ;Using P_Data ;Using T_Data ;Using P_ObjData ;Using D_MenuData LOCAL Ptr:l INPUT Color:w BEGIN +b moveword Color,>D_CurColor lda T_Editing beq TryObjects lda T_FontFlags ora #T_ColorFl sta T_FontFlags moveword Color,T_NewColor lda T_TextSelect beq @NoSelect jsl T_ChangeFont @NoSelect bra Exit TryObjects moveword Color,P_DefColor call P_IsObjSel,out=(a:w) beq Exit call P_BuildUndo,in=(#P_ColorUndo:w) call P_SetObjAttr,in=(#P_ColorAttr:w,Color:w) Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PMOUSE.S b/appleworksgs/PL/Src/PMOUSE.S new file mode 100755 index 0000000..88dc309 --- /dev/null +++ b/appleworksgs/PL/Src/PMOUSE.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT P_PIconRect IMPORT P_IconPalette IMPORT P_GrowRect IMPORT P_ActionProc IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_DblPage IMPORT P_DeselectAll IMPORT P_DrawHandles IMPORT P_Entry IMPORT P_FindObject IMPORT P_FixMenus IMPORT P_FixRect IMPORT P_GrewDoc IMPORT P_HRulRect IMPORT P_ImportHdl IMPORT P_ImportType IMPORT P_KillUndo IMPORT P_Local2PL IMPORT P_MDInTools IMPORT P_MakeFigure IMPORT P_MakeObj IMPORT P_MoveGuide IMPORT P_MoveObject IMPORT P_MoveTabs IMPORT P_NewGuide IMPORT P_NewTool IMPORT P_ObjList IMPORT P_Page IMPORT P_PageMode IMPORT P_PastePt IMPORT P_Placing IMPORT P_PortRect IMPORT P_ScrollPages IMPORT P_SelectRect IMPORT P_StretchObj IMPORT P_ThreadDir IMPORT P_ThreadHdl IMPORT P_ToolType IMPORT P_TrackCursor IMPORT P_VRulRect IMPORT P_VisPalette IMPORT P_VisRuler IMPORT T_Activate IMPORT T_Click IMPORT T_CurParHdl IMPORT T_Deactivate IMPORT T_DotObj IMPORT T_Editing ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_FindTextObj ENTRY P_MouseContent ;------------------------------------------------------------------------------ ; ; P_MouseDown (Click:w,TaskRec:l,CLickPt2:l,ClickPt3:l) ; ; Click - the number of the click 1 - single click, 2 for double, 3 for triple ; TaskRec - a pointer to an Event Record for you to look at. ; ClickPt2 - the Q_Point(global) where the first click of this sequence was ; ; Single click (click=1) look at the TaskRec as before, ClickPts are undefined. ; Double click (click=2) look at the pt in the TaskRec(global) and see if it ; is D_Close enough to ClickPt2(global) to be a double click. ClickPt3 is undefin ; Triple click (click=3) check that ClickPt3 is D_Close enough to ClickPt2 ; and the pt in TaskRec. ; If you don't support a type of click, or it isn't D_Close enough together ; just do the same thing you would do for single clicking P_MouseDown PROC EXPORT ;Using P_IconData ;Using P_Data ;Using P_ObjData ;Using P_RulerData ;Using T_Data ;Using T_TextEqu INPUT Click:w,TaskRec:l,ClickPt2:l,ClickPt3:l LOCAL ThePt:l,tmprect:r,tmpctl:l BEGIN +b cpzl P_CurrentWin jeq Exit ; Just in case jsl P_Entry movelong [TaskRec]:#owhere,ThePt tool _GlobalToLocal,in=(!ThePt:l) CkContent tool _PtInRect,in=(!ThePt:l,#P_ContentRect:l),out=(a:w) beq CkPages call P_MouseContent,in=(TaskRec:l,click:w) brl Exit CkPages tool _ClipRect,in=(#P_PortRect:l) tool _PtInRect,in=(!ThePt:l,#P_PIconRect:l),out=(a:w) beq CkTools call P_ScrollPages,in=(ThePt+2:w) brl SetClip CkTools lda P_VisPalette beq CkControls tool _PtInRect,in=(!ThePt:l,#P_IconPalette:l),out=(a:w) beq CkControls call P_MDInTools,in=(ThePt:l) brl SetClip CkControls in !tmpctl:l,[TaskRec]:#owhere:l,P_CurrentWin:l out a:w xtool _FindControl beq CkGrow in [TaskRec]:#owhere:l,#P_ActionProc:l,tmpctl:l out a:w xtool _TrackControl brl SetClip CkGrow tool _PtInRect,in=(!ThePt:l,#P_GrowRect:l),out=(a:w) beq CkTabs spacelong addword #11,P_DblPage,a asl a asl a asl a asl a asl a pushword a pushword #P_MinHeight pushlong [TaskRec]:#owhere pushlong P_CurrentWin xtool _GrowWindow lda 1,s bne CleanUp lda 3,s bne CleanUp pla pla brl SetClip CleanUp lda 3,s and #$FFFE ; Q_Mask odd bit off. sta 3,s tool _SizeWindow,in=(P_CurrentWin:l) call P_GrewDoc,in=(P_CurrentWin:l) brl SetClip CkTabs lda P_VisRuler jeq SetClip ; Check if in tab area moverect P_HRulRect,tmprect moveword #10,tmprect tool _PtInRect,in=(!ThePt:l,!tmprect:l),out=(a:w) bne DoTabs ; Check if in tab well moveword P_HRulRect,tmprect moveword P_VRulRect+2,tmprect+2 movelong P_ContentRect,tmprect+4 tool _PtInRect,in=(!ThePt:l,!tmprect:l),out=(a:w) beq CkHGuide DoTabs lda T_Editing beq CkVGuide call P_MoveTabs,in=(ThePt:l),out=(a:w) brl SetClip CkHGuide tool _PtInRect,in=(!ThePt:l,#P_HRulRect:l),out=(a:w) beq CkVGuide call P_TrackCursor,in=(!ThePt:l) call P_NewGuide,in=(#0:w) brl SetClip CkVGuide tool _PtInRect,in=(!ThePt:l,#P_VRulRect:l),out=(a:w) beq SetClip call P_TrackCursor,in=(!ThePt:l) call P_NewGuide,in=(#1:w) SetClip tool _ClipRect,in=(#P_ContentRect:l) Exit call P_FixMenus RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_MouseUp ; P_MouseUp PROC EXPORT input TaskRec:l begin return ENDP ;-------------------------------------------------------------------------- ; ; P_MouseContent (TaskRecPtr:l,Click:w) ; P_MouseContent PROC EXPORT ;Using P_ObjData ;Using P_Data ;Using T_Data INPUT TaskRecPtr:l,Click:w LOCAL ObjHdl:l,ObjPtr:l,ScrPt:l,Pt:l LOCAL ObjType:w,ModFlags:w,Q_Rect:r,Handle:w,Flag:w BEGIN movelong [TaskRecPtr]:#10,ScrPt moveword [TaskRecPtr]:#14,ModFlags tool _GlobalToLocal,in=(!ScrPt:l) rcall P_Local2PL,in=(ScrPt:ax),out=(Pt:ax) movelong Pt,P_PastePt lda P_Placing beq NotPlacing lda P_ImportType bne PlacePict moveword #P_ALPHA,ObjType bra DoPlace PlacePict moveword #P_PICTURE,ObjType DoPlace call P_MakeObj,in=(ObjType:w,Pt:l,P_ImportHdl:l,#0:w) call P_NewTool,in=(#P_ARROW:w,#0:w) stzl P_ImportHdl stz P_Placing brl Exit NotPlacing lda P_ToolType cmp #P_Arrow beq DoArrow cmp #P_Alpha jeq DoAlpha ;------------------------------------------------------------------------------- NewObject call P_MakeObj,in=(P_ToolType:w,Pt:l,#0:l,#0:w) brl Exit ;------------------------------------------------------------------------------- DoArrow call P_FindObject,in=(P_ObjList:l,ScrPt:l),out=(ObjHdl:l,Handle:w) cpzl ObjHdl bne Hit ; Check guides here call P_MoveGuide,in=(Pt:l),out=(a:w) bne ToExit ; Multiple selection code call P_MakeFigure,in=(#0:w,Pt:l),out=(Q_Rect+4:l) movelong Pt,Q_Rect lda ModFlags and #shiftKey bne ShiftDown jsl P_DeselectAll ShiftDown call P_SelectRect,in=(Q_Rect+4:l,Q_Rect:l) ToExit brl Exit Hit lda Handle bne InHandle movelong [ObjHdl],ObjPtr lda ModFlags and #shiftKey bne ShiftDown2 ; Shift is up moveword [ObjPtr]:#P_Selected,a bne DoMove jsl P_DeselectAll call P_DrawHandles,in=(ObjPtr:l) bra DoMove ShiftDown2 ldy #P_Selected moveword [ObjPtr]:y,a eor #1 moveword a,[ObjPtr]:y call P_DrawHandles,in=(ObjPtr:l) moveword [ObjPtr]:#P_Selected,a beq ToExit2 DoMove moveword #1,[ObjPtr]:#P_Selected call P_MoveObject,in=(ObjHdl:l,Pt:l) ToExit2 brl Exit InHandle cmpw Handle,#5 blt NotThread jsl P_KillUndo inc P_Placing stz P_ImportType movelong ObjHdl,P_ThreadHdl movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_ParagHdl,P_ImportHdl subword Handle,#5,P_ThreadDir brl Exit NotThread jsl P_DeselectAll call P_StretchObj,in=(ObjHdl:l,Handle:w,Pt:l,ModFlags:w) brl Exit ;------------------------------------------------------------------------------- DoAlpha lda T_Editing beq NotSame movelong T_DotObj,ObjHdl movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_PageNo,P_Page bne NotSame moverect [ObjPtr]:#P_ObjRect,Q_Rect call P_FixRect,in=(!Q_Rect:l,#P_RECTANGLE:w,P_PageMode:w,#0:w) tool _PtInRect,in=(!Pt:l,!Q_Rect:l),out=(a:w) bne AlphaClick NotSame call P_FindTextObj,in=(Pt:l),out=(ObjHdl:l) cpzl ObjHdl bne AlphaClick moveword T_Editing,Flag call T_Deactivate,in=(#1:w,#1:w) call P_MakeObj,in=(P_ToolType:w,Pt:l,#0:l,Flag:w) bra Exit AlphaClick lda P_PageMode bne Exit movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_StartParag,a bmi Exit cmpl [ObjPtr]:#P_ParagHdl,T_CurParHdl bne D_Activate call T_Click,in=(ObjHdl:l,Pt:l,ModFlags:w,Click:w) bra Exit D_Activate call T_Deactivate,in=(#1:w,#1:w) call T_Activate,in=(ObjHdl:l,Pt:l),out=(a:w) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_FindTextObj (Pt:l) : ObjHdl:l ; P_FindTextObj PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT Pt:l OUTPUT ObjHdl:l LOCAL ObjPtr:l,Q_Rect:r BEGIN lda P_PageMode beq NormalMode addword Pt,P_ContentRect,Pt addword Pt+2,P_ContentRect+2,Pt+2 NormalMode movelong P_ObjList,ObjHdl While cpzl ObjHdl jeq Exit movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_Deleted,a bne TryNext cmpw [ObjPtr]:#P_Type,#P_ALPHA bne TryNext moverect [ObjPtr]:#P_ObjRect,Q_Rect call P_FixRect,in=(!Q_Rect:l,#P_RECTANGLE:w,P_PageMode:w,#0:w) tool _PtInRect,in=(!Pt:l,!Q_Rect:l),out=(a:w) bne Exit movelong [ObjHdl],ObjPtr TryNext movelong [ObjPtr]:#P_Next,ObjHdl brl While Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PMOVE.S b/appleworksgs/PL/Src/PMOVE.S new file mode 100755 index 0000000..e0a9be9 --- /dev/null +++ b/appleworksgs/PL/Src/PMOVE.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_Deref IMPORT P_AddObjRgn IMPORT P_AddThreadRgn IMPORT P_BoundsRect IMPORT P_BuildUndo IMPORT P_Constrain IMPORT P_DrawFigure IMPORT P_DrawHandles IMPORT P_DrawRgn IMPORT P_FixRect IMPORT P_FixSpecRect IMPORT P_ListOp IMPORT P_Local2PL IMPORT P_MagMove IMPORT P_MagPt IMPORT P_ObjList IMPORT P_TrackCursor IMPORT D_Set4Pat IMPORT T_ReThread IMPORT P_PrintHand ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_WaitMouse ;------------------------------------------------------------------------------ ; ; P_MoveObject (ObjHdl:l, AnchorPt:l) ; P_MoveObject PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjHdl:l,AnchorPt:l LOCAL ObjPtr:l,NewPt:l,ObjType:w,ObjCount:w LOCAL Q_Rect:r,MultRect:r,TRect:r,TMultRect:r LOCAL HDiff:w,VDiff:w,UpdateRgn:l,RealPt:l BEGIN call P_WaitMouse,in=(AnchorPt:l),out=(a:w) jeq Exit rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) moveword [ObjPtr]:#P_Type,ObjType moverect [ObjPtr]:#P_ObjRect,Q_Rect call P_BoundsRect,in=(P_ObjList:l,!MultRect:l),out=(ObjCount:w) tool _SetPenMode,in=(#notXOR:w) tool _SetPenSize,in=(#2:w,#1:w) call D_Set4Pat,in=(#LeftGray:w) WhileLoop tool _GetMouse,in=(!NewPt:l) call P_TrackCursor,in=(!NewPt:l) rcall P_Local2PL,in=(NewPt:ax),out=(NewPt:ax) movelong NewPt,RealPt in #P_MOVEMENT:w,AnchorPt:l,!NewPt:l,P_PrintHand:l xcall P_Constrain subword NewPt,AnchorPt,VDiff subword NewPt+2,AnchorPt+2,HDiff ; Change Q_Rect addword VDiff,Q_Rect,TRect addword VDiff,Q_Rect+4,TRect+4 addword HDiff,Q_Rect+2,TRect+2 addword HDiff,Q_Rect+6,TRect+6 call P_MagMove,in=(!TRect:l) subword TRect,Q_Rect,VDiff subword TRect+2,Q_Rect+2,HDiff call P_DrawFigure,in=(ObjType:w,TRect:l,TRect+4:l) cmpw ObjCount,#2 blt NoMultDraw ; Change MultRect addword VDiff,MultRect,TMultRect addword VDiff,MultRect+4,TMultRect+4 addword HDiff,MultRect+2,TMultRect+2 addword HDiff,MultRect+6,TMultRect+6 call D_Set4Pat,in=(#RightGray:w) call P_DrawFigure,in=(#P_RECTANGLE:w,TMultRect:l,TMultRect+4:l) call D_Set4Pat,in=(#LeftGray:w) NoMultDraw call P_WaitMouse,in=(RealPt:l),out=(a:w) beq EndWhile jsr EraseStuff brl WhileLoop EndWhile jsr EraseStuff _PenNormal tool _HUnlock,in=(ObjHdl:l) call P_BuildUndo,in=(#P_MoveUndo:w) tool _NewRgn,out=(UpdateRgn:l) call P_ListOp,in=(P_ObjList:l,#PL_AddUpdate:w,UpdateRgn:l,#0:l) call P_ListOp,in=(P_ObjList:l,#PL_OffsetObj:w,HDiff:w,VDiff:w,#0:l) call P_ListOp,in=(P_ObjList:l,#PL_AddUpdate:w,UpdateRgn:l,#0:l) call P_DrawRgn,in=(UpdateRgn:l) Exit RETURN EraseStuff call P_DrawFigure,in=(ObjType:w,TRect:l,TRect+4:l) cmpw ObjCount,#2 blt NoMultErase call D_Set4Pat,in=(#RightGray:w) call P_DrawFigure,in=(#P_RECTANGLE:w,TMultRect:l,TMultRect+4:l) call D_Set4Pat,in=(#LeftGray:w) NoMultErase rts ENDP ;------------------------------------------------------------------------------ ; ; P_StretchObj (ObjHdl:l; HandleNo:w; StartPt:l; ModFlags:w) ; P_StretchObj PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_TextEqu INPUT ObjHdl:l,HandleNo:w,StartPt:l,ModFlags:w LOCAL ObjPtr:l,Q_Rect:r,NRect:r,NewPt:l,Swapped:w LOCAL ObjType:w,HDiff:w,VDiff:w,UpdateRgn:l LOCAL MousePt:l,AnchorPt:l BEGIN call P_WaitMouse,in=(StartPt:l),out=(a:w) jeq Exit rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) moveword [ObjPtr]:#P_Type,ObjType moverect [ObjPtr]:#P_ObjRect,Q_Rect moveword [ObjPtr]:#P_Selected,a beq NotSelected call P_DrawHandles,in=(ObjPtr:l) NotSelected moveword #1,[ObjPtr]:#P_Selected tool _SetPenMode,in=(#notXOR:w) tool _SetPenSize,in=(#2:w,#1:w) call D_Set4Pat,in=(#LeftGray:w) movelong StartPt,AnchorPt ; bogus; should never have 0 handle lda HandleNo asl a tax jmp (AnchorTable,x) AnchorTable ; ; Which handle? DC.W Nothing DC.W TopLeftA DC.W BottomRightA DC.W BottomLeftA DC.W TopRightA TopLeftA movelong Q_Rect+4,AnchorPt movelong Q_Rect,StartPt bra Nothing BottomRightA movelong Q_Rect,AnchorPt movelong Q_Rect+4,StartPt bra Nothing BottomLeftA moveword Q_Rect+6,AnchorPt+2 moveword Q_Rect,AnchorPt moveword Q_Rect+2,StartPt+2 moveword Q_Rect+4,StartPt bra Nothing TopRightA moveword Q_Rect+2,AnchorPt+2 moveword Q_Rect+4,AnchorPt moveword Q_Rect+6,StartPt+2 moveword Q_Rect,StartPt Nothing WhileLoop tool _GetMouse,in=(!NewPt:l) call P_TrackCursor,in=(!NewPt:l) rcall P_Local2PL,in=(NewPt:ax),out=(NewPt:ax) movelong ax,MousePt ; constrain to Q_square. in ObjType:w,AnchorPt:l,!NewPt:l,P_PrintHand:l xcall P_Constrain ; get to any guides. call P_MagPt,in=(!NewPt:l,!AnchorPt:l,ObjType:w) ; keep it Q_square. in ObjType:w,AnchorPt:l,!NewPt:l,P_PrintHand:l xcall P_Constrain subword NewPt,StartPt,VDiff subword NewPt+2,StartPt+2,HDiff ; Draw It moverect Q_Rect,NRect jsr StretchRect call P_DrawFigure,in=(ObjType:w,NRect:l,NRect+4:l) call P_WaitMouse,in=(MousePt:l),out=(a:w) beq EndWhile ; Erase It call P_DrawFigure,in=(ObjType:w,NRect:l,NRect+4:l) brl WhileLoop EndWhile _PenNormal ; Handle pictures cmpw ObjType,#P_PICTURE bne Resize lda ModFlags and #optionKey beq StretchPict ; Set crop undo call P_BuildUndo,in=(#P_CropUndo:w) bra FixObjRect ; Map the Pict Q_Rect on a stretch StretchPict call P_BuildUndo,in=(#P_StretchUndo:w) addlong ObjPtr,#P_PictRect,s pushlong !Q_Rect pushlong !NRect _MapRect bra FixObjRect Resize call P_BuildUndo,in=(#P_StretchUndo:w) ; Accumulate old and D_New objects into the D_Update Q_Region FixObjRect tool _NewRgn,out=(UpdateRgn:l) call P_AddObjRgn,in=(ObjPtr:l,UpdateRgn:l) moverect NRect,[ObjPtr]:#P_ObjRect call P_FixSpecRect,in=(ObjPtr:l) call P_AddObjRgn,in=(ObjPtr:l,UpdateRgn:l) tool _HUnlock,in=(ObjHdl:l) ; Handles Q_Text objects cmpw ObjType,#P_Alpha bne NotAlpha call P_AddThreadRgn,in=(ObjHdl:l,UpdateRgn:l) call T_ReThread,in=(ObjHdl:l) NotAlpha call P_DrawRgn,in=(UpdateRgn:l) Exit RETURN StretchRect lda HandleNo asl a tax jmp (JumpTable,x) JumpTable ; ;order determined by FindObject DC.W RectSet DC.W TopLeft DC.W BottomRight DC.W BottomLeft DC.W TopRight TopLeft addword NRect,VDiff,NRect addword NRect+2,HDiff,NRect+2 bra RectSet BottomRight addword NRect+4,VDiff,NRect+4 addword NRect+6,HDiff,NRect+6 bra RectSet BottomLeft addword NRect+2,HDiff,NRect+2 addword NRect+4,VDiff,NRect+4 bra RectSet TopRight addword NRect,VDiff,NRect addword NRect+6,HDiff,NRect+6 RectSet call P_FixRect,in=(!NRect:l,ObjType:w,#0:w,#0:w) rts ENDP ;------------------------------------------------------------------------------ ; ; P_WaitMouse (Pt:l) : StillDown:w ; ; Waits until the mouse button is released or it changes position. P_WaitMouse PROC EXPORT INPUT Pt:l OUTPUT StillDown:w LOCAL NewPt:l BEGIN stz StillDown Loop tool _StillDown,in=(#0:w),out=(a:w) beq Exit tool _GetMouse,in=(!NewPt:l) rcall P_Local2PL,in=(NewPt:ax),out=(NewPt:ax) cmpl NewPt,Pt beq Loop inc StillDown Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/POBJECT.S b/appleworksgs/PL/Src/POBJECT.S new file mode 100755 index 0000000..53a93ee --- /dev/null +++ b/appleworksgs/PL/Src/POBJECT.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT P_PageRect IMPORT P_FullPageRect IMPORT D_Deref IMPORT D_DrawPicture IMPORT D_MemoryError IMPORT D_NeedHand IMPORT P_AddThreadRgn IMPORT P_AppleFuck IMPORT P_BuildUndo IMPORT P_DefColor IMPORT P_DefFont IMPORT P_DefJust IMPORT P_DefSize IMPORT P_DefStyle IMPORT P_DrawHandles IMPORT P_DrawRgn IMPORT P_DrawSpec IMPORT P_ExplodeRect IMPORT P_FillMode IMPORT P_FixRect IMPORT P_FixSpecRect IMPORT P_GetPictSize IMPORT P_LastObj IMPORT P_LineAdjust IMPORT P_LineSize IMPORT P_ListOp IMPORT P_MagGuides IMPORT P_MagValue IMPORT P_MakeFigure IMPORT P_NewClip IMPORT P_ObjList IMPORT P_OldClip IMPORT P_Page IMPORT P_PageMode IMPORT P_SetDelFlag IMPORT P_SetPen IMPORT P_SetSpecStr IMPORT P_SmallRect IMPORT P_SpecStr IMPORT P_ValidRect IMPORT D_RectSect IMPORT D_SectClipRect IMPORT D_SetCursor IMPORT T_Activate IMPORT T_CurParHdl IMPORT T_Editing IMPORT T_New IMPORT T_Update IMPORT P_GetModifiers ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_NewObj ENTRY P_ObjSizes include 'pl.equ' ;------------------------------------------------------------------------------ ; ; P_InsertObj (ObjHdl:l,PlaceHdl:l) ; ; Inserts the object after PlaceHdl. P_InsertObj PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjHdl:l,PlaceHdl:l LOCAL ObjPtr:l,NextObj:l,NextPtr:l,PlacePtr:l BEGIN cmpl PlaceHdl,P_LastObj bne NotLast movelong ObjHdl,P_LastObj NotLast movelong [ObjHdl],ObjPtr movelong PlaceHdl,[ObjPtr]:#P_Prev cpzl PlaceHdl bne NotFirst movelong P_ObjList,[ObjPtr]:#P_Next movelong P_ObjList,NextObj movelong ObjHdl,P_ObjList cpzl NextObj beq Done movelong [NextObj],NextPtr movelong ObjHdl,[NextPtr]:#P_Prev bra Done NotFirst movelong [PlaceHdl],PlacePtr movelong [PlacePtr],NextObj movelong ObjHdl,[PlacePtr]:#P_Next movelong NextObj,[ObjPtr]:#P_Next cpzl NextObj beq Done movelong [NextObj],NextPtr movelong ObjHdl,[NextPtr]:#P_Prev Done RETURN ENDP ;----------------------------------------------------------------------------- ; ; P_RemoveObj (ObjHdl:l) ; P_RemoveObj PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjHdl:l LOCAL ObjPtr:l,NextObj:l,PrevObj:l,Temp:l BEGIN movelong [ObjHdl],ObjPtr movelong [ObjPtr],NextObj movelong [ObjPtr]:#P_Prev,PrevObj DoPrev cpzl PrevObj bne Normal movelong NextObj,P_ObjList bra DoNext Normal movelong [PrevObj],Temp movelong NextObj,[Temp] DoNext cpzl NextObj bne Normal2 movelong PrevObj,P_LastObj bra Exit Normal2 movelong [NextObj],Temp movelong PrevObj,[Temp]:#P_Prev Exit RETURN ENDP ;------------------------------------------------------------------------------ ; P_DeselectAll () ; P_DeselectAll PROC EXPORT ;Using P_Data ;Using P_ObjData BEGIN call P_ListOp,in=(P_ObjList:l,#PL_DeselectAll:w,#0:l,#0:l) RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_SelectRect (Q_Rect:r) ; ; Adds objects completely inside the rectangle to the selected ; list using eor. P_SelectRect PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT Q_Rect:r BEGIN call P_ValidRect,in=(!Q_Rect:l),out=(a:w) call P_ListOp,in=(P_ObjList:l,#PL_SelRect:w,!Q_Rect:l,#0:l) RETURN ENDP ;----------------------------------------------------------------------------- ; ; P_DelObjects (Type:w) ; ; Marks all the selected objects as deleted and updates the screen. P_DelObjects PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT Type:w LOCAL RgnHdl:l BEGIN tool _NewRgn,out=(RgnHdl:l) call P_ListOp,in=(P_ObjList:l,#PL_AddUpdate:w,RgnHdl:l,#0:l) call P_SetDelFlag,in=(#1:w) call P_DrawRgn,in=(RgnHdl:l) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_DrawObject (ObjHdl:l; Printing:w) ; P_DrawObject PROC EXPORT ;Using P_ObjData ;Using P_Data INPUT ObjHdl:l,Printing:w LOCAL ObjPtr:l,ObjType:w,Q_Rect:r,PictRect:r LOCAL ClipRgn:l,PictHdl:l,PictPtr:l,Q_OvalSize:l ERROR err BEGIN stz err rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) moverect [ObjPtr]:#P_ObjRect,Q_Rect moveword [ObjPtr]:#P_Type,ObjType call P_FixRect,in=(!Q_Rect:l,ObjType:w,P_PageMode:w,#1:w) Draw lda ObjType asl a tax jmp (JumpTable,x) JumpTable DC.W Done ; should not happen DC.W D_DrawText DC.W DrawPage DC.W DrawDate DC.W DrawLine DC.W DrawLine DC.W D_DrawRect DC.W DrawRRect DC.W DrawOval DC.W DrawPict D_DrawText jsl P_AppleFuck call T_Update,in=(ObjHdl:l,Printing:w) brl Done DrawPage DrawDate jsl P_AppleFuck call P_SetSpecStr,in=(ObjPtr:l,#0:w) call P_DrawSpec,in=(ObjPtr:l) brl Done DrawLine jsr PSetPen tool _MoveTo,in=(Q_Rect:l) tool _LineTo,in=(Q_Rect+4:l) brl Done D_DrawRect jsr PSetPen pushlong !Q_Rect moveword [ObjPtr]:#P_ObjFilled,a bne ColorRect _FrameRect brl Done ColorRect _PaintRect brl Done DrawRRect jsr PSetPen moveword #20,Q_OvalSize moveword #40,Q_OvalSize+2 lda P_PageMode beq NoScale tool _ScalePt,in=(!Q_OvalSize:l,#P_PageRect:l,#P_FullPageRect:l) NoScale pushlong !Q_Rect pushlong Q_OvalSize moveword [ObjPtr]:#P_ObjFilled,a bne ColorRRect _FrameRRect brl Done ColorRRect _PaintRRect brl Done DrawOval jsr PSetPen pushlong !Q_Rect moveword [ObjPtr]:#P_ObjFilled,a bne ColorOval _FrameOval brl Done ColorOval _PaintOval brl Done DrawPict call D_SetCursor,in=(#WatchCursor:w) ; D_Save and set the clip spacelong _NewRgn movelong 1:s,ClipRgn _GetClip call D_SectClipRect,in=(!Q_Rect:l) moverect [ObjPtr]:#P_PictRect,PictRect movelong [ObjPtr]:#P_PictHandle,PictHdl movelong [PictHdl],PictPtr moveword [PictPtr],a and #$80 bne Not320 addword PictRect+2,PictRect+6,a lsr a moveword a,PictRect+6 Not320 call P_FixRect,in=(!PictRect:l,#P_RECTANGLE:w,P_PageMode:w,#1:w) call D_DrawPicture,in=(PictHdl:l,!PictRect:l),err=err ; restore the clip tool _SetClip,in=(ClipRgn:l) tool _DisposeHandle,in=(ClipRgn:l) Done _PenNormal tool _HUnlock,in=(ObjHdl:l) RETURN PSetPen call P_SetPen,in=([ObjPtr]:#P_PenSize:w,[ObjPtr]:#P_ObjColor:w) rts ENDP ;------------------------------------------------------------------------------ ; ; P_DrawObjList (LastObj:l,RectPtr:l,Printing:w) ; P_DrawObjList PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data INPUT LastObj:l,RectPtr:l,Printing:w LOCAL ObjHdl:l,ObjPtr:l,ObjType:w,TempRect:r,Q_PenSize:w BEGIN movelong LastObj,ObjHdl While1 cpzl ObjHdl jeq EndWhile1 movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_Type,ObjType moverect [ObjPtr]:#P_ObjRect,TempRect call P_LineAdjust,in=(ObjPtr:l,!TempRect:l) moveword [ObjPtr]:#P_Deleted,a bne NextObject lda T_Editing beq @NoEdit lda Printing bne @NoEdit cmpw ObjType,#P_ALPHA bne @NoEdit cmpl [ObjPtr]:#P_ParagHdl,T_CurParHdl bne @NoEdit tool _SetClipHandle,in=(P_OldClip:l) jsr DrawIt tool _SetClipHandle,in=(P_NewClip:l) bra NextObject @NoEdit jsr DrawIt NextObject movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_Prev,ObjHdl brl While1 EndWhile1 DrawHandles lda Printing bne Exit movelong LastObj,ObjHdl While2 cpzl ObjHdl beq EndWhile2 movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_Deleted,a bne NoDraw moveword [ObjPtr]:#P_Selected,a beq NoDraw call P_DrawHandles,in=(ObjPtr:l) NoDraw movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_Prev,ObjHdl bra While2 EndWhile2 Exit RETURN DrawIt call P_FixRect,in=(!TempRect:l,#P_RECTANGLE:w,P_PageMode:w,#1:w) call D_RectSect,in=(RectPtr:l,!TempRect:l),out=(a:w) beq No call P_DrawObject,in=(ObjHdl:l,Printing:w) No rts ENDP ;----------------------------------------------------------------------------- ; ; P_MakeObj (ObjType:w,Pt:l,DataHdl:l,Flags:w) ; ; Makes a D_New object after defining its rectangle. P_MakeObj PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjType:w,Pt:l,DataHdl:l,Flags:w LOCAL Q_Rect:r,ObjHdl:l,AnchorPt:l,mods:w BEGIN movelong Pt,AnchorPt lda ObjType beq NoMag lda P_MagGuides beq NoMag call P_MagValue,in=(AnchorPt:w,#1:w),out=(AnchorPt:w) call P_MagValue,in=(AnchorPt+2:w,#0:w),out=(AnchorPt+2:w) NoMag call P_GetModifiers,out=(mods:w) call P_MakeFigure,in=(ObjType:w,AnchorPt:l),out=(Q_Rect+4:l) movelong AnchorPt,Q_Rect ; if the option key is down lda mods and #optionKey beq @cont ; and if it's a Pict cmpw ObjType,#P_PICTURE bne @cont ; then double the vertical size (down the page). cmpl Q_Rect,Q_Rect+4 bne @diff call P_GetPictSize,in=(DataHdl:l),out=(Q_Rect+4:l) addword Q_Rect,Q_Rect+4,Q_Rect+4 addword Q_Rect+2,Q_Rect+6,Q_Rect+6 @diff subword Q_Rect+4,Q_Rect,a asl a addword a,Q_Rect,Q_Rect+4 @cont cmpw ObjType,#P_ALPHA bne NotAlpha call P_SmallRect,in=(!Q_Rect:l),out=(a:w) beq NotSmall lda Flags bne Exit call P_ExplodeRect,in=(Pt:l,!Q_Rect:l) bcs Exit NotSmall NotAlpha call P_NewObj,in=(ObjType:w,!Q_Rect:l,DataHdl:l),out=(ObjHdl:l) cpzl ObjHdl beq Exit cmpw ObjType,#P_ALPHA bne Exit cpzl DataHdl bne Exit call T_Activate,in=(ObjHdl:l,AnchorPt:l),out=(a:w) bne Exit call P_DrawObject,in=(ObjHdl:l,#0:w) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_NewObj (ObjType:w,RectPtr:l,DataHdl:l) : ObjHdl:l ; P_NewObj PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjType:w,RectPtr:l,DataHdl:l OUTPUT ObjHdl:l LOCAL ObjPtr:l,ObjRectPtr:l,UpdateRgn:l LOCAL BRect:r,LCorner:l,Same:w BEGIN lda ObjType cmp #P_Line beq Valid cmp #P_STRLINE beq Valid call P_ValidRect,in=(RectPtr:l),out=(a:w) Valid stz Same cmpl [RectPtr],[RectPtr]:#4 bne Diff inc Same Diff stzl ObjHdl lda ObjType dec a asl a asl a tax lda P_ObjSizes,x call D_NeedHand,in=(#0:w,a:w),out=(ObjHdl:l) bcc NoErr jsl D_MemoryError brl Exit NoErr rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) addlong ObjPtr,#P_ObjRect,ObjRectPtr moveword ObjType,[ObjPtr]:#P_Type moverect [RectPtr],[ObjRectPtr] movelong P_ObjList,[ObjPtr]:#P_Next lda #0 moveword a,[ObjPtr]:#P_Prev moveword a,[ObjPtr]:#P_Prev+2 moveword a,[ObjPtr]:#P_Selected moveword a,[ObjPtr]:#P_Deleted moveword a,[ObjPtr]:#P_UndoData lda ObjType asl a tax jmp (JumpTable,x) JumpTable DC.W Exit DC.W NewAlpha DC.W NewSpecial DC.W NewSpecial DC.W NewGraphic DC.W NewGraphic DC.W NewGraphic DC.W NewGraphic DC.W NewGraphic DC.W NewPict NewAlpha call T_New,in=(ObjHdl:l,DataHdl:l) brl MadeObj NewSpecial moveword P_DefFont,[ObjPtr]:#P_ItemFontID shortm moveword P_DefStyle,[ObjPtr]:#P_ItemFontID+2 moveword P_DefSize,[ObjPtr]:#P_ItemFontID+3 longm moveword P_DefColor,[ObjPtr]:#P_ItemColor moveword P_DefJust,[ObjPtr]:#P_ItemJust moveword P_Page,[ObjPtr]:#P_CopyPage call P_SetSpecStr,in=(ObjPtr:l,#1:w) tool _StringBounds,in=(#P_SpecStr:l,!BRect:l) subword BRect+4,BRect,a addword a,#2,a addword a,[ObjRectPtr],[ObjRectPtr]:#4 subword BRect+6,BRect+2,a addword a,#2,a addword a,[ObjRectPtr]:#2,[ObjRectPtr]:#6 brl MadeObj NewGraphic lda Same jne KillObj moveword P_LineSize,[ObjPtr]:#P_PenSize moveword P_FillMode,[ObjPtr]:#P_ObjFilled moveword P_DefColor,[ObjPtr]:#P_ObjColor brl MadeObj NewPict call P_SmallRect,in=(ObjRectPtr:l),out=(a:w) beq RectSet movelong [ObjRectPtr],LCorner movelong #0,[ObjRectPtr] call P_GetPictSize,in=(DataHdl:l),out=([ObjRectPtr]:#4:l) tool _OffsetRect,in=(ObjRectPtr:l,LCorner:l) RectSet movelong DataHdl,[ObjPtr]:#P_PictHandle moverect [ObjRectPtr],[ObjPtr]:#P_PictRect bra MadeObj KillObj tool _DisposeHandle,in=(ObjHdl:l) stzl ObjHdl brl Exit MadeObj call P_FixSpecRect,in=(ObjPtr:l) tool _HUnlock,in=(ObjHdl:l) call P_BuildUndo,in=(#P_NoUndo:w) call P_InsertObj,in=(ObjHdl:l,#0:l) cmpw ObjType,#P_ALPHA bne NotText cpzl DataHdl beq Exit tool _NewRgn,out=(UpdateRgn:l) call P_AddThreadRgn,in=(ObjHdl:l,UpdateRgn:l) call P_DrawRgn,in=(UpdateRgn:l) bra Exit NotText call P_DrawObject,in=(ObjHdl:l,#0:w) Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; This data segment contains declarations for object stuff. ; P_ObjData PROC EXPORT EXPORT P_OBJSIZES ; Types of tools and objects P_OBJSIZES DC.L P_TextObjSize DC.L 36 DC.L 36 DC.L 36 DC.L 36 DC.L 36 DC.L 36 DC.L 36 DC.L 36 ; Common Object Part ; Q_Text Object Part ; Lines, Q_Rects, Rounded Q_Rects, Ovals ; Page #, Date ; Pictures ; List Operations ; Object attribute changes ; Object handles ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/POBJUTIL.S b/appleworksgs/PL/Src/POBJUTIL.S new file mode 100755 index 0000000..0048f67 --- /dev/null +++ b/appleworksgs/PL/Src/POBJUTIL.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT P_PageRect IMPORT P_FullPageRect IMPORT P_PrintHand IMPORT D_BitMapChanged IMPORT D_Deref IMPORT X_DoAsciitoPLText IMPORT D_DrawIcon IMPORT X_DrawPLText IMPORT D_NeedHand IMPORT P_AddObjRgn IMPORT P_BtmHdl IMPORT P_Constrain IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_DefColor IMPORT P_DoHandles IMPORT P_DrawContent IMPORT P_FixRect IMPORT P_GetPageMode IMPORT P_LineSize IMPORT P_Local2PL IMPORT P_MagPt IMPORT P_Mask IMPORT P_MinHdl IMPORT P_ObjList IMPORT P_Page IMPORT P_PageMode IMPORT P_PlsHdl IMPORT P_SpecStr IMPORT P_TopHdl IMPORT P_TrackCursor IMPORT D_SectRgnRect IMPORT D_Set4Pat IMPORT T_ScalePort ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_SetPen ;----------------------------------------------------------------------------- ; ; P_DrawFigure (Figure:w,Pt1:l,Pt2:l) ; P_DrawFigure PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT Figure:w,Pt1:l,Pt2:l LOCAL Q_Rect:r,PageMode:w,Pen:l,Q_OvalSize:w BEGIN movelong Pt1,Q_Rect movelong Pt2,Q_Rect+4 rcall P_GetPageMode,out=(PageMode:a) call P_FixRect,in=(!Q_Rect:l,Figure:w,PageMode:w,#1:w) lda Figure asl a tax jmp (JumpTable,x) JumpTable DC.W DoRect ; 0 DC.W DoRect ; 1 DC.W DoRect ; 2 DC.W DoRect ; 3 DC.W DoLine ; 4 DC.W DoLine ; 5 DC.W DoRect ; 6 DC.W DoRoundRect ; 7 DC.W DoOval ; 8 DC.W DoRect ; 9 DoLine cmpl Q_Rect,Q_Rect+4 beq ToExit tool _MoveTo,in=(Q_Rect:l) tool _LineTo,in=(Q_Rect+4:l) ToExit bra Exit DoRect tool _FrameRect,in=(!Q_Rect:l) bra Exit DoRoundRect moveword #20,Q_OvalSize moveword #40,Q_OvalSize+2 lda PageMode beq NoScale tool _ScalePt,in=(!Q_OvalSize:l,#P_PageRect:l,#P_FullPageRect:l) NoScale tool _FrameRRect,in=(!Q_Rect:l,Q_OvalSize:l) bra Exit DoOval tool _FrameOval,in=(!Q_Rect:l) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_DrawSpec (ObjPtr:l) ; P_DrawSpec PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using D_GlobalData INPUT ObjPtr:l LOCAL AsciiHdl:l,StaticText:l,Lngth:l,Port:l LOCAL Q_Rect:r,ScaleRect:r BEGIN lda P_SpecStr and #$ff sta Lngth stz Lngth+2 call D_NeedHand,in=(Lngth:l),out=(AsciiHdl:l) jcs Exit tool _PtrToHand,in=(#P_SpecStr+1:l,AsciiHdl:l,Lngth:l) in AsciiHdl:l,[ObjPtr]:#P_ItemFontId:l,[ObjPtr]:#P_ItemColor:w out StaticText:l xcall X_DoAsciitoPLText jcs Done2 moverect [ObjPtr]:#P_ObjRect,Q_Rect lda P_PageMode bne OffScreen call P_FixRect,in=(!Q_Rect:l,#P_RECTANGLE:w,#0:w,#1:w) call X_DrawPLText,in=(StaticText:l,!Q_Rect:l) brl Done1 OffScreen subword Q_Rect+4,Q_Rect,a cmp #100 blt VOkay addword Q_Rect,#100,Q_Rect+4 VOkay moverect Q_Rect,ScaleRect tool _MapRect,in=(!ScaleRect:l,#P_PageRect:l,#P_FullPageRect:l) subword Q_Rect+4,Q_Rect,Q_Rect+4 subword Q_Rect+6,Q_Rect+2,Q_Rect+6 stz Q_Rect stz Q_Rect+2 tool _SetPort,in=(T_ScalePort:l) tool _EraseRect,in=(!Q_Rect:l) call X_DrawPLText,in=(StaticText:l,!Q_Rect:l) tool _SetPort,in=(P_CurrentWin:l) pushlong T_ScalePort ;Src LocInfo pushlong P_CurrentWin ;Dest LocInfo pushlong !Q_Rect ;Src Q_Rect pushlong !ScaleRect ;Dest Q_Rect pushword #NotBIC ;Mode pushlong #0 _CopyPixels moveword #1,>D_BitMapChanged Done1 tool _DisposeHandle,in=(StaticText:l) Done2 tool _DisposeHandle,in=(AsciiHdl:l) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_IsObjSel () : Result:w ; ; Returns true if an object is selected. P_IsObjSel PROC EXPORT ;Using P_Data ;Using P_ObjData OUTPUT Result:w LOCAL ObjHdl:l,ObjPtr:l BEGIN stz Result movelong P_ObjList,ObjHdl Loop cpzl ObjHdl beq Exit movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_Deleted,a bne NextObj moveword [ObjPtr]:#P_Selected,a bne Yes NextObj movelong [ObjPtr],ObjHdl bra Loop Yes inc Result Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_MakeFigure (Figure:w,AnchorPt:l) : EndPt:l ; ; AnchorPt must be in D_PL coordinates. P_MakeFigure PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT Figure:w,AnchorPt:l OUTPUT EndPt:l LOCAL NewPt:l BEGIN movelong AnchorPt,EndPt tool _SetPenMode,in=(#notXOR:w) lda Figure cmp #P_STRLINE blt Normal call P_SetPen,in=(P_LineSize:w,P_DefColor:w) bra WhileLoop Normal tool _SetPenSize,in=(#1:w,#1:w) tool _SetPenMask,in=(#P_Mask:l) WhileLoop tool _StillDown,in=(#0:w),out=(a:w) jeq EndWhile tool _GetMouse,in=(!NewPt:l) call P_TrackCursor,in=(!NewPt:l) rcall P_Local2PL,in=(NewPt:ax),out=(NewPt:ax) cmpw Figure,#P_RECTANGLE blt NoCorrect cmp #P_CIRCLE+1 bge NoCorrect addword P_LineSize,NewPt,NewPt lda P_LineSize asl a addword a,NewPt+2,NewPt+2 NoCorrect call P_Constrain,in=(Figure:w,AnchorPt:l,!NewPt:l,P_PrintHand:l) call P_MagPt,in=(!NewPt:l,!AnchorPt:l,Figure:w) call P_Constrain,in=(Figure:w,AnchorPt:l,!NewPt:l,P_PrintHand:l) cmpl EndPt,NewPt jeq WhileLoop ; Erase Old Figure call P_DrawFigure,in=(Figure:w,AnchorPt:l,EndPt:l) ; Draw D_New Figure call P_DrawFigure,in=(Figure:w,AnchorPt:l,NewPt:l) movelong NewPt,EndPt brl WhileLoop EndWhile ; erase last one call P_DrawFigure,in=(Figure:w,AnchorPt:l,EndPt:l) _PenNormal RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_SetPen (LineSize:w,Color:w) ; P_SetPen PROC EXPORT ;Using P_Data INPUT LineSize:w,Color:w LOCAL Pt:l BEGIN lda LineSize sta Pt stz Pt+2 lda P_PageMode beq SetIt tool _ScalePt,in=(!Pt:l,#P_PageRect:l,#P_FullPageRect:l) SetIt lda Pt bne Okay inc Pt Okay lda Pt asl a sta Pt+2 tool _SetPenSize,in=(Pt:l) call D_Set4Pat,in=(Color:w) RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_AddThreadRgn (ObjHdl:l,RgnHdl:l) ; ; Adds the rectangles for all the Q_Text objects in the thread starting at ; ObjHdl that are on the current page. P_AddThreadRgn PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjHdl:l,RgnHdl:l LOCAL ObjPtr:l BEGIN Loop cpzl ObjHdl beq EndLoop rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) cmpw P_Page,[ObjPtr]:#P_PageNo bne Skip call P_AddObjRgn,in=(ObjPtr:l,RgnHdl:l) Skip tool _HUnlock,in=(ObjHdl:l) movelong [ObjPtr]:#P_NThread,ObjHdl bra Loop EndLoop RETURN ENDP ;----------------------------------------------------------------------------- ; ; P_DrawRgn (UpdateRgn:l) ; ; Disposes the UpdateRgn when done. P_DrawRgn PROC EXPORT ;Using P_Data INPUT UpdateRgn:l LOCAL ClipHdl:l,ClipPtr:l,Q_Rect:r BEGIN call D_SectRgnRect,in=(UpdateRgn:l,#P_ContentRect:l) tool _GetClipHandle,out=(ClipHdl:l) tool _EraseRgn,in=(ClipHdl:l) movelong [ClipHdl],ClipPtr moverect [ClipPtr]:#2,Q_Rect call P_DrawContent,in=(!Q_Rect:l,#0:w) tool _ClipRect,in=(#P_ContentRect:l) tool _DisposeRgn,in=(UpdateRgn:l) RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_DrawHandles (ObjPtr:l) ; P_DrawHandles PROC EXPORT ;Using P_ObjData ;Using P_IconData ;Using P_Data INPUT ObjPtr:l LOCAL Q_Rect:r,MidPt:w,PThread:l,NThread:l BEGIN call P_DoHandles,in=(ObjPtr:l,#0:w,#0:l),out=(a:w) cmpw [ObjPtr]:#P_Type,#P_ALPHA jne Exit moverect [ObjPtr]:#P_ObjRect,Q_Rect call P_FixRect,in=(!Q_Rect:l,[ObjPtr]:#P_Type:w,P_PageMode:w,#1:w) subword Q_Rect+6,Q_Rect+2,a lsr a subword a,#7,a addword a,Q_Rect+2,MidPt pushlong ObjPtr TryPrev movelong [ObjPtr]:#P_PThread,PThread cpzl PThread beq NoPrev movelong [PThread],ObjPtr moveword [ObjPtr]:#P_Deleted,a bne TryPrev pushlong #P_MinHdl bra Cont NoPrev pushlong #P_TopHdl Cont pushword MidPt subword Q_Rect,#5,s pushword #notXOR jsl D_DrawIcon pulllong ObjPtr TryNext movelong [ObjPtr]:#P_NThread,NThread cpzl NThread beq NoNext movelong [NThread],ObjPtr moveword [ObjPtr]:#P_Deleted,a bne TryNext pushlong #P_PlsHdl bra Cont2 NoNext pushlong #P_BtmHdl Cont2 pushword MidPt lda Q_Rect+4 dec a pha pushword #notXOR jsl D_DrawIcon Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/POBJUTIL2.S b/appleworksgs/PL/Src/POBJUTIL2.S new file mode 100755 index 0000000..94197c4 --- /dev/null +++ b/appleworksgs/PL/Src/POBJUTIL2.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AddRectRgn IMPORT D_Deref IMPORT P_DrawHandles IMPORT P_Fix2Int IMPORT P_FixRect IMPORT P_GetModifiers IMPORT P_GetPageMode ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_AddObjRgn ENTRY P_DoHandles ENTRY P_FixSpecRect ENTRY P_PtInLine ENTRY P_PtInOval ENTRY P_ValidRect ;------------------------------------------------------------------------------ ; ; P_ListOp (ObjList:l,Oper:w,Data:l,Data2:l) ; ; Automatically skips any object with the Deleted flag set. P_ListOp PROC EXPORT ;Using P_ObjData INPUT ObjList:l,Oper:w,Data:l,Data2:l LOCAL ObjPtr:l,ObjType:w,Selected:w,Q_Rect:r BEGIN ObjLoop cpzl ObjList beq Exit movelong [ObjList],ObjPtr moveword [ObjPtr]:#P_Deleted,a bne NextObj tool _HLock,in=(ObjList:l) moveword [ObjPtr]:#P_Type,ObjType moveword [ObjPtr]:#P_Selected,Selected moverect [ObjPtr]:#P_ObjRect,Q_Rect lda Oper asl a tax jsr (JumpTable,x) tool _HUnlock,in=(ObjList:l) NextObj movelong [ObjPtr],ObjList bra ObjLoop Exit RETURN JumpTable DC.W SelectRect DC.W DeselectAll DC.W SelectAll DC.W FixTObj DC.W OffsetObj DC.W AddUpdate DC.W ClrUndoData DC.W SetUndoData DC.W CpyUndoData ; -------- Operation 0 SelectRect ;TopLeft tool _PtInRect,in=(!Q_Rect:l,Data:l),out=(a:w) beq Exit0 ;BottomRight tool _PtInRect,in=(!Q_Rect+4:l,Data:l),out=(a:w) beq Exit0 lda Selected eor #1 moveword a,[ObjPtr]:#P_Selected call P_DrawHandles,in=(ObjPtr:l) Exit0 rts ; -------- Operation 1 ; ; If Data is not 0, then don't D_Update the screen. DeselectAll lda Selected beq Exit1 moveword #0,[ObjPtr]:#P_Selected lda Data bne Exit1 call P_DrawHandles,in=(ObjPtr:l) Exit1 rts ; ------- Operation 2 SelectAll lda Selected bne Exit2 inc a moveword a,[ObjPtr]:#P_Selected call P_DrawHandles,in=(ObjPtr:l) Exit2 rts ; ------- Operation 3 FixTObj cmpw ObjType,#P_ALPHA bne Exit3 moveword Data,[ObjPtr]:#P_PageNo Exit3 rts ; ------- Operation 4 ; Offsets all object Q_Rects by Data. OffsetObj lda Selected beq Exit4 addword Q_Rect,Data,[ObjPtr]:#P_ObjRect addword Q_Rect+4,Data,[ObjPtr]:#P_ObjRect+4 addword Q_Rect+2,Data+2,[ObjPtr]:#P_ObjRect+2 addword Q_Rect+6,Data+2,[ObjPtr]:#P_ObjRect+6 cmpw ObjType,#P_PICTURE bne PictSet addword [ObjPtr]:#P_PictRect,Data,[ObjPtr]:#P_PictRect addword [ObjPtr]:#P_PictRect+4,Data,[ObjPtr]:#P_PictRect+4 addword [ObjPtr]:#P_PictRect+2,Data+2,[ObjPtr]:#P_PictRect+2 addword [ObjPtr]:#P_PictRect+6,Data+2,[ObjPtr]:#P_PictRect+6 PictSet call P_FixSpecRect,in=(ObjPtr:l) Exit4 rts ; ------- Operation 5 ; Adds the selected objects to the D_Update Q_Region passed in Data. AddUpdate lda Selected beq Exit5 call P_AddObjRgn,in=(ObjPtr:l,Data:l) Exit5 rts ; ------ Operation 6 ; Sets the UndoData for all selected objects. ClrUndoData moveword #0,[ObjPtr]:#P_UndoData Exit6 rts ; ------ Operation 7 ; Sets the UndoData for all selected objects. SetUndoData lda Selected beq Exit7 moveword Data,[ObjPtr]:#P_UndoData Exit7 rts ; ------ Operation 8 ; Copies the UndoData into the Selected field. Used for redo of obj deletion. CpyUndoData moveword [ObjPtr]:#P_UndoData,[ObjPtr]:#P_Selected Exit8 rts ENDP ;------------------------------------------------------------------------------ ; ; P_FindObject (ObjList:l,Pt:l) : ObjHdl:l,Handle:w ; ; Pt must be in screen coordinates. ; ; Returns 0 for ObjHdl if no object is found. ; Handle ranges from 1 to 4 for normal objects, and includes ; 5 and 6 for Q_Text objects. ; ; [BOGUS] -- leaves ObjHdl X_Locked. P_FindObject PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjList:l,Pt:l OUTPUT ObjHdl:l,Handle:w LOCAL ObjPtr:l,Q_Rect:r,InnerRect:r,HRect:r,PageMode:w LOCAL ObjType:w,Q_PenSize:w,RgnHdl:l,InLine:w BEGIN rcall P_GetPageMode,out=(PageMode:a) ; Check Handles of all objects first movelong ObjList,ObjHdl Loop cpzl ObjHdl beq CheckObjects rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) moveword [ObjPtr]:#P_Deleted,a bne TryNext moveword [ObjPtr]:#P_Selected,a beq TryNext call P_DoHandles,in=(ObjPtr:l,#1:w,Pt:l),out=(Handle:w) jne Exit TryNext tool _HUnlock,in=(ObjHdl:l) movelong [ObjPtr],ObjHdl brl Loop ; Check all the objects CheckObjects stz Handle movelong ObjList,ObjHdl Loop2 cpzl ObjHdl jeq Exit rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) moveword [ObjPtr]:#P_Deleted,a jne TryNext2 moveword [ObjPtr]:#P_Type,ObjType moveword [ObjPtr]:#P_PenSize,Q_PenSize moverect [ObjPtr]:#P_ObjRect,Q_Rect moverect Q_Rect,InnerRect call P_FixRect,in=(!Q_Rect:l,ObjType:w,PageMode:w,#1:w) ; Inset by Q_PenSize pushlong !InnerRect lda Q_PenSize tax asl a inc a pha inx phx _InsetRect call P_FixRect,in=(!InnerRect:l,ObjType:w,PageMode:w,#1:w) lda ObjType asl a tax jmp (JumpTable,x) CheckLine call P_PtInLine,in=(Pt:l,ObjPtr:l,!Q_Rect:l),out=(a:w) jne Exit brl TryNext2 CheckFRect tool _PtInRect,in=(!Pt:l,!Q_Rect:l),out=(a:w) jne Exit brl TryNext2 CheckRect moveword [ObjPtr]:#P_ObjFilled,a bne CheckFRect tool _PtInRect,in=(!Pt:l,!Q_Rect:l),out=(a:w) beq TryNext2 tool _PtInRect,in=(!Pt:l,!InnerRect:l),out=(a:w) beq Exit bra TryNext2 CheckCircle call P_PtInOval,in=(Pt:l,!Q_Rect:l),out=(a:w) beq TryNext2 moveword [ObjPtr]:#P_ObjFilled,a bne Exit call P_PtInOval,in=(Pt:l,!InnerRect:l),out=(a:w) beq Exit TryNext2 tool _HUnlock,in=(ObjHdl:l) movelong [ObjPtr],ObjHdl brl Loop2 Exit RETURN JumpTable DC.W TryNext2 DC.W CheckFRect DC.W CheckFRect DC.W CheckFRect DC.W CheckLine DC.W CheckLine DC.W CheckRect DC.W CheckRect DC.W CheckCircle DC.W CheckFRect ENDP ;------------------------------------------------------------------------------ ; ; P_LineAdjust (ObjPtr:l,RectPtr:l) ; P_LineAdjust PROC EXPORT ;Using P_ObjData INPUT ObjPtr:l,RectPtr:l LOCAL Q_PenSize:w BEGIN cmpw [ObjPtr]:#P_Type,#P_LINE beq IsLine cmp #P_STRLINE bne Exit IsLine moveword [ObjPtr]:#P_PenSize,Q_PenSize cmpw [RectPtr]:#4,[RectPtr] bge Normal1 addword Q_PenSize,[RectPtr],[RectPtr] bra Horiz Normal1 addword Q_PenSize,[RectPtr]:#4,[RectPtr]:#4 Horiz asl Q_PenSize cmpw [RectPtr]:#6,[RectPtr]:#2 bge Normal2 addword Q_PenSize,[RectPtr]:#2,[RectPtr]:#2 bra Exit Normal2 addword Q_PenSize,[RectPtr]:#6,[RectPtr]:#6 Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_DoHandles (ObjPtr:l,DoFind:w,Where:l) : Handle:w ; ; DoFind -- 1 - Find; 0 - Draw ; Where -- Mouse pos. in local screen coordinates if Find ; Handle -- Result of Find ; ; General purpose routine for drawing and finding handles. P_DoHandles PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjPtr:l,DoFind:w,Where:l OUTPUT Handle:w LOCAL Q_Rect:r,HRect:r,ObjType:w,Swapped:w LOCAL Type:w,Q_PenSize:w,DblPen:w,Temp:w,PageMode:w Q_Line equ 1 FlipLine equ 2 BEGIN moverect [ObjPtr]:#P_ObjRect,Q_Rect call P_LineAdjust,in=(ObjPtr:l,!Q_Rect:l) moveword [ObjPtr]:#P_Type,ObjType moveword [ObjPtr]:#P_PenSize,Q_PenSize asl a sta DblPen rcall P_GetPageMode,out=(PageMode:a) call P_FixRect,in=(!Q_Rect:l,ObjType:w,PageMode:w,#1:w) call P_ValidRect,in=(!Q_Rect:l),out=(Swapped:w) lda DoFind beq Drawing ; finding - first test bounds, to make test fast for really bad pts stz Handle moverect Q_Rect,HRect tool _InsetRect,in=(!HRect:l,#-4:w,#-6:w) tool _PtInRect,in=(!Where:l,!HRect:l),out=(a:w) jeq done Drawing stz Type cmpw ObjType,#P_LINE beq IsLine cmp #P_STRLINE bne Cont IsLine inc Type lda Swapped beq Cont inc Type Cont TestHV lda Type jeq NotHV ; Not a horiz or vert Q_Line subword Q_Rect+6,Q_Rect+2,a ; Q_Rect width = horiz. Q_PenSize? cmp DblPen bne NotVert ; Vertical Q_Line lsr a addword a,Q_Rect+2,a subword a,#3,HRect+2 addword a,#6,HRect+6 addword Q_Rect,#1,HRect+4 subword a,#3,HRect lda #P_TLHdl jsr DoOneHand ; draw or test the handle jcs done ; carry set if hit: exit subword Q_Rect+4,#1,HRect addword a,#3,HRect+4 lda #P_BRHdl jsr DoOneHand brl done notvert subword Q_Rect+4,Q_Rect,a ; Q_Rect height = vert. Q_PenSize? cmp DblPen bne nothv ; Horizontal Q_Line lsr a addword a,Q_Rect,a subword a,#1,HRect addword a,#3,HRect+4 addword Q_Rect+2,#2,HRect+6 subword a,#6,HRect+2 lda #P_TLHdl jsr DoOneHand jcs done subword Q_Rect+6,#2,HRect+2 addword a,#6,HRect+6 lda #P_BRHdl jsr DoOneHand brl done ; Not horizontal or vertical nothv addword Q_Rect,#1,HRect+4 subword a,#3,HRect addword Q_Rect+2,#2,HRect+6 subword a,#6,HRect+2 cmpw Type,#FLipLine beq didul lda #P_TLHdl jsr DoOneHand jcs done didul subword Q_Rect+4,#1,HRect addword a,#3,HRect+4 cmpw Type,#Q_Line beq diddl lda #P_BLHdl jsr DoOneHand jcs done diddl subword Q_Rect+6,#2,HRect+2 addword a,#6,HRect+6 cmpw Type,#FlipLine beq diddr lda #P_BRHdl jsr DoOneHand jcs done diddr addword Q_Rect,#1,HRect+4 subword a,#3,HRect cmpw Type,#Q_Line beq didur lda #P_TRHdl jsr DoOneHand jcs done didur lda DoFind jeq done cmpw ObjType,#P_ALPHA jne done subword Q_Rect+6,Q_Rect+2,a lsr a subword a,#7,a addword a,Q_Rect+2,HRect+2 addword a,#14,HRect+6 moveword Q_Rect,HRect+4 subword a,#5,HRect lda #5 jsr DoOneHand jcs done moveword Q_Rect+4,HRect addword a,#6,HRect+4 lda #6 jsr DoOneHand done cmpw Type,#2 bne Exit cmpw Handle,#4 bne Try2 moveword #1,Handle bra Exit Try2 cmp #3 bne Exit moveword #2,Handle Exit RETURN DoOneHand sta temp lda DoFind beq DrawIt tool _PtInRect,in=(!Where:l,!HRect:l),out=(a:w) beq notin sec moveword temp,Handle notin rts DrawIt tool _InvertRect,in=(!HRect:l) rts ENDP ;------------------------------------------------------------------------------- ; ; P_DoThread (ObjHdl:l,NewObj:l,Dir:w) ; P_DoThread PROC EXPORT ;Using P_ObjData INPUT ObjHdl:l,NewObj:l,Dir:w LOCAL ObjPtr:l,NewPtr:l,PrevObj:l,PrevPtr:l LOCAL NextObj:l,NextPtr:l BEGIN movelong [ObjHdl],ObjPtr movelong [NewObj],NewPtr lda Dir bne After movelong [ObjPtr]:#P_PThread,PrevObj movelong ObjHdl,[NewPtr]:#P_NThread movelong PrevObj,[NewPtr]:#P_PThread movelong NewObj,[ObjPtr]:#P_PThread cpzl PrevObj beq Skip1 movelong [PrevObj],PrevPtr movelong NewObj,[PrevPtr]:#P_NThread Skip1 bra Exit After movelong [ObjPtr]:#P_NThread,NextObj movelong ObjHdl,[NewPtr]:#P_PThread movelong NextObj,[NewPtr]:#P_NThread movelong NewObj,[ObjPtr]:#P_NThread cpzl NextObj beq Skip2 movelong [NextObj],NextPtr movelong NewObj,[NextPtr]:#P_PThread Skip2 Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; P_BoundsRect (ObjHdl:l,RectPtr:l) : Count:w ; P_BoundsRect PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjHdl:l,RectPtr:l OUTPUT Count:w LOCAL ObjPtr:l,Q_Rect:r BEGIN stz Count WhileLoop cpzl ObjHdl jeq EndLoop movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_Deleted,a jne NextObject moveword [ObjPtr]:#P_Selected,a jeq NextObject moverect [ObjPtr]:#P_ObjRect,Q_Rect call P_LineAdjust,in=(ObjPtr:l,!Q_Rect:l) call P_ValidRect,in=(!Q_Rect:l),out=(a:w) lda Count bne NotFirst moverect Q_Rect,[RectPtr] NotFirst inc Count cmpw Q_Rect,[RectPtr] bpl x1 sta [RectPtr] x1 cmpw Q_Rect+2,[RectPtr]:#2 bpl x2 sta [RectPtr],y x2 cmpw Q_Rect+4,[RectPtr]:#4 bmi x3 sta [RectPtr],y x3 cmpw Q_Rect+6,[RectPtr]:#6 bmi x4 sta [RectPtr],y x4 NextObject movelong [ObjPtr],ObjHdl brl WhileLoop EndLoop RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_Constrain (Figure:w,AnchorPt:l,PointPtr:l,PrintHandle:l) ; P_Constrain PROC EXPORT ;Using P_ObjData INPUT Figure:w,AnchorPt:l,PointPtr:l,PHdl:l LOCAL ModFlags:w,Flags:w,NewPt:l LOCAL dx:w,dy:w,pdx:l,pdy:l LOCAL ratio:l,tmp:l,newdy:l BEGIN +B call P_GetModifiers,out=(ModFlags:w) lda Figure beq ToExit asl a tay lda ConstrainTable,y sta flags cmpw Figure,#P_STRLINE beq DoConstr lda ModFlags and #shiftKey bne DoConstr ToExit brl Exit * * This code constrains newpt with reference to anchorpt. The type of * constraint is specified in `flags,' a combination of the bits * %01 (constrain horizontally/vertically) & %10 (constrain * diagonally). At least one bit must be set. * Q_Pixels are assumed to be shaped as defined by the print record. * DoConstr movelong [phdl],tmp tool _FixRatio,in=([tmp]:#4:w,[tmp]:#6:w),out=(ratio:l) movelong [pointptr],newpt subword anchorpt,newpt,dy abs a sta pdy+2 stz pdy subword anchorpt+2,newpt+2,dx abs a sta pdx+2 stz pdx tool _FixDiv,in=(pdy:l,ratio:l),out=(newdy:l) movelong newdy,tmp clc rol tmp rol tmp+2 cmpl tmp,pdx ; if 2dy < dx, should be horizontal jlt horiz cmpl newdy,pdx ; if dy < dx, should be diag/horiz blt diag2 movelong pdx,tmp clc rol tmp rol tmp+2 cmpl newdy,tmp ; if dy < 2dx should be diag/vert blt diag1 ; otherwise vertical. vert lda flags ; If can't be vertical, diagonal bit #1 beq diag1 moveword anchorpt+2,[pointptr]:#2 brl exit diag1 lda flags ; If can't be diagonal, vertical bit #2 beq vert lda dx bpl d1pos rcall P_Fix2Int,in=(newdy:ax) addword a,anchorpt+2,[pointptr]:#2 bra exit d1pos rcall P_Fix2Int,in=(newdy:ax) neg a addword a,anchorpt+2,[pointptr]:#2 bra exit diag2 lda flags ; If can't be diagonal, horizontal bit #2 beq horiz tool _FixMul,in=(pdx:l,ratio:l),out=(pdx:l) lda dy bpl d2pos rcall P_Fix2Int,in=(pdx:ax) addword a,anchorpt,[pointptr] bra exit d2pos rcall P_Fix2Int,in=(pdx:ax) neg a addword a,anchorpt,[pointptr] bra exit horiz lda flags ; If can't be horizontal, diagonal bit #1 beq diag2 moveword anchorpt,[pointptr] Exit RETURN ConstrainTable DC.W 0,2,2,2,1,3,2,2,2,2,1 ENDP ;----------------------------------------------------------------------------- ; ; P_AddObjRgn (ObjPtr:l; RgnHdl:l) ; ; Adds the area taken up by the object to the already created RgnHdl. P_AddObjRgn PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjPtr:l,RgnHdl:l LOCAL Q_Rect:r,HRect:r,PageMode:w BEGIN moverect [ObjPtr]:#P_ObjRect,Q_Rect call P_LineAdjust,in=(ObjPtr:l,!Q_Rect:l) rcall P_GetPageMode,out=(PageMode:a) call P_FixRect,in=(!Q_Rect:l,#P_RECTANGLE:w,PageMode:w,#1:w) moveword [ObjPtr]:#P_Selected,a beq AddRect subword Q_Rect+2,#4,Q_Rect+2 addword Q_Rect+6,#4,Q_Rect+6 cmpw [ObjPtr]:#P_Type,#P_ALPHA bne NotAlpha subword Q_Rect,#6,Q_Rect addword Q_Rect+4,#6,Q_Rect+4 bra AddRect NotAlpha dec Q_Rect dec Q_Rect inc Q_Rect+4 inc Q_Rect+4 AddRect call D_AddRectRgn,in=(RgnHdl:l,!Q_Rect:l) Exit RETURN ENDP ;---------------------------------------------------------------------------- ; ; P_SmallRect (RectPtr:l) : Small:w P_SmallRect PROC EXPORT INPUT RectPtr:l OUTPUT Small:w BEGIN stz Small subword [RectPtr]:#4,[RectPtr],a cmp #6 bge Exit subword [RectPtr]:#6,[RectPtr]:#2,a cmp #12 bge Exit inc Small Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_MaskRect (RectPtr:l) ; P_MaskRect PROC EXPORT INPUT RectPtr:l BEGIN ldy #2 lda [RectPtr],y and #$FFFE sta [RectPtr],y ldy #6 lda [RectPtr],y and #$FFFE sta [RectPtr],y RETURN ENDP ;--------------------------------------------------------------------------------- ; ; P_FixSpecRect (ObjPtr:l) ; P_FixSpecRect PROC EXPORT ;Using P_ObjData INPUT ObjPtr:l LOCAL Q_Rect:r,TRect:r,Tmp:w BEGIN addlong ObjPtr,#P_ObjRect,s jsl P_MaskRect moveword [ObjPtr]:#P_Type,a cmp #P_ALPHA jne NotAlpha moverect [ObjPtr]:#P_ObjRect,Q_Rect addword Q_Rect+2,#22,Tmp scmpw Tmp,Q_Rect+6 blt HOkay moveword Tmp,Q_Rect+6 moveword a,[ObjPtr]:#P_ObjRect+6 HOkay addword Q_Rect,#4,Tmp scmpw Tmp,Q_Rect+4 blt VOKay moveword Tmp,Q_Rect+4 moveword a,[ObjPtr]:#P_ObjRect+4 VOkay addword Q_Rect,#1,TRect subword Q_Rect+4,#1,TRect+4 addword Q_Rect+2,#4,TRect+2 subword Q_Rect+6,#4,TRect+6 moverect TRect,[ObjPtr]:#P_TRect NotAlpha cmpw [ObjPtr]:#P_Type,#P_PICTURE bne Exit addlong ObjPtr,#P_PictRect,s jsl P_MaskRect Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; P_ValidRect (RectPtr:l) : Flipped:w ; P_ValidRect PROC EXPORT ;Using P_ObjData INPUT RectPtr:l OUTPUT Flipped:w BEGIN stz Flipped lda [RectPtr] tax cmpw a,[RectPtr]:#4 bmi VOkay ldy #4 moveword [RectPtr]:y,[RectPtr] txa moveword a,[RectPtr]:y inc Flipped VOkay moveword [RectPtr]:#2,a tax cmpw a,[RectPtr]:#6 bmi HOkay moveword [RectPtr]:#6,[RectPtr]:#2 txa moveword a,[RectPtr]:#6 lda Flipped eor #1 sta Flipped HOkay Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_GetPictSize (PictHdl:l) : Pt:l ; ; Sets RectPtr to the bounding Q_Rect for the given picture. P_GetPictSize PROC EXPORT INPUT PictHdl:l OUTPUT Pt:l LOCAL Ptr:l BEGIN movelong [PictHdl],Ptr subword [Ptr]:#6,[Ptr]:#2,Pt subword [Ptr]:#8,[Ptr]:#4,Pt+2 ; moveword [Ptr],a ; and #$80 ; bne Not320 ; asl Pt+2 Not320 RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_PtInLine (Pt:l,ObjPtr:l,RectPtr:l) : Result:w ; ; Makes a rgn of the Q_Line and does a _PtInRgn P_PtInLine PROC EXPORT ;Using P_ObjData INPUT Pt:l,ObjPtr:l,RectPtr:l OUTPUT Result:w LOCAL Start:l,End:l,width:w,height:w,lh:w,lv:w LOCAL RgnHdl:l,Flipped:w,Q_Rect:r BEGIN ; Make a quick check to the adjusted Q_Line coordinates to see if in ; bounding rectangle stz Result moverect [RectPtr],Q_Rect call P_LineAdjust,in=(ObjPtr:l,!Q_Rect:l) call P_ValidRect,in=(!Q_Rect:l),out=(a:w) tool _PtInRect,in=(!Pt:l,!Q_Rect:l),out=(Result:w) jeq Exit moveword [ObjPtr]:#P_PenSize,lv asl a sta lh call P_ValidRect,in=(RectPtr:l),out=(Flipped:w) movelong [RectPtr],End movelong [RectPtr]:#4,Start ; now ul is in end, dr in start subword start,end,height subword start+2,end+2,width tool _NewRgn,out=(RgnHdl:l) tool _OpenRgn lda Flipped bne Type2 ; Q_Line is ul-dr type1 tool _MoveTo,in=(end:l) tool _Line,in=(#0:w,lv:w) tool _Line,in=height:l tool _Line,in=(lh:w,#0:w) pea 0 lda lv eor #-1 inc a pha _Line lda width eor #-1 inc a pha lda height eor #-1 inc a pha _Line tool _LineTo,in=(end:l) bra done ; Q_Line is dl-ur type2 tool _MoveTo,in=(end+2:w,start:w) tool _Line,in=(#0:w,lv:w) tool _Line,in=(lh:w,#0:w) pushw width lda height eor #-1 inc a pha _Line pea 0 lda lv eor #-1 inc a pha _Line lda lh eor #-1 inc a pha pea 0 _Line tool _LineTo,in=(end+2:w,start:w) done tool _CloseRgn,in=(RgnHdl:l) tool _PtInRgn,in=(!Pt:l,RgnHdl:l),out=(Result:w) tool _DisposeRgn,in=(RgnHdl:l) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_PtInOval (Q_Point:l,RectPtr:l) : boolean; ; ; Notes: To avoid floating Q_Point math or 64-bit numbers, the ; equation used is x^2 a^2 / b^2 + y^2 <= a^2. (The left ; addend is actually computed as x*x/b*a/b*a) ; P_PtInOval PROC EXPORT INPUT Q_Point:l,rectptr:l OUTPUT init:w LOCAL arad:w,brad:w,a2:l,midx:w,midy:w,temp:l BEGIN tool _PtInRect,in=(!Q_Point:l,RectPtr:l),out=(a:w) jeq notinoval subword [rectptr]:#4,[rectptr],arad ; get horiz. radius lsr arad addword arad,[rectptr],midy ; get horizontal Q_center subword [rectptr]:#6,[rectptr]:#2,brad ; get vert. distance lsr brad addword brad,[rectptr]:#2,midx ; get vertical Q_center tool _Multiply,in=(arad:w,arad:w),out=(a2:l) ; compute a^2 spacelong ; rmdr - used for result x*x/b*a/b*a spacelong ; quotient x*x/b*a/b spacelong ; rmdr - used for result x*x/b*a spacelong ; quotient x*x/b spacelong ; result x*x subword Q_Point+2,midx,a bpl xok ; Mutiply doesn't handle neg #s right eor #$ffff inc a xok pha pha _Multiply ; x*x pea 0 pushword brad _LongDivide ; x*x/b pla ; significant word of quotient sta 1,s ; high word was 0 (assuming x <= b) pushword arad _Multiply ; x*x*a/b pea 0 pushword brad _LongDivide ; x*x*a/(b*b) pla sta 1,s pushword arad _Multiply ; x*x*a*a/(b*b) pulllong temp spacelong ; for Multiply... lda Q_Point sec sbc midy bpl yok eor #$ffff inc a yok pha pha _Multiply addlong s,temp,temp cmpl a2,temp bge inoval notinoval stz init bra done inoval moveword #1,init done RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/POPTIONS.S b/appleworksgs/PL/Src/POPTIONS.S new file mode 100755 index 0000000..eaa51c1 --- /dev/null +++ b/appleworksgs/PL/Src/POPTIONS.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_CloseDialog IMPORT D_DigitsOnly IMPORT D_GetNewModalDialog IMPORT P_BuildUndo IMPORT P_ChangePage IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_DblPage IMPORT P_DrawContent IMPORT P_Entry IMPORT P_FirstPOff IMPORT P_FixSpecMenu IMPORT P_Go2PDlog IMPORT P_GrewDoc IMPORT P_HorizGuides IMPORT P_InitPage IMPORT P_KillPage IMPORT P_LoadPage IMPORT P_LockGuides IMPORT P_MagGuides IMPORT P_MergeGuides IMPORT P_ObjList IMPORT P_PIconRect IMPORT P_PNumDlog IMPORT P_Page IMPORT P_PageCount IMPORT P_PageIcons IMPORT P_PageMode IMPORT P_PageStart IMPORT P_PagesPN IMPORT P_PortRect IMPORT P_PrintChanged IMPORT P_SavePage IMPORT P_StoreV IMPORT P_UseTemplate IMPORT P_V IMPORT P_VertGuides IMPORT P_VisGuides IMPORT P_VisPalette IMPORT P_VisRuler IMPORT D_SetCursor IMPORT T_Deactivate IMPORT D_UseStdColors IMPORT P_KillLMasterStr ; poptions.s include 'pl.equ' ;--------------------------------------------------------------------------- ; ; P_ChgView ; P_ChgView PROC EXPORT ;Using P_AttrData ;Using P_DATA ;Using P_ObjData ;Using T_Data begin +b jsl P_Entry call D_SetCursor,in=(#WatchCursor:w) lda P_PageMode beq GoFull stz P_PageMode movelong P_StoreV,P_V bra Done GoFull inc P_PageMode movelong P_V,P_StoreV stzl P_V call T_Deactivate,in=(#0:w,#0:w) Done call P_FixSpecMenu call P_PrintChanged,in=(P_CurrentWin:l) return ENDP ;--------------------------------------------------------------------------- ; ; P_ChgTemplate ; ; P_ChgTemplate PROC EXPORT ;Using P_AttrData ;Using P_Data begin +b jsl P_Entry Not P_UseTemplate jsl P_FixSpecMenu call P_MergeGuides tool _EraseRect,in=(#P_ContentRect:l) call P_DrawContent,in=(#P_ContentRect:l,#0:w) return ENDP ;--------------------------------------------------------------------------- ; ; P_ChgTmplCount () ; P_ChgTmplCount PROC EXPORT ;Using P_AttrData ;Using P_Data local oldpage:w begin +b jsl P_Entry moveword P_Page,oldpage call P_SavePage,in=(a:w) lda P_DblPage beq GoDbl call P_LoadPage,in=(#0:w) IsNil P_VertGuides bne DoAlert IsNil P_HorizGuides bne DoAlert IsNil P_ObjList beq GoSingle DoAlert jsl D_UseStdColors call D_AlertBox,in=(#2:w,#P_KillLMasterStr:l),out=(a:w) cmp #Cancel jeq exit GoSingle call P_BuildUndo,in=(#P_NoUndo:w) lda oldpage bne DoKill call T_Deactivate,in=(#0:w,#0:w) DoKill call P_KillPage,in=(#0:w,#0:w) call P_InitPage,in=(#0:w) stz P_DblPage lda oldpage bne done inc oldpage bra done GoDbl inc P_DblPage done call P_LoadPage,in=(oldpage:w) jsl P_FixSpecMenu call P_GrewDoc,in=(P_CurrentWin:l) tool _EraseRect,in=(#P_ContentRect:l) call P_DrawContent,in=(#P_ContentRect:l,#0:w) bra quit exit call P_LoadPage,in=(oldpage:w) quit return ENDP ;--------------------------------------------------------------------------- ; ; P_ChgGuideVis ; P_ChgGuideVis PROC EXPORT ;Using P_AttrData ;Using P_Data begin +b jsl P_Entry lda P_VisGuides beq MakeVis stz P_VisGuides bra exit MakeVis inc P_VisGuides exit call P_FixSpecMenu tool _EraseRect,in=(#P_ContentRect:l) tool _InvalRect,in=(#P_ContentRect:l) ; generate an D_Update return ENDP ;--------------------------------------------------------------------------- ; ; P_ChgGuideLock ; P_ChgGuideLock PROC EXPORT ;Using P_AttrData ;Using P_Data begin +b lda P_LockGuides beq Lockit stz P_LockGuides bra exit Lockit inc P_LockGuides exit call P_FixSpecMenu return ENDP ;--------------------------------------------------------------------------- ; ; P_ChgGuideMag ; P_ChgGuideMag PROC EXPORT ;Using P_AttrData ;Using P_Data begin +b lda P_MagGuides beq MakeMag stz P_MagGuides bra exit MakeMag inc P_MagGuides exit call P_FixSpecMenu return ENDP ;--------------------------------------------------------------------------- ; ; P_ChgRulerVis ; P_ChgRulerVis PROC EXPORT ;Using P_AttrData ;Using P_RulerDATA ;Using P_DATA local tmprect:r begin +b jsl P_Entry lda P_VisRuler beq MakeVis stz P_VisRuler tool _ClipRect,in=(#P_PortRect:l) ; GrewDoc will fix this... stz P_contentRect ; top lda P_VisPalette bne DontErase stz P_ContentRect+2 bra DidErase DontErase moveword #P_TabWLeft,P_ContentRect+2 DidErase tool _EraseRect,in=(#P_ContentRect:l) tool _InvalRect,in=(#P_ContentRect:l) stz P_ContentRect+2 stzl P_ContentRect+4 bra exit MakeVis inc P_VisRuler stzl P_ContentRect tool _EraseRect,in=(#P_ContentRect:l) tool _InvalRect,in=(#P_ContentRect:l) ; generate an D_Update stzl P_ContentRect+4 exit call P_GrewDoc,in=(P_CurrentWin:l) call P_FixSpecMenu return ENDP ;--------------------------------------------------------------------------- ; ; P_ChgPalVis ; P_ChgPalVis PROC EXPORT ;Using P_AttrData ;Using P_RulerDATA ;Using P_DATA local tmprect:r begin +b jsl P_Entry lda P_VisPalette beq MakeVis stz P_VisPalette tool _ClipRect,in=(#P_PortRect:l) ; GrewDoc will fix this... ; fix consts... stz P_contentRect ; top stz P_contentRect+2 ; left tool _EraseRect,in=(#P_ContentRect:l) tool _InvalRect,in=(#P_ContentRect:l) stzl P_ContentRect+4 bra exit MakeVis inc P_VisPalette stzl P_ContentRect tool _EraseRect,in=(#P_ContentRect:l) tool _InvalRect,in=(#P_ContentRect:l) stzl P_ContentRect+4 exit call P_GrewDoc,in=(P_CurrentWin:l) call P_FixSpecMenu return ENDP ;--------------------------------------------------------------------------- ; ; P_GotoPage ; P_GotoPage PROC EXPORT ;Using P_Data local TheDlog:l,result:w,page:w local pagetext:r begin +b jsl P_Entry jsl D_UseStdColors call D_GetNewModalDialog,in=(#P_Go2PDlog:l),out=(TheDlog:l) DlogLoop tool _ModalDialog,in=(#D_DigitsOnly+$80000000:l),out=(result:w) cmp #Cancel beq QuitDlog cmp #OK bne DlogLoop DoneDlog tool _GetIText,in=(TheDlog:l,#4:w,!pagetext:l) lda pagetext and #$00FF bne CkValid moveword #2,result bra QuitDlog CkValid tax spaceword pushlong !pagetext+1 pushword x pushword #0 _Dec2Int pullword page bcs QuitDlog QuitDlog call D_CloseDialog,in=(TheDlog:l) cmpw result,#Cancel jeq exit subword page,P_FirstPOff,a bpl NotNeg addword P_FirstPOff,#2,page bra DidCk NotNeg cmp #1 bgt CkGtr addword P_FirstPOff,#2,page bra DidCk CkGtr subword page,P_FirstPOff,a subword a,#2,a cmp P_PageCount blt DidCk lda P_PageCount ina addword a,P_FirstPOff,page DidCk subword page,P_FirstPOff,page DoGo cmpw Page,P_Page beq Exit call P_ChangePage,in=(Page:w,#1:w) Exit return ENDP ;--------------------------------------------------------------------------- ; ; P_SetPageNo ; P_SetPageNo PROC EXPORT ;Using P_Data local TheDlog:l,result:w,page:w,length:w local pagetext:r begin +b jsl P_Entry addword #2,P_FirstPOff,a tool _Int2Dec,in=(a:w,#P_PagesPN:l,#3:w,#0:w) jsl D_UseStdColors call D_GetNewModalDialog,in=(#P_PNumDlog:l),out=(TheDlog:l) DlogLoop tool _ModalDialog,in=(#D_DigitsOnly+$80000000:l),out=(result:w) cmp #Cancel beq QuitDlog cmp #OK bne DlogLoop DoneDlog tool _GetIText,in=(TheDlog:l,#4:w,!pagetext:l) lda pagetext and #$00FF bne CkValid moveword #2,result bra QuitDlog CkValid QuitDlog call D_CloseDialog,in=(TheDlog:l) cmpw result,#Cancel jeq exit lda pagetext and #$FF sta length tool _Dec2Int,in=(!pagetext+1:l,length:w,#0:w),out=(page:w) addword #2,P_FirstPOff,a cmp page ; Same 1st page beq exit ; already. call P_BuildUndo,in=(#P_NoUndo:w) subword P_PageStart,P_FirstPOff,x subword page,#2,P_FirstPOff addword x,P_FirstPOff,P_PageStart tool _ClipRect,in=(#P_PortRect:l) tool _EraseRect,in=(#P_PIconRect:l) call P_PageIcons call P_MergeGuides tool _ClipRect,in=(P_ContentRect:l) tool _InvalRect,in=(#P_ContentRect:l) ; generate an D_Update exit return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PPAGE.S b/appleworksgs/PL/Src/PPAGE.S new file mode 100755 index 0000000..db02fe0 --- /dev/null +++ b/appleworksgs/PL/Src/PPAGE.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_CloseDialog IMPORT D_DigitsOnly IMPORT D_FastMult IMPORT D_GetNewModalDialog IMPORT P_AllHGCount IMPORT P_AllHGuides IMPORT P_AllVGCount IMPORT P_AllVGuides IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_DPageDlog IMPORT P_DblPage IMPORT P_DelObjList IMPORT P_DeleteData IMPORT P_DrawContent IMPORT P_DrawObjList IMPORT P_FirstPOff IMPORT P_FixMenus IMPORT P_FixSpecMenu IMPORT P_GrewDoc IMPORT P_HorizGCount IMPORT P_HorizGuides IMPORT P_InsertData IMPORT P_KillUndo IMPORT P_LastObj IMPORT P_ListOp IMPORT P_Merge IMPORT P_ObjList IMPORT P_PIconRect IMPORT P_PInfoSize IMPORT P_Page IMPORT P_PageArray IMPORT P_PageCount IMPORT P_PageDlog IMPORT P_PageIcons IMPORT P_PageInfo IMPORT P_PageStart IMPORT P_PortRect IMPORT P_ToolType IMPORT P_UseTemplate IMPORT P_VertGCount IMPORT P_VertGuides IMPORT T_ClipThread IMPORT T_DotObj IMPORT D_UseStdColors IMPORT D_SetFileChanged IMPORT T_Editing IMPORT T_Deactivate ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_CenterPage ENTRY P_ChangePage ENTRY P_FixTextObj ENTRY P_InitPage ENTRY P_KillPage ENTRY P_LoadPage ENTRY P_MergeGuides ENTRY P_SavePage ENTRY P_InsPgFilter ; ppage.s ;--------------------------------------------------------------------------- ; ; P_InsertPages ; ; ; OKBut 1 ; CancelBut 2 ; Text1 3 ; Insert ; PgCnt 4 ; 1 ; Text2 5 ; page(s) ; RCtl1 6 ; at the beginning. ; RCtl2 7 ; after the current page. ; RCtl3 8 ; at the end. ; ; invariants: P_PageCount = # of user pages ; P_PageStart = 1st user page that is displayed as an icon ; P_Page = current page's index into page array ; = user page # + 1 ; P_DblPage = bool. F=1 template, T=L/R template P_InsertPages PROC EXPORT ;Using P_Data ;Using P_AttrData ;Using P_ICONDATA Text1I equ 3 PgCntI equ 4 Text2I equ 5 RCtl1 equ 6 RCtl2 equ 7 RCtl3 equ 8 local TheDlog:l,result:w,NewPages:w,thepage:w local WhichCtl:w,offset:w,ptr:l,count:w,hdl:l,oldpage:w local Len:w,pagetext:r error err begin +b moveword #RCtl2,WhichCtl moveword P_Page,oldpage jsl D_UseStdColors call D_GetNewModalDialog,in=(#P_PageDlog:l),out=(TheDlog:l) cmpw P_Page,#2 bge DlogLoop moveword #RCtl1,WhichCtl tool _SetDItemValue,in=(#1:w,TheDlog:l,#RCtl1:w) pushword #255 tool _GetControlDItem,in=(TheDlog:l,#RCtl2:w),out=(:l) tool _HiliteControl,in=(:w,:l) ; [sic] DlogLoop tool _ModalDialog,in=(#P_InsPgFilter+$80000000:l),out=(result:w) cmp #OK jeq HitOK cmp #Cancel jeq DoCancel cmp #RCtl1 blt DlogLoop cmp #RCtl3+1 bge DlogLoop sta WhichCtl tool _SetDItemValue,in=(#1:w,TheDlog:l,WhichCtl:w) brl DlogLoop DoCancel call D_CloseDialog,in=(TheDlog:l) brl Exit HitOK tool _GetIText,in=(TheDlog:l,#PgCntI:w,!pagetext:l) lda pagetext and #$00FF sta Len tool _Dec2Int,in=(!pagetext+1:l,Len:w,#0:w),out=(NewPages:w) lda NewPages beq DoCancel call D_CloseDialog,in=(TheDlog:l) call P_KillUndo call P_SavePage,in=(P_Page:w) cmpw WhichCtl,#RCtl1 bne Ck2 ; after the first page moveword #2,thepage bra DoneCk Ck2 cmp #RCtl2 bne Ck3 ; after the current page lda P_Page ina sta thepage bra DoneCk Ck3 ; ; must be Ctl3: ; after the last page addword P_PageCount,#2,thepage DoneCk addword P_PageCount,#2,count rcall D_FastMult,in=(#P_PInfoSize:x,thepage:y),out=(offset:a) in P_PageArray:l,offset:w,NewPages:w,#P_PInfoSize:w,count:w xerr err xcall P_InsertData jcs whoops moveword NewPages,count moveword thepage,offset ZilchLoop call P_InitPage,in=(offset:w) inc offset dec count jne ZilchLoop lda offset ; Make P_Page correspond dec a ; to the page globals, so sta P_Page ; P_ChangePage is happy. addword P_PageCount,NewPages,P_PageCount call P_FixTextObj call P_GrewDoc,in=(P_CurrentWin:l) call P_ChangePage,in=(thepage:w,#1:w) tool _ValidRect,in=(#P_ContentRect:l) call D_SetFileChanged,in=(P_CurrentWin:l) bra exit whoops call P_ChangePage,in=(oldpage:w,#0:w) Exit return ENDP ;--------------------------------------------------------------------------- ; ; P_InsPgFilter (don't activate OK until there is a number we can use. ; note that we're guaranteed we won't be called if the max. ; number of pages has already been reached.) ; P_InsPgFilter PROC EXPORT input TheDlog:l,TheEvent:l,ItemHit:l local Len:w,pagetext:r output TheResult:w begin +b PgCntI equ 4 tool _GetIText,in=(TheDlog:l,#PgCntI:w,!pagetext:l) lda pagetext and #$00FF sta Len beq NoOK tool _Dec2Int,in=(!pagetext+1:l,Len:w,#0:w),out=(a:w) bcs NoOK beq NoOK addword a,P_PageCount,a cmp #P_MaxPages+1 blt DoOK NoOK pushword #255 bra DoHilite DoOK pushword #0 DoHilite tool _GetControlDItem,in=(TheDlog:l,#1:w),out=(:l) tool _HiliteControl,in=(:w,:l) ; [sic] call D_DigitsOnly,in=(TheDlog:l,TheEvent:l,ItemHit:l),out=(TheResult:w) exit return ENDP ;--------------------------------------------------------------------------- ; ; P_DeletePage ; ; Item#'s: ; ; 1 = OK ; 2 = Cancel ; 3 = 'Delete pages' ; 4 = FromPage ; 5 = 'through' ; 6 = ToPage ; P_DeletePage PROC EXPORT ;Using P_Data ;Using P_AttrData local count:w,offset:w,TheDlog:l,result:w local first:w,last:w,oldpage:w,hdl:l,ptr:l,oldcount:w local tmp:l local pagetext:r error err begin +b call P_KillUndo call P_SavePage,in=(P_Page:w) moveword P_Page,oldpage jsl D_UseStdColors call D_GetNewModalDialog,in=(#P_DPageDlog:l),out=(TheDlog:l) DlogLoop tool _ModalDialog,in=(#D_DigitsOnly+$80000000:l),out=(a:w) cmp #Cancel jeq QuitDlog cmp #OK bne DlogLoop tool _GetIText,in=(TheDlog:l,#4:w,!pagetext:l) lda pagetext and #$00FF jeq QuitDlog tax tool _Dec2Int,in=(!pagetext+1:l,x:w,#0:w),out=(first:w) jcs QuitDlog tool _GetIText,in=(TheDlog:l,#6:w,!pagetext:l) lda pagetext and #$00FF bne GetLast moveword last,first bra GotLast GetLast tax tool _Dec2Int,in=(!pagetext+1:l,x:w,#0:w),out=(last:w) jcs QuitDlog GotLast scmpw last,first bge GotOrder swap first,last GotOrder subword first,P_FirstPOff,first subword a,#2,tmp scmpw tmp,P_PageCount jge QuitDlog ; beyond page range. lda tmp bpl CkLast moveword #2,first ; don't delete before first CkLast subword last,P_FirstPOff,last jmi QuitDlog ; cmp #2 ; jlt QuitDlog ; before page range. subword a,#2,a cmp P_PageCount blt StartDel addword P_PageCount,#1,last ; don't delete beyond last. StartDel lda P_ToolType cmp #P_Alpha bne SkipIt call T_Deactivate,in=(#1:w,#1:w) SkipIt moveword P_PageCount,oldcount moveword last,count DeleteLoop cmpw count,first blt DidDelete Killit call P_KillPage,in=(count:w,#0:w) dec count dec P_PageCount bra DeleteLoop DidDelete pushlong P_PageArray tool _Multiply,in=(#P_PInfoSize:w,first:w),out=(a:w,x:w) phx subword last,first,a ina pha pushword #P_PInfoSize addword oldcount,#2,s call P_DeleteData,in=(:l,:w,:w,:w,:w) ; ;.. Hdl:l,offset:w,items:w,UnitSize:w,Count:w lda P_PageCount jne GotOne ; make a D_New page. moveword #1,P_PageCount cmpw oldpage,#2 blt DoInit moveword #2,oldpage stz T_Editing DoInit in P_PageArray:l,#2*P_PInfoSize:w,#1:w,#P_PInfoSize:w,#2:w xerr err xcall P_InsertData call P_InitPage,in=(#2:w) bra LoadIt GotOne cmpw first,oldpage ; Page was before deletion range bgt LoadIt ; cmpw oldpage,last ble InTheMiddle subword oldpage,last,a ; Page was after deletion range dec a ; addword a,first,oldpage ; stz T_Editing bra Loadit InTheMiddle stz T_Editing subword first,#1,oldpage ; Page was in the deletion range. cmp #1 ; bgt LoadIt ; Go to first page before deletion inc oldpage ; range if possible, or just 1st page. LoadIt call D_CloseDialog,in=(TheDlog:l) call D_SetFileChanged,in=(P_CurrentWin:l) call P_FixTextObj call P_GrewDoc,in=(P_CurrentWin:l) call P_LoadPage,in=(oldpage:w) ; <- hacks to get the right call P_CenterPage,in=(#2:w) ; <- stuff for change page call P_ChangePage,in=(oldpage:w,#1:w) ; set up. tool _ValidRect,in=(#P_ContentRect:l) bra Exit whoops QuitDlog call D_CloseDialog,in=(TheDlog:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_InitPage (PageNo:w) ; P_InitPage PROC EXPORT ;Using P_Data input PageNo:w begin stzl P_ObjList stzl P_LastObj stzl P_VertGuides stzl P_HorizGuides stz P_VertGCount stz P_HorizGCount cmpw PageNo,#2 bge UseIt stz P_UseTemplate bra Done UseIt moveword #1,P_UseTemplate Done call P_SavePage,in=(PageNo:w) return ENDP ;----------------------------------------------------------------------------- ; ; P_SavePage (Page:w) ; P_SavePage PROC EXPORT ;Using P_Data ;Using T_Data input Page:w local Hdl:l,Ptr:l,Size:l begin movelong P_PageArray,Hdl movelong [Hdl],Ptr tool _Multiply,in=(Page:w,#P_PINFOSIZE:w),out=(Size:l) pushlong #P_PageInfo addlong Size,Ptr,s tool _BlockMove,in=(:l,:l,#P_PINFOSIZE:l) return ENDP ;----------------------------------------------------------------------------- ; ; P_LoadPage (NewPage:w) ; ; Sets P_Page to NewPage, loads page data into globals. P_LoadPage PROC EXPORT ;Using P_Data input NewPage:w local Hdl:l,Ptr:l,Size:l begin movelong P_PageArray,Hdl movelong [Hdl],Ptr tool _Multiply,in=(NewPage:w,#P_PINFOSIZE:w),out=(Size:l) addlong Size,Ptr,s tool _BlockMove,in=(:l,#P_PageInfo:l,#P_PINFOSIZE:l) moveword NewPage,P_Page return ENDP ;------------------------------------------------------------------------------ ; ; P_ChangePage (Page:w,Redraw:w) ; ; Changes the document to the given page, and changes the window to reflect ; this. Any objects on the D_New page are deselected if the arrow tool is ; not in use. P_ChangePage PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data INPUT Page:w,Redraw:w BEGIN lda Redraw beq DidCenter call P_CenterPage,in=(page:w) DidCenter tool _ClipRect,in=(#P_PortRect:l) call P_SavePage,in=(P_Page:w) tool _EraseRect,in=(#P_ContentRect:l) call P_LoadPage,in=(Page:w) ; Sets P_Page = page. call P_MergeGuides lda P_ToolType beq IsArrow call P_ListOp,in=(P_ObjList:l,#PL_DeselectAll:w,#0:w,#1:w,#0:l) IsArrow lda Redraw beq DidDraw tool _EraseRect,in=(#P_PIconRect:l) call P_PageIcons DidDraw tool _ClipRect,in=(#P_ContentRect:l) call T_ClipThread,in=(T_DotObj:l) call P_DrawContent,in=(#P_ContentRect:l,#0:w) call P_FixMenus call P_FixSpecMenu RETURN ENDP ;----------------------------------------------------------------------------- ; ; P_DrawTemplate (PageNo:w; RectPtr:l) ; P_DrawTemplate PROC EXPORT ;Using P_Data input PageNo:w,RectPtr:l local PHdl:l,PPtr:l,UseRight:w begin ; Use Right Template if not DoublePage. ; Otherwise Even Pages use Right Template (MPage = 1) ; and Odd Pages use Left Template (MPage = 0) moveword #1,UseRight lda P_DblPage beq DoIt addword PageNo,P_FirstPOff,a bit #1 bne DoIt stz UseRight DoIt movelong P_PageArray,PHdl movelong [PHdl],PPtr lda UseRight beq No addlong #P_PINFOSIZE,PPtr,PPtr No call P_DrawObjList,in=([PPtr]:#4:l,RectPtr:l,#1:w) return ENDP ;------------------------------------------------------------------------------ ; ; P_KillPage (PageNo:w,All:w) ; P_KillPage PROC EXPORT ;Using P_Data input PageNo:w,All:w begin call P_LoadPage,in=(PageNo:w) call P_DelObjList,in=(P_ObjList:l,#1:w,All:w) stzl P_ObjList stzl P_LastObj cpzl P_VertGuides beq DoHoriz tool _DisposeHandle,in=(P_VertGuides:l) stzl P_VertGuides DoHoriz cpzl P_HorizGuides beq Exit tool _DisposeHandle,in=(P_HorizGuides:l) stzl P_HorizGuides Exit call P_SavePage,in=(PageNo:w) return ENDP ;--------------------------------------------------------------------------- ; ; P_MergeGuides ; P_MergeGuides PROC EXPORT ;Using P_Data local UseRight:l,Ptr:l,Hdl:l local TemplV:l,TemplH:l,HCount:w,VCount:w begin stzl TemplV stzl TemplH stz HCount stz VCount lda P_UseTemplate beq DidSetup moveword #1,UseRight lda P_DblPage beq DoIt addword P_Page,P_FirstPOff,a bit #1 bne DoIt stz UseRight DoIt movelong P_PageArray,Hdl movelong [Hdl],Ptr lda UseRight beq No addlong #P_PINFOSIZE,Ptr,Ptr No lda P_UseTemplate beq DidSetup movelong [Ptr]:#8,TemplV movelong [Ptr]:#12,TemplH moveword [Ptr]:#16,VCount moveword [Ptr]:#18,HCount DidSetup in TemplV:l,P_VertGuides:l,P_AllVGuides:l in VCount:w,P_VertGCount:w out P_AllVGCount:w xcall P_Merge in TemplH:l,P_HorizGuides:l,P_AllHGuides:l in HCount:w,P_HorizGCount:w out P_AllHGCount:w xcall P_Merge return ENDP ;--------------------------------------------------------------------------- ; ; P_CenterPage ; ; given a page # (literal, not user) calculate P_PageStart ; so as to Q_center that page icon as well as possible. ; ; only side effect is the modification of P_PageStart P_CenterPage PROC EXPORT ;Using P_Data input page:w local newfirst:w,userpage:w begin cmpw page,#2 ; Don't Q_center master pages. blt exit ; cmpw P_PageCount,#6 ; No scroll arrows. blt UseFirst ; addword page,P_FirstPOff,userpage subword a,P_PageStart,a bmi DoSet cmp #5 blt exit ; It's already visible DoSet cmpw page,#4 blt UseFirst ; Too D_Close to the left cmp P_PageCount ; Obscure hack. blt GotIt subword P_PageCount,#3,a ; Too D_Close to the right, addword a,P_FirstPOff,P_PageStart ; so get (last page - 4) bra exit ; to display the last 5 pp. GotIt subword userpage,#2,P_PageStart bra exit UseFirst addword P_FirstPOff,#2,P_PageStart exit return ENDP ;------------------------------------------------------------------------------- ; ; P_FixTextObj () ; ; This routine is called after pages have been inserted or deleted. ; It D_Update the PageNo field in Q_Text objects. P_FixTextObj PROC EXPORT ;Using P_Data ;Using P_ObjData local PageHdl:l,PagePtr:l,PageCount:w,CurPage:w begin movelong P_PageArray,PageHdl movelong [PageHdl],PagePtr addwl #P_PINFOSIZE*2,PagePtr ;Skip master pages stz PageCount moveword #2,CurPage PLoop call P_ListOp,in=([PagePtr]:l,#PL_FixTObj:w,#0:w,CurPage:w,#0:l) addwl #P_PINFOSIZE,PagePtr inc CurPage inc PageCount cmpw PageCount,P_PageCount blt PLoop return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PPRINT.S b/appleworksgs/PL/Src/PPRINT.S new file mode 100755 index 0000000..5955464 --- /dev/null +++ b/appleworksgs/PL/Src/PPRINT.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_CheckPurge IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_DrawContent IMPORT P_FirstPOff IMPORT P_H IMPORT P_LoadPage IMPORT P_Page IMPORT P_PageCount IMPORT P_PageMode IMPORT P_PageRect IMPORT P_PaperRect IMPORT P_PrintHand IMPORT P_SavePage IMPORT P_V IMPORT D_PrintToLW IMPORT D_PrOpenDoc ; pprint.s ;--------------------------------------------------------------------------- ; ; P_PrintDoc (Window:l) ; P_PrintDoc PROC EXPORT ;Using P_Data input Window:l error Err local PHdl:l,PPtr:l,PrinterPort:l,Spool:w,Copies:w local FirstPage:w,LastPage:w,CurPage:w,docOpened:w BEGIN +b stz Err stz docOpened call P_SavePage,in=(P_Page:w) ; D_Save to be restored pushword P_Page pushword P_PageMode pushlong P_CurrentWin pushword P_H pushword P_V pushlong P_ContentRect stz P_PageMode stz P_H stz P_V subword P_PaperRect,P_PageRect,P_ContentRect subword P_PaperRect+2,P_PageRect+2,P_ContentRect+2 movelong P_PrintHand,PHdl movelong [PHdl],PPtr moveword [PPtr]:#oPrJob+oBJDocLoop,a and #$ff sta Spool moveword [PPtr]:#oPrJob+oICopies,Copies moveword [PPtr]:#oPrJob+oIFstPage,FirstPage moveword [PPtr]:#oPrJob+oILstPage,LastPage moveword #1,[PPtr]:#oPrJob+oIFstPage moveword #1,[PPtr]:#oPrJob+oICopies ; do copies *our* way: collated. ; if it's a LaserWriter, do it the normal way. lda >D_PrintToLW bne @normalMuck moveword #1,[PPtr]:#oPrJob+oILstPage bra @didMuck @normalMuck subword LastPage,FirstPage,a ina moveword a,[PPtr]:#oPrJob+oILstPage @didMuck ; Adjust the page range... ; if it's 1-999, pretend like it's 0-999 cmpw LastPage,#999 bne @cont cmpw FirstPage,#1 bne @cont stz FirstPage @cont lda FirstPage bne NotZero cmpw P_FirstPOff,#-2 beq NotZero inc FirstPage NotZero subword LastPage,P_FirstPOff,LastPage cmpw a,P_PageCount blt LastOkay lda P_PageCount inc a sta LastPage LastOkay subword FirstPage,P_FirstPOff,FirstPage scmpw a,#2 bge FirstOkay moveword #2,FirstPage FirstOkay CopyLoop lda Copies jeq Exit dec Copies moveword FirstPage,CurPage PageLoop cmpw LastPage,CurPage blt CopyLoop ; D_Open printer doc lda docOpened bne @opened moveword #-1,docOpened call D_PrOpenDoc,in=(PHdl:l,#0:l),out=(PrinterPort:l),err=(Err) jcs Abort @opened movelong PrinterPort,P_CurrentWin call P_LoadPage,in=(CurPage:w) tool _PrOpenPage,in=(PrinterPort:l,#0:l),err=(err) bcs CloseIt tool _SetFontFlags,in=(#4:w) tool _SetTextMode,in=(#modeForeCopy:w) call P_DrawContent,in=(#P_PaperRect:l,#1:w) CloseIt tool _PrClosePage,in=(PrinterPort:l) lda err jne Abort lda >D_PrintToLW bne ckMem closeD tool _PrCloseDoc,in=(PrinterPort:l),err=(Err) stz docOpened jcs Exit didclose jsl D_CheckPurge bcc MemOkay tool _PRSetError,in=(#-128:w) lda docOpened jeq Exit brl abort ckMem jsl D_CheckPurge bcc NoSpool tool _PRSetError,in=(#-128:w) lda docOpened jeq Exit brl abort MemOkay ; Print spooled file if neccessary lda Spool beq NoSpool tool _PrPicFile,in=(PHdl:l,#0:l,#StatusRecord:l),err=(Err) bcs Exit NoSpool inc CurPage brl PageLoop Exit lda docOpened beq @restore stz Copies bra closeD @restore ; Restore from stack pulllong P_ContentRect pullword P_V pullword P_H pulllong P_CurrentWin pullword P_PageMode call P_LoadPage,in=(:w) RETURN Abort tool _PrCloseDoc,in=(PrinterPort:l) stz docOpened bra Exit StatusRecord DS.B 28 ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PRIM.S b/appleworksgs/PL/Src/PRIM.S new file mode 100755 index 0000000..dd3f276 --- /dev/null +++ b/appleworksgs/PL/Src/PRIM.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_BeachBall IMPORT D_GetStats IMPORT D_GetWdth IMPORT D_GrowLHandle IMPORT D_MustHandle IMPORT D_SelectFont IMPORT T_CurColor IMPORT T_CurFont IMPORT T_CurIndent IMPORT T_CurRulBits IMPORT T_CurRulPtr IMPORT T_CurStyle IMPORT T_CurStyleSize IMPORT T_GetParPtr IMPORT T_GetSpacing IMPORT T_LockRuler IMPORT T_MaxAscent IMPORT T_MaxDescent IMPORT T_MulLine IMPORT T_UnlockRuler ;------------------------------------------------------------------------------ ; ; T_CountSpaces (TextPtr:l,Offset:w,MaxOffset:w) : TabStop:w,Spaces:w ; T_CountSpaces PROC EXPORT ;Using T_TextEqu INPUT TextPtr:l,Offset:w,MaxOffset:w OUTPUT TabStop:w,Spaces:w BEGIN stz Spaces stz TabStop ldy Offset CharLoop cpy MaxOffset bge Exit lda [TextPtr],y iny and #$ff cmp #SPACE+1 bge CharLoop cmp #5 bge ChkTab asl a tax jmp (JumpTable,x) ChkTab cmp #9 beq DoTab cmp #13 beq Exit cmp #32 beq DoSpace bra Charloop DoSpace inc Spaces bra CharLoop DoTab bra CharLoop Skip2 iny Skip1 iny bra CharLoop Exit dey lda [TextPtr],y and #$ff cmp #SPACE bne No dec Spaces No RETURN JumpTable DC.W Exit ; 0 DC.W Skip2 ; 1 DC.W Skip1 ; 2 DC.W Skip1 ; 3 DC.W Skip1 ; 4 ENDP ;------------------------------------------------------------------------------- ; ; T_UseTab (TextPtr:l,Offset:w,CurH:w,MaxH:w,FontId:l,Color:w) : NextH ; ; TextPtr -- Ptr to Q_Text ; Offset -- Offet into Q_Text after tab. ; CurH -- Where Q_Text up to TextPtr ends horiz. ; MaxH -- The right margin ; ; NextH -- -1 -- Try tab on next Q_Line. ; >= 0 -- Where to start putting Q_Text ; T_UseTab PROC EXPORT ;Using P_Data ;Using T_TextEqu ;Using T_Data INPUT TextPtr:l,Offset:w,CurH:w,MaxH:w,FontId:l,Color:w OUTPUT NextH:w LOCAL RulerPtr:l,FontChanged:w,TabCount:w LOCAL CurTab:l,TextWidth:w,Room:w,TheChar:w BEGIN moveword #-1,NextH ; D_Save these to be restored later pushword FontId pushword FontId+2 pushword Color stz FontChanged lda T_CurRulBits and #T_Full+T_left jeq TreatSpace movelong T_CurRulPtr,RulerPtr cmpw CurH,[RulerPtr]:#T_Indent bge NotIndent moveword [RulerPtr]:y,CurTab stz CurTab+2 bra DoTab NotIndent ; If there are no tab stops, treat as a space moveword [RulerPtr]:#T_TabCount,TabCount jeq TreatSpace ; If the first tab stop is greater than MaxH, treat as a space addwl #T_TabArray,RulerPtr cmpw [RulerPtr],MaxH jge TreatSpace ldx #0 LookTab cmpw CurH,[RulerPtr] blt FoundTab addwl #4,RulerPtr inx cpx TabCount blt LookTab brl Exit ;Past all tabs, try next Q_Line. FoundTab movelong [RulerPtr],CurTab DoTab cmpw CurTab,MaxH bge Exit sta NextH lda CurTab+2 beq Exit ;left tab just move over subword CurTab,CurH,Room stz TextWidth CharLoop moveword [TextPtr]:Offset,a inc Offset and #$ff sta TheChar cmp #'.' bne noPer lda CurTab+2 bpl NormalChar brl AdjustTab NoPer cmp #sp bcs NormalChar SpecChar asl a tax jmp (JumpTable,x) NormalChar lda FontChanged beq NoChange rcall D_SelectFont,in=(FontId:a,FontId+2:x,#0:y) stz FontChanged NoChange rcall D_GetWdth,in=(TheChar:a),out=(a:a) addword a,TextWidth,TextWidth GotTW cmp Room bge MakeCurH brl CharLoop AdjustTab subword Room,TextWidth,a bpl Okay lda #0 Okay addword a,CurH,NextH bra Exit TreatSpace rcall D_GetWdth,in=(#SPACE:a),out=(a:a) addword a,CurH,CurH cmp MaxH bge Exit MakeCurH moveword CurH,NextH Exit ply plx pla jsl D_SelectFont RETURN FChange moveword [TextPtr]:Offset,FontId inc Offset bra ChangeExit SizeChange movebyte [TextPtr]:Offset,FontId+3 bra ChangeExit StyleChange movebyte [TextPtr]:Offset,FontId+2 bra ChangeExit ChangeExit inc Offset inc FontChanged brl CharLoop JumpTable DC.W 0,FChange ;0,1 DC.W StyleChange,SizeChange ;2,3 DC.W ChangeExit,CharLoop ;4,5 DC.W CharLoop,CharLoop ;6,7 DC.W 0,AdjustTab ;8,9 DC.W 0,0 ;a,b DC.W 0,AdJustTab ;c,d ENDP ;------------------------------------------------------------------------------ ; ; T_CutLine (TextPtr:l,LineNo:w,Offset:w,MaxWidth:w) : ; EndOffset:w,LineWidth:w,HitCR:w ; T_CutLine PROC EXPORT ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT TextPtr:l,LineNo:w,Offset:w,MaxWidth:w OUTPUT EndOffset:w,LineWidth:w,HitCR:w LOCAL CurWidth:w,Font:w,StyleSize:w LOCAL MaxAscent:w,MaxDescent:w LOCAL theChar:w,CharSize:w,FontChanged:w,ValidOffset:w BEGIN stz EndOffset stz CurWidth stz FontChanged stz ValidOffset stz HitCR lda LineNo bne NotFirst moveword T_CurIndent,CurWidth NotFirst lda T_CurFont sta Font ldx T_CurStyleSize stx StyleSize ldy #0 jsl D_SelectFont rcall D_GetStats,out=(MaxAscent:a,MaxDescent:x) CharLoop moveword [TextPtr]:Offset,a inc Offset and #$ff sta theChar cmp #SPACE+1 blt SpecialCase ldx FontChanged beq NoChange rcall D_SelectFont,in=(Font:a,StyleSize:x,#0:y) jsl D_GetStats cmp MaxAscent blt Smaller1 sta MaxAscent Smaller1 cpx MaxDescent blt Smaller2 stx MaxDescent Smaller2 stz FontChanged lda theChar NoChange cmp #$2D beq DoHyphen CheckWidth jsl D_GetWdth addword a,CurWidth,CurWidth cmp MaxWidth bge NoFit moveword Offset,ValidOffset bra CharLoop NoFit lda EndOffset bne WordBreaks ; went one too far jsr D_SetStuff dec EndOffset lda ValidOffset beq NoChanges moveword ValidOffset,EndOffset NoChanges rcall D_GetWdth,in=(theChar:a),out=(CharSize:a) subword LineWidth,CharSize,LineWidth WordBreaks brl EndLine SpecialCase cmp #5 bge ChkTab asl a tax jmp (JumpTable,x) ChkTab cmp #9 beq DoTab cmp #13 beq X_DoCR cmp #32 beq DoSpace brl Charloop DoHyphen rcall D_GetWdth,in=(theChar:a),out=(a:a) addword a,CurWidth,a cmp MaxWidth bge NoFit sta CurWidth jsr D_SetStuff brl CharLoop DoSpace jsr D_SetStuff lda theChar brl CheckWidth DoTab jsr D_SetStuff in TextPtr:l,Offset:w,CurWidth:w,MaxWidth:w in StyleSize:w,Font:w,#0:w out a:w xcall T_UseTab bmi TabNext sta CurWidth jsr D_SetStuff brl CharLoop TabNext dec Offset jsr D_SetStuff brl EndLine X_DoCR dec Offset jsr D_SetStuff inc HitCR brl EndLine FontChange moveword [TextPtr]:Offset,Font inc Offset bra ChangeExit StyleChange movebyte [TextPtr]:Offset,StyleSize bra ChangeExit SizeChange movebyte [TextPtr]:Offset,StyleSize+1 ChangeExit inc FontChanged inc Offset brl CharLoop EndLine RETURN D_SetStuff moveword Offset,EndOffset moveword CurWidth,LineWidth moveword Font,T_CurFont moveword StyleSize,T_CurStyleSize moveword MaxAscent,T_MaxAscent moveword MaxDescent,T_MaxDescent rts JumpTable DC.W CharLoop ; 0 DC.W FontChange ; 1 DC.W StyleChange ; 2 DC.W SizeChange ; 3 DC.W ChangeExit ; 4 ENDP ;---------------------------------------------------------------------------- ; ; T_CutParag (ObjHdl:l; ParagNo:w; VertPos:w) : EndObjHdl:l,EndVertPos:w ; ; Works on T_CurParHdl. T_CutParag PROC EXPORT ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT ObjHdl:l,ParagNo:w,VertPos:w OUTPUT EndObjHdl:l,EndVertPos:w ERROR Err LOCAL ObjPtr:l,ParagPtr:l,TextHdl:l,TextPtr:l LOCAL NextObj:l,LinesHdl:l,LinePtr:l,Room:w LOCAL LineCount:w,MaxWidth:w,MaxVert:w,ParHeight:w,LineHeight:w LOCAL Offset:w,EndOffset:w,LineWidth:w,LineFont:l,HitCR:w BEGIN stz Err stz ParHeight stz LineCount moveword #20,Room call D_MustHandle,in=(#20*T_LineInfoSize:l,#attrLocked+attrPurge1:w),out=LinesHdl:l movelong [LinesHdl],LinePtr movelong [ObjHdl],ObjPtr subword [ObjPtr]:#P_TRect+6,[ObjPtr]:#P_TRect+2,MaxWidth subword [ObjPtr]:#P_TRect+4,[ObjPtr]:#P_TRect,MaxVert rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) rcall T_LockRuler,in=(ax:ax) rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong ObjHdl,[ParagPtr]:#T_ObjHdl moveword VertPos,[ParagPtr]:#T_ParStart movelong [ParagPtr]:#T_TextBlock,TextHdl tool _HLock,in=(TextHdl:l) movelong [TextHdl],TextPtr moveword [ParagPtr]:#T_ParOffset,a addwl a,TextPtr movelong [TextPtr],T_CurFont rcall D_SelectFont,in=(T_CurFont:a,T_CurStyle:x,#0:y) moveword #T_ParHeader,Offset LineLoop movelong T_CurFont,LineFont CutLine in TextPtr:l,LineCount:w,Offset:w,MaxWidth:w out EndOffset:w,LineWidth:w,HitCR:w xcall T_CutLine rcall T_GetSpacing,in=(T_CurRulBits:a,T_MaxAscent:x,T_MaxDescent:y) addword a,T_MaxAscent,a addword a,T_MaxDescent,LineHeight addword a,VertPos,a cmp MaxVert bge NextObject jsr SetLine lda HitCR beq LineLoop ToDone brl Done NextObject movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_NThread,NextObj cpzl NextObj bne NextOkay cmpw VertPos,MaxVert bge OverFlow moveword ParagNo,[ObjPtr]:#P_EndParag moveword LineCount,[ObjPtr]:#P_EndLine bra OverFlow NextOkay moveword ParagNo,[ObjPtr]:#P_EndParag moveword LineCount,[ObjPtr]:#P_EndLine movelong NextObj,ObjHdl movelong [ObjHdl],ObjPtr moveword ParagNo,[ObjPtr]:#P_StartParag moveword LineCount,[ObjPtr]:#P_StartLine subword [ObjPtr]:#P_TRect+6,[ObjPtr]:#P_TRect+2,MaxWidth subword [ObjPtr]:#P_TRect+4,[ObjPtr]:#P_TRect,MaxVert stz VertPos movelong LineFont,T_CurFont brl CutLine OverFlow jsr SetLine Done movelong ObjHdl,EndObjHdl moveword VertPos,EndVertPos rcall T_MulLine,in=(LineCount:a),out=(a:a) tool _SetHandleSize,in=(#0:w,a:w,LinesHdl:l) call T_UnlockRuler tool _HUnlock,in=(TextHdl:l) rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) moveword ParHeight,[ParagPtr]:#T_ParHeight moveword LineCount,[ParagPtr]:#T_LineCount movelong LinesHdl,[ParagPtr]:#T_LinesHdl Exit RETURN SetLine cmpw LineCount,Room blt NoGrow addword LineCount,#20,a jsl T_MulLine call D_GrowLHandle,in=(#0:w,a:w,LinesHdl:l),out=LinePtr:l,err=Err jcs LocExit rcall T_MulLine,in=(LineCount:a) addwl a,LinePtr NoGrow addword LineHeight,VertPos,VertPos addword LineHeight,ParHeight,ParHeight inc LineCount moveword Offset,[LinePtr]:#T_Offset subword EndOffset,Offset,[LinePtr]:#T_Length moveword LineWidth,[LinePtr]:#T_LineWidth shortm moveword T_MaxAscent,[LinePtr]:#T_Ascent moveword T_MaxDescent,[LinePtr]:#T_Descent longm moveword EndOffset,Offset addwl #T_LineInfoSize,LinePtr LocExit rts ENDP ;------------------------------------------------------------------------------- ; ; T_RecutParag (ObjHdl:l,ParagNo:w;StartVert:w) : EndObjHdl:l,EndVert:w ; T_RecutParag PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using P_ObjData INPUT ObjHdl:l,ParagNo:w,StartVert:w OUTPUT EndObjHdl:l,EndVert:w LOCAL ParagPtr:l,ParHeight:w,LinesHdl:l BEGIN jsl D_BeachBall rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_LinesHdl,LinesHdl cpzl LinesHdl beq NoDispose tool _DisposeHandle,in=(LinesHdl:l) NoDispose in ObjHdl:l,ParagNo:w,StartVert:w out EndObjHdl:l,EndVert:w xcall T_CutParag rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) tool _HUnlock,in=([ParagPtr]:#T_LinesHdl:l) RETURN ENDP ;------------------------------------------------------------------------------; ; ; T_TrackFont (TextPtr:l, StopOffset:w) ; ; Track a font from the start of the paragragh pointed to by TextPtr ; T_TrackFont PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT TextPtr:l,StopOffset:w BEGIN moveword [TextPtr]:#T_ParFont,T_CurFont moveword [TextPtr]:#T_ParStyle,T_CurStyleSize moveword [TextPtr]:#T_ParColor,a and #$ff sta T_CurColor ldy #T_ParHeader CharLoop cpy StopOffset bge Exit lda [TextPtr],y iny and #$ff cmp #T_ColorChange+1 bge CharLoop asl a tax jmp (JumpTable,x) FontChange moveword [TextPtr]:y,T_CurFont iny iny bra CharLoop StyleChange shortm moveword [TextPtr]:y,T_CurStyleSize longm iny bra CharLoop SizeChange shortm moveword [TextPtr]:y,T_CurStyleSize+1 longm iny bra CharLoop ColorChange shortm moveword [TextPtr]:y,T_CurColor longm iny bra CharLoop Exit RETURN JumpTable DC.W Exit DC.W FontChange DC.W StyleChange DC.W SizeChange DC.W ColorChange ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PRIM2.S b/appleworksgs/PL/Src/PRIM2.S new file mode 100755 index 0000000..dc7c4a4 --- /dev/null +++ b/appleworksgs/PL/Src/PRIM2.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_GetWdth IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_Fix2Int IMPORT P_H IMPORT P_Page IMPORT P_V IMPORT D_SelectFont IMPORT T_CaretDrawn IMPORT T_CountSpaces IMPORT T_CurFont IMPORT T_CurIndent IMPORT T_CurRulBits IMPORT T_CurSize IMPORT T_CurStyle IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_DotPixs IMPORT T_GetLinePtr IMPORT T_GetObject IMPORT T_GetParPtr IMPORT T_GetRulBits IMPORT T_GetSpacing IMPORT T_LockRuler IMPORT T_TopLine IMPORT T_TrackFont IMPORT T_UnlockRuler IMPORT T_UseTab ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_Pix2Offset ;------------------------------------------------------------------------------ ; ; T_GetStart (LineWidth:w,MaxWidth:w,NoIndent:w) : StartWidth:w ; ; Returns the starting horiz offset for a Q_Line of Q_Text, using the current ; ruler information. T_GetStart PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT LineWidth:w,MaxWidth:w,NoIndent:w OUTPUT StartWidth:w BEGIN stz StartWidth lda T_CurRulBits and #T_Center bne DoCenter lda T_CurRulBits and #T_Right beq DoIndent DoRight subword MaxWidth,LineWidth,StartWidth bra DoIndent DoCenter subword MaxWidth,LineWidth,a lsr a sta StartWidth DoIndent lda NoIndent bne Exit addword StartWidth,T_CurIndent,StartWidth Exit RETURN ENDP ;------------------------------------------------------------------------- ; ; T_Pt2Offset (ObjHdl:l,Pt:l) : ParagNo:w,Offset:w,LineNo:w,Q_Pixels:w ; T_Pt2Offset PROC EXPORT ;Using P_ObjData ;Using T_TextEqu ;Using T_Data INPUT ObjHdl:l,Pt:l OUTPUT ParagNo:w,Offset:w,LineNo:w,Q_Pixels:w LOCAL ObjPtr:l,ParagPtr:l,LinePtr:l LOCAL EndParag:w,EndLine:w,ParagCount:w,LineCount:w,Q_Rect:r LOCAL RulBits:w,TotHeight:w,Leading:w,Ascent:w,Descent:w LOCAL MaxWidth:w BEGIN movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_StartParag,ParagNo moveword [ObjPtr]:#P_StartLine,LineNo moveword [ObjPtr]:#P_EndParag,EndParag moveword [ObjPtr]:#P_EndLine,EndLine moverect [ObjPtr]:#P_TRect,Q_Rect subword Pt,Q_Rect,Pt subword Pt+2,Q_Rect+2,Pt+2 subword Q_Rect+6,Q_Rect+2,MaxWidth rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) moveword [ParagPtr],ParagCount stz TotHeight ; Find the Q_Line and the parag ParagLoop rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_LineCount,LineCount rcall T_GetRulBits,in=(ParagNo:a),out=(RulBits:a) rcall T_GetLinePtr,in=(ParagNo:a,LineNo:x),out=(LinePtr:ax) LineLoop cmpw ParagNo,EndParag blt CheckCount cmpw LineNo,EndLine blt CheckCount brl PastEnd CheckCount cmpw LineNo,LineCount bge NextParag moveword [LinePtr]:#T_Ascent,a and #$ff sta Ascent moveword [LinePtr]:#T_Descent,a and #$ff sta Descent rcall T_GetSpacing,in=(RulBits:a,Ascent:x,Descent:y),out=(a:a) addword a,Ascent,a addword a,Descent,a addword a,TotHeight,TotHeight scmpw a,Pt bge FindPixels addwl #T_LineInfoSize,LinePtr inc LineNo bra LineLoop NextParag stz LineNo inc ParagNo cmpw ParagNo,ParagCount bge PastEnd addwl #T_ParInfoSize,ParagPtr brl ParagLoop PastEnd moveword MaxWidth,Pt+2 lda LineNo bne Skip lda ParagNo beq FindPixels dec ParagNo rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_LineCount,LineNo Skip dec LineNo FindPixels in ParagNo:w,LineNo:w,Pt+2:w,MaxWidth:w out Offset:w,Q_Pixels:w xcall T_Pix2Offset RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_Pix2Offset (ParagNo:w,LineNo:w,Pix:w,MaxWidth:w) : Offset:w,Q_Pixels:w ; ; T_Pix2Offset PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,LineNo:w,Pix:w,MaxWidth:w OUTPUT Offset:w,Q_Pixels:w LOCAL ParagPtr:l,TextHdl:l,TextPtr:l,LinePtr:l LOCAL LineCount:w,MaxOffset:w,LineWidth:w LOCAL Width:l,NextWidth:l,SpaceExtra:l LOCAL FontChanged:w,Spaces:w,TabStop:w BEGIN rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) rcall T_LockRuler,in=(ax:ax) moveword [ParagPtr]:#T_LineCount,LineCount movelong [ParagPtr]:#T_TextBlock,TextHdl tool _HLock,in=(TextHdl:l) movelong [TextHdl],TextPtr moveword [ParagPtr]:#T_ParOffset,a addwl a,TextPtr rcall T_GetLinePtr,in=(ParagNo:a,LineNo:x),out=(LinePtr:ax) moveword [LinePtr]:#T_Offset,Offset addword a,[LinePtr]:#T_Length,MaxOffset moveword [LinePtr]:#T_LineWidth,LineWidth stz FontChanged stzl SpaceExtra stzl Width call T_GetStart,in=(LineWidth:w,MaxWidth:w,LineNo:w),out=(a:w) sta Width+2 lda Pix jmi SetPixs lda T_CurRulBits and #T_Full beq NotFull dec LineCount cmpw LineNo,LineCount bge NotFull in TextPtr:l,Offset:w,MaxOffset:w out TabStop:w,Spaces:w xcall T_CountSpaces lda Spaces beq NotFull spacelong subword MaxWidth,LineWidth,s pushword Spaces _FixRatio pulllong SpaceExtra NotFull call T_TrackFont,in=(TextPtr:l,Offset:w) rcall D_SelectFont,in=(T_CurFont:a,T_CurStyle:x,#0:y) CharLoop cmpw Offset,MaxOffset jge SetPixs moveword [TextPtr]:Offset,a inc Offset and #$ff cmp #T_MaxChange+1 bge NormalChar inc FontChanged asl a tax jmp (JumpTable,x) NormalChar ldx FontChanged beq NoChange pha rcall D_SelectFont,in=(T_CurFont:a,T_CurStyle:x,#0:y) pla stz FontChanged NoChange cmp #SPACE beq DoSpace cmp #TAB beq DoTab cmp #CR beq FoundIt jsl D_GetWdth sta NextWidth+2 stz NextWidth brl CheckIt DoSpace moveword SpaceExtra,NextWidth rcall D_GetWdth,in=(#SPACE:a),out=(a:a) addword a,SpaceExtra+2,NextWidth+2 brl CheckIt DoTab in TextPtr:l,Offset:w,Width+2:w,MaxWidth:w in T_CurFont:l,#0:w out a:w xcall T_UseTab bmi FoundIt subword a,Width+2,NextWidth+2 stz NextWidth bra CheckIt CheckIt rcall P_Fix2Int,in=(NextWidth:ax),out=(a:a) lsr a addword a,Width+2,a cmp Pix bge FoundIt addlong Width,NextWidth,Width brl CharLoop FoundIt dec Offset SetPixs rcall P_Fix2Int,in=(Width:ax),out=(a:a) cmp MaxWidth blt StorePixs lda MaxWidth StorePixs sta Q_Pixels call T_UnlockRuler tool _HUnlock,in=(TextHdl:l) Exit RETURN JumpTable DC.W CharLoop DC.W FontChange DC.W StyleChange DC.W SizeChange DC.W ChangeExit DC.W CharLoop DC.W CharLoop DC.W CharLoop FontChange moveword [TextPtr]:Offset,T_CurFont inc Offset bra ChangeExit StyleChange movebyte [TextPtr]:Offset,T_CurStyle bra ChangeExit SizeChange movebyte [TextPtr]:Offset,T_CurSize bra ChangeExit ChangeExit inc Offset brl CharLoop ENDP ;------------------------------------------------------------------------------; ; ; T_Offset2Pix (ObjHdl:l,ParagNo:w,StopOffset:w,LineNo:w) : Pixs:w ; T_Offset2Pix PROC EXPORT ;Using P_ObjData ;Using T_TextEqu ;Using T_Data INPUT ObjHdl:l,ParagNo:w,StopOffset:w,LineNo:w OUTPUT Pixs:w LOCAL ParagPtr:l,LinePtr:l,TextHdl:l,TextPtr:l,ObjPtr:l LOCAL LineCount:w,MaxWidth:w LOCAL CurOffset:w,MaxOffset:w,LineWidth:w LOCAL Width:l,SpaceExtra:l LOCAL Spaces:w,TabStop:w,FontChanged:w BEGIN rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) rcall T_LockRuler,in=(ax:ax) rcall T_GetLinePtr,in=(ParagNo:a,LineNo:x),out=(LinePtr:ax) movelong [ParagPtr]:#T_TextBlock,TextHdl moveword [ParagPtr]:#T_LineCount,LineCount moveword [LinePtr]:#T_Offset,CurOffset addword a,[LinePtr]:#T_Length,MaxOffset moveword [LinePtr]:#T_LineWidth,LineWidth tool _HLock,in=(TextHdl:l) movelong [TextHdl],TextPtr moveword [ParagPtr]:#T_ParOffset,a addwl a,TextPtr stzl Width stzl SpaceExtra movelong [ObjHdl],ObjPtr subword [ObjPtr]:#P_TRect+6,[ObjPtr]:#P_TRect+2,MaxWidth in LineWidth:w,MaxWidth:w,LineNo:w out Width+2:w xcall T_GetStart lda T_CurRulBits and #T_Full beq NotFull dec LineCount cmpw LineNo,LineCount bge NotFull in TextPtr:l,CurOffset:w,MaxOffset:w out TabStop:w,Spaces:w xcall T_CountSpaces lda Spaces beq NotFull spacelong subword MaxWidth,LineWidth,s pushword Spaces _FixRatio pulllong SpaceExtra NotFull call T_TrackFont,in=(TextPtr:l,CurOffset:w) rcall D_SelectFont,in=(T_CurFont:a,T_CurStyle:x,#0:y) CharLoop cmpw CurOffset,StopOffset jge Done moveword [TextPtr]:CurOffset,a inc CurOffset and #$ff cmp #T_MaxChange+1 blt SpecialCase ldx FontChanged beq NoChange pha rcall D_SelectFont,in=(T_CurFont:a,T_CurStyle:x,#0:y) pla stz FontChanged NoChange cmp #SPACE beq DoSpace cmp #TAB beq DoTab cmp #CR beq Done jsl D_GetWdth addword a,Width+2,Width+2 bra CharLoop DoSpace rcall D_GetWdth,in=(#SPACE:a),out=(a:a) addword a,Width+2,Width+2 addlong Width,SpaceExtra,Width bra CharLoop DoTab in TextPtr:l,CurOffset:w,Width+2:w,MaxWidth:w in T_CurFont:l,#0:w out a:w xcall T_UseTab bmi Done sta Width+2 brl CharLoop SpecialCase inc FontChanged asl a tax jmp (JumpTable,x) Done rcall P_Fix2Int,in=(Width:ax),out=(Width+2:a) SetPixs cmpw Width+2,MaxWidth blt StorePixs lda MaxWidth StorePixs sta Pixs call T_UnlockRuler tool _HUnlock,in=(TextHdl:l) RETURN JumpTable DC.W Done DC.W FontChange DC.W StyleChange DC.W SizeChange DC.W ChangeExit DC.W CharLoop DC.W CharLoop DC.W CharLoop FontChange moveword [TextPtr]:CurOffset,T_CurFont inc CurOffset bra ChangeExit StyleChange movebyte [TextPtr]:CurOffset,T_CurStyle bra ChangeExit SizeChange movebyte [TextPtr]:CurOffset,T_CurSize bra ChangeExit ChangeExit inc CurOffset brl CharLoop ENDP ;------------------------------------------------------------------------------ ; ; T_Offset2Line (ParagNo:w,Offset:w) : ObjHdl:l,LineNo:w ; T_Offset2Line PROC EXPORT ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,Offset:w OUTPUT ObjHdl:l,LineNo:w LOCAL LinePtr:l BEGIN rcall T_GetLinePtr,in=(ParagNo:a,#0:x),out=(LinePtr:ax) stz LineNo LineLoop addword [LinePtr],[LinePtr]:#T_Length,a cmpw a,Offset bge EndLoop addwl #T_LineInfoSize,LinePtr inc LineNo bra LineLoop EndLoop call T_GetObject,in=(ParagNo:w,LineNo:w),out=(ObjHdl:l) Exit RETURN ENDP ;------------------------------------------------------------------------------; ; ; T_BlinkCaret () ; T_BlinkCaret PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu LOCAL ParagPtr:l,LinePtr:l,ObjHdl:l,ObjPtr:l LOCAL RTop:w,RLeft:w,Top:w,Height:w,Ascent:w,Descent:w BEGIN tool _SetPort,in=(P_CurrentWin:l) movelong T_DotObj,ObjHdl movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_PageNo,P_Page jne Exit moveword [ObjPtr]:#P_TRect,RTop moveword [ObjPtr]:#P_TRect+2,RLeft call T_TopLine,in=(T_DotParag:w,T_DotLine:w),out=(a:l,Top:w) rcall T_GetLinePtr,in=(T_DotParag:a,T_DotLine:x),out=(LinePtr:ax) moveword [LinePtr]:#T_Ascent,a and #$ff sta Ascent moveword [LinePtr]:#T_Descent,a and #$ff sta Descent addword a,Ascent,Height rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) rcall T_GetRulBits,in=(T_DotParag:a),out=(a:a) rcall T_GetSpacing,in=(a:a,Ascent:x,Descent:y),out=(a:a) addword a,Top,Top in T_DotObj:l,T_DotParag:w,T_DotOffset:w,T_DotLine:w out T_DotPixs:w xcall T_Offset2Pix addword P_ContentRect+2,RLeft,a subword a,P_H,a addword a,T_DotPixs,s addword P_ContentRect,RTop,a subword a,P_V,a addword a,Top,s _MoveTo tool _SetPenMode,in=(#notXOR:w) tool _Line,in=(#0:w,Height:w) tool _SetPenMode,in=(#0:w) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_EraseCaret () ; ; Erases the caret if necessary. T_EraseCaret PROC EXPORT ;Using T_Data lda T_CaretDrawn beq Exit jsl T_BlinkCaret stz T_CaretDrawn Exit rtl ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PRULER.S b/appleworksgs/PL/Src/PRULER.S new file mode 100755 index 0000000..9f6360c --- /dev/null +++ b/appleworksgs/PL/Src/PRULER.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_Deref IMPORT DoneH IMPORT DoneV IMPORT P_ContentRect IMPORT P_Do_Ruler IMPORT P_FullPaperRect IMPORT P_H IMPORT P_HRulRect IMPORT P_PageMode IMPORT P_PaperRect IMPORT P_PortRect IMPORT P_PrintHand IMPORT P_V IMPORT P_VRulRect IMPORT D_Set4Pat IMPORT D_UnLock ;---------------------------------------------------------------------- ; ; Draw Rulers ; P_DrawRulers PROC EXPORT ;Using P_Data ;Using P_RulerData ;Using P_IconData input rgnhdl:l local tmprect:r,counter:w,offset:w,printstuff:l,vert:l local horz:l,ppp:w,startloc:w,tmp:l,ppfp:w,rgnptr:l begin +b call D_Set4Pat,in=(#LightYellow:w) moveword #P_TabWTop,tmprect moveword #P_TabWBottom,tmprect+4 moveword P_VRulRect+2,tmprect+2 moveword P_VRulRect+6,tmprect+6 tool _ClipRect,in=(!tmprect:l) tool _PaintRect,in=(!tmprect:l) _PenNormal rcall D_Deref,in=(P_PrintHand:ax),out=(printstuff:ax) moveword [printstuff]:#4,vert moveword [printstuff]:#6,horz stz vert+2 stz horz+2 rcall D_UnLock,in=(P_PrintHand:ax) rcall D_Deref,in=(rgnhdl:ax),out=(rgnptr:ax) ; ; Horizontal ruler moverect P_HRulRect,tmprect moveword P_VRulRect+2,tmprect+2 tool _RectInRgn,in=(!tmprect:l,rgnhdl:l),out=(a:w) jeq CkVert subword P_PaperRect+6,P_PaperRect+2,ppp ; do D_Update Q_Rect!?!?! subword P_ContentRect+2,P_H,startloc lda P_PageMode bne DoHPage tool _Long2Fix,in=(horz:l),out=(horz:l) bra DoHoriz DoHPage moveword P_FullPaperRect+2,startloc subword P_FullPaperRect+6,P_FullPaperRect+2,ppfp tool _Multiply,in=(horz:w,ppfp:w),out=(tmp:l) tool _FixDiv,in=(tmp:l,#0:w,ppp:w),out=(horz:l) DoHoriz pushlong horz pushword startloc cmpw [rgnptr]:#4,P_ContentRect+2 blt HContent1 and #$FFFE pushword a bra HCk HContent1 pushword P_ContentRect+2 HCk cmpw [rgnptr]:#8,P_ContentRect+6 blt HContent2 pushword P_ContentRect+6 bra DoneH HContent2 pushword a DoneH ; in :l,:w,:w,:w in #0:w,#P_HRulRect:l,#P_VRulRect:l,#P_PortRect:l in #P_ContentRect:l,P_Pagemode:w xcall P_Do_Ruler ; ; Vertical ruler CkVert tool _RectInRgn,in=(#P_VRulRect:l,rgnhdl:l),out=(a:w) jeq exit subword P_PaperRect+4,P_PaperRect,ppp subword P_ContentRect,P_V,startloc lda P_PageMode bne DoVPage tool _Long2Fix,in=(vert:l),out=(vert:l) bra DoVert DoVPage moveword P_FullPaperRect,startloc subword P_FullPaperRect+4,P_FullPaperRect,ppfp tool _Multiply,in=(vert:w,ppfp:w),out=(tmp:l) tool _FixDiv,in=(tmp:l,#0:w,ppp:w),out=(vert:l) DoVert pushlong vert pushword startloc cmpw [rgnptr]:#2,P_ContentRect blt VContent1 pushword a bra VCk VContent1 pushword P_ContentRect VCk cmpw [rgnptr]:#6,P_ContentRect+4 blt VContent2 pushword P_ContentRect+4 bra DoneV VContent2 pushword a DoneV ; in :l,:w,:w,:w in #1:w,#P_HRulRect:l,#P_VRulRect:l,#P_PortRect:l in #P_ContentRect:l,P_Pagemode:w xcall P_Do_Ruler Exit rcall D_UnLock,in=(rgnhdl:ax) _PenNormal return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PRULER2.S b/appleworksgs/PL/Src/PRULER2.S new file mode 100755 index 0000000..d72a631 --- /dev/null +++ b/appleworksgs/PL/Src/PRULER2.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_FastMult IMPORT P_DrawTabs IMPORT P_Fix2Int IMPORT P_LShift IMPORT D_SelectFont IMPORT D_Set4Pat ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY ruler_marks ;------------------------------------------------------------------------------ ; ; P_Do_Ruler () ; P_Do_Ruler PROC EXPORT ;Using P_RulerData input ppi:l,start:w,vis_start:w,vis_end:w,vert:w ; pass in necess. globals input hrulrect:l,vrulrect:l,portrect:l,contentrect:l,pagemode:w output mindist:w local max:w,min:w,gran:w,i:w,length:w,space:w local tmp:w,j:w,k:w,v_line:l,h_line:l,start_offset:w local dist:l,tmp_dist:l,min_pix:l,h_pos:l,v_pos:l,pos:l local v_end:l,ruleraddr:l,Q_Line:w,inch_min:w local tmprect:r,foorect:r BEGIN _PenNormal cmpw vis_start,vis_end jeq EXIT stz Q_Line stz length stzl dist movelong #ruler_marks,ruleraddr call D_Set4Pat,in=(#LightYellow:w) ; ; if (vert) lda vert jeq ELSE1 ; ; { moverect [vrulrect],tmprect moveword vis_start,tmprect moveword vis_end,tmprect+4 tool _ClipRect,in=(!tmprect:l) tool _PaintRect,in=(!tmprect:l) tool _SetPenSize,in=(#2:w,#1:w) call D_Set4Pat,in=(#Black:w) moverect [portrect],foorect moveword [contentrect]:#4,foorect+4 tool _ClipRect,in=(!foorect:l) subword [vrulrect]:#6,#2,s pushword #0 _MoveTo tool _Line,in=(#0:w,#P_VRulLength:w) tool _ClipRect,in=(!tmprect:l) movelong !tmp_dist,v_pos movelong !pos,h_pos movelong !Q_Line,v_line movelong !length,h_line moveword #4,start_offset subword [vrulrect]:#6,#2,a movefixword a,pos movefixword #P_MIN_VPIX,min_pix brl ENDIF1 ; ; } else { ELSE1 moverect [hrulrect],tmprect moveword vis_start,tmprect+2 moveword vis_end,tmprect+6 tool _ClipRect,in=(!tmprect:l) tool _PaintRect,in=(!tmprect:l) call D_Set4Pat,in=(#Black:w) moverect [portrect],foorect moveword [contentrect]:#6,foorect+6 tool _ClipRect,in=(!foorect:l) tool _MoveTo,in=(tmprect+2:w,#P_HRulTop+P_HRulWdth-7:w) tool _Line,in=(#640:w,#0:w) tool _MoveTo,in=([vrulrect]:#2:w,#P_HRulTop+P_HRulWdth-1:w) tool _Line,in=(#640:w,#0:w) tool _ClipRect,in=(!tmprect:l) movelong !pos,v_pos movelong !tmp_dist,h_pos movelong !length,v_line movelong !Q_Line,h_line moveword #2,start_offset subword [hrulrect]:#4,#7,a movefixword a,pos movefixword #P_MIN_HPIX,min_pix ; ; } ENDIF1 _PenNormal ; More inits. ; ; max = (short) Fix2Long(FixDiv(Int2Fix(vis_end-start),ppi))+1; spacelong subword vis_end,start,a pushfixword a pushlong ppi _FixDiv pulllong ax rcall P_Fix2Int,in=(ax:ax) inc a sta max ; ; min = (short) Fix2Long(FixDiv(Int2Fix(vis_start-start),ppi))-1; spacelong subword vis_start,start,a pushfixword a pushlong ppi _FixDiv pulllong ax rcall P_Fix2Int,in=(ax:ax) dec a sta min ; ; ---- movefixword vis_end,v_end ; ; for (gran=7;(dist=0);gran--) moveword #7,gran brl FOR1 ; ; { LOOP1 ; dist = ppi / (1<=min;i-=space) lda #0 sta i bra FOR6 LOOP6 subword i,space,i FOR6 scmpw a,min bge LOOP6 ; ; tmp_dist = FixMul(ppi,Int2Fix(i)) + Int2Fix(start+start_offset); addword start,start_offset,s pushword #0 tool _FixMul,in=(ppi:l,i:w,#0:w),out=(:l) addlong 1:s,5:s,tmp_dist ply ply ply ply lda pagemode bne ENDIF7 addword space,space,a addword a,i,i addlong tmp_dist,dist,tmp_dist addlong tmp_dist,dist,tmp_dist ENDIF7 ; ; for (;i<=max;i+=space,tmp_dist+=dist) brl FOR8 LOOP8 rcall P_Fix2Int,in=([h_pos]:ax),out=(a:a) pha rcall P_Fix2Int,in=([v_pos]:ax),out=(a:a) pha _MoveTo subword #0,i,a bpl GOTJ lda i GOTJ tool _UDivide,in=(a:w,#10:w),out=(j:w,k:w) lda k beq NO_K addword a,#'0',a pha _DrawChar bra DRAW_J NO_K lda vert beq DRAW_J tool _DrawChar,in=(#' ':w) tool _DrawChar,in=(#' ':w) DRAW_J addword j,#'0',a pha _DrawChar lda vert beq HorizScritch pushword #3 pushword #0 pushword #62 rcall P_Fix2Int,in=([v_pos]:ax) subword a,#4,a pha bra CONT8 HorizScritch pushword #0 pushword #1 rcall P_Fix2Int,in=([h_pos]:ax) dec a dec a pha pushword #3 CONT8 _MoveTo _Line addword i,space,i addlong tmp_dist,dist,tmp_dist FOR8 scmpw max,i jge LOOP8 ENDFOR8 EXIT lda vert bne gone call P_DrawTabs gone return ENDP ;---------------------------------------------------------- P_RulerData PROC EXPORT EXPORT ruler_marks ; 2 8 32 128 th of an inch ; 1 ; 4 ; 16 ; 64 ; ruler_marks DC.W -5,-4,-3,-2,-1,-1,-1,-1 DC.W -11,-8,-6,-4,-2,-2,-2,-2 ;P_VisLMarg ds 2 ; what are these? ;P_VisIndent ds 2 ;P_VisRMarg ds 2 ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PSCRAP.S b/appleworksgs/PL/Src/PSCRAP.S new file mode 100755 index 0000000..c629b64 --- /dev/null +++ b/appleworksgs/PL/Src/PSCRAP.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT X_CopyOneHandle IMPORT X_DisposeThread IMPORT P_CopyObjList IMPORT P_MakePict IMPORT T_CpyOrClrObj IMPORT T_ReThread ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_CopyPLScrap ENTRY P_DelObjList ENTRY P_DelPLScrap ENTRY P_PL2Pict ENTRY T_Dispose P_ScrapJumps PROC EXPORT DC.L P_CopyPLScrap DC.L P_DelPLScrap DC.L P_PL2Pict ENDP P_ScrapData PROC EXPORT EXPORT P_QDPict EXPORT P_ConvErr P_QDPict DS.B 4 P_ConvErr DS.B 2 ENDP ;------------------------------------------------------------------------------ ; ; P_CopyPLScrap (ScrapHdl:l) : CopyHdl:l ; P_CopyPLScrap PROC EXPORT input ScrapHdl:l output CopyHdl:l error Err begin call P_CopyObjList,in=(ScrapHdl:l,#1:w),out=(CopyHdl:l),err=(Err) return ENDP ;----------------------------------------------------------------------------- ; ; P_DelPLScrap (ObjHdl:l,KillData:w) ; P_DelPLScrap PROC EXPORT ;Using P_ObjData ;Using P_ScrapData input ObjHdl:l,KillData:w local ObjPtr:l,NextObj:l begin +b cpzl P_QDPict beq DoIt tool _KillPicture,in=(P_QDPict:l) stzl P_QDPict DoIt call P_DelObjList,in=(ObjHdl:l,KillData:w,#1:w) return ENDP ;----------------------------------------------------------------------------- ; ; P_PL2Pict (ObjHdl:l) : PictHdl:l ; P_PL2Pict PROC EXPORT ;Using P_ScrapData input ObjHdl:l output PictHdl:l error Err begin +b cpzl P_QDPict beq DoIt moveword P_ConvErr,Err bne Exit call X_CopyOneHandle,in=(P_QDPict:l),out=(PictHdl:l),err=(Err) bra Exit DoIt call P_MakePict,in=(ObjHdl:l),out=(PictHdl:l),err=(Err) Exit return ENDP ;----------------------------------------------------------------------------- ; ; P_DelObjList (ObjHdl:l,KillData:w,All:w) ; P_DelObjList PROC EXPORT ;Using P_ObjData ;Using P_ScrapData input ObjHdl:l,KillData:w,All:w local ObjPtr:l,NextObj:l begin WhileLoop cpzl ObjHdl jeq Exit movelong [ObjHdl],ObjPtr movelong [ObjPtr],NextObj lda KillData beq TrashIt moveword [ObjPtr]:#P_Type,a cmp #P_ALPHA bne TryPict call T_Dispose,in=(ObjHdl:l,All:w) bra TrashIt TryPict cmp #P_PICTURE bne TrashIt tool _KillPicture,in=([ObjPtr]:#P_PictHandle:l) TrashIt tool _DisposeHandle,in=(ObjHdl:l) movelong NextObj,ObjHdl brl WhileLoop Exit return ENDP ;---------------------------------------------------------------------------- ; ; T_Dispose (ObjHdl:l,All:w) ; ; Can call X_DisposeThread if there are no objects attached to this one. T_Dispose PROC EXPORT ;Using P_ObjData input ObjHdl:l,All:w local ObjPtr:l,NThread:l,PThread:l,Ptr:l begin +b movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_NThread,NThread movelong [ObjPtr]:#P_PThread,PThread lda All beq NotAll cpzl PThread beq KillThread lda PThread and PThread+2 cmp #$FFFF beq Killthread brl Exit NotAll lda NThread ora NThread+2 ora PThread ora PThread+2 bne Linked KillThread call X_DisposeThread,in=([ObjPtr]:#P_ParagHdl:l,#1:w) brl Exit Linked call T_CpyOrClrObj,in=(ObjPtr:l,#0:w),out=(a:l) cpzl PThread beq NoPrev movelong [PThread],Ptr movelong NThread,[Ptr]:#P_NThread NoPrev cpzl NThread beq NoNext movelong [NThread],Ptr movelong PThread,[Ptr]:#P_PThread NoNext cpzl PThread beq AtStart pushlong PThread bra Cont AtStart pushlong NThread Cont jsl T_ReThread Exit return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PSCROLL.S b/appleworksgs/PL/Src/PSCROLL.S new file mode 100755 index 0000000..023ec2b --- /dev/null +++ b/appleworksgs/PL/Src/PSCROLL.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_DrawIcon IMPORT D_FastMult IMPORT P_ChangePage IMPORT P_ContentRect IMPORT P_DblPage IMPORT P_Do_Ruler IMPORT P_DrawAPage IMPORT P_DrawContent IMPORT P_FirstPOff IMPORT P_H IMPORT P_HRulRect IMPORT P_L_ArrFilledIcon IMPORT P_L_ArrHollowIcon IMPORT P_Page IMPORT P_PageCount IMPORT P_PageStart IMPORT P_Pagemode IMPORT P_PortRect IMPORT P_PrintHand IMPORT P_R_ArrFilledIcon IMPORT P_R_ArrHollowIcon IMPORT P_TrackCursor IMPORT P_V IMPORT P_VRulRect IMPORT P_VScroll IMPORT P_VisPalette IMPORT P_VisRuler IMPORT T_ClipThread IMPORT T_DotObj ;--------------------------------------------------------------------------- ; ; P_ActionProc (PartCode:w,CtlHdl:l) : Result:w ; P_ActionProc PROC EXPORT ;Using P_Data ;Using P_RulerData ;Using T_Data input PartCode:w,CtlHdl:l output Result:w local UpdateRgn:l,UpdateRect:r,SRect:r,CtlMax:w local Amount:w,NewValue:w,Width:w,Height:w local PHdl:l,PPtr:l,TempPtr:l begin +b ; Get rid of any possible scritch marks before possible scrolling moveword #-10,PPtr moveword #-10,PPtr+2 call P_TrackCursor,in=(!PPtr:l) tool _ClipRect,in=(#P_PortRect:l) moverect P_ContentRect,SRect tool _NewRgn,out=(UpdateRgn:l) movelong P_PrintHand,PHdl movelong [PHdl],PPtr spacelong pushlong CtlHdl _GetCtlParams subword s,s,CtlMax cmpl CtlHdl,P_VScroll jeq Vertical subword P_ContentRect+6,P_ContentRect+2,Width lda PartCode cmp #Thumb beq HThumb cmp #5 ;UpArrow beq HUpArrow cmp #6 ;DownArrow beq HDownArrow cmp #PageUp beq HPageUp cmp #PageDown beq HPageDown brl Exit HThumb tool _GetCtlValue,in=(CtlHdl:l),out=(a:w) and #$fffe sta NewValue tool _SetCtlValue,in=(a:w,CtlHdl:l) subword NewValue,P_H,Amount moveword NewValue,P_H lda Amount abs a cmp Width blt HSmall lda Width ldy Amount bpl HStore neg a HStore sta Amount HSmall brl HDoScroll HUpArrow moveword #-32,Amount bra HCheckValue HDownArrow moveword #32,Amount bra HCheckValue HPageUp lda Width lsr a neg a sta Amount bra HCheckValue HPageDown lda Width lsr a sta Amount HCheckValue lda Amount and #$fffe sta Amount addword a,P_H,NewValue bpl HCheckMax stz NewValue bra HSet HCheckMax cmp CtlMax bmi HSet moveword CtlMax,NewValue HSet subword NewValue,P_H,Amount moveword NewValue,P_H pushword NewValue pushlong CtlHdl _SetCtlValue HDoScroll stz SRect pushlong !SRect subword #0,Amount,s pushword #0 pushlong UpdateRgn _ScrollRect movelong [UpdateRgn],TempPtr moverect [TempPtr]:#2,UpdateRect moveword P_ContentRect,UpdateRect lda P_VisRuler beq ToUpdate pushword [PPtr]:#6 pushword #0 subword P_ContentRect+2,P_H,s in UpdateRect+2:w,UpdateRect+6:w,#0:w in #P_HRulRect:l,#P_VRulRect:l,#P_PortRect:l in #P_ContentRect:l,P_Pagemode:w xcall P_Do_Ruler ToUpdate brl DoUpdate Vertical subword P_ContentRect+4,P_ContentRect,Height lda PartCode cmp #Thumb beq VThumb cmp #5 ;UpArrow beq VUpArrow cmp #6 ;DownArrow beq VDownArrow cmp #PageUp beq VPageUp cmp #PageDown beq VPageDown brl Exit VThumb tool _GetCtlValue,in=(CtlHdl:l),out=(a:w) and #$fffe sta NewValue tool _SetCtlValue,in=(a:w,CtlHdl:l) subword NewValue,P_V,Amount moveword NewValue,P_V lda Amount abs a cmp Height blt VSmall lda Height ldy Amount bpl VStore neg a VStore sta Amount VSmall brl VDoScroll VUpArrow moveword #-16,Amount bra VCheckValue VDownArrow moveword #16,Amount bra VCheckValue VPageUp lda Height lsr a neg a sta Amount bra VCheckValue VPageDown lda Height lsr a sta Amount VCheckValue lda Amount and #$fffe sta Amount addword a,P_V,NewValue bpl VCheckMax stz NewValue bra VSet VCheckMax cmp CtlMax bmi VSet moveword CtlMax,NewValue VSet subword NewValue,P_V,Amount moveword NewValue,P_V tool _SetCtlValue,in=(a:w,CtlHdl:l) VDoScroll stz SRect+2 lda P_VisPalette beq DidPal moveword #P_VRulLeft,SRect+2 DidPal pushlong !SRect pushword #0 subword #0,Amount,s pushlong UpdateRgn _ScrollRect movelong [UpdateRgn],TempPtr moverect [TempPtr]:#2,UpdateRect moveword P_ContentRect+2,UpdateRect+2 lda P_VisRuler beq DoUpdate pushword [PPtr]:#4 pushword #0 subword P_ContentRect,P_V,s in UpdateRect:w,UpdateRect+4:w,#1:w in #P_HRulRect:l,#P_VRulRect:l,#P_PortRect:l in #P_ContentRect:l,P_Pagemode:w xcall P_Do_Ruler DoUpdate tool _DisposeRgn,in=(UpdateRgn:l) tool _ClipRect,in=(!UpdateRect:l) call T_ClipThread,in=(T_DotObj:l) call P_DrawContent,in=(!UpdateRect:l,#0:w) tool _ClipRect,in=(#P_PortRect:l) Exit return ENDP ;--------------------------------------------------------------------------- ; ; P_ScrollPages (xpos:w) ; P_ScrollPages PROC EXPORT ;Using P_Data ;Using P_IconDATA input xpos:w local pagenum:w,xloc:w,yloc:w,count:w,xcheck:w local pt:l,tmprect:r,CRect:r,off:w,curpage:w begin addword P_Page,P_FirstPOff,curpage moveword #-1,xloc moveword P_ContentRect+4,yloc sta tmprect sta CRect addword a,#12,tmprect+4 sta CRect+4 moveword #P_PageWidth-1,xcheck ; Check the template page cmpw xpos,xcheck bge Ck2nd lda P_DblPage beq DoRight moveword P_FirstPOff,pagenum ; pagenum=#0+P_FirstPOff; brl ShowPage ; Check the second template page Ck2nd lda P_DblPage beq CheckLeft addword #P_PageWidth-2,xloc,xloc addword #P_PageWidth-2,xcheck,xcheck cmpw xpos,xcheck bge CheckLeft DoRight addword #1,P_FirstPOff,pagenum brl ShowPage ; Check the leftarrow CheckLeft ; first add in the space. addword #P_SpaceWidth,xcheck,xcheck cmp xpos jge exit ; dead space addword #P_SpaceWidth+P_PageWidth,xloc,xloc cmpw P_PageCount,#P_MaxVisPages+1 jlt CheckVis addword #P_ControlWidth-2,xloc,xloc addword #P_ControlWidth-1,xcheck,xcheck cmp xpos jlt CheckVis moveword #1,off moveword xloc,tmprect+2 inc a inc a sta CRect+6 addword a,#5*(P_PageWidth-2)-2,tmprect+6 subword xloc,#P_ControlWidth-2,CRect+2 lda P_DblPage beq LeftLoop inc tmprect+2 inc tmprect+2 LeftLoop tool _GetMouse,in=(!pt:l) tool _PtInRect,in=(!pt:l,!CRect:l),out=(a:w) bne LeftIn ; Outside the box lda off jne LeftDown ; already off ; turn it off moveword #1,off pushlong #P_L_ArrHollowIcon subword xloc,#P_ControlWidth-6,s lda yloc inc a pha pushword #modeCOPY jsl D_DrawIcon brl LeftDown LeftIn lda off beq LeftHere ; already on ; turn it on stz off pushlong #P_L_ArrFilledIcon subword xloc,#P_ControlWidth-6,s lda yloc inc a pha pushword #modeCOPY jsl D_DrawIcon LeftHere addword #2,P_FirstPOff,a cmp P_PageStart beq LeftDown tool _ScrollRect,in=(!tmprect:l,#P_PageWidth-2:w,#0:w,#0:l) NoExtra dec P_PageStart call P_DrawAPage,in=(xloc:w,yloc:w,P_PageStart:w,#1:w) LeftDown tool _StillDown,in=(#0:w),out=(a:w) jne LeftLoop pushlong #P_L_ArrHollowIcon subword xloc,#P_ControlWidth-6,s lda yloc inc a pha pushword #modeCOPY jsl D_DrawIcon brl Exit ; Check pages 1-5 CheckVis cmpw P_PageCount,#P_MaxVisPages blt GotCount lda #P_MaxVisPages GotCount sta count moveword P_PageStart,pagenum loop addword #P_PageWidth-2,xcheck,xcheck cmp xpos jge ShowPage addword #P_PageWidth-2,xloc,xloc inc pagenum dec count bne loop ; Check the rightarrow CheckRight cmpw P_PageCount,#P_MaxVisPages+1 jlt exit ; Not really here, I guess addword #4,xloc,xloc addword #P_ControlWidth+1,xcheck,xcheck cmp xpos jlt exit moveword #1,off subword xloc,#4,tmprect+6 sta CRect+2 subword a,#5*(P_PageWidth-2)-2,tmprect+2 moveword xcheck,CRect+6 RightLoop tool _GetMouse,in=(!pt:l) tool _PtInRect,in=(!pt:l,!CRect:l),out=(a:w) bne RightIn lda off bne RightDown moveword #1,off pushlong #P_R_ArrHollowIcon pushword xloc lda yloc inc a pha pushword #modeCOPY jsl D_DrawIcon bra RightDown RightIn lda off beq RightHere stz off pushlong #P_R_ArrFilledIcon pushword xloc lda yloc inc a pha pushword #modeCOPY jsl D_DrawIcon RightHere addword P_PageCount,P_FirstPOff,a subword a,#4,a cmp P_PageStart blt RightDown tool _ScrollRect,in=(!tmprect:l,#-P_PageWidth+2:w,#0:w,#0:l) inc P_PageStart subword xloc,#2+P_PageWidth,s pushword yloc addword P_PageStart,#P_MaxVisPages-1,s pushword #1 jsl P_DrawAPage RightDown tool _StillDown,in=(#0:w),out=(a:w) jne RightLoop pushlong #P_R_ArrHollowIcon pushword xloc lda yloc inc a pha pushword #modeCOPY jsl D_DrawIcon brl Exit ShowPage ; don't do anything if the page is current. cmpw curpage,pagenum cmp pagenum jeq exit stz count ; redraw the old page, if visible. cmpw P_Page,#2 bge NotTemplate ; curpage is a template moveword #-1,count lda P_DblPage beq HideOldPage lda P_Page beq HideOldPage addword #P_PageWidth-2,count,count bra HideOldPage NotTemplate cmpw curpage,P_PageStart jlt DoNewPage ; curpage is scrolled off left cmpw P_PageCount,#P_MaxVisPages+1 blt DoOldPage ; all pages are visible. addword #P_ControlWidth-2,count,count addword #P_MaxVisPages-1,P_PageStart,a cmp curpage blt DoNewPage ; curpage is scrolled off right DoOldPage subword curpage,P_PageStart,a ; x now has 0-4 rcall D_FastMult,in=(a:x,#P_PageWidth-2:y) addword a,#P_PageWidth-1+P_SpaceWidth,a addword a,count,count lda P_DblPage beq HideOldPage addword #P_PageWidth-2,count,count HideOldPage addword #2,count,tmprect+2 addword a,#P_PageWidth-4,tmprect+6 tool _ClipRect,in=(!tmprect:l) dec P_Page call P_DrawAPage,in=(count:w,yloc:w,curpage:w,#0:w) inc P_Page DoNewPage addword #2,xloc,tmprect+2 addword a,#P_PageWidth-4,tmprect+6 tool _ClipRect,in=(!tmprect:l) ; do all this stack monkeying w/ P_Page so the page ; icon changes, then the screen gets refreshed -- it ; 'looks & feels' better. pushword P_Page ; ...on the stack subword pagenum,P_FirstPOff,off ; squirrel away the D_New sta P_Page ; page # for later... call P_DrawAPage,in=(xloc:w,yloc:w,pagenum:w,#0:w) pullword P_Page ; off the stack. tool _ClipRect,in=(#P_ContentRect:l) ; so that P_ChangePage call P_ChangePage,in=(off:w,#0:w) ; will be happy Exit return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PTAB.S b/appleworksgs/PL/Src/PTAB.S new file mode 100755 index 0000000..eb12f53 --- /dev/null +++ b/appleworksgs/PL/Src/PTAB.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT X_CopyOneHandle IMPORT D_Deref IMPORT Local2TextObj IMPORT P_ContentRect IMPORT P_DrawATab IMPORT P_HRulRect IMPORT P_PL2Local IMPORT P_PortRect IMPORT P_Traverse IMPORT P_VRulRect IMPORT P_VisRuler IMPORT D_Set4Pat IMPORT T_ChangeRuls IMPORT T_DotObj IMPORT T_DotParag IMPORT T_Editing IMPORT T_GetParPtr IMPORT TextObj2Local IMPORT D_UnLock ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_DragTab ENTRY P_DrawTabwell ;--------------------------------------------------------------------------- ; ; P_EraseTabs ; ; erase all of the tabs P_EraseTabs PROC EXPORT ;Using P_Data ;Using P_RulerData local tmprect:r begin lda P_VisRuler beq Exit call D_Set4Pat,in=(#LightYellow:w) moveword #P_TabWBottom-6,tmprect moveword #P_TabWBottom-1,tmprect+4 moveword P_ContentRect+2,tmprect+2 moveword P_ContentRect+6,tmprect+6 tool _ClipRect,in=(!tmprect:l) tool _PaintRect,in=(!tmprect:l) _PenNormal tool _ClipRect,in=(#P_ContentRect:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_EraseTabwell ; P_EraseTabwell PROC EXPORT ;Using P_Data ;Using P_RulerData local tmprect:r begin lda P_VisRuler beq Exit call D_Set4Pat,in=(#LightYellow:w) moveword #P_TabWTop,tmprect moveword P_VRulRect+2,tmprect+2 moveword #P_TabWBottom-1,tmprect+4 subword P_VRulRect+6,#2,tmprect+6 tool _ClipRect,in=(!tmprect:l) tool _PaintRect,in=(!tmprect:l) _PenNormal tool _ClipRect,in=(#P_ContentRect:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_HideTabs (erase the Tabwell and any active tabs) ; P_HideTabs PROC EXPORT call P_EraseTabwell call P_EraseTabs rtl ENDP ;--------------------------------------------------------------------------- ; ; P_DrawTabs ; P_DrawTabs PROC EXPORT ;Using P_RulerData ;Using P_Data ;Using T_Data ;Using T_TextEqu local count:w,ptr:l,offset:w,tmp:l,objhdl:l,hoffset:w local rulerhdl:l begin lda P_VisRuler jeq exit lda T_Editing jeq exit rcall T_GetParPtr,in=(T_DotParag:a),out=(ptr:ax) movelong [ptr]:#T_RulerHdl,RulerHdl rcall D_Deref,in=(RulerHdl:ax),out=(ptr:ax) cmpw [ptr]:#T_TabCount,#P_MaxTabcount bge DidTabwell call P_DrawTabwell DidTabwell tool _ClipRect,in=(#P_HRulRect:l) moveword [ptr]:#T_TabCount,count addwl #T_Indent,ptr stz offset tabloop pushlong #-1 call TextObj2Local,in=([ptr]:offset:w,#0:w),out=(:w,y:w) pushword #P_HRulTop+P_HRulWdth-6 inc offset inc offset pushword [ptr]:offset call P_DrawATab,in=(:l,:l,:w) addword offset,#2,offset dec count bpl tabloop tool _ClipRect,in=(#P_ContentRect:l) rcall D_UnLock,in=(RulerHdl:ax) exit return ENDP ;--------------------------------------------------------------------------- ; ; P_DrawTabwell () ; P_DrawTabwell PROC EXPORT ;Using P_RulerData ;Using P_Data ;Using T_Data ;Using T_TextEqu begin tool _ClipRect,in=(#P_PortRect:l) ; Draw the 3 in the Tabwell. addword P_VRulRect+2,#8,a and #$FFFE call P_DrawATab,in=(#-1:l,a:w,#P_TabWTop+5:w,#P_LeftTab:w) addword P_VRulRect+2,#18,a and #$FFFE call P_DrawATab,in=(#-1:l,a:w,#P_TabWTop+5:w,#P_DecimalTab:w) addword P_VRulRect+2,#28,a and #$FFFE call P_DrawATab,in=(#-1:l,a:w,#P_TabWTop+5:w,#P_RightTab:w) tool _ClipRect,in=(#P_ContentRect:l) RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_MoveTabs (Pt:l) : Moved:w ; ; pt is local P_MoveTabs PROC EXPORT ;Using T_Data ;Using P_Data ;Using T_TextEqu ;Using P_ObjData ;Using P_RulerData input ThePt:l output moved:w local ParagPtr:l,RulerHdl:l,RulerPtr:l local TabsHdl:l,TabsPtr:l,TabArray:l,TabType:w local tmprect:r,tabcount:w,tmp:l,ptr:l local tmptab:l,tmpptr:l,arrayhdl:l,hoffset:w local leftside:w,rightside:w,offset:w error err begin moverect P_ContentRect,tmprect moveword P_PortRect,tmprect moveword P_VRulRect+2,tmprect+2 tool _ClipRect,in=(!tmprect:l) stz moved rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_RulerHdl,RulerHdl call X_CopyOneHandle,in=(RulerHdl:l),out=(TabsHdl:l) rcall D_Deref,in=(TabsHdl:ax),out=(TabsPtr:ax) moveword [TabsPtr]:#T_TabCount,tabcount addlong #T_Indent,TabsPtr,TabArray call TextObj2Local,in=(#0:w,#0:w),out=(leftside:w,y:w) bpl DoRightSide moveword #0,leftside DoRightSide movelong T_DotObj,tmp movelong [tmp],ptr rcall P_PL2Local,in=([ptr]:#P_RLeft:x) call Local2TextObj,in=(x:w,#0:w),out=(hoffset:w,a:w) rcall P_PL2Local,in=([ptr]:#P_RRight:x),out=(a:x) and #$FFFE sta rightside movelong !tabarray,arrayhdl ; Check for D_MouseDown in tab-Q_Rect moverect P_HRulRect,tmprect moveword #10,tmprect tool _PtInRect,in=(!ThePt:l,!tmprect:l),out=(a:w) jeq CkTabwell ; See if mouse was down on a tab call Local2TextObj,in=(ThePt:l),out=(ThePt:l) subword ThePt+2,#4,tmp lda tabcount ina sta tmp+2 in arrayhdl:l,tmp:w,#4:w,tmp+2:w out offset:w xcall P_Traverse lsr a lsr a cmp tmp+2 jge Exit movelong [tabarray]:offset,tmptab addword #5,ThePt+2,a and #$FFFE cmp tmptab jlt Exit ; Foundit!! lda offset bne DoNormTab lda tabcount beq CheckMax ; use the first tab as the rightmost bounds. call TextObj2Local,in=([tabarray]:#4:w,#0:w),out=(a:w,y:w) subword a,#P_MinTabDist,rightside CheckMax cmpw P_ContentRect+6,rightside bge CheckMin sta rightside CheckMin cmpw P_ContentRect+2,leftside blt DoOldDrag sta leftside bra DoOldDrag DoNormTab addlong a,tabarray,ptr addlong ptr,#4,s pushlong ptr lda Tabcount asl a asl a pushword #0 subword a,offset,s _BlockMove dec TabCount addword P_VRulRect+2,#2,leftside subword P_ContentRect+6,#2,rightside DoOldDrag call TextObj2Local,in=(tmptab:w,#0:w),out=(ThePt:l) moveword #P_TabWBottom-6,ThePt ; Erase the old one... call P_DrawATab,in=(ThePt:l,#-1:l,#0:w) moveword tabcount,tmp lda offset not a in a:w,leftside:w,rightside:w,ThePt:l in tabarray:l,tabcount:w,tmptab+2:w out tabcount:w xcall P_DragTab lda tabcount cmp #P_MaxTabCount-1 bne NoDraw cmp tmp bne NoDraw call P_DrawTabwell ; We've removed the 10th tab NoDraw brl DoStore CkTabwell cmpw tabcount,#P_MaxTabCount jge Exit addword P_VRulRect+2,#2,leftside subword P_ContentRect+6,#2,rightside moveword P_HRulRect,tmprect moveword P_VRulRect+2,tmprect+2 movelong P_ContentRect,tmprect+4 tool _PtInRect,in=(!ThePt:l,!tmprect:l),out=(a:w) jeq Exit moveword #2,tmprect moveword #11,tmprect+4 addword P_VRulRect+2,#3,tmprect+2 addword P_VRulRect+2,#13,tmprect+6 tool _PtInRect,in=(!ThePt:l,!tmprect:l),out=(a:w) beq CkDec moveword #P_LeftTab,TabType bra DoDrag CkDec moveword tmprect+6,tmprect+2 addword P_VRulRect+2,#23,tmprect+6 tool _PtInRect,in=(!ThePt:l,!tmprect:l),out=(a:w) beq CkRight moveword #P_DecimalTab,TabType bra DoDrag CkRight moveword tmprect+6,tmprect+2 addword P_VRulRect+2,#33,tmprect+6 tool _PtInRect,in=(!ThePt:l,!tmprect:l),out=(a:w) beq Exit moveword #P_RightTab,TabType DoDrag in #0:w,leftside:w,rightside:w,ThePt:l in tabarray:l,tabcount:w,TabType:w out a:w xcall P_DragTab cmp tabcount beq Exit sta tabcount DoStore moveword tabcount,[TabsPtr]:#T_Tabcount inc moved cmpw tabcount,#P_MaxTabcount blt StillThere call P_EraseTabwell StillThere tool _ClipRect,in=(#P_ContentRect:l) movelong [RulerHdl],RulerPtr ldy #T_Indent cmpw [RulerPtr]:y,[TabsPtr]:y beq ChTabs call T_ChangeRuls,in=(#T_ChangeIndent:w,[TabsPtr]:#T_Indent:w,#0:l) bra Exit ChTabs call T_ChangeRuls,in=(#T_ChangeTabs:w,#0:w,TabsHdl:l) Exit tool _DisposeHandle,in=(TabsHdl:l) tool _ClipRect,in=(#P_ContentRect:l) return ENDP ;--------------------------------------------------------------------------- ; ; P_DragTab ; P_DragTab PROC EXPORT ;Using P_RulerData ;Using P_Data ;Using T_Data ;Using T_TextEqu input izitindent:w,minhorz:w,maxhorz:w,oldpt:l input array:l,count:w,type:w output newcount:w local ThePt:l,TabPt:l,arrayhdl:l,tmprect:r local offset:w,ptr:l,tmp:l begin moveword count,newcount movelong !array,arrayhdl _HideCursor moveword #-50,oldpt dragloop tool _GetMouse,in=(!ThePt:l) lda ThePt+2 bpl CheckMax lda #0 CheckMax cmp maxhorz blt CheckMin moveword maxhorz,ThePt+2 CheckMin cmp minhorz bge DoConvert moveword minhorz,ThePt+2 DoConvert jsr FixPt call Local2TextObj,in=(ThePt:l),out=(TabPt:l) lda izitindent bne DrawIt cmpw #P_TabWBottom-6,ThePt ; Not in the ruler. bne DrawIt ; Do nearness checking for other tabs, incl indent lda TabPt+2 ; Not in the textobj bmi DrawIt DoSearch addword count,#1,tmp+2 subword TabPt+2,#P_MinTabDist,tmp in arrayhdl:l,tmp:w,#4:w,tmp+2:w out offset:w xcall P_Traverse lsr a lsr a cmp tmp+2 bge DrawIt subword [array]:offset,TabPt+2,a abs a cmp #P_MinTabDist bge DrawIt movelong oldpt,ThePt ; There's a tab to the right bra D_SkipIt DrawIt cmpl ThePt,oldpt beq ContLoop call P_DrawATab,in=(oldpt:l,ThePt:l,type:w) ContLoop movelong ThePt,oldpt D_SkipIt tool _StillDown,in=(#0:w),out=(a:w) jne dragloop call Local2TextObj,in=(ThePt:l),out=(TabPt:l) ; Check to see if it's in a valid location & accept or reject it. lda izitindent beq CkValid moveword TabPt+2,[array] brl Accept CkValid lda TabPt+2 ; if it's to the left of the obj. jmi Reject cmpw #P_TabWBottom-6,ThePt ; if it's out of the ruler. jne Reject cmpw TabPt+2,[array] ; It's to the left of the indent jlt Reject subword a,#P_MinTabDist,tmp ; In the indent's 'space' jmi Reject ; See if it's on top of another tab's space (incl the indent). addword count,#1,tmp+2 in arrayhdl:l,tmp:w,#4:w,tmp+2:w out offset:w xcall P_Traverse lsr a lsr a cmp tmp+2 ; It's the last tab. bge DoInsert subword [array]:offset,TabPt+2,a abs a cmp #P_MinTabDist blt Reject ; There's a tab too D_Close ; insert it. DoInsert inc newcount in arrayhdl:l,TabPt+2:w,#4:w,newcount:w out a:w xcall P_Traverse bne DoMove lda #4 DoMove sta offset addlong a,array,ptr pushlong ptr addlong #4,ptr,s pushword #0 lda newcount asl a asl a subword a,offset,s _BlockMove moveword TabPt+2,[ptr] moveword type,[ptr]:#2 bra accept Reject call P_DrawATab,in=(ThePt:l,#-50:w,#-50:w,type:w) bra exit Accept call P_DrawATab,in=(ThePt:l,#-1:l,type:w) moverect P_ContentRect,tmprect stz tmprect tool _ClipRect,in=(!tmprect:l) call P_DrawATab,in=(#-1:l,ThePt:l,type:w) exit _ShowCursor return ;------------------------ ; FixPt ; FixPt lda ThePt+2 and #$FFFE sta ThePt+2 lda izitindent bne FixDrag lda ThePt bpl CkVert stz ThePt CkVert subword ThePt,#3,a bmi FixDrag cmp P_HRulRect+4 bge GotIt FixDrag moveword #P_TabWBottom-6,ThePt GotIt rts ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PTOOL.S b/appleworksgs/PL/Src/PTOOL.S new file mode 100755 index 0000000..9b48835 --- /dev/null +++ b/appleworksgs/PL/Src/PTOOL.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_DrawIcon IMPORT P_BuildUndo IMPORT P_CheckIcon IMPORT P_CkLoc IMPORT P_ContentRect IMPORT P_Cursor IMPORT P_DeSelectAll IMPORT P_FillMode IMPORT P_FillRect IMPORT P_FrameRect IMPORT P_IconPalette IMPORT P_IsObjSel IMPORT P_KillImport IMPORT P_LineSize IMPORT P_Palette IMPORT P_SetObjAttr IMPORT P_ToolHeights IMPORT P_ToolType IMPORT P_UnCkIcon IMPORT P_VisPalette IMPORT T_Deactivate ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_NewTool ;--------------------------------------------------------------------------- ; ; P_DrawTools ; P_DrawTools PROC EXPORT ;Using P_IconData ;Using P_Data ;Using P_ObjData LOCAL tmp:l,tmprect:r BEGIN call D_DrawIcon,in=(#P_IconPalette:l,#-1:w,#-1:w,#0:w) tool _SetPenSize,in=(#2:w,#1:w) tool _MoveTo,in=(#36:w,#0:w) tool _LineTo,in=(#36:w,#220:w) tool _PenNormal tool _InvertRect,in=(#P_Palette:l) lda P_FillMode beq DoFrame tool _InvertRect,in=(#P_FillRect:l) bra DrawCheck DoFrame tool _InvertRect,in=(#P_FrameRect:l) DrawCheck lda P_LineSize asl a addlong a,#P_CkLoc,tmp call D_DrawIcon,in=(#P_CheckIcon:l,#1:w,[tmp]:w,#0:w) RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_MDInTools (ThePt:l) ; P_MDInTools PROC EXPORT ;Using P_IconData ;Using P_Data ;Using P_ObjData INPUT ThePt:l LOCAL Tmp:l,NewSize:w BEGIN lda ThePt ldx #0 ToolLoop cmp P_ToolHeights,x blt FoundIt inx inx bra ToolLoop FoundIt txa lsr a cmp #P_CIRCLE+1 beq ChangeFill bge ChangeLine NewTool call P_NewTool,in=(a:w,#1:w) brl Exit ChangeFill lda ThePt+2 cmp P_FrameRect+6 bge DoFill lda P_FillMode beq SetFF stz P_FillMode bra DoFillStuff DoFill lda P_FillMode bne SetFF moveword #1,P_FillMode DoFillStuff tool _ClipRect,in=(#P_IconPalette:l) tool _InvertRect,in=(#P_FillRect:l) tool _InvertRect,in=(#P_FrameRect:l) tool _ClipRect,in=(#P_ContentRect:l) SetFF call P_IsObjSel,out=(a:w) beq ToExit call P_BuildUndo,in=(#P_FillUndo:w) call P_SetObjAttr,in=(#P_FillAttr:w,P_FillMode:w) ToExit brl Exit ChangeLine subword a,#P_CIRCLE+1,NewSize tool _ClipRect,in=(#P_IconPalette:l) ; uncheck old D_Mark lda P_LineSize asl a addlong a,#P_CkLoc,tmp call D_DrawIcon,in=(#P_UnCkIcon:l,#1:w,[tmp]:w,#0:w) ; check D_New D_Mark lda NewSize sta P_LineSize asl a addlong a,#P_CkLoc,tmp call D_DrawIcon,in=(#P_CheckIcon:l,#1:w,[tmp]:w,#0:w) tool _ClipRect,in=(#P_ContentRect:l) call P_IsObjSel,out=(a:w) beq Exit call P_BuildUndo,in=(#P_PenSizeUndo:w) call P_SetObjAttr,in=(#P_PenSizeAttr:w,P_LineSize:w) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_NewTool (NewTool:w; KillImport:w) ; P_NewTool PROC EXPORT ;Using P_Data ;Using P_IconDATA ;Using P_OBJData ;Using T_Data INPUT NewTool:w,KillImport:w LOCAL CRect:r BEGIN tool _ClipRect,in=(#P_ContentRect:l) cmpw NewTool,P_ToolType jeq Exit ; Deselect old tool and select D_New one stz CRect stz CRect+2 moveword P_ContentRect+4,CRect+4 moveword P_IconPalette+6,CRect+6 tool _ClipRect,in=(!CRect:l) lda P_VisPalette beq NotVis1 tool _InvertRect,in=(#P_Palette:l) NotVis1 lda NewTool asl a tax lda CursorTypes,x sta P_Cursor lda P_ToolHeights,x dec a moveword a,P_Palette+4 subword a,#12,P_Palette lda P_VisPalette beq NotVis2 tool _InvertRect,in=(#P_Palette:l) NotVis2 tool _ClipRect,in=(#P_ContentRect:l) lda KillImport beq NoKill jsl P_KillImport NoKill ; If we're un-using the Arrow tool, deselect everything. lda P_ToolType cmp #P_ARROW bne UnText call P_DeSelectAll bra Choose ; If we're un-using the I-beam tool, deactivate the Q_Text. UnText cmp #P_ALPHA bne Choose call T_Deactivate,in=(#1:w,#1:w) Choose moveword NewTool,P_ToolType Exit RETURN CursorTypes DC.W ArrowCursor DC.W BeamCursor DC.W PageNumCursor DC.W DateCursor DC.W -1 DC.W -1 DC.W -1 DC.W -1 DC.W -1 ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PUNDO.S b/appleworksgs/PL/Src/PUNDO.S new file mode 100755 index 0000000..b29030f --- /dev/null +++ b/appleworksgs/PL/Src/PUNDO.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT X_CopyOneHandle IMPORT D_Deref IMPORT X_DisposeThread IMPORT P_AddObjRgn IMPORT P_AddThreadRgn IMPORT P_ChangePage IMPORT P_ContentRect IMPORT P_CopyObjList IMPORT P_CurrentWin IMPORT P_DelMarkObj IMPORT P_DelObjList IMPORT P_DeselectAll IMPORT P_DrawContent IMPORT P_DrawRgn IMPORT P_FixMenus IMPORT P_HorizGCount IMPORT P_HorizGuides IMPORT P_ListOp IMPORT P_LoadPage IMPORT P_MergeGuides IMPORT P_NewTool IMPORT P_NotActive IMPORT P_ObjList IMPORT P_Page IMPORT P_SavePage IMPORT P_SetDelFlag IMPORT P_VertGCount IMPORT P_VertGuides IMPORT D_SetFileChanged IMPORT D_SetUndoStr IMPORT T_Clear IMPORT T_ClearPrim IMPORT T_Copy IMPORT T_CopyPrim IMPORT T_CurParHdl IMPORT T_DotLine IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_FixParag IMPORT T_InvSelect IMPORT T_MarkOffset IMPORT T_MarkParag IMPORT T_Paste IMPORT T_ReThread IMPORT T_TextSelect IMPORT T_JunkRight IMPORT T_JunkLeft IMPORT T_MakeParStyle ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_ClearStr ENTRY P_ColorStr ENTRY P_CropStr ENTRY P_CutStr ENTRY P_FillStr ENTRY P_FontStr ENTRY P_GuideStr ENTRY P_KillBuild ENTRY P_MoveStr ENTRY P_PenSizeStr ENTRY P_SizeStr ENTRY P_StretchStr ENTRY P_StyleStr ENTRY P_TypeStr ENTRY P_UndoAux1 ENTRY P_UndoAux2 ENTRY P_UndoAux3 ENTRY P_UndoAux4 ENTRY P_UndoAuxHdl ENTRY P_UndoHdl ENTRY P_UndoPage ENTRY P_UndoStrings ENTRY P_UndoType ENTRY P_RedoFlag ;----------------------------------------------------------------------------- ; ; P_SetUndoStr () ; ; Sets the undo string according to whats in P_UndoType P_SetUndoStr PROC EXPORT ;Using P_Data ;Using P_UndoDataSeg begin lda P_UndoType asl a asl a tax pushlong P_UndoStrings:x lda P_UndoType bpl NotRedo lda 3,s ora #$8000 sta 3,s NotRedo call D_SetUndoStr,in=(:l,P_CurrentWin:l) Exit return ENDP ;------------------------------------------------------------------------------- ; ; P_KillUndo () ; ; Kills the undo by throwing away the undo and setting the menu. P_KillUndo PROC EXPORT ;Using P_UndoDataSeg begin call P_KillBuild call P_SetUndoStr Exit return ENDP ;------------------------------------------------------------------------------ ; ; P_KillBuild () ; ; Kills whatever has been stored for the undo. P_KillBuild PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using P_UndoDataSeg local CurPage:w begin lda P_UndoType asl a tax jmp (KillTable,x) KillTable DC.W Exit ;Can't Undo DC.W PartDelete ;Move DC.W PartDelete ;Stretch DC.W PartDelete ;Crop DC.W PartDelete ;Fill DC.W PartDelete ;Q_PenSize DC.W PartDelete ;ObjFontID DC.W PartDelete ;ObjFont DC.W PartDelete ;ObjStyle DC.W PartDelete ;ObjSize DC.W PartDelete ;ObjColor DC.W FullDelete ;ObjClear DC.W FullDelete ;ObjCut DC.W GuideDispose ;Guide DC.W TextDelete ;TextClear DC.W TextDelete ;TextCut DC.W Typing ;Typing PartDelete call P_DelObjList,in=(P_UndoHdl:l,#0:w,#1:w) brl Exit FullDelete moveword P_Page,CurPage cmp P_UndoPage beq PageOkay call P_SavePage,in=(CurPage:w) call P_LoadPage,in=(P_UndoPage:w) PageOkay lda P_UndoType bmi Redo call P_DelMarkObj bra CkReset Redo call P_ListOp,in=(P_ObjList:l,#PL_ClrUndoData:w,#0:l,#0:l) CkReset cmpw CurPage,P_UndoPage beq Exit call P_SavePage,in=(P_UndoPage:w) call P_LoadPage,in=(CurPage:w) bra Exit GuideDispose cpzl P_UndoHdl beq NotMe tool _DisposeHandle,in=(P_UndoHdl:l) NotMe cpzl P_UndoAuxHdl beq NotMe2 tool _DisposeHandle,in=(P_UndoAuxHdl:l) NotMe2 bra Exit TextDelete lda P_UndoType bmi Exit TextDispose call X_DisposeThread,in=(P_UndoHdl:l,#1:w) bra Exit Typing lda P_UndoType bmi TextDispose Exit stzl P_UndoHdl stz P_UndoType return ENDP ;-------------------------------------------------------------------------------- ; ; P_BuildUndo (UndoType:w) ; P_BuildUndo PROC EXPORT ;Using P_Data ;Using T_Data ;Using P_UndoDataSeg input UndoType:w begin call D_SetFileChanged,in=(P_CurrentWin:l) lda P_NotActive jne Exit call P_KillBuild moveword P_Page,P_UndoPage moveword UndoType,P_UndoType asl a tax jmp (BuildTable,x) BuildTable DC.W Done ;Can't Undo DC.W PartCopy ;Move DC.W PartCopy ;Stretch DC.W PartCopy ;Crop DC.W PartCopy ;Fill DC.W PartCopy ;Q_PenSize DC.W PartCopy ;ObjFontID DC.W PartCopy ;ObjFont DC.W PartCopy ;ObjStyle DC.W PartCopy ;ObjSize DC.W PartCopy ;ObjColor DC.W SetDelete ;ObjClear DC.W SetDelete ;ObjCut DC.W GuideCopy ;Guide DC.W TextCopy ;TextClear DC.W TextCopy ;TextCut DC.W BuildType ;Typing PartCopy call P_CopyObjList,in=(P_ObjList:l,#0:w),out=(P_UndoHdl:l) jcs DoErr brl Done SetDelete brl Done GuideCopy stzl P_UndoAuxHdl moveword P_HorizGCount,P_UndoAux2 beq NoHoriz call X_CopyOneHandle,in=(P_HorizGuides:l),out=(P_UndoAuxHdl:l) jcs DoErr NoHoriz stzl P_UndoHdl moveword P_VertGCount,P_UndoAux1 beq Done call X_CopyOneHandle,in=(P_VertGuides:l),out=(P_UndoHdl:l) bcc Done tool _DisposeHandle,in=(P_UndoAuxHdl:l) bra DoErr TextCopy moveword T_DotParag,P_UndoAux1 moveword T_DotOffset,P_UndoAux2 call T_Copy,out=(P_UndoHdl:l) bcs DoErr bra Done BuildType moveword T_DotParag,P_UndoAux1 moveword T_DotOffset,P_UndoAux2 moveword T_MarkParag,P_UndoAux3 moveword T_MarkOffset,P_UndoAux4 stzl P_UndoHdl lda T_TextSelect beq @NoSelect call T_Copy,out=(P_UndoHdl:l) @NoSelect bra Done DoErr stz P_UndoType Done jsl P_SetUndoStr Exit return ENDP ;------------------------------------------------------------------------------- ; ; P_BuildType () ; ; P_BuildType PROC EXPORT ;Using P_Data ;Using P_UndoDataSeg begin cmpw P_UndoType,#P_TypeUndo beq Exit call P_BuildUndo,in=(#P_TypeUndo:w) Exit return ENDP ;------------------------------------------------------------------------------- ; ; P_ListUndo () ; ; Does all object list undos. ; ; Use PlaceHdl for undoing object changes. P_ListUndo PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using P_UndoDataSeg local RgnHdl:l,ObjHdl:l,ObjPtr:l,NextObj:l,PlaceNo:w local DataPtr1:l,DataPtr2:l,ObjSize:l local PlaceHdl:l,PlacePtr:l,Counter:w begin tool _NewRgn,out=(RgnHdl:l) movelong P_UndoHdl,ObjHdl Loop cpzl ObjHdl jeq Done rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) call P_AddObjRgn,in=(ObjPtr:l,RgnHdl:l) moveword [ObjPtr]:#P_UndoData,PlaceNo jsr GetPlace rcall D_Deref,in=(PlaceHdl:ax),out=(PlacePtr:ax) call P_AddObjRgn,in=(PlacePtr:l,RgnHdl:l) ; Set the place so redo works moveword PlaceNo,[PlacePtr]:#P_UndoData ; Don't copy the first 16 bytes of the object tool _GetHandleSize,in=(ObjHdl:l),out=(ObjSize:l) subword ObjSize,#16,ObjSize addlong #16,ObjPtr,DataPtr1 addlong #16,PlacePtr,DataPtr2 tool _BlockMove,in=(DataPtr2:l,#Temp:l,ObjSize:l) tool _BlockMove,in=(DataPtr1:l,DataPtr2:l,ObjSize:l) tool _BlockMove,in=(#Temp:l,DataPtr1:l,ObjSize:l) movelong [ObjPtr],NextObj tool _HUnlock,in=(PlaceHdl:l) tool _HUnlock,in=(ObjHdl:l) cmpw [PlacePtr]:#P_Type,#P_Alpha bne NotText call P_AddThreadRgn,in=(PlaceHdl:l,RgnHdl:l) call T_ReThread,in=(PlaceHdl:l) NotText movelong NextObj,ObjHdl brl Loop Done call P_DrawRgn,in=(RgnHdl:l) Exit return ; PlaceNo -- 0 - (ObjCount-1) ; PlaceHdl -- Points to the object in PlaceNo, if it exists. GetPlace movelong P_ObjList,PlaceHdl stz Counter PlaceLoop cpzl PlaceHdl beq FoundIt cmpw Counter,PlaceNo beq FoundIt inc Counter movelong [PlaceHdl],PlacePtr movelong [PlacePtr],PlaceHdl bra PlaceLoop FoundIt rts Temp DS.B 40 ;P_TextObjSize-16 ENDP ;------------------------------------------------------------------------------ ; ; P_Undo() ; P_Undo PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using P_UndoDataSeg ;Using T_Data local RgnHdl:l,CharCount:w,TempHdl:l begin +b cmpw P_Page,P_UndoPage beq Okay call P_ChangePage,in=(P_UndoPage:w,#1:w) Okay lda P_UndoType asl a tax jmp (UndoTable,x) UndoTable DC.W Exit ;None DC.W UndoList ;Move DC.W UndoList ;Stretch DC.W UndoList ;Crop DC.W UndoList ;Fill DC.W UndoList ;Q_PenSize DC.W UndoList ;ObjFontId DC.W UndoList ;ObjFont DC.W UndoList ;ObjStyle DC.W UndoList ;ObjSize DC.W UndoList ;ObjColor DC.W DeleteObj ;ObjClear DC.W DeleteObj ;ObjCut DC.W GuideChange ;Guide DC.W TextPaste ;TextClear DC.W TextPaste ;TextCut DC.W Typing ;Typing UndoList jsl P_ListUndo brl Done DeleteObj call P_NewTool,in=(#P_ARROW:w,#1:w) jsl P_DeselectAll tool _NewRgn,out=(RgnHdl:l) lda P_UndoType bmi RedoDel call P_SetDelFlag,in=(#0:w) call P_ListOp,in=(P_ObjList:l,#PL_SetUndoData:w,#0:w,#1:w,#0:l) call P_ListOp,in=(P_ObjList:l,#PL_AddUpdate:w,RgnHdl:l,#0:l) bra DrawThem RedoDel call P_ListOp,in=(P_ObjList:l,#PL_CpyUndoData:w,#0:l,#0:l) call P_ListOp,in=(P_ObjList:l,#PL_AddUpdate:w,RgnHdl:l,#0:l) call P_SetDelFlag,in=(#1:w) DrawThem call P_DrawRgn,in=(RgnHdl:l) brl Done GuideChange pushlong P_UndoHdl pushlong P_UndoAuxHdl pushword P_UndoAux1 pushword P_UndoAux2 movelong P_VertGuides,P_UndoHdl movelong P_HorizGuides,P_UndoAuxHdl moveword P_VertGCount,P_UndoAux1 moveword P_HorizGCount,P_UndoAux2 pullword P_HorizGCount pullword P_VertGCount pulllong P_HorizGuides pulllong P_VertGuides call P_MergeGuides tool _EraseRect,in=(#P_ContentRect:l) call P_DrawContent,in=(#P_ContentRect:l,#0:w) brl Done TextPaste lda P_UndoType bmi TextDel * I save T_DotOffSet because T_Paste screws it up and we know that it should * never change pushword T_DotOffset call T_Paste,in=(P_UndoHdl:l,#0:w) inc T_TextSelect pullword T_DotOffSet rcall T_JunkLeft,in=(T_MarkParag:a,T_MarkOffset:x) sta T_MarkOffset jsl T_InvSelect brl Done TextDel * This is so that the second undo doesn't bleed style changes to adjacent text. rcall T_JunkLeft,in=(T_MarkParag:a,T_MarkOffset:x) sta T_MarkOffset call T_Copy,out=(P_UndoHdl:l) jsl T_Clear brl Done Typing jsl T_InvSelect lda P_UndoType jmi RedoType rcall T_JunkLeft,in=(P_UndoAux1:a,P_UndoAux2:x) sta P_UndoAux2 rcall T_JunkLeft,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffset in T_CurParHdl:l,P_UndoAux1:w,P_UndoAux2:w in T_DotParag:w,T_DotOffset:w out TempHdl:l xcall T_CopyPrim moveword T_DotParag,T_MarkParag moveword T_DotOffset,T_MarkOffset moveword P_UndoAux1,T_DotParag moveword P_UndoAux2,T_DotOffset jsl T_MakeParStyle in P_UndoAux1:w,P_UndoAux2:w,T_MarkParag:w,T_MarkOffset:w out CharCount:w xcall T_ClearPrim moveword P_UndoAux1,T_DotParag moveword P_UndoAux2,T_DotOffset stz T_TextSelect moveword P_UndoAux3,T_MarkParag cpzl P_UndoHdl beq NoPaste pushword T_DotOffSet call T_Paste,in=(P_UndoHdl:l,#0:w) pullword T_DotOffSet inc T_TextSelect jsl T_InvSelect bra DidType NoPaste call T_FixParag,in=(T_DotParag:w,T_DotLine:w,CharCount:w) DidType movelong TempHdl,P_UndoHdl bra Done RedoType stzl TempHdl lda T_TextSelect beq @NoSelect inc P_RedoFlag rcall T_JunkLeft,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffset in T_CurParHdl:l,T_DotParag:w,T_DotOffset:w in T_MarkParag:w,T_MarkOffset:w out TempHdl:l xcall T_CopyPrim @NoSelect call T_Paste,in=(P_UndoHdl:l,#1:w) movelong TempHdl,P_UndoHdl Done lda P_UndoType eor #$8000 sta P_UndoType jsl P_SetUndoStr jsl P_FixMenus Exit return ENDP ;----------------------------------------------------------------------------- ; ; P_UndoDataSeg PROC EXPORT EXPORT P_UndoType EXPORT P_UndoHdl EXPORT P_UndoAuxHdl EXPORT P_UndoAux1 EXPORT P_UndoAux2 EXPORT P_UndoAux3 EXPORT P_UndoAux4 EXPORT P_UndoPage EXPORT P_MoveStr EXPORT P_StretchStr EXPORT P_CropStr EXPORT P_FillStr EXPORT P_PenSizeStr EXPORT P_FontStr EXPORT P_StyleStr EXPORT P_SizeStr EXPORT P_ColorStr EXPORT P_ClearStr EXPORT P_CutStr EXPORT P_GuideStr EXPORT P_TypeStr EXPORT P_UndoStrings EXPORT P_RedoFlag P_RedoFlag DC.W 0 ;special case flag P_UndoType DS.B 2 ; Type of undo. 0 for none. P_UndoHdl DS.B 4 ; Hdl to undo data P_UndoAuxHdl DS.B 4 ; Aux data for certain undos P_UndoAux1 DS.B 2 P_UndoAux2 DS.B 2 P_UndoAux3 DS.B 2 P_UndoAux4 DS.B 2 P_UndoPage DS.B 2 ; Page to undo on. ; Undo types ; --- located in P_Data ; Undo strings P_MoveStr str 'Move' P_StretchStr str 'Stretch' P_CropStr str 'Crop' P_FillStr str 'Fill Change' P_PenSizeStr str 'Pen Change' P_FontStr str 'Font Change' P_StyleStr str 'Style Change' P_SizeStr str 'Size Change' P_ColorStr str 'Color Change' P_ClearStr str 'Clear' P_CutStr str 'Cut' P_GuideStr str 'Guide Change' P_TypeStr str 'Typing' P_UndoStrings DC.L 0 DC.L P_MoveStr DC.L P_StretchStr DC.L P_CropStr DC.L P_FillStr DC.L P_PenSizeStr DC.L P_FontStr DC.L P_FontStr DC.L P_StyleStr DC.L P_SizeStr DC.L P_ColorStr DC.L P_ClearStr DC.L P_CutStr DC.L P_GuideStr DC.L P_ClearStr DC.L P_CutStr DC.L P_TypeStr ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PUPDATE.S b/appleworksgs/PL/Src/PUPDATE.S new file mode 100755 index 0000000..5c3e525 --- /dev/null +++ b/appleworksgs/PL/Src/PUPDATE.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_Deref IMPORT D_DrawIcon IMPORT P_ContentRect IMPORT P_CtlBoxIcon IMPORT P_CurrentWin IMPORT P_DblPage IMPORT P_DoScritch IMPORT P_DrawGuides IMPORT P_DrawObjList IMPORT P_DrawRulers IMPORT P_DrawTemplate IMPORT P_DrawTools IMPORT P_Entry IMPORT P_FirstPOff IMPORT P_FullPageRect IMPORT P_FullPaperRect IMPORT P_GrowIcon IMPORT P_GrowRect IMPORT P_H IMPORT P_HScroll IMPORT P_IconPalette IMPORT P_LIcon IMPORT P_LPageIcon IMPORT P_L_ArrHollowIcon IMPORT P_LastObj IMPORT P_LoadWindowStuff IMPORT P_NewClip IMPORT P_NumberTab IMPORT P_OldClip IMPORT P_OldIdlePt IMPORT P_PIconRect IMPORT P_Page IMPORT P_PageCount IMPORT P_PageMode IMPORT P_PageRect IMPORT P_PageStart IMPORT P_PaperRect IMPORT P_PortRect IMPORT P_RIcon IMPORT P_RPageIcon IMPORT P_R_ArrHollowIcon IMPORT P_TIcon IMPORT P_TrackOn IMPORT P_UseTemplate IMPORT P_V IMPORT P_VScroll IMPORT P_VisGuides IMPORT P_VisPalette IMPORT P_VisRuler IMPORT P__LPIcon IMPORT P__RPIcon IMPORT D_RectSect IMPORT D_Set4Pat IMPORT T_BlinkCaret IMPORT T_CaretDrawn IMPORT T_Editing IMPORT T_InvSelect IMPORT T_TextSelect IMPORT T_ThreadRgn IMPORT D_UnLock ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_DrawAPage ENTRY P_DrawContent ENTRY P_PageIcons ENTRY P_UpdateDoc ; pupdate.s ;------------------------------------------------------------------------------- ; ; P_ForceUpdate (WindowPtr:l) ; ; Forces an D_Update of the current window. P_ForceUpdate PROC EXPORT INPUT WindowPtr:l BEGIN tool _BeginUpdate,in=(WindowPtr:l) call P_UpdateDoc,in=(WindowPtr:l) tool _EndUpdate,in=(WindowPtr:l) RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_UpdateDoc (Window:l) ; ; Do not call BeginUpdate, EndUpdate or set your own origin. ; P_UpdateDoc PROC EXPORT ;Using P_RulerData ;Using P_Data ;Using P_IconDATA ;Using P_ObjData ;Using T_Data input window:l local rectptr:l,rgn:l,OldWind:l,OldEdit:w,NotActive:w local tmp:l,ObjHdl:l,ObjPtr:l,tmprect:r begin +b stz NotActive cmpl Window,P_CurrentWin beq DoUpdate inc NotActive movelong P_CurrentWin,OldWind moveword T_Editing,OldEdit stz T_Editing call P_LoadWindowStuff,in=(window:l) DoUpdate tool _GetVisHandle,out=(rgn:l) rcall D_Deref,in=(rgn:ax),out=(tmp:ax) addlong tmp,#2,rectptr tool _EraseRect,in=(RectPtr:l) lda P_VisPalette beq NoPalette call D_RectSect,in=(rectptr:l,#P_IconPalette:l),out=(a:w) beq NoPalette moverect P_IconPalette,tmprect moveword P_ContentRect+4,tmprect+4 tool _ClipRect,in=(!tmprect:l) call P_DrawTools NoPalette DoRulers lda P_VisRuler beq DoneRulers call P_DrawRulers,in=(rgn:l) DoneRulers tool _ClipRect,in=(#P_PortRect:l) ; Redraw scritches. lda P_TrackOn beq CkGrow call P_DoScritch,in=(P_OldIdlePt:l) CkGrow call D_RectSect,in=(rectptr:l,#P_GrowRect:l),out=(a:w) beq CkScroll pushlong #P_GrowIcon subword P_GrowRect+2,#1,s pushword P_GrowRect pushword #modeCopy jsl D_DrawIcon CkScroll movelong P_HScroll,tmp spaceword pushlong [tmp]:#0 addlong 1:s,#8,1:s ; get address of Q_Rect call D_RectSect,in=(rectptr:l) pla beq CkVert tool _DrawOneCtl,in=(P_HScroll:l) CkVert movelong P_VScroll,tmp spaceword pushlong [tmp]:#0 addlong 1:s,#8,1:s ; get address of Q_Rect call D_RectSect,in=(rectptr:l) pla beq CkIcons tool _DrawOneCtl,in=(P_VScroll:l) CkIcons call D_RectSect,in=(rectptr:l,#P_PIconRect:l),out=(a:w) beq CkContent call P_PageIcons CkContent call D_RectSect,in=(rectptr:l,#P_ContentRect:l),out=(a:w) beq Done tool _ClipRect,in=(#P_ContentRect:l) call P_DrawContent,in=(rectptr:l,#0:w) Done rcall D_UnLock,in=(rgn:ax) lda NotActive beq Exit call P_LoadWindowStuff,in=(OldWind:l) moveword OldEdit,T_Editing Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_PageIcons ; ; ; invariants: P_PageCount = # of user pages ; P_PageStart = 1st user page that is displayed as an icon ; P_Page = current page's index into page array ; = user page # + 1 ; P_DblPage = bool. F=1 template, T=L/R template ; ; ; variables: xpos = current icon x coordinate ; ypos = ' ' y " ; xnum = current number icon x coordinate ; ynum = ' ' ' y ' P_PageIcons PROC EXPORT ;Using P_Data ;Using P_IconData local xpos:w,ypos:w local count:w,pagenum:w begin moveword P_ContentRect+4,ypos moveword #-1,xpos ; Draw the template page(s) lda P_DblPage beq DoRPage call P_DrawAPage,in=(xpos:w,ypos:w,P_FirstPOff:w,#1:w) addword #P_PageWidth-2,xpos,xpos DoRPage addword P_FirstPOff,#1,a call P_DrawAPage,in=(xpos:w,ypos:w,a:w,#1:w) addword xpos,#P_PageWidth,a addword a,#P_SpaceWidth,xpos DoPages ; Draw the user page(s) ; Draw the left control if necess. cmpw P_PageCount,#P_MaxVisPages+1 blt DrawVis call D_DrawIcon,in=(#P_CtlBoxIcon:l,xpos:w,ypos:w,#notBIC:w) addword xpos,#4,xpos inc ypos call D_DrawIcon,in=(#P_L_ArrHollowIcon:l,xpos:w,ypos:w,#modeCOPY:w) dec ypos addword xpos,#P_ControlWidth-6,xpos DrawVis ; Draw the visible pages cmpw P_PageCount,#6 blt GotCount lda #5 GotCount sta count ; this is the # of icons moveword P_PageStart,pagenum loop call P_DrawAPage,in=(xpos:w,ypos:w,pagenum:w,#1:w) addword xpos,#P_PageWidth-2,xpos inc pagenum dec count bne loop DrawRCtl ; Draw the right control if necess. cmpw P_PageCount,#P_MaxVisPages+1 blt exit call D_DrawIcon,in=(#P_CtlBoxIcon:l,xpos:w,ypos:w,#notBIC:w) addword xpos,#4,xpos inc ypos call D_DrawIcon,in=(#P_R_ArrHollowIcon:l,xpos:w,ypos:w,#modeCOPY:w) exit return ENDP ;--------------------------------------------------------------------------- ; ; P_DrawAPage ; need to be able to draw page '0'.. set templates to p-2,-1. ; P_DrawAPage PROC EXPORT ;Using P_Data ;Using P_IconData input xpos:w,ypos:w,pagenum:w,showpage:w local mode:w,icon:l,ptr:l,tmppage:w,tmprect:l begin lda showpage bne GoAhead ; erase the old page moveword ypos,tmprect addword xpos,#2,tmprect+2 addword xpos,#P_PageWidth,tmprect+6 addword ypos,#11,tmprect+4 tool _EraseRect,in=(!tmprect:l) GoAhead addword P_Page,P_FirstPOff,a cmp pagenum beq InvertMode moveword #modeCOPY,mode lda P_DblPage beq DoRight subword pagenum,P_FirstPOff,a ; actual page # cmp #2 bge One bit #1 bne DoRight bra DoLeft One lda pagenum bit #1 bne DoRight DoLeft movelong #P_LPageIcon,icon bra DoCall DoRight movelong #P_RPageIcon,icon bra DoCall InvertMode moveword #notCOPY,mode lda P_DblPage beq Do_Right subword pagenum,P_FirstPOff,a cmp #2 bge _One bit #1 bne Do_Right bra Do_Left _One lda pagenum bit #1 bne Do_Right Do_Left movelong #P__LPIcon,icon bra DoCall Do_Right movelong #P__RPIcon,icon DoCall call D_DrawIcon,in=(icon:l,xpos:w,ypos:w,#notBIC:w) ; Do the page numbers addword #5,ypos,ypos subword pagenum,P_FirstPOff,a cmp #1 bge CheckRightPage call D_DrawIcon,in=(#P_LIcon:l,#8:w,ypos:w,mode:w) brl exit CheckRightPage cmp #2 bge TheNum lda P_DblPage beq DoTemplate call D_DrawIcon,in=(#P_RIcon:l,#P_PageWidth+7:w,ypos:w,mode:w) brl exit DoTemplate call D_DrawIcon,in=(#P_TIcon:l,#8:w,ypos:w,mode:w) brl exit ; ; xpos: + #5, #9, #14: left, Q_center, right... TheNum tool _UDivide,in=(pagenum:w,#10:w),out=(tmppage:w,x:w) txa beq NoLeading cmp #10 blt DoLeading tool _UDivide,in=(a:w,#10:w),out=(a:w,x:w) DoLeading asl a asl a addlong a,#P_NumberTab,ptr addword #5,xpos,xpos call D_DrawIcon,in=([ptr]:l,xpos:w,ypos:w,mode:w) NoLeading addword #9,xpos,xpos lda tmppage asl a asl a addlong a,#P_NumberTab,ptr call D_DrawIcon,in=([ptr]:l,xpos:w,ypos:w,mode:w) exit return ENDP ;--------------------------------------------------------------------------- ; ; P_DrawContent (RectPtr:l,Printing:w) ; P_DrawContent PROC EXPORT ;Using P_Data ;Using T_Data input rectptr:l,printing:w local tmprect:r,tmp:l begin jsl P_Entry lda T_Editing beq NotEdit lda Printing bne NotEdit tool _GetClipHandle,out=(P_OldClip:l) tool _NewRgn,out=(P_NewClip:l) tool _DiffRgn,in=(P_OldClip:l,T_ThreadRgn:l,P_NewClip:l) tool _SetClipHandle,in=(P_NewClip:l) NotEdit lda Printing jne DoContent lda P_PageMode bne DoPageMode moverect P_PageRect,tmprect ; ; offset to the content Q_Rect & offset by paper Q_Rect into content Q_Rect ; with H,V scrolling offsets subword P_ContentRect,P_V,a subword a,P_PaperRect,tmp subword P_ContentRect+2,P_H,a subword a,P_PaperRect+2,tmp+2 addword tmprect,tmp,tmprect addword tmprect+4,tmp,tmprect+4 addword tmprect+2,tmp+2,tmprect+2 addword tmprect+6,tmp+2,tmprect+6 brl DoDotted DoPageMode call D_RectSect,in=(rectptr:l,#P_FullPaperRect:l),out=(a:w) jeq DoneRects tool _SetPenSize,in=(#2:w,#1:w) tool _FrameRect,in=(#P_FullPaperRect:l) ; Shadow... addword P_FullPaperRect+2,#2,s pushword P_FullPaperRect+4 _MoveTo tool _LineTo,in=(P_FullPaperRect+6:w,P_FullPaperRect+4:w) pushword P_FullPaperRect+6 lda P_FullPaperRect inc a pha _LineTo call D_RectSect,in=(rectptr:l,#P_FullPageRect:l),out=(a:w) beq DoneRects moverect P_FullPageRect,tmprect DoDotted tool _SetPenSize,in=(#2:w,#1:w) call D_Set4Pat,in=(#LightGray:w) tool _FrameRect,in=(!tmprect:l) DoneRects _PenNormal lda P_VisGuides beq DoContent call P_DrawGuides,in=(rectptr:l) DoContent cmpw P_Page,#2 blt DidTemplate lda P_UseTemplate beq DidTemplate call P_DrawTemplate,in=(P_Page:w,rectptr:l) DidTemplate in P_LastObj:l,RectPtr:l,Printing:w xcall P_DrawObjList lda T_Editing beq Exit lda Printing bne Exit tool _SetClipHandle,in=(P_OldClip:l) tool _DisposeRgn,in=(P_NewClip:l) lda T_TextSelect bne DoInvert lda T_CaretDrawn beq Exit jsl T_BlinkCaret bra Exit DoInvert jsl T_InvSelect Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PUTIL.S b/appleworksgs/PL/Src/PUTIL.S new file mode 100755 index 0000000..b1651e4 --- /dev/null +++ b/appleworksgs/PL/Src/PUTIL.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_DateToStr IMPORT D_FastMult IMPORT D_GetRefCon IMPORT D_KillFont IMPORT P_AllHGCount IMPORT P_AllHGuides IMPORT P_AllVGCount IMPORT P_AllVGuides IMPORT P_ContentRect IMPORT P_CurDate IMPORT P_CurrentWin IMPORT P_Cursor IMPORT P_FindGuide IMPORT P_FirstPOff IMPORT P_FullPageRect IMPORT P_FullPaperRect IMPORT P_H IMPORT P_ImportType IMPORT P_LineSize IMPORT P_MagGuides IMPORT P_OldIdlePt IMPORT P_Page IMPORT P_PageMode IMPORT P_PageRect IMPORT P_PaperRect IMPORT P_Placing IMPORT P_PortRect IMPORT P_PrintHand IMPORT P_SetCursor IMPORT P_SpecStr IMPORT P_TrackMaskHorz IMPORT P_TrackMaskVert IMPORT P_TrackOn IMPORT P_V IMPORT P_ValidRect IMPORT P_VisRuler IMPORT P_WinStuffSize IMPORT P_WindowStuff IMPORT D_PrintToLW IMPORT D_SelectFont IMPORT D_Set4Pat IMPORT T_DotObj ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ;-------------------------------------------------------------------------------- ; ; This is a massive kludge to get around Apple's fucked up LaserWriter driver. ; The LaserWriter driver uses the current pen D_Pattern for drawing Q_Text instead ; of the current Q_Text pen. Furthermore, because of the way Quickdraw records ; pictures, it is not sufficient to just set the pen D_Pattern, because Quickdraw ; will not record the change until something it applies to, i.e. not Q_Text, is ; drawn. Therefore the bogus call to FrameRect. Argggg!! ; P_AppleFuck PROC EXPORT ;Using D_GlobalData lda >D_PrintToLW beq Exit tool _PenNormal tool _FrameRect,in=(#BogusRect:l) Exit rtl BogusRect DC.W 0,0,0,0 ENDP ;------------------------------------------------------------------------------ ; ; P_Entry () ; ; Entry routine. P_Entry PROC EXPORT ;Using P_Data tool _SetPort,in=(P_CurrentWin:l) jsl D_KillFont rtl ENDP ;--------------------------------------------------------------------------- ; ; P_SaveWindowStuff ; P_SaveWindowStuff PROC EXPORT ;Using P_Data input window:l local tmp:l begin IsNil window beq Exit call D_GetRefCon,in=(window:l),out=(tmp:l) tool _BlockMove,in=(#P_WindowStuff:l,[tmp]:l,#P_WinStuffSize:l) Exit return ENDP ;--------------------------------------------------------------------------- ; ; P_LoadWindowStuff ; P_LoadWindowStuff PROC EXPORT ;Using P_Data input NewWindow:l local tmp:l begin cmpl NewWindow,P_CurrentWin beq Done call P_SaveWindowStuff,in=(P_CurrentWin:l) IsNil NewWindow beq SetWin call D_GetRefCon,in=(NewWindow:l),out=(tmp:l) tool _BlockMove,in=([tmp]:l,#P_WindowStuff:l,#P_WinStuffSize:l) SetWin movelong NewWindow,P_CurrentWin Done return ENDP ;--------------------------------------------------------------------------- ; ; P_LShift ; ; shifts A to the left X bits ; trashes Y. ; returns in A P_LShift PROC EXPORT txy Shift beq DoneShift asl a dex bra Shift DoneShift rtl ENDP ;--------------------------------------------------------------------------- ; ; P_RShift ; ; shifts A to the right X bits ; trashes Y. ; returns in A P_RShift PROC EXPORT txy Shift beq DoneShift lsr a dex bra Shift DoneShift rtl ENDP ;--------------------------------------------------------------------------- ; ; P_Fix2Int ; ; converts fp to short, rounding accordingly. ; P_Fix2Int PROC EXPORT tay bpl exit inx exit txa rtl ENDP ;-------------------------------------------------------------------------- ; ; P_DoScritch ; P_DoScritch PROC EXPORT ;Using P_Data ;Using P_RulerData input Pt:l begin lda P_VisRuler jeq Exit tool _SetPort,in=(P_CurrentWin:l) tool _GetPenState,in=(#P_PennState:l) call D_Set4Pat,in=(#Black:w) tool _SetPenMode,in=(#notXOR:w) tool _SetPenMask,in=(#P_TrackMaskVert:l) tool _SetPenSize,in=(#1:w,#1:w) ; Horizontal tracking tool _MoveTo,in=(Pt+2:w,#0:w) tool _Line,in=(#0:w,#9:w) tool _SetPenMask,in=(#P_TrackMaskHorz:l) ; Vertical tracking subword P_ContentRect+2,#P_VRulWdth,s pushword Pt _MoveTo tool _Line,in=(#38:w,#0:w) norm tool _SetPenState,in=(#P_PennState:l) Exit return P_PennState DS.B 50 ENDP ;--------------------------------------------------------------------------- ; ; P_TrackCursor (PtPtr:l) ; P_TrackCursor PROC EXPORT ;Using P_Data input PtPtr:l local D_Cursor:w,Pt:l,Width:w begin D_DoIdle movelong [PtPtr],Pt lda P_Placing beq NotPlacing lda P_ImportType beq ItsText moveword #PlaceGrfCursor,D_Cursor bra Placed ItsText moveword #PlaceTxtCursor,D_Cursor bra Placed NotPlacing moveword P_Cursor,D_Cursor Placed tool _ClipRect,in=(#P_PortRect:l) tool _PtInRect,in=(PtPtr:l,#P_ContentRect:l),out=(a:w) bne TrackCurs moveword #ArrowCursor,D_Cursor lda P_TrackOn jeq GotCurs call P_DoScritch,in=(P_OldIdlePt:l) stz P_TrackOn brl GotCurs TrackCurs cmpw Pt+2,P_ContentRect+2 bge cont subword P_ContentRect+2,2,Pt+2 cont cmpw Pt,P_ContentRect bge cont2 moveword #0,Pt cont2 cmpl Pt,P_OldIdlePt jeq GotCurs lda P_TrackOn beq AlreadyOff call P_DoScritch,in=(P_OldIdlePt:l) AlreadyOff call P_DoScritch,in=(Pt:l) movelong Pt,P_OldIdlePt moveword #1,P_TrackOn GotCurs moveword #1,Width lda P_PageMode bne FullPage moveword P_LineSize,Width FullPage call P_SetCursor,in=(D_Cursor:w,Width:w) Exit tool _ClipRect,in=(#P_ContentRect:l) return ENDP ;---------------------------------------------------------------------------- ; ; P_Local2PL (a = Vert; x =Horix) ; ; Converts a Q_Point from local window coordinates to D_PL coordinates. P_Local2PL PROC EXPORT ;Using P_Data ldy P_PageMode beq NoMap movelong ax,Pt tool _MapPt,in=(#Pt:l,#P_FullPageRect:l,#P_PageRect:l) movelong Pt,ax bra Exit NoMap addword a,P_V,a subword a,P_ContentRect,s addword x,P_H,a subword a,P_ContentRect+2,x pla Exit rtl Pt DS.B 4 ENDP ;---------------------------------------------------------------------------- ; ; P_PL2Local (a = Vert; x =Horix) P_PL2Local PROC EXPORT ;Using P_Data ldy P_PageMode beq NoMap movelong ax,Pt tool _MapPt,in=(#Pt:l,#P_PageRect:l,#P_FullPageRect:l) movelong Pt,ax bra Exit NoMap subword a,P_V,a addword a,P_ContentRect,s subword x,P_H,a addword a,P_ContentRect+2,x pla Exit rtl Pt DS.B 4 ENDP ;--------------------------------------------------------------------------- ; ; P_FixPt ; ; i/o=(vert:a, horiz:x), in=(Q_Mask:y) ; i.e. (Q_Point:ax) ; ; Converts a document Q_Point to a window-local Q_Point. ; If currently in FullPageMode, Q_Point is mapped accordingly. ; If Y register is non-zero, Q_Point is masked to an even pixel. ; Presumably, masking to even pixel is never desired in FullPageMode ; P_FixPt PROC EXPORT ;Using P_Data movelong ax,ThePt phy lda P_PageMode beq DontMap tool _MapPt,in=(#ThePt:l,#P_PaperRect:l,#P_FullPaperRect:l) movelong ThePt,ax ply bra exit DontMap lda ThePt+2 subword a,P_H,a addword a,P_ContentRect+2,x lda ThePt subword a,P_V,a addword a,P_ContentRect,a DidMap ply beq exit pha txa and #$FFFE tax pla exit rtl ThePt DS.B 4 ENDP ;------------------------------------------------------------------------------ ; ; P_FixRect (RectPtr:l; ObjType:w; Map:w; Offset:w) ; P_FixRect PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT RectPtr:l,ObjType:w,Map:w,Offset:w BEGIN lda ObjType cmp #P_LINE beq DoLine cmp #P_STRLINE beq DoLine call P_ValidRect,in=(RectPtr:l),out=(a:w) bra DoMap DoLine cmpw [RectPtr],[RectPtr]:#4 blt DoMap pushlong [RectPtr] movelong [RectPtr]:#4,[RectPtr] pulllong [RectPtr]:#4 DoMap lda Map beq NoMap tool _MapRect,in=(RectPtr:l,#P_PageRect:l,#P_FullPageRect:l) ldy #2 lda [RectPtr],y and #$FFFE sta [RectPtr],y ldy #6 lda [RectPtr],y and #$FFFE sta [RectPtr],y bra NoOffset NoMap lda Offset beq NoOffset pushlong RectPtr subword P_ContentRect+2,P_H,s subword P_ContentRect,P_V,s _OffsetRect NoOffset Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_UnMapPt () ; ; Converts a Q_Point from window coordinates to document P_UnmapPt PROC EXPORT BEGIN RETURN ENDP ;--------------------------------------------------------------------------- ; ; Local2TextObj ; Local2TextObj PROC EXPORT ;Using P_ObjData ;Using P_Data ;Using T_Data ;Using T_TextEqu input pt:l output newpt:l local hdl:l,ptr:l begin movelong T_DotObj,Hdl movelong [hdl],ptr subword pt,[ptr]:#P_TRect,a addword a,P_V,a subword a,P_ContentRect,newpt subword pt+2,[ptr]:#P_TRect+2,a addword a,P_H,a subword a,P_ContentRect+2,a and #$FFFE sta newpt+2 RETURN ENDP ;--------------------------------------------------------------------------- ; ; TextObj2Local ; TextObj2Local PROC EXPORT ;Using P_ObjData ;Using P_Data ;Using T_Data ;Using T_TextEqu input pt:l output newpt:l local hdl:l,ptr:l begin movelong T_DotObj,hdl movelong [hdl],ptr addword pt,[ptr]:#P_TRect,a subword a,P_V,a addword a,P_ContentRect,newpt addword pt+2,[ptr]:#P_TRect+2,a subword a,P_H,a addword a,P_ContentRect+2,a and #$FFFE sta newpt+2 RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_RoundGuide (amt:w,vert:w):w ; P_RoundGuide PROC EXPORT ;Using P_Data ;Using P_RulerData input amt:w,vert:w output newamt:w local hdl:l,ppi:l,quo:w,rem:w,tmp:l,dist:w begin movelong P_PrintHand,hdl movelong [hdl],tmp movelong [tmp]:#4,ppi moveword #P_MIN_VPIX,dist lda vert beq DidVert moveword ppi+2,ppi moveword #P_MIN_HPIX,dist DidVert tool _UDivide,in=(amt:w,ppi:w),out=(tmp:w,amt:w) ldx #0 lda ppi Loop cmp dist blt DoShift lsr a inx bra loop DoShift dex stx dist rcall P_LShift,in=(tmp:a),out=(tmp:a) tool _UDivide,in=(tmp:w,ppi:w),out=(rem:w,quo:w) rcall P_LShift,in=(#1:a,dist:x),out=(dist:a) moveword ppi,tmp+2 lsr tmp+2 cmpw rem,tmp+2 blt DidDiv inc quo DidDiv rcall D_FastMult,in=(ppi:x,quo:y) tool _UDivide,in=(a:w,dist:w),out=(a:w,quo:w) rcall D_FastMult,in=(ppi:x,amt:y) addword a,quo,newamt return ENDP ;------------------------------------------------------------------------------ ; ; P_MagValue (OldValue:w; Vert:w) : NewValue:w ; P_MagValue PROC EXPORT ;Using P_Data INPUT OldValue:w,Vert:w OUTPUT NewValue:w BEGIN lda Vert beq Horiz in P_AllHGuides:l,P_AllHGCount:w,OldValue:w,#4:w,#-1:w out a:w,NewValue:w,a:w xcall P_FindGuide bra Exit Horiz in P_AllVGuides:l,P_AllVGCount:w,OldValue:w,#8:w,#-1:w out a:w,NewValue:w,a:w xcall P_FindGuide Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; P_MagPt (PtPtr1:l,Pt_Ptr2:w,Figure:w) ; P_MagPt PROC EXPORT ;Using P_Data INPUT PtPtr:l,AncPtPtr:l,Figure:w BEGIN lda P_MagGuides beq Exit lda Figure beq Exit call P_MagValue,in=([PtPtr]:w,#1:w),out=([PtPtr]:w) call P_MagValue,in=([PtPtr]:#2:w,#0:w),out=([PtPtr]:#2:w) cmpw [AncPtPtr],[PtPtr] bge TryHoriz lda [PtPtr] ina sta [PtPtr] TryHoriz ldy #2 cmpw [AncPtPtr]:y,[PtPtr]:y bge Exit lda [PtPtr],y ina sta [PtPtr],y Exit RETURN ENDP ;---------------------------------------------------------------------------- ; ; P_MagMove (RectPtr:l) ; ; If magnetic guides are turned on, this routine will bump the rectangle. P_MagMove PROC EXPORT ;Using P_Data INPUT RectPtr:l LOCAL Q_Rect:r,NewValue:l,VDiff:w,HDiff:w BEGIN lda P_MagGuides jeq Exit moverect [RectPtr],Q_Rect call P_MagValue,in=(Q_Rect:w,#1:w),out=(NewValue:w) cmp Q_Rect beq TryBottom subword a,Q_Rect,VDiff moveword NewValue,Q_Rect addword Q_Rect+4,VDiff,Q_Rect+4 bra DoHoriz TryBottom call P_MagValue,in=(Q_Rect+4:w,#1:w),out=(:w) pla ; ina ; sta NewValue ; cmp Q_Rect+4 beq DoHoriz subword a,Q_Rect+4,VDiff moveword NewValue,Q_Rect+4 addword Q_Rect,VDiff,Q_Rect DoHoriz call P_MagValue,in=(Q_Rect+2:w,#0:w),out=(NewValue:w) cmp Q_Rect+2 beq TryRight subword a,Q_Rect+2,HDiff moveword NewValue,Q_Rect+2 addword Q_Rect+6,HDiff,Q_Rect+6 bra SetIt TryRight call P_MagValue,in=(Q_Rect+6:w,#0:w),out=(:w) pla ; ina ; ina ; sta NewValue ; cmp Q_Rect+6 beq SetIt subword a,Q_Rect+6,HDiff moveword NewValue,Q_Rect+6 addword Q_Rect+2,HDiff,Q_Rect+2 SetIt moverect Q_Rect,[RectPtr] Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; P_SetSpecStr (ObjPtr:l) ; ; Sets P_SpecStr to the correct Q_Text for either a page or date object and ; sets the current font. P_SetSpecStr PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjPtr:l,ForBounds:w BEGIN pushword [ObjPtr]:#P_ItemFontID moveword [ObjPtr]:#P_ItemFontID+2,x moveword [ObjPtr]:#P_ItemColor,y pla jsl D_SelectFont cmpw [ObjPtr]:#P_Type,#P_DATETOOL beq X_dodate cmpw P_Page,#2 bge NotMaster lda ForBounds beq ShoveNumb moveword #4,P_SpecStr movelong #$35353535,P_SpecStr+1 bra Exit ShoveNumb moveword NumStr,P_SpecStr bra Exit NotMaster addword P_Page,P_FirstPOff,a tool _Int2Dec,in=(a:w,#P_SpecStr+1:l,#4:w,#0:w) movebyte #4,P_SpecStr bra Exit X_dodate call D_DateToStr,in=(P_CurDate:l,#P_SpecStr:l,#2:w,#0:w) Exit RETURN NumStr DC.B 1,35 ENDP ;---------------------------------------------------------------------------- ; ; P_GetPageMode () : PageMode:a ; ; The bank must be set when calling this routine from another bank. P_GetPageMode PROC EXPORT ;Using P_Data lda P_PageMode rtl ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/PUTIL2.S b/appleworksgs/PL/Src/PUTIL2.S new file mode 100755 index 0000000..4281523 --- /dev/null +++ b/appleworksgs/PL/Src/PUTIL2.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_CloseDialog IMPORT D_CurCursor IMPORT D_Deref IMPORT D_DigitsOnly IMPORT D_DrawIcon IMPORT D_FastMult IMPORT D_GetNewModalDialog IMPORT D_GrowHandle IMPORT D_NeedHand IMPORT D_NeedHandle IMPORT D_Newhandle IMPORT D_SetCursor IMPORT D_StrPos IMPORT D_UnLock IMPORT D_UseStdColors ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY DrawCurs1 ENTRY DrawCursors ENTRY OldHeight ENTRY P_DTabPc ENTRY P_InsertData ENTRY P_NothingPc ENTRY P_TabTable ;-------------------------------------------------------------------------------- ; ; P_ErrorAlert (Kind:w) ; P_ErrorAlert PROC EXPORT INPUT Kind:w LOCAL Ptr:l BEGIN +B lda Kind asl a asl a addlong a,#StrTable,Ptr jsl D_UseStdColors call D_AlertBox,in=(#OKBOX:w,[Ptr]:l),out=(a:w) RETURN NoPaste str 'Cannot import/paste more than 2500 paragraphs.' _NoEdit str 'There is not enough memory to edit text.' BadData str 'This file has been damaged and is unusable.' BadVersion str 'Cannot open. The file format has changed.' StrTable DC.L NoPaste DC.L _NoEdit DC.L BadData DC.L BadVersion ENDP ;------------------------------------------------------------------------------- ; ; P_CheckHand (HowMuch:l) ; ; Check to see if a handle this size can be allocated. P_CheckHand PROC EXPORT INPUT HowMuch:l ERROR Err BEGIN spacelong pushlong HowMuch jsl D_NeedHand sta Err bcc killit pla pla bra exit killit _DisposeHandle exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; P_MustHandle (HowMuch:l,Attr:w) : Hdl:l ; ; Allocate a handle any way possible. ;P_MustHandle PROC EXPORT ; ; INPUT HowMuch:l,Attr:w ; OUTPUT Hdl:l ; ; BEGIN ; ; call D_NeedHandle,in=(HowMuch:l,Attr:w),out=(Hdl:l) ; bcc Exit ; ; call D_Newhandle,in=(HowMuch:l,Attr:w),out=(Hdl:l) ; ;Exit RETURN ; ENDP ;--------------------------------------------------------------------------- ; ; P_Traverse (Hdl:l,value:w,size:w,count:w),out=(offset:w) ; ; linear search (wordsized) for an insertion point in array P_Traverse PROC EXPORT local Ptr:l input Hdl:l,value:w,size:w,count:w output offset:w begin rcall D_FastMult,in=(size:x,count:y),out=(count:a) movelong [Hdl],Ptr ldy #0 Loop cpy count bge done scmpw [Ptr]:y,value bge done addword y,size,y bra Loop done sty offset return ENDP ; Dead Code ;--------------------------------------------------------------------------- ; ; P_LTraverse (Hdl:l,value:l,size:w,count:w),out=(offset:w) ; ; linear search for a long in array, returns -1 if not found. ; ; NOTE that this is slightly different from P_Traverse. ; ;P_LTraverse PROC EXPORT ; local Ptr:l ; input Hdl:l,value:l,size:w,count:w ; output offset:w ; begin ; ; rcall D_FastMult,in=(size:x,count:y),out=(count:a) ; ; movelong [Hdl],Ptr ; ; stz offset ;Loop cmpw offset,count ; bge notthere ; cmpl [Ptr]:offset,value ; beq done ; addword offset,size,offset ; bra Loop ; ;notthere moveword #-1,offset ;done return ; ENDP ;--------------------------------------------------------------------------- ; ; P_FindGuide (Hdl:l,Count:w,Value:w,Diff:w,ftype:w) Offset:w,NewVal:w,Type:w ; ; diff is the # of Q_Pixels away you can be ; ftype is the type of guide you want to find. use -1 for any. P_FindGuide PROC EXPORT input Hdl:l,Count:w,Value:w,Diff:w,ftype:w output Offset:w,Newval:w,Type:w local Ptr:l,min:w,max:w begin IsNil Hdl beq notthere addword value,diff,a inc a sta max subword value,diff,min rcall D_FastMult,in=(#4:x,count:y),out=(count:a) movelong [Hdl],Ptr stz offset Loop cmpw offset,count bge notthere moveword [Ptr]:offset,newval iny iny moveword [Ptr]:y,type scmpw newval,min blt cont scmpw newval,max bge notthere ; found one. lda ftype bmi done iny iny cmp [ptr],y bne cont bra done cont addword offset,#4,offset bra Loop notthere moveword #-1,offset moveword value,newval done return ENDP ; Dead Code ;;--------------------------------------------------------------------------- ;; ;; P_DoInsert ;; ;; stick a long into an var-array of longs ; ;P_DoInsert PROC EXPORT ; input Hdl:l,offset:w,item:l,current:w ; local ptr:l ; error err ; begin ; ; call P_InsertData,in=(Hdl:l,offset:w,#1:w,#4:w,current:w),err=(err) ; movelong [Hdl],ptr ; ldy offset ; movelong item,[ptr]:y ; ; return ; ENDP ;--------------------------------------------------------------------------- ; ; P_Merge merge 2 arrays of long into a 3rd array ; P_Merge PROC EXPORT input Hdl1:l,Hdl2:l,Hdl3:l,size1:w,size2:w output size3:w local ptr1:l,ptr2:l,ptr3:l local offset1:w,offset2:w,offset3:w error err begin stz err cmpl Hdl1,Hdl2 bne NotTemplate stz size1 ; D_Ignore the 'template' passed in. NotTemplate addword size1,size2,size3 asl size3 asl size3 jeq exit call D_GrowHandle,in=(#0:w,size3:w,Hdl3:l),err=(err) jcs exit IsNil Hdl1 beq No1 rcall D_Deref,in=(Hdl1:ax),out=(ptr1:ax) asl size1 asl size1 bra Try2 No1 stz size1 Try2 IsNil Hdl2 beq No2 rcall D_Deref,in=(Hdl2:ax),out=(ptr2:ax) asl size2 asl size2 bra Do3 No2 stz size2 Do3 rcall D_Deref,in=(Hdl3:ax),out=(ptr3:ax) stz offset1 stz offset2 stz offset3 loop cmpw offset1,size1 bge DoSecond cmpw offset2,size2 bge DoFirst cmpw [ptr1]:offset1,[ptr2]:offset2 bgt DoSecond ; blt DoFirst ; ; They're equal, so... ; movelong [ptr1]:offset1,[ptr3]:offset3 ; addword offset1,#4,offset1 ; addword offset2,#4,offset2 ; bra continue DoFirst movelong [ptr1]:offset1,[ptr3]:offset3 addword offset1,#4,offset1 bra continue DoSecond movelong [ptr2]:offset2,[ptr3]:offset3 addword offset2,#4,offset2 continue addword offset3,#4,offset3 cmp size3 jlt loop IsNil Hdl1 beq Unlock2 rcall D_UnLock,in=(Hdl1:ax) Unlock2 IsNIl Hdl2 beq Unlock3 rcall D_UnLock,in=(Hdl2:ax) Unlock3 rcall D_UnLock,in=(Hdl3:ax) exit lsr size3 lsr size3 return ENDP ;------------------------------------------------------------------------------ ; ; P_InsertData (Hdl:l, Offset:w, items:w, UnitSize:w, Count:w) : memory errs. ; ^bytes ^insert ^current ; ; NOTE: Hdl must already exist & be non-nil P_InsertData PROC EXPORT INPUT Hdl:l,offset:w,items:w,UnitSize:w,Count:w LOCAL Size:l,Increase:l,Src:l,off:l,tmp:l error err BEGIN stz err moveword offset,off stz off+2 tool _Multiply,in=(Count:w,UnitSize:w),out=(Size:l) tool _Multiply,in=(items:w,UnitSize:w),out=(Increase:l) addlong Size,Increase,tmp IsNil tmp beq exit call D_GrowHandle,in=(tmp:l,Hdl:l),err=(err) bcs exit addlong off,[Hdl],Src pushlong Src addlong Src,Increase,s sublong Size,off,s _BlockMove exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_DeleteData (Hdl:l, offset:w, items:w, UnitSize:w, Count:w) : memory errs ; P_DeleteData PROC EXPORT INPUT Hdl:l,offset:w,items:w,UnitSize:w,Count:w LOCAL Size:l,Decrease:l,DestOffset:l,Dest:l,temp:l,off:l error err BEGIN stz err moveword offset,off stz off+2 tool _Multiply,in=(UnitSize:w,Count:w),out=(Size:l) tool _Multiply,in=(items:w,UnitSize:w),out=(Decrease:l) addlong [Hdl],off,Dest addlong Dest,Decrease,s pushlong Dest sublong Size,off,temp sublong temp,Decrease,s _BlockMove sublong Size,Decrease,off IsNil off beq exit call D_GrowHandle,in=(off:l,Hdl:l),err=(err) exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; Fix2Asc ; ; converts fixedpoint to ascii, with 2 decimal places ; assumes str is long enough to accomodate. ; ; doesn't work right for small negative numbers: -1 <= x < 0 ; ; limits string to 4 characters. E.g., '1.24' Fix2Asc PROC EXPORT input value:l,str:l local neg:w,fill:r,tmpstr:w,tmpval:l,tmp:l local offset:w,length:w begin moveword value,tmpval stz tmpval+2 stz neg lda value+2 asl a bcc NotNeg inc neg inc value+2 NotNeg tool _Int2Dec,in=(value+2:w,!tmpstr:l,#6:w,#1:w) moveword #$2E,tmpstr+6 ; the character . lda neg beq NotNeg2 sublong #$00010000,tmpval,tmp movelong tmp,tmpval NotNeg2 tool _FixMul,in=(#0:w,#100:w,tmpval:l),out=(tmpval:l) tool _Int2Dec,in=(tmpval:w,!tmpstr+7:l,#2:w,#0:w) ; convert any spaces to zeroes. short lda tmpstr+7 cmp #' ' bne Ck2nd lda #'0' sta tmpstr+7 Ck2nd lda tmpstr+8 cmp #' ' bne DidZeroes lda #'0' sta tmpstr+8 DidZeroes long moveword #9,length movelong !tmpstr,tmp stz offset D_EatBlanks moveword [tmp]:offset,a and #$FF cmp #' ' bne GotIt dec length inc offset bra D_EatBlanks GotIt cmpw length,#5 blt GotLen moveword #4,length GotLen lda offset addlong a,tmp,s addlong str,#1,s pushlongword length _BlockMove lda [str] and #$FF00 ora length sta [str] return ENDP ;--------------------------------------------------------------------------- ; ; P_AddGuide ; ; rulerguides = 0, col guides = 1, margin guides = 2 P_AddGuide PROC EXPORT input pos:w,array:l,count:w,type:w output newcount:w local tmp:l,ptr:l error err begin moveword count,newcount call P_Traverse,in=(array:l,pos:w,#4:w,count:w),out=(tmp:w) call P_InsertData,in=(array:l,tmp:w,#1:w,#4:w,count:w),err=(err) rcall D_Deref,in=(array:ax),out=(ptr:ax) jcs whoops moveword pos,[ptr]:tmp iny iny moveword type,[ptr]:y rcall D_UnLock,in=(array:ax) inc newcount whoops return ENDP ;--------------------------------------------------------------------------- ; ; P_ExplodeGuide ; P_ExplodeGuide PROC EXPORT input arrayhdl:l,count:w,val:w,type:w,dir:w output newval:w local offset:w,ptr:l,max:w error err begin moveword #1,err lda count asl a asl a sta max call P_Traverse,in=(arrayhdl:l,val:w,#4:w,count:w),out=(offset:w) movelong [arrayhdl],ptr lda dir bpl SearchF SearchR lda offset beq quit subword offset,#4,offset moveword [ptr]:offset,newval lda type bmi exit iny iny cmpw [ptr]:y,type bne SearchR bra exit SearchF cmpw offset,max beq quit moveword [ptr]:offset,newval lda type bmi exit iny iny cmpw [ptr]:y,type beq exit addword offset,#4,offset bra SearchF exit stz err quit return ENDP ;--------------------------------------------------------------------------- ; ; P_DrawATab ; ; ; newpt of -1,-1 says to erase the old, period. ; ; newpt == oldpt says to XOR over the old, then XOR the D_New. ; ; oldpt == -1,-1 says just draw it, as if in an D_Update. ; ; need to clip as necessary before calling this. ; Coordinates are in WINDOW local -- not offset nor scaled. ; P_DrawATab PROC EXPORT ;Using P_Data ;Using P_RulerData ;Using P_TabIcons input oldpt:l,newpt:l,type:w local iconptr:l,tmp:w begin +b lda type inc a asl a asl a addlong a,#P_TabTable,iconptr _PenNormal cmpl newpt,#-1 bne cont ; Totally erase the old subword oldpt+2,#4,oldpt+2 call D_DrawIcon,in=(#P_NothingPc:l,oldpt:l,#modeCopy:w) bra exit ; UnDraw the old first... cont cmpl oldpt,#-1 beq DrawNew subword oldpt+2,#4,tmp call D_DrawIcon,in=([iconptr]:l,tmp:w,oldpt:w,#notXOR:w) ; Now the D_New... DrawNew cmpl newpt,oldpt bne DrawIt ; Really place it. PlaceIt subword newpt+2,#4,newpt+2 call D_DrawIcon,in=([iconptr]:l,newpt:l,#notBIC:w) bra exit DrawIt cmpl OldPt,#-1 beq PlaceIt subword newpt+2,#4,newpt+2 call D_DrawIcon,in=([iconptr]:l,newpt:l,#notXOR:w) exit return ENDP ;--------------------------------------------------------------------------- ; ; P_TabIcons ; P_TabIcons PROC EXPORT EXPORT P_TabTable EXPORT P_IndentPc EXPORT P_LTabPc EXPORT P_DTabPc EXPORT P_RTabPc EXPORT P_NothingPc P_TabTable DC.L P_DTabPc,P_LTabPc,P_RTabPc,P_IndentPc P_IndentPc DC.W 0,0,5,10 DC.B $ff,$4f,$ff DC.B $ff,$4f,$ff DC.B $ff,$4f,$ff DC.B $f4,$44,$ff DC.B $44,$44,$4f P_LTabPc DC.W 0,0,5,10 DC.B $ff,$4f,$ff DC.B $ff,$44,$ff DC.B $ff,$44,$4f DC.B $ff,$44,$ff DC.B $ff,$4f,$ff P_DTabPc DC.W 0,0,5,10 DC.B $ff,$4f,$ff DC.B $f4,$44,$ff DC.B $f4,$f4,$ff DC.B $f4,$44,$ff DC.B $ff,$4f,$ff P_RTabPc DC.W 0,0,5,10 DC.B $ff,$4f,$ff DC.B $f4,$4f,$ff DC.B $44,$4f,$ff DC.B $f4,$4f,$ff DC.B $ff,$4f,$ff P_NothingPc DC.W 0,0,5,14 DC.B $ee,$ee,$ee,$ee DC.B $ee,$ee,$ee,$ee DC.B $ee,$ee,$ee,$ee DC.B $ee,$ee,$ee,$ee DC.B $ee,$ee,$ee,$ee ENDP ;--------------------------------------------------------------------------- ; ; P_DoSpacingDlog ; P_DoSpacingDlog PROC EXPORT input default:w output height:w local TheDlog:l,result:w,pagetext:l begin tool _Int2Dec,in=(default:w,#P_Height+1:l,#2:w,#0:w) jsl D_UseStdColors call D_GetNewModalDialog,in=(#P_SetLHDlog:l),out=(TheDlog:l) DlogLoop tool _ModalDialog,in=(#D_DigitsOnly+$80000000:l),out=(result:w) cmp #OK beq DoneDlog cmp #Cancel beq DoneDlog bra DlogLoop DoneDlog tool _GetIText,in=(TheDlog:l,#4:w,!pagetext:l) lda pagetext and #$00FF bne CkValid moveword #Cancel,result bra QuitDlog CkValid tax tool _Dec2Int,in=(!pagetext+1:l,x:w,#0:w),out=(height:w) bcs Oops cmpw height,#4 bge CheckMax lda #4 CheckMax cmp #65 blt GotHeight lda #64 GotHeight sta height bra QuitDlog Oops moveword #Cancel,result QuitDlog call D_CloseDialog,in=(TheDlog:l) cmpw result,#OK beq exit stz height exit return ;--------------------------------------------------------------------------- ; Set Line Height Dialog ; ; 1 = OK ; 2 = Cancel ; 3 = "Set Q_Line Height' ; 4 = Q_Line Height P_SetLHDlog DC.W 48,185,101,462 DC.W 1 DC.L 0 DC.L P_LHOK,P_LHCancel,P_SetLHCnt,P_SetLHText DC.L 0 P_LHOK DC.W 1 DC.W 34,160,47,230 DC.W $000A DC.L OKTxt DC.W 0 DC.W 0 DC.L 0 OKTxt STR 'OK' P_LHCancel DC.W 2 DC.W 34,40,47,110 DC.W $000A DC.L CancelTxt DC.W 0 DC.W 0 DC.L 0 CancelTxt STR 'Cancel' P_SetLHText DC.W 3 DC.W 10,40,23,161 DC.W $800F DC.L P_SetLHTextMsg DC.W 0 DC.W 0 DC.L 0 P_SetLHTextMsg STR 'Set line height' P_SetLHCnt DC.W 4 DC.W 8,165,21,203 DC.W $8011 DC.L P_Height DC.W 3 DC.W 0 DC.W 0 P_Height STR '99' ENDP ;--------------------------------------------------------------------------- ; ; Asc2Fix ; Asc2Fix PROC EXPORT input strptr:l output value:l local tmp:l,len:w,fraclen:w,divisor:w,decpos:w error err begin moveword #1,err stzl value lda [strptr] and #$FF sta len jeq exit ; find the period moveword #$2E01,tmp ; == '.' call D_StrPos,in=(!tmp:l,strptr:l,#1:w),out=(decpos:w) bmi DoInt ; calculate the fraction cmpw decpos,len beq DoInt spaceword ina addlong a,strptr,s subword len,decpos,fraclen pha pushword #0 _Dec2Int sta err pullword value bcs exit ; Convert from decimal to binary fraction moveword #10,divisor DecLoop dec fraclen beq DidDec rcall D_FastMult,in=(divisor:x,#10:y),out=(divisor:a) bra DecLoop DidDec tool _FixRatio,in=(value:w,divisor:w),out=(value:l) ; calculate the integer DoInt lda decpos bpl GotOff addword #1,len,decpos GotOff stz err subword decpos,#1,tmp beq exit addwl #1,strptr tool _Dec2Int,in=(strptr:l,tmp:w,#0:w),out=(value+2:w),err=(err) exit return ENDP ;--------------------------------------------------------------------------- ; ; P_GetModifiers():w ; ; returns a modifier word as per the event mgr. ; P_GetModifiers PROC EXPORT output mods:w local modifiers:w,where:l,when:l,message:l,event:w begin tool _GetNextEvent,in=(#0:w,!event:l),out=(a:w) moveword modifiers,mods return ENDP ;--------------------------------------------------------------------------- ; ; P_SetCursor (_cursor:w,width:w) ; P_SetCursor PROC EXPORT ;Using P_Cursors ;Using CursorData input _cursor:w,width:w local ptr:l begin +b lda _cursor bpl NotDraw movelong #DrawCursors,ptr cmpw _cursor,>D_CurCursor bne SetIt cmpw Width,OldHeight beq Exit SetIt lda Width sta OldHeight dec a asl a asl a tay tool _SetCursor,in=([ptr]:y:l) Exit call D_SetCursor,in=(_cursor:w) RETURN NotDraw stz OldHeight bra exit ENDP P_Cursors PROC EXPORT EXPORT OldHeight EXPORT DrawCursors EXPORT DrawCurs1 EXPORT DrawCurs2 EXPORT DrawCurs3 EXPORT DrawCurs4 EXPORT DrawCurs5 OldHeight DS.B 2 DrawCursors DC.L DrawCurs1,DrawCurs2,DrawCurs3,DrawCurs4,DrawCurs5 DrawCurs1 DC.W 9 ;Slices DC.W 4 ;words / slice DC.B $00,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$00,$00,$00,$00 DC.B $ff,$ff,$ff,$ff,$f0,$00,$00,$00 DC.B $00,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.W 4 ;Hot Y DC.W 8 ;Hot X DrawCurs2 DC.W 10 ;Slices DC.W 4 ;words / slice DC.B $00,$00,$ff,$00,$00,$00,$00,$00 DC.B $00,$00,$ff,$00,$00,$00,$00,$00 DC.B $00,$00,$ff,$00,$00,$00,$00,$00 DC.B $00,$00,$ff,$00,$00,$00,$00,$00 DC.B $ff,$ff,$ff,$ff,$ff,$00,$00,$00 DC.B $ff,$ff,$ff,$ff,$ff,$00,$00,$00 DC.B $00,$00,$ff,$00,$00,$00,$00,$00 DC.B $00,$00,$ff,$00,$00,$00,$00,$00 DC.B $00,$00,$ff,$00,$00,$00,$00,$00 DC.B $00,$00,$ff,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.W 4 ;Hot Y DC.W 8 ;Hot X DrawCurs3 DC.W 11 ;Slices DC.W 4 ;words / slice DC.B $00,$00,$ff,$f0,$00,$00,$00,$00 DC.B $00,$00,$f0,$f0,$00,$00,$00,$00 DC.B $00,$00,$f0,$f0,$00,$00,$00,$00 DC.B $00,$00,$f0,$f0,$00,$00,$00,$00 DC.B $ff,$ff,$ff,$ff,$ff,$f0,$00,$00 DC.B $f0,$00,$f0,$f0,$00,$f0,$00,$00 DC.B $ff,$ff,$ff,$ff,$ff,$f0,$00,$00 DC.B $00,$00,$f0,$f0,$00,$00,$00,$00 DC.B $00,$00,$f0,$f0,$00,$00,$00,$00 DC.B $00,$00,$f0,$f0,$00,$00,$00,$00 DC.B $00,$00,$ff,$f0,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.W 4 ;Hot Y DC.W 8 ;Hot X DrawCurs4 DC.W 12 ;Slices DC.W 4 ;words / slice DC.B $00,$00,$ff,$ff,$00,$00,$00,$00 DC.B $00,$00,$f0,$0f,$00,$00,$00,$00 DC.B $00,$00,$f0,$0f,$00,$00,$00,$00 DC.B $00,$00,$f0,$0f,$00,$00,$00,$00 DC.B $ff,$ff,$ff,$ff,$ff,$ff,$00,$00 DC.B $f0,$00,$f0,$0f,$00,$0f,$00,$00 DC.B $f0,$00,$f0,$0f,$00,$0f,$00,$00 DC.B $ff,$ff,$ff,$ff,$ff,$ff,$00,$00 DC.B $00,$00,$f0,$0f,$00,$00,$00,$00 DC.B $00,$00,$f0,$0f,$00,$00,$00,$00 DC.B $00,$00,$f0,$0f,$00,$00,$00,$00 DC.B $00,$00,$ff,$ff,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00 DC.W 4 ;Hot Y DC.W 8 ;Hot X DrawCurs5 DC.W 13 ;Slices DC.W 5 ;words / slice DC.B $00,$00,$ff,$ff,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$f0,$00,$00,$00,$00,$00 DC.B $ff,$ff,$ff,$ff,$ff,$ff,$f0,$00,$00,$00 DC.B $f0,$00,$f0,$00,$f0,$00,$f0,$00,$00,$00 DC.B $f0,$00,$f0,$00,$f0,$00,$f0,$00,$00,$00 DC.B $f0,$00,$f0,$00,$f0,$00,$f0,$00,$00,$00 DC.B $ff,$ff,$ff,$ff,$ff,$ff,$f0,$00,$00,$00 DC.B $00,$00,$f0,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$f0,$00,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$ff,$ff,$f0,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 DC.W 4 ;Hot Y DC.W 8 ;Hot X ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/SCRAP.S b/appleworksgs/PL/Src/SCRAP.S new file mode 100755 index 0000000..cf6b030 --- /dev/null +++ b/appleworksgs/PL/Src/SCRAP.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT T_GetParPtr IMPORT T_LineCount IMPORT T_LineInfoSize IMPORT T_LinesHdl IMPORT T_MulLine ;------------------------------------------------------------------------------ ; ; T_OffsetLines (ParagNo:w,LineNo:w,CharCount:w) ; T_OffsetLines PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,LineNo:w,CharCount:w LOCAL ParagPtr:l,LinesHdl:l,LinePtr:l,LineCount:w BEGIN rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_LinesHdl,LinesHdl movelong [LinesHdl],LinePtr moveword [ParagPtr]:#T_LineCount,LineCount rcall T_MulLine,in=(LineNo:a),out=(a:a) addwl a,LinePtr ldx LineNo LLoop inx cpx LineCount bge EndLLoop addwl #T_LineInfoSize,LinePtr addword CharCount,[LinePtr],[LinePtr] bra LLoop EndLLoop RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/TCNTL.S b/appleworksgs/PL/Src/TCNTL.S new file mode 100755 index 0000000..ea24b98 --- /dev/null +++ b/appleworksgs/PL/Src/TCNTL.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT P_KillUndo IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_DotPixs IMPORT T_FontFlags IMPORT T_GetObject IMPORT T_GetParPtr IMPORT T_GetParSize IMPORT T_InvSelect IMPORT T_JunkRight IMPORT T_MovedDot IMPORT T_NextChar IMPORT T_Pix2Offset IMPORT T_PrevChar IMPORT T_RangeFont IMPORT T_TextSelect ;----------------------------------------------------------------------------- ; ; T_DoControl (Char:w; ModFlags:w) ; T_DoControl PROC EXPORT ;Using P_ObjData ;Using T_TextEqu ;Using T_Data INPUT Char:w,ModFlags:w LOCAL ParagPtr:l,LastPar:w LOCAL ObjHdl:l,ObjPtr:l,MaxWidth:w BEGIN stz T_FontFlags jsl T_InvSelect stz T_TextSelect rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) moveword [ParagPtr],a dec a sta LastPar lda Char asl a tax jmp (JumpTable,x) ; Left arrow _LeftArrow rcall T_PrevChar,in=(T_DotParag:a,T_DotOffset:x) cmp #0 beq PrevParag sta T_DotOffset brl MovedDot PrevParag lda T_DotParag beq NoDec dec a sta T_DotParag rcall T_GetParSize,in=(a:a),out=(a:a) dec a sta T_DotOffset NoDec brl MovedDot _RightArrow rcall T_NextChar,in=(T_DotParag:a,T_DotOffset:x) cmp #0 beq NextParag sta T_DotOffset brl MovedDot NextParag cmpw T_DotParag,LastPar bge NoInc inc T_DotParag moveword #T_ParHeader,T_DotOffset NoInc brl MovedDot _UpArrow lda T_DotLine beq PrevParag2 dec T_DotLine bra FindPixs PrevParag2 lda T_DotParag jeq Exit dec T_DotParag rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_LineCount,a dec a sta T_DotLine bra FindPixs _DownArrow rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) lda T_DotLine inc a cmpw a,[ParagPtr]:#T_LineCount bge NextParag2 inc T_DotLine bra FindPixs NextParag2 cmpw T_DotParag,LastPar jeq Exit inc T_DotParag stz T_DotLine FindPixs call T_GetObject,in=(T_DotParag:w,T_DotLine:w),out=(T_DotObj:l) movelong T_DotObj,ObjHdl movelong [ObjHdl],ObjPtr subword [ObjPtr]:#P_TRect+6,[ObjPtr]:#P_TRect+2,MaxWidth in T_DotParag:w,T_DotLine:w,T_DotPixs:w,MaxWidth:w out T_DotOffset:w,T_DotPixs:w xcall T_Pix2Offset MovedDot rcall T_JunkRight,in=(T_DotParag:a,T_DotOffset:x) sta T_DotOffset jsl P_KillUndo jsl T_MovedDot jsl T_RangeFont Exit RETURN JumpTable DC.W Exit ;0 DC.W Exit ;1 DC.W Exit ;2 DC.W Exit ;3 DC.W Exit ;4 DC.W Exit ;5 DC.W Exit ;6 DC.W Exit ;7 DC.W _LeftArrow ;8 DC.W Exit ;9 Tab DC.W _DownArrow ;10 DC.W _UpArrow ;11 DC.W Exit ;12 DC.W Exit ;13 CR DC.W Exit ;14 DC.W Exit ;15 DC.W Exit ;16 DC.W Exit ;17 DC.W Exit ;18 DC.W Exit ;19 DC.W Exit ;20 DC.W _RightArrow ;21 DC.W Exit ;22 DC.W Exit ;23 DC.W Exit ;24 DC.W Exit ;25 DC.W Exit ;26 DC.W Exit ;27 DC.W Exit ;28 DC.W Exit ;29 DC.W Exit ;30 DC.W Exit ;31 ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/TDBG.S b/appleworksgs/PL/Src/TDBG.S new file mode 100755 index 0000000..010d314 --- /dev/null +++ b/appleworksgs/PL/Src/TDBG.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_Deref IMPORT T_Ascent IMPORT T_Descent IMPORT T_Length IMPORT T_LineCount IMPORT T_LineInfoSize IMPORT T_LineWidth IMPORT T_LinesHdl IMPORT T_ObjHdl IMPORT T_Offset IMPORT T_ParHeight IMPORT T_ParInfoSize IMPORT T_ParOffset IMPORT T_ParStart IMPORT T_RulerHdl IMPORT T_TextBlock IMPORT D_UseStdColors ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY CancelItem ENTRY PAItem1 ENTRY PAItem2 ENTRY PAItem3 ENTRY PAItem4 ENTRY PAItem5 ENTRY PAItem6 ENTRY PAString1 ENTRY PAString2 ENTRY PAString3 ENTRY PAString4 ENTRY PAString5 ENTRY PAString6 ENTRY PBItem2 ENTRY PBItem3 ENTRY PBItem4 ENTRY PBItem5 ENTRY PBItem6 ENTRY PBString2 ENTRY PBString3 ENTRY PBString4 ENTRY PBString5 ENTRY PBString6 ENTRY PCItem1 ENTRY PCItem10 ENTRY PCItem2 ENTRY PCItem3 ENTRY PCItem4 ENTRY PCItem5 ENTRY PCItem6 ENTRY PCItem7 ENTRY PCItem8 ENTRY PCItem9 ENTRY PCString1 ENTRY PCString10 ENTRY PCString2 ENTRY PCString3 ENTRY PCString4 ENTRY PCString5 ENTRY PCString6 ENTRY PCString7 ENTRY PCString8 ENTRY PCString9 ENTRY PDItem10 ENTRY PDItem3 ENTRY PDItem4 ENTRY PDItem5 ENTRY PDItem6 ENTRY PDItem7 ENTRY PDItem8 ENTRY PDItem9 ENTRY PDString10 ENTRY PDString3 ENTRY PDString4 ENTRY PDString5 ENTRY PDString6 ENTRY PDString7 ENTRY PDString8 ENTRY PDString9 ENTRY String1 ENTRY String2 ENTRY String3 ENTRY String4 ENTRY String5 ENTRY String6 ENTRY String7 ENTRY String8 ENTRY String9 ENTRY TItem1 ENTRY TItem2 ENTRY TItem3 ENTRY TItem4 ENTRY TItem5 ENTRY TItem6 ENTRY TItem7 ENTRY TItem8 ENTRY T_CancelStr ENTRY T_LineAlert ENTRY T_ParagAlert ENTRY T_Str ;KEEP obj/tdbg INCLUDE 'mac/tdbg.mac' ;---------------------------------------------------------------------- ; T_NumbAlert (Numb:word) ; T_NumbAlert PROC EXPORT ;Using T_DebugData INPUT Numb:w BEGIN +b spacelong _GetPort pushword Numb pushlong #T_Str+1 pushword #6 pushword #0 _Int2Dec spaceword pushword #1 pushlong #T_Str jsl D_UseStdColors jsl D_AlertBox pla _SetPort RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_DebugTextObj (ObjHdl:l) ; T_DebugTextObj PROC EXPORT ;Using P_ObjData ;Using P_Data INPUT ObjHdl:l LOCAL ObjPtr:l,PrevObject:l BEGIN Loop movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_PThread,PrevObject cpzl PrevObject beq AtStart movelong PrevObject,ObjHdl bra Loop AtStart Loop2 cpzl ObjHdl beq Exit movelong [ObjHdl],ObjPtr pushword [ObjPtr]:#P_StartParag jsl T_NumbAlert pushword [ObjPtr]:#P_StartLine jsl T_NumbAlert pushword [ObjPtr]:#P_EndParag jsl T_NumbAlert pushword [ObjPtr]:#P_EndLine jsl T_NumbAlert movelong [ObjPtr]:#P_NThread,ObjHdl bra Loop2 Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; T_DebugLines (LinePtr:l,LineCount:w) ; T_DebugLines PROC EXPORT ;Using T_Data ;Using T_DebugData ;Using T_TextEqu INPUT LinePtr:l,LineCount:w LOCAL CurLine:w BEGIN +b stz CurLine Loop inc CurLine pushword [LinePtr]:#T_Offset pushlong #PBString2+1 pushword #6 pushword #0 _Int2Dec pushword [LinePtr]:#T_Length pushlong #PBString3+1 pushword #6 pushword #0 _Int2Dec pushword [LinePtr]:#T_LineWidth pushlong #PBString4+1 pushword #6 pushword #0 _Int2Dec moveword [LinePtr]:#T_Ascent,a and #$ff pha pushlong #PBString5+1 pushword #6 pushword #0 _Int2Dec moveword [LinePtr]:#T_Descent,a and #$ff pha pushlong #PBString6+1 pushword #6 pushword #0 _Int2Dec spaceword pushlong #T_LineAlert pushlong #0 _Alert pla cmp #1 bne Exit cmpw CurLine,LineCount bge Exit addwl #T_LineInfoSize,LinePtr brl Loop Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_DebugParag (ParagPtr:l) : Continue:w ; T_DebugParag PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using T_DebugData INPUT ParagPtr:l OUTPUT Continue:w LOCAL LinesHdl:l,LinePtr:l,Result:w BEGIN +b pushlong [ParagPtr]:#T_TextBlock pushlong #PDString3+1 pushword #6 _Long2Hex pushword [ParagPtr]:#T_ParOffset pushlong #PDString4+1 pushword #6 pushword #0 _Int2Dec pushword [ParagPtr]:#T_ParStart pushlong #PDString5+1 pushword #6 pushword #0 _Int2Dec pushlong [ParagPtr]:#T_RulerHdl pushlong #PDString6+1 pushword #6 _Long2Hex pushword [ParagPtr]:#T_ParHeight pushlong #PDString7+1 pushword #6 pushword #0 _Int2Dec pushlong [ParagPtr]:#T_LinesHdl pushlong #PDString8+1 pushword #6 _Long2Hex pushword [ParagPtr]:#T_LineCount pushlong #PDString9+1 pushword #6 pushword #0 _Int2Dec pushlong [ParagPtr]:#T_ObjHdl pushlong #PDString10+1 pushword #6 _Long2Hex spaceword pushlong #T_ParagAlert pushlong #0 _Alert pullword Result cmpw Result,#1 beq Yes cmpw Result,#2 bne No movelong [ParagPtr]:#T_LinesHdl,LinesHdl movelong LinesHdl,ax jsl D_Deref movelong ax,LinePtr pushlong LinePtr pushword [ParagPtr]:#T_LineCount jsl T_DebugLines pushlong LinesHdl _HUnlock Yes moveword #1,Continue bra Exit No stz Continue Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_DebugThread (ParagHdl:l) ; T_DebugThread PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagHdl:l LOCAL ParagPtr:l,ParCount:w BEGIN +b pushlong ParagHdl _HLock movelong [ParagHdl],ParagPtr moveword [ParagPtr],ParCount pushword ParCount jsl T_NumbAlert ParLoop lda ParCount beq Done spaceword pushlong ParagPtr jsl T_DebugParag pla beq Done addwl #T_ParInfoSize,ParagPtr dec ParCount bra ParLoop Done pushlong ParagHdl _HUnlock RETURN ENDP ;----------------------------------------------------------------------------- ; ; T_DebugData ; T_DebugData PROC EXPORT EXPORT T_Str EXPORT T_String EXPORT ContStr EXPORT T_ParagAlert EXPORT PCItem1 EXPORT PCItem2 EXPORT PCItem3 EXPORT PCItem4 EXPORT PCItem5 EXPORT PCItem6 EXPORT PCItem7 EXPORT PCItem8 EXPORT PCItem9 EXPORT PCItem10 EXPORT PDItem3 EXPORT PDItem4 EXPORT PDItem5 EXPORT PDItem6 EXPORT PDItem7 EXPORT PDItem8 EXPORT PDItem9 EXPORT PDItem10 EXPORT PCString1 EXPORT PCString2 EXPORT PCString3 EXPORT PCString4 EXPORT PCString5 EXPORT PCString6 EXPORT PCString7 EXPORT PCString8 EXPORT PCString9 EXPORT PCString10 EXPORT PDString3 EXPORT PDString4 EXPORT PDString5 EXPORT PDString6 EXPORT PDString7 EXPORT PDString8 EXPORT PDString9 EXPORT PDString10 EXPORT T_LineAlert EXPORT PAItem1 EXPORT PAItem2 EXPORT PAItem3 EXPORT PAItem4 EXPORT PAItem5 EXPORT PAItem6 EXPORT PBItem2 EXPORT PBItem3 EXPORT PBItem4 EXPORT PBItem5 EXPORT PBItem6 EXPORT CancelItem EXPORT PAString1 EXPORT PAString2 EXPORT PAString3 EXPORT PAString4 EXPORT PAString5 EXPORT PAString6 EXPORT PBString2 EXPORT PBString3 EXPORT PBString4 EXPORT PBString5 EXPORT PBString6 EXPORT T_CancelStr EXPORT T_ThreadDlg EXPORT TItem1 EXPORT TItem2 EXPORT TItem3 EXPORT TItem4 EXPORT TItem5 EXPORT TItem6 EXPORT TItem7 EXPORT TItem8 EXPORT TItem9 EXPORT String1 EXPORT String2 EXPORT String3 EXPORT String4 EXPORT String5 EXPORT String6 EXPORT String7 EXPORT String8 EXPORT String9 T_Str DC.B 6 T_String DS.B 255 ContStr STR 'Continue?' T_ParagAlert DC.W 60,140,190,500 DC.W 789 DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.L PCItem1 DC.L PCItem2 DC.L PCItem2 DC.L PCItem3 DC.L PCItem4 DC.L PCItem5 DC.L PCItem6 DC.L PCItem7 DC.L PCItem8 DC.L PCItem9 DC.L PCItem10 DC.L PDItem3 DC.L PDItem4 DC.L PDItem5 DC.L PDItem6 DC.L PDItem7 DC.L PDItem8 DC.L PDItem9 DC.L PDItem10 DC.L CancelItem DC.L 0 PCItem1 DC.W 1 ;Number DC.W 65,230,80,320 ;Rectangle DC.W 10 ;Type DC.L PCString1 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCItem2 DC.W 2 ;Number DC.W 85,230,100,320 ;Rectangle DC.W 10 ;Type DC.L PCString2 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCItem3 DC.W 3 ;Number DC.W 5,30,17,100 ;Rectangle DC.W 15 ;Type DC.L PCString3 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCItem4 DC.W 4 ;Number DC.W 20,30,32,100 ;Rectangle DC.W 15 ;Type DC.L PCString4 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCItem5 DC.W 5 ;Number DC.W 35,30,47,100 ;Rectangle DC.W 15 ;Type DC.L PCString5 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCItem6 DC.W 6 ;Number DC.W 50,30,62,100 ;Rectangle DC.W 15 ;Type DC.L PCString6 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCItem7 DC.W 7 ;Number DC.W 65,30,77,100 ;Rectangle DC.W 15 ;Type DC.L PCString7 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCItem8 DC.W 8 ;Number DC.W 80,30,92,100 ;Rectangle DC.W 15 ;Type DC.L PCString8 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCItem9 DC.W 9 ;Number DC.W 95,30,107,100 ;Rectangle DC.W 15 ;Type DC.L PCString9 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCItem10 DC.W 10 ;Number DC.W 110,30,122,100 ;Rectangle DC.W 15 ;Type DC.L PCString10 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PDItem3 DC.W 11 ;Number DC.W 5,130,17,200 ;Rectangle DC.W 15 ;Type DC.L PDString3 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PDItem4 DC.W 12 ;Number DC.W 20,130,32,200 ;Rectangle DC.W 15 ;Type DC.L PDString4 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PDItem5 DC.W 13 ;Number DC.W 35,130,47,200 ;Rectangle DC.W 15 ;Type DC.L PDString5 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PDItem6 DC.W 14 ;Number DC.W 50,130,62,200 ;Rectangle DC.W 15 ;Type DC.L PDString6 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PDItem7 DC.W 15 ;Number DC.W 65,130,77,200 ;Rectangle DC.W 15 ;Type DC.L PDString7 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PDItem8 DC.W 16 ;Number DC.W 80,130,92,200 ;Rectangle DC.W 15 ;Type DC.L PDString8 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PDItem9 DC.W 17 ;Number DC.W 95,130,107,200 ;Rectangle DC.W 15 ;Type DC.L PDString9 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PDItem10 DC.W 18 ;Number DC.W 110,130,122,200 ;Rectangle DC.W 15 ;Type DC.L PDString10 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PCString1 STR 'Continue' PCString2 STR 'LineInfo' PCString3 STR 'TextHdl' PCString4 STR 'ParOffset' PCString5 STR 'ParStart' PCString6 STR 'RulerHdl' PCString7 STR 'ParHeight' PCString8 STR 'LinesHdl' PCString9 STR 'LineCount' PCString10 STR 'ObjHdl' PDString3 DC.B 6 DS.B 6 PDString4 DC.B 6 DS.B 6 PDString5 DC.B 6 DS.B 6 PDString6 DC.B 6 DS.B 6 PDString7 DC.B 6 DS.B 6 PDString8 DC.B 6 DS.B 6 PDString9 DC.B 6 DS.B 6 PDString10 DC.B 6 DS.B 6 T_LineAlert DC.W 60,140,160,500 DC.W 789 DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.L PAItem1 DC.L PAItem2 DC.L PAItem3 DC.L PAItem4 DC.L PAItem5 DC.L PAItem6 DC.L PBItem2 DC.L PBItem3 DC.L PBItem4 DC.L PBItem5 DC.L PBItem6 DC.L CancelItem DC.L 0 PAItem1 DC.W 1 ;Number DC.W 65,230,80,320 ;Rectangle DC.W 10 ;Type DC.L PAString1 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PAItem2 DC.W 2 ;Number DC.W 5,30,17,100 ;Rectangle DC.W 15 ;Type DC.L PAString2 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PAItem3 DC.W 3 ;Number DC.W 20,30,32,100 ;Rectangle DC.W 15 ;Type DC.L PAString3 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PAItem4 DC.W 4 ;Number DC.W 35,30,47,100 ;Rectangle DC.W 15 ;Type DC.L PAString4 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PAItem5 DC.W 5 ;Number DC.W 50,30,62,100 ;Rectangle DC.W 15 ;Type DC.L PAString5 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PAItem6 DC.W 6 ;Number DC.W 65,30,77,100 ;Rectangle DC.W 15 ;Type DC.L PAString6 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PBItem2 DC.W 13 ;Number DC.W 5,130,17,200 ;Rectangle DC.W 15 ;Type DC.L PBString2 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PBItem3 DC.W 14 ;Number DC.W 20,130,32,200 ;Rectangle DC.W 15 ;Type DC.L PBString3 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PBItem4 DC.W 15 ;Number DC.W 35,130,47,200 ;Rectangle DC.W 15 ;Type DC.L PBString4 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PBItem5 DC.W 16 ;Number DC.W 50,130,62,200 ;Rectangle DC.W 15 ;Type DC.L PBString5 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PBItem6 DC.W 17 ;Number DC.W 65,130,77,200 ;Rectangle DC.W 15 ;Type DC.L PBString6 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 CancelItem DC.W 24 ;Number DC.W 40,230,55,320 ;Rectangle DC.W 10 ;Type DC.L T_CancelStr ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 PAString1 STR 'Continue' PAString2 STR 'Offset' PAString3 STR 'Length' PAString4 STR 'Width' PAString5 STR 'Ascent' PAString6 STR 'Descent' PBString2 DC.B 6 DS.B 6 PBString3 DC.B 6 DS.B 6 PBString4 DC.B 6 DS.B 6 PBString5 DC.B 6 DS.B 6 PBString6 DC.B 6 DS.B 6 T_CancelStr STR 'Cancel' T_ThreadDlg DC.W 40,120,180,520 DC.W 1 DC.L 0 DC.L TItem1 DC.L TItem2 DC.L TItem3 DC.L TItem4 DC.L TItem5 DC.L TItem6 DC.L TItem7 DC.L TItem8 DC.L 0 TItem1 DC.W 1 ;Number DC.W 30,30,45,150 ;Rectangle DC.W 10 ;Type DC.L String1 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 TItem2 DC.W 2 ;Number DC.W 50,30,65,150 ;Rectangle DC.W 10 ;Type DC.L String2 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 TItem3 DC.W 3 ;Number DC.W 70,30,85,150 ;Rectangle DC.W 10 ;Type DC.L String3 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 TItem4 DC.W 4 ;Number DC.W 90,30,105,150 ;Rectangle DC.W 10 ;Type DC.L String4 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 TItem5 DC.W 5 ;Number DC.W 30,175,45,275 ;Rectangle DC.W 15 ;Type DC.L String5 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 TItem6 DC.W 6 ;Number DC.W 50,175,65,275 ;Rectangle DC.W 15 ;Type DC.L String6 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 TItem7 DC.W 7 ;Number DC.W 30,300,45,375 ;Rectangle DC.W 15 ;Type DC.L String7 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 TItem8 DC.W 8 ;Number DC.W 50,300,65,375 ;Rectangle DC.W 15 ;Type DC.L String8 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 TItem9 DC.W 9 ;Number DC.W 0,0,0,0 ;Rectangle DC.W 15 ;Type DC.L String9 ;Descriptor DC.W 0 ;Value DC.W 0 DC.L 0 String1 STR 'LineInfo' String2 STR 'Cancel' String3 STR 'Next' String4 STR 'Previous' String5 STR 'StartOffset' String6 STR 'LineCount' String7 DC.B 6 DS.B 6 String8 DC.B 6 DS.B 6 String9 DC.B 6 DS.B 6 ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/TDRAW.S b/appleworksgs/PL/Src/TDRAW.S new file mode 100755 index 0000000..05bb87e --- /dev/null +++ b/appleworksgs/PL/Src/TDRAW.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_BitMapChanged IMPORT D_BitMapPtr IMPORT D_ClearBitMap IMPORT D_Deref IMPORT D_DrawText IMPORT D_GetStats IMPORT D_KillFont IMPORT P_ContentRect IMPORT P_CurrentWin IMPORT P_DrawFigure IMPORT P_H IMPORT P_Page IMPORT P_PageMode IMPORT P_V IMPORT D_RectZap IMPORT D_SelectFont IMPORT D_Set4Pat IMPORT T_CountSpaces IMPORT T_CurColor IMPORT T_CurFont IMPORT T_CurParHdl IMPORT T_CurRulBits IMPORT T_CurSize IMPORT T_CurStyle IMPORT T_GetParPtr IMPORT T_GetSpacing IMPORT T_GetStart IMPORT T_LockLines IMPORT T_LockRuler IMPORT T_MulLine IMPORT T_ScalePort IMPORT T_TrackFont IMPORT T_UnlockRuler IMPORT T_UseTab IMPORT P_PageRect IMPORT P_FullPageRect ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_DrawLine ENTRY T_DrawLines ENTRY T_DrawOSLine ;------------------------------------------------------------------------------- ; ; T_Update (ObjHdl:l; Printing:w) ; T_Update PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT ObjHdl:l,Printing:w LOCAL ObjPtr:l,ParagHdl:l,ParagPtr:l LOCAL ParagNo:w,StartLine:w,VertPos:w,Q_Rect:r LOCAL ParagCount:w,MaxHeight:w BEGIN pushlong T_CurParHdl rcall D_Deref,in=(ObjHdl:ax),out=(ObjPtr:ax) movelong [ObjPtr]:#P_ParagHdl,ParagHdl movelong ParagHdl,T_CurParHdl rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) moveword [ParagPtr],ParagCount moverect [ObjPtr]:#P_ObjRect,Q_Rect subword Q_Rect+4,Q_Rect,MaxHeight lda Printing bne Skip tool _SetPensize,in=(#2:w,#1:w) call D_Set4Pat,in=(#3:w) call P_DrawFigure,in=(#P_RECTANGLE:w,Q_Rect:l,Q_Rect+4:l) tool _PenNormal Skip moveword [ObjPtr]:#P_StartParag,ParagNo moveword [ObjPtr]:#P_StartLine,StartLine stz VertPos lda ParagNo cmp #$FFFF beq Done ParLoop rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) in ObjPtr:l,ParagNo:w,StartLine:w,[ParagPtr]:#T_LineCount:w in VertPos:w,#0:w out VertPos:w xcall T_DrawLines cmp MaxHeight bge Done inc ParagNo cmpw ParagNo,ParagCount bge Done stz StartLine bra ParLoop Done pulllong T_CurParHdl tool _HUnlock,in=(ObjHdl:l) RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_DrawParag (ParagNo:w,StartLine:w,MaxLine:w,VertPos:w) ; ; Draw the specified lines in the specified paragraph. Cross object bounds ; if neccessary. ; ; Current Bugs ; 1. May not handle MaxLine correctly if it is not the last Q_Line ; and the paragraph crosses objects. T_DrawParag PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_TextEqu ;Using T_Data INPUT ParagNo:w,StartLine:w,MaxLine:w,VertPos:w LOCAL ObjHdl:l,ObjPtr:l,ParagPtr:l BEGIN rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_ObjHdl,ObjHdl movelong [ObjHdl],ObjPtr ObjLoop cmpw ParagNo,[ObjPtr]:#P_EndParag blt CkDraw cmpw StartLine,[ObjPtr]:#P_EndLine bge NextObject CkDraw cmpw [ObjPtr]:#P_PageNo,P_Page bne NextObject tool _HLock,in=(ObjHdl:l) in ObjPtr:l,ParagNo:w,StartLine:w,MaxLine:w,VertPos:w,#1:w out a:w xcall T_DrawLines tool _HUnlock,in=(ObjHdl:l) NextObject movelong [ObjPtr]:#P_NThread,ObjHdl cpzl ObjHdl beq Exit movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_StartParag,ParagNo bne Exit moveword [ObjPtr]:#P_StartLine,StartLine stz VertPos brl ObjLoop Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; _DrawLines (ObjPtr:l,ParagNo:w,StartLine:w,EndLine:w,StartVert:w ; OffScreen:w): EndVert:w ; ; Draws the part of the paragraph specified by StartLine and EndLine. ; EndLine is really one larger than the last Q_Line drawn. ; It doesn't draw across object boundaries. T_DrawLines PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT ObjPtr:l,ParagNo:w,StartLine:w,MaxLine:w INPUT StartVert:w,OffScreen:w OUTPUT EndVert:w LOCAL ParagPtr:l,LinesHdl:l,LinesPtr:l,TextHdl:l,TextPtr:l LOCAL ParHeight:w,MaxWidth:w,CurLine:w LOCAL LeftPix:w,TopPix:w,MaxVert:w LOCAL BaseLine:w,Ascent:w,Descent:w,Flags:w BEGIN subword [ObjPtr]:#P_TRect+6,[ObjPtr]:#P_TRect+2,MaxWidth subword [ObjPtr]:#P_TRect+4,[ObjPtr]:#P_TRect,MaxVert rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_TextBlock,TextHdl moveword [ParagPtr]:#T_ParHeight,ParHeight rcall D_Deref,in=(TextHdl:ax),out=(TextPtr:ax) moveword [ParagPtr]:#T_ParOffset,a addwl a,TextPtr rcall T_LockRuler,in=(ParagPtr:ax) rcall T_LockLines,in=(ParagNo:a),out=(LinesHdl:ax) movelong [LinesHdl],LinesPtr lda StartLine sta CurLine jsl T_MulLine addwl a,LinesPtr call T_TrackFont,in=(TextPtr:l,[LinesPtr]:w) subword P_ContentRect+2,P_H,a addword a,[ObjPtr]:#P_TRect+2,LeftPix subword P_ContentRect,P_V,a addword a,[ObjPtr]:#P_TRect,TopPix LineLoop stz Flags lda CurLine bne NotFirst lda Flags ora #T_FirstLine sta Flags NotFirst inc CurLine cmpw CurLine,MaxLine blt DoLine jne Done lda Flags ora #T_LastLine sta Flags DoLine moveword [LinesPtr]:#T_Ascent,a and #$ff sta Ascent moveword [LinesPtr]:#T_Descent,a and #$ff sta Descent rcall T_GetSpacing,in=(T_CurRulBits:a,Ascent:x,Descent:y) addword a,Ascent,a addword a,StartVert,StartVert sta BaseLine pushword LeftPix addword StartVert,TopPix,s _MoveTo addword StartVert,Descent,StartVert cmp MaxVert bge Done lda P_PageMode bne DrawOff lda OffScreen beq DrawOn DrawOff in TextPtr:l,LinesPtr:l,Flags:w in [ObjPtr]:#P_TRect+4:l,[ObjPtr]:#P_TRect:l,BaseLine:w xcall T_DrawOSLine bra DrewIt DrawOn in TextPtr:l,LinesPtr:l,MaxWidth:w,Flags:w xcall T_DrawLine DrewIt addwl #T_LineInfoSize,LinesPtr brl LineLoop Done moveword StartVert,EndVert call T_UnlockRuler tool _HUnlock,in=(LinesHdl:l) tool _HUnlock,in=(TextHdl:l) RETURN ENDP ;------------------------------------------------------------------------------; ; ; T_DrawLine (TextPtr:l,LinePtr:l,MaxWidth:w,Flags:w) ; T_DrawLine PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT TextPtr:l,LinePtr:l,MaxWidth:w,Flags:w LOCAL Offset:w,Length:w,LineWidth:w,theChar:w LOCAL MaxOffset:w,StartSeg:w,EndSeg:w,LeftOffset:w LOCAL Spaces:w,TabStop:w,FontChanged:w LOCAL BaseChange:w,BaseOffset:w LOCAL MaxAscent:w,MaxDescent:w,Descent:w LOCAL NoIndent:w,Pt:l,LeftMarg:w,CurH:w,NewH:w LOCAL TempPtr:l,SpaceWidth:w BEGIN moveword [LinePtr]:#T_Offset,Offset moveword [LinePtr]:#T_Length,Length moveword [LinePtr]:#T_LineWidth,LineWidth addword Length,Offset,MaxOffset lda Flags and #T_FIRSTLINE eor #T_FIRSTLINE sta NoIndent in LineWidth:w,MaxWidth:w,NoIndent:w out LeftOffset:w xcall T_GetStart lda T_CurRulBits and #T_Full beq DrawIt lda Flags and #T_LastLine bne DrawIt in TextPtr:l,Offset:w,MaxOffset:w out TabStop:w,Spaces:w xcall T_CountSpaces lda TabStop bne TabOnLine lda Spaces ; Don't divide by 0 beq TabOnLine spacelong subword MaxWidth,LineWidth,s pushword Spaces _FixRatio _SetSpaceExtra TabOnLine DrawIt rcall D_SelectFont,in=(T_CurFont:a,T_CurStyle:x,T_CurColor:y) stz FontChanged moveword Offset,StartSeg tool _GetPen,in=(!Pt:l) moveword Pt+2,LeftMarg tool _Move,in=(LeftOffset:w,#0:w) CharLoop cmpw Offset,MaxOffset jge EndLine moveword [TextPtr]:Offset,a inc Offset and #$ff sta theChar cmp #T_ColorChange+1 blt SpecialChar cmp #TAB beq DoTab ; real characters lda FontChanged beq CharLoop rcall D_SelectFont,in=(T_CurFont:a,T_CurStyle:x,T_CurColor:y) stz FontChanged subword Offset,#1,StartSeg bra CharLoop DoTab lda FontChanged bne IsDrawn subword Offset,#1,EndSeg jsr DrawSegment IsDrawn tool _GetPen,in=(!Pt:l) subword Pt+2,LeftMarg,CurH in TextPtr:l,Offset:w,CurH:w,MaxWidth:w in T_CurFont:l,T_CurColor:w out a:w xcall T_UseTab bmi EndLine sta NewH subword NewH,CurH,s pushword #0 _Move moveword Offset,StartSeg brl CharLoop SpecialChar pha lda FontChanged bne DoJump subword Offset,#1,EndSeg jsr DrawSegment inc FontChanged DoJump pla asl a tax jmp (JumpTable,x) FontChange moveword [TextPtr]:Offset,T_CurFont inc Offset bra ChangeExit StyleChange movebyte [TextPtr]:Offset,T_CurStyle bra ChangeExit SizeChange movebyte [TextPtr]:Offset,T_CurSize bra ChangeExit ColorChange moveword [TextPtr]:Offset,a and #$ff sta T_CurColor ChangeExit inc Offset brl CharLoop EndLine lda FontChanged bne IsDrawn2 moveword Offset,EndSeg jsr DrawSegment IsDrawn2 lda T_CurRulBits and #T_FULL beq Exit tool _SetSpaceExtra,in=(#0:l) Exit RETURN DrawSegment stz BaseChange lda T_CurStyle ; and #SuperScript-SubScript and #SuperScript+SubScript beq Draw ; eor #SuperScript-SubScript eor #SuperScript+SubScript beq Draw inc BaseChange stz BaseOffset lda T_CurStyle and #$ffff-SuperScript-SubScript tax rcall D_SelectFont,in=(T_CurFont:a,x:x,T_CurColor:y) lda T_CurStyle and #SuperScript beq DoSub moveword [LinePtr]:#T_Ascent,a and #$ff sta MaxAscent jsl D_GetStats subword a,MaxAscent,BaseOffset tool _Move,in=(#0:w,BaseOffset:w) bra Draw DoSub moveword [LinePtr]:#T_Descent,a and #$ff sta MaxDescent jsl D_GetStats stx Descent subword MaxDescent,Descent,BaseOffset tool _Move,in=(#0:w,BaseOffset:w) Draw SpaceWord pushword #SPACE _CharWidth pullword SpaceWidth lda StartSeg addlong a,TextPtr,TempPtr pushlong TempPtr subword EndSeg,StartSeg,y lda LeftOffSet clc adc LineWidth adc SpaceWidth cmp MaxWidth blt NoSpaceAtEnd Dloop dey bmi OutOfBounds lda [TempPtr],y and #$FF cmp #SPACE ;is it a space? beq NoSpaceAtEnd OutOfBounds iny NoSpaceAtEnd phy ;# of chars to draw call D_DrawText lda BaseChange beq No pushword #0 subword #0,BaseOffset,s _Move No rts JumpTable DC.W CharLoop ; 0 DC.W FontChange ; 1 DC.W StyleChange ; 2 DC.W SizeChange ; 3 DC.W ColorChange ; 4 ENDP ;------------------------------------------------------------------------------; ; ; T_DrawOSLine (TextPtr:l,LinePtr:l,Flags:w,TextRect:r,BaseLine:w) ; T_DrawOSLine PROC EXPORT ;Using P_Data ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData INPUT TextPtr:l,LinePtr:l,Flags:w,TextRect:r,BaseLine:w LOCAL Ascent:w,Descent:w,MaxWidth:w,Port:l LOCAL ClipRect:r,ScaleRect:r,MoreLoc:r,LocInfo:r LOCAL VertPos:w,HorizPos:w BEGIN moveword #1,>D_BitMapChanged moveword [LinePtr]:#T_Ascent,a and #$ff sta Ascent moveword [LinePtr]:#T_Descent,a and #$ff sta Descent rcall T_GetSpacing,in=(T_CurRulBits:a,Ascent:x,Descent:y) addword a,Ascent,Ascent subword TextRect+6,TextRect+2,MaxWidth movelong P_CurrentWin,Port lda P_PageMode jne ScaleLine ; Adjust top,left and right of rectangle to local coordinates subword P_ContentRect,P_V,a addword a,TextRect,TextRect subword P_ContentRect+2,P_H,a addword a,TextRect+2,TextRect+2 addword a,MaxWidth,TextRect+6 ; Narrow in on the Q_Line of Q_Text addword TextRect,BaseLine,VertPos subword a,Ascent,TextRect addword VertPos,Descent,TextRect+4 ; Adjust rectangle to global coordinates moveword TextRect+2,HorizPos tool _LocalToGlobal,in=(!TextRect:l) tool _LocalToGlobal,in=(!TextRect+4:l) call D_ClearBitMap,in=(!TextRect:l) tool _MoveTo,in=(HorizPos:w,VertPos:w) pushlong [Port]:#2 ;D_Save BitMap Ptr movelong >D_BitMapPtr,[Port]:#2 in TextPtr:l,LinePtr:l,MaxWidth:w,Flags:w xcall T_DrawLine pulllong [Port]:#2 ;Restore BitMap Ptr ; Intersect the zap rectangle with the content Q_Rect in global coords. moverect P_ContentRect,ClipRect tool _LocalToGlobal,in=(!ClipRect:l) tool _LocalToGlobal,in=(!ClipRect+4:l) tool _SectRect,in=(!TextRect:l,!ClipRect:l,!TextRect:l),out=(a:w) beq NoZap call D_RectZap,in=(!TextRect:l) NoZap brl Exit ScaleLine ; Narrow in on the Q_Line of Q_Text addword TextRect,BaseLine,VertPos subword a,Ascent,TextRect addword VertPos,Descent,TextRect+4 ; Scale rectangle moverect TextRect,ScaleRect tool _MapRect,in=(!ScaleRect:l,#P_PageRect:l,#P_FullPageRect:l) subword TextRect+4,TextRect,TextRect+4 subword TextRect+6,TextRect+2,TextRect+6 stz TextRect stz TextRect+2 call D_ClearBitMap,in=(#ScreenRect:l) tool _SetPort,in=(T_ScalePort:l) jsl D_KillFont tool _MoveTo,in=(#0:w,Ascent:w) in TextPtr:l,LinePtr:l,MaxWidth:w,Flags:w xcall T_DrawLine tool _SetPort,in=(Port:l) pushlong T_ScalePort ;Src LocInfo pushlong Port ;Dest LocInfo pushlong !TextRect ;Src Q_Rect pushlong !ScaleRect ;Dest Q_Rect pushword #NotBIC ;Mode pushlong #0 _CopyPixels Exit RETURN ScreenRect DC.W 0,0,199,640 ENDP ;------------------------------------------------------------------------------ ; ; T_DrawOneLine (ParagNo:w,LineNo:w,ObjHdl:l,VertPos:w) ; T_DrawOneLine PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_TextEqu ;Using T_Data INPUT ParagNo:w,LineNo:w,ObjHdl:l,VertPos:w LOCAL ParagPtr:l,TextHdl:l,TextPtr:l LOCAL ObjPtr:l,LinesHdl:l,LinePtr:l LOCAL Flags:w,Ascent:w,Descent:w BEGIN rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) rcall T_LockRuler,in=(ax:ax) movelong [ParagPtr]:#T_TextBlock,TextHdl tool _HLock,in=(TextHdl:l) movelong [TextHdl],TextPtr moveword [ParagPtr]:#T_ParOffset,a addwl a,TextPtr rcall T_LockLines,in=(ParagNo:a),out=(LinesHdl:ax) movelong [LinesHdl],LinePtr rcall T_MulLine,in=(LineNo:a),out=(a:a) addwl a,LinePtr stz Flags moveword [ParagPtr]:#T_LineCount,a dec a cmp LineNo bne NotLast moveword #T_LastLine,Flags NotLast lda LineNo bne NotFirst lda Flags ora #T_FirstLine sta Flags NotFirst moveword [LinePtr]:#T_Ascent,a and #$ff sta Ascent moveword [LinePtr]:#T_Descent,a and #$ff sta Descent rcall T_GetSpacing,in=(T_CurRulBits:a,Ascent:x,Descent:y) addword a,Ascent,a addword a,VertPos,VertPos call T_TrackFont,in=(TextPtr:l,[LinePtr]:w) movelong [ObjHdl],ObjPtr in TextPtr:l,LinePtr:l,Flags:w in [ObjPtr]:#P_TRect+4:l,[ObjPtr]:#P_TRect:l,VertPos:w xcall T_DrawOSLine call T_UnlockRuler tool _HUnlock,in=(TextHdl:l) tool _HUnlock,in=(LinesHdl:l) RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/TRULER.S b/appleworksgs/PL/Src/TRULER.S new file mode 100755 index 0000000..a42fe5c --- /dev/null +++ b/appleworksgs/PL/Src/TRULER.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT X_CopyOneHandle IMPORT D_MainZPage IMPORT D_NeedHand IMPORT P_BuildUndo IMPORT P_DefJust IMPORT P_DefSpacing IMPORT P_DrawTabs IMPORT P_EraseTabs IMPORT T_DotObj IMPORT T_DotParag IMPORT T_Editing IMPORT T_EraseCaret IMPORT T_GetParPtr IMPORT T_MarkParag IMPORT T_RulDrawn IMPORT T_RulObj IMPORT T_TextSelect IMPORT T_UpdatePars ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_ClearRulers ENTRY T_SetRulers ;------------------------------------------------------------------------------ ; ; T_UseRuler (RulerHdl:ax) ; T_UseRuler PROC EXPORT ;Using D_GlobalData RulerHdl equ 0 RulerPtr equ 4 phd pha lda >D_MainZPage tcd pla movelong ax,RulerHdl movelong [RulerHdl],RulerPtr lda [RulerPtr] inc a sta [RulerPtr] pld rtl ENDP ;------------------------------------------------------------------------------ ; ; T_UsUseRuler (RulerHdl:ax) ; T_UnUseRuler PROC EXPORT ;Using D_GlobalData ;Using T_Data RulerHdl equ 0 RulerPtr equ 4 phd pha lda >D_MainZPage tcd pla movelong ax,RulerHdl movelong [RulerHdl],RulerPtr lda [RulerPtr] dec a sta [RulerPtr] bne Exit cmpl RulerHdl,T_RulDrawn bne Okay stzl T_RulDrawn Okay tool _DisposeHandle,in=(RulerHdl:l) Exit pld rtl ENDP ;------------------------------------------------------------------------------ ; ; T_NewRuler() : RulerHdl:l ; T_NewRuler PROC EXPORT ;Using P_Data ;Using T_TextEqu ;Using D_GlobalData OUTPUT RulerHdl:l LOCAL RulerPtr:l ERROR Err BEGIN call D_NeedHand,in=(#T_RulerInfoSize:l),out=(RulerHdl:l),err=(Err) movelong [RulerHdl],RulerPtr moveword #1,[RulerPtr]:#T_ParsUsing lda P_DefJust ora P_DefSpacing moveword a,[RulerPtr]:#T_RulBits moveword #0,[RulerPtr]:#T_TabCount moveword #0,[RulerPtr]:#T_Indent moveword #P_IndentTab,[RulerPtr]:#T_Indent+2 RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_DrawRuler () ; T_DrawRuler PROC EXPORT ;Using T_Data ;Using T_TextEqu LOCAL ParagPtr:l,RulerHdl:l BEGIN lda T_Editing beq Exit rcall T_GetParPtr,in=(T_DotParag:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_RulerHdl,RulerHdl cmpl T_DotObj,T_RulObj bne DrawIt cmpl RulerHdl,T_RulDrawn beq Exit DrawIt movelong T_DotObj,T_RulObj movelong RulerHdl,T_RulDrawn call P_EraseTabs call P_DrawTabs Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_ChangeRuls (ModType:w,Data:w,TabList:l) ; T_ChangeRuls PROC EXPORT ;Using P_Data ;Using T_TextEqu ;Using T_Data INPUT ModType:w,Data:w,TabList:l LOCAL CurPar:w,ParagPtr:l,NewRuler:l,NewPtr:l,TabPtr:l LOCAL RulerHdl:l BEGIN call P_BuildUndo,in=(#0:w) lda T_TextSelect bne Range call T_EraseCaret moveword T_DotParag,T_MarkParag Range moveword T_DotParag,CurPar ParLoop rcall T_GetParPtr,in=(CurPar:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_RulerHdl,RulerHdl lda RulerHdl+2 and #T_MarkBit bne NextParag call X_CopyOneHandle,in=(RulerHdl:l),out=(NewRuler:l) movelong [NewRuler],NewPtr moveword #0,[NewPtr] ;ParsUsing set by T_SetRulers lda ModType asl a tax jsr (ModTable,x) in NewRuler:l,RulerHdl:l,CurPar:w,T_MarkParag:w,#1:w xcall T_SetRulers NextParag inc CurPar cmpw T_MarkParag,CurPar bge ParLoop call T_ClearRulers,in=(T_DotParag:w,T_MarkParag:w) call T_UpdatePars,in=(T_DotParag:w,T_MarkParag:w) RETURN ModTable DC.W Spacing DC.W Justif DC.W Indent DC.W Tabs Spacing ldy #T_RulBits lda [NewPtr],y and #T_NoSpacing ora Data sta [NewPtr],y rts Justif ldy #T_RulBits lda [NewPtr],y and #T_NoJust ora Data sta [NewPtr],y rts Indent moveword Data,[NewPtr]:#T_Indent rts Tabs movelong [TabList],TabPtr ldy #T_TabCount moveword [TabPtr]:y,[NewPtr]:y addlong #T_TabArray,TabPtr,s addlong #T_TabArray,NewPtr,s pushlong #P_MaxTabCount*4 _BlockMove rts ENDP ;------------------------------------------------------------------------------ ; ; T_SetRulers (NewRuler:l,OldRuler:l,FirstPar:w,LastPar:w,UnUse:w) ; ; The NewRuler is marked in every paragraph record that uses its. ; DisposeRuler is called for every paragraph that is no longer using ; OldRuler if UnUse is set. T_SetRulers PROC EXPORT ;Using T_TextEqu INPUT NewRuler:l,OldRuler:l,FirstPar:w,LastPar:w,UnUse:w LOCAL ParagPtr:l,ParsUsing:w,RulerHdl:l,RPtr:l BEGIN lda NewRuler+2 ora #T_MarkBit sta NewRuler+2 stz ParsUsing ParLoop rcall T_GetParPtr,in=(FirstPar:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_RulerHdl,RulerHdl cmpl RulerHdl,OldRuler bne NextPar inc ParsUsing lda UnUse beq SetIt rcall T_UnUseRuler,in=(RulerHdl:ax) SetIt movelong NewRuler,[ParagPtr]:#T_RulerHdl NextPar inc FirstPar cmpw LastPar,FirstPar bge ParLoop movelong [NewRuler],RPtr moveword ParsUsing,[RPtr] RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_ClearRulers (FirstPar:w,LastPar:w) ; ; Clears the marks in the ruler hdls. T_ClearRulers PROC EXPORT ;Using T_TextEqu INPUT FirstPar:w,LastPar:w LOCAL ParagPtr:l BEGIN ParLoop rcall T_GetParPtr,in=(FirstPar:a),out=(ParagPtr:ax) ldy #T_RulerHdl+2 moveword [ParagPtr]:y,a and #$7FFF moveword a,[ParagPtr]:y inc FirstPar cmpw LastPar,FirstPar bge ParLoop RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/TSCRAP.S b/appleworksgs/PL/Src/TSCRAP.S new file mode 100755 index 0000000..c8fe5be --- /dev/null +++ b/appleworksgs/PL/Src/TSCRAP.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;------------------------------------------ ; ; Equates from procedure T_WPRulData ; ;------------------------------------------ T_WPParsUsing EQU 0 T_WPRulBits EQU 2 T_WPLeftMarg EQU 4 T_WPIndent EQU 6 T_WPRightMarg EQU 8 T_WPTabCount EQU 10 T_WPTabArray EQU 12 T_WPDefLM EQU 80 ;Defualt margins for D_WP T_WPDefRM EQU 600 ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_FastMult IMPORT D_GrowHandle IMPORT P_FixRect IMPORT T_MulParag IMPORT T_NewRuler ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_ClearMarks ;---------------------------------------------------------------------------- ; ; T_ClearBottom (ObjHdl:l,VertPos:w,CurPage:w) ; ; Clears the bottom of a Q_Text thread, whatever that means T_ClearBottom PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_TextEqu INPUT ObjHdl:l,VertPos:w,CurPage:w LOCAL ObjPtr:l,Q_Rect:r BEGIN movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_PageNo,CurPage bne ObjLoop moverect [ObjPtr]:#P_TRect,Q_Rect addword Q_Rect,VertPos,Q_Rect cmpw Q_Rect,Q_Rect+4 bge ObjLoop call P_FixRect,in=(!Q_Rect:l,#P_RECTANGLE:w,#0:w,#1:w) tool _EraseRect,in=(!Q_Rect:l) ObjLoop movelong [ObjHdl],ObjPtr movelong [ObjPtr]:#P_NThread,ObjHdl cpzl ObjHdl beq Exit movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_PageNo,CurPage bne ObjLoop moverect [ObjPtr]:#P_TRect,Q_Rect call P_FixRect,in=(!Q_Rect:l,#P_RECTANGLE:w,#0:w,#1:w) tool _EraseRect,in=(!Q_Rect:l) bra ObjLoop Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_WP2PLText (ParagHdl:l) ; ; Convert D_WP scrap to my scrap. Expand each Parag record by 4 bytes ; and convert the rulers. T_WP2PLText PROC EXPORT ;Using P_Data ;Using T_Data ;Using T_TextEqu ;Using T_WPRulData INPUT ParagHdl:l ERROR Err LOCAL ParagPtr:l,RulerHdl:l,RulerPtr:l LOCAL ParagCount:w,SrcPtr:l,DestPtr:l LOCAL LeftMarg:w,TabCount:w,Indent:w BEGIN ; Grow handle movelong [ParagHdl],ParagPtr moveword [ParagPtr],ParagCount lda ParagCount jsl T_MulParag pushword #0 addword a,#2,s pushlong ParagHdl jsl D_GrowHandle sta Err jcs Exit movelong [ParagHdl],ParagPtr addwl #2,ParagPtr ldx ParagCount dex ldy #T_ParInfoSize-4 jsl D_FastMult addlong a,ParagPtr,SrcPtr lda ParagCount dec a jsl T_MulParag addlong a,ParagPtr,DestPtr ParLoop tool _BlockMove,in=(SrcPtr:l,DestPtr:l,#T_ParInfoSize-4:l) moveword [DestPtr]:#T_ParStart-2,a beq Normal ; Paragraph is a page break. Get it a valid ruler call T_NewRuler,out=(RulerHdl:l),err=(Err) jcs Exit movelong RulerHdl,[DestPtr]:#T_RulerHdl-2 moveword #0,[DestPtr]:#T_ParStart-2 brl DoneTabs Normal movelong [DestPtr]:#T_RulerHdl-2,RulerHdl movelong [RulerHdl],RulerPtr ldy #T_WPRulBits moveword [RulerPtr]:y,a and #T_MarkBit bne DoneTabs moveword [RulerPtr]:y,a ora #T_MarkBit and #T_KillWidow moveword a,[RulerPtr]:y moveword [RulerPtr]:#T_WPLeftMarg,LeftMarg moveword [RulerPtr]:#T_WPTabCount,TabCount moveword [RulerPtr]:#T_WPIndent,Indent moveword TabCount,[RulerPtr]:#T_TabCount subword Indent,LeftMarg,a bpl NotNeg lda #0 NotNeg moveword a,[RulerPtr]:#T_Indent moveword #P_IndentTab,[RulerPtr]:#T_Indent+2 ldy #T_TabArray TabLoop ldx TabCount beq DoneTabs subword [RulerPtr]:y,LeftMarg,[RulerPtr]:y iny iny iny iny dec TabCount bra TabLoop DoneTabs sublong DestPtr,#T_ParInfoSize,DestPtr sublong SrcPtr,#T_ParInfoSize-4,SrcPtr dec ParagCount lda ParagCount jne ParLoop call T_ClearMarks,in=(ParagHdl:l,#T_ParInfoSize:w) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_PL2WPText (ParagHdl:l) ; ; Convert my scrap to D_WP scrap. Shrink each Parag record by 4 bytes ; and convert the rulers. T_PL2WPText PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using T_WPRulData INPUT ParagHdl:l LOCAL ParagPtr:l,RulerHdl:l,RulerPtr:l LOCAL SrcPtr:l,DestPtr:l LOCAL ParagCount:w,Count:w,TabCount:w,Indent:w BEGIN movelong [ParagHdl],ParagPtr moveword [ParagPtr],ParagCount stz Count addwl #2,ParagPtr movelong ParagPtr,SrcPtr movelong ParagPtr,DestPtr ParLoop tool _BlockMove,in=(SrcPtr:l,DestPtr:l,#T_ParInfoSize-4:l) lda #0 moveword a,[DestPtr]:#T_ParStart-2 moveword a,[DestPtr]:#T_ParHeight-2 movelong [DestPtr]:#T_RulerHdl-2,RulerHdl movelong [RulerHdl],RulerPtr ldy #T_RulBits moveword [RulerPtr]:y,a and #T_MarkBit bne DoneTabs moveword [RulerPtr]:y,a ora #T_MarkBit moveword a,[RulerPtr]:y moveword [RulerPtr]:#T_Indent,Indent moveword [RulerPtr]:#T_TabCount,TabCount moveword TabCount,[RulerPtr]:#T_WPTabCount addword Indent,#T_WPDefLM,[RulerPtr]:#T_WPIndent moveword #T_WPDefLM,[RulerPtr]:#T_WPLeftMarg moveword #T_WPDefRM,[RulerPtr]:#T_WPRightMarg ;Convert tabs ldy #T_TabArray TabLoop ldx TabCount beq DoneTabs addword [RulerPtr]:y,#T_WPDefLM,[RulerPtr]:y iny iny iny iny dec TabCount bra TabLoop DoneTabs addlong SrcPtr,#T_ParInfoSize,SrcPtr addlong DestPtr,#T_ParInfoSize-4,DestPtr inc Count cmpw Count,ParagCount jlt ParLoop ; Shrink the handle ldx ParagCount ldy #T_ParInfoSize-4 jsl D_FastMult pushword #0 addword a,#2,s pushlong ParagHdl jsl D_GrowHandle call T_ClearMarks,in=(ParagHdl:l,#T_ParInfoSize-4:w) RETURN ENDP ;----------------------------------------------------------------------------- ; ; T_ClearMarks (ParagHdl:l,ParRecSize:w) ; T_ClearMarks PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagHdl:l,ParRecSize:w LOCAL ParagPtr:l,RulerHdl:l,RulerPtr:l,ParagCount:w BEGIN movelong [ParagHdl],ParagPtr moveword [ParagPtr],ParagCount ParLoop movelong [ParagPtr]:#T_RulerHdl,RulerHdl movelong [RulerHdl],RulerPtr ldy #T_RulBits moveword [RulerPtr]:y,a and #T_ClearMark moveword a,[RulerPtr]:y dec ParagCount addwl ParRecSize,ParagPtr lda ParagCount bne ParLoop RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_WPRulData T_WPRulData PROC EXPORT ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/TUTIL.S b/appleworksgs/PL/Src/TUTIL.S new file mode 100755 index 0000000..325e01e --- /dev/null +++ b/appleworksgs/PL/Src/TUTIL.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_GrowHandle IMPORT D_MainZPage IMPORT D_NeedHand IMPORT P_ChangePage IMPORT P_ContentRect IMPORT P_DefFont IMPORT P_DefSize IMPORT P_DefStyle IMPORT P_H IMPORT P_Page IMPORT P_V IMPORT T_CurColor IMPORT T_CurFont IMPORT T_CurIndent IMPORT T_CurParHdl IMPORT T_CurRulBits IMPORT T_CurRulHdl IMPORT T_CurRulPtr IMPORT T_CutParag IMPORT T_Deactivate IMPORT T_DotLine IMPORT T_DotObj IMPORT T_DotOffset IMPORT T_DotParag IMPORT T_DotPixs IMPORT T_DrawRuler IMPORT T_EraseCaret IMPORT T_FontFlags IMPORT T_InsertFont IMPORT T_LessRoom IMPORT T_MakeRoom IMPORT T_MarkLine IMPORT T_MarkObj IMPORT T_MarkOffset IMPORT T_MarkParag IMPORT T_MarkPixs IMPORT T_NewAddStyle IMPORT T_NewColor IMPORT T_NewFont IMPORT T_NewRuler IMPORT T_NewSize IMPORT T_Offset2Line IMPORT T_Offset2Pix IMPORT T_TextSelect IMPORT T_TrackFont IMPORT T_UnUseRuler ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_LineHeight ENTRY T_OffThread ;--------------------------------------------------------------------------- ; T_MulLine ; T_MulLine PROC EXPORT asl a asl a asl a rtl ENDP ;--------------------------------------------------------------------------- ; T_MulParag ; T_MulParag PROC EXPORT asl a asl a asl a pha asl a clc adc 1,s plx rtl ENDP ;------------------------------------------------------------------------------- ; ; T_GetParPtr (ParagNo:a) : ParagPtr:ax ; ; Operates on the current thread. The ParagHdl is not X_Locked down. T_GetParPtr PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData ParagHdl equ 0 ParagPtr equ 4 phd pha lda >D_MainZPage tcd movelong T_CurParHdl,ParagHdl movelong [ParagHdl],ParagPtr pla jsl T_MulParag addwl a,ParagPtr movelong ParagPtr,ax pld rtl ENDP ;------------------------------------------------------------------------------- ; ; T_GetTextPtr (ParagNo:a) : TextPtr:ax ; ; Operates on the current thread. The TextHdl is not X_Locked down. T_GetTextPtr PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData ParagHdl equ 0 ParagPtr equ 4 TextHdl equ 8 TextPtr equ 12 phd pha lda >D_MainZPage tcd movelong T_CurParHdl,ParagHdl movelong [ParagHdl],ParagPtr pla jsl T_MulParag addwl a,ParagPtr movelong [ParagPtr]:#T_TextBlock,TextHdl movelong [TextHdl],TextPtr moveword [ParagPtr]:#T_ParOffset,a addwl a,TextPtr movelong TextPtr,ax pld rtl ENDP ;------------------------------------------------------------------------------- ; ; T_GetRulBits (ParagNo:a) : RulBits:a ; ; Operates on the current thread. T_GetRulBits PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData ParagPtr equ 20 RulerHdl equ 24 RulerPtr equ 28 phd pha lda >D_MainZPage tcd pla rcall T_GetParPtr,in=(a:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_RulerHdl,RulerHdl movelong [RulerHdl],RulerPtr moveword [RulerPtr]:#T_RulBits,a pld rtl ENDP ;----------------------------------------------------------------------------- ; ; T_GetSpacing (RulBits:a; Ascent:x; Descent:y) : Spacing:a ; T_GetSpacing PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData RulBits equ 0 Ascent equ 2 Descent equ 4 TextHeight equ 6 phd pha lda >D_MainZPage tcd stx Ascent sty Descent pullword RulBits and #T_CustSpace bne Custom lda RulBits and #T_Single bne Single lda RulBits and #T_Double bne Double Triple addword Ascent,#2,a bra Exit Double lda Ascent lsr a addword a,#2,a bra Exit Single lda #1 bra Exit Custom addword Ascent,Descent,TextHeight lda RulBits xba and #T_GetCustSpace inc a ; 1-64 subword a,TextHeight,a bpl Exit NoSpace lda #0 Exit pld rtl ENDP ;------------------------------------------------------------------------------ ; ; T_LockRuler (ParagPtr:ax) ; T_LockRuler PROC EXPORT ;Using D_GlobalData ;Using T_Data ;Using T_TextEqu ParagPtr equ 0 RulerHdl equ 4 RulerPtr equ 8 phd pha lda >D_MainZPage tcd pla movelong ax,ParagPtr movelong [ParagPtr]:#T_RulerHdl,RulerHdl tool _HLock,in=(RulerHdl:l) movelong RulerHdl,T_CurRulHdl movelong [RulerHdl],RulerPtr movelong RulerPtr,T_CurRulPtr moveword [RulerPtr]:#T_RulBits,T_CurRulBits moveword [RulerPtr]:#T_Indent,T_CurIndent pld rtl ENDP ;----------------------------------------------------------------------------- ; ; T_UnlockRuler () ; T_UnlockRuler PROC EXPORT ;Using T_Data tool _HUnlock,in=(T_CurRulHdl:l) rtl ENDP ;------------------------------------------------------------------------------ ; ; T_GetParSize (ParagNo:a) : ParSize:a ; ; Returns the size of the paragraph in bytes. ; ; All ParOffsets must be correct for this routine to work. T_GetParSize PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData ParagNo equ 20 ParagPtr equ 22 TempHdl equ 26 TempPtr equ 30 ParOffset equ 34 LastPar equ 36 TextBlock equ 38 phd pha lda >D_MainZPage tcd pullword ParagNo rcall T_GetParPtr,in=(a:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_ParOffset,ParOffset movelong [ParagPtr]:#T_TextBlock,TextBlock movelong T_CurParHdl,TempHdl movelong [TempHdl],TempPtr moveword [TempPtr],a dec a sta LastPar cmpw ParagNo,LastPar bge X_EndBlock addwl #T_ParInfoSize,ParagPtr cmpl TextBlock,[ParagPtr]:#T_TextBlock bne X_EndBlock moveword [ParagPtr]:#T_ParOffset,a bra SubIt X_EndBlock movelong [TextBlock],TempPtr moveword [TempPtr]:#T_TextSize,a SubIt subword a,ParOffset,a pld rtl ENDP ;------------------------------------------------------------------------------ ; ; T_LockLines2 (ParagNo:a) : LinesHdl:ax ; T_LockLines2 PROC EXPORT ;Using T_TextEqu INPUT ParagNo:w OUTPUT LinesHdl:l LOCAL ParagPtr:l BEGIN rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_LinesHdl,LinesHdl cpzl LinesHdl beq _Cut cpzl [LinesHdl] beq Purged tool _HLock,in=(LinesHdl:l) bra Exit Purged tool _DisposeHandle,in=(LinesHdl:l) _Cut in [ParagPtr]:#T_ObjHdl:l,ParagNo:w,[ParagPtr]:#T_ParStart:w out a:l,a:w xcall T_CutParag rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_LinesHdl,LinesHdl Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_LockLines (ParagNo:a) : LinesHdl:ax ; ; Returns with the LinesHdl X_Locked. T_LockLines PROC EXPORT call T_LockLines2,in=(a:w),out=(ax:l) rtl ENDP ;------------------------------------------------------------------------------ ; ; T_GetLinePtr2 (ParagNo:w,LineNo:w) : LinePtr:l ; T_GetLinePtr2 PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,LineNo:w OUTPUT LinePtr:l LOCAL LinesHdl:l BEGIN call T_LockLines2,in=(ParagNo:w),out=(LinesHdl:l) tool _HUnlock,in=(LinesHdl:l) movelong [LinesHdl],LinePtr rcall T_MulLine,in=(LineNo:a),out=(a:a) addwl a,LinePtr RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_GetLinePtr (ParagNo:a,LineNo:x) : LinePtr:ax ; T_GetLinePtr PROC EXPORT ;Using T_Data ;Using T_TextEqu call T_GetLinePtr2,in=(a:w,x:w),out=(ax:l) rtl ENDP ;----------------------------------------------------------------------------- ; ; T_EatJunk (TextPtr:ax; Offset:y) : NewOffset:y ; ; Moves Offset past any font changes, such that [TextPtr]:y is a normal ; character. T_EatJunk PROC EXPORT ;Using T_TextEqu ;Using D_GlobalData TextPtr equ 0 phd pha lda >D_MainZPage tcd pla movelong ax,TextPtr Loop lda [TextPtr],y and #$ff cmp #T_ColorChange+1 bge Exit iny iny cmp #T_FontChange bne Loop iny bra Loop Exit pld rtl ENDP ;------------------------------------------------------------------------------ ; ; T_PrevChar (ParagNo:a,Offset:x) : NewOffset:a ; ; Offset must be an offset within the paragraph. ; The NewOffset returned points to the previous character ; or is 0 if at the beginning of a paragraph. ; T_PrevChar PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData Offset equ 20 TextPtr equ 22 NewOffset equ 26 phd pha lda >D_MainZPage tcd stx Offset pla rcall T_GetTextPtr,in=(a:a),out=(TextPtr:ax) stz NewOffset ldy #T_ParHeader CharLoop cpy Offset bge Done lda [TextPtr],y and #$ff cmp #T_ColorChange+1 blt Special sty NewOffset iny bra CharLoop Special iny asl a tax jmp (JumpTable,x) SkipTwo iny SkipOne iny bra CharLoop Done lda NewOffset Exit pld rtl JumpTable DC.W CharLoop DC.W SkipTwo DC.W SkipOne DC.W SkipOne DC.W SkipOne ENDP ;------------------------------------------------------------------------------ ; ; T_NextChar (ParagNo:a,Offset:x) : NewOffset:a ; ; Offset must be an offset within the paragraph. ; NewOffset is set to 0 if the next character is not in the paragraph. T_NextChar PROC EXPORT ;Using T_Data ;Using T_TextEqu ;Using D_GlobalData ParagNo equ 20 Offset equ 22 TextPtr equ 24 NewOffset equ 28 HitFirst equ 30 phd pha lda >D_MainZPage clc adc #64 tcd stx Offset pla sta ParagNo jsl T_GetTextPtr movelong ax,TextPtr ldy Offset jsl T_EatJunk moveword [TextPtr]:y,a and #$ff cmp #CR beq IsCr iny movelong TextPtr,ax jsl T_EatJunk tya Exit pld rtl IsCR lda #0 bra Exit ENDP ;------------------------------------------------------------------------------ ; ; T_JunkLeft (ParagNo:a,Offset:x) : NewOffset:a ; T_JunkLeft PROC EXPORT ;Using T_TextEqu jsl T_PrevChar cmp #0 beq AtStart inc a rtl AtStart lda #T_ParHeader rtl ENDP ;------------------------------------------------------------------------------ ; ; T_JunkRight (ParagNo:a,Offset:x) : NewOffset:a ; T_JunkRight PROC EXPORT phx jsl T_GetTextPtr ply jsl T_EatJunk tya rtl ENDP ;------------------------------------------------------------------------------ ; ; T_GetObjBound (ObjPtr:l,Start:w) : Par:w,Offset:w ; ; Returns the offset to the start or end of the Q_Text in a Q_Text object. ; If the Q_Text object is empty, the last par and offset are returned. T_GetObjBound PROC EXPORT ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT ObjPtr:l,Start:w OUTPUT Par:w,Offset:w LOCAL ParagHdl:l,ParagPtr:l,LastPar:w LOCAL LinePtr:l,Q_Line:w,LineCount:w BEGIN movelong T_CurParHdl,ParagHdl movelong [ParagHdl],ParagPtr moveword [ParagPtr],a dec a sta LastPar lda Start beq DoEnd moveword [ObjPtr]:#P_StartParag,Par jmi DoLastPar moveword [ObjPtr]:#P_StartLine,Q_Line rcall T_GetLinePtr,in=(Par:a,Q_Line:x),out=(LinePtr:ax) moveword [LinePtr],Offset brl Exit DoEnd moveword [ObjPtr]:#P_EndParag,Par bmi DoLastPar moveword [ObjPtr]:#P_EndLine,a bne NotFirst lda Par beq Zero dec Par rcall T_GetParPtr,in=(Par:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_LineCount,a NotFirst dec a Zero sta Q_Line rcall T_GetParPtr,in=(Par:a),out=(ParagPtr:ax) subword [ParagPtr]:#T_LineCount,#1,LineCount rcall T_GetLinePtr,in=(Par:a,Q_Line:x),out=(LinePtr:ax) addword [LinePtr],[LinePtr]:#T_Length,Offset cmpw Q_Line,LineCount blt Exit cmpw Par,LastPar bge Exit inc Par moveword #7,Offset bra Exit DoLastPar moveword LastPar,Par rcall T_GetParPtr,in=(a:a),out=(ParagPtr:ax) moveword [ParagPtr]:#T_LineCount,a dec a tax rcall T_GetLinePtr,in=(Par:a,x:x),out=(LinePtr:ax) addword [LinePtr],[LinePtr]:#T_Length,Offset Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_NewParHdl () : ParagHdl:l ; ; Returns any memory errors. T_NewParHdl PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu OUTPUT ParagHdl:l ERROR Err LOCAL RulerHdl:l,TextHdl:l,TextPtr:l,ParagPtr:l BEGIN ; Make RulerHdl call T_NewRuler,out=(RulerHdl:l),err=(Err) jcs Exit ; Make TextBlock call D_NeedHand,in=(#T_ParHeader+5:l),out=(TextHdl:l),err=(Err) jcs DisposeRuler movelong [TextHdl],TextPtr lda #T_ParHeader+5 moveword a,[TextPtr] moveword a,[TextPtr]:#2 moveword P_DefFont,[TextPtr]:#4 shortm moveword P_DefStyle,[TextPtr]:#6 moveword P_DefSize,[TextPtr]:#7 moveword #0,[TextPtr]:#8 moveword #CR,[TextPtr]:#11 longm ; Init ParagHdl call D_NeedHand,in=(#T_ParInfoSize+2:l),out=(ParagHdl:l),err=(Err) jcs DisposeText movelong [ParagHdl],ParagPtr moveword #1,[ParagPtr] movelong TextHdl,[ParagPtr]:#T_TextBlock moveword #4,[ParagPtr]:#T_ParOffset movelong RulerHdl,[ParagPtr]:#T_RulerHdl lda #0 moveword a,[ParagPtr]:#T_LinesHdl moveword a,[ParagPtr]:#T_LinesHdl+2 Exit RETURN DisposeText tool _DisposeHandle,in=(TextHdl:l) DisposeRuler tool _DisposeHandle,in=(RulerHdl:l) bra Exit ENDP ;------------------------------------------------------------------------------ ; ; T_OffsetPCount (ObjHdl:l,Change:w) ; ; Offsets the starting paragraph for all the objects in ; the thread after ObjHdl by adding Change to them. T_OffsetPCount PROC EXPORT ;Using P_ObjData INPUT ObjHdl:l,Change:w LOCAL ObjPtr:l BEGIN movelong [ObjHdl],ObjPtr Loop movelong [ObjPtr]:#P_NThread,ObjHdl cpzl ObjHdl beq Exit movelong [ObjHdl],ObjPtr ldy #P_StartParag addword Change,[ObjPtr]:y,[ObjPtr]:y movelong [ObjPtr]:#P_NThread,ObjHdl bra Loop Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_OffsetPars (ParagNo:w,Change:w) ; ; Offsets the paragraph offsets for the rest of the paragraphs in ; the same Q_Text block as ParagNo. T_OffsetPars PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,Change:w LOCAL ParagPtr:l,TextBlock:l,ParCount:w BEGIN rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) moveword [ParagPtr],ParCount rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_TextBlock,TextBlock ParLoop inc ParagNo cmpw ParagNo,ParCount bge Exit addwl #T_ParInfoSize,ParagPtr cmpl TextBlock,[ParagPtr]:#T_TextBlock bne Exit ldy #T_ParOffset moveword [ParagPtr]:y,a addword a,Change,[ParagPtr]:y bra ParLoop Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_NewPars (ParagNo:w,Count:w) ; ; This routine makes space for the ParagInfo records in the array. ; The paragraphs themselves are uninitialized and inserted before ; ParagNo. This operation occurs on the current thread. T_NewPars PROC EXPORT ;Using T_Data INPUT ParagNo:w,Change:w LOCAL ParagHdl:l,ParagPtr:l,OldCount:w,NewCount:w ERROR Err BEGIN tool _HUnlock,in=(T_CurParHdl:l) movelong T_CurParHdl,ParagHdl movelong [ParagHdl],ParagPtr moveword [ParagPtr],OldCount addword a,Change,NewCount jsl T_MulParag addword a,#2,a ;Two extra bytes for count call D_GrowHandle,in=(#0:w,a:w,ParagHdl:l),err=(Err) bcs Exit movelong [ParagHdl],ParagPtr moveword NewCount,[ParagPtr] addwl #2,ParagPtr lda ParagNo jsl T_MulParag addlong a,ParagPtr,s ;Src addword ParagNo,Change,a jsl T_MulParag addlong a,ParagPtr,s ;Dest subword OldCount,ParagNo,a jsl T_MulParag pushword #0 pushword a ;Amount _BlockMove Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_DeletePars (ParagNo:w,Change:w) ; ; This routine deletes paragraphs starting at ParagNo. Q_Text ; must be disposed before the LinesHdl and RulerHdl fields. T_DeletePars PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,Change:w LOCAL ParagHdl:l,ParagPtr:l,RulerHdl:l,LinesHdl:l LOCAL TextBlock:l,FirstBlock:l,LastBlock:l LOCAL ParagCount:w,CurParag:w,NewCount:w LOCAL StopParag:w,SrcParag:w,ParSize:w BEGIN movelong T_CurParHdl,ParagHdl lda Change jeq Exit rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) moveword [ParagPtr],ParagCount rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_TextBlock,FirstBlock addword ParagNo,Change,StopParag dec a rcall T_GetParPtr,in=(a:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_TextBlock,LastBlock moveword ParagNo,CurParag ParLoop rcall T_GetParPtr,in=(CurParag:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_TextBlock,TextBlock cmpl TextBlock,FirstBlock beq DeleteChars cmpl TextBlock,LastBlock beq DeleteChars cmpw [ParagPtr]:#T_ParOffset,#4 bne AuxStuff tool _DisposeHandle,in=(TextBlock:l) bra AuxStuff DeleteChars rcall T_GetParSize,in=(CurParag:a),out=(ParSize:a) call T_LessRoom,in=(CurParag:w,#0:w,ParSize:w) AuxStuff movelong [ParagPtr]:#T_LinesHdl,LinesHdl cpzl LinesHdl beq NoLines tool _DisposeHandle,in=(LinesHdl:l) NoLines movelong [ParagPtr]:#T_RulerHdl,RulerHdl rcall T_UnUseRuler,in=(RulerHdl:ax) inc CurParag cmpw CurParag,StopParag jlt ParLoop ; Fix up paragraph array FixIt rcall T_GetParPtr,in=(#0:a),out=(ParagPtr:ax) subword ParagCount,Change,NewCount moveword a,[ParagPtr] addword ParagNo,Change,SrcParag rcall T_GetParPtr,in=(a:a),out=(ParagPtr:ax) addlong #2,ParagPtr,s ;Src rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) addlong #2,ParagPtr,s ;Dest subword ParagCount,SrcParag,a jsl T_MulParag pushword #0 pushword a ;Amount _BlockMove tool _HUnlock,in=(ParagHdl:l) lda NewCount jsl T_MulParag pushword #0 addword a,#2,s ;Two extra bytes for count pushlong ParagHdl jsl D_GrowHandle Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_CopyParEnd (ParagNo:w,Offset:w) : Hdl:l ; ; Hdl is a valid textblock with a valid paragraph in it. T_CopyParEnd PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,Offset:w OUTPUT Hdl:l ERROR Err LOCAL TextPtr:l,Ptr:l,HdlSize:w,TextSize:w BEGIN rcall T_GetParSize,in=(ParagNo:a),out=(a:a) subword a,Offset,a sta TextSize addword a,#T_ParHeader+4,HdlSize call D_NeedHand,in=(#0:w,HdlSize:w),out=(Hdl:l),err=(Err) bcs Exit rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) call T_TrackFont,in=(TextPtr:l,Offset:w) movelong [Hdl],Ptr moveword HdlSize,[Ptr] moveword HdlSize,[Ptr]:#2 movelong T_CurFont,[Ptr]:#4 moveword T_CurColor,[Ptr]:#4+T_ParColor addwl Offset,TextPtr addwl #4+T_ParHeader,Ptr tool _BlockMove,in=(TextPtr:l,Ptr:l,#0:w,TextSize:w) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_PastePar (ParagNo:w,Offset:w,Hdl:l) : CharCount:w ; ; Paste the Q_Text in Hdl at the Offset of ParagNo. ; Hdl must contain a proper textblock with a proper paragraph. ; Disposes the Hdl. ; T_PastePar PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,Offset:w,Hdl:l OUTPUT CharCount:w ERROR Err LOCAL TextPtr:l,Ptr:l,TextSize:w,Room:w LOCAL OrigFont:l,OrigColor:w BEGIN stz Err rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) call T_TrackFont,in=(TextPtr:l,Offset:w) movelong T_CurFont,OrigFont moveword T_CurColor,OrigColor movelong [Hdl],Ptr subword [Ptr]:#T_TextSize,#T_ParHeader+5,TextSize ;No CR either addwl #4,Ptr moveword [Ptr],T_NewFont shortm moveword [Ptr]:#T_ParStyle,T_NewAddStyle moveword [Ptr]:#T_ParSize,T_NewSize moveword [Ptr]:#T_ParColor,T_NewColor longm call T_MakeRoom,in=(ParagNo:w,Offset:w,TextSize:w) rcall T_GetTextPtr,in=(ParagNo:a),out=(TextPtr:ax) addwl Offset,TextPtr movelong [Hdl],Ptr addwl #T_ParHeader+4,Ptr tool _BlockMove,in=(Ptr:l,TextPtr:l,#0:w,TextSize:w) moveword #$ffff,T_FontFlags call T_InsertFont,in=(ParagNo:w,Offset:w,#1:w),out=(Room:w) addword a,Offset,Offset moveword OrigFont,T_NewFont shortm moveword OrigFont+2,T_NewAddStyle moveword OrigFont+3,T_NewSize moveword OrigColor,T_NewColor longm addword Offset,TextSize,Offset call T_InsertFont,in=(ParagNo:w,Offset:w,#1:w),out=(a:w) addword a,TextSize,a addword a,Room,CharCount stz T_FontFlags tool _DisposeHandle,in=(Hdl:l) RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_GetObject (ParagNo:w,LineNo:w) : ObjHdl:l ; T_GetObject PROC EXPORT ;Using P_ObjData ;Using T_TextEqu INPUT ParagNo:w,LineNo:w OUTPUT ObjHdl:l LOCAL ParagPtr:l,ObjPtr:l,NextObj:l BEGIN rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_ObjHdl,ObjHdl While cpzl ObjHdl beq Exit movelong [ObjHdl],ObjPtr cmpw ParagNo,[ObjPtr]:#P_EndParag blt Exit bne Cont cmpw LineNo,[ObjPtr]:#P_EndLine blt Exit Cont movelong [ObjPtr]:#P_NThread,ObjHdl bra While Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_TopLine (ParagNo:w,LineNo:w) : ObjHdl:l,VertPos:w ; T_TopLine PROC EXPORT ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,LineNo:w OUTPUT ObjHdl:l,VertPos:w LOCAL ObjPtr:l,ParagPtr:l,CurLine:w BEGIN call T_GetObject,in=(ParagNo:w,LineNo:w),out=(ObjHdl:l) rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_StartParag,ParagNo beq First moveword [ParagPtr]:#T_ParStart,VertPos stz CurLine bra LineLoop First moveword [ObjPtr]:#P_StartLine,CurLine stz VertPos LineLoop cmpw CurLine,LineNo bge Exit call T_LineHeight,in=(ParagNo:w,CurLine:w),out=(a:w) addword a,VertPos,VertPos inc CurLine bra LineLoop Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_LineHeight (ParagNo:w,LineNo:w) : Height:w ; T_LineHeight PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,LineNo:w OUTPUT Height:w LOCAL LinePtr:l,Ascent:w,Descent:w BEGIN rcall T_GetLinePtr,in=(ParagNo:a,LineNo:x),out=(LinePtr:ax) moveword [LinePtr]:#T_Ascent,a and #$ff sta Ascent moveword [LinePtr]:#T_Descent,a and #$ff sta Descent rcall T_GetRulBits,in=(ParagNo:a),out=(a:a) rcall T_GetSpacing,in=(a:a,Ascent:x,Descent:y) addword a,Ascent,a addword a,Descent,Height RETURN ENDP ;------------------------------------------------------------------------------- ; ;T_InvertObj (ObjHdl:l,StartPar:w,StartLine:w,StartPixs:w ; EndPar:w,EndLine:w,EndPixs:w) T_InvertObj PROC EXPORT ;Using P_ObjData ;Using P_Data ;Using T_Data ;Using T_TextEqu INPUT ObjHdl:l INPUT StartPar:w,StartLine:w,StartPixs:w INPUT EndPar:w,EndLine:w,EndPixs:w LOCAL ObjPtr:l,ObjRect:r,InvRect:r LOCAL StartTop:w,StartHeight:w,EndTop:w,EndHeight:w BEGIN movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_PageNo,P_Page jne Exit moverect [ObjPtr]:#P_TRect,ObjRect pushlong !ObjRect subword P_ContentRect+2,P_H,s subword P_ContentRect,P_V,s _OffsetRect call T_TopLine,in=(StartPar:w,StartLine:w),out=(a:l,StartTop:w) call T_LineHeight,in=(StartPar:w,StartLine:w),out=(StartHeight:w) cmpw StartLine,EndLine bne MultLines cmpw StartPar,EndPar bne MultLines addword ObjRect,StartTop,InvRect addword a,StartHeight,InvRect+4 addword ObjRect+2,StartPixs,InvRect+2 addword ObjRect+2,EndPixs,InvRect+6 tool _InvertRect,in=(!InvRect:l) brl Exit MultLines call T_TopLine,in=(EndPar:w,EndLine:w),out=(a:l,EndTop:w) call T_LineHeight,in=(EndPar:w,EndLine:w),out=(EndHeight:w) addword ObjRect,StartTop,InvRect addword a,StartHeight,InvRect+4 addword ObjRect+2,StartPixs,InvRect+2 moveword ObjRect+6,InvRect+6 tool _InvertRect,in=(!InvRect:l) moveword InvRect+4,InvRect addword ObjRect,EndTop,InvRect+4 cmpw InvRect,InvRect+4 beq NoMiddle moveword ObjRect+2,InvRect+2 moveword ObjRect+6,InvRect+6 tool _InvertRect,in=(!InvRect:l) NoMiddle moveword InvRect+4,InvRect addword a,EndHeight,InvRect+4 moveword ObjRect+2,InvRect+2 addword a,EndPixs,InvRect+6 tool _InvertRect,in=(!InvRect:l) Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_InvertArea (StartObj:l,StartPar:w,StartLine:w,StartPixs:w, ; EndObj:l,EndPar:w,EndLine:w,EndPixs:w); ; T_InvertArea PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu INPUT StartObj:l,StartPar:w,StartLine:w,StartPixs:w INPUT EndObj:l,EndPar:w,EndLine:w,EndPixs:w LOCAL CurObj:l,CurPtr:l,ParagPtr:l LOCAL Par1:w,Line1:w,Pixs1:w,Par2:w,Line2:w,Pixs2:w BEGIN cmpw StartPar,EndPar blt NoSwap bne Swap cmpw StartLine,EndLine blt NoSwap bne Swap cmpw StartPixs,EndPixs blt NoSwap jeq Exit Swap pushlong StartObj movelong EndObj,StartObj pulllong EndObj ldx StartPar moveword EndPar,StartPar stx EndPar ldx StartLine moveword EndLine,StartLine stx EndLine ldx StartPixs moveword EndPixs,StartPixs stx EndPixs NoSwap movelong StartObj,CurObj ObjLoop cpzl CurObj jeq Exit movelong [CurObj],CurPtr cmpl CurObj,StartObj beq FirstObj moveword [CurPtr]:#P_StartParag,Par1 moveword [CurPtr]:#P_StartLine,Line1 stz Pixs1 bra SetEnd FirstObj moveword StartPar,Par1 moveword StartLine,Line1 moveword StartPixs,Pixs1 SetEnd cmpl CurObj,EndObj bne UseEnd call T_OffThread,in=(EndPar:w,EndLine:w),out=(a:w) bne UseEnd moveword EndPar,Par2 moveword EndLine,Line2 moveword EndPixs,Pixs2 bra DoCall UseEnd moveword [CurPtr]:#P_EndParag,Par2 moveword [CurPtr]:#P_EndLine,Line2 subword [CurPtr]:#P_TRect+6,[CurPtr]:#P_TRect+2,Pixs2 lda Line2 beq PrevPar dec Line2 bra DoCall PrevPar lda Par2 beq DoCall dec Par2 rcall T_GetParPtr,in=(Par2:a),out=(ParagPtr:ax) subword [ParagPtr]:#T_LineCount,#1,Line2 DoCall in CurObj:l,Par1:w,Line1:w,Pixs1:w in Par2:w,Line2:w,Pixs2:w xcall T_InvertObj cmpl CurObj,EndObj beq Exit movelong [CurObj],CurPtr movelong [CurPtr]:#P_NThread,CurObj brl ObjLoop Exit RETURN ENDP ;------------------------------------------------------------------------------; ; T_InvSelect () ; ; Inverts the area described by the active globals. T_InvSelect PROC EXPORT ;Using T_Data lda T_TextSelect beq @NoSelect in T_DotObj:l,T_DotParag:w,T_DotOffset:w,T_DotLine:w out T_DotPixs:w xcall T_Offset2Pix in T_MarkObj:l,T_MarkParag:w,T_MarkOffset:w,T_MarkLine:w out T_MarkPixs:w xcall T_Offset2Pix in T_DotObj:l,T_DotParag:w,T_DotLine:w,T_DotPixs:w in T_MarkObj:l,T_MarkParag:w,T_MarkLine:w,T_MarkPixs:w xcall T_InvertArea bra Exit @NoSelect jsl T_EraseCaret Exit rtl ENDP ;----------------------------------------------------------------------------- ; ; T_OffThread (ParagNo:w,Q_Line:w) : Off:w ; ; Returns true if the position described by the inputs is not in an object. T_OffThread PROC EXPORT ;Using P_ObjData ;Using T_TextEqu ;Using T_Data INPUT ParagNo:w,Q_Line:w OUTPUT Off:w LOCAL ParagPtr:l,ObjHdl:l,ObjPtr:l LOCAL EndParag:w,EndLine:w BEGIN stz Off rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_ObjHdl,ObjHdl ObjLoop movelong [ObjHdl],ObjPtr moveword [ObjPtr]:#P_EndParag,EndParag bmi Exit moveword [ObjPtr]:#P_EndLine,EndLine cmpw EndParag,ParagNo blt TryNext bne Exit cmpw Q_Line,EndLine blt Exit TryNext movelong [ObjPtr]:#P_NThread,ObjHdl cpzl ObjHdl bne ObjLoop inc Off Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_MovedDot () ; ; Call this routine to D_Update the position of the D_Cursor. T_MovedDot PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data ;Using T_TextEqu LOCAL ObjHdl:l,ObjPtr:l BEGIN in T_DotParag:w,T_DotOffset:w out T_DotObj:l,T_DotLine:w xcall T_Offset2Line call T_OffThread,in=(T_DotParag:w,T_DotLine:w),out=(a:w) beq NoDeact call T_Deactivate,in=(#1:w,#1:w) bra Exit NoDeact lda T_TextSelect bne DoRul movelong T_DotObj,ObjHdl movelong [ObjHdl],ObjPtr cmpw [ObjPtr]:#P_PageNo,P_Page beq DoRul call P_ChangePage,in=(a:w,#1:w) DoRul call T_DrawRuler Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_PadThread (ObjHdl:l,VertPos:w) ; T_PadThread PROC EXPORT ;Using P_Data ;Using P_ObjData INPUT ObjHdl:l,VertPos:w LOCAL ObjPtr:l,MaxVert:w BEGIN movelong [ObjHdl],ObjPtr subword [ObjPtr]:#P_TRect+4,[ObjPtr]:#P_TRect,MaxVert cmpw VertPos,MaxVert bge Loop lda #$FFFF moveword a,[ObjPtr]:#P_EndParag moveword a,[ObjPtr]:#P_EndLine Loop movelong [ObjPtr]:#P_NThread,ObjHdl cpzl ObjHdl beq EndLoop movelong [ObjHdl],ObjPtr lda #$FFFF moveword a,[ObjPtr]:#P_StartParag moveword a,[ObjPtr]:#P_StartLine moveword a,[ObjPtr]:#P_EndParag moveword a,[ObjPtr]:#P_EndLine bra Loop EndLoop RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/TUTIL2.S b/appleworksgs/PL/Src/TUTIL2.S new file mode 100755 index 0000000..6ed8738 --- /dev/null +++ b/appleworksgs/PL/Src/TUTIL2.S @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'pl.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_GrowHandle IMPORT T_GetParPtr IMPORT T_OffsetPars ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY T_LessRoom ENTRY T_MakeRoom ; ------------------------------------------------------------------------------ ; T_MakeRoom and T_LessRoom will grow or shrink the Q_Text blocks the ; correct amount and make sure everything in the parag array data ; structure gets updated, with the exception of the LinesHdl. ; ;------------------------------------------------------------------------------ ; ; T_DoRoom (Par:w,Offset:w,Bytes:w) ; T_DoRoom PROC EXPORT lda 4,s ;look at bytes jpl T_MakeRoom eor #$ffff inc a sta 4,s brl T_LessRoom ENDP ;------------------------------------------------------------------------------ ; ; T_MakeRoom (ParagNo:w,Offset:w,Bytes:w) ; T_MakeRoom PROC EXPORT ;Using T_Data ;Using T_TextEqu INPUT ParagNo:w,Offset:w,Bytes:w LOCAL ParagPtr:l,TextHdl:l,TextPtr:l LOCAL X_Blocksize:w,TextSize:w,NewTSize:w ERROR Err BEGIN stz Err lda Bytes jeq Exit rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_TextBlock,TextHdl addword [ParagPtr]:#T_ParOffset,Offset,Offset movelong [TextHdl],TextPtr moveword [TextPtr],X_Blocksize moveword [TextPtr]:#T_TextSize,TextSize addword a,Bytes,NewTSize cmp X_Blocksize blt Fits ; 1. Grow Q_Text Block call D_GrowHandle,in=(#0:w,NewTSize:w,TextHdl:l),err=(Err) bcs Exit movelong [TextHdl],TextPtr moveword NewTSize,[TextPtr] ; BlockMove rest of Q_Text down Fits moveword NewTSize,[TextPtr]:#T_TextSize addwl Offset,TextPtr pushlong TextPtr lda Bytes addlong a,TextPtr,s pushword #0 subword TextSize,Offset,s _BlockMove call T_OffsetPars,in=(ParagNo:w,Bytes:w) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_LessRoom (ParagNo:w,Offset:w,Bytes:w) ; ; This routine will remove the Bytes starting at ParagNo,Offset. T_LessRoom PROC EXPORT ;Using T_TextEqu INPUT ParagNo:w,Offset:w,Bytes:w LOCAL ParagPtr:l,TextBlock:l,TextPtr:l LOCAL TextSize:w,SrcOffset:w,DestOffset:w BEGIN rcall T_GetParPtr,in=(ParagNo:a),out=(ParagPtr:ax) movelong [ParagPtr]:#T_TextBlock,TextBlock movelong [TextBlock],TextPtr moveword [TextPtr]:#T_TextSize,TextSize addword [ParagPtr]:#T_ParOffset,Offset,DestOffset addword a,Bytes,SrcOffset addlong a,TextPtr,s ;Src lda DestOffset addlong a,TextPtr,s ;Dest subword TextSize,SrcOffset,a pushword #0 pushword a ;Amount _BlockMove subword TextSize,Bytes,TextSize cmp #4 beq KillIt moveword a,[TextPtr] moveword a,[TextPtr]:#T_TextSize pushword #0 pushword TextSize pushlong TextBlock _SetHandleSize pushword ParagNo subword #0,Bytes,s jsl T_OffsetPars bra Exit KillIt tool _DisposeHandle,in=(TextBlock:l) Exit RETURN ENDP ;------------------------------------------------------------------------------- ; ; T_CalcFBytes (FontId1:l,Color1:w,FontId2:l,Color2:w) : Bytes:w ; T_CalcFBytes PROC EXPORT INPUT FontID1:l,Color1:w,FontID2:l,Color2:w OUTPUT Bytes:w BEGIN stz Bytes cmpw FontId1,FontID2 beq SameFont moveword #3,bytes SameFont cmpb FontId1+2,FontId2+2 beq SameStyle addword #2,bytes,bytes SameStyle cmpb FontId1+3,FontId2+3 beq SameSize addword #2,bytes,bytes SameSize cmpb color1,color2 beq SameColor addword #2,bytes,bytes SameColor RETURN ENDP ;------------------------------------------------------------------------------ ; ; T_WriteFbytes (Ptr:l,FontId1:l,Color1:w,FontId2:l,Color2:w) ; T_WriteFBytes PROC EXPORT INPUT Ptr:l,FontID1:l,Color1:w,FontID2:l,Color2:w BEGIN cmpw FontId1,FontID2 beq SameFont moveword #1,[Ptr] moveword FontId2,[Ptr]:#1 addwl #3,Ptr SameFont cmpb FontId1+2,FontId2+2 beq SameStyle lda FontId2+1 ;2 is in the high shortm lda #2 ;flag is in the low longm sta [Ptr] addwl #2,Ptr SameStyle cmpb FontId1+3,FontId2+3 beq SameSize lda FontId2+2 ;3 is in the high shortm lda #3 ;flag is in the low longm sta [Ptr] addwl #2,Ptr SameSize cmpb color1,color2 beq SameColor lda color2-1 ;2 is in the high shortm lda #4 ;flag is in the low longm sta [Ptr] SameColor RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/pdata.s b/appleworksgs/PL/Src/pdata.s new file mode 100755 index 0000000..3f275de --- /dev/null +++ b/appleworksgs/PL/Src/pdata.s @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT P_BringFront,P_SendBack IMPORT P_ChangeAll,P_DoFont IMPORT P_ChgGuideMag,P_GotoPage,P_SetPageNo IMPORT P_ChgGuideVis,P_SetGuides,P_ChgGuideLock IMPORT P_ChgTemplate,P_ChgTmplCount IMPORT P_ChgView,P_ChgPalVis,P_ChgRulerVis IMPORT P_DoColor IMPORT P_DoSize IMPORT P_DoStyle,T_Upper,T_Lower,T_Capit IMPORT P_FlipHoriz,P_FlipVert IMPORT P_InsertPages,P_DeletePage IMPORT P_Left,P_Center,P_Right,P_Full IMPORT P_RotateLeft,P_RotateRight IMPORT P_SelectAll,P_Duplicate IMPORT P_SetSpacing IMPORT P_SingleSpace,P_DoubleSpace,P_TripleSpace IMPORT P_KillLMasterStr,P_CancelStr,P_OKStr,P_InsText1Msg IMPORT P_InsText2Msg,P_RCtlMsg1,P_RCtlMsg2,P_RCtlMsg3 IMPORT P_DelText1Msg,P_DelText2Msg,P_GotoTextMsg IMPORT P_PNumMsg,P_LRMsg,P_TBMsg,P_ColMsg,P_CSMsg ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_0Msg ENTRY P_25Msg ENTRY P_5Msg ENTRY P_ArrangeMenu ENTRY P_CS_25 ENTRY P_Col_1 ENTRY P_Col_1Msg ENTRY P_Col_2Msg ENTRY P_ColorMenuTab ENTRY P_DPagesFr ENTRY P_ExEditList ENTRY P_FontMenuTab ENTRY P_GotoOK ENTRY P_InchMsg ENTRY P_InitCol ENTRY P_InitMarg ENTRY P_InsOK ENTRY P_InsText2 ENTRY P_LRTxt ENTRY P_LR_25 ENTRY P_LR_LE ENTRY P_MLastBList ENTRY P_MenuBitList ENTRY P_MenuList ENTRY P_MenuProcList ENTRY P_OptionsMenu ENTRY P_Pages1 ENTRY P_Pages2 ENTRY P_Pages3 ENTRY P_Pages4 ENTRY P_PagesPN ENTRY P_SampTitle ENTRY P_SelAll ENTRY P_SgAdd ENTRY P_SwinEND ENTRY P_TB_25 ENTRY P_TextMenu EXPORT P_NoUndo EXPORT P_ID,P_VNum,P_VersNum EXPORT P_FillUndo,P_PenSizeUndo,P_MoveUndo,P_CropUndo,P_StretchUndo EXPORT P_FontUndo,P_FontIDUndo,P_StyleUndo,P_SizeUndo,P_ColorUndo EXPORT P_ClearTextUndo,P_CUtTextUndo,P_ClearObjUndo,P_CutObjUndo EXPORT P_TypeUndo,P_GuideUndo EXPORT LightGray,DarkGray,LightGrey,DarkGrey,CheckMark EXPORT P_FrontBit,P_BackBit,P_FlipHBit,P_FlipVBit,P_RotLBit,P_RotRBit EXPORT P_DefaultArrange,P_AllArrange,P_ObjArrange EXPORT P_ViewPageBit,P_HidePaletteBit,P_HideRulerBit,P_HideGuideBit,P_SetGuideBit,P_LockGuideBit,P_MagGuideBit,P_GoToPageBit,P_SetNumBit,P_UseTempBit,P_DblPageBit EXPORT P_AllOptions,P_DefaultOpt EXPORT P_ViewPageItem,P_HidePaletteItem,P_HideRulerItem,P_HideGuideItem,P_SetGuideItem,P_LockGuideItem,P_MagGuideItem,P_GotoPageItem,P_SetNumItem,P_UseTempItem,P_DblPageItem EXPORT P_AllText,P_DefaultText EXPORT P_LeftBit,P_CenterBit,P_RightBit,P_FullBit,P_SingleSpBit,P_1_5SpBit,P_DoubleSpBit,P_SetSpBit EXPORT P_LeftItem,P_CenterItem,P_RightItem,P_FullItem,P_SingleItem,P_DoubleItem,P_TripleItem,P_SetSItem EXPORT P_DefaultEdit,P_ObjEdit,P_TextEdit,P_EditAll EXPORT P_SelectAllBit,P_DuplicateBit,P_InsertBit,P_DeleteBit EXPORT P_MinHeight EXPORT P_MaxPages EXPORT P_MenuColor,P_MenuStyle,P_MenuSize,P_MenuFont,P_MenuFormat,P_MenuArrange,P_MenuOptions,P_MenuEdit,P_MenuFile,P_MenuApple EXPORT MargGuide,ColGuide,RulerGuide EXPORT P_MaxTabCount,P_LeftTab,P_DecimalTab,P_RightTab,P_IndentTab,P_MinTabDist EXPORT P_ALPHA,P_ARROW,P_BLHDL,P_BRHDL,P_CIRCLE,P_COLORATTR,P_DATETOOL,P_DELETED,P_ENDLINE EXPORT P_ENDPARAG,P_FONTATTR,P_ITEMCOLOR,P_ITEMFONTID,P_LINE,P_MOVEMENT,P_NEXT,P_NTHREAD EXPORT P_OBJCOLOR,P_OBJFILLED,P_OBJRECT,P_PAGENO,P_PAGETOOL,P_PARAGHDL,P_PENSIZE,P_PICTHANDLE EXPORT P_PICTRECT,P_PICTURE,P_PREV,P_PTHREAD,P_RECTANGLE,P_RLEFT,P_RRIGHT,P_SELECTED EXPORT P_SIZEATTR,P_STARTLINE,P_STARTPARAG,P_STRLINE,P_STYLEATTR,P_TEXTOBJSIZE,P_TLHDL EXPORT P_TRECT,P_TRHDL,P_TYPE,P_UNDODATA EXPORT PL_SelRect,PL_DeselectAll,PL_SelectAll,PL_FixTObj,PL_OffsetObj EXPORT PL_AddUpdate,PL_ClrUndoData,PL_SetUndoData,PL_CpyUndoData include 'pl.equ' P_ATTRData PROC EXPORT EXPORT P_AttrTable EXPORT P_MenuList EXPORT P_ArrangeMenu EXPORT P_OptionsMenu EXPORT P_VPage EXPORT P_HPalette EXPORT P_HRulers EXPORT P_HGuides EXPORT P_SetGuidez EXPORT P_LGuides EXPORT P_MGuides EXPORT P_Go2Page EXPORT P_SetNum EXPORT P_NTemplate EXPORT P_SPTempl EXPORT P_NPage EXPORT P_SPalette EXPORT P_SRulers EXPORT P_SGuides EXPORT P_ULGuides EXPORT P_UTemplate EXPORT P_DPTempl EXPORT P_TextMenu EXPORT P_ExEditList EXPORT P_SelAll EXPORT P_Dup EXPORT P_InstPg EXPORT P_DelPg EXPORT P_MenuBitList EXPORT P_MLastBList EXPORT P_MenuProcList EXPORT P_ArrangeMenuTab EXPORT P_FontMenuTab EXPORT P_SizeMenuTab EXPORT P_StyleMenuTab EXPORT P_ColorMenuTab EXPORT P_ExEditTable EXPORT P_OptMenutab EXPORT P_FmtMenuTab EXPORT P_SampTitle P_AttrTable DC.L P_MenuList ;list of applications menus DC.L P_MenuProcList ;ptrs to procs for each menu DC.L P_MenuBitList ;bit descriptions of above] DC.L P_MLastBList ;the last menu bit*2 for each menu DC.L P_ExEditList ;extra edit items, can be 0 DC.L 0 ;default undo string, can be 0 DC.L P_SampTitle DC.W 0 ; no buttons DS.B 8 ; no button space P_SampTitle str ' (PL) ' ; menus are inserted backwards P_MenuList DC.L ColorMenu+9 ;menu 9 DC.L StyleMenu+8 ;menu 8 DC.L SizeMenu+7 ;menu 7 DC.L FontMenu+6 ;menu 6 DC.L P_TextMenu ;menu 5 DC.L P_ArrangeMenu ;menu A DC.L P_OptionsMenu ;menu 4 ; Edit Menu 3 ; File Menu 2 ; Menu 1 DC.L 0 P_ArrangeMenu DC.B '> Arrange \N10' DC.B cr DC.B ' Bring to Front\*+=H' DC.W $A01 DC.B cr DC.B ' Send to Back\*-_VH' DC.W $A02 DC.B cr DC.B ' Flip Horizontal\H' DC.W $A03 DC.B cr DC.B ' Flip Vertical\H' DC.W $A04 DC.B cr DC.B ' Rotate Left\H' DC.W $A05 DC.B cr DC.B ' Rotate Right\H' DC.W $A06 DC.B cr DC.B '.' P_OptionsMenu DC.B '> Options \N4' DC.B cr P_VPage DC.B ' Fit in Window\*WwVH' DC.W $401 DC.B cr P_HPalette DC.B ' Hide Tools\H' DC.W $402 DC.B cr P_HRulers DC.B ' Hide Rulers\H' DC.W $403 DC.B cr P_HGuides DC.B ' Hide Guides\VH' DC.W $404 DC.B cr P_SetGuidez DC.B ' Set Guides\H' DC.W $405 DC.B cr P_LGuides DC.B ' Lock Guides\H' DC.W $406 DC.B cr P_MGuides DC.B ' Magnetic Guides\VH' DC.W $407 DC.B cr P_Go2Page DC.B ' Go to page\*GgH' DC.W $408 DC.B cr P_SetNum DC.B ' Set First Page\VH' DC.W $409 DC.B cr P_NTemplate DC.B ' Ignore Master Page\H' DC.W $40A DC.B cr P_SPTempl DC.B ' Single Master Page\H' DC.W $40B DC.B cr DC.B '.' P_NPage DC.B ' Actual Size\*WwVH' DC.W $401 DC.B cr P_SPalette DC.B ' Show Tools\H' DC.W $402 DC.B cr P_SRulers DC.B ' Show Rulers\H' DC.W $403 DC.B cr P_SGuides DC.B ' Show Guides\VH' DC.W $404 DC.B cr P_ULGuides DC.B ' Unlock Guides\H' DC.W $406 DC.B cr P_UTemplate DC.B ' Use Master Page\H' DC.W $40A DC.B cr P_DPTempl DC.B ' Left/Right Master Pages\H' DC.W $40B DC.B cr P_TextMenu DC.B '> Text \N5' DC.B cr DC.B ' Left\CH' DC.W $501 DC.B cr DC.B ' Center\H' DC.W $502 DC.B cr DC.B ' Right\H' DC.W $503 DC.B cr DC.B ' Full\VH' DC.W $504 DC.B cr DC.B ' Single Space\CH' DC.W $505 DC.B cr DC.B ' 1-1/2 Space\H' DC.W $506 DC.B cr DC.B ' Double Space\H' DC.W $507 DC.B cr DC.B ' Set Spacing\H' DC.W $508 DC.B cr DC.B '.' P_ExEditList DC.L P_SelAll,P_Dup,P_InstPg,P_DelPg,0 P_SelAll DC.B ' Select All\*AaH' DC.W ExEditStart DC.B cr P_Dup DC.B ' Duplicate\*DdVH' DC.W ExEditStart+1 DC.B cr P_InstPg DC.B ' Insert Page(s)\H' DC.W ExEditStart+2 DC.B cr P_DelPg DC.B ' Delete Page(s)\H' DC.W ExEditStart+3 DC.B cr P_MenuBitList DS.B 4 ; skips zero and one DC.W FileStandard ; file menu DC.W P_DefaultEdit DC.W P_DefaultOpt DC.W P_DefaultText DC.W 1 ; font menu DC.W 1 ; size menu DC.W 1 ; style menu DC.W 1 ; color menu DC.W P_DefaultArrange P_MLastBList DS.B 4 ;skip menu0 D_Menu1 DC.W QuitBit<<1 DC.W P_DeleteBit<<1 DC.W P_DblPageBit<<1 DC.W P_SetSpBit<<1 DC.W 0 DC.W 0 DC.W 0 DC.W 0 DC.W P_RotRBit<<1 P_MenuProcList DC.L 0,0,P_ExEditTable,P_OptMenuTab,P_FmtMenuTab DC.L P_FontMenuTab,P_SizeMenuTab,P_StyleMenuTab DC.L P_ColorMenuTab,P_ArrangeMenuTab P_ArrangeMenuTab DC.L P_BringFront,P_SendBack DC.L P_FlipHoriz,P_FlipVert DC.L P_RotateLeft,P_RotateRight P_FontMenuTab DC.L P_ChangeAll,P_DoFont P_SizeMenuTab DC.L P_DoSize,0,0 P_StyleMenuTab DC.L P_DoStyle,T_Upper,T_Lower,T_Capit P_ColorMenuTab DC.L P_DoColor P_ExEditTable DC.L 0,0,0,0,0 DC.L P_SelectAll,P_Duplicate DC.L P_InsertPages,P_DeletePage P_OptMenutab DC.L P_ChgView,P_ChgPalVis,P_ChgRulerVis DC.L P_ChgGuideVis,P_SetGuides,P_ChgGuideLock DC.L P_ChgGuideMag,P_GotoPage,P_SetPageNo DC.L P_ChgTemplate,P_ChgTmplCount P_FmtMenuTab DC.L P_Left,P_Center,P_Right,P_Full DC.L P_SingleSpace,P_DoubleSpace,P_TripleSpace DC.L P_SetSpacing ENDP ;--------------------------------------------------------------------------- P_Data PROC EXPORT EXPORT P_SwinParams EXPORT P_Plane EXPORT P_SwinEND EXPORT P_WindColors EXPORT P_FrameColor EXPORT P_TitleColor EXPORT P_TBarColor EXPORT P_GrowColor EXPORT P_InfoBarColor EXPORT P_HScrTempl EXPORT P_HValue EXPORT P_HViewSize EXPORT P_HDataSize EXPORT P_VScrTempl EXPORT P_VValue EXPORT P_VViewSize EXPORT P_VDataSize EXPORT P_PageDlog EXPORT P_InsOK EXPORT P_InsCancel EXPORT P_InsText1 EXPORT P_InsText2 EXPORT P_InsPgCnt EXPORT P_Pages1 EXPORT P_RCtl1 EXPORT P_RCtl2 EXPORT P_RCtl3 EXPORT P_DPageDlog EXPORT P_DelOK EXPORT P_DelCancel EXPORT P_DelText1 EXPORT P_DelText2 EXPORT P_DPagesTo EXPORT P_Pages3 EXPORT P_DPagesFr EXPORT P_Pages4 EXPORT P_Go2PDlog EXPORT P_GotoOK EXPORT P_GotoCancel EXPORT P_GotoText EXPORT P_GotoPgCnt EXPORT P_Pages2 EXPORT P_PNumDlog EXPORT P_PNumText EXPORT P_PNumCnt EXPORT P_PagesPN EXPORT P_SGuideDlog EXPORT P_SgAdd EXPORT P_SgCancel EXPORT P_LR_LE EXPORT P_InitMarg EXPORT P_TB_LE EXPORT P_Col_LE EXPORT P_InitCol EXPORT P_CS_LE EXPORT P_LR_25 EXPORT P_25Msg EXPORT P_LR_5 EXPORT P_5Msg EXPORT P_LR_0 EXPORT P_InchMsg EXPORT P_TB_25 EXPORT P_TB_5 EXPORT P_TB_0 EXPORT P_Col_1 EXPORT P_Col_1Msg EXPORT P_Col_2 EXPORT P_Col_2Msg EXPORT P_Col_0 EXPORT P_0Msg EXPORT P_CS_25 EXPORT P_CS_5 EXPORT P_CS_0 EXPORT P_LRTxt EXPORT P_TBTxt EXPORT P_ColTxt EXPORT P_CSTxt EXPORT P_LineRects EXPORT P_Mask EXPORT P_TrackMaskVert EXPORT P_TrackMaskHorz EXPORT P_CurrentWin EXPORT P_NotActive EXPORT P_Placing EXPORT P_ImportType EXPORT P_ImportHdl EXPORT P_ThreadHdl EXPORT P_ThreadDir EXPORT P_HotRect EXPORT P_SpecStr EXPORT P_OldClip EXPORT P_NewClip EXPORT P_Pattern EXPORT P_OldIdlePt EXPORT P_PastePt EXPORT P_Header EXPORT P_Version EXPORT P_WindowStuff EXPORT P_Palette EXPORT P_TrackOn EXPORT P_LineSize EXPORT P_FillMode EXPORT P_VisRuler EXPORT P_VisPalette EXPORT P_PageMode EXPORT P_Cursor EXPORT P_ToolType EXPORT P_DblPage EXPORT P_PageCount EXPORT P_PageArray EXPORT P_Page EXPORT P_FirstPOff EXPORT P_PageStart EXPORT P_PrintHand EXPORT P_PageRect EXPORT P_PaperRect EXPORT P_FullPageRect EXPORT P_FullPaperRect EXPORT P_HRulRect EXPORT P_VRulRect EXPORT P_OrgOffset EXPORT P_V EXPORT P_H EXPORT P_VScroll EXPORT P_HScroll EXPORT P_ContentRect EXPORT P_GrowRect EXPORT P_PIconRect EXPORT P_PortRect EXPORT P_VisGuides EXPORT P_LockGuides EXPORT P_MagGuides EXPORT P_DefSpacing EXPORT P_DefJust EXPORT P_DefFont EXPORT P_DefStyle EXPORT P_DefSize EXPORT P_DefColor EXPORT P_AllHGuides EXPORT P_AllVGuides EXPORT P_AllHGCount EXPORT P_AllVGCount EXPORT P_CurDate EXPORT P_StoreV EXPORT P_StoreH EXPORT P_Reserved EXPORT P_PageInfo EXPORT P_ObjList EXPORT P_LastObj EXPORT P_VertGuides EXPORT P_HorizGuides EXPORT P_VertGCount EXPORT P_HorizGCount EXPORT P_UseTemplate EXPORT P_EndofInfo EXPORT P_HeaderSize,P_InfoSize,P_WinStuffSize,P_PInfoSize P_DefaultWinTitle STR 'P' P_SwinParams DC.W P_SwinEND-P_SwinParams ; Parameter block length DC.W fZoomed+fCtlTie+fQContent+fMove+fZoom+fFlex+fClose+fTitle P_TitlePtr DC.L P_DefaultWinTitle ; Title DC.L 2 ; RefCon DC.W P_WinTop,P_WinLeft ; Window 'full' size DC.W P_WinTop+P_WinHeight,P_WinLeft+P_WinWidth DC.L 0 ; Color table pointer (default) DC.W 0,0 ; Effective TM origin DC.W 180,0 ; DATA size (GUESS) 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 DC.W P_WinTop,P_WinLeft DC.W P_WinHeight+P_WinTop,P_WinWidth+P_WinLeft P_Plane DC.L $FFFFFFFF ; Starting plane (front) DC.L 0 ; Address (any) P_SwinEND P_WindColors P_FrameColor DS.B 2 P_TitleColor DS.B 2 P_TBarColor DS.B 2 P_GrowColor DS.B 2 P_InfoBarColor DS.B 2 DS.B 10 P_HScrTempl DC.W 0,0,0,0 ; these are filled in before use DC.L 0 DC.W horScroll+leftFlag+rightFlag P_HValue DC.W 0 P_HViewSize DC.W 5 P_HDataSize DC.W 20 DC.L scrollProc DC.L 1 DC.L 0 P_VScrTempl DC.W 0,0,0,0 ; these are filled in before use DC.L 0 DC.W downFlag+upFlag P_VValue DC.W 0 P_VViewSize DC.W 5 P_VDataSize DC.W 20 DC.L scrollProc DC.L 2 DC.L 0 ;--------------------------------------------------------------------------- ; Insert Pages Dialog ; ; 1 = OK ; 2 = Cancel ; 3 = 'Insert' ; 4 = pages ; 5 = 'page(s)' ; 6 = () at the beginning. ; 7 = () after the current page. ; 8 = () at the end. P_PageDlog DC.W 48,185,136,462 DC.W 1 ; dialog is visible DC.L 0 DC.L P_InsOK,P_InsCancel,P_InsText1,P_InsPgCnt DC.L P_InsText2,P_RCtl1,P_RCtl2,P_RCtl3 DC.L 0 ; terminator P_InsOK DC.W 1 DC.W 69,165,82,230 DC.W $000A DC.L P_OKStr DC.W 0 DC.W 0 DC.L 0 P_InsCancel DC.W 2 DC.W 69,40,82,105 DC.W $000A DC.L P_CancelStr DC.W 0 DC.W 0 DC.L 0 P_InsText1 DC.W 3 DC.W 10,60,23,110 DC.W $000F DC.L P_InsText1Msg DC.W 0 DC.W 0 DC.L 0 P_InsText2 DC.W 5 DC.W 10,156,23,216 DC.W $800F DC.L P_InsText2Msg DC.W 0 DC.W 0 DC.L 0 P_InsPgCnt DC.W 4 DC.W 8,114,21,150 DC.W $8011 DC.L P_Pages1 DC.W 3 DC.W 0 DC.L 0 P_Pages1 STR '1' P_RCtl1 DC.W 6 DC.W 25,40,35,230 DC.W $000C DC.L P_RCtlMsg1 DC.W 0 DC.W 0 DC.L 0 P_RCtl2 DC.W 7 DC.W 39,40,49,230 DC.W $000C DC.L P_RCtlMsg2 DC.W 1 ; ON -- this is the default. DC.W 0 DC.L 0 P_RCtl3 DC.W 8 DC.W 53,40,63,230 DC.W $000C DC.L P_RCtlMsg3 DC.W 0 DC.W 0 DC.L 0 ;--------------------------------------------------------------------------- ; Delete Pages Dialog ; ; 1 = OK ; 2 = Cancel ; 3 = 'Delete pages' ; 4 = FromPage ; 5 = 'through' ; 6 = ToPage P_DPageDlog DC.W 48,185,117,462 DC.W 1 DC.L 0 DC.L P_DelOK,P_DelCancel,P_DelText1 DC.L P_DPagesFr,P_DelText2,P_DPagesTo DC.L 0 P_DelOK DC.W 1 DC.W 51,165,64,230 DC.W $000A DC.L P_OKStr DC.W 0 DC.W 0 DC.L 0 P_DelCancel DC.W 2 DC.W 51,40,64,105 DC.W $000A DC.L P_CancelStr DC.W 0 DC.W 0 DC.L 0 P_DelText1 DC.W 3 DC.W 10,86,23,191 DC.W $800F DC.L P_DelText1Msg DC.W 0 DC.W 0 DC.L 0 P_DelText2 DC.W 5 DC.W 27,107,40,163 DC.W $800F DC.L P_DelText2Msg DC.W 0 DC.W 0 DC.L 0 P_DPagesTo DC.W 6 DC.W 25,167,38,205 DC.W $8011 DC.L P_Pages3 DC.W 4 DC.W 0 DC.W 0 P_Pages3 STR '1' P_DPagesFr DC.W 4 DC.W 25,65,38,103 DC.W $8011 DC.L P_Pages4 DC.W 4 DC.W 0 DC.W 0 P_Pages4 STR '1' ;--------------------------------------------------------------------------- ; Goto Page Dialog ; ; 1 = OK ; 2 = Cancel ; 3 = 'Go to page' ; 4 = PageCount P_Go2PDlog DC.W 48,185,101,462 DC.W 1 DC.L 0 DC.L P_GotoOK,P_GotoCancel,P_GotoText,P_GotoPgCnt DC.L 0 P_GotoOK DC.W 1 DC.W 34,160,47,230 DC.W $000A DC.L P_OKStr DC.W 0 DC.W 0 DC.L 0 P_GotoCancel DC.W 2 DC.W 34,40,47,110 DC.W $000A DC.L P_CancelStr DC.W 0 DC.W 0 DC.L 0 P_GotoText DC.W 3 DC.W 10,80,23,161 DC.W $800F DC.L P_GotoTextMsg DC.W 0 DC.W 0 DC.L 0 P_GotoPgCnt DC.W 4 DC.W 8,165,21,203 DC.W $8011 DC.L P_Pages2 DC.W 4 DC.W 0 DC.W 0 P_Pages2 STR '1' ;--------------------------------------------------------------------------- ; Set Page Number Dialog ; ; 1 = OK ; 2 = Cancel ; 3 = 'First page number:' ; 4 = PageCount P_PNumDlog DC.W 48,185,101,462 DC.W 1 DC.L 0 DC.L P_GotoOK,P_GotoCancel,P_PNumText,P_PNumCnt DC.L 0 P_PNumText DC.W 3 DC.W 10,40,23,175 DC.W $800F DC.L P_PNumMsg DC.W 0 DC.W 0 DC.L 0 P_PNumCnt DC.W 4 DC.W 8,179,21,217 DC.W $8011 DC.L P_PagesPN DC.W 3 DC.W 0 DC.W 0 P_PagesPN STR '1' DS.B 4 ; extra string space ;--------------------------------------------------------------------------- ; Set Guides Dialog ; ; 1 = OK ; 2 = Cancel ; ; 4 = LR LineEdit ; 5 = TB LineEdit ; 6 = Col LineEdit ; 7 = CS LineEdit ; ; 8 = LR 0.25 inch ; 9 = 0.5 inch ; 10 = LE control ; ; 12 = TB 0.25 inch ; 13 = 0.5 inch ; 14 = LE control ; ; 16 = Col 1 ; 17 = 2 ; 18 = LE control ; ; 20 = CS 0.25 inch ; 21 = 0.5 inch ; 22 = LE control ; ; 24 = L/R Margins ; 25 = T/B Margins ; 26 = Columns ; 27 = Column Spacing ; P_SGuideDlog DC.W 23,140,176,500 DC.W 1 DC.L 0 DC.L P_SgAdd,P_SgCancel DC.L P_LR_LE,P_CS_LE,P_TB_LE,P_Col_LE DC.L P_LR_25,P_LR_5,P_LR_0 DC.L P_TB_25,P_TB_5,P_TB_0 DC.L P_Col_1,P_Col_2,P_Col_0 DC.L P_CS_25,P_CS_5,P_CS_0 DC.L P_LRTxt,P_TBTxt,P_ColTxt,P_CSTxt DC.L 0 ; ; Buttons P_SgAdd DC.W 1 DC.W 131,220,144,305 DC.W buttonItem DC.L P_OKStr DC.W 0 DC.W 0 DC.L 0 P_SgCancel DC.W 2 DC.W 131,50,144,135 DC.W buttonItem DC.L P_CancelStr DC.W 0 DC.W 0 DC.L 0 ; ; LineEdits P_LR_LE DC.W 4 DC.W 47,76,60,116 DC.W editLine DC.L P_InitMarg DC.W 4 DC.W 0 DC.W 0 P_InitMarg STR '1.0' P_TB_LE DC.W 5 DC.W 107,76,120,116 DC.W editLine DC.L P_InitMarg DC.W 4 DC.W 0 DC.W 0 P_Col_LE DC.W 6 DC.W 47,256,60,276 DC.W editLine DC.L P_InitCol DC.W 1 DC.W 0 DC.W 0 P_InitCol STR '3' P_CS_LE DC.W 7 DC.W 107,256,120,296 DC.W editLine DC.L P_InitMarg DC.W 4 DC.W 0 DC.W 0 ; ; Radio Controls P_LR_25 DC.W 8 DC.W 23,50,33,155 DC.W radioItem DC.L P_25Msg DC.W 1 DC.W 8 DC.L 0 P_25Msg STR '0.25 inch' P_LR_5 DC.W 9 DC.W 36,50,46,155 DC.W radioItem DC.L P_5Msg DC.W 0 DC.W 8 DC.L 0 P_5Msg STR '0.5 inch' P_LR_0 DC.W 10 DC.W 49,50,59,155 DC.W radioItem DC.L P_InchMsg DC.W 0 DC.W 8 DC.L 0 P_InchMsg STR ' inch' P_TB_25 DC.W 12 DC.W 83,50,93,155 DC.W radioItem DC.L P_25Msg DC.W 1 DC.W 12 DC.L 0 P_TB_5 DC.W 13 DC.W 96,50,106,155 DC.W radioItem DC.L P_5Msg DC.W 0 DC.W 12 DC.L 0 P_TB_0 DC.W 14 DC.W 109,50,119,155 DC.W radioItem DC.L P_InchMsg DC.W 0 DC.W 12 DC.L 0 P_Col_1 DC.W 16 DC.W 23,230,33,295 DC.W radioItem DC.L P_Col_1Msg DC.W 1 DC.W 16 DC.L 0 P_Col_1Msg STR '1' P_Col_2 DC.W 17 DC.W 36,230,46,295 DC.W radioItem DC.L P_Col_2Msg DC.W 0 DC.W 16 DC.L 0 P_Col_2Msg STR '2' P_Col_0 DC.W 18 DC.W 49,230,59,255 DC.W radioItem DC.L P_0Msg DC.W 0 DC.W 16 DC.L 0 P_0Msg DC.B 0 P_CS_25 DC.W 20 DC.W 83,230,93,335 DC.W radioItem DC.L P_25Msg DC.W 1 DC.W 20 DC.L 0 P_CS_5 DC.W 21 DC.W 96,230,106,335 DC.W radioItem DC.L P_5Msg DC.W 0 DC.W 20 DC.L 0 P_CS_0 DC.W 22 DC.W 109,230,119,335 DC.W radioItem DC.L P_InchMsg DC.W 0 DC.W 20 DC.L 0 ; ; Static Text P_LRTxt DC.W 24 DC.W 10,30,23,190 DC.W $800F DC.L P_LRMsg DC.W 0 DC.W 0 DC.L 0 P_TBTxt DC.W 25 DC.W 70,30,83,190 DC.W $800F DC.L P_TBMsg DC.W 0 DC.W 0 DC.L 0 P_ColTxt DC.W 26 DC.W 10,215,23,275 DC.W $800F DC.L P_ColMsg DC.W 0 DC.W 0 DC.L 0 P_CSTxt DC.W 27 DC.W 70,215,83,340 DC.W $800F DC.L P_CSMsg DC.W 0 DC.W 0 DC.L 0 ; Various non-refcon globals P_LineRects DC.W 96,1,101,35 ;BOGUS DC.W 100,1,106,35 DC.W 105,1,112,35 DC.W 111,1,119,35 DC.W 118,1,127,35 DC.W 126,1,136,35 DC.W 135,1,146,35 P_Mask DC.B %11001100 DC.B %00110011 DC.B %11001100 DC.B %00110011 DC.B %11001100 DC.B %00110011 DC.B %11001100 DC.B %00110011 P_TrackMaskVert DC.B %00000000 DC.B %11111111 DC.B %00000000 DC.B %11111111 DC.B %00000000 DC.B %11111111 DC.B %00000000 DC.B %11111111 P_TrackMaskHorz DC.B %01100110 DC.B %01100110 DC.B %01100110 DC.B %01100110 DC.B %01100110 DC.B %01100110 DC.B %01100110 DC.B %01100110 ; Various equates ; Globals and refcon data P_CurrentWin DS.B 4 ; Always reflects the window whose refcon data ; ; is on board P_NotActive DS.B 2 ; Don't fuck with the menus because I'm not active P_Placing DS.B 2 ; boolean P_ImportType DS.B 2 ; 0 - Text, 1 - picture P_ImportHdl DS.B 4 ; For Text, this is a ParagHdl. P_ThreadHdl DS.B 4 ; Object to thread to. P_ThreadDir DS.B 4 ; Direction threading P_HotRect DS.B 8 ; Used for hot copy P_SpecStr DS.B 40 ; Used for page and date string building P_OldClip DS.B 4 ; Temp clip rgn handle P_NewClip DS.B 4 ; Temp clip rgn handle P_Pattern DS.B 32 P_OldIdlePt DC.W -20,-20 ; way off screen P_PastePt DC.W -20,-20 ; Where to center the next paste P_Header ;------------------- P_Version DC.W P_VersNum P_WindowStuff ;------------------- P_Palette DS.B 8 ; rectangle of selected palette tool DS.B 4 ; old title ptr space P_TrackOn DS.B 2 P_LineSize DS.B 2 ; pixel height of drawing Line P_FillMode DS.B 2 ; bool - graphic objects filled/hollow P_VisRuler DS.B 2 ; bool - Ruler is visible? P_VisPalette DS.B 2 ; bool - Palette is visible? P_PageMode DS.B 2 ; bool - viewing page? P_Cursor DS.B 2 ; current D_Cursor (over content Rect) P_ToolType DS.B 2 ; tool chosen from palette (0-6) P_DblPage DS.B 2 ; bool - template page mode P_PageCount DS.B 2 ; # pages (1-32767) P_PageArray DS.B 4 ; Handle to array of page infos. P_Page DS.B 2 ; Active Page # P_FirstPOff DS.B 2 ; Offset from actual page to user page #. P_PageStart DS.B 2 ; First visible page icon P_PrintHand DS.B 4 ; Handle to print record P_PageRect DS.B 8 ; Rect with printable interior P_PaperRect DS.B 8 ; Actual size of the damn piece of paper. P_FullPageRect DS.B 8 ; Rect of full page when viewing entire page P_FullPaperRect DS.B 8 ; Rect of full paper when viewing entire page P_HRulRect DS.B 8 ; Horizontal Ruler rectangle P_VRulRect DS.B 8 ; Vertical Ruler rectangle P_OrgOffset ; ; pt. P_V DS.B 2 ; Vertical offset for scrolling (neg) P_H DS.B 2 ; Horizontal offset for scrolling (neg) P_VScroll DS.B 4 ; Ctl Handle P_HScroll DS.B 4 ; Ctl Handle P_ContentRect DS.B 8 ; Visible area of document within window P_GrowRect DS.B 8 P_PIconRect DS.B 8 P_PortRect DS.B 8 P_VisGuides DS.B 2 P_LockGuides DS.B 2 P_MagGuides DS.B 2 P_DefSpacing DS.B 2 ; Default Text spacing P_DefJust DS.B 2 ; Default Text justification P_DefFont DS.B 2 ; Default font family P_DefStyle DS.B 2 ; Default style P_DefSize DS.B 2 ; Default size P_DefColor DS.B 2 ; Default color P_AllHGuides DS.B 4 P_AllVGuides DS.B 4 P_AllHGCount DS.B 2 P_AllVGCount DS.B 2 P_CurDate DS.B 4 P_StoreV DS.B 2 P_StoreH DS.B 2 P_Reserved DS.B 16 P_PageInfo ; ; current page info. ;------------------- P_ObjList DS.B 4 ; Beginning of object linked list P_LastObj DS.B 4 ; Ending of object linked list P_VertGuides DS.B 4 P_HorizGuides DS.B 4 P_VertGCount DS.B 2 P_HorizGCount DS.B 2 P_UseTemplate DS.B 2 ; bool P_EndofInfo P_PINFOSIZE equ P_EndofInfo-P_PageInfo P_WINSTUFFSIZE equ P_EndofInfo-P_WindowStuff P_HEADERSIZE equ P_EndofInfo-P_Header ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/picon.s b/appleworksgs/PL/Src/picon.s new file mode 100755 index 0000000..416bbbc --- /dev/null +++ b/appleworksgs/PL/Src/picon.s @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_0Icon ENTRY P_5Icon EXPORT P_PageWidth,P_SpaceWidth,P_MaxVisPages,P_ControlWidth include 'pl.equ' P_IconDATA PROC EXPORT EXPORT P_IconPalette EXPORT P_ToolHeights EXPORT P_ArrowRect EXPORT P_FrameRect EXPORT P_FillRect EXPORT P_CkLoc EXPORT P_NumberTab EXPORT P_0Icon EXPORT P_1Icon EXPORT P_2Icon EXPORT P_3Icon EXPORT P_4Icon EXPORT P_5Icon EXPORT P_6Icon EXPORT P_7Icon EXPORT P_8Icon EXPORT P_9Icon EXPORT P_LIcon EXPORT P_RIcon EXPORT P_TIcon EXPORT P_CtlBoxIcon EXPORT P_R_ArrHollowIcon EXPORT P_L_ArrHollowIcon EXPORT P_R_ArrFilledIcon EXPORT P_L_ArrFilledIcon EXPORT P_LPageIcon EXPORT P__LPIcon EXPORT P_RPageIcon EXPORT P__RPIcon EXPORT P_CheckIcon EXPORT P_UnCkIcon EXPORT P_GrowIcon EXPORT P_TopHdl EXPORT P_BtmHdl EXPORT P_MinHdl EXPORT P_PlsHdl P_IconPalette DC.W 0,0,163,40 DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$0f,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$00,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$00,$0f,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$00,$00,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$00,$00,$0f,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$f0,$0f,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$00,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$c3,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$00,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$fc,$00,$3f,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$f0,$f0,$0f,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$c3,$fc,$03,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$00,$00,$ff,$ff,$ff,$0f DC.B $0f,$ff,$fc,$3f,$ff,$c0,$3f,$ff,$ff,$0f DC.B $0f,$ff,$f0,$ff,$ff,$f0,$3f,$ff,$ff,$0f DC.B $0f,$ff,$00,$0f,$ff,$00,$00,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$c3,$c3,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$3f,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$0f,$0f,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$0f,$0f,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$c0,$00,$00,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$fc,$3c,$3f,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$fc,$00,$00,$00,$3f,$ff,$0f DC.B $0f,$ff,$ff,$fc,$ff,$ff,$ff,$3f,$ff,$0f DC.B $0f,$ff,$fc,$00,$00,$00,$3f,$3f,$ff,$0f DC.B $0f,$ff,$fc,$ff,$ff,$ff,$3f,$3f,$ff,$0f DC.B $0f,$ff,$fc,$fc,$0f,$c3,$3f,$3f,$ff,$0f DC.B $0f,$ff,$fc,$f3,$f3,$03,$3f,$3f,$ff,$0f DC.B $0f,$ff,$fc,$ff,$cf,$c3,$3f,$3f,$ff,$0f DC.B $0f,$ff,$fc,$fc,$3f,$c3,$00,$3f,$ff,$0f DC.B $0f,$ff,$fc,$f0,$03,$c3,$3f,$ff,$ff,$0f DC.B $0f,$ff,$fc,$00,$00,$00,$3f,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$00,$00,$00,$00,$00,$0f,$ff,$0f DC.B $0f,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$f0,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$0f,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$0f,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$f0,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$f0,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$00,$00,$00,$00,$00,$0f,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$00,$00,$00,$00,$00,$0f,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$00,$00,$0f,$ff,$ff,$0f DC.B $0f,$ff,$f0,$ff,$ff,$ff,$f0,$ff,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$0f,$ff,$ff,$ff,$ff,$0f,$ff,$0f DC.B $0f,$ff,$f0,$ff,$ff,$ff,$f0,$ff,$ff,$0f DC.B $0f,$ff,$ff,$00,$00,$00,$0f,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$fc,$00,$03,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$03,$ff,$fc,$0f,$ff,$ff,$0f DC.B $0f,$ff,$f0,$3f,$ff,$ff,$c0,$ff,$ff,$0f DC.B $0f,$ff,$c3,$ff,$ff,$ff,$fc,$3f,$ff,$0f DC.B $0f,$ff,$c3,$ff,$ff,$ff,$fc,$3f,$ff,$0f DC.B $0f,$ff,$c3,$ff,$ff,$ff,$fc,$3f,$ff,$0f DC.B $0f,$ff,$c3,$ff,$ff,$ff,$fc,$3f,$ff,$0f DC.B $0f,$ff,$fc,$3f,$ff,$ff,$c3,$ff,$ff,$0f DC.B $0f,$ff,$ff,$03,$ff,$fc,$0f,$ff,$ff,$0f DC.B $0f,$ff,$ff,$fc,$00,$03,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$f1,$11,$11,$ff,$fd,$11,$11,$3f,$0f DC.B $0f,$f1,$ff,$f1,$ff,$fd,$11,$11,$3f,$0f DC.B $0f,$f1,$ff,$f1,$ff,$fd,$11,$11,$3f,$0f DC.B $0f,$f1,$ff,$f1,$ff,$fd,$11,$11,$3f,$0f DC.B $0f,$f1,$ff,$f1,$ff,$fd,$11,$11,$3f,$0f DC.B $0f,$f1,$11,$11,$ff,$fd,$11,$11,$3f,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$f0,$00,$00,$00,$00,$0f,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$0f P_ToolHeights DC.W 13 ;Arrow DC.W 26 ;Q_Text DC.W 39 ;Page DC.W 52 ;Date DC.W 65 ;Str Q_Line DC.W 78 ;Q_Line DC.W 91 ;Q_Rect DC.W 104 ;Round Q_Rect DC.W 117 ;Oval DC.W 130 ;Fill DC.W 134 ;Q_Line Widths... DC.W 139 DC.W 145 DC.W 152 DC.W 163 P_ArrowRect DC.W -1,1,13,35 P_FrameRect DC.W 117,1,129,19 P_FillRect DC.W 117,19,129,35 P_CkLoc DC.W 0,131,135,140,146,153 ;Where the check marks go P_NumberTab DC.L P_0Icon,P_1Icon,P_2Icon,P_3Icon,P_4Icon DC.L P_5Icon,P_6Icon,P_7Icon,P_8Icon,P_9Icon P_0Icon ; ; 0 DC.W 0,0, 5,8 DC.B $f0,$0f DC.B $cf,$f3 DC.B $cf,$f3 DC.B $cf,$f3 DC.B $f0,$0f P_1Icon ; ; 1 DC.W 0,0, 5,8 DC.B $ff,$3f DC.B $fc,$3f DC.B $ff,$3f DC.B $ff,$3f DC.B $f0,$03 P_2Icon ; ; 2 DC.W 0,0, 5,8 DC.B $f0,$0f DC.B $cf,$f3 DC.B $ff,$0f DC.B $f0,$ff DC.B $c0,$03 P_3Icon ; ; 3 DC.W 0,0, 5,8 DC.B $c0,$03 DC.B $ff,$f3 DC.B $ff,$0f DC.B $cf,$f3 DC.B $f0,$0f P_4Icon ; ; 4 DC.W 0,0, 5,8 DC.B $cf,$cf DC.B $cf,$cf DC.B $c0,$03 DC.B $ff,$cf DC.B $ff,$cf P_5Icon ; ; 5 DC.W 0,0, 5,8 DC.B $c0,$03 DC.B $cf,$ff DC.B $c0,$0f DC.B $ff,$f3 DC.B $c0,$0f P_6Icon ; ; 6 DC.W 0,0, 5,8 DC.B $f0,$0f DC.B $cf,$ff DC.B $c0,$0f DC.B $cf,$f3 DC.B $f0,$0f P_7Icon ; ; 7 DC.W 0,0, 5,8 DC.B $c0,$03 DC.B $ff,$f3 DC.B $ff,$0f DC.B $fc,$ff DC.B $fc,$ff P_8Icon ; ; 8 DC.W 0,0, 5,8 DC.B $f0,$0f DC.B $cf,$f3 DC.B $f0,$0f DC.B $cf,$f3 DC.B $f0,$0f P_9Icon ; ; 9 DC.W 0,0, 5,8 DC.B $f0,$0f DC.B $cf,$f3 DC.B $f0,$03 DC.B $ff,$f3 DC.B $f0,$0f P_LIcon DC.W 0,0, 5,8 DC.B $0f,$ff DC.B $0f,$ff DC.B $0f,$ff DC.B $0f,$ff DC.B $00,$0f P_RIcon DC.W 0,0, 5,8 DC.B $00,$0f DC.B $0f,$03 DC.B $00,$0f DC.B $0f,$0f DC.B $0f,$c3 P_TIcon DC.W 0,0, 5,8 DC.B $0f,$f0 DC.B $00,$00 DC.B $0c,$30 DC.B $0f,$f0 DC.B $0f,$f0 P_CtlBoxIcon DC.W 0,0,13,20 DC.B $00,$00,$00,$00,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $0e,$ee,$ee,$ee,$0f DC.B $00,$00,$00,$00,$0f P_R_ArrHollowIcon DC.W 0,0,9,12 DC.B $0e,$ee,$ee DC.B $00,$ee,$ee DC.B $0f,$0e,$ee DC.B $0f,$f0,$ee DC.B $0f,$ff,$0e DC.B $0f,$f0,$ee DC.B $0f,$0e,$ee DC.B $00,$ee,$ee DC.B $0e,$ee,$ee P_L_ArrHollowIcon DC.W 0,0,9,12 DC.B $ee,$ee,$0e DC.B $ee,$e0,$0e DC.B $ee,$0f,$0e DC.B $e0,$ff,$0e DC.B $0f,$ff,$0e DC.B $e0,$ff,$0e DC.B $ee,$0f,$0e DC.B $ee,$e0,$0e DC.B $ee,$ee,$0e P_R_ArrFilledIcon DC.W 0,0,9,12 DC.B $0e,$ee,$ee DC.B $00,$ee,$ee DC.B $00,$0e,$ee DC.B $00,$00,$ee DC.B $00,$00,$0e DC.B $00,$00,$ee DC.B $00,$0e,$ee DC.B $00,$ee,$ee DC.B $0e,$ee,$ee P_L_ArrFilledIcon DC.W 0,0,9,12 DC.B $ee,$ee,$0e DC.B $ee,$e0,$0e DC.B $ee,$00,$0e DC.B $e0,$00,$0e DC.B $00,$00,$0e DC.B $e0,$00,$0e DC.B $ee,$00,$0e DC.B $ee,$e0,$0e DC.B $ee,$ee,$0e P_LPageIcon DC.W 0,0,12,28 DC.B $ff,$f0,$00,$00,$00,$00,$0f DC.B $ff,$00,$ff,$ff,$ff,$ff,$0f DC.B $f0,$f0,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$0f P__LPIcon DC.W 0,0,12,28 DC.B $ff,$ff,$00,$00,$00,$00,$0f DC.B $ff,$ff,$00,$00,$00,$00,$0f DC.B $ff,$0f,$00,$00,$00,$00,$0f DC.B $ff,$ff,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f P_RPageIcon DC.W 0,0,12,28 DC.B $00,$00,$00,$00,$00,$ff,$ff DC.B $0f,$ff,$ff,$ff,$f0,$0f,$ff DC.B $0f,$ff,$ff,$ff,$f0,$f0,$ff DC.B $0f,$ff,$ff,$ff,$f0,$00,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $0f,$ff,$ff,$ff,$ff,$ff,$0f DC.B $00,$00,$00,$00,$00,$00,$0f P__RPIcon DC.W 0,0,12,28 DC.B $00,$00,$00,$00,$0f,$ff,$ff DC.B $00,$00,$00,$00,$0f,$ff,$ff DC.B $00,$00,$00,$00,$0f,$0f,$ff DC.B $00,$00,$00,$00,$0f,$ff,$ff DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f DC.B $00,$00,$00,$00,$00,$00,$0f P_CheckIcon DC.W 0,0,4,12 DC.B $ff,$ff,$f9 DC.B $ff,$ff,$9f DC.B $f9,$f9,$ff DC.B $ff,$9f,$ff P_UnCkIcon DC.W 0,0,4,12 DC.B $ff,$ff,$ff DC.B $ff,$ff,$ff DC.B $ff,$ff,$ff DC.B $ff,$ff,$ff P_GrowIcon DC.W 0,0,10,32 DC.B $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff DC.B $ff,$c0,$00,$00,$ff,$ff,$ff,$ff DC.B $ff,$c3,$ff,$f0,$ff,$ff,$ff,$ff DC.B $ff,$c3,$ff,$f0,$00,$03,$ff,$ff DC.B $ff,$c3,$ff,$f0,$ff,$c3,$ff,$ff DC.B $ff,$c0,$00,$00,$ff,$c3,$ff,$ff DC.B $ff,$ff,$c3,$ff,$ff,$c3,$ff,$ff DC.B $ff,$ff,$c3,$ff,$ff,$c3,$ff,$ff DC.B $ff,$ff,$c0,$00,$00,$03,$ff,$ff DC.B $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff P_TopHdl DC.W 0,0,6,14 DC.B $ff,$00,$0f,$f0 DC.B $fc,$3f,$c3,$f0 DC.B $c3,$ff,$fc,$30 DC.B $c3,$ff,$fc,$30 DC.B $c3,$ff,$fc,$30 DC.B $c0,$00,$00,$30 P_BtmHdl DC.W 0,0,6,14 DC.B $c0,$00,$00,$30 DC.B $c3,$ff,$fc,$30 DC.B $c3,$ff,$fc,$30 DC.B $c3,$ff,$fc,$30 DC.B $fc,$3f,$c3,$f0 DC.B $ff,$00,$0f,$f0 P_MinHdl DC.W 0,0,6,14 DC.B $ff,$00,$0f,$f0 DC.B $fc,$3f,$c3,$f0 DC.B $c3,$f0,$fc,$30 DC.B $c3,$00,$0c,$30 DC.B $c3,$f0,$fc,$30 DC.B $c0,$00,$00,$30 P_PlsHdl DC.W 0,0,6,14 DC.B $c0,$00,$00,$30 DC.B $c3,$f0,$fc,$30 DC.B $c3,$00,$0c,$30 DC.B $c3,$f0,$fc,$30 DC.B $fc,$3f,$c3,$f0 DC.B $ff,$00,$0f,$f0 ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/pl.s b/appleworksgs/PL/Src/pl.s new file mode 100755 index 0000000..041fdcd --- /dev/null +++ b/appleworksgs/PL/Src/pl.s @@ -0,0 +1 @@ + LOAD 'macros.dump' include 'pl.equ' include 'driver.equ' include 'scrap.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_MakeNewWin IMPORT D_AddStrings IMPORT D_BitMapPtr IMPORT D_Deref IMPORT D_DisposePtr IMPORT D_FastMult IMPORT D_GetNewUntitled IMPORT X_GetPLSCRAPAddr IMPORT D_GetPrintHandle IMPORT D_GetRefCon IMPORT D_LoadSegment IMPORT D_NeedHand IMPORT D_NeedHandle IMPORT D_NewCtl IMPORT P_AllHGCount IMPORT P_AllHGuides IMPORT P_AllVGCount IMPORT P_AllVGuides IMPORT P_ArrowRect IMPORT P_AttrTable IMPORT P_BuildUndo IMPORT P_CheckHand IMPORT P_Clear IMPORT P_ContentRect IMPORT P_ConvErr IMPORT P_Copy IMPORT P_CurDate IMPORT P_CurrentWin IMPORT P_Cursor IMPORT P_Cut IMPORT P_DblPage IMPORT P_DefColor IMPORT P_DefFont IMPORT P_DefJust IMPORT P_DefSize IMPORT P_DefSpacing IMPORT P_DefStyle IMPORT P_DelObjects IMPORT P_DoScritch IMPORT P_DrawContent IMPORT P_Entry IMPORT P_FillMode IMPORT P_FirstPOff IMPORT P_FixMenus IMPORT P_FixSpecMenu IMPORT P_ForceUpdate IMPORT P_FullPageRect IMPORT P_FullPaperRect IMPORT P_GrowRect IMPORT P_H IMPORT P_HDataSize IMPORT P_HRulRect IMPORT P_HScrTempl IMPORT P_HScroll IMPORT P_HValue IMPORT P_HViewSize IMPORT P_HorizGCount IMPORT P_HorizGuides IMPORT P_ImportHdl IMPORT P_ImportType IMPORT P_KillImport IMPORT P_KillPage IMPORT P_KillUndo IMPORT P_LastObj IMPORT P_LineSize IMPORT P_LoadWindowStuff IMPORT P_LockGuides IMPORT P_MagGuides IMPORT P_MakePict IMPORT P_MouseDown IMPORT P_MouseUp IMPORT P_ObjList IMPORT P_OldIdlePt IMPORT P_OpenDoc IMPORT P_OrgOffset IMPORT P_PIconRect IMPORT P_PInfoSize IMPORT P_Page IMPORT P_PageArray IMPORT P_PageCount IMPORT P_PageMode IMPORT P_PageRect IMPORT P_PageStart IMPORT P_Palette IMPORT P_PaperRect IMPORT P_Placing IMPORT P_Plane IMPORT P_PortRect IMPORT P_PrintDoc IMPORT P_PrintHand IMPORT P_QDPict IMPORT P_SWinParams IMPORT P_SampTitle IMPORT P_SaveDoc IMPORT P_SavePage IMPORT P_SaveWindowStuff IMPORT P_TBarColor IMPORT P_TitleColor IMPORT P_ToolType IMPORT P_TrackCursor IMPORT P_TrackOn IMPORT P_Undo IMPORT P_UpDateDoc IMPORT P_UseTemplate IMPORT P_V IMPORT P_VDataSize IMPORT P_VRulRect IMPORT P_VScrTempl IMPORT P_VScroll IMPORT P_VValue IMPORT P_VViewSize IMPORT P_VertGCount IMPORT P_VertGuides IMPORT P_VisGuides IMPORT P_VisPalette IMPORT P_VisRuler IMPORT P_WinStuffSize IMPORT P_WindColors IMPORT P_paste IMPORT X_ScrapRefCon IMPORT X_ScrapType IMPORT D_SetRefCon IMPORT T_ClipThread IMPORT T_Deactivate IMPORT T_DotObj IMPORT T_Editing IMPORT T_Idle IMPORT T_Key IMPORT T_ScaleLocInfo IMPORT T_ScalePort IMPORT D_TodaysDate IMPORT D_UnloadSegment IMPORT D_UnLock ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY P_ActivateDoc ENTRY P_DeActivateDoc ENTRY P_DisposeDoc ENTRY P_GrewDoc ENTRY P_IdleProc ENTRY P_Ignore ENTRY P_InitDoc ENTRY P_KeyDown ENTRY P_LoadMod ENTRY P_MakeRoom ENTRY P_MakeWin ENTRY P_Message ENTRY P_NewDoc ENTRY P_PrintChanged ENTRY P_RelockMem ENTRY P_ShowDoc ENTRY P_UnloadMod ENTRY P_UnlockMem P_Procs PROC EXPORT ;Using P_AttrData DC.L P_AttrTable ;attribute table for module jml P_OpenDoc ;D_Open a file jml P_NewDoc ;D_Create a D_New file jml P_DisposeDoc ;dispose of a window jml P_SaveDoc ;D_Save a document jml P_Undo ;undo in active window jml P_Cut ;cut in active window jml P_Copy ;do a copy in a window active or not jml P_paste ;Do a Paste in a window active or not jml P_Clear ;Do a clear in the active window jml P_ActivateDoc ;make a window active jml P_DeActivateDoc jml P_UpDateDoc ;D_Update a window jml P_MouseDown ;mouse down in active window jml P_KeyDown ;key down in active window jml P_Ignore ;mouse down in active window bar jml P_GrewDoc ;document changed size (zoomed) jml P_IdleProc ;called in D_MainLoop jml P_MakeRoom ;release unneeded memory jml P_PrintChanged ;print record changed jml P_PrintDoc jml P_MouseUp jml P_Message jml P_LoadMod jml P_UnloadMod jml P_UnlockMem jml P_RelockMem jml P_MakeWin P_Vers DC.W 101 ; official module version number. ENDP P_Ignore PROC EXPORT begin return ENDP ;--------------------------------------------------------------------------- ; ; P_MakeWin ; P_MakeWin PROC EXPORT ;Using P_Data ;Using P_AttrData input plane:l,RectPtr:l output window:l error err begin +b MoveLong #-1,Window movelong Plane,P_Plane tool _NewWindow,in=(#P_SWinParams:l),out=(window:l),err=(err) jcs whoops tool _SetOriginMask,in=(#$fffc:w,window:l) tool _GetFrameColor,in=(#P_WindColors:l,window:l) moveword #$20f,P_TBarColor moveword #$f00,P_TitleColor tool _SetFrameColor,in=(#P_WindColors:l,window:l) tool _SetPort,in=(window:l) tool _SetFontFlags,in=(#4:w) tool _SetTextMode,in=(#modeForeCopy:w) whoops return ENDP ;--------------------------------------------------------------------------- ; NewDoc - opens a blank document on the desktop ; input - ModuleNum use as reference for D_MakeNewWin ; Return memory error. If successful call D_MakeNewWin so the driver ; can init the window. P_NewDoc PROC EXPORT ;Using P_data ;Using P_iconData ;Using P_RulerData ;Using T_TextEqu INPUT MWinPtr:l ERROR err LOCAL tmp:l,ptr:l,OldWindow:l,refcon:l BEGIN +B movelong P_CurrentWin,OldWindow call P_CheckHand,in=(#$8000:l),err=(err) jcs Whoops call P_SaveWindowStuff,in=(P_CurrentWin:l) call P_InitDoc,in=(MWinPtr:l),out=(RefCon:l),err=(err) bcs ToWhoops moveword #ArrowCursor,P_Cursor moverect P_ArrowRect,P_Palette moveword #Black,P_DefColor call D_NeedHand,in=(#P_PInfoSize*3:l),out=(tmp:l),err=(err) bcc NoErrs tool _DisposeHandle,in=(RefCon:l) ToWhoops brl Whoops NoErrs movelong [tmp],ptr ldy #P_PInfoSize*3-3 lda #0 Zilchloop sta [ptr],y dey bpl Zilchloop movelong tmp,P_PageArray ; Zeroes stz P_FillMode stz P_PageMode stz P_LockGuides stz P_MagGuides stz P_ToolType stz P_VertGCount stz P_HorizGCount stzl P_ObjList stzl P_LastObj stzl P_OrgOffset stzl P_PIconRect stzl P_PIconRect+4 stz P_ImportType stz P_DblPage stz P_UseTemplate stzl P_VertGuides stzl P_HorizGuides ; Ones lda #1 sta P_LineSize sta P_PageCount sta P_VisRuler sta P_VisPalette sta P_VisGuides sta P_PageStart moveword a,[ptr]:#P_PInfoSize*3-2 moveword #-1,P_FirstPOff moveword #3,P_DefFont ; Geneva moveword #0,P_DefStyle ; Plain moveword #12,P_DefSize ; 12 Point moveword #T_Left,P_DefJust moveword #T_Single,P_DefSpacing call P_SavePage,in=(#0:w) call P_SavePage,in=(#1:w) moveword #1,P_UseTemplate call P_SavePage,in=(#2:w) moveword #2,P_Page call P_ShowDoc,in=(MWinPtr:l),err=(err) Whoops call P_LoadWindowStuff,in=(OldWindow:l) RETURN ENDP ***************************************************************************************************** ; P_InitDoc ( WindowPtr:long ): RefCon:long ; ; This routine will create a window refcon for the given window and call the driver to put our ; our refcon in the window structure. Memory errors can be returned. The allocated refcon is ; returned to the caller. The guide counts for the document are also cleared. Current window will be ; set to the given window. P_InitDoc PROC EXPORT ;Using P_data input window:l output refcon:l error err begin ; Clear guide counts for the document. stz P_AllHGCount stz P_AllVGCount ; Get refcon handle if successful then call driver to put it in the window structure. movelong window,P_CurrentWin call D_NeedHand,in=(#P_WinStuffSize:l),out=(refcon:l),err=(err) bcs whoops call D_SetRefCon,in=(refcon:l,window:l) whoops return ENDP ;--------------------------------------------------------------------------- ; ; P_ShowDoc ; P_ShowDoc PROC EXPORT ;Using P_Data ;Using P_RulerData INPUT window:l ERROR err LOCAL tmp:l,ptr:l BEGIN call D_NeedHand,in=(#4:l),out=(tmp:l),err=(err) jcs whoops movelong [tmp],ptr movelong #0,[ptr] movelong tmp,P_AllHGuides call D_NeedHand,in=(#4:l),out=(tmp:l),err=(err) jcs whoops movelong [tmp],ptr movelong #0,[ptr] movelong tmp,P_AllVGuides moveword #P_HRulTop,P_HRulRect moveword #P_HRulLeft,P_HRulRect+2 lda #P_HRulTop+P_HRulWdth moveword #P_HRulTop+P_HRulWdth,P_HRulRect+4 moveword #P_VRulTop,P_VRulRect moveword #P_VRulLeft,P_VRulRect+2 moveword #P_VRulLeft+P_VRulWdth,P_VRulRect+6 stz P_TrackOn stzl P_HScroll stzl P_VScroll stzl P_ImportHdl stz P_Placing call D_TodaysDate,out=(P_CurDate:l) call P_PrintChanged,in=(window:l) tool _SetPort,in=(window:l) whoops return ENDP ;---------------------------------------------------------------- ; ; P_ActivateDoc (Window:l) ; ; The Frame assures that the menu is as you left it except for ; checks, any menu item style change etc. Items are enabled, ; disabled, inserted and deleted just as you last saw this document. P_ActivateDoc PROC EXPORT ;Using P_Data ;Using P_RulerData ;Using P_AttrData input window:l local ctl:l,tmprect:r,ptr:l begin +b cmpl Window,P_CurrentWin jeq Exit call P_LoadWindowStuff,in=(window:l) jsl P_Entry tool _GetPortRect,in=(!tmprect:l) tool _ClipRect,in=(!tmprect:l) movelong P_HScroll,ctl movelong [ctl],ptr moveword [ptr]:#oCtlHilite,a and #$FF bne @hilite ; Draw the controls the first time through. tool _DrawOneCtl,in=(P_HScroll:l) ; since the controls will be hilighted correctly tool _DrawOneCtl,in=(P_VScroll:l) ; on the very first activate. bra @valid @hilite tool _HiliteControl,in=(#noHilite:w,P_HScroll:l) tool _HiliteControl,in=(#noHilite:w,P_VScroll:l) ; Do this so we don't redraw the controls in a subsequent update. @valid movelong [ctl],ptr moverect [ptr]:#oCtlRect,tmprect tool _ValidRect,in=(!tmprect:l) movelong P_VScroll,ctl movelong [ctl],ptr moverect [ptr]:#oCtlRect,tmprect tool _ValidRect,in=(!tmprect:l) tool _ClipRect,in=(#P_ContentRect:l) call P_FixSpecMenu call P_FixMenus Exit return ENDP ;------------------------------------------------------------------------------ ; ; P_DeactivateDoc (Window:l) ; P_DeactivateDoc PROC EXPORT ;Using P_Data ;Using T_Data input window:l local ctl:l,tmprect:r,ptr:l begin +b cmpl window,P_CurrentWin bne ToExit cpzl Window bne Cont ToExit brl Exit Cont jsl P_Entry call T_Deactivate,in=(#1:w,#0:w) jsl P_KillImport jsl P_KillUndo tool _ClipRect,in=(#P_PortRect:l) lda P_TrackOn beq Off call P_DoScritch,in=(P_OldIdlePt:l) ; Erase scritches Off tool _HiliteControl,in=(#inactiveHilite:w,P_HScroll:l) tool _HiliteControl,in=(#inactiveHilite:w,P_VScroll:l) tool _ClipRect,in=(#P_ContentRect:l) stz P_TrackOn call P_SavePage,in=(P_Page:w) call P_SaveWindowStuff,in=(window:l) stzl P_CurrentWin Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_DisposeDoc (Window:l) ; ; Don't call D_CloseWindow, driver will do it for you. P_DisposeDoc PROC EXPORT ;Using P_Data INPUT Window:l LOCAL NotActive:w,ActiveWin:l,CurPage:w,StopPage:w BEGIN +b stz NotActive cmpl Window,P_CurrentWin beq Okay inc NotActive movelong P_CurrentWin,ActiveWin call P_LoadWindowStuff,in=(Window:l) Okay call P_DeactivateDoc,in=(Window:l) tool _DisposeControl,in=(P_HScroll:l) tool _DisposeControl,in=(P_VScroll:l) addword P_PageCount,#1,CurPage PageLoop call P_KillPage,in=(CurPage:w,#1:w) dec CurPage bpl PageLoop tool _DisposeHandle,in=(P_PageArray:l) call D_GetRefCon,in=(window:l),out=(:l) _DisposeHandle tool _DisposeHandle,in=(P_AllVGuides:l) tool _DisposeHandle,in=(P_AllHGuides:l) lda NotActive beq Exit call P_LoadWindowStuff,in=(ActiveWin:l) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_KeyDown (TaskRec:l) ; P_KeyDown PROC EXPORT ;Using P_Data ;Using P_ObjData ;Using T_Data input TaskRec:l local objhdl:l,objptr:l begin +b jsl P_Entry lda T_Editing beq DoneText call T_Key,in=(TaskRec:l) bra Exit DoneText moveword [TaskRec]:#oMessage,a and #$FF cmp #$7F bne Exit call P_BuildUndo,in=(#P_ClearObjUndo:w) call P_DelObjects,in=(#0:w) jsl P_FixMenus Exit RETURN ENDP ;----------------------------------------------------------------------------- ; The Window was grown. You should use this make any scroll bar ; adjustments, updates etc. (Should ;*only** be called if active window) ; input - window, the one that changed size. ; ; Notes: ;always* (erase/D_New)'s the horizontal scrollbar. ; only (erase/D_New)'s the vert scrollbar if the window size has changed ; otherwise ; ; Caveat: this is a hideous piece of code. The kitchen sink was taken out, ; but everything else is still there. It is called by anybody ; a general recalc of rulers/scrollbars, etc. ; P_GrewDoc PROC EXPORT ;Using P_Data ;Using P_ICONData ;Using P_RulerData ;Using T_Data input Window:l local tmprect:r,changed:w,tmp:l,vert:w,horz:w begin +b jsl P_Entry tool _GetPortRect,in=(#P_PortRect:l) tool _ClipRect,in=(#P_PortRect:l) ; Use old vert. scrollbar, iff the window size hasn't changed. subword P_PortRect+6,#P_ScrollWidth,tmprect+6 subword P_PortRect+4,#P_ScrollHeight-1,tmprect+4 cmpl tmprect+4,P_ContentRect+4 bne Cont stz changed bra DoHoriz ; Erase V ScrollBar Cont moveword #1,changed IsNil P_VScroll jeq NewVert movelong P_VScroll,tmprect movelong [tmprect],tmp moverect [tmp]:#oCtlRect,tmprect moveword P_GrowRect+4,tmprect+4 tool _EraseRect,in=(!tmprect:l) tool _InvalRect,in=(!tmprect:l) DoHoriz ; Erase H scrollbar IsNil P_HScroll beq NewVert movelong P_HScroll,tmp pushlong [tmp] addlong 1:s,#oCtlRect,1:s pushlong 1:s _EraseRect _InvalRect ; Old page icons tool _EraseRect,in=(#P_PIconRect:l) tool _InvalRect,in=(#P_PIconRect:l) NewVert DoInit moveword #P_VScrollT,P_VScrTempl subword P_PortRect+6,#P_ScrollWidth,P_VScrTempl+2 addword P_PortRect+6,#2,P_VScrTempl+6 moveword P_PortRect+4,P_HScrTempl+4 inc P_HScrTempl+4 subword P_HScrTempl+4,#P_ScrollHeight,P_HScrTempl moveword P_HScrTempl,P_VScrTempl+4 inc P_VScrTempl+4 addword P_VScrTempl+2,#2,P_HScrTempl+6 ; 1 templ page + 2 spaces. moveword #P_PageWidth+(2*P_SpaceWidth)-1,P_HScrTempl+2 lda P_DblPage beq DidTempl ; 2nd templ page addword #P_PageWidth-2,P_HScrTempl+2,P_HScrTempl+2 DidTempl cmpw P_PageCount,#6 blt LessThan6 ; 2 controls addword #2*(P_ControlWidth-2),P_HScrTempl+2,P_HScrTempl+2 lda #5 Lessthan6 rcall D_FastMult,in=(a:x,#P_PageWidth-2:y) ; 1-5 pages. ina ; add in 2 Q_Pixels for righthand edge. ina addword a,P_HScrTempl+2,P_HScrTempl+2 tool _InvalRect,in=(#P_HScrTempl:l) tool _InvalRect,in=(#P_VScrTempl:l) subword P_PaperRect+4,P_PaperRect,P_VDataSize subword P_PaperRect+6,P_PaperRect+2,a and #$FFFE sta P_HDataSize moveword P_H,P_HValue moveword P_V,P_VValue lda P_PageMode beq NormMode moveword P_VDataSize,P_VViewSize ; Make scrollbars empty moveword P_HDataSize,P_HViewSize ; bra DoRulers NormMode lda P_VisRuler bne VisRulers moveword P_HScrTempl,P_VViewSize subword P_VScrTempl+2,#P_TabWLeft,a bra FixView VisRulers subword P_HScrTempl,#P_TabWBottom,P_VViewSize subword P_VScrTempl+2,#P_TabWRight,a FixView ldy P_VisPalette bne DidPal addword a,#P_TabWLeft,a DidPal and #$FFFE sta P_HViewSize DoRulers IsNil P_HScroll jeq NilHScroll ; first, check controls for out-of-boundedness. tool _GetCtlValue,in=(P_HScroll:l),out=(a:w) addword a,P_HViewSize,a cmp P_HDataSize blt ResizeVert subword P_HDataSize,P_HViewSize,P_HValue bpl @sta lda #0 ; origin shouldn't ever go negative @sta sta P_H call T_ClipThread,in=(T_DotObj:l) lda P_PageMode bne ResizeVert tool _InvalRect,in=(#P_HRulRect:l) tool _ClipRect,in=(#P_ContentRect:l) tool _EraseRect,in=(#P_ContentRect:l) call P_DrawContent,in=(#P_ContentRect:l,#0:w) ResizeVert tool _GetCtlValue,in=(P_VScroll:l),out=(a:w) addword a,P_VViewSize,a cmp P_VDataSize blt DidResize subword P_VDataSize,P_VViewSize,P_VValue bpl @sta lda #0 ; origin shouldn't ever go negative @sta sta P_V call T_ClipThread,in=(T_DotObj:l) lda P_PageMode bne DidResize tool _ClipRect,in=(#P_ContentRect:l) tool _EraseRect,in=(#P_ContentRect:l) tool _InvalRect,in=(#P_VRulRect:l) call P_DrawContent,in=(#P_ContentRect:l,#0:w) DidResize tool _ClipRect,in=(#P_PortRect:l) tool _DisposeControl,in=(P_HScroll:l) NilHScroll IsNil P_VScroll beq NoVert lda changed beq NoVert tool _DisposeControl,in=(P_VScroll:l) NoVert ; rulers need to be resized also? moveword P_HScrTempl,P_PIconRect stz P_PIconRect+2 moveword P_HScrTempl+4,P_PIconRect+4 moveword P_HScrTempl+2,P_PIconRect+6 tool _EraseRect,in=(#P_PIconRect:l) tool _InvalRect,in=(#P_PIconRect:l) tool _ClipRect,in=(#P_PortRect:l) call D_NewCtl,in=(#P_HScrTempl:l,P_CurrentWin:l),out=(P_HScroll:l) lda changed jeq exit call D_NewCtl,in=(#P_VScrTempl:l,P_CurrentWin:l),out=(P_VScroll:l) addword P_HScrTempl,#1,P_GrowRect addword P_VScrTempl+2,#2,P_GrowRect+2 movelong P_PortRect+4,P_GrowRect+4 subword P_GrowRect,#1,P_ContentRect+4 ; bottom subword P_GrowRect+2,#2,P_ContentRect+6 ; right stz P_ContentRect+2 ; P_ContentRect[2] = visP?TabWL:0 + visR?TabWR-TabWL-1:0 ; P_ContentRect[0] = visR?TabWB:0 lda P_VisPalette beq CkRuler moveword #P_TabWLeft-1,P_ContentRect+2 ; left (palette vis) CkRuler lda P_VisRuler beq NoRulers moveword #P_TabWBottom,P_ContentRect addword P_ContentRect+2,#P_TabWRight-P_TabWLeft,P_ContentRect+2 bra contRects NoRulers stz P_ContentRect contRects moveword P_ContentRect+4,P_VRulRect+4 moveword P_ContentRect+6,P_HRulRect+6 moveword P_ContentRect+2,P_VRulRect+6 sta P_HRulRect+2 subword P_ContentRect+2,#P_VRulWdth,P_VRulRect+2 addword P_ContentRect,#10,P_FullPaperRect subword P_ContentRect+4,#10,P_FullPaperRect+4 rcall D_Deref,in=(P_PrintHand:ax),out=(tmp:ax) moveword [tmp]:#$C,vert moveword [tmp]:#$E,horz rcall D_UnLock,in=(P_PrintHand:ax) subword P_FullPaperRect+4,P_FullPaperRect,tmp tool _Multiply,in=(horz:w,tmp:w),out=(tmp:l) in tmp:l,#0:w,vert:w out a:w,a:w,a:w,tmp:w xtool _LongDivide ; tmp is the width of the fullpaperrect subword P_ContentRect+6,P_ContentRect+2,a subword a,tmp,a bmi TooSmall bra JustRight TooSmall addword P_ContentRect+2,#20,P_FullPaperRect+2 subword P_ContentRect+6,#20,P_FullPaperRect+6 subword P_FullPaperRect+6,P_FullPaperRect+2,tmp tool _Multiply,in=(vert:w,tmp:w),out=(tmp:l) in tmp:l,#0:w,horz:w out a:w,a:w,a:w,tmp:w xtool _LongDivide subword P_ContentRect+4,P_ContentRect,a subword a,tmp,a lsr a addword a,P_ContentRect,P_FullPaperRect addword tmp,P_FullPaperRect,P_FullPaperRect+4 bra GotFull JustRight lsr a addword a,P_ContentRect+2,P_FullPaperRect+2 addword tmp,P_FullPaperRect+2,P_FullPaperRect+6 ; PageRect : FullPageRect :: PaperRect : FullPaperRect GotFull moverect P_PageRect,P_FullPageRect in #P_FullPageRect:l,#P_PaperRect:l,#P_FullPaperRect:l xtool _MapRect tool _InvalRect,in=(#P_GrowRect:l) lda P_PageMode beq exit movelong P_ContentRect,tmprect moveword #200,tmprect+4 moveword #640,tmprect+6 tool _EraseRect,in=(!tmprect:l) stz tmprect moveword #P_VRulLeft,tmprect+2 tool _InvalRect,in=(!tmprect:l) exit tool _ClipRect,in=(#P_ContentRect:l) call T_ClipThread,in=(T_DotObj:l) call P_ForceUpdate,in=(Window:l) return ENDP ;------------------------------------------------------------------------------- ; ; P_IdleProc (InMyWin:w,RectPtr:l,PtPtr:l,Time:l) ; ; input - InMyWin boolean, is the D_Cursor over my active window ; - RectPtr pointer to your the Port Q_Rect of the active window ; - PtPtr pointer to the current (local) Q_Point that the D_Cursor is over ; - Time The current TickCount P_IdleProc PROC EXPORT ;Using P_RulerData ;Using P_Data ;Using T_Data input InMyWin:w,RectPtr:l,PtPtr:l,Time:l begin +b ; Don't check InMyWin, because we want to erase scritch marks ; when the D_Cursor goes outside the window. IsNil P_CurrentWin beq Exit ; He hasn't activated the window yet. jsl P_Entry lda T_Editing beq DoTrack call T_Idle,in=(Time:l) DoTrack call P_TrackCursor,in=(PtPtr:l) Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; P_PrintChanged (Window:l) ; P_PrintChanged PROC EXPORT ;Using P_DATA ;Using P_RulerData input window:l local tmp:l,tmprect:l,oldwin:l begin +b movelong P_CurrentWin,oldwin call P_LoadWindowStuff,in=(Window:l) jsl P_Entry call D_GetPrintHandle,in=(window:l),out=(P_PrintHand:l) rcall D_Deref,in=(P_PrintHand:ax),out=(tmp:ax) moverect [tmp]:#oPrInfo+oRPage,P_PageRect moverect [tmp]:#oRPaper,P_PaperRect rcall D_UnLock,in=(P_PrintHand:ax) pushlong #P_PageRect subword #0,P_PaperRect+2,s subword #0,P_PaperRect,s pushlong #P_PaperRect pushlong 5:s _OffsetRect _OffsetRect IsNil P_ContentRect beq NotThere tool _EraseRect,in=(#P_ContentRect:l) NotThere stzl P_contentRect stzl P_Contentrect+4 tool _GetPortRect,in=(#P_PortRect:l) moverect P_PortRect,tmprect moveword P_VRulRect+2,tmprect+2 tool _InvalRect,in=(!tmprect:l) call P_GrewDoc,in=(window:l) call P_LoadWindowStuff,in=(OldWin:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; P_Message (Type:w,Message:l) : Answer:l ; P_Message PROC EXPORT input Type:w,Message:l output answer:l error Err begin stz Err return ENDP ;--------------------------------------------------------------------------- ; ; P_LoadMod () ; P_LoadMod PROC EXPORT ;Using T_Data ;Using D_GlobalData error Err local Hdl:l begin +b call X_GetPLSCRAPAddr,out=(a:l),err=(Err) jcs Exit call D_LoadSegment,in=(#segPL2:w,#4:w),out=(a:l),err=(Err) jcs Exit call D_LoadSegment,in=(#segWPIO:w,#4:w),out=(ax:l),err=err bcc @loadAscii @unloadPL2 call D_UnloadSegment,in=(#segPL2:w,#4:w) brl exit @loadAscii call D_LoadSegment,in=(#segTOStatText:w,#4:w),out=(ax:l),err=err bcc gotsegs call D_UnloadSegment,in=(#segWPIO:w,#4:w) bra @unloadPL2 gotsegs ; Allocate the port used for scaling text call D_NeedHandle,in=(#$AA:l,#$4010:w),out=(Hdl:l),err=(Err) bcs Exit movelong [Hdl],T_ScalePort tool _OpenPort,in=(T_ScalePort:l),err=(Err) bcs DoErr movelong >D_BitMapPtr,T_ScaleLocInfo+2 tool _SetPortLoc,in=(#T_ScaleLocInfo:l) tool _SetTextMode,in=(#ModeForeCopy:w) tool _SetFontFlags,in=(#4:w) Exit return DoErr tool _DisposeHandle,in=(Hdl:l) bra Exit ENDP ;--------------------------------------------------------------------------- ; ; P_UnloadMod () ; P_UnloadMod PROC EXPORT ;Using T_Data ;Using X_ClipData ;Using P_ScrapData begin +b cpzl T_ScalePort beq DoUnload tool _ClosePort,in=(T_ScalePort:l) call D_DisposePtr,in=(T_ScalePort:l) cmpw >X_ScrapType,#PLPICT bne DoUnload in >X_ScrapRefCon:l out >P_QDPict:l xerr >P_ConvErr xcall P_MakePict DoUnload call D_UnloadSegment,in=(#segPL2:w,#4:w) call D_UnloadSegment,in=(#segWPIO:w,#4:w) call D_UnloadSegment,in=(#segTOStatText:w,#4:w) Exit return ENDP ;--------------------------------------------------------------------------- ; This will be called when memory is needed. You should make purgeable ; any handle not needed. ; This call WILL change as this project progresses. P_MakeRoom PROC EXPORT input Window:l begin return ENDP ;--------------------------------------------------------------------------- ; ; P_UnlockMem () ; P_UnlockMem PROC EXPORT input Window:l begin return ENDP ;--------------------------------------------------------------------------- ; ; P_RelockMem () ; P_RelockMem PROC EXPORT input Window:l begin return ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/Src/strings.s b/appleworksgs/PL/Src/strings.s new file mode 100755 index 0000000..1c7750c --- /dev/null +++ b/appleworksgs/PL/Src/strings.s @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' P_Strings PROC EXPORT P_KillLMasterStr,P_CancelStr,P_OKStr,P_InsText1Msg EXPORT P_InsText2Msg,P_RCtlMsg1,P_RCtlMsg2,P_RCtlMsg3 EXPORT P_DelText1Msg,P_DelText2Msg,P_GotoTextMsg EXPORT P_PNumMsg,P_LRMsg,P_TBMsg,P_ColMsg,P_CSMsg P_KillLMasterStr STR 'This will delete anything on the left master page.' P_CancelStr STR 'Cancel' P_OKStr STR 'OK' P_InsText1Msg STR 'Insert' P_InsText2Msg STR 'page(s)' P_RCtlMsg1 STR 'at the beginning.' P_RCtlMsg2 STR 'after the current page.' P_RCtlMsg3 STR 'at the end.' P_DelText1Msg STR 'Delete pages' P_DelText2Msg STR 'through' P_GotoTextMsg STR 'Go to page' P_PNumMsg STR 'First page number:' P_LRMsg STR 'Left / Right Margins' P_TBMsg STR 'Top / Bottom Margins' P_ColMsg STR 'Columns' P_CSMsg STR 'Column Spacing' ENDP END \ No newline at end of file diff --git a/appleworksgs/PL/pl.make b/appleworksgs/PL/pl.make new file mode 100755 index 0000000..66e6eac --- /dev/null +++ b/appleworksgs/PL/pl.make @@ -0,0 +1 @@ +# # PL.make - Makefile for PL # # Copyright 1989, Claris Corporation. # # This is a sub-makefile, called recursively when ::AppleWorks.make is # executed. # # All modules (including Driver, Scrap, Pict., SS, DB, etc.) # should have similar makefiles in their respective folders. # # This makefile rebuilds the module object files as necessary and creates a # file containing the necessary steps to link this module with the rest of # AppleWorksGS. ::AppleWorks.make combines the link files from the modules # into a script which it executes to create an executable. #-------------------------------------------------------------------------------- # Variables AsmIIGSOptions = Segment1 = PL Segment2 = PL2 Segment3 = PLSCRAP Module = PL ModuleDir = {AWGS}{Module}: SrcDir = {ModuleDir}Src: IncDir = {ModuleDir} ObjDir = {ModuleDir}Obj: GlobalIncludes = {AWGS}Macros:Macros.dump {IncDir}PL.equ {AWGS}Driver:Driver.equ Linkfile = {ModuleDir}{Module}.link Makefile = {ModuleDir}{Module}.make Objs = {Objs1} {Objs2} {Objs3} Objs1 = {objdir}pl.o {objdir}pdata.o {objdir}picon.o {objdir}putil.o {objdir}poptions.o {objdir}pfile.o {objdir}pprint.o {objdir}ptool.o {objdir}pmouse.o {objdir}pobject.o {objdir}pobjutil.o {objdir}plist.o {objdir}pmove.o {objdir}ppage.o {objdir}pruler.o {objdir}pupdate.o {objdir}pmenus.o {objdir}pedit.o {objdir}pundo.o {objdir}parrange.o {objdir}pscroll.o {objdir}pguide.o {objdir}pdrag.o {objdir}ptab.o {objdir}main.o {objdir}prim.o {objdir}prim2.o {objdir}tutil.o {objdir}tdraw.o {objdir}click.o {objdir}key.o {objdir}edit.o {objdir}format.o {objdir}truler.o {objdir}tcntl.o Objs2 = {objdir}pruler2.o {objdir}putil2.o {objdir}pobjutil2.o {objdir}tscrap.o {objdir}tutil2.o # {objdir}tdbg.o # {objdir}tdbg.o # {objdir}pdbg.o # {objdir}pdbg.o Objs3 = {objdir}pscrap.o {objdir}strings.o ScrapDpndtObj = {objdir}pedit.o {objdir}pl.o #-------------------------------------------------------------------------------- # Main target {Linkfile} {Objs} {Makefile} @if "`newer {Makefile} {LinkFile}`"; @echo "# Creating {LinkFile} " @echo " -lseg:dynamic {Segment1} {Objs1} " > {targ} @echo " -lseg:dynamic {Segment2} {Objs2} " >> {targ} @echo " -lseg {Segment3} {Objs3} " >> {targ} @else @touch {linkfile} @end # Global PL dependencies {Objs} {GlobalIncludes} # Other PL dependencies {ScrapDpndtObj} {AWGS}Scrap:Scrap.equ clean @confirm "Delete {Module} objs and linkfile?" @if ({status} == 0) set foobar {exit} unset exit delete -y {awgs}{module}:src:.lst delete -y {Linkfile} delete -y {Objs} set exit {foobar} @end #-------------------------------------------------------------------------------- # Default rules .o .s AsmIIGS {DepDir}{Default}.s -i {IncDir},{AWGS}Macros,{AWGS}Driver,{AWGS}Scrap -o {TargDir}{Default}.o {AsmIIGSOptions} {ObjDir} {SrcDir} \ No newline at end of file diff --git a/appleworksgs/Pict/.DS_Store b/appleworksgs/Pict/.DS_Store new file mode 100644 index 0000000..8183a6b Binary files /dev/null and b/appleworksgs/Pict/.DS_Store differ diff --git a/appleworksgs/Pict/Pict.link b/appleworksgs/Pict/Pict.link new file mode 100755 index 0000000..05847ac --- /dev/null +++ b/appleworksgs/Pict/Pict.link @@ -0,0 +1 @@ + -lseg:dynamic PICT Source:AWGS:Pict:Obj:picture.aii.o Source:AWGS:Pict:Obj:fliprot.aii.o Source:AWGS:Pict:Obj:region.aii.o Source:AWGS:Pict:Obj:pixels.aii.o Source:AWGS:Pict:Obj:text.aii.o Source:AWGS:Pict:Obj:misc.aii.o \ No newline at end of file diff --git a/appleworksgs/Pict/Pict.make b/appleworksgs/Pict/Pict.make new file mode 100755 index 0000000..5057653 --- /dev/null +++ b/appleworksgs/Pict/Pict.make @@ -0,0 +1 @@ +# # Pict.make - Makefile for Pict # # Copyright 1989, Claris Corporation. # # This is a sub-makefile, called recursively when ::AppleWorks.make is # executed. # # All modules (including Driver, Scrap, Pict., SS, DB, etc.) # should have similar makefiles in their respective folders. # # This makefile rebuilds the module object files as necessary and creates a # file containing the necessary steps to link this module with the rest of # AppleWorksGS. ::AppleWorks.make combines the link files from the modules # into a script which it executes to create an executable. #-------------------------------------------------------------------------------- # Variables AsmIIGSOptions = Segment1 = PICT Module = Pict ModuleDir = {AWGS}{Module}: SrcDir = {ModuleDir}Src: IncDir = {ModuleDir} ObjDir = {ModuleDir}Obj: Linkfile = {ModuleDir}{Module}.link Makefile = {ModuleDir}{Module}.make GlobalIncludes = {IncDir}Pict.equ {AWGS}Driver:Driver.equ GlobalMacros = {AWGS}Macros:Macros.dump Objs = {ObjDir}picture.aii.o {ObjDir}fliprot.aii.o {ObjDir}region.aii.o {ObjDir}pixels.aii.o {ObjDir}text.aii.o {ObjDir}misc.aii.o #-------------------------------------------------------------------------------- # Main target {Linkfile} {Objs} {Makefile} @echo "Creating {LinkFile} " @echo " -lseg:dynamic {Segment1} {Objs} " > {Targ} # Global Pict dependencies {Objs} {GlobalIncludes} {GlobalMacros} clean @confirm "Delete {Module} objs and linkfile?" @if {status} == 0 then rm {Linkfile} {Objs} @end #-------------------------------------------------------------------------------- # Default rules .aii.o .aii AsmIIGS -i {AWGS}Macros,{AWGS}Driver,{AWGS}Pict {DepDir}{Default}.aii -o {TargDir}{Default}.aii.o {AsmIIGSOptions} {ObjDir} {SrcDir} \ No newline at end of file diff --git a/appleworksgs/Pict/Src/fliprot.aii b/appleworksgs/Pict/Src/fliprot.aii new file mode 100755 index 0000000..24fd479 --- /dev/null +++ b/appleworksgs/Pict/Src/fliprot.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'Pict.equ' INCLUDE 'Driver.equ' IMPORT Q_FlipHMap IMPORT Q_FlipVMap IMPORT Q_RotLMap IMPORT Q_RotRMap **************************************************************** * ; * Picture flipping and rotating routines ; * Jeff G. Erickson ; * ; **************************************************************** **************************************************************** Q_PictData PROC EXPORT EXPORT Q_picterr EXPORT Q_gotPScomm EXPORT Q_op EXPORT Q_center EXPORT Q_addbytes EXPORT Q_pictSCB EXPORT Q_thePnSize EXPORT Q_theMask EXPORT Q_thePnLoc EXPORT Q_theFGcolor EXPORT Q_theBGcolor EXPORT Q_theTxFont EXPORT Q_theTxMode EXPORT Q_theChExtra EXPORT Q_theSpExtra EXPORT Q_theFontFlags EXPORT Q_theTxLoc EXPORT Q_txtPort EXPORT Q_txtPortLoc EXPORT Q_txtSCB EXPORT Q_txtImage EXPORT Q_txtWidth EXPORT Q_txtBounds EXPORT Q_txtHandle EXPORT Q_txtHsize EXPORT Q_txtRect EXPORT Q_pixSCB EXPORT Q_pixbounds EXPORT Q_srcpixsize EXPORT Q_dstpixsize EXPORT Q_PixelTable EXPORT Q_printsquare EXPORT Q_square EXPORT Q_half Q_picterr DS.B 2 Q_gotPScomm DC.W 0 *--------------------------------------------------------------* * Picture stuff ; *--------------------------------------------------------------* Q_op DS.B 2 ; current picture opcode Q_center DS.B 4 ; TWICE the Q_center of the picture Q_addbytes DS.B 4 ; how many bytes to add to the pict? Q_pictSCB DS.B 2 ; picture's original SCB Q_thePnSize DS.B 4 ; current pen size w/i the D_New picture Q_theMask DS.B 8 ; ... pen Q_Mask ... Q_thePnLoc DS.B 4 ; current pen location w/i OLD picture *--------------------------------------------------------------* * Q_Text stuff ; *--------------------------------------------------------------* Q_theFGcolor DS.B 2 ; ... foreground color ... Q_theBGcolor DS.B 2 ; ... background color ... Q_theTxFont DS.B 4 ; ... font ID ... Q_theTxMode DS.B 2 ; ... Q_Text mode ... Q_theChExtra DS.B 4 ; ... charExtra ... Q_theSpExtra DS.B 4 ; ... spaceExtra ... Q_theFontFlags DS.B 2 ; ... font flags ... Q_theTxLoc DS.B 4 ; ... the Q_Text location ... Q_txtPort DS.B 170 ; Q_Text port Q_txtPortLoc ; ; Q_Text port loc Q_txtSCB DS.B 2 ; SCB Q_txtImage DS.B 4 ; pointer to Q_Text image Q_txtWidth DS.B 2 ; byte width of Q_Text image (mult. of 8) Q_txtBounds DS.B 8 ; bounds of Q_Text image (adj'd to width) Q_txtHandle DS.B 4 ; handle on Q_Text image (ptr to Q_txtImage) Q_txtHsize DS.B 4 ; size of Q_txtHandle Q_txtRect DS.B 8 ; REAL bounds of Q_Text image *--------------------------------------------------------------* * Pixelmap stuff ; *--------------------------------------------------------------* Q_pixSCB DS.B 2 ; pixmap's scan-Q_Line control byte Q_pixbounds DS.B 4 ; bottom right of (old) bounds Q_srcpixsize DS.B 4 ; size (bytes) of source pixmap Q_dstpixsize DS.B 4 ; size (bytes) of detination pixmap Q_PixelTable ; ; routines for mangling pixmaps DC.L Q_FlipHMap DC.L Q_FlipVMap DC.L Q_RotRMap DC.L Q_RotLMap *--------------------------------------------------------------* * Q_Region stuff ; *--------------------------------------------------------------* Q_printsquare DC.W 0,0,128,256 Q_square DC.W 0,0,128,128 Q_half DC.W 0,0,128,64 ENDP END \ No newline at end of file diff --git a/appleworksgs/Pict/Src/misc.aii b/appleworksgs/Pict/Src/misc.aii new file mode 100755 index 0000000..df476a9 --- /dev/null +++ b/appleworksgs/Pict/Src/misc.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'Pict.equ' INCLUDE 'Driver.equ' IMPORT Q_printsquare IMPORT Q_square **************************************************************** * * Q_ManglePoint(srcpt:l,rectptr:l,what:w,prrec:l):dstpt:l * Flip/rotate a Q_Point around the Q_center of a rectangle. * srcpt and dstpt are values, not pointers. Everything * is done according to the print record prrec. * **************************************************************** Q_ManglePoint PROC EXPORT ;Using Q_PictData input srcpt:l,rectptr:l,who:w,prrec:l output dstpt:l local middle:l,prptr:l begin +b movelong [rectptr],myrect movelong [rectptr]:#4,myrect+4 cmpl prrec,#0 beq nomap movelong [prrec],prptr movelong [prptr]:#4,Q_printsquare+4 pushlong #myrect pushlong #Q_printsquare pushlong #Q_square _MapRect pushlong !srcpt pushlong #Q_printsquare pushlong #Q_square _MapPt nomap addword myrect,myrect+4,middle addword myrect+2,myrect+6,middle+2 jtl trashPt,who cmpl prrec,#0 beq nomap2 pushlong !srcpt pushlong #Q_square pushlong #Q_printsquare _MapPt nomap2 movelong srcpt,dstpt return trashPt DC.L h_pt DC.L v_pt DC.L r_pt DC.L l_pt *--------------------------------------------------------------* h_pt lda middle+2 ; H-flip the Q_Point around middle.x sec sbc srcpt+2 sta srcpt+2 rtl *--------------------------------------------------------------* v_pt lda middle ; V-flip the Q_Point around middle.y sec sbc srcpt sta srcpt rtl *--------------------------------------------------------------* ; ; NOTE: The reason behind adding the last bit of either middle or ; middle+2 in the calculations below is to prevent the Q_Point ; from creeping up and/or to the left when (middle)+(middle+2) ; is odd. Trust me. It works. ; -- jge, 1/20/88 ; r_pt lda middle+2 ; R-rotate the Q_Point around middle and #1 ; clc adc middle+2 ; pt.x <= -(pt.y - middle.y) + middle.x adc middle sta dstpt ; (divide middle by 2, preserving asl dstpt ; the sign) ror a ; sec sbc srcpt tax ; D_Save it here... lda middle ; pt.y <= pt.x - middle.x + middle.y and #1 ; clc adc middle sec sbc middle+2 sta dstpt ; (divide middle by 2, preserving asl dstpt ; the sign) ror a ; clc adc srcpt+2 sta srcpt stx srcpt+2 ; ...and store it here. r_ptdone rtl *--------------------------------------------------------------* l_pt lda middle ; L-rotate the Q_Point around middle and #1 ; clc adc middle ; pt.y <= -(pt.x - middle.x) + middle.y adc middle+2 sta dstpt ; (divide middle by 2, preserving asl dstpt ; the sign) ror a ; sec sbc srcpt+2 tay ; D_Save it here... lda middle+2 ; pt.x <= pt.y - middle.y + middle.x and #1 ; clc adc middle+2 sec sbc middle sta dstpt ; (divide middle by 2, preserving asl dstpt ; the sign) ror a ; clc adc srcpt sta srcpt+2 sty srcpt ; ...and store it here. l_ptdone rtl *--------------------------------------------------------------* myrect DS.B 8 ENDP END \ No newline at end of file diff --git a/appleworksgs/Pict/Src/picture.aii b/appleworksgs/Pict/Src/picture.aii new file mode 100755 index 0000000..64eeb17 --- /dev/null +++ b/appleworksgs/Pict/Src/picture.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'Pict.equ' INCLUDE 'Driver.equ' IMPORT D_MemoryError IMPORT D_BeachBall IMPORT Q_BgColor IMPORT Q_ChExtra IMPORT Q_DhDvText IMPORT Q_DhText IMPORT Q_DvText IMPORT Q_FgColor IMPORT D_GrowHandle IMPORT Q_LongText IMPORT D_NeedHandle IMPORT Q_PixRect IMPORT Q_PixRgn IMPORT Q_Region IMPORT Q_SpExtra IMPORT Q_Text IMPORT Q_TxFace IMPORT Q_TxFont IMPORT Q_TxMode IMPORT Q_TxSize IMPORT Q_addbytes IMPORT Q_center IMPORT Q_gotPScomm IMPORT Q_op IMPORT Q_pictSCB IMPORT Q_picterr IMPORT Q_theBGcolor IMPORT Q_theChExtra IMPORT Q_theFGcolor IMPORT Q_theMask IMPORT Q_thePnLoc IMPORT Q_thePnSize IMPORT Q_theSpExtra IMPORT Q_theTxFont IMPORT Q_theTxLoc IMPORT Q_theTxMode ENTRY Q_Angles ENTRY Q_Arc ENTRY Q_Arcs ENTRY Q_ChangePictSize ENTRY Q_Comments ENTRY Q_Copy2 ENTRY Q_Copy4 ENTRY Q_CopyPt ENTRY Q_DhDv ENTRY Q_FakeDhDv ENTRY Q_JustRect ENTRY Q_linetext ENTRY Q_manglePt ENTRY Q_Mask ENTRY Q_Nop ENTRY Q_NudgePt ENTRY Q_OvalSize ENTRY Pict_pattern ENTRY Q_PenSize ENTRY Q_Pixels ENTRY Q_Point ENTRY Q_Poly ENTRY Q_Polys ENTRY Q_Rect ENTRY Q_Rects ENTRY Q_Regions ENTRY Q_ShiftPen ENTRY Q_Undef ENTRY Q_Lfrom ENTRY Q_Line ENTRY Q_Slfrom ENTRY Q_Sline **************************************************************** * ; * Picture mangling routines ; *______________________________________________________________* * ; * Some things should be brought to the attention of ; * whoever tries to D_Read this piece of spaghetti code. ; * ; * First of all, all pictures are flipped and rotated ; * ;as if* the picture were defined in 320-mode. The actual ; * SCB for the D_New picture is no different from that of the ; * old picture, but rectangles which look approximately ; * Q_square will still look approximately Q_square when rotated. ; * Such a rectangle will in fact be twice as wide as tall if ; * it's defined in 640 mode, so before rotation, horizontal ; * values are doubled and vertical values are halved. This ; * can introduce a bit of round-off error, but it's ; * unavoidable. ; * ; * A result of this mode-faking is that occasionally, ; * a 'ShortLine' opcode will have to be translated into a ; * 'Q_Line' opcode, or a 'SLineFrom' into 'LineFrom'. For ; * this reason (and to place mangled Q_Text), the location of ; * the pen is maintained throughout the source picture. ; * ; * Secondly, naively rotated and flipped lines will not ; * appear to be mangled correctly, due to the somewhat ; * inconsistent way QuickDraw handles pensizes. Thus, the ; * pen size is also maintained, and used in Q_NudgePt. ; * ; * Third, there is some number-hacking in Q_Point rotation ; * to prevent rotated pictures from creeping up and to the ; * left. There's a comment in Q_CopyPt describing the hack. ; * ; * Other notes concerning the mangling of pixel maps, ; * Q_Text, and Q_Regions can be found in their respective files. ; * ; * -- jge, 2/4/88 ; * ; **************************************************************** **************************************************************** * * Q_ManglePict(oldpict:l,what:w) -> newpict:l -- the guts of the * picture routines. Interprets the opcodes, distributing * the work to other routines. * **************************************************************** Q_ManglePict PROC EXPORT ;Using Q_PictData EXPORT Q_linetext EXPORT Q_Rects EXPORT Q_Arcs EXPORT Q_Polys EXPORT Q_Regions EXPORT Q_Pixels EXPORT Q_Comments EXPORT Q_Nop EXPORT Q_Copy2 EXPORT Q_Copy4 EXPORT Q_Copy6 EXPORT Q_Point EXPORT Q_OvalSize EXPORT Q_PenSize EXPORT Q_Line EXPORT Q_Lfrom EXPORT Q_Sline EXPORT Q_Slfrom EXPORT Q_Rect EXPORT Q_JustRect EXPORT Q_FixRect EXPORT Q_Arc EXPORT Q_Poly EXPORT Q_DhDv EXPORT Q_ShiftPen EXPORT Q_FakeDhDv EXPORT Q_CopyPt EXPORT Q_manglePt EXPORT Q_NudgePt EXPORT Q_Angles EXPORT Pict_pattern EXPORT Q_Mask EXPORT Q_Undef EXPORT Q_ChangePictSize export oldpict export what export newpict export Q_newsize export oldptr export newptr export count export thepoint export temp input ~~oldpict:l,~~what:w output ~~newpict:l local oldsize:l,~~newsize:l local ~~oldptr:l,~~newptr:l local oldend:l local ~~count:w,~~thepoint:l,~~temp:l begin +b stz Q_picterr *--------------------------------------------------------------* * Lock down the old pict, allocate the D_New one, copy the ; * header, and compute some useful information. ; *--------------------------------------------------------------* movelong #0,Q_theTxFont movelong #0,Q_theSpExtra movelong #0,Q_theChExtra moveword #1,Q_thePnSize moveword #1,Q_thePnSize+2 moveword #0,Q_theFGcolor moveword #15,Q_theBGcolor moveword #0,Q_theTxMode movelong #$ffffffff,Q_theMask movelong #$ffffffff,Q_theMask+4 movelong #0,Q_thePnLoc movelong #0,Q_theTxLoc stz Q_gotPScomm pushlong DC.L Q_Undef ; 11 = DC.L Q_ChExtra ; 12 = char extra DC.L Q_Mask ; 13 = pen Q_Mask DC.L Q_Copy4 ; 14 = Q_Arc rot?? DC.L Q_Copy4 ; 15 = font flags *--------------------------------------------------------------* * The short routine table ; *--------------------------------------------------------------* h_table2 DC.L Q_linetext ; 2x = lines or Q_Text DC.L Q_Rects ; 3x = rectangle DC.L Q_Rects ; 4x = round Q_Rect DC.L Q_Rects ; 5x = oval DC.L Q_Arcs ; 6x = Q_Arc DC.L Q_Polys ; 7x = polygon DC.L Q_Regions ; 8x = Q_Region DC.L Q_Pixels ; 9x = Q_Pixels DC.L Q_Comments ; Ax = Q_Comments **************************************************************** * ; * DRAWING OPCODE-GROUP ROUTINES ; * ; **************************************************************** *--------------------------------------------------------------* * Copy lines or Q_Text, depending on low nybble of Q_op ; *--------------------------------------------------------------* Q_linetext ; lda Q_op ; get the low nybble and #$f jtl lt_table rtl lt_table DC.L Q_Line ; 20 = Q_Line DC.L Q_Lfrom ; 21 = Q_Line from DC.L Q_Sline ; 22 = short Q_Line DC.L Q_Slfrom ; 23 = short Q_Line from DC.L Q_Undef ; 24 = DC.L Q_Undef ; 25 = DC.L Q_Undef ; 26 = DC.L Q_Undef ; 27 = DC.L Q_Text ; 28 = Q_Text DC.L Q_DhText ; 29 = dh Q_Text DC.L Q_DvText ; 2A = dv Q_Text DC.L Q_DhDvText ; 2B = offset Q_Text DC.L Q_LongText ; 2C = long Q_Text DC.L Q_Undef ; 2D = DC.L Q_Undef ; 2E = DC.L Q_Undef ; 2F = *--------------------------------------------------------------* * Copy Q_Rect opcode and parameters (if any) ; *--------------------------------------------------------------* Q_Rects ; lda Q_op ; get the low three bits and #7 cmp #5 ; is this legal? jgt Q_Undef lda Q_op and #8 ; same Q_Rect? jeq Q_Rect ; if not, copy the D_New one jmp Q_Nop ; otherwise, just the opcode will do *--------------------------------------------------------------* * Copy Q_Arc opcode and parameters (if any) ; *--------------------------------------------------------------* Q_Arcs ; lda Q_op ; get the low nybble and #$7 cmp #$5 ; is this legal? jgt Q_Undef lda Q_op and #$8 ; same? jeq Q_Arc ; if not, copy the D_New one jsl Q_Nop ; if so, just copy the opcode jmp Q_Angles ; and the Q_Angles *--------------------------------------------------------------* * Copy Q_Poly opcode and parameters (if any) ; *--------------------------------------------------------------* Q_Polys ; lda Q_op ; get the low nybble and #$7 cmp #$5 ; is this legal? jgt Q_Undef lda Q_op and #$8 ; same? jeq Q_Poly ; if not, copy it jmp Q_Nop ; else, just copy the opcode *--------------------------------------------------------------* * Copy Q_Region opcode and parameters (if any) ; *--------------------------------------------------------------* Q_Regions ; lda Q_op ; get the low nybble and #$7 cmp #$5 ; is this legal? jgt Q_Undef lda Q_op and #$8 ; same? jeq Q_Region ; if not, copy the D_New one jmp Q_Nop ; else just copy the opcode *--------------------------------------------------------------* * Copy pixelmap opcode and parameters ; *--------------------------------------------------------------* Q_Pixels ; cmpw Q_op,#$91 jgt Q_Undef jeq Q_PixRgn jmp Q_PixRect *--------------------------------------------------------------* * Copy comment opcode and data ; * Now mangles the first PSHandle comment appropriately ; *--------------------------------------------------------------* Q_Comments ; cmpw Q_op,#$A1 jne Q_Undef jsl Q_Copy2 ; copy the opcode moveword [ P U N T < ; cmp #256-64 ; bgt dosline ; movelong #2,Q_addbytes ; What luck. Change the pict size jsl Q_ChangePictSize ; to accomodate the different opcode moveword #$20,[ P U N T < ; cmp #265-64 ; bgt doslfrom movelong #2,Q_addbytes ; What luck. Change the pict size jsl Q_ChangePictSize ; to accomodate the different opcode moveword #$21,[ clc adc Q_center+2 ; pt.x <= -(pt.y - Q_center.y) + Q_center.x adc Q_center sta clc adc Q_center sec sbc Q_center+2 sta clc adc Q_center ; pt.y <= -(pt.x - Q_center.x) + Q_center.y adc Q_center+2 sta clc adc Q_center+2 sec sbc Q_center sta **************************************************************** * ; * MISCELLANY ; * ; **************************************************************** *--------------------------------------------------------------* * Abort! An undefined opcode was found! ; *--------------------------------------------------------------* Q_Undef ; moveword #$A501,Q_picterr sec rtl *--------------------------------------------------------------* * Add Q_addbytes to newpict and D_Update the pointer ; *--------------------------------------------------------------* Q_ChangePictSize ; sublong bytes lsr a inc a sta [ boundsok lda Q_pixbounds ; get source rowsize in bytes dec a lsr a ; (already adjusted for mode) inc a sta srowsize lda Q_pixbounds+2 ; get destination rowsize in bytes dec a lsr a ; (already adjusted for mode) inc a sta drowsize lda Q_pixbounds+2 ; is there an extra pixel on the edge and #1 ; of the destination map? sta slop moveword Q_pixbounds,rcount moveword #1,sside stz soffset ; (start at the left of source) rloop jsl D_BeachBall moveword drowsize,doffset ; initialize the offsets movelong srcpix,srcrow ; (start at the top of source) moveword slop,dside ; and other goodies stz pixel ploop moveword [srcrow]:soffset,a ; get the source byte ldx sside ; which side is the pixel on? bne shipixel and #$f ; it's low. ldx dside ; should it be? beq putpixel asl a asl a asl a asl a bra gotpixel shipixel and #$f0 ; it's high ldx dside ; should it be? bne gotpixel lsr a lsr a lsr a lsr a gotpixel ora pixel putpixel sta pixel lda dside ; am I done with this byte? beq nowrite dec doffset ; move backwards through the dest. row movebyte pixel,[dstpix]:doffset lda doffset ; am I done with this row? jeq rdone stz dside stz pixel bra nextp nowrite inc dside nextp addwl srowsize,srcrow ; next source row. brl ploop rdone dec rcount jeq bye addwl drowsize,dstpix ; next destination row lda sside eor #1 sta sside beq stayput ; if sside = 0, same src byte column addwl #1,soffset ; else, use next one stayput brl rloop bye return ENDP **************************************************************** * * Q_RotLMap(srcpix:l,dstpix:l) -- rotate a pixelmap anticlockwise * * Source is scanned leftwards a column at a time, starting * at the bottom of each column. Destination is scanned * downward a row at a time, starting at the right end * of each row. * **************************************************************** Q_RotLMap PROC EXPORT ;Using Q_PictData input srcpix:l,dstpix:l local srowsize:w,drowsize:w,spicsize:l local soffset:w,doffset:w,rcount:w,srcrow:l local pixel:w,slop:w,dside:w,sside:w begin lda Q_pixSCB beq boundsok dec Q_pixbounds ; adjust OLD width of bounds ONLY lsr Q_pixbounds inc Q_pixbounds ; boundsok lda Q_pixbounds ; get source rowsize in bytes dec a lsr a ; (already adjusted for mode) inc a sta srowsize lda Q_pixbounds+2 ; get destination rowsize in bytes dec a lsr a ; (already adjusted for mode) inc a sta drowsize lda Q_pixbounds+2 ; is there an extra pixel on the edge and #1 ; of the destination map? sta slop moveword Q_pixbounds,rcount lda Q_pixbounds ; how about the source map? and #1 sta sside spacelong ; how big is the whole thing? pushword srowsize subword Q_pixbounds+2,#1,s _Multiply pulllong spicsize moveword srowsize,soffset ; start at right of source map dec soffset rloop jsl D_BeachBall moveword drowsize,doffset ; initialize the offsets addlong srcpix,spicsize,srcrow ; (start at bottom of source) ; subwl srowsize,srcrow moveword slop,dside ; and other goodies stz pixel ploop moveword [srcrow]:soffset,a ; get the source byte ldx sside ; which side is the pixel on? bne shipixel and #$f ; it's low. ldx dside ; should it be? beq gotpixel asl a asl a asl a asl a bra gotpixel shipixel and #$f0 ; it's high ldx dside ; should it be? bne gotpixel lsr a lsr a lsr a lsr a gotpixel ora pixel putpixel sta pixel lda dside ; am I done with this byte? beq nowrite dec doffset ; move backwards through the dest. row movebyte pixel,[dstpix]:doffset lda doffset ; am I done with this row? jeq rdone stz dside stz pixel bra nextp nowrite inc dside nextp subwl srowsize,srcrow ; previous source row. brl ploop rdone dec rcount jeq bye addwl drowsize,dstpix ; next destination row lda sside eor #1 sta sside bne stayput ; if sside = 1, same src byte column dec soffset ; else, use previous one stayput brl rloop bye return ENDP END \ No newline at end of file diff --git a/appleworksgs/Pict/Src/region.aii b/appleworksgs/Pict/Src/region.aii new file mode 100755 index 0000000..f1fe7db --- /dev/null +++ b/appleworksgs/Pict/Src/region.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'Pict.equ' INCLUDE 'Driver.equ' IMPORT Q_ChangePictSize IMPORT Q_Copy2 IMPORT Q_JustRect IMPORT D_NeedHandle IMPORT Q_Nop IMPORT D_ZeroBlock IMPORT Q_addbytes IMPORT Q_center IMPORT count IMPORT Q_half IMPORT newptr IMPORT oldptr IMPORT Q_pictSCB IMPORT Q_picterr IMPORT Q_printsquare IMPORT Q_square import temp IMPORT thepoint IMPORT what ENTRY Q_FlipHRgn ENTRY Q_FlipVRgn ENTRY MangleRgn ENTRY Q_RotLRgn ENTRY Q_RotRRgn ENTRY Q_flipdx ENTRY flipdy **************************************************************** * ; * Q_Region flipping and rotating routines ; *______________________________________________________________* * ; * Q_MangleRegion(rgn:l,what:w,prerec:l):newrgn:l ; *______________________________________________________________* * ; * NOTE! The Apple Q_Region data structure is proprietary, ; * and as such, this code may legally belong to Apple, if ; * they ask for it. ; * ; **************************************************************** *--------------------------------------------------------------* * Copy a Q_Region picture opcode and mangle its data ; *--------------------------------------------------------------* Q_Region PROC EXPORT ;Using Q_PictData EXPORT Q_JustRgn jsl Q_Nop ; copy the opcode Q_JustRgn ; cmpw [ clc adc Q_center+2 ; pt.x <= pt.y - Q_center.y + Q_center.x sec sbc Q_center sta temp ; (divide by 2, preserving asl temp ; the sign) ror a ; clc adc Q_Point rts Q_flipdx ; sta Q_Point lda Q_center ; pt.y <= pt.x - Q_center.x + Q_center.y and #1 ; clc adc Q_center sec sbc Q_center+2 sta temp ; (divide by 2, preserving asl temp ; the sign) ror a ; clc adc Q_Point rts *--------------------------------------------------------------* preprgn spacelong pushword #0 pushword rgnsize pushword #$8000 jsl D_NeedHandle sta Q_picterr pulllong newrgn jcs prepped movelong [newrgn],newrptr moveword rgnsize,[newrptr] ; copy the size ldy #2 ; mangle the bounding Q_Rect lda [oldrptr],y jsr flipdy ldy #4 sta [newrptr],y ldy #4 lda [oldrptr],y jsr Q_flipdx ldy #2 sta [newrptr],y ldy #6 lda [oldrptr],y jsr flipdy ldy #8 sta [newrptr],y ldy #8 lda [oldrptr],y jsr Q_flipdx ldy #6 sta [newrptr],y clc ; SIGH prepped rts Q_Point DS.B 2 temp DS.B 2 ENDP **************************************************************** * * Q_RotRRgn -- rotate a Q_Region clockwise * **************************************************************** Q_RotRRgn PROC EXPORT ;Using Q_PictData input oldrgn:l output newrgn:l local tmprgn:l begin spacelong pushlong oldrgn jsl Q_FlipDRgn sta Q_picterr pulllong tmpRgn bcs notmp spacelong pushlong tmprgn jsl Q_FlipHRgn sta Q_picterr pulllong newrgn pushlong tmprgn _DisposeHandle notmp return Q_picterr ENDP **************************************************************** * * Q_RotLRgn -- rotate a Q_Region anticlockwise * **************************************************************** Q_RotLRgn PROC EXPORT ;Using Q_PictData input oldrgn:l output newrgn:l local tmprgn:l begin spacelong pushlong oldrgn jsl Q_FlipHRgn sta Q_picterr pulllong tmpRgn bcs notmp spacelong pushlong tmprgn jsl Q_FlipDRgn sta Q_picterr pulllong newrgn pushlong tmprgn _DisposeHandle notmp return Q_picterr ENDP END \ No newline at end of file diff --git a/appleworksgs/Pict/Src/text.aii b/appleworksgs/Pict/Src/text.aii new file mode 100755 index 0000000..df70fa5 --- /dev/null +++ b/appleworksgs/Pict/Src/text.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'Pict.equ' INCLUDE 'Driver.equ' IMPORT Q_ChangePictSize IMPORT Q_Copy2 IMPORT Q_Copy4 IMPORT D_KillFont IMPORT D_NeedHandle IMPORT Q_Nop IMPORT Q_PixRect IMPORT D_SelectFont IMPORT Q_addbytes IMPORT count IMPORT oldptr IMPORT Q_pictSCB IMPORT Q_picterr IMPORT temp IMPORT Q_theBGcolor IMPORT Q_theChExtra IMPORT Q_theFGcolor IMPORT Q_theFontFlags IMPORT Q_theMask IMPORT Q_thePnSize IMPORT Q_theSpExtra IMPORT Q_theTxFont IMPORT Q_theTxLoc IMPORT Q_theTxMode IMPORT Q_txtBounds IMPORT Q_txtHandle IMPORT Q_txtHsize IMPORT Q_txtImage IMPORT Q_txtPort IMPORT Q_txtPortLoc IMPORT Q_txtRect IMPORT Q_txtSCB IMPORT Q_txtWidth ENTRY Q_MakeTextImage **************************************************************** * ; * Q_Text rotating and flipping routines ; *______________________________________________________________* * ; * FUTURE EXTENSIONS: ; * ; * -- Don't actually record Q_Text size, style, ; * font, color, and flags opcodes in the ; * mangled picture ; * ; * -- Record them as part of a PicComment, along ; * with the orientation of the Q_Text image, so ; * that they can be restored as actual Q_Text ; * call if the picture is restored to its ; * original orientation. ; * ; * -- Add PostScript PicComments so that the ; * rotated/flipped Q_Text still prints out nice ; * and pretty. ; * ; **************************************************************** **************************************************************** * * Q_TextOps -- handle picture opcodes for Q_Text * **************************************************************** Q_TextOps PROC EXPORT ;Using Q_PictData EXPORT Q_FgColor EXPORT Q_BgColor EXPORT Q_TxFont EXPORT Q_TxFace EXPORT Q_TxSize EXPORT Q_TxMode EXPORT Q_ChExtra EXPORT Q_SpExtra EXPORT Q_FontFlags EXPORT Q_Text EXPORT Q_DhText EXPORT Q_DvText EXPORT Q_DhDvText EXPORT Q_LongText *--------------------------------------------------------------* * Remember the foreground color ; *--------------------------------------------------------------* Q_FgColor ; jsl Q_Nop ; move the opcode moveword [ and #7 clc adc Q_txtWidth sta Q_txtWidth ; NOW I've got it. asl a ; compute the adjusted ;pixel* width ldx Q_txtSCB ; 320 or 640? beq gotbnds asl a gotbnds sta Q_txtBounds+6 ; got it! spacelong pushword Q_txtWidth pushword Q_txtBounds+4 _Multiply addlong s,#34,Q_txtHsize ; (34 bytes for Q_PixRect parameters) spacelong ; allocate image handle pushlong Q_txtHsize pushword #$8010 ; lock it within one bank jsl D_NeedHandle sta Q_picterr ; store the error code pulllong ihand jcs abort ; (uh oh.) movelong [ihand],iptr addlong iptr,#34,Q_txtImage ; Adjust ptr back for portLoc movelong ihand,Q_txtHandle pushlong #Q_txtPortLoc _SetPortLoc _PenNormal pushword bg _SetSolidPenPat pushlong #Q_txtBounds _PaintRect pushlong Q_thePnSize _SetPenSize pushlong #Q_theMask _SetPenMask pushword fg _SetForeColor pushword bg _SetBackColor pushword Q_theFontFlags _SetFontFlags pushword #4 ; foreCopy _SetTextMode pushlong txtPoint _MoveTo pushlong txtPtr ; FINALLY! Draw the Q_Text! pushword txtCount _DrawText jsl D_KillFont *--------------------------------------------------------------* * Set up the fake BitsRect opcode structure ; *--------------------------------------------------------------* moveword #$90,[iptr] ; BitsRect opcode moveword Q_pictSCB,[iptr]:#2 ; SCB (MUST be same as picture's) moveword #0,[iptr]:#4 ; BWvsColor moveword Q_txtWidth,[iptr]:#6 ; width movelong #0,[iptr]:#8 ; top left of bounds Q_Rect moveword Q_txtBounds+4,[iptr]:#12 ; bottom of bounds Q_Rect lda Q_txtWidth asl a ; recompute the adjusted pixel width ldx Q_pictSCB ; 320 or 640? beq gotbnds2 asl a gotbnds2 moveword a,[iptr]:#14 ; store it movelong Q_txtRect,[iptr]:#16 ; top left of src Q_Rect (ADJUST?) moveword Q_txtRect+4,[iptr]:#20 ; bottom of src Q_Rect lda Q_txtRect+6 ; ---- ADJUST SOURCE Q_Rect RIGHT ---- ldx Q_txtSCB ; what mode was the Q_Text in? beq was320 ldx Q_pictSCB ; 640. Is the picture? bne putright dec a ; nope. adjust the source bounds lsr a inc a bra putright was320 ldx Q_pictSCB ; 320. Is the picture? beq putright asl a ; nope. adjust it. putright moveword a,[iptr]:#22 ; store it. subword Q_theTxLoc,txtPoint,[iptr]:#24 ; top of dest. subword Q_theTxLoc+2,txtPoint+2,[iptr]:#26 ; left of dest. addword [iptr]:#20,[iptr]:#24,[iptr]:#28 ; bot. of dest. addword [iptr]:#22,[iptr]:#26,[iptr]:#30 ; right of dest. moveword mode,[iptr]:#32 ; mode bra abort notext movelong #0,Q_txtHsize abort _SetPort ; restore the old port return Q_picterr ENDP END \ No newline at end of file diff --git a/appleworksgs/Pict/pict.equ b/appleworksgs/Pict/pict.equ new file mode 100755 index 0000000..be93d0a --- /dev/null +++ b/appleworksgs/Pict/pict.equ @@ -0,0 +1 @@ + ;------------------------------------------ ; ; Equates from procedure Q_PictData ; ;------------------------------------------ Q_fliph equ 0 Q_flipv equ 1 Q_rotr equ 2 Q_rotl equ 3 Q_BadPictData equ $A501 ; Error code: illegal picture data \ No newline at end of file diff --git a/appleworksgs/SS/SS.equ b/appleworksgs/SS/SS.equ new file mode 100755 index 0000000..32f6976 --- /dev/null +++ b/appleworksgs/SS/SS.equ @@ -0,0 +1 @@ +;------------------------------------------ ; ; Global Equates ; ;------------------------------------------ S_MagNum1 equ -6 ; I forgot where it was used S_NormalPen equ $00020001 S_ThickPen equ $00020002 S_RowHeight equ 10 S_EditHeight equ 12 S_EditWidth equ 640 ; not really used yet S_TextOffset equ 9 S_ColLabelHeight equ S_RowHeight+1 S_NumLabelWidth equ 52 ; was 80 S_NumLabOffset equ 8 ; was 30 S_DefaultColWd equ 80 S_MaxCellWidth equ 500 S_MinCellWidth equ 16 S_GrowHeight equ 10 S_GrowWidth equ 25 S_RSRefCon equ 0 S_BSRefCon equ 1 S_GrowRefCon equ 2 S_RDataSize equ 10000 ; hex -> $270F S_BDataSize equ 702 ; hex -> $02BE S_BViewSize equ 1 S_DefDefFormat equ $00020300 S_ColWdStructSize equ 704 ; These are the different message types SS can receive S_ColWidthMsg equ $0200 S_BreakLinkMsg equ $5200 S_BreakGraphLink equ $2500 ; these go to the graph module S_ChartMsg equ $2501 ; These bits are used in the CurEditFlag S_EditingBit equ 1 S_BRMostBit equ 2 ; bit on means I dont know BRMost S_ViewFormulaBit equ 4 S_ManCalcBit equ 8 S_GridOff equ 16 S_KeysInactive equ 32 ; This bit is used temporarily in fixing dependency formulas ; (see S_FixFormula,S_FixFormula2,S_SwapCell) S_RecentlyChangedBit equ $40 S_RecentlyChangedBit2 equ $20 ; Definition of a Key structure S_KeyMin equ 2 S_KeyMax equ 4 S_KeyArray equ 6 S_KeyStructDefault equ 8 S_KeySize equ 2 S_KeyIndexSize equ 4 S_KeyStructSize equ 0 ; word (point to RowCells) S_KeyMap equ 2 ; variable (words) S_KeyIndices equ 4 ; def variable (longs) S_NotACell equ $7FFF7FFF ; *** Driver Equate *** S_EndOfList equ -1 ; Definition of a Cell structure S_CellStructSize equ 36 S_CellID equ 0 ; long S_CellFormat equ 4 ; long Driver Equate S_CellValue equ 8 ; 10 bytes, floating pt Driver Equate S_CellPriority equ 18 ; word S_CellDependOnMe equ 20 ; long S_CellContent equ 24 ; long S_CellNext equ 28 ; long S_CellPrevious equ 32 ; long ; Format, lower word S_CellType equ $E000 S_CellPercent equ $1000 S_CellComma equ $0800 S_CellDollar equ $0400 S_CellRedNeg equ $0200 S_CellParenNeg equ $0100 S_CellSciNote equ $0080 S_CellFixed equ $0040 S_CellInvalid equ $0020 ; 0 = Valid, 1 = Invalid Driver equ S_CellError equ $0010 ; 0 = Not Avail, 1 = Error Driver equ S_CellBold equ $0008 S_CellULine equ $0004 S_CellJustify equ $0003 ; Format, upper word S_CellProtect equ $8000 S_CellInPath equ $0080 ; for circularity checking S_CellVisited equ $0040 ; ' ' " S_CellCircular equ $0020 ; ' ' " ; S_CellInRecalcList equ $0010 S_CellDecPlace equ $000F S_CellTypeText equ $0000 S_CellTypeValue equ $2000 ; *** Driver Equate *** S_CellTypeTextForm equ $4000 ; text formula S_CellTypeFormula equ $6000 ; value formula S_CellTypeLeftPad equ $8000 S_CellTypeRightPad equ $A000 S_CellTypeEmpty equ $E000 S_CellLeftJustify equ $0000 S_CellRightJustify equ $0001 S_CellCenterJustify equ $0002 ; Definition of DependOnMe stucture S_DependStructSize equ 12 S_DependInc equ 4 S_DependSize equ 0 ; long ( size of both lists) S_DependRangeList equ 4 ; long (ptr to list start) S_DependList equ 8 ; variable length (list start) ; Definition of Scrap structure S_ScrapRows equ 0 S_ScrapCols equ 2 S_ScrapParseCode equ 4 S_ScrapSize equ 6 S_ScrapCells equ 10 S_ScrapCellLoc equ 0 S_ScrapCellSize equ 4 S_ScrapFormat equ 6 S_ScrapValueSize equ 10 S_ScrapValue equ 11 S_ScrapValFormula equ 21 ; Definition of File Cell structure ; This is modeled after the scrap structure S_FileRows equ 0 S_FileCols equ 2 S_FileSheetSize equ 4 S_FileSheet equ 8 S_FileCellLoc equ 0 S_FileCellSize equ 4 S_FileFormat equ 6 S_FileValueSize equ 10 S_FileValue equ 11 ; 1/10/89 ; ; This is a list of old File Version numbers S_FileVersion1v1 equ 4 ; Release Version 1.0v1 S_FileVersion1v2 equ 5 ; Release Version 1.0v2 S_FileVersion1v3 equ 6 ; Release Version 1.0v3 ; Theses are the high byte flags that will distinguish the ; entries in the cell table. S_CellTableFlags equ $C000 S_CellTableList equ $4000 S_CellTableSingDep equ $8000 S_CellTableRangeDep equ $C000 ;------------------------------------------ ; ; Equates from procedure S_AttrData ; ;------------------------------------------ S_PasteFormatMI equ 1<<5 S_PasteValueMI equ 1<<6 S_SelectAllMI equ 1<<7 S_InsertMI equ 1<<8 S_DeleteMI equ 1<<9 S_MoveMI equ 1<<10 S_FillMI equ 1<<11 S_TransposeMI equ 1<<12 S_DefaultEdit equ %1111111111110 S_BoldItem equ $401 S_UnderlineItem equ $402 S_AlignLeftItem equ $403 S_AlignCtrItem equ $404 S_AlignRightItem equ $405 S_GeneralItem equ $406 S_FixedItem equ $407 S_DollarItem equ $408 S_PercentItem equ $409 S_SciNoteItem equ $40A S_CommaItem equ $40C S_RedNegItem equ $40D S_ParenItem equ $40E S_SetDefItem equ $40F S_BoldMI equ 1<<0 S_UnderlineMI equ 1<<1 S_AlignLeftMI equ 1<<2 S_AlignCenterMI equ 1<<3 S_AlignRightMI equ 1<<4 S_GeneralMI equ 1<<5 S_FixedMI equ 1<<6 S_DollarSignMI equ 1<<7 S_PercentMI equ 1<<8 S_SciNoteMI equ 1<<9 S_DecimalMI equ 1<<10 S_CommasMI equ 1<<11 S_RedNegNumMI equ 1<<12 S_ParenNegNumMI equ 1<<13 S_SetDefFormatMI equ 1<<14 S_FormatStandard equ %0111111111111111 S_CalculateItem equ $501 S_RecalcItem equ $502 S_ViewItem equ $503 S_ListFormulasItem equ $504 S_ChangeDefWdItem equ $505 S_RestoreWidthItem equ $506 S_SetTitlesItem equ $507 S_GridItem equ $508 S_CalculationMI equ 1<<0 S_RecalcMI equ 1<<1 S_ViewMI equ 1<<2 S_ListFormulasMI equ 1<<3 S_ChangeDefWidthMI equ 1<<4 S_RestoreWidthMI equ 1<<5 S_SetTitlesMI equ 1<<6 S_GridMI equ 1<<7 S_OptionsStandard equ 1+4+8+16+32+64+128 S_GotoItem equ $601 S_SortItem equ $602 S_ProtectItem equ $603 S_NewChartItem equ $604 S_ModChartItem equ $605 S_GotoMI equ 1<<0 S_SortMI equ 1<<1 S_ProtectMI equ 1<<2 S_NewChartMI equ 1<<3 S_ModChartMI equ 1<<4 S_DataStandard equ 1+2+4+8+16 ;------------------------------------------ ; ; Equates from procedure S_ChartData ; ;------------------------------------------ S_PieHCtr equ 150 S_PieVCtr equ 67 S_MaxChartCount equ 100 S_MinOp equ $1F00 S_MaxOp equ $1E00 S_CSize equ 70 S_CType equ 0 S_CRange equ 2 S_CName equ 10 S_CIsMax equ 42 S_CMax equ 44 S_CMin equ 54 S_SpaceBar equ 64 S_CWind equ 66 S_PieLegendH equ 320 S_PieType equ 1 S_BarType equ 2 S_3DBarType equ 3 S_LineType equ 4 S_PtType equ 5 ;------------------------------------------ ; ; Equates from procedure S_UndoData ; ;------------------------------------------ S_UndoColWdType equ 1 S_UndoEntryType equ 2 S_UndoClearType equ 3 S_UndoCutType equ 4 S_UndoPasteType equ 5 S_UndoPasteValuesType equ 6 S_UndoPasteFormatType equ 7 S_UndoFillType equ 8 S_UndoMoveType equ 9 S_UndoDeleteType equ 10 S_UndoInsertType equ 11 S_UndoTransposeType equ 12 S_UndoSortType equ 13 S_UndoImportType equ 14 \ No newline at end of file diff --git a/appleworksgs/SS/SS.link b/appleworksgs/SS/SS.link new file mode 100755 index 0000000..e25183c --- /dev/null +++ b/appleworksgs/SS/SS.link @@ -0,0 +1 @@ + -lseg{Kind} SS Source:AWGS:SS:Obj:Data.aii.o Source:AWGS:SS:Obj:SS.aii.o Source:AWGS:SS:Obj:FileIO.aii.o Source:AWGS:SS:Obj:Edit.aii.o Source:AWGS:SS:Obj:Edit2.aii.o Source:AWGS:SS:Obj:Undo.aii.o Source:AWGS:SS:Obj:Move.aii.o Source:AWGS:SS:Obj:Move2.aii.o Source:AWGS:SS:Obj:Move3.aii.o Source:AWGS:SS:Obj:Sort.aii.o Source:AWGS:SS:Obj:Format.aii.o Source:AWGS:SS:Obj:Options.aii.o Source:AWGS:SS:Obj:DataMenu.aii.o Source:AWGS:SS:Obj:Update.aii.o Source:AWGS:SS:Obj:Draw.aii.o Source:AWGS:SS:Obj:Draw2.aii.o Source:AWGS:SS:Obj:Mouse.aii.o Source:AWGS:SS:Obj:Key.aii.o Source:AWGS:SS:Obj:Misc.aii.o Source:AWGS:SS:Obj:Cells.aii.o Source:AWGS:SS:Obj:Cells2.aii.o Source:AWGS:SS:Obj:CellEdit.aii.o Source:AWGS:SS:Obj:CellEval.aii.o Source:AWGS:SS:Obj:Eval2.aii.o Source:AWGS:SS:Obj:Dlog.aii.o -lseg{Kind} SS2 Source:AWGS:SS:Obj:Misc2.aii.o Source:AWGS:SS:Obj:Dlog2.aii.o Source:AWGS:SS:Obj:Chart.aii.o Source:AWGS:SS:Obj:Pie.aii.o Source:AWGS:SS:Obj:Bar.aii.o Source:AWGS:SS:Obj:ChartData.aii.o \ No newline at end of file diff --git a/appleworksgs/SS/SS.make b/appleworksgs/SS/SS.make new file mode 100755 index 0000000..2b8bbff --- /dev/null +++ b/appleworksgs/SS/SS.make @@ -0,0 +1 @@ +# # SS.make - Makefile for SS # # Copyright 1989, Claris Corporation. # # This is a sub-makefile, called recursively when ::AppleWorks.make is # executed. # # All modules (including Driver, Scrap, Pict., SS, DB, etc.) # should have similar makefiles in their respective folders. # # This makefile rebuilds the module object files as necessary and creates a # file containing the necessary steps to link this module with the rest of # AppleWorksGS. ::AppleWorks.make combines the link files from the modules # into a script which it executes to create an executable. #-------------------------------------------------------------------------------- # Variables AsmIIGSOptions = -i {IncDir},{AWGS}Macros,{AWGS}Driver,{AWGS}Heap,{AWGS}Eval # -d Profile,ProfileNumber=13 Segment1 = SS Segment2 = SS2 Module = SS ModuleDir = {AWGS}{Module}: SrcDir = {ModuleDir}Src: IncDir = {ModuleDir} ObjDir = {ModuleDir}Obj: Linkfile = {ModuleDir}{Module}.link Makefile = {ModuleDir}{Module}.make GlobalIncludes = {IncDir}SS.equ {AWGS}Driver:Driver.equ {AWGS}Heap:Heap.aii.i GlobalMacros = {AWGS}Macros:Macros.dump {AWGS}Macros:M16.Profile Objs = {Objs1} {Objs2} Objs1 = {ObjDir}Data.aii.o {ObjDir}SS.aii.o {ObjDir}FileIO.aii.o {ObjDir}Edit.aii.o {ObjDir}Edit2.aii.o {ObjDir}Undo.aii.o {ObjDir}Move.aii.o {ObjDir}Move2.aii.o {ObjDir}Move3.aii.o {ObjDir}Sort.aii.o {ObjDir}Format.aii.o {ObjDir}Options.aii.o {ObjDir}DataMenu.aii.o {ObjDir}Update.aii.o {ObjDir}Draw.aii.o {ObjDir}Draw2.aii.o {ObjDir}Mouse.aii.o {ObjDir}Key.aii.o {ObjDir}Misc.aii.o {ObjDir}Cells.aii.o {ObjDir}Cells2.aii.o {ObjDir}CellEdit.aii.o {ObjDir}CellEval.aii.o {ObjDir}Eval2.aii.o {ObjDir}Dlog.aii.o Objs2 = {ObjDir}Misc2.aii.o {ObjDir}Dlog2.aii.o {ObjDir}Chart.aii.o {ObjDir}Pie.aii.o {ObjDir}Bar.aii.o {ObjDir}ChartData.aii.o #-------------------------------------------------------------------------------- # Main target {Linkfile} {Objs} {Makefile} @if "`newer {Makefile} {LinkFile}`" @echo "Creating {LinkFile} " @echo " -lseg{Kind} {Segment1} {Objs1} " > {Targ} @echo " -lseg{Kind} {Segment2} {Objs2} " >> {Targ} @else @touch {Linkfile} @end # SS dependencies {Objs} {GlobalIncludes} {GlobalMacros} {ObjDir}Data.aii.o {ObjDir}CellEdit.aii.o {ObjDir}CellEval.aii.o {ObjDir}Cells2.aii.o {ObjDir}Move.aii.o {ObjDir}Move2.aii.o {ObjDir}Move3.aii.o {ObjDir}Undo.aii.o {ObjDir}SS.aii.o {Makefile} {ObjDir}CellEval.aii.o {ObjDir}CellEdit.aii.o {ObjDir}Cells2.aii.o {ObjDir}Dlog2.aii.o {ObjDir}Draw.aii.o {ObjDir}Edit.aii.o {ObjDir}Eval2.aii.o {ObjDir}Misc.aii.o {ObjDir}Misc2.aii.o {ObjDir}Move.aii.o {ObjDir}Move2.aii.o {ObjDir}Move3.aii.o {ObjDir}SS.aii.o {AWGS}Eval:Eval.aii.i clean @confirm "Delete {Module} objs and linkfile?" @if {status} == 0 then rm {Linkfile} {Objs} @end #-------------------------------------------------------------------------------- # Default rules .aii.o .aii AsmIIGS {DepDir}{Default}.aii -o {TargDir}{Default}.aii.o {AsmIIGSOptions} {ObjDir} {SrcDir} \ No newline at end of file diff --git a/appleworksgs/SS/Src/Bar.aii b/appleworksgs/SS/Src/Bar.aii new file mode 100755 index 0000000..86379e0 --- /dev/null +++ b/appleworksgs/SS/Src/Bar.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;------------------------------------------ ; ; Equates from procedure S_BarData ; ;------------------------------------------ S_CHARTMAXH equ 16 S_BarHeight equ 150 S_BarHZero equ 80 S_BarVZero equ 160 ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_ClosePicture IMPORT D_AlertBox IMPORT D_CheckPurge IMPORT D_DrawString IMPORT D_FastMult IMPORT D_KillFont IMPORT D_SelectFont IMPORT D_Set4Pat IMPORT X_FormatValue IMPORT S_ChartTitleLoc IMPORT S_LinearMax IMPORT S_LinearMaxVal IMPORT S_BigBar IMPORT S_ChartColors IMPORT S_Cur2Heap IMPORT S_GetCellPtr IMPORT S_GetMinMax IMPORT S_ItzaBar IMPORT S_NoData IMPORT S_NormalizeRange IMPORT S_NoINF IMPORT S_OneDatum IMPORT S_PictRect IMPORT S_PieOffset IMPORT S_PieSum IMPORT S_TraverseRange IMPORT S_decform2 IMPORT S_drec2 ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_DoPtPlot ENTRY S_BarCount ENTRY S_BarMax ENTRY S_BarMin ENTRY S_BarPoly ENTRY S_BarRect ENTRY S_BarSpace ENTRY S_BarWidth ENTRY S_ChartAxes ENTRY S_DoPlot ENTRY S_DoScaling ENTRY S_OldPt ENTRY S_Plot3DBar ENTRY S_PlotAxes ENTRY S_PlotLine ;--------------------------------------------------------------------------- ; ; S_MakeBar ; ; S_MakeBar PROC EXPORT ;Using S_CurrentData2 ;Using S_ChartData ;Using S_BarData ;Using S_PieData ;Using SANEEQUS input charthdl:l output pict:l local color:w,OldClip:l,chart:l local cellptr:l,col:w,tmp:l local topl:l,botr:l,type:l error err begin stz err H_GetBlockPtr charthdl,chart call S_NormalizeRange,in=([chart]:#S_CRange:l,[chart]:#S_CRange+4:l) pulllong botr pulllong topl cmpw topl+2,botr+2 beq ItsVert subword botr,topl,a bra CkMax ItsVert subword botr,topl,a CkMax cmp #257 blt OKSize call D_AlertBox,in=(#OKCancelBox:w,#S_BigBar:l),out=(a:w) cmp #Cancel jeq abort cmpw topl+2,botr+2 beq ItsVert2 addword topl+2,#255,botr+2 bra OKSize ItsVert2 addword topl,#255,botr OKSize moveword #1,S_ItzaBar stz S_PieOffset call S_TraverseRange,in=(topl:l,botr:l,#S_PieSum:l),err=(err) jcs quit lda S_PieOffset beq NoData cmp #1 bne OpenIt stz type+2 moveaddr S_DoPtPlot+1,type ; hack to find out what kind cmpl type,#S_PlotLine ; of chart is being generated. bne OpenIt call D_AlertBox,in=(#1:w,#S_OneDatum:l),out=(a:w) brl abort NoData call D_AlertBox,in=(#1:w,#S_NoData:l),out=(a:w) brl abort OpenIt call S_GetMinMax,in=(topl:l,botr:l,#1:w),out=(:l) tool FCLASSX,in=(:l) txa asl a cmp #2*FCINF beq @INF call S_GetMinMax,in=(topl:l,botr:l,#0:w),out=(:l) tool FCLASSX,in=(:l) txa asl a cmp #2*FCINF bne @dopict @INF call D_AlertBox,in=(#1:w,#S_NoINF:l),out=(a:w) brl abort @dopict movelong topl,[chart]:#S_CRange movelong botr,[chart]:#S_CRange+4 tool _NewRgn,out=(OldClip:l),err=(err) jcs quit tool _GetClip,in=(OldClip:l) tool _ClipRect,in=(#S_PictRect:l) tool _OpenPicture,in=(#S_Pictrect:l),out=(pict:l) _PenNormal tool _SetPenSize,in=(#2:w,#1:w) pushlong topl pushlong botr H_GetBlockPtr charthdl,chart addlong #S_CMin,chart,s addlong #S_CMax,chart,s call S_DoScaling,in=(:l,:l,:l,:l,[chart]:#S_CIsMax:w) H_GetBlockPtr charthdl,chart call S_ChartAxes,in=(topl:l,botr:l,[chart]:#S_SpaceBar:w) addword S_BarSpace,#S_BarHZero,S_BarRect+2 stz S_BarCount moveword #S_BarVZero,S_OldPt moveword #S_BarHZero,S_OldPt+2 moveword #S_BarVZero,S_LinearMax call S_TraverseRange,in=(topl:l,botr:l,#S_DoPlot:l) H_GetBlockPtr charthdl,chart call S_PlotAxes,in=(topl:l,botr:l,[chart]:#S_SpaceBar:w) DoTitle tool _MoveTo,in=(S_ChartTitleLoc:l) _PenNormal ; necess. for #'s in case of 0's ==> no colour jsl D_KillFont rcall D_SelectFont,in=(#$FFFE:a,#$0800:x,#0:y) H_GetBlockPtr charthdl,chart addlong chart,#S_CName,s call D_DrawString,in=(:l) jsl D_ClosePicture bcs @picErr call D_CheckPurge bcc exit @picErr tool _KillPicture,in=(pict:l) call D_CheckPurge dec err exit _PenNormal whoops tool _SetClip,in=(OldClip:l) tool _DisposeRgn,in=(OldClip:l) quit stz S_ItzaBar return abort dec err bra quit ENDP ;--------------------------------------------------------------------------- ; ; S_ChartAxes ; S_ChartAxes PROC EXPORT ;Using S_ChartData ;Using S_BarData input topl:l,botr:l,spacing:w local range:w,width:w,ptr:l BEGIN cmpw topl+2,botr+2 beq Top2Bot subword botr+2,topl+2,a inc a sta range bra DidRange Top2Bot subword botr,topl,a inc a sta range DidRange moveword #560,width cmpw range,#S_CHARTMAXH+1 bge TooBig rcall D_FastMult,in=(range:x,#32:y) addword a,#16,width lda spacing bne DoSpaces moveword #32,S_BarWidth stz S_BarSpace bra GotWidth DoSpaces moveword #16,S_BarWidth moveword #16,S_BarSpace bra GotWidth TooBig spacelong pushword #1120 lda range asl a inc a pha _UDivide lda spacing bne DoSpaces2 pullword S_BarWidth pla stz S_BarSpace bra GotWidth DoSpaces2 pla plx asl a spacelong pha pushword #3 _UDivide pla plx sta S_BarWidth lsr a sta S_BarSpace GotWidth RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_PlotAxes ; S_PlotAxes PROC EXPORT ;Using S_ChartData ;Using S_BarData input topl:l,botr:l,spacing:w local range:w,width:w,ptr:l,tmp:l local negY:w BEGIN subword #S_BarVZero,S_LinearMax,negY cmpw topl+2,botr+2 beq Top2Bot subword botr+2,topl+2,a inc a sta range bra DidRange Top2Bot subword botr,topl,a inc a sta range DidRange moveword #560,width cmpw range,#S_CHARTMAXH+1 bge TooBig rcall D_FastMult,in=(range:x,#32:y) addword a,#16,width lda spacing bne DoSpaces moveword #32,S_BarWidth stz S_BarSpace bra GotWidth DoSpaces moveword #16,S_BarWidth moveword #16,S_BarSpace bra GotWidth TooBig spacelong pushword #1120 lda range asl a inc a pha _UDivide lda spacing bne DoSpaces2 pullword S_BarWidth pla stz S_BarSpace bra GotWidth DoSpaces2 pla plx asl a spacelong pha pushword #3 _UDivide pla plx sta S_BarWidth lsr a sta S_BarSpace GotWidth _PenNormal jsl D_KillFont rcall D_SelectFont,in=(#$FFFE:a,#$0800:x,#0:y) in #S_BarHZero-6:w,#0:l,#S_BarMin:l out tmp:w,ptr:l,a:w xcall X_FormatValue subword #S_BarHZero-6,tmp,tmp tool _MoveTo,in=(tmp:w,#S_BarVZero:w) call D_DrawString,in=(ptr:l) in #S_BarHZero-6:w,#0:l,#S_BarMax:l out tmp:w,ptr:l,a:w xcall X_FormatValue subword #S_BarHZero-6,tmp,tmp tool _MoveTo,in=(tmp:w,#S_BarVZero-S_BarHeight:w) call D_DrawString,in=(ptr:l) lda negY bpl @noNegY in #S_BarHZero-6:w,#0:l,#S_LinearMaxVal:l out tmp:w,ptr:l,a:w xcall X_FormatValue subword #S_BarHZero-6,tmp,tmp addword S_LinearMax,#10,tmp+2 tool _MoveTo,in=(tmp:w,tmp+2:w) call D_DrawString,in=(ptr:l) @noNegY tool _SetPenSize,in=(#2:w,#1:w) ; Horizontal axis (group both axes) tool _PicComment,in=(#picLParen:w,#0:w,#0:l) tool _MoveTo,in=(#S_BarHZero-6:w,#S_BarVZero:w) tool _Line,in=(width:w,#0:w) ; Vertical axis tool _MoveTo,in=(#S_BarHZero:w,#S_BarVZero-S_BarHeight:w) tool _LineTo,in=(#S_BarHZero:w,S_LinearMax:w) ; Stubs tool _MoveTo,in=(#S_BarHZero:w,#S_BarVZero-S_BarHeight:w) tool _Line,in=(#-6:w,#0:w) lda negY bpl @nothird tool _MoveTo,in=(#S_BarHZero:w,S_LinearMax:w) tool _Line,in=(#-6:w,#0:w) @nothird tool _PicComment,in=(#picRParen:w,#0:w,#0:l) RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_DoPlot ; S_DoPlot PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 ;Using SANEEQUS ;Using S_BarData EXPORT S_DoPtPlot input cell:l local cellptr:l,h1:w,height:r,tmp:l local h2:w,tmpSane:r local h3:w,tmpSane2:r BEGIN +b addword S_BarRect+2,S_BarWidth,S_BarRect+6 call S_GetCellPtr,in=(cell:l),out=(cellptr:l) ora CellPtr jeq exit addlong cellptr,#S_CellFormat,tmp lda [tmp] and #S_CellTypeValue cmp #S_CellTypeText jeq exit addlong cellptr,#S_CellValue,cellptr tool FCLASSX,in=(cellptr:l) txa asl a cmp #2*FCINF jeq exit ; is it infinity? skip it. moveword #S_BarHeight,tmp tool FI2X,in=(!tmp:l,!height:l) moveX [cellptr],tmpSane tool FSUBX,in=(#S_BarMin:l,!tmpSane:l) moveX S_BarMax,tmpSane2 tool FSUBX,in=(#S_BarMin:l,!tmpSane2:l) tool FDIVX,in=(!tmpSane2:l,!height:l) tool FMULX,in=(!tmpSane:l,!height:l) tool FX2I,in=(!height:l,!tmp:l) subword #S_BarVZero,tmp,a bmi PlotIt cmp S_LinearMax blt PlotIt sta S_LinearMax moveX [cellptr],S_LinearMaxVal PlotIt stz cell+2 moveaddr S_DoPtPlot+1,cell ; hack to find out what kind cmpl cell,#S_Plot3DBar ; of chart is being generated. bne NormPlot ; Only group 3D-bar charts... tool _PicComment,in=(#picLParen:w,#0:w,#0:l) jsr HeresPlot tool _PicComment,in=(#picRParen:w,#0:w,#0:l) bra exit NormPlot jsr HeresPlot bra exit HeresPlot pushlong tmp S_DoPtPlot jsl >0 rts exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_PlotBar ; S_PlotBar PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 ;Using SANEEQUS ;Using S_BarData input pt:l BEGIN lda pt bmi NegVal subword #S_BarVZero,pt,S_BarRect moveword #S_BarVZero+1,S_BarRect+4 bra GotRect NegVal subword #S_BarVZero,pt,S_BarRect+4 moveword #S_BarVZero,S_BarRect GotRect movelong #S_ChartColors,pt lda S_BarCount cmp #$0C blt DoColor lda #0 sta S_BarCount DoColor asl a tay call D_Set4Pat,in=([pt]:y:w) inc S_BarRect+6 inc S_BarRect+6 tool _PaintRect,in=(#S_BarRect:l) _PenNormal tool _SetPenSize,in=(#2:w,#1:w) tool _FrameRect,in=(#S_BarRect:l) dec S_BarRect+6 dec S_BarRect+6 exit addword S_BarRect+6,S_BarSpace,S_BarRect+2 inc S_BarCount RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_Plot3DBar ; S_Plot3DBar PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 ;Using SANEEQUS ;Using S_BarData input pt:l local pt1:l,pt2:l,pt3:l,pt4:l,pt5:l BEGIN lda pt bmi NegVal subword #S_BarVZero,pt,S_BarRect moveword #S_BarVZero+1,S_BarRect+4 bra GotRect NegVal subword #S_BarVZero,pt,S_BarRect+4 moveword #S_BarVZero,S_BarRect GotRect movelong #S_ChartColors,pt lda S_BarCount cmp #$0C blt DoColor lda #0 sta S_BarCount DoColor asl a tay call D_Set4Pat,in=([pt]:y:w) inc S_BarRect+6 inc S_BarRect+6 tool _PaintRect,in=(#S_BarRect:l) _PenNormal tool _SetPenSize,in=(#2:w,#1:w) tool _FrameRect,in=(#S_BarRect:l) subword S_BarRect,#4,pt1 addword S_BarRect+2,#8,pt1+2 moveword pt1,pt2 addword S_BarRect+6,#6,pt2+2 moveword pt2+2,pt3+2 subword S_BarRect+4,#5,pt3 movelong S_BarRect+4,pt4 dec pt4 dec pt4+2 dec pt4+2 moveword S_BarRect,pt5 subword S_BarRect+6,#2,pt5+2 tool _OpenPoly,out=(S_BarPoly:l) tool _MoveTo,in=(pt4:l) tool _LineTo,in=(pt5:l) tool _LineTo,in=(pt2:l) tool _LineTo,in=(pt3:l) tool _LineTo,in=(pt4:l) _ClosePoly tool _PicComment,in=(#picLParen:w,#0:w,#0:l) call D_Set4Pat,in=(#RightGray:w) tool _PaintPoly,in=(S_BarPoly:l) call D_Set4Pat,in=(#Black:w) ; tool _FramePoly,in=(S_BarPoly:l) ; tool _MoveTo,in=(pt4:l) ; tool _LineTo,in=(pt5:l) ; Work around Apple's tool _LineTo,in=(pt2:l) ; polygon - picture bug tool _LineTo,in=(pt3:l) ; tool _LineTo,in=(pt4:l) ; tool _KillPoly,in=(S_BarPoly:l) tool _PicComment,in=(#picRParen:w,#0:w,#0:l) tool _OpenPoly,out=(S_BarPoly:l) tool _MoveTo,in=(S_BarRect:l) tool _LineTo,in=(pt5:l) tool _LineTo,in=(pt2:l) tool _LineTo,in=(pt1:l) tool _LineTo,in=(S_BarRect:l) _ClosePoly tool _PicComment,in=(#picLParen:w,#0:w,#0:l) tool _PaintPoly,in=(S_BarPoly:l) ; tool _FramePoly,in=(S_BarPoly:l) ; tool _MoveTo,in=(S_BarRect:l) ; As above... tool _LineTo,in=(pt5:l) ; tool _LineTo,in=(pt2:l) ; tool _LineTo,in=(pt1:l) ; tool _LineTo,in=(S_BarRect:l) ; tool _KillPoly,in=(S_BarPoly:l) tool _PicComment,in=(#picRParen:w,#0:w,#0:l) dec S_BarRect+6 dec S_BarRect+6 addword S_BarRect+6,S_BarSpace,S_BarRect+2 inc S_BarCount RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_DoScaling ; S_DoScaling PROC EXPORT ;Using S_BarData ;Using SANEEQUS ;Using S_SaneData2 input first:l,last:l,min:l,max:l,isMax:w local h1:w,sanetmp:r,tmpmin:l BEGIN moveX [min],S_BarMin lda isMax jne DoMove ; Find the absolute Max over range call S_GetMinMax,in=(first:l,last:l,#0:w),out=(tmpmin:l) moveX [tmpmin],sanetmp movelong !sanetmp,tmpmin call S_GetMinMax,in=(first:l,last:l,#1:w),out=(max:l) moveX [tmpmin],sanetmp tool FABSX,in=(!sanetmp:l) tool FCMPX,in=(!sanetmp:l,max:l) bvc @didAbs movelong !sanetmp,max @didAbs stz S_decform2 ; float moveword #3,S_decform2+2 ; 3 digits DidDecPlace tool FX2DEC,in=(#S_decform2:l,max:l,#S_drec2:l) lda S_drec2 bne AllNeg DoCeiling moveword #$3030,S_drec2+6 ; '00' lda S_drec2+5 and #$FF ina cmp #'9'+1 blt GotNew inc S_drec2+2 lda #'1' bra GotNew AllNeg call S_GetMinMax,in=(first:l,last:l,#0:w),out=(max:l) tool FX2DEC,in=(#S_decform2:l,max:l,#S_drec2:l) stz S_drec2 bra DoCeiling GotNew xba ora #3 ; strlen. sta S_drec2+4 tool FDEC2X,in=(#S_drec2:l,#S_BarMax:l) tool FTESTXCP,in=(#$0004:w) ; Ck for overflow beq exit DoMove moveX [max],S_BarMax exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_PlotLine ; S_PlotLine PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 ;Using SANEEQUS ;Using S_BarData input pt:l BEGIN moveword S_BarRect+2,pt+2 subword #S_BarVZero,pt,pt lda S_BarCount ina sta S_BarCount cmp #1 beq exit tool _MoveTo,in=(S_OldPt:l) tool _LineTo,in=(pt:l) exit movelong pt,S_OldPt addword S_BarRect+6,S_BarSpace,S_BarRect+2 RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_PlotPt ; S_PlotPt PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 ;Using SANEEQUS ;Using S_BarData input pt:l local dotrect:r BEGIN moveword S_BarRect+2,pt+2 subword #S_BarVZero,pt,pt movelong pt,dotrect movelong pt,dotrect+4 dec dotrect inc dotrect+4 inc dotrect+4 dec dotrect+2 dec dotrect+2 inc dotrect+6 inc dotrect+6 inc dotrect+6 tool _PaintOval,in=(!dotrect:l) movelong pt,S_OldPt exit addword S_BarRect+6,S_BarSpace,S_BarRect+2 RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_BarData ; S_BarData PROC EXPORT EXPORT S_OldPt EXPORT S_BarCount EXPORT S_BarWidth EXPORT S_BarSpace EXPORT S_BarMax EXPORT S_BarMin EXPORT S_BarRect EXPORT S_BarPoly S_OldPt DS.L 1 S_BarCount DS.W 1 S_BarWidth DS.W 1 S_BarSpace DS.W 1 S_BarMax DS.B 10 S_BarMin DC.W 0,0,0,0,0 S_BarRect DS.B 8 S_BarPoly DS.L 1 ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/CellEdit.aii b/appleworksgs/SS/Src/CellEdit.aii new file mode 100755 index 0000000..f739ecf --- /dev/null +++ b/appleworksgs/SS/Src/CellEdit.aii @@ -0,0 +1 @@ + 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_MemoryError IMPORT X_FormatValue IMPORT S_AddCellToChangedList IMPORT S_BuildSimpleUndo IMPORT S_CalculateCell IMPORT S_CalculateSheet IMPORT S_CellWidth IMPORT S_ChkCellProtect IMPORT S_CurBRSelect IMPORT S_CurBScrl IMPORT S_CurContHt IMPORT S_CurContRect IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurEditFlag IMPORT S_CurEditRect IMPORT S_CurFormat IMPORT S_CurHeap IMPORT S_CurLEHandle IMPORT S_CurRScrl IMPORT S_CurTLSelect IMPORT S_FindLeftContent IMPORT S_FindRightContent IMPORT S_GetCellIndex IMPORT S_GetCellPtr IMPORT S_HiliteCells IMPORT S_InsertDependency IMPORT S_InsertLeftPadCells IMPORT S_InsertRightPadCells IMPORT S_LoadingFile IMPORT S_NewCell IMPORT S_ProtectedCellMsg IMPORT S_RedrawCellRange IMPORT S_RemoveCell IMPORT S_RemovePadCells IMPORT S_SetCircularBits IMPORT S_SetUndoOn IMPORT S_Thumb IMPORT S_UpdatePriorities IMPORT S_WhereCell ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_AcceptCell ENTRY S_DrawLEText ENTRY S_ParseText ENTRY S_RearrangePadCells ;-------------------------------------------------------------------------; ; S_NewLineEdit ( CellIndex:l ) ; ; S_NewLineEdit is called to setup a New line edit entry in the entry bar. ; CellIndex is an index to the cell which will appear in the line edit. S_NewLineEdit PROC EXPORT ;Using S_CurrentData input CellIndex:l local CellType:w,ContentIndex:l,CellPtr:l,StringPtr:l BEGIN ; If CellIndex is not NIL then get the content as the ; default value for line edit. lda CellIndex ora CellIndex+2 bne getdefault setempty ldx #0 brl setText getdefault H_GetBlockPtr CellIndex,CellPtr MoveLong [CellPtr]:#S_CellContent,ContentIndex MoveWord [CellPtr]:#S_CellFormat,a and #S_CellType sta CellType bmi setempty and #S_CellTypeTextForm beq notFormula H_GetBlockPtr ContentIndex,StringPtr in S_CurTLSelect:l,StringPtr:l out StringPtr:l XCall E_ExpandFormula bra adjustString2 notText SpaceWord ; string length SpaceLong ; string ptr SpaceWord ; color PushWord #$7FFF PushLong #$000F2000 AddLong CellPtr,#S_CellValue,s Call X_FormatValue pla PullLong StringPtr pla bra adjustString2 notFormula lda CellType bne notText H_GetBlockPtr ContentIndex,StringPtr lda [StringPtr] and #$FF00 ; 'A' cmp #$4100 blt adjustString1 cmp #$5B00 ; 'Z' + 1 blt adjustString2 cmp #$6100 ; 'a' blt adjustString1 cmp #$7B00 ; 'z' + 1 bge adjustString1 adjustString2 lda [StringPtr] and #$00FF tax incl StringPtr setText Tool _LESetText,in=(StringPtr:l,x:w,S_CurLEHandle:l) bra doDraw adjustString1 lda [StringPtr] and #$00FF inc a tax lda [StringPtr] pha and #$FF00 ora #$0027 sta [StringPtr] Tool _LESetText,in=(StringPtr:l,x:w,S_CurLEHandle:l) H_GetBlockPtr ContentIndex,StringPtr PullWord [StringPtr] ; Display the line edit string in the entry bar, but first make ; sure that the line edit field has been deactivated ( ie get ; rid of any Cursor in the entry bar). doDraw Tool _LEDeactivate,in=(S_CurLEHandle:l) Call S_DrawLEText RETURN QuotePtr DC.B $27 ; hex for single quote ENDP ;---------------------------------------------------------------------------- ; ; S_SetCaret PROC EXPORT ;Using S_CurrentData input location:w BEGIN Tool _LEActivate,in=(S_CurLEHandle:l) ; Tool _EraseRect,in=(#S_CurEditRect:l) ; Tool _LEUpdate,in=(S_CurLEHandle:l) in location:w,location:w,S_CurLEHandle:l XTool _LESetSelect RETURN ENDP ;-------------------------------------------------------------------------; ; S_EndEdit ( Accept:w ) ; ; S_EndEdit is called whenever editing in the LineEdit is to stop. If ; accept is TRUE (non-zero) then the contents of the LineEdit string will ; be copied into a cell structure for the selected cell. The line edit will be ; deactivated and the EditingBit of S_EditFlag will be cleared. ; Note: The line edit is still displayed and its text handle still ; contains the text - it has simply been deactivated; to clear the line ; edit and the entrybar S_ClearLineEdit must be called. S_EndEdit PROC EXPORT ;Using S_CurrentData ;Using S_ErrorData ;Using SANEequs input Accept:w local Size:w,TextPtr:l,TextHandle:l local Cell:l,CellPtr:l,CellIndex:l,ValuePtr:l local LCell:l,RCell:l local TypeCell:w,ContentIndex:l error ErrorFlag BEGIN stz ErrorFlag MoveLong S_CurTLSelect,Cell ; Deactivate LineEdit and check if accept flag is false Tool _LEDeactivate,in=(S_CurLEHandle:l) lda Accept bne doAccept in Cell:l out :l XCall S_GetCellIndex Call S_NewLineEdit,in=(:l) brl Exit doAccept Call S_GetCellIndex,in=(Cell:l),out=(CellIndex:l) ora CellIndex beq buildUndo in Cell:l,CellIndex:l XCall S_ChkCellProtect bcc buildUndo lda S_CurFormat+2 and #S_CellProtect beq buildUndo Call D_AlertBox,in=(#OkBox:w,#S_ProtectedCellMsg:l),out=(a:w) brl Exit buildUndo in S_CurTLSelect:l,S_CurTLSelect:l XCall S_BuildSimpleUndo,err=ErrorFlag jcs doMemError Tool _LEGetTextLen,in=(S_CurLEHandle:l),out=(Size:w) bne hasContents MoveWord #S_CellTypeEmpty,TypeCell ; stz ContentIndex ; stz ContentIndex+2 bra AcceptCell hasContents Tool _LEGetTextHand,in=(S_CurLEHandle:l),out=(TextHandle:l) in S_CurTLSelect:l,TextHandle:l,#0:l,Size:w,#DRec:l,#0:w out TypeCell:w,ContentIndex:l XCall S_ParseText,err=ErrorFlag bcc AcceptCell lda ErrorFlag and #$FF00 bne doMemError Call S_SetCaret,in=(ErrorFlag:w) bra finishError doMemError Call D_MemoryError finishError brl Exit AcceptCell SpaceLong SpaceLong PushLong Cell lda S_CurFormat+2 and #-1-S_CellCircular pha lda S_CurFormat and #$FFFF-S_CellType-S_CellInvalid-S_CellError ora TypeCell pha PushLong ContentIndex Call S_AcceptCell,err=ErrorFlag PullLong RCell PullLong LCell bcc chkContent Call D_MemoryError brl redrawRange chkContent lda TypeCell bmi DrawCells cmp #S_CellTypeValue beq handleValue cmp #S_CellTypeFormula bne doJump handleFormula lda S_CurEditFlag and #S_ManCalcBit beq doJump Call S_CalculateCell,in=(Cell:l),err=ErrorFlag doJump brl DrawCells handleValue in Cell:l out CellPtr:l XCall S_GetCellPtr AddLong CellPtr,#S_CellValue,ValuePtr Tool FDEC2X,in=(#DRec:l,ValuePtr:l) Tool FCLASSX,in=(ValuePtr:l) cpx #$80FF bne DrawCells Tool FNEGX,in=(ValuePtr:l) ; Draw the affected cells ; DrawCells in Cell:l out :l XCall S_GetCellIndex Call S_NewLineEdit,in=(:l) redrawRange Call S_RedrawCellRange,in=(LCell:l,RCell:l) Call S_AddCellToChangedList,in=(Cell:l) Call S_SetUndoOn,in=(#S_UndoEntryType:w) lda S_CurEditFlag and #S_ManCalcBit bne Exit Call S_CalculateSheet,err=ErrorFlag Exit RETURN DRec DS.B 33 SaneZero DC.W 0,0,0,0,0 ENDP ; Dead Code ; ; ;-------------------------------------------------------------------------; ; ; S_ClearLineEdit ( ) ; ; ; ; ; ; S_ClearLineEdit PROC EXPORT ; ;Using S_CurrentData ; ; BEGIN ; ; ; Clear the LineEdit text and redisplay. ; ; Tool _LESetText,in=(#0:l,#0:w,S_CurLEHandle:l) ; Call S_DrawLEText ; ; RETURN ; ENDP ;-------------------------------------------------------------------------; ; S_DrawLEText ( ) ; ; S_DrawLEText will call S_DrawEntryBar with the clip set so that only ; the text string itself is redrawn. S_DrawLEText PROC EXPORT ;Using S_CurrentData BEGIN Tool _NewRgn,out=(:l) PushLong 1:s Tool _GetClip,in=(:l) Tool _ClipRect,in=(#S_CurEditRect:l) Tool _EraseRect,in=(#S_CurEditRect:l) Tool _LEUpdate,in=(S_CurLEHandle:l) PushLong 1:s Tool _SetClip,in=(:l) Tool _DisposeRgn,in=(:l) RETURN ENDP ;----------------------------------------------------------------------------- ; ParseText(Cell:l,TextHandle:l,Offset:l,TextSize:w,DecRecPtr:l): ; CellType:w,ContentIndex:l ; ; ParseCode <> 0 means to make parse error cells as text type. S_ParseText PROC EXPORT ;Using S_CurrentData input Cell:l,TextHandle:l,Offset:l,TextSize:w input DecRecPtr:l,ParseCode:w output CellType:w,ContentIndex:l local TextPtr:l,StringPtr:l,Size:l error ErrorFlag BEGIN stz ErrorFlag lda TextSize AddWord a,#1,Size stz Size+2 AddLong [TextHandle],Offset,TextPtr lda [TextPtr] and #$00FF cmp #'' beq doNum cmp #'' beq doNum cmp #'' beq doNum cmp #'=' beq doFormula jge doText cmp #$27 ; ' jeq doQuote cmp #$22 ; " jeq doQuote cmp #'-' beq doNum cmp #'.' beq doNum cmp #'+' beq doNum cmp #'$' beq doNum cmp #'0' blt doText cmp #'9'+1 bge doText doNum Call E_ParseNumber,in=(TextPtr:l,TextSize:w,DecRecPtr:l) bcs doText MoveWord #S_CellTypeValue,CellType stz ContentIndex stz ContentIndex+2 brl Exit doFormula MoveWord #S_CellTypeFormula,CellType in TextPtr:l,TextSize:w,Cell:l,ParseCode:w out ContentIndex:l XCall E_ParseFormula,err=ErrorFlag jcc Exit lda ErrorFlag ; if tool (memory) error and #$FF00 ; exit anyway jne Exit lda ParseCode jeq Exit stz ErrorFlag bra doText doQuote Moveword #S_CellTypeText,CellType IncL Offset dec TextSize dec Size bra copyString doText Moveword #S_CellTypeText,CellType copyString H_NewBlock Size,ContentIndex,StringPtr,err=ErrorFlag bcs Exit ; Copy LineEdit text to Cell structure with length byte to form ; proper pascal string. ; Copy String ; MoveWord TextSize,[StringPtr] incl StringPtr AddLong [TextHandle],Offset,s PushLong StringPtr PushWord #0 PushWord TextSize Tool _BlockMove,in=(:l,:l,:l) Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_NewEditCell(Cell:l) ; S_NewEditCell PROC EXPORT ;Using S_CurrentData input Cell:l local CellPtr:l,Value:w,Width:w local OldClipRgn:l,Col:w,ErrorFlag:w BEGIN ; The old Cell needs to be accepted, if edited. ; lda S_CurEditFlag and #S_EditingBit beq ChkBump Call S_EndEdit,in=(#-1:w),err=ErrorFlag jcs Exit clrEdit lda S_CurEditFlag and #-1-S_EditingBit sta S_CurEditFlag ; Bump the window until the New cell is completely in view ; ChkBump Call S_WhereCell,in=(Cell:l),out=(:w,:w,:w,:w) pla jeq bumpDown cmp S_CurContHt jge bumpUp pla jeq bumpRight cmp S_CurContWd jge bumpLeft pla pla ; The Cell is completely in view ; Tool _NewRgn,out=(:l) MoveLong 1:s,OldClipRgn Tool _GetClip,in=(:l) Tool _ClipRect,in=(#S_CurContRect:l) Call S_HiliteCells MoveWord Cell,S_CurTLSelect sta S_CurBRSelect MoveWord Cell+2,S_CurTLSelect+2 sta S_CurBRSelect+2 Call S_HiliteCells Tool _SetClip,in=(OldClipRgn:l) Tool _DisposeRgn,in=(OldClipRgn:l) ; The New cell needs to be displayed in the LE field. ; in Cell:l out :l XCall S_GetCellIndex Call S_NewLineEdit,in=(:l) Exit RETURN ;---------------------------- bumpLeft pla pla lda Cell+2 sta Col dec a sta Value MoveWord S_CurContXpt,Width leftLoop dec Col Call S_CellWidth,in=(Col:w),out=(a:w) AddWord a,Width,Width cmp S_CurContWd bge BumpH dec Value bra leftLoop bumpRight pla pla lda Cell+2 dec a sta Value BumpH Tool _SetCtlValue,in=(Value:w,S_CurBScrl:l) Call S_Thumb,in=(S_CurBScrl:l) brl ChkBump ;---------------------------- bumpUp pla pla pla lda Cell dec a sta Value lda S_CurContYpt upLoop AddWord a,#S_RowHeight,a cmp S_CurContHt bge BumpV dec Value bra upLoop bumpDown pla pla pla lda Cell dec a sta Value BumpV Tool _SetCtlValue,in=(Value:w,S_CurRScrl:l) Call S_Thumb,in=(S_CurRScrl:l) brl ChkBump ENDP ;-------------------------------------------------------------------------; ; S_AcceptCell ( Cell:l,Format:l,ContentIndex:l ): TLCell:l,BRCell:l ; ; S_AcceptCell is called whenever a 'user' cell is to be stuck into the ; current sheet. If the cell is to appear empty, then the Cell Type should ; be negative. S_AcceptCell PROC EXPORT ;Using S_CurrentData ;Using S_FileIOData ;Using SANEequs input Cell:l,Format:l,ContentIndex:l output LCell:l,RCell:l local CellPtr:l,ContCell:l local CellIndex:l,TypeCell:w error ErrorFlag BEGIN stz ErrorFlag MoveWord Cell,LCell sta RCell MoveWord Cell+2,LCell+2 sta RCell+2 Call S_RemoveCell,in=(Cell:l) ; lda ContentIndex ; changed 12/13/88 ; ora ContentIndex+2 ; removing numeric text ; jne hasContents lda Format bpl hasContents in Cell:l out LCell:l,RCell:l XCall S_RearrangePadCells,err=ErrorFlag brl Exit ; Get New Cell Structure hasContents ; lda Format and #S_CellType sta TypeCell in Cell:l,TypeCell:w,Format:l,ContentIndex:l out CellIndex:l,CellPtr:l XCall S_NewCell,err=ErrorFlag jcs Exit in Cell:l out LCell:l,RCell:l XCall S_RemovePadCells,err=ErrorFlag jcs Exit lda TypeCell and #S_CellTypeTextForm bne handleFormula lda TypeCell cmp #S_CellTypeText jne Exit ; Set up pad cells if needed ; handleText in Cell:l out CellPtr:l XCall S_GetCellPtr MoveLong ContentIndex,[CellPtr]:#S_CellValue in Cell:l out ax:l XCall S_InsertRightPadCells,err=ErrorFlag bcs memError cpx RCell+2 blt chkRight2 stx RCell+2 chkRight2 in Cell:l out ax:l XCall S_InsertLeftPadCells,err=ErrorFlag bcs memError cpx LCell+2 bge Exit stx LCell+2 bra Exit handleFormula in Cell:l,ContentIndex:l XCall S_InsertDependency,err=ErrorFlag bcs memError lda S_LoadingFile bne doPriorities Call S_SetCircularBits,in=(Cell:l) doPriorities Call S_UpdatePriorities,in=(Cell:l) bra Exit memError Call S_RemoveCell,in=(Cell:l) Exit RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_RearrangePadCells PROC EXPORT input Cell:l output LCell:l,RCell:l local CellPtr:l,ContCell:l error ErrFlag BEGIN ProfileIn 10 stz ErrFlag in Cell:l out LCell:l,RCell:l XCall S_RemovePadCells,err=ErrFlag jcs Exit chkLeftSide lda LCell+2 dec a tax beq chkRightSide in x:w,LCell:w out CellPtr:l XCall S_GetCellPtr ora CellPtr jeq chkRightSide MoveWord [CellPtr]:#S_CellFormat,a and #S_CellType bpl goRight cmp #S_CellTypeRightPad bne chkRightSide goRight in LCell:l out ContCell:l,a:w XCall S_FindLeftContent in ContCell:l out ax:l XCall S_InsertRightPadCells,err=ErrFlag cpx RCell+2 blt chkRightSide stx RCell+2 brl Exit chkRightSide lda ErrFlag bne Exit lda RCell+2 inc a tax cmp #$02BF jge Exit in x:w,RCell:w out CellPtr:l XCall S_GetCellPtr ora CellPtr jeq Exit MoveWord [CellPtr]:#S_CellFormat,a and #S_CellType bpl goLeft cmp #S_CellTypeRightPad jne Exit goLeft in RCell:l out ContCell:l,a:w XCall S_FindRightContent in ContCell:l out ax:l XCall S_InsertLeftPadCells,err=ErrFlag cpx LCell+2 bge Exit stx LCell+2 Exit ProfileOut 10 RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/CellEval.aii b/appleworksgs/SS/Src/CellEval.aii new file mode 100755 index 0000000..c8dd51c --- /dev/null +++ b/appleworksgs/SS/Src/CellEval.aii @@ -0,0 +1 @@ + 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 ; S_ZeroRecalcList PROC EXPORT BEGIN ldx #S_NumOfRecalcBuckets<<2 lda #0 loop dex dex sta S_RecalcList,x bne loop RETURN ENDP ;-------------------------------------------------------------------------; ; S_AddCellToRecalcList( Cell:l ) ; ; S_AddCellToRecalcList will add a cell to the recalculate list. ; The recalculate list is now implemented by a series of buckets. ; The buckets will contain those cells that need to be recalculated ; which have the lower n bits of the priority number equal to the ; bucket number. S_AddCellToRecalcList PROC EXPORT ;Using S_CurrentData input Cell:l local RecalcPtr:l,CellPtr:l,CellPriority:w local NextCell:l,NextPtr:l,BucketOffset:w BEGIN in Cell:l out CellPtr:l XCall S_GetCellPtr ora CellPtr ; does this ever happen ? beq toExit MoveWord [CellPtr]:#S_CellFormat+2,a and #S_CellCircular bne toExit MoveWord [CellPtr]:#S_CellNext,a ; checks if in a list ldy #S_CellNext+2 ora [CellPtr],y beq addToList ; no long refs = 0 toExit brl Exit ; First figure out which bucket to add cell to and then do the ; insertion Sort on that bucket. addToList MoveWord [CellPtr]:#S_CellPriority,CellPriority and #S_NumOfRecalcBuckets-1 asl a asl a sta BucketOffset tax lda S_RecalcList,x ora S_RecalcList+2,x bne exists MoveLong Cell,S_RecalcList:x MoveLong #S_EndOfList,[CellPtr]:#S_CellNext brl Exit exists in S_RecalcList:x:l out RecalcPtr:l XCall S_GetCellPtr CmpWord [RecalcPtr]:#S_CellPriority,CellPriority blt startLoop ldx BucketOffset MoveLong S_RecalcList:x,[CellPtr]:#S_CellNext MoveLong Cell,S_RecalcList:x bra Exit loop MoveLong NextPtr,RecalcPtr startLoop MoveLong [RecalcPtr]:#S_CellNext,NextCell CmpLong NextCell,#S_EndOfList beq FoundPlace in NextCell:l out NextPtr:l XCall S_GetCellPtr CmpWord [NextPtr]:#S_CellPriority,CellPriority blt loop FoundPlace MoveLong NextCell,[CellPtr]:#S_CellNext MoveLong Cell,[RecalcPtr]:#S_CellNext Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_AddCellToDepList( CellToEnter:l,TargetCell:l ) ; ; S_AddCellToDepList will add a cell to another cell's dependency list. S_AddCellToDepList PROC EXPORT ;Using S_CurrentData input CellToEnter:l,TargetCell:l local CellIndex:l,CellPtr:l,DependPtr:l local DependSize:l,NewSize:l,DependList:l,LastPtr:l local DependRangeList:l,NewRangeList:l,CellExists:w local OtherCellInList:l error ErrorFlag BEGIN stz ErrorFlag stz CellExists in TargetCell:l out CellIndex:l XCall S_GetCellTableEntry ora CellIndex beq noDepsOnMe lda CellIndex+2 and #S_CellTableFlags beq targetExists MoveLong CellIndex,DependList bra depListExists ; The TagetCell is real, so we have to dereference it to get the ; depend list if there is one. targetExists inc CellExists H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellDependOnMe,DependList MoveWord [CellPtr]:#S_CellDependOnMe+2,DependList+2 ora DependList bne depListExists ; There are no previous DependOnMe's for this TargetCell ; We will Create a short list (type: Single) noDepsOnMe MoveWord CellToEnter,DependList lda CellToEnter+2 ora #S_CellTableSingDep sta DependList+2 lda CellExists jeq noCell brl storeInCell ; Previous DependOnMe's exists, but we don't know how many and ; which type they are. depListExists lda DependList+2 jpl fullListExists and #$FFFF-S_CellTableFlags sta OtherCellInList+2 MoveWord DependList,OtherCellInList lda DependList+2 and #S_CellTableFlags cmp #S_CellTableRangeDep beq singleAndRange ; The previous list was only one single dependency reference. ; Check to see if it is the CellToEnter, and if not, make a ; full dep list. CmpLong CellToEnter,OtherCellInList jeq Exit MoveLong #S_DependStructSize+S_DependInc,DependRangeList bra createList ; The previous list was only one range dependency reference. ; Make a full dep list. singleAndRange MoveLong #S_DependStructSize,DependRangeList createList H_NewBlock #S_DependStructSize+S_DependInc,DependList,DependPtr,err=ErrorFlag jcs Exit MoveLong #S_DependStructSize+S_DependInc,[DependPtr]:#S_DependSize MoveLong DependRangeList,[DependPtr]:#S_DependRangeList MoveLong CellToEnter,[DependPtr]:#S_DependList MoveLong OtherCellInList,[DependPtr]:#S_DependList+S_DependInc lda DependList+2 ora #S_CellTableList sta DependList+2 ; Determine where to store the New DependList just created. lda CellExists beq noCell H_GetBlockPtr CellIndex,CellPtr storeInCell MoveLong DependList,[CellPtr]:#S_CellDependOnMe brl Exit noCell in TargetCell:l,DependList:l XCall S_SetCellTableEntry,err=ErrorFlag brl Exit ; A previous full DependOnMe list exists, insert the New cell if it ; is not already in the list fullListExists ; lda DependList+2 ; already in 'a' and #-1-S_CellTableList sta DependList+2 ; Search the original list. H_GetBlockPtr DependList,DependPtr MoveLong [DependPtr]:#S_DependSize,DependSize MoveLong [DependPtr]:#S_DependRangeList,DependRangeList AddLong DependPtr,DependRangeList,LastPtr AddLong DependPtr,#S_DependList,DependPtr bra cmpPtrs SearchLoop CmpLong [DependPtr],CelltoEnter jeq Exit AddLong DependPtr,#S_DependInc,DependPtr cmpPtrs CmpLong DependPtr,LastPtr blt SearchLoop ; Cell is not already in DependOnMe List ; AddLong DependSize,#S_DependInc,NewSize AddLong DependRangeList,#S_DependInc,NewRangeList H_ResizeBlock DependList,NewSize,DependPtr,err=ErrorFlag bcs Exit AddLong DependPtr,DependRangeList,s AddLong DependPtr,NewRangeList,s SubLong DependSize,DependRangeList,s Tool _BlockMove MoveLong NewSize,[DependPtr]:#S_DependSize MoveLong NewRangeList,[DependPtr]:#S_DependRangeList AddLong DependRangeList,DependPtr,DependPtr MoveLong CellToEnter,[DependPtr] Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_RemoveCellFromDepList( CellToRemove:l,TargetCell:l ) ; ; S_RemoveCellFromDepList will remove a cell from another cell's dependency ; list. S_RemoveCellFromDepList PROC EXPORT ;Using S_CurrentData input CellToRemove:l,TargetCell:l local CellIndex:l local CellPtr:l,DependList:l,DependPtr:l,NewDependList:l local DependSize:l,NewSize:l,NextPtr:l,LastPtr:l local DependRangeList:l,NewRangeList:l,CellExists:w error ErrorFlag BEGIN stz ErrorFlag stz CellExists in TargetCell:l out CellIndex:l XCall S_GetCellTableEntry ora CellIndex beq toExit lda CellIndex+2 and #S_CellTableFlags beq targetExists MoveLong CellIndex,DependList bra depListExists ; The TargetCell is real, so we have to de-reference it to get the ; DependOnMe list, if there is one. targetExists inc CellExists H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellDependOnMe,DependList MoveWord [CellPtr]:#S_CellDependOnMe+2,DependList+2 ora DependList bne depListExists toExit brl Exit ; Previous DependOnMe's exist, but we don't know how many and of ; of which type they are. depListExists lda DependList+2 bpl fullListExists ; Only one previous DependOnMe. and #S_CellTableFlags cmp #S_CellTableRangeDep beq toExit ; It was a single reference, chk to see if it is the CellToRemove lda DependList+2 and #$FFFF-S_CellTableFlags cmp CellToRemove+2 bne toExit CmpWord DependList,CellToRemove bne toExit ; It was, replace it with no list. stzl NewDependList brl storeDepList ; A previous full DependOnMe list exists, chk the following. ; 1) Are there any single references. ; 2) Is there more than two references. ; 3) Is there two single references, or one single and one range reference. fullListExists lda DependList+2 and #-1-S_CellTableList sta DependList+2 H_GetBlockPtr DependList,DependPtr CmpLong [DependPtr]:#S_DependRangeList,#S_DependList jeq Exit CmpLong #S_DependStructSize+S_DependInc,[DependPtr]:#S_DependSize jne moreThanTwo CmpLong [DependPtr]:#S_DependRangeList,#S_DependList+S_DependInc bne twoSingles ; There is one single and one range reference, if the single reference ; is the CellToRemove, then leave a short list (type: range) CmpLong CellToRemove,[DependPtr]:#S_DependList jne Exit MoveWord [DependPtr]:#S_DependList+S_DependInc,NewDependList MoveWord [DependPtr]:#S_DependList+S_DependInc+2,a ora #S_CellTableRangeDep sta NewDependList+2 bra killDepList ; There are two single references. Check if either one is the CellToRemove. ; If so, leave the other in a short list. (type: single) twoSingles CmpLong CellToRemove,[DependPtr]:#S_DependList bne notFirst MoveWord [DependPtr]:#S_DependList+S_DependInc,NewDependList MoveWord [DependPtr]:#S_DependList+S_DependInc+2,a bra setSingle notFirst CmpLong CellToRemove,[DependPtr]:#S_DependList+S_DependInc jne Exit MoveWord [DependPtr]:#S_DependList,NewDependList MoveWord [DependPtr]:#S_DependList+2,a setSingle ora #S_CellTableSingDep sta NewDependList+2 killDepList H_DisposeBlock DependList ; Determine where to store the NewDependList storeDepList lda CellExists beq noCell MoveLong NewDependList,[CellPtr]:#S_CellDependOnMe brl Exit noCell Call S_SetCellTableEntry,in=(TargetCell:l,NewDependList:l) brl Exit ; There are more than two DependOnMe references. Check if the CellToRemove ; is in the single list, and remove it. moreThanTwo MoveLong [DependPtr]:#S_DependSize,DependSize MoveLong [DependPtr]:#S_DependRangeList,DependRangeList AddLong DependPtr,DependRangeList,LastPtr AddLong DependPtr,#S_DependList,NextPtr SearchLoop CmpLong [NextPtr],CelltoRemove beq found AddLong NextPtr,#S_DependInc,NextPtr CmpLong NextPtr,LastPtr blt SearchLoop brl Exit found SubLong DependSize,#S_DependInc,NewSize SubLong DependRangeList,#S_DependInc,NewRangeList MoveLong NewSize,[DependPtr]:#S_DependSize MoveLong NewRangeList,[DependPtr]:#S_DependRangeList AddLong NextPtr,#S_DependInc,s PushLong NextPtr AddLong DependPtr,DependSize,s SubLong 1:s,NextPtr,1:s Tool _BlockMove H_ResizeBlock DependList,NewSize ; resize smaller always works Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_CalculateSheet ; ; S_CalculateSheet will handle the calculation of all necessary cells. S_CalculateSheet PROC EXPORT ;Using S_CurrentData local RecalcIndex:l,RecalcPtr:l local Cell:l,CellPtr:l,Next:l,HighFormat:w local CurrentPriority:w,CurrentBucket:w,LastBucket:w local LowestPriority:w,BestBucket:w error ErrFlag BEGIN stz ErrFlag lda S_CurChangedList ora S_CurChangedList+2 jeq Exit ; Put the changed list in the recalc list. The recalc list is now ; a series of buckets, so that the sorting process will go much ; faster on long lists. Call S_ZeroRecalcList MoveLong S_CurChangedList,Next changedLoop Call D_BeachBall MoveLong Next,Cell in Cell:l out CellPtr:l XCall S_GetCellPtr MoveLong [CellPtr]:#S_CellNext,Next lda #0 MoveWord a,[CellPtr]:#S_CellNext MoveWord a,[CellPtr]:#S_CellNext+2 MoveWord a,[CellPtr]:#S_CellPrevious MoveWord a,[CellPtr]:#S_CellPrevious+2 MoveWord [CellPtr]:#S_CellFormat,a bmi addDepList ; branch pad cells and #S_CellTypeTextForm bne addToRecalc ; branch all formulas addDepList Call S_AddDepListToRecalc,in=(Cell:l) bra getNextCell addToRecalc Call S_AddCellToRecalcList,in=(Cell:l) getNextCell CmpLong Next,#S_EndOfList bne changedLoop stz S_CurChangedList stz S_CurChangedList+2 ; Start re-calculating ; ; Things to remember: 1) The RecalcList must be maintained ; during calculation, so that New ; cells may be added to it. stz CurrentPriority stz CurrentBucket startFindNext ldx CurrentBucket SubWord x,#4,a and #(S_NumOfRecalcBuckets<<2)-1 sta LastBucket MoveWord #-1,LowestPriority loopN lda S_RecalcList,x ora S_RecalcList+2,x beq contSearch ; There is a list here, check if the first cell is of the ; right priority, if not, remember the lowest priority and ; continue the search. stx CurrentBucket in S_RecalcList:x:l out CellPtr:l XCall S_GetCellPtr CmpWord [CellPtr]:#S_CellPriority,CurrentPriority beq doThisCell ldx CurrentBucket CmpWord [CellPtr]:y,LowestPriority bge contSearch sta LowestPriority stx BestBucket contSearch cpx LastBucket beq lookedAtAll inc CurrentPriority AddWord x,#4,a and #(S_NumOfRecalcBuckets<<2)-1 tax bra loopN ; We've looked at all of the buckets, and didn't find any ; of the right priority, on this pass. If we saw any cells, ; we have remembered the lowest priority. lookedAtAll CmpWord LowestPriority,#-1 jeq Exit MoveWord BestBucket,CurrentBucket tax in S_RecalcList:x:l out CellPtr:l XCall S_GetCellPtr MoveWord [CellPtr]:#S_CellPriority,CurrentPriority ; This is the next cell to recalculate. We'll first fix up the ; list it is in, calculate it, and then add it's dependencies. ; Then we start the search loop over to find the next cell to ; calculate. doThisCell ldx CurrentBucket MoveLong S_RecalcList:x,Cell MoveLong [CellPtr]:#S_CellNext,S_RecalcList:x CmpLong S_RecalcList:x,#S_EndOfList bne recalcSet MoveWord #0,S_RecalcList:x sta S_RecalcList+2,x recalcSet MoveLong #0,[CellPtr]:#S_CellNext Call S_CalculateCell,in=(Cell:l),err=ErrFlag bcs calcMemError Call S_AddDepListToRecalc,in=(Cell:l) lda S_CurEditFlag and #S_ViewFormulaBit bne getNextCell2 Call S_RedrawCellRange,in=(Cell:l,Cell:l) getNextCell2 brl startFindNext ; We had a memory error during recalculation. This can happen ; when the result of a formula is a string, and there isn't ; enough memory in the heap to hold the string. ; We need to remember all the cells that need to be recalculated ; and recalculate them the next time S_CalculateSheet is called. calcMemError Call S_AddCellToRecalcList,in=(Cell:l) stz CurrentBucket errorLoop ldx CurrentBucket lda S_RecalcList,x ora S_RecalcList+2,x beq noneHere MoveLong S_RecalcList:x,Cell in Cell:l out CellPtr:l XCall S_GetCellPtr ldx CurrentBucket MoveLong [CellPtr]:#S_CellNext,S_RecalcList:x MoveLong #0,[CellPtr]:#S_CellNext CmpLong Cell,#S_EndOfList bne addToCanged MoveWord #0,S_RecalcList:x sta S_RecalcList+2,x addToCanged Call S_AddCellToChangedList,in=(Cell:l) bra errorLoop noneHere AddWord CurrentBucket,#4,a and #(S_NumOfRecalcBuckets<<2)-1 sta CurrentBucket bne errorLoop Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_AddDepListToRecalc( Cell:l ) ; ; S_AddListToRecalc will add a cell's dependency list to the recalculate ; list. S_AddDepListToRecalc PROC EXPORT ;Using S_CurrentData input Cell:l local CellPtr:l,DepListPtr:l local LastPtr:l,DependList:l BEGIN in Cell:l out CellPtr:l XCall S_GetCellPtr ora CellPtr jeq Exit MoveWord [CellPtr]:#S_CellDependOnMe,DependList MoveWord [CellPtr]:#S_CellDependOnMe+2,DependList+2 ora DependList beq Exit lda DependList+2 bpl fullList and #$FFFF-S_CellTableFlags pha PushWord DependList Call S_AddCellToRecalcList,in=(:l) bra Exit fullList and #$FFFF-S_CellTableFlags sta DependList+2 H_GetBlockPtr DependList,DepListPtr AddLong DepListPtr,[DepListPtr],LastPtr ; size AddLong DepListPtr,#S_DependList,DepListPtr loop Call S_AddCellToRecalcList,in=([DepListPtr]:l) AddLong DepListPtr,#S_DependInc,DepListPtr CmpLong DepListPtr,LastPtr blt loop Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_CalculateCell( Cell:l ) ; ; S_CalculateCell will handle the calculation of an individual cell. S_CalculateCell PROC EXPORT ;Using S_CurrentData input Cell:l local CellIndex:l local CellPtr:l,RefCellPtr:l,ContentPtr:l error ErrFlag BEGIN stz ErrFlag Call D_BeachBall in Cell:l out CellIndex:l XCall S_GetCellIndex H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellFormat,a bmi Exit and #S_CellTypeTextForm ; checks formula bit beq Exit MoveWord [CellPtr]:#S_CellFormat+2,a and #S_CellCircular bne Exit Call S_EvalFormula,in=(CellIndex:l),err=ErrFlag Exit RETURN ENDP ;---------------------------------------------------------------------------- ; S_CheckStack ; S_CheckStack PROC EXPORT tsc pha AddWord >D_MainZPage,#1024,a cmp 1,s ; carry set = limit stack pla rtl ;---------------------------------------------------------------------------- ; S_TraverseDependOnMeTree ; ; This routine will start at the given cell and call a given routine on that ; cell and all cells in the dependency branch until/unless an abort signal is ; passed back from the traverse routine. The traverse routine should be of ; the following form: ; ; S_TraverseRoutine,in=(CellPtr:l),out=(ProceedCode:w),err=AbortTraverse ; S_TraverseDependOnMeTree PROC EXPORT ;Using S_CurrentData ;Using S_PriorityData input Cell:l,Routine:l local CellPtr:l,DependList:l,DepListPtr:l,LastPtr:l local OrigStack:w,NoRoomMsg:w,OverflowIndex:w,OverflowArray:l error AbortTraverse BEGIN stz AbortTraverse stz NoRoomMsg stz OverflowIndex stz OverflowArray+2 AddWord >D_MainZPage,#256,OverflowArray tsc sta OrigStack MoveWord Routine,>Slot+1 MoveWord Routine+1,>Slot+2 startRoutine lda #0 pha pha pha pha beginCell Call S_CheckStack bcc stackOK jsr handleOverFlow brl endCell stackOK in Cell:l out CellPtr:l XCall S_GetCellPtr ora CellPtr jeq endCell ; Make Call SpaceWord PushLong CellPtr slot Call >0 sta AbortTraverse PullWord jcs cleanStack ; The result of the routine will tell if this branch of the tree ; should be traversed or skipped. jne endCell ; Now loop on the DependOnMe list and make an iteration for each of the ; the cells that depend on this cell. MoveWord [CellPtr]:#S_CellDependOnMe,DependList MoveWord [CellPtr]:#S_CellDependOnMe+2,DependList+2 ora DependList beq endCell lda DependList+2 bpl doFullList and #$FFFF-S_CellTableFlags sta DependList+2 MoveLong !DependList,DepListPtr stzl LastPtr bra dependLoop doFullList and #$FFFF-S_CellTableFlags tay ldx DependList H_GetBlockPtr xy,DepListPtr AddLong DepListPtr,[DepListPtr],LastPtr AddLong DepListPtr,#S_DependList,DepListPtr ; We want this routine to be iterative, not recursive, so as to use less ; stack space. dependLoop PushLong DepListPtr PushLong LastPtr MoveLong [DepListPtr],Cell brl beginCell endCell PullLong LastPtr PullWord DepListPtr PullWord DepListPtr+2 ora DepListPtr beq recoverOverflow AddLong DepListPtr,#S_DependInc,DepListPtr CmpLong DepListPtr,LastPtr blt dependLoop bra endCell recoverOverflow lda OverflowIndex beq chkMsg SubWord OverflowIndex,#4,OverflowIndex MoveLong [OverflowArray]:OverflowIndex,Cell brl startRoutine ; We jump to here if we want to abort the traversal. We need to ; clean up the stack. cleanStack lda OrigStack tcs chkMsg lda NoRoomMsg beq Exit Call D_AlertBox,in=(#OKBox:w,#S_DepOnMeTreeTooBig:l),out=(a:w) Exit RETURN handleOverFlow ldy OverflowIndex cpy #260 bge noRoom MoveLong Cell,[OverflowArray]:y AddWord OverflowIndex,#4,OverflowIndex rts noRoom MoveWord #1,NoRoomMsg rts ENDP ;-------------------------------------------------------------------------; ; S_CheckCellCircularity ; ; S_CheckCellCircularity PROC EXPORT EXPORT S_FirstCallToCheckCircularity EXPORT S_OrigCell input CellPtr:l output ProceedCode:w error AbortFlag BEGIN stz AbortFlag lda S_FirstCallToCheckCircularity bne firstCall CmpLong [CellPtr]:#S_CellId,S_OrigCell bne noCircularity MoveWord #-1,AbortFlag brl exit firstCall stz S_FirstCallToCheckCircularity noCircularity ldy #S_CellFormat+2 lda [CellPtr],y and #S_CellCircular+S_CellVisited bne deadEnd lda [CellPtr],y ora #S_CellVisited sta [CellPtr],y stz ProceedCode bra exit deadEnd MoveWord #1,ProceedCode exit RETURN S_FirstCallToCheckCircularity DS.W 1 S_OrigCell DS.L 1 ENDP ;-------------------------------------------------------------------------; ; S_SetCellCircular ; ; S_SetCellCircular PROC EXPORT input CellPtr:l output ProceedCode:w error AbortFlag BEGIN stz AbortFlag ldy #S_CellFormat+2 lda [CellPtr],y and #S_CellCircular beq setIt MoveWord #1,ProceedCode bra exit setIt lda [CellPtr],y and #-1-S_CellVisited ora #S_CellCircular sta [CellPtr],y ; Clear the value of this cell ; ldy #S_CellFormat lda [CellPtr],y and #S_CellType cmp #S_CellTypeTextForm bne storeZero lda [CellPtr],y and #$FFFF-S_CellType ora #S_CellTypeFormula sta [CellPtr],y H_DisposeBlock [CellPtr]:#S_CellValue storeZero lda #0 ldy #S_CellValue ldx #5 zeroLoop sta [CellPtr],y iny iny dex bne zeroLoop ; Draw the circ. cell ; MoveWord [CellPtr]:#S_CellId+2,a tax MoveWord [CellPtr]:#S_CellId,a Call S_RedrawCellRange,in=(ax:l,ax:l) stz ProceedCode exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_ClearCellVisited ; ; The whole DependOnMe tree had visited bits set, before this routine ; started to clear them. S_ClearCellVisited PROC EXPORT input CellPtr:l output ProceedCode:w error AbortFlag BEGIN stz AbortFlag ; If the visited bit is not set, then we have already cleared it, ; and all of the cells past this point in the DependOnMe tree have ; also been cleared. ldy #S_CellFormat+2 lda [CellPtr],y and #S_CellVisited beq deadEnd ; Clear the bit. lda [CellPtr],y and #-1-S_CellVisited sta [CellPtr],y stz ProceedCode bra exit deadEnd MoveWord #1,ProceedCode exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_SetCircularBits ; ; S_SetCircularBits PROC EXPORT ;Using S_CurrentData input Cell:l local CellPtr:l BEGIN in Cell:l out CellPtr:l XCall S_GetCellPtr ora CellPtr beq Exit ; Check if any of the cells in the formula are circular. ; If so, set all cells depending on this routine as circular. in Cell:l,[CellPtr]:#S_CellContent:l out a:w XCall S_CheckForCirc bne setCircularity ; Traverse DependOnMe checking for circularity ; MoveWord #-1,S_FirstCallToCheckCircularity MoveLong Cell,S_OrigCell in Cell:l,#S_CheckCellCircularity:l XCall S_TraverseDependOnMeTree bcc clearVisited ; Traverse DependOnMe setting the circularity bits ; setCircularity in Cell:l,#S_SetCellCircular:l XCall S_TraverseDependOnMeTree bra Exit ; Traverse DependOnMe clearing the visited bits ; clearVisited in Cell:l,#S_ClearCellVisited:l XCall S_TraverseDependOnMeTree Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_ClearCellCircular ; ; The whole DependOnMe tree had visited bits set, before this routine ; started to clear them. S_ClearCellCircular PROC EXPORT input CellPtr:l output ProceedCode:w error AbortFlag BEGIN stz AbortFlag ; If the visited bit is not set, then we have already cleared it, ; and all of the cells past this point in the DependOnMe tree have ; also been cleared. ldy #S_CellFormat+2 lda [CellPtr],y and #S_CellCircular beq deadEnd ; Should the bit be cleared? in [CellPtr]:#S_CellId:l,[CellPtr]:#S_CellContent:l out a:w XCall S_CheckForCirc bne deadEnd ; Clear the bit. ldy #S_CellFormat+2 lda [CellPtr],y and #-1-S_CellCircular sta [CellPtr],y stz ProceedCode bra exit deadEnd MoveWord #1,ProceedCode exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_ResetCircularBits ; ; S_ResetCircularBits PROC EXPORT ;Using S_CurrentData input Cell:l BEGIN in Cell:l,#S_ClearCellCircular:l XCall S_TraverseDependOnMeTree RETURN ENDP ;----------------------------------------------------------------------------- ; S_CheckForCirc( Cell:l, ContentIndex:l ) , CircFlag:w ; S_CheckForCirc PROC EXPORT ;Using S_CurrentData input Cell:l,ContentIndex:l output CircFlag:w local ContentPtr:l,NumCells:w,CurCell:w local RefType:w,TargetCell:l,TargetCell2:l BEGIN stz CircFlag H_GetBlockPtr ContentIndex,ContentPtr lda ContentPtr+2 ora ContentPtr jeq Exit MoveWord [ContentPtr]:#E_FormulaCells,NumCells MoveWord #E_FormulaData,CurCell cmp NumCells jge Exit loop MoveWord [ContentPtr]:CurCell,a and #$00FF sta RefType and #$0080 jeq singleRef iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell:l XCall S_GetRealCell AddWord CurCell,#5,CurCell tay MoveWord [ContentPtr]:y,a and #$00FF sta RefType iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell2:l XCall S_GetRealCell Call S_NormalizeRange,in=(TargetCell:l,TargetCell2:l) in #S_IsCellCircular:l ; 2 inputs already on stack XCall S_TraverseRange bcc nextCell bra setCircFlag singleRef iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell:l XCall S_GetRealCell Call S_IsCellCircular,in=(TargetCell:l) bcc nextCell setCircFlag MoveWord #S_CellCircular,CircFlag bra Exit nextCell AddWord CurCell,#5,CurCell cmp NumCells bge Exit brl loop Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Cells.aii b/appleworksgs/SS/Src/Cells.aii new file mode 100755 index 0000000..bf804c0 --- /dev/null +++ b/appleworksgs/SS/Src/Cells.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' ; INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_GrowHandle IMPORT D_NeedHand IMPORT S_CurRowBlock ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_GetKeyIndex ENTRY S_GetRowStructIndex ENTRY S_SetKeyIndex ENTRY S_SetRowStructIndex ;--------------------------------------------------------------------------- ; S_SetCellTableEntry ; S_SetCellTableEntry PROC EXPORT ;Using S_CurrentData input Cell:l,NewCellIndex:l local OldRowIndex:l,NewRowIndex:l error ErrorFlag BEGIN stz ErrorFlag in Cell:w out OldRowIndex:l XCall S_GetRowStructIndex in Cell+2:w,OldRowIndex:l,NewCellIndex:l out NewRowIndex:l XCall S_SetKeyIndex,err=ErrorFlag bcs Exit CmpLong OldRowIndex,NewRowIndex beq Exit in Cell:w,NewRowIndex:l XCall S_SetRowStructIndex,err=ErrorFlag bcs killNewRow lda OldRowIndex ora OldRowIndex+2 beq Exit Tool _DisposeHandle,in=(OldRowIndex:l) bra Exit killNewRow Tool _DisposeHandle,in=(NewRowIndex:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_GetCellTableEntry( Cell:l ) : Index:l ; S_GetCellTableEntry PROC EXPORT ;Using S_CurrentData input Cell:l output Index:l BEGIN StructPtr equ Index in Cell:w out StructPtr:l XCall S_GetRowStructIndex ora StructPtr beq Exit in Cell+2:w,StructPtr:l out Index:l XCall S_GetKeyIndex Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_GetCellIndex( Cell:l ) : CellIndex:l ; S_GetCellIndex PROC EXPORT ;Using S_CurrentData input Cell:l output CellIndex:l BEGIN Call S_GetCellTableEntry,in=(Cell:l),out=(CellIndex:l) and #S_CellTableFlags beq Exit stzl CellIndex Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_GetCellPtr( Cell:l ) : CellPtr:l ; S_GetCellPtr PROC EXPORT ;Using S_CurrentData input Cell:l output CellPtr:l BEGIN +b CellIndex equ CellPtr in Cell:l out CellIndex:l XCall S_GetCellIndex ora CellIndex beq Exit ; return 0 if cell doesn't exist H_GetBlockPtr CellIndex,CellPtr Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_GetKeyIndex( Key:w,Struct:l ) : Index:l ; S_GetKeyIndex PROC EXPORT ;Using S_CurrentData input Key:w,Struct:l output Index:l BEGIN StructPtr equ Struct ; MoveLong [Struct],ax ldy #2 lda [Struct],y tax lda [Struct] sta StructPtr stx StructPtr+2 CmpWord Key,[StructPtr]:#S_KeyMax bge notFound SubWord a,[StructPtr]:#S_KeyMin,a blt notFound asl a asl a AddWord a,#S_KeyArray,y MoveLong [StructPtr]:y,Index bra Exit notFound stz Index stz Index+2 Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_SetKeyIndex ; S_SetKeyIndex PROC EXPORT ;Using S_CurrentData input Key:w,OldStructIndex:l,NewIndex:l output StructIndex:l local StructPtr:l,Min:w,Max:w,ZeroMin:w,ZeroMax:w local NewSize:w error ErrorFlag BEGIN S_Key2StructDefault equ 26 stz ErrorFlag MoveWord OldStructIndex,StructIndex MoveWord OldStructIndex+2,StructIndex+2 ora OldStructIndex jne structExists lda NewIndex ora NewIndex+2 jeq Exit in #S_Key2StructDefault:l out StructIndex:l XCall D_NeedHand,err=ErrorFlag jcs Exit MoveLong [StructIndex],StructPtr MoveWord #S_Key2StructDefault,[StructPtr] MoveWord Key,[StructPtr]:#S_KeyMin inc a MoveWord a,[StructPtr]:#S_KeyMax MoveLong NewIndex,[StructPtr]:#S_KeyArray brl Exit structExists MoveLong [OldStructIndex],StructPtr CmpWord Key,[StructPtr]:#S_KeyMax bge notFoundMax SubWord a,[StructPtr]:#S_KeyMin,a blt notFoundMin asl a asl a AddWord a,#S_KeyArray,y ; Put the New index over the last one, it is up to the caller ; to dispose of the old one. MoveLong NewIndex,[StructPtr]:y brl Exit notFoundMax ldy #S_KeyMin MoveWord [StructPtr]:y,Min lda Key inc a sta Max SubWord a,[StructPtr]:y,a asl a asl a AddWord a,#S_KeyArray,ZeroMax SubWord [StructPtr]:#S_KeyMax,[StructPtr]:#S_KeyMin,a asl a asl a AddWord a,#S_KeyArray,ZeroMin bra loadIndex notFoundMin eor #$FFFF inc a asl a asl a AddWord a,#S_KeyArray,ZeroMax MoveWord #S_KeyArray,ZeroMin MoveWord Key,Min MoveWord [StructPtr]:#S_KeyMax,Max loadIndex lda NewIndex ora NewIndex+2 jeq Exit SubWord Max,Min,a asl a asl a AddWord a,#S_KeyArray,a cmp [StructPtr] blt OKsize AddWord a,#S_Key2StructDefault,NewSize in #0:w,NewSize:w,OldStructIndex:l XCall D_GrowHandle,err=ErrorFlag bcs Exit MoveLong [OldStructIndex],StructPtr MoveWord NewSize,[StructPtr] OKsize CmpWord ZeroMin,#S_KeyArray bne OKfix AddLong a,StructPtr,s lda ZeroMax AddLong a,StructPtr,s pea 0 SubWord [StructPtr]:#S_KeyMax,[StructPtr]:#S_KeyMin,a asl a asl a pha Tool _BlockMove,in=(:l,:l,:l) OKfix lda #0 ldy ZeroMin zeroLoop sta [StructPtr],y iny iny cpy ZeroMax blt zeroLoop MoveWord Min,[StructPtr]:#S_KeyMin MoveWord Max,[StructPtr]:#S_KeyMax SubWord Key,Min,a asl a asl a AddWord a,#S_KeyArray,y MoveLong NewIndex,[StructPtr]:y Exit RETURN ENDP ;-------------------------------------------------------------------------- ; S_GetRowStructIndex( Row:w ) Index:l ; S_GetRowStructIndex PROC EXPORT ;Using S_CurrentData input Row:w output StructIndex:l BEGIN stz StructIndex stz StructIndex+2 lda S_CurRowBlock ora S_CurRowBlock+2 beq Exit in Row:w,S_CurRowBlock:l out StructIndex:l XCall S_GetKeyIndex Exit RETURN ENDP ;-------------------------------------------------------------------------- ; S_SetRowStructIndex( Row:w,Index:l ) ; S_SetRowStructIndex PROC EXPORT ;Using S_CurrentData input Row:w,RowIndex:l local NewRowBlock:l error ErrorFlag BEGIN stz ErrorFlag in Row:w,S_CurRowBlock:l,RowIndex:l out NewRowBlock:l XCall S_SetKeyIndex,err=ErrorFlag bcs Exit CmpLong S_CurRowBlock,NewRowBlock beq Exit lda S_CurRowBlock ora S_CurRowBlock+2 beq oldGone Tool _DisposeHandle,in=(S_CurRowBlock:l) oldGone MoveLong NewRowBlock,S_CurRowBlock Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Cells2.aii b/appleworksgs/SS/Src/Cells2.aii new file mode 100755 index 0000000..cc3436b --- /dev/null +++ b/appleworksgs/SS/Src/Cells2.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'M16.Profile' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT S_AddCellToChangedList IMPORT S_AddCellToDepList IMPORT S_CellWidth IMPORT S_CurBRMost IMPORT S_CurDefFormat IMPORT S_CurEditFlag IMPORT S_DepOnMeTreeTooBig IMPORT S_FindLeftContent IMPORT S_FindRightContent IMPORT S_GetCellIndex IMPORT S_GetCellPtr IMPORT S_GetCellTableEntry IMPORT S_GetRealCell IMPORT S_LoadingFile IMPORT S_NormalizeRange IMPORT S_RemoveCellFromChangedList IMPORT S_RemoveCellFromDepList IMPORT S_ResetCircularBits IMPORT S_SetCellTableEntry IMPORT S_TraverseDependOnMeTree IMPORT S_TraverseRange ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_DependHomeCell ENTRY S_EnterRangeDep ENTRY S_GetCellPriority ENTRY S_InsertLeftPadCells ENTRY S_RemoveCell ENTRY S_RemoveDependency ENTRY S_RemoveRangeDep ENTRY S_UpdateCellPriority ;---------------------------------------------------------------------------- ; S_NewCell S_NewCell PROC EXPORT ;Using S_CurrentData input Cell:l,CellType:w,Format:l,Content:l output Index:l,CellPtr:l local DepOnMe:l error ErrorFlag BEGIN stz ErrorFlag in Cell:l out Index:l XCall S_GetCellTableEntry ora Index beq noOldCell lda Index+2 and #S_CellTableFlags bne noOldCell H_GetBlockPtr Index,CellPtr brl gotCellPtr noOldCell MoveLong Index,DepOnMe H_NewBlock #S_CellStructSize,Index,err=ErrorFlag jcs Exit ; Set Index for Cell ; in Cell:l,Index:l XCall S_SetCellTableEntry,err=ErrorFlag bcc doOK H_DisposeBlock Index brl Exit ; Set up New Cell structure ; doOK H_GetBlockPtr Index,CellPtr lda #0 MoveWord a,[CellPtr]:#S_CellNext MoveWord a,[CellPtr]:#S_CellNext+2 MoveWord a,[CellPtr]:#S_CellPrevious MoveWord a,[CellPtr]:#S_CellPrevious+2 MoveWord a,[CellPtr]:#S_CellPriority MoveLong Cell,[CellPtr]:#S_CellID MoveLong DepOnMe,[CellPtr]:#S_CellDependOnMe gotCellPtr lda Format and #$FFFF-S_CellType ora CellType MoveWord a,[CellPtr]:#S_CellFormat MoveWord Format+2,[CellPtr]:#S_CellFormat+2 MoveLong Content,[CellPtr]:#S_CellContent lda #0 ldy #S_CellValue+8 loop sta [CellPtr],y dey dey cpy #S_CellValue bge loop lda CellType bmi Exit lda S_CurEditFlag and #S_BRMostBit bne Exit CmpWord S_CurBRMost,Cell bge chkRight MoveWord Cell,S_CurBRMost chkRight CmpWord S_CurBRMost+2,Cell+2 bge Exit MoveWord Cell+2,S_CurBRMost+2 Exit RETURN ENDP ;---------------------------------------------------------------------------- ; S_UpdatePriorities ; S_UpdatePriorities PROC EXPORT ;Using S_CurrentData ;Using S_PriorityData input Cell:l BEGIN in Cell:l,#S_UpdateCellPriority:l XCall S_TraverseDependOnMeTree RETURN ENDP ;----------------------------------------------------------------------- ; ; S_PriorityData PROC EXPORT EXPORT S_MaxPriority S_MaxPriority DS.B 2 ENDP ;---------------------------------------------------------------------------- ; S_UpdateCellPriority ; S_UpdateCellPriority PROC EXPORT input CellPtr:l output ProceedCode:w local Cell:l,ContentPtr:l local NumCells:w,CurCell:w,DepCellPtr:l local DepListPtr:l,LastPtr:l,DependList:l local RefType:w,TargetCell:l,TargetCell2:l error AbortFlag BEGIN stz AbortFlag MoveLong [CellPtr]:#S_CellID,Cell MoveWord [CellPtr]:#S_CellFormat+2,a and #S_CellCircular jne dontProceed stz S_MaxPriority MoveWord [CellPtr]:#S_CellFormat,a jmi gotPriority and #S_CellTypeTextForm ; any formula jeq gotPriority ; The cell is of type formula, although we don't car which kind H_GetBlockPtr [CellPtr]:#S_CellContent,ContentPtr MoveWord [ContentPtr]:#E_FormulaCells,NumCells MoveWord #E_FormulaData,CurCell cmp NumCells jge gotPriority loop MoveWord [ContentPtr]:CurCell,a and #$00FF sta RefType iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell:l XCall S_GetRealCell lda RefType and #$0080 beq singCell AddWord CurCell,#5,CurCell tay MoveWord [ContentPtr]:y,a and #$00FF sta RefType iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell2:l XCall S_GetRealCell Call S_NormalizeRange,in=(TargetCell:l,TargetCell2:l) in #S_GetCellPriority:l ; 2 inputs on stack XCall S_TraverseRange bra prioritySet singCell Call S_GetCellPriority,in=(TargetCell:l) prioritySet AddWord CurCell,#5,CurCell cmp NumCells jlt loop gotPriority CmpWord S_MaxPriority,[CellPtr]:#S_CellPriority beq dontProceed sta [CellPtr],y stz ProceedCode bra Exit dontProceed MoveWord #1,ProceedCode Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; S_GetCellPriority PROC EXPORT ;Using S_PriorityData input Cell:l local CellPtr:l BEGIN in Cell:l out CellPtr:l XCall S_GetCellPtr ora CellPtr beq emptyCell MoveWord [CellPtr]:#S_CellPriority,a bra adjustPriority emptyCell lda #0 adjustPriority inc a cmp S_MaxPriority blt Exit sta S_MaxPriority Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_RemovePadCells( Cell:l ) ; S_RemovePadCells PROC EXPORT ;Using S_CurrentData input Cell:l output LCell:l,RCell:l local CellPtr:l,Format:l error ErrFlag BEGIN stz ErrFlag MoveWord Cell,LCell sta RCell MoveWord Cell+2,LCell+2 sta RCell+2 ; in Cell:l ; Dont check, so we can remove ; out CellPtr:l ; those on one side of a given ; XCall S_GetCellPtr ; column during resize columns ; ; ora CellPtr ; jeq Exit ; Remove those on the left first ; lfloop dec Cell+2 beq lfdone in Cell:l out CellPtr:l XCall S_GetCellPtr ora CellPtr beq lfdone MoveLong [CellPtr]:#S_CellFormat,Format ; bpl lfdone lda Format and #S_CellType cmp #S_CellTypeLeftPad bne lfdone Call S_RemoveCell,in=(Cell:l) MoveWord Cell+2,LCell+2 bra lfloop lfdone ; Remove those on the right ; MoveWord RCell+2,Cell+2 rtloop inc Cell+2 CmpWord Cell+2,#$02BF jge Exit ; no pad cells to insert in Cell:l out CellPtr:l XCall S_GetCellPtr ora CellPtr jeq Exit ; no pad cells to insert MoveLong [CellPtr]:#S_CellFormat,Format lda Format and #S_CellType ; bpl insertPadCells cmp #S_CellTypeRightPad bne insertPadCells Call S_RemoveCell,in=(Cell:l) MoveWord Cell+2,RCell+2 bra rtloop ; Add left pad cells to existing cells, if necessary ; insertPadCells cmp #S_CellTypeText beq doIt cmp #S_CellTypeLeftPad bne Exit ; inc Cell+2 ; in Cell:l ; out Cell:l,a:w ; XCall S_FindRightContent doIt Call S_InsertLeftPadCells,in=(Cell:l),out=(:l),err=ErrFlag pla pla cmp LCell+2 bge Exit sta LCell+2 Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_InsertRightPadCells( Cell:l ): RCell:l ; S_InsertRightPadCells PROC EXPORT ;Using S_CurrentData input Cell:l output RCell:l local CellStrPtr:l,StringWd:w,TotalWd:w local OrigCellPtr:l,NewCellPtr:l,Format:l local NewCellIndex:l,Justify:w error ErrFlag BEGIN ProfileIn 11 stz ErrFlag ; Initialize Output ; MoveLong Cell,RCell in Cell:l out OrigCellPtr:l XCall S_GetCellPtr ora OrigCellPtr jeq Exit ; Cell structure exists ; MoveLong [OrigCellPtr]:#S_CellFormat,Format lda Format and #S_CellType cmp #S_CellTypeRightPad bne gotContent ; Get the Content Cell ; in Cell:l out Cell:l,a:w XCall S_FindLeftContent in Cell:l out OrigCellPtr:l XCall S_GetCellPtr MoveLong [OrigCellPtr]:#S_CellFormat,Format ; Cell has contents ; gotContent lda Format and #S_CellType cmp #S_CellTypeText jne Exit lda Format and #S_CellJustify cmp #S_CellRightJustify jeq Exit ; Right pad cells may be needed ; sta Justify ; Get the String width ; Tool _GetTextFace,out=(:w) ; leave on stack lda Format and #S_CellBold beq textFaceSet lda 1,s ora #$01 ; set bold bit on Tool _SetTextFace,in=(a:w) textFaceSet H_GetBlockPtr [OrigCellPtr]:#S_CellContent,CellStrPtr Tool _StringWidth,in=(CellStrPtr:l),out=(StringWd:w) Tool _SetTextFace,in=(:w) ; input from _GetTextFace ; Get enough cells to fit string, if possible ; MoveWord #S_MagNum1,TotalWd lda Justify jeq rtchk Call S_CellWidth,in=(Cell+2:w),out=(a:w) AddWord a,#S_MagNum1,a AddWord a,StringWd,a lsr a sta StringWd brl rtchk rtloop inc Cell+2 CmpWord Cell+2,#$02BF jge rtdone in Cell:l out NewCellPtr:l XCall S_GetCellPtr ora NewCellPtr beq rtcont ; Check to see if it is a pad cell, ... ; MoveLong [NewCellPtr]:#S_CellFormat,Format lda Format bpl rtdone and #S_CellType cmp #S_CellTypeRightPad beq rtchk ; Change the direction of the overlap. ; lda Format and #$FFFF-S_CellType ora #S_CellTypeRightPad MoveWord a,[NewCellPtr]:#S_CellFormat bra rtOK rtcont in Cell:l,#S_CellTypeRightPad:w,S_CurDefFormat:l,#0:l out NewCellIndex:l,NewCellPtr:l XCall S_NewCell,err=ErrFlag bcs rtdone rtOK MoveWord Cell+2,RCell+2 rtchk Call S_CellWidth,in=(Cell+2:w),out=(a:w) AddWord a,TotalWd,TotalWd cmp StringWd jlt rtloop rtdone Exit ProfileOut 11 RETURN ENDP ;----------------------------------------------------------------------------- ; S_InsertLeftPadCells( Cell:l ): LCell:l ; S_InsertLeftPadCells PROC EXPORT ;Using S_CurrentData input Cell:l output LCell:l local CellStrPtr:l,StringWd:w,TotalWd:w local OrigCellPtr:l,NewCellPtr:l,Format:l local NewCellIndex:l,Justify:w error ErrFlag BEGIN ProfileIn 12 stz ErrFlag ; Initialize output ; MoveLong Cell,LCell in Cell:l out OrigCellPtr:l XCall S_GetCellPtr ora OrigCellPtr jeq Exit ; Cell structure exists ; MoveLong [OrigCellPtr]:#S_CellFormat,Format lda Format and #S_CellType cmp #S_CellTypeLeftPad bne gotContent ; Get the Content Cell, we are adding to the left end of some ; ; left pad cells ; in Cell:l out Cell:l,a:w XCall S_FindRightContent in Cell:l out OrigCellPtr:l XCall S_GetCellPtr MoveLong [OrigCellPtr]:#S_CellFormat,Format ; Cell has contents ; gotContent lda Format and #S_CellType cmp #S_CellTypeText jne Exit lda Format and #S_CellJustify ; cmp #S_CellLeftJustify ; = 0 jeq Exit ; Left pad cells may be needed ; sta Justify ; Get the String width ; Tool _GetTextFace,out=(:w) ; leave on stack lda Format and #S_CellBold beq textFaceSet lda 1,s ora #$01 ; set bold bit on Tool _SetTextFace,in=(a:w) textFaceSet H_GetBlockPtr [OrigCellPtr]:#S_CellContent,CellStrPtr Tool _StringWidth,in=(CellStrPtr:l),out=(StringWd:w) Tool _SetTextFace,in=(:w) ; input from _GetTextFace ; Get enough cells to fit string, if possible ; MoveWord #S_MagNum1,TotalWd lda Justify cmp #S_CellRightJustify jeq lfchk Call S_CellWidth,in=(Cell+2:w),out=(a:w) AddWord a,#S_MagNum1,a AddWord a,StringWd,a lsr a sta StringWd brl lfchk lfloop dec Cell+2 jeq lfdone in Cell:l out NewCellPtr:l XCall S_GetCellPtr ora NewCellPtr beq lfcont ; Check to see if it is a pad cell, ... ; MoveLong [NewCellPtr]:#S_CellFormat,Format lda Format bpl lfDone and #S_CellType cmp #S_CellTypeLeftPad beq lfchk cmp #S_CellTypeRightPad beq lfDone lda Format and #$FFFF-S_CellType ora #S_CellTypeLeftPad MoveWord a,[NewCellPtr]:#S_CellFormat bra lfOK lfcont in Cell:l,#S_CellTypeLeftPad:w,S_CurDefFormat:l,#0:l out NewCellIndex:l,NewCellPtr:l XCall S_NewCell,err=ErrFlag bcs lfDone lfOK MoveWord Cell+2,LCell+2 lfchk Call S_CellWidth,in=(Cell+2:w),out=(a:w) AddWord a,TotalWd,TotalWd cmp StringWd jlt lfloop lfDone Exit ProfileOut 12 RETURN ENDP ;---------------------------------------------------------------------------- ; S_RemoveCell( Cell:l ) ; S_RemoveCell PROC EXPORT ;Using S_CurrentData input Cell:l local CellIndex:l,CellPtr:l,ContentIndex:l,DependIndex:l local DependPtr:l,DNext:l,DLimit:l,Format:l,Value:l local NextField:l,DependList:l,NextCell:l,Ptr:l BEGIN in Cell:l out CellIndex:l XCall S_GetCellIndex ora CellIndex jeq Exit H_GetBlockPtr CellIndex,CellPtr MoveLong [CellPtr]:#S_CellFormat,Format MoveLong [CellPtr]:#S_CellValue,Value MoveLong [CellPtr]:#S_CellContent,ContentIndex MoveLong [CellPtr]:#S_CellNext,NextField lda ContentIndex ora ContentIndex+2 beq contentGone lda Format ; empty,pad-> no content and #S_CellTypeTextForm ; text and value formulas beq killContent Call S_RemoveDependency,in=(Cell:l,ContentIndex:l) lda Format and #S_CellType cmp #S_CellTypeTextForm ; text formula bne killContent ; lda Format ; not necessary ; and #S_CellInvalid ; invalid cells are ; bne killContent ; typed as numeric H_DisposeBlock Value killContent H_DisposeBlock ContentIndex H_GetBlockPtr CellIndex,CellPtr contentGone MoveWord [CellPtr]:#S_CellDependOnMe,DependList sta DependIndex MoveWord [CellPtr]:#S_CellDependOnMe+2,DependList+2 and #$FFFF-S_CellTableFlags sta DependIndex+2 ora DependIndex jeq disposeIt ; If the cell is a non-user cell, i.e. pad-cell, then the value, priority, ; and circularity of other cells will not change. lda Format jmi disposeIt MoveWord #0,[CellPtr]:#S_CellFormat+2 MoveWord a,[CellPtr]:#S_CellPriority lda DependList+2 bpl doLoop Call S_UpdatePriorities,in=(DependIndex:l) lda S_LoadingFile bne doDispose Call S_ResetCircularBits,in=(DependIndex:l) Call S_AddCellToChangedList,in=(DependIndex:l) doDispose bra disposeIt doLoop MoveLong #S_DependList,DNext H_GetBlockPtr DependIndex,DependPtr MoveLong [DependPtr],DLimit priorityLoop AddLong DependPtr,DNext,Ptr MoveLong [Ptr],NextCell Call S_UpdatePriorities,in=(NextCell:l) lda S_LoadingFile bne nextInLoop Call S_ResetCircularBits,in=(NextCell:l) Call S_AddCellToChangedList,in=(NextCell:l) nextInLoop AddLong DNext,#S_DependInc,DNext CmpLong DNext,DLimit blt priorityLoop disposeIt lda NextField ora NextField+2 beq killCell ; We have to wait to Deref PreviousCell, since we are adding cells ; to the changed list; one of them may alter this value. in Cell:l,[CellPtr]:#S_CellPrevious:l,NextField:l XCall S_RemoveCellFromChangedList killCell ; If there are dependencies, then that is what I want to set into ; the cell table, otherwise set #0 (DependList == 0) Call S_SetCellTableEntry,in=(Cell:l,DependList:l) H_DisposeBlock CellIndex MoveWord Format,a bmi Exit lda S_CurEditFlag and #S_BRMostBit bne Exit CmpWord Cell,S_CurBRMost bge findBRMost CmpWord Cell+2,S_CurBRMost+2 blt Exit findBRMost lda #S_BRMostBit tsb S_CurEditFlag Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_RemoveDependency( Cell:l, ContentIndex:l ) ; S_RemoveDependency PROC EXPORT ;Using S_CurrentData ;Using S_DependData input Cell:l,ContentIndex:l local ContentPtr:l,NumCells:w,CurCell:w local RefType:w,TargetCell:l,TargetCell2:l BEGIN H_GetBlockPtr ContentIndex,ContentPtr MoveWord [ContentPtr]:#E_FormulaCells,NumCells MoveWord #E_FormulaData,CurCell cmp NumCells jge Exit loop MoveWord [ContentPtr]:CurCell,a and #$00FF sta RefType and #$0080 jeq singleRef iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell:l XCall S_GetRealCell AddWord CurCell,#5,CurCell tay CmpLong TargetCell,#S_NotACell jeq nextCell MoveWord [ContentPtr]:y,a and #$00FF sta RefType iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell2:l XCall S_GetRealCell CmpLong TargetCell2,#S_NotACell beq nextCell MoveLong Cell,S_DependHomeCell Call S_NormalizeRange,in=(TargetCell:l,TargetCell2:l) in #S_RemoveRangeDep:l ; 2 inputs already on stack XCall S_TraverseRange bra nextCell singleRef iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell:l XCall S_GetRealCell CmpLong TargetCell,#S_NotACell beq nextCell Call S_RemoveCellFromDepList,in=(Cell:l,TargetCell:l) nextCell AddWord CurCell,#5,CurCell cmp NumCells bge Exit H_GetBlockPtr ContentIndex,ContentPtr brl loop Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_InsertDependency( Cell:l, ContentIndex:l ) ; S_InsertDependency PROC EXPORT ;Using S_CurrentData ;Using S_DependData input Cell:l,ContentIndex:l local ContentPtr:l,NumCells:w,CurCell:w local RefType:w,TargetCell:l,TargetCell2:l error ErrFlag BEGIN stz ErrFlag H_GetBlockPtr ContentIndex,ContentPtr MoveWord [ContentPtr]:#E_FormulaCells,NumCells MoveWord #E_FormulaData,CurCell cmp NumCells jge Exit loop MoveWord [ContentPtr]:CurCell,a and #$00FF sta RefType and #$0080 jeq singleRef iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell:l XCall S_GetRealCell AddWord CurCell,#5,CurCell tay CmpLong TargetCell,#S_NotACell jeq nextCell MoveWord [ContentPtr]:y,a and #$00FF sta RefType iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell2:l XCall S_GetRealCell CmpLong TargetCell2,#S_NotACell beq nextCell MoveLong Cell,S_DependHomeCell Call S_NormalizeRange,in=(TargetCell:l,TargetCell2:l) in #S_EnterRangeDep:l ; 2 inputs already on stack XCall S_TraverseRange,err=ErrFlag bcc nextCell bra gotError singleRef iny in [ContentPtr]:y:l,RefType:w,Cell:l out TargetCell:l XCall S_GetRealCell CmpLong TargetCell,#S_NotACell beq nextCell Call S_AddCellToDepList,in=(Cell:l,TargetCell:l),err=ErrFlag bcs gotError nextCell AddWord CurCell,#5,CurCell cmp NumCells bge Exit H_GetBlockPtr ContentIndex,ContentPtr brl loop gotError Call S_RemoveDependency,in=(Cell:l,ContentIndex:l) Exit RETURN ENDP ;------------------------------------------------------------------------- ; ; S_DependData PROC EXPORT EXPORT S_DependHomeCell S_DependHomeCell DS.B 4 ENDP ;------------------------------------------------------------------------- ; ; S_EnterRangeDep PROC EXPORT ;Using S_CurrentData ;Using S_DependData input TargetCell:l local CellIndex:l,CellPtr:l,DependPtr:l local DependSize:l,NewSize:l,DependList:l local DependRangeList:l,CellExists:w local OtherCellInList:l error ErrorFlag BEGIN stz ErrorFlag stz CellExists in TargetCell:l out CellIndex:l XCall S_GetCellTableEntry ora CellIndex beq noDepsOnMe lda CellIndex+2 and #S_CellTableFlags beq targetExists MoveLong CellIndex,DependList bra depListExists ; The TagetCell is real, so we have to dereference it to get the ; depend list if there is one. targetExists inc CellExists H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellDependOnMe,DependList MoveWord [CellPtr]:#S_CellDependOnMe+2,DependList+2 ora DependList bne depListExists ; There are no previous DependOnMe's for this TargetCell ; We will Create a short list (type: Range) noDepsOnMe MoveWord S_DependHomeCell,DependList lda S_DependHomeCell+2 ora #S_CellTableRangeDep sta DependList+2 lda CellExists jeq noCell brl storeInCell ; Previous DependOnMe's exists, but we don't know how many and ; which type they are. depListExists lda DependList+2 jpl fullListExists and #$FFFF-S_CellTableFlags sta OtherCellInList+2 MoveWord DependList,OtherCellInList lda DependList+2 and #S_CellTableFlags cmp #S_CellTableSingDep beq singleAndRange ; The previous list was only one range dependency reference. ; Make a full dep list. MoveLong #S_DependList,DependRangeList bra createList ; The previous list was only one single dependency reference. ; Make a full dep list. singleAndRange MoveLong #S_DependStructSize,DependRangeList createList H_NewBlock #S_DependStructSize+S_DependInc,DependList,DependPtr,err=ErrorFlag jcs Exit MoveLong #S_DependStructSize+S_DependInc,[DependPtr]:#S_DependSize MoveLong DependRangeList,[DependPtr]:#S_DependRangeList MoveLong OtherCellInList,[DependPtr]:#S_DependList MoveLong S_DependHomeCell,[DependPtr]:#S_DependList+S_DependInc lda DependList+2 ora #S_CellTableList sta DependList+2 ; Determine where to store the New DependList just created. lda CellExists beq noCell H_GetBlockPtr CellIndex,CellPtr storeInCell MoveLong DependList,[CellPtr]:#S_CellDependOnMe brl Exit noCell in TargetCell:l,DependList:l XCall S_SetCellTableEntry,err=ErrorFlag brl Exit ; A previous full DependOnMe list exists, put the New cell at the end fullListExists ; lda DependList+2 ; already in 'a' and #-1-S_CellTableList sta DependList+2 H_GetBlockPtr DependList,DependPtr MoveLong [DependPtr]:#S_DependSize,DependSize AddLong DependSize,#S_DependInc,NewSize H_ResizeBlock DependList,NewSize,DependPtr,err=ErrorFlag bcs Exit MoveLong NewSize,[DependPtr]:#S_DependSize AddLong DependSize,DependPtr,DependPtr MoveLong S_DependHomeCell,[DependPtr] Exit RETURN ENDP ;------------------------------------------------------------------------- ; ; S_RemoveRangeDep PROC EXPORT ;Using S_CurrentData ;Using S_DependData input TargetCell:l local CellIndex:l local CellPtr:l,DependList:l,DependPtr:l local DependSize:l,NewSize:l,NextPtr:l,LastPtr:l local DependRangeList:l,CellExists:w,NewDependList:l error ErrorFlag BEGIN stz ErrorFlag stz CellExists in TargetCell:l out CellIndex:l XCall S_GetCellTableEntry ora CellIndex beq toError lda CellIndex+2 and #S_CellTableFlags beq targetExists MoveLong CellIndex,DependList bra depListExists ; The TargetCell is real, so we have to de-reference it to get the ; DependOnMe list, if there is one. targetExists inc CellExists H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellDependOnMe,DependList MoveWord [CellPtr]:#S_CellDependOnMe+2,DependList+2 ora DependList bne depListExists toError brl Error ; Previous DependOnMe's exist, but we don't know how many and of ; of which type they are. depListExists lda DependList+2 bpl fullListExists ; Only one previous DependOnMe. and #S_CellTableFlags cmp #S_CellTableSIngDep beq toError ; It was a range reference, chk to see if it is the S_DependHomeCell lda DependList+2 and #$FFFF-S_CellTableFlags cmp S_DependHomeCell+2 bne toError CmpWord DependList,S_DependHomeCell bne toError ; It was, replace it with no list. stzl NewDependList brl storeDepList ; A previous full DependOnMe list exists, chk the following. ; 1) Are there any range references. ; 2) Are there more than two references. ; 3) Are there two range references, or one single and one range reference. fullListExists lda DependList+2 and #-1-S_CellTableList sta DependList+2 H_GetBlockPtr DependList,DependPtr CmpLong [DependPtr]:#S_DependRangeList,[DependPtr]:#S_DependSize jeq Error CmpLong #S_DependStructSize+S_DependInc,[DependPtr]:#S_DependSize jne moreThanTwo CmpLong [DependPtr]:#S_DependRangeList,#S_DependList+S_DependInc bne twoRanges ; There is one single and one range reference, if the range reference ; is the S_DependHomeCell, then leave a short list (type: single) CmpLong S_DependHomeCell,[DependPtr]:#S_DependList+S_DependInc jne Error MoveWord [DependPtr]:#S_DependList,NewDependList MoveWord [DependPtr]:#S_DependList+2,a ora #S_CellTableSingDep sta NewDependList+2 bra killDepList ; There are two range references. Check if either one is the S_DependHomeCell. ; If so, leave the other in a short list. (type: range) twoRanges CmpLong S_DependHomeCell,[DependPtr]:#S_DependList bne notFirst MoveWord [DependPtr]:#S_DependList+S_DependInc,NewDependList MoveWord [DependPtr]:#S_DependList+S_DependInc+2,a bra setRange notFirst CmpLong S_DependHomeCell,[DependPtr]:#S_DependList+S_DependInc jne Error MoveWord [DependPtr]:#S_DependList,NewDependList MoveWord [DependPtr]:#S_DependList+2,a setRange ora #S_CellTableRangeDep sta NewDependList+2 killDepList H_DisposeBlock DependList ; Determine where to store the NewDependList storeDepList lda CellExists beq noCell MoveLong NewDependList,[CellPtr]:#S_CellDependOnMe brl Exit noCell Call S_SetCellTableEntry,in=(TargetCell:l,NewDependList:l) brl Exit ; There are more than two DependOnMe references. Check if the S_DependHomeCell ; is in the range list, and remove it. moreThanTwo MoveLong [DependPtr]:#S_DependSize,DependSize MoveLong [DependPtr]:#S_DependRangeList,DependRangeList AddLong DependPtr,DependSize,LastPtr AddLong DependPtr,DependRangeList,NextPtr SearchLoop CmpLong [NextPtr],S_DependHomeCell beq found AddLong NextPtr,#S_DependInc,NextPtr CmpLong NextPtr,LastPtr blt SearchLoop bra Error found SubLong DependSize,#S_DependInc,NewSize MoveLong NewSize,[DependPtr]:#S_DependSize AddLong NextPtr,#S_DependInc,s PushLong NextPtr AddLong DependPtr,DependSize,s SubLong 1:s,NextPtr,1:s Tool _BlockMove,in=(:l,:l,:l) H_ResizeBlock DependList,NewSize Error Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Chart.aii b/appleworksgs/SS/Src/Chart.aii new file mode 100755 index 0000000..1efdf91 --- /dev/null +++ b/appleworksgs/SS/Src/Chart.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_BLForgetLists IMPORT D_BLGetSel IMPORT D_BLMakeList IMPORT D_BLModalDialog IMPORT D_BLSelect IMPORT D_CloseDialog IMPORT D_CopyStrings IMPORT D_DrawString IMPORT D_EscFilter IMPORT D_GetNewModalDialog IMPORT D_SendMessage IMPORT D_SetCursor IMPORT D_HeartbeatIdle IMPORT D_BlinkButton IMPORT X_DialogFromScrap IMPORT X_DialogToScrap IMPORT X_FormatValue IMPORT S_ChartCount IMPORT S_ChartGRWind IMPORT S_ChartListRec IMPORT S_ChartMsgRec IMPORT S_ChartNameStr IMPORT S_ChartPict IMPORT S_ChartSSWind IMPORT S_DlogClipRgn IMPORT S_DoPtPlot IMPORT S_ListDlog IMPORT S_ListRect IMPORT S_NoSelectStr IMPORT S_Cell2Str IMPORT S_Ch1stTxt IMPORT S_ChIconTable IMPORT S_ChLastTxt IMPORT S_ChMaxTxt IMPORT S_ChMinTxt IMPORT S_ChNameNum IMPORT S_ChTooMany IMPORT S_ChUntitle IMPORT S_ChooseChartDlog IMPORT S_CopyIn IMPORT S_CopyOut IMPORT S_Cur2BRSelect IMPORT S_Cur2ChartCount IMPORT S_Cur2ChartList IMPORT S_Cur2Heap IMPORT S_Cur2TLSelect IMPORT S_Cur2Window IMPORT S_CurrentData2 IMPORT S_LoMem IMPORT S_MakeBar IMPORT S_MakePie IMPORT S_ModifyChartDlog IMPORT S_PieZero IMPORT S_Plot3DBar IMPORT S_PlotBar IMPORT S_PlotLine IMPORT S_PlotPt IMPORT S_SetUndoOff IMPORT S_SwapOut IMPORT S_Text2Cell IMPORT S_drec2 ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_CalcChart ENTRY S_DoChartDlog ENTRY S_DoLinkBreakage ENTRY S_KillChart ENTRY S_ChartFilter ;--------------------------------------------------------------------------- ; ; S_DoNewChart (menu - New Chart) ; S_DoNewChart PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 ;Using S_PieData local first:l,last:l local type:w,cancelled:w local ptr:l,hdl:l local icon:w,chartname:l local foo:l,min:r,foo2:l,max:r error err BEGIN +b stz err call S_CopyIn,in=(#S_CurrentData2:l) cmpw S_Cur2ChartCount,#S_MaxChartCount blt NotTooMany call D_AlertBox,in=(#OKBox:w,#S_ChTooMany:l),out=(a:w) brl Exit NotTooMany H_NewBlock #S_CSize,hdl,ptr,err=err jcs exit ; added (6/8/89) MRH inc S_Cur2ChartCount in S_Cur2ChartCount:w,#S_ChNameNum-2:l,#2:w,#0:w xtool _Int2Dec moveword #S_BarType,[ptr]:#S_CType movelong S_Cur2TLSelect,[ptr]:#S_CRange ; Selection range movelong S_Cur2BRSelect,[ptr]:#S_CRange+4 moveword #1,[ptr]:#S_SpaceBar moveword #0,[ptr]:#S_CIsMax movelong #0,[ptr]:#S_CWind pushlong #S_ChUntitle lda #S_CName addlong a,ptr,s call D_CopyStrings,in=(:l,:l) moveX S_PieZero,[ptr]:#S_CMin moveX S_PieZero,[ptr]:#S_CMax call S_DoChartDlog,in=(hdl:l),out=(a:w) beq GoAhead killnewchart H_DisposeBlock hdl dec S_Cur2ChartCount brl Exit GoAhead call S_SetUndoOff cmpw S_Cur2ChartCount,#2 bge NotFirst H_NewBlock #4,S_Cur2ChartList,ptr,err=err bra addChart ; added (6/8/89) MRH NotFirst ; lda S_Cur2ChartCount ; already in a asl a asl a tax ldy #0 H_ResizeBlock S_Cur2ChartList,xy,ptr,err=err addChart bcs killnewchart ; added (6/8/89) MRH lda S_Cur2ChartCount dec a asl a asl a tay movelong hdl,[ptr]:y stzl S_ChartGRWind call S_CalcChart,in=(hdl:l),err=(err) bcc exit lda S_Cur2ChartCount dec a call S_KillChart,in=(a:w) exit call S_CopyOut,in=(#S_CurrentData2:l) call S_SwapOut ; If CalcChart has lost me. RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_DoChartDlog ; S_DoChartDlog PROC EXPORT ;Using SANEEQUS ;Using S_ChartData ;Using S_CurrentData2 ;Using S_PieData ;Using S_SaneData2 input block:l output cancelled:w local chart:l local icon:w,first:l,last:l local TheDlog:l,result:w,ptr:l,hdl:l local tmprect:r,tmp:l,olditem:w local oldtime:l,newtime:l,time:l local range1:r,range2:r,mode:w local h1:l,min:r,h2:l,max:r local valid:w,lptr:w,space:w error err BEGIN +b stz cancelled call D_SetCursor,in=(#WatchCursor:w) ; Set up chart name string. H_GetBlockPtr block,chart lda #S_CName addlong a,chart,s call D_CopyStrings,in=(:l,#S_ChartNameStr:l) ; Set up the strings for the Max/Min values. moveX [chart]:#S_CMin,MinVal moveX [chart]:#S_CMax,MaxVal in #200:w,#0:l,#MinVal:l out a:w,ptr:l,a:w xcall X_FormatValue cmpw [ptr],#$3001 bne DoCopy1 stz S_ChMinTxt bra DoMaxTxt DoCopy1 call D_CopyStrings,in=(ptr:l,#S_ChMinTxt:l) DoMaxTxt in #200:w,#0:l,#MaxVal:l out a:w,ptr:l,a:w xcall X_FormatValue moveword [chart]:#S_CIsMax,a bne DoCopy2 stz S_ChMaxTxt bra DoType DoCopy2 call D_CopyStrings,in=(ptr:l,#S_ChMaxTxt:l) ; Do the other init's. DoType subword [chart]:#S_CType,#1,icon ; Icon selected movelong [chart]:#S_CRange,first movelong [chart]:#S_CRange+4,last cmpw first,last beq Singlized cmpw first+2,last+2 beq Singlized moveword first,last Singlized call S_Cell2Str,in=(#S_Ch1stTxt:l,first:l) call S_Cell2Str,in=(#S_ChLastTxt:l,last:l) call D_GetNewModalDialog,in=(#S_ChooseChartDlog:l),out=(TheDlog:l) H_GetBlockPtr block,chart moveword [chart]:#S_SpaceBar,space tool _SetDItemValue,in=(a:w,TheDlog:l,#8:w) jsl X_DialogFromScrap tool _SetPort,in=(TheDlog:l) tool _SelectIText,in=(TheDlog:l,#20:w,#0:w,#255:w) tool _ShowWindow,in=(TheDlog:l) call D_SetCursor,in=(#ArrowCursor:w) tool _GetDblTime,out=(time:l) tool _GetTick,out=(newtime:l) addword icon,#3,result DlogLoop moveword #modeCopy,mode jsr FrameIcon stz ismax moveword result,olditem movelong newtime,oldtime tool _ModalDialog,in=(#$80000000+S_ChartFilter:l),out=(result:w) tool _GetTick,out=(newtime:l) lda result cmp #OK jeq DoneDlog cmp #Cancel jeq DoneDlog cmp #8 jeq doCheckBox cmp #9 bge DlogLoop subword result,#3,a cmp icon bne DoFrame cmpw result,olditem bne DlogLoop sublong newtime,oldtime,oldtime cmpl time,oldtime jlt DlogLoop lda itsOK jne DoneDlog brl DlogLoop DoFrame moveword #notXOR,mode jsr FrameIcon subword result,#3,icon jsr FrameIcon brl DlogLoop ; toggle the checkbox doCheckBox tool _GetDItemValue,in=(TheDlog:l,result:w),out=(a:w) eor #1 tool _SetDItemValue,in=(a:w,TheDlog:l,result:w) brl DlogLoop DoneDlog cmpw result,#Cancel jeq DoClose tool _GetDItemValue,in=(TheDlog:l,#8:w),out=(space:w) OKMinMax tool _GetIText,in=(TheDlog:l,#16:w,!range1:l) tool _GetIText,in=(TheDlog:l,#17:w,!range2:l) ; Do conversion. lda range1 and #$FF sta tmp call S_Text2Cell,in=(!range1+1:l,tmp:w),out=(first:l) lda range2 and #$FF sta tmp call S_Text2Cell,in=(!range2+1:l,tmp:w),out=(last:l) H_GetBlockPtr block,chart addword icon,#1,[chart]:#S_CType movelong first,[chart]:#S_CRange movelong last,[chart]:#S_CRange+4 moveword space,[chart]:#S_SpaceBar moveword ismax,[chart]:#S_CIsMax pushlong #S_ChartNameStr lda #S_CName addlong a,chart,s jsl D_CopyStrings moveX MinVal,[chart]:#S_CMin moveX MaxVal,[chart]:#S_CMax DoClose jsl X_DialogToScrap call D_CloseDialog,in=(TheDlog:l) tool _SetPort,in=(S_Cur2Window:l) cmpw result,#Cancel bne exit inc cancelled exit RETURN FrameIcon cmpw result,#8 ; if it's not an bge DidHilite ; icon that was cmp #3 ; chosen, don't change blt DidHilite ; the check boxes. cmp #5 beq Do0 cmp #4 bne DoFF Do0 pushword #0 bra DoHilite DoFF pushword #$FF DoHilite tool _GetControlDItem,in=(TheDlog:l,#8:w),out=(:l) _HiliteControl DidHilite movelong #S_ChIconTable,tmp lda icon mul4 tay movelong [tmp]:y,ptr moverect [ptr]:#2,tmprect subword tmprect,#4,tmprect subword tmprect+2,#8,tmprect+2 addword tmprect+4,#4,tmprect+4 addword tmprect+6,#9,tmprect+6 tool _SetPenMode,in=(mode:w) tool _SetPenSize,in=(#5:w,#2:w) tool _FrameRect,in=(!tmprect:l) _PenNormal rts EXPORT MaxVal,MinVal,isMax,itsOK MaxVal DS.B 10 MinVal DS.B 10 isMax DS.W 1 itsOK DS.W 1 ENDP ;--------------------------------------------------------------------------- ; ; S_ChartFilter ; S_ChartFilter PROC input TheDlog:l,TheEvent:l,ItemHit:l output TheResult:w local TheCtl:l,range1:r,range2:r,tmp:l local foo:l,min:r,foo2:l,max:r,ptr:l,valid:w local lptr:w,tmp2:l begin +b stz theResult jsl D_HeartBeatIdle tool _GetIText,in=(TheDlog:l,#20:w,#S_ChartNameStr:l) lda S_ChartNameStr and #$FF jeq baddata tool _GetIText,in=(TheDlog:l,#16:w,!range1:l) tool _GetIText,in=(TheDlog:l,#17:w,!range2:l) ; Do conversion. lda range1 and #$FF sta tmp call S_Text2Cell,in=(!range1+1:l,tmp:w),out=(tmp:l) jcs baddata lda range2 and #$FF sta tmp2 call S_Text2Cell,in=(!range2+1:l,tmp2:w),out=(tmp2:l) jcs baddata ;See if we have one row or one column Cmpw tmp,tmp2 beq rangeok Cmpw tmp+2,tmp2+2 jne baddata ; check max/min values rangeok tool _GetIText,in=(TheDlog:l,#18:w,!min:l) lda min and #$FF jeq NoMin moveword #1,lptr tool FPSTR2DEC,in=(!min:l,!lptr:l,#S_drec2:l,!valid:l) lda min and #$FF cmp lptr jge baddata FinishMin tool FDEC2X,in=(#S_drec2:l,#MinVal:l) bra DoMax NoMin moveX S_PieZero,MinVal DoMax tool _GetIText,in=(TheDlog:l,#19:w,!max:l) lda max and #$FF jeq NoMax moveword #1,lptr tool FPSTR2DEC,in=(!max:l,!lptr:l,#S_drec2:l,!valid:l) lda max and #$FF cmp lptr jge baddata FinishMax tool FDEC2X,in=(#S_drec2:l,#MaxVal:l) bra DidMaxMin NoMax moveX S_PieZero,MaxVal DidMaxMin tool FCMPX,in=(#MaxVal:l,#S_PieZero:l) bne CkNonZero tool FCMPX,in=(#MinVal:l,#S_PieZero:l) bne CkNonZero bra notSame ; both are 0, so auto-scaling is enabled. CkNonZero inc ismax tool FCMPX,in=(#MinVal:l,#MaxVal:l) fbge baddata notSame pushword #noHilite moveword #1,itsOK bra DoHilite baddata pushword #inactiveHilite stz itsOK DoHilite tool _GetControlDItem,in=(TheDlog:l,#1:w),out=(:l) tool _HiliteControl,in=(:w,:l) cmpw [TheEvent],#keyDownEvt beq @aKey cmpw [TheEvent],#autoKeyEvt bne exit @aKey moveword [TheEvent]:#omessage,a and #$FF @ckPeriod cmp #'.' bne @ckCancel moveword [TheEvent]:#oModifiers,a and #appleKey beq exit @cancel lda #Cancel bra @sta @ckCancel cmp #$1B beq @cancel @ckReturn cmp #$D bne exit ldy itsOK bne @OK moveword #0,[TheEvent] ; throw away the event. bra exit @OK lda #OK @sta inc theResult sta [itemHit] call D_BlinkButton,in=(TheDlog:l,a:w) exit return ENDP ;--------------------------------------------------------------------------- ; ; S_ModifyChart ; S_DoModifyChart PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 local TheDlog:l,result:w,item:w,ptr:l,hdl:l,tmp:l error err BEGIN +b call S_CopyIn,in=(#S_CurrentData2:l) tool _NewRgn,out=(S_DlogClipRgn:l) call D_GetNewModalDialog,in=(#S_ModifyChartDlog:l),out=(TheDlog:l) movelong TheDlog,S_ListDlog moveword S_Cur2ChartCount,S_ChartCount call D_BLMakeList,in=(#S_ChartListRec:l) DlogLoop call D_BLSelect,in=(#S_ChartListRec:l,#0:w) call D_BLModalDialog,in=(#D_EscFilter+$80000000:l),out=(result:w) call D_BLGetSel,in=(#S_ChartListRec:l),out=(item:w) cmpw result,#Cancel beq CloseIt lda item bpl CloseIt call D_AlertBox,in=(#OKBox:w,#S_NoSelectStr:l),out=(a:w) bra DlogLoop CloseIt call D_CloseDialog,in=(TheDlog:l) tool _DisposeRgn,in=(S_DlogClipRgn:l) call D_BLForgetLists H_GetBlockPtr S_Cur2ChartList,ptr cmpw result,#Cancel jeq exit cmp #OK bne CkKill call S_SetUndoOff lda item asl a asl a tay ; this is a blockptr. call S_CalcChart,in=([ptr]:y:l),err=(err) brl exit CkKill cmp #3 bne DoMod call S_SetUndoOff call S_KillChart,in=(item:w) brl exit DoMod H_GetBlockPtr S_Cur2ChartList,ptr lda item asl a asl a tay movelong [ptr]:y,hdl call S_DoChartDlog,in=(hdl:l),out=(a:w) bne exit call S_SetUndoOff call S_CalcChart,in=(hdl:l),err=(err) exit call S_CopyOut,in=(#S_CurrentData2:l) call S_SwapOut ; Just in case ReCalcChart has lost me. RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_ChartListProc ; S_ChartListProc PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 input listrec:l,item:w local hdl:l,ptr:l,tmprect:r BEGIN +b tool _GetClip,in=(S_DlogClipRgn:l) tool _ClipRect,in=(#S_ListRect:l) tool _Move,in=(#2:w,#8:w) H_GetBlockPtr S_Cur2ChartList,ptr lda item asl a asl a addlong a,ptr,ptr movelong [ptr],hdl H_GetBlockPtr hdl,ptr lda #S_CName addlong a,ptr,s call D_DrawString tool _SetClip,in=(S_DlogClipRgn:l) RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_ChartDummy ; S_ChartDummy PROC EXPORT input ptr:l,item:w BEGIN RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_CalcChart ; S_CalcChart PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 input charthdl:l local chart:l,tmprect:r error err BEGIN H_GetBlockPtr charthdl,chart cmpw [chart]:#S_CType,#S_PieType bne CkBar call S_MakePie,in=(charthdl:l),out=(S_ChartPict:l),err=(err) jcs whoops brl GotPict CkBar cmp #S_BarType bne Ck3D moveaddr #S_PlotBar,S_DoPtPlot+1 call S_MakeBar,in=(charthdl:l),out=(S_ChartPict:l),err=(err) jcs whoops brl GotPict Ck3D cmp #S_3DBarType bne CkLine moveaddr #S_Plot3DBar,S_DoPtPlot+1 call S_MakeBar,in=(charthdl:l),out=(S_ChartPict:l),err=(err) jcs whoops bra GotPict CkLine cmp #S_LineType bne CkPt moveaddr #S_PlotLine,S_DoPtPlot+1 call S_MakeBar,in=(charthdl:l),out=(S_ChartPict:l),err=(err) jcs whoops bra GotPict CkPt cmp #S_PtType moveaddr #S_PlotPt,S_DoPtPlot+1 call S_MakeBar,in=(charthdl:l),out=(S_ChartPict:l),err=(err) jcs whoops GotPict ; pushword #Pict ; call X_CopyOneHandle,in=(S_ChartPict:l),out=(:l) ; call X_PostScrap,in=(:w,:l) H_GetBlockPtr charthdl,chart movelong [chart]:#S_CWind,S_ChartGRWind movelong S_Cur2Window,S_ChartSSWind ; GR in #5:w,#S_ChartMsg:w,#S_ChartMsgRec:l out :l xerr err xcall D_SendMessage bcc GetWind tax pulllong a cpx #-1 beq @1 call D_AlertBox,in=(#OKBox:w,#S_LoMem:l),out=(a:w) @1 H_GetBlockPtr charthdl,chart movelong #0,[chart]:#S_CWind bra KillP GetWind H_GetBlockPtr charthdl,chart cpzl [chart]:#S_CWind beq GrabWind pulllong a bra KillP GrabWind pulllong [chart]:#S_CWind KillP tool _KillPicture,in=(S_ChartPict:l) whoops call D_SetCursor,in=(#ArrowCursor:w) RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_KillChart (num:w) where num is the array position [0..n] ; dispose of a chart S_KillChart PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 input chartnum:w local ptr:l,size:w,offset:w BEGIN H_GetBlockPtr S_Cur2ChartList,ptr lda chartnum asl a asl a sta offset call S_DoLinkBreakage,in=([ptr]:offset:l) H_GetBlockPtr S_Cur2ChartList,ptr H_DisposeBlock [ptr]:offset subword S_Cur2ChartCount,chartnum,a dec a sta size beq CleanUp ; { lda chartnum ina asl a asl a addlong a,ptr,s ; src ; lda chartnum ; asl a ; asl a ; addlong a,ptr,s ; dest ; lda size ; asl a ; asl a ; pea 0 ; pha ; size tool _BlockMove,in=(:l,:l,:l) ; } CleanUp lda S_Cur2ChartCount dec a sta S_Cur2ChartCount beq exit asl a asl a tax ldy #0 H_ResizeBlock S_Cur2ChartList,xy exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_BreakLink(message:l) ; ; handle a break-link message from GR (or myself...) ; S_BreakLink PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 input message:l local count:w,ptr:l BEGIN +b call S_CopyIn,in=(#S_CurrentData2:l) ; go to a particular chart & zero its CWind moveword S_Cur2ChartCount,count loop dec count bmi exit H_GetBlockPtr S_Cur2ChartList,ptr lda count mul4 a tay H_GetBlockPtr [ptr]:y,ptr cmpl [ptr]:#S_CWind,[message] bne loop movelong #0,[ptr]:#S_CWind exit call S_CopyOut,in=(#S_CurrentData2:l) RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_DoLinkBreakage(chart:l) ; ; ; tell GR to break link & break it myself ; ... S_BreakGraphLink S_DoLinkBreakage PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 input charthdl:l local chart:l,ptr:l BEGIN H_GetBlockPtr charthdl,chart movelong [chart]:#S_CWind,ptr cpzl ptr beq KillIt movelong ptr,S_ChartGRWind movelong S_Cur2Window,S_ChartSSWind call D_SendMessage,in=(#5:w,#S_BreakGraphLink:w,#S_ChartMsgRec:l),out=(a:l) KillIt call S_CopyOut,in=(#S_CurrentData2:l) call S_BreakLink,in=(#S_ChartMsgRec:l) call S_CopyIn,in=(#S_CurrentData2:l) exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_KillLinks() ; S_KillLinks PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 local count:w,ptr:l BEGIN +b call S_CopyIn,in=(#S_CurrentData2:l) ; Traverse charts, calling DoLinkBreakage moveword S_Cur2ChartCount,count loop dec count bmi exit H_GetBlockPtr S_Cur2ChartList,ptr lda count mul4 a tay call S_DoLinkBreakage,in=([ptr]:y:l) bra loop exit call S_CopyOut,in=(#S_CurrentData2:l) RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_SaveCharts ; S_SaveCharts PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 input destptr:l output size:l local ptr:l,offset:l,tmp:l BEGIN +b stzl size stz offset+2 call S_CopyIn,in=(#S_CurrentData2:l) moveword S_Cur2ChartCount,offset jeq GotSize ; Get the final size of all the chartdata. tool _Multiply,in=(S_Cur2ChartCount:w,#S_CSize:w),out=(size:l) movelong size,[destptr] addwl #4,destptr ; Get the ptr to the array of blockptrs. H_GetBlockPtr S_Cur2ChartList,ptr dec offset asl offset asl offset ; Loop through the array, Deref'ing and saving out all the charts. SaveLoop addlong ptr,offset,tmp H_GetBlockPtr [tmp],s tool _BlockMove,in=(:l,destptr:l,#S_CSize:l) movelong #0,[destptr]:#S_CWind ; zero out the GR wind ptr. subword offset,#4,offset bmi GotSize addwl #S_CSize,destptr bra SaveLoop ; Allow for the size longword. GotSize addwl #4,size exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_LoadCharts ; S_LoadCharts PROC EXPORT ;Using S_ChartData ;Using S_CurrentData2 input srcptr:l output size:l local ptr:l,offset:l,chartindex:l,chartptr:l error err BEGIN +b stz err stzl size stz offset+2 call S_CopyIn,in=(#S_CurrentData2:l) moveword S_Cur2ChartCount,offset jeq GotSize ; Size of all chart data. movelong [srcptr],size asl offset asl offset ; Alloc an array blockptr ldx offset ldy #0 H_NewBlock xy,S_Cur2ChartList,err=err jcs exit subword offset,#4,offset addwl #4,srcptr ; allow for size of size LoadLoop H_NewBlock #S_CSize,chartindex,chartptr,err=err bcs exit H_GetBlockPtr S_Cur2ChartList,ptr movelong chartindex,[ptr]:offset tool _BlockMove,in=(srcptr:l,chartptr:l,#S_CSize:l) subword offset,#4,offset bmi GotSize addwl #S_CSize,srcptr bra LoadLoop GotSize addwl #4,size exit call S_CopyOut,in=(#S_CurrentData2:l) RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/ChartData.aii b/appleworksgs/SS/Src/ChartData.aii new file mode 100755 index 0000000..554b62d --- /dev/null +++ b/appleworksgs/SS/Src/ChartData.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- ; IMPORT Bar IMPORT S_ChartDummy IMPORT S_ChartListProc IMPORT S_DlogRect ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ; ENTRY S_ChartNameStr ENTRY S_3DBarIcon ENTRY S_3DBarIconHdl ENTRY S_BarIcon ENTRY S_BarIconHdl ENTRY S_Ch1stMsg ENTRY S_Ch1stTxt ENTRY S_ChBox2 ENTRY S_ChBoxMsg2 ENTRY S_ChCancelTxt ENTRY S_ChLastLE ENTRY S_ChLastMsg ENTRY S_ChLastTxt ENTRY S_ChMaxLE ENTRY S_ChMaxMsg ENTRY S_ChMaxTxt ENTRY S_ChMinMsg ENTRY S_ChMinTxt ENTRY S_ChName ENTRY S_ChNameLE ENTRY S_ChNameMsg ENTRY S_ChOK ENTRY S_ChOKTxt ENTRY S_ChPie ENTRY S_ChPt ENTRY S_ChRange ENTRY S_ChRangeMsg ENTRY S_ChVal ENTRY S_ChValMsg ENTRY S_LineIcon ENTRY S_LineIconHdl ENTRY S_MdCclTxt ENTRY S_MdChgTxt ENTRY S_MdDelTxt ENTRY S_MdRCTxt ENTRY S_MdRCalc ENTRY S_MdTitleMsg ENTRY S_PieIcon ENTRY S_PieIconHdl ENTRY S_PtIcon ENTRY S_PtIconHdl ENTRY S_RangeRect ;--------------------------------------------------------------------------- ; ; S_ChartData ; S_ChartData PROC EXPORT EXPORT S_ChartListRec EXPORT S_ListDlog EXPORT S_ListRect EXPORT S_ChartCount EXPORT S_ChartNameStr EXPORT S_DlogClipRgn EXPORT S_ItzaBar EXPORT S_MissingSlice EXPORT S_LinearMax EXPORT S_LinearMaxVal EXPORT S_ChartColors EXPORT S_ChartMsgRec EXPORT S_ChartSSWind EXPORT S_ChartGRWind EXPORT S_ChartPict EXPORT S_ChartTitleLoc EXPORT S_PieRect EXPORT S_PictRect EXPORT S_ChUntitle EXPORT S_ChNameNum EXPORT S_ChTooMany EXPORT S_SliceStr EXPORT S_NoSelectStr EXPORT S_BadNum EXPORT S_NoData EXPORT S_OneDatum EXPORT S_BigPie EXPORT S_BigBar EXPORT S_LoMem EXPORT S_NoINF EXPORT S_ModifyChartDlog EXPORT S_MdRCalc EXPORT S_MdRCTxt EXPORT S_MdCancel EXPORT S_MdCclTxt EXPORT S_MdDelete EXPORT S_MdDelTxt EXPORT S_MdChange EXPORT S_MdChgTxt EXPORT S_MdTitle EXPORT S_MdTitleMsg EXPORT S_ChOKTxt EXPORT S_ChCancelTxt EXPORT S_ChooseChartDlog EXPORT S_ChOK EXPORT S_ChCancel EXPORT S_ChIconTable EXPORT S_ChPie EXPORT S_ChBar EXPORT S_Ch3DBar EXPORT S_ChLine EXPORT S_ChPt EXPORT S_ChBox2 EXPORT S_ChBoxMsg2 EXPORT S_ChRange EXPORT S_ChRangeMsg EXPORT S_Ch1st EXPORT S_Ch1stMsg EXPORT S_ChLast EXPORT S_ChLastMsg EXPORT S_ChVal EXPORT S_ChValMsg EXPORT S_ChMin EXPORT S_ChMinMsg EXPORT S_ChMax EXPORT S_ChMaxMsg EXPORT S_ChName EXPORT S_ChNameMsg EXPORT S_Ch1stLE EXPORT S_Ch1stTxt EXPORT S_ChLastLE EXPORT S_ChLastTxt EXPORT S_ChMinLE EXPORT S_ChMinTxt EXPORT S_ChMaxLE EXPORT S_ChMaxTxt EXPORT S_ChNameLE EXPORT S_ChNamePtr EXPORT S_RangeRect EXPORT S_ValueRect EXPORT S_PieIconHdl EXPORT S_PieIcon EXPORT S_BarIconHdl EXPORT S_BarIcon EXPORT S_3DBarIconHdl EXPORT S_3DBarIcon EXPORT S_LineIconHdl EXPORT S_LineIcon EXPORT S_PtIconHdl EXPORT S_PtIcon ; ENTRY S_EndTooMany ;----------------- ; Globals ;----------------- S_ChartListRec S_ListDlog DS.L 1 S_ListRect DC.W 23,54,105,254 DC.W 23,252,105,278 S_ChartCount DC.W 0 DC.W 10 DC.W 1 DC.L S_ChartListProc DC.L S_ChartDummy DC.L S_ChartDummy DS.W 18 S_ChartNameStr DS.B 33 S_DlogClipRgn DS.L 1 S_ItzaBar DS.W 1 S_MissingSlice DS.W 1 S_LinearMax DS.W 1 S_LinearMaxVal DS.B 10 S_ChartColors DC.W LightBlue,LightGreen,DarkRed,Aqua,LeftGray,LightYellow DC.W DarkGreen,Pink,DarkBlue,Orange,Purple,YellowGreen S_ChartMsgRec S_ChartSSWind DS.L 1 S_ChartGRWind DS.L 1 S_ChartPict DS.L 1 S_ChartTitleLoc DC.W 171,260 S_PieRect DC.W 0,0,135,300 S_PictRect DC.W 0,0,$18C,$2D0 ; 8' x 11.5' S_ChUntitle STR 'Untitled Chart ' S_ChNameNum S_ChTooMany DC.B S_EndTooMany-S_ChTooMany-1 DC.B 'You are limited to a maximum of 100' DC.B 13 DC.B 'charts per spreadsheet.' S_EndTooMany ;----------------------- ; Chart error messages ;----------------------- S_SliceStr STR 'Some of the numbers are too small to be plotted.' S_NoSelectStr STR 'You must select a chart first.' S_BadNum STR 'All numbers in the range must have the same sign.' S_NoData STR 'There is no data to chart in the selected range.' S_OneDatum STR 'A line chart must have more than one number',13,'to plot.' S_BigPie STR 'There is a maximum of 24 slices per pie.' S_BigBar STR 'There is a maximum of 256 data points per linear',13,'chart. Only the first 256 cells will be charted.' S_LoMem STR 'Not enough memory to draw the chart.' S_NoINF STR 'Infinite values cannot be charted.',13,'Select a range that does not contain INF.' S_ModifyChartDlog DC.W 38,80,162,565 DC.W 1 ; visible DC.L 0 ; refcon DC.L S_MdRCalc,S_MdDelete,S_MdChange,S_MdCancel,S_MdTitle DC.L 0 ; Buttons S_MdRCalc DC.W 1 DC.W 24,333,37,431 DC.W buttonItem DC.L S_MdRCTxt DC.W 0 DC.W 0 DC.L 0 S_MdRCTxt STR 'Recalculate' S_MdCancel DC.W 2 DC.W 92,333,105,431 DC.W buttonItem DC.L S_MdCclTxt DC.W 0 DC.W 0 DC.L 0 S_MdCclTxt STR 'Cancel' S_MdDelete DC.W 3 DC.W 48,333,61,431 DC.W buttonItem DC.L S_MdDelTxt DC.W 0 DC.W 0 DC.L 0 S_MdDelTxt STR 'Delete' S_MdChange DC.W 4 DC.W 70,333,83,431 DC.W buttonItem DC.L S_MdChgTxt DC.W 0 DC.W 0 DC.L 0 S_MdChgTxt STR 'Change' S_MdTitle DC.W 5 DC.W 9,58,21,254 DC.W statText+itemDisable DC.L S_MdTitleMsg DC.W 0 DC.W 0 DC.L 0 S_MdTitleMsg STR 'Select a chart:' ;--------------------------------------------------------------------------- ; Choose Chart Dialog ; ; 1 = OK ; 2 = Cancel ; 4 = 'Fixed decimal places' ; 5 = DigitCount S_ChOKTxt STR 'OK' S_ChCancelTxt STR 'Cancel' S_ChooseChartDlog DC.W 32,48,182,592 DC.W 0 ; Invisible DC.L 0 ; Refcon DC.L S_ChOK,S_ChCancel ; Buttons DC.L S_ChPie,S_ChBar,S_Ch3DBar,S_ChLine ; Icons DC.L S_ChPt DC.L S_ChBox2 DC.L S_ChRange,S_Ch1st,S_ChLast ; Static Text DC.L S_ChVal,S_ChMin,S_ChMax DC.L S_ChName DC.L S_ChNameLE DC.L S_ChMaxLE,S_ChMinLE ; Line Edits DC.L S_ChLastLE,S_Ch1stLE DC.L S_RangeRect,S_ValueRect DC.L 0 ; Buttons S_ChOK DC.W 1 DC.W 130,400,143,501 DC.W buttonItem DC.L S_ChOKTxt DC.W 0 DC.W 0 DC.L 0 S_ChCancel DC.W 2 DC.W 105,402,118,503 DC.W buttonItem DC.L S_ChCancelTxt DC.W 0 DC.W 0 DC.L 0 S_ChIconTable DC.L S_ChPie,S_ChBar,S_Ch3DBar,S_ChLine,S_ChPt ; Icons S_ChPie DC.W 3 DC.W 17,36,44,102 DC.W iconItem DC.L S_PieIconHdl DC.W 0,0 DC.L 0 S_ChBar DC.W 4 DC.W 17,138,44,204 DC.W iconItem DC.L S_BarIconHdl DC.W 0,0 DC.L 0 S_Ch3DBar DC.W 5 DC.W 17,240,44,306 DC.W iconItem DC.L S_3DBarIconHdl DC.W 0,0 DC.L 0 S_ChLine DC.W 6 DC.W 17,342,44,408 DC.W iconItem DC.L S_LineIconHdl DC.W 0,0 DC.L 0 S_ChPt DC.W 7 DC.W 17,444,44,510 DC.W iconItem DC.L S_PtIconHdl DC.W 0,0 DC.L 0 ; Check box S_ChBox2 DC.W 8 DC.W 73,402,83,513 DC.W checkItem DC.L S_ChBoxMsg2 DC.W 1 ; initial value DC.B 0,0 ; visibility, hilighting style DC.L 0 S_ChBoxMsg2 STR 'Spaced bars' ; Static Text S_ChRange DC.W 9 DC.W 54,46,64,100 DC.W statText+itemDisable DC.L S_ChRangeMsg DC.W 0 DC.W 0 DC.L 0 S_ChRangeMsg STR ' Range:' S_Ch1st DC.W 10 DC.W 66,50,76,125 DC.W statText+itemDisable DC.L S_Ch1stMsg DC.W 0 DC.W 0 DC.L 0 S_Ch1stMsg STR 'First Cell' S_ChLast DC.W 11 DC.W 66,198,76,268 DC.W statText+itemDisable DC.L S_ChLastMsg DC.W 0 DC.W 0 DC.L 0 S_ChLastMsg STR 'Last Cell' S_ChVal DC.W 12 DC.W 90,46,100,100 DC.W statText+itemDisable DC.L S_ChValMsg DC.W 0 DC.W 0 DC.L 0 S_ChValMsg STR ' Value:' S_ChMin DC.W 13 DC.W 102,50,112,105 DC.W statText+itemDisable DC.L S_ChMinMsg DC.W 0 DC.W 0 DC.L 0 S_ChMinMsg STR 'Minimum' S_ChMax DC.W 14 DC.W 102,198,112,254 DC.W statText+itemDisable DC.L S_ChMaxMsg DC.W 0 DC.W 0 DC.L 0 S_ChMaxMsg STR 'Maximum' S_ChName DC.W 15 DC.W 132,45,142,126 DC.W statText+itemDisable DC.L S_ChNameMsg DC.W 0 DC.W 0 DC.L 0 S_ChNameMsg STR 'Chart Name:' ; Line Edits S_Ch1stLE DC.W 16 DC.W 64,126,77,186 DC.W editLine DC.L S_Ch1stTxt DC.W 6 DC.W 0 DC.W 0 DC.L 0 S_Ch1stTxt DC.B 0 DS.B 5 S_ChLastLE DC.W 17 DC.W 64,278,77,344 DC.W editLine DC.L S_ChLastTxt DC.W 6 DC.W 0 DC.W 0 DC.L 0 S_ChLastTxt DC.B 0 DS.B 5 S_ChMinLE DC.W 18 DC.W 100,110,113,186 DC.W editLine DC.L S_ChMinTxt DC.W 10 DC.W 0 DC.W 0 DC.L 0 S_ChMinTxt DS.B 16 S_ChMaxLE DC.W 19 DC.W 100,258,113,344 DC.W editLine DC.L S_ChMaxTxt DC.W 10 DC.W 0 DC.W 0 DC.L 0 S_ChMaxTxt DS.B 16 S_ChNameLE DC.W 20 DC.W 130,131,143,356 DC.W editLine S_ChNamePtr DC.L S_ChartNameStr DC.W 31 DC.W 0 DC.W 0 DC.L 0 S_RangeRect DC.W 21 DC.W 59,40,82,356 DC.W userItem+itemDisable DC.L S_DlogRect DC.W 0 DC.W 0 DC.L 0 S_ValueRect DC.W 22 DC.W 95,40,118,356 DC.W userItem+itemDisable DC.L S_DlogRect DC.W 0 DC.W 0 DC.L 0 S_PieIconHdl DC.L S_PieIcon,0 S_PieIcon DC.W 0,0,27,68 DC.B $FF,$FF,$FF,$FF,$FF,$F0,$00,$00,$00,$00,$0F,$FF,$FF,$FF,$FF,$FF,$FF DC.B $FF,$FF,$FF,$FF,$C0,$00,$AA,$A0,$DD,$DD,$00,$03,$FF,$FF,$FF,$FF,$FF DC.B $FF,$FF,$FF,$C0,$0A,$AA,$AA,$A0,$DD,$DD,$DD,$D0,$03,$FF,$FF,$FF,$FF DC.B $FF,$FF,$F0,$0A,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DD,$D0,$0F,$FF,$FF,$FF DC.B $FF,$FF,$0A,$AA,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DD,$DD,$C0,$FF,$FF,$FF DC.B $FF,$F0,$AA,$AA,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DD,$DD,$DC,$0F,$FF,$FF DC.B $FF,$CA,$AA,$AA,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DD,$DD,$DD,$C3,$FF,$FF DC.B $FC,$0A,$AA,$AA,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DD,$DD,$DD,$D0,$3F,$FF DC.B $F0,$AA,$AA,$AA,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DD,$DD,$DD,$DD,$0F,$FF DC.B $F0,$AA,$AA,$AA,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DD,$DD,$DD,$DD,$0F,$FF DC.B $0A,$AA,$AA,$AA,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DD,$DD,$DD,$DD,$C0,$FF DC.B $0A,$AA,$AA,$AA,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DD,$DD,$DD,$DD,$D0,$FF DC.B $0A,$AA,$AA,$AA,$AA,$AA,$AA,$A0,$DD,$DD,$DD,$DC,$00,$00,$00,$00,$FF DC.B $0A,$AA,$AA,$AA,$AA,$AA,$AA,$A0,$00,$00,$00,$00,$66,$66,$66,$60,$FF DC.B $0A,$AA,$AA,$AA,$AA,$AA,$AA,$00,$06,$66,$66,$66,$66,$66,$66,$60,$FF DC.B $0A,$AA,$AA,$AA,$AA,$AA,$00,$EC,$06,$66,$66,$66,$66,$66,$66,$60,$FF DC.B $0A,$AA,$AA,$AA,$AA,$A0,$4E,$EE,$06,$66,$66,$66,$66,$66,$66,$60,$FF DC.B $F0,$AA,$AA,$AA,$A0,$0E,$EE,$EE,$06,$66,$66,$66,$66,$66,$66,$0F,$FF DC.B $F0,$AA,$AA,$AA,$04,$EE,$EE,$EE,$06,$66,$66,$66,$66,$66,$66,$0F,$FF DC.B $FC,$0A,$AA,$00,$EE,$EE,$EE,$EE,$06,$66,$66,$66,$66,$66,$60,$3F,$FF DC.B $FF,$CA,$A0,$4E,$EE,$EE,$EE,$EE,$E0,$66,$66,$66,$66,$66,$63,$FF,$FF DC.B $FF,$F0,$0E,$EE,$EE,$EE,$EE,$EE,$E0,$66,$66,$66,$66,$66,$0F,$FF,$FF DC.B $FF,$FF,$04,$EE,$EE,$EE,$EE,$EE,$E0,$66,$66,$66,$66,$60,$FF,$FF,$FF DC.B $FF,$FF,$F0,$0E,$EE,$EE,$EE,$EE,$E0,$66,$66,$66,$60,$0F,$FF,$FF,$FF DC.B $FF,$FF,$FF,$C0,$0E,$EE,$EE,$EE,$EE,$06,$66,$60,$03,$FF,$FF,$FF,$FF DC.B $FF,$FF,$FF,$FF,$C0,$00,$EE,$EE,$EE,$06,$00,$03,$FF,$FF,$FF,$FF,$FF DC.B $FF,$FF,$FF,$FF,$FF,$F0,$00,$00,$00,$00,$0F,$FF,$FF,$FF,$FF,$FF,$FF S_BarIconHdl DC.L S_BarIcon,0 S_BarIcon DC.W 0,0,27,68 DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$C0,$00,$00,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$C0,$00,$00,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$C6,$66,$60,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$FF,$FF,$FF,$FF,$C6,$66,$60,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$00,$00,$03,$FF,$C6,$66,$60,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$FF,$FF,$FF,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$00,$00,$00,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$0E,$EE,$E0,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$0E,$EE,$E0,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$0E,$EE,$E0,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$0E,$EE,$E0,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$0E,$EE,$E0,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$0E,$EE,$E0,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$0E,$EE,$E0,$FF,$CA,$AA,$A0,$FF DC.B $0F,$0D,$DD,$D3,$FF,$C6,$66,$60,$FF,$0E,$EE,$E0,$FF,$CA,$AA,$A0,$FF DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0F S_3DBarIconHdl DC.L S_3DBarIcon,0 S_3DBarIcon DC.W 0,0,27,68 DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$33,$33,$0F DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F3,$33,$30,$8F DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$FF,$FF,$FF,$FF,$FF,$33,$33,$0F,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$FF,$FF,$FF,$FF,$F3,$33,$30,$4F,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$FF,$FF,$FF,$FF,$66,$66,$64,$4F,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$FF,$33,$33,$0F,$66,$66,$64,$4F,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$F3,$33,$30,$1F,$66,$66,$64,$4F,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$FF,$FF,$FF,$FF,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$FF,$33,$33,$0F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$F3,$33,$30,$2F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$EE,$EE,$E2,$2F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$EE,$EE,$E2,$2F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$EE,$EE,$E2,$2F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$EE,$EE,$E2,$2F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$EE,$EE,$E2,$2F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$EE,$EE,$E2,$2F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$EE,$EE,$E2,$2F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$EE,$EE,$E2,$2F,$AA,$AA,$A8,$8F DC.B $0F,$DD,$DD,$D1,$1F,$66,$66,$64,$4F,$EE,$EE,$E2,$2F,$AA,$AA,$A8,$8F DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0F S_LineIconHdl DC.L S_LineIcon,0 S_LineIcon DC.W 0,0,27,68 DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F4,$4F DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$44,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$4F,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F4,$4F,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$44,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$F4,$4F,$FF,$FF,$FF,$FF,$FF,$FF,$4F,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$F4,$44,$C4,$FF,$FF,$FF,$FF,$FF,$F4,$4F,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$44,$FF,$F4,$44,$FF,$FF,$FF,$FF,$44,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$44,$4F,$FF,$FF,$F4,$4F,$FF,$FF,$FF,$4F,$FF,$FF,$FF DC.B $0F,$FF,$FF,$F4,$4F,$FF,$FF,$FF,$FF,$44,$FF,$FF,$F4,$4F,$FF,$FF,$FF DC.B $0F,$FF,$FF,$44,$FF,$FF,$FF,$FF,$FF,$F4,$44,$FF,$44,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$4F,$FF,$FF,$FF,$FF,$FF,$FF,$F4,$4F,$4F,$FF,$FF,$FF,$FF DC.B $0F,$FF,$F4,$4F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$44,$4F,$FF,$FF,$FF,$FF DC.B $0F,$FF,$F4,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$44,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$4F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$F4,$4F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$F4,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$44,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$4F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0C,$4F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $04,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $04,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0F S_PtIconHdl DC.L S_PtIcon,0 S_PtIcon DC.W 0,0,27,68 DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$C3,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FC,$00,$3F,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$C3,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$C3,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FC,$00,$3F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$C3,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$C3,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FC,$00,$3F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$C3,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$C3,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FC,$00,$3F,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$C3,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF DC.B $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0F ; -------------------- ; A Chart: ; -------------------- ; ________________ ; ; Type (int) 2| 0 ; ;________________| ; ;Range (int,int)8| 2 ; ;________________| ; ; Name (str) 32| 10 ; ;________________| ; ; IsMax (bool) 2| 42 ; ;________________| ; ; Max (ext) 10| 44 ; ;________________| ; ; Min (ext) 10| 54 ; ;________________| ; ;SpaceBar (bool)2| 64 ; ;________________| ; ; Wind (long) 4| 66 ; ;________________| ; 70 ENDP S_SANEData2 PROC EXPORT EXPORT S_decform2 EXPORT S_nstring2 EXPORT S_drec2 S_decform2 DC.W 1,17 S_nstring2 DS.W 156 S_drec2 DS.W 1 DS.W 1 DS.B 18 ENDP ;----------------------------------------------------------------------------- ; S_CurrentData2 ; S_CurrentData2 PROC EXPORT EXPORT S_Cur2Window EXPORT S_Cur2Sheet EXPORT S_Cur2ContRect EXPORT S_Cur2SheetInfo EXPORT S_Cur2ContHt EXPORT S_Cur2ContWd EXPORT S_Cur2RScrl EXPORT S_Cur2Bscrl EXPORT S_Cur2Grow EXPORT S_Cur2VPageSize EXPORT S_Cur2MaxTLCell EXPORT S_Cur2LEHandle EXPORT S_Cur2Heap EXPORT S_Cur2State EXPORT S_Cur2RowBlock EXPORT S_Cur2ContYPt EXPORT S_Cur2ContXPt EXPORT S_Cur2TLTitle EXPORT S_Cur2BRTitle EXPORT S_Cur2ChartCount EXPORT S_Cur2ChartList EXPORT S_Cur2ChangedList EXPORT S_Cur2RecalcList EXPORT S_Cur2ColumnWds EXPORT S_Cur2DefColWd EXPORT S_Cur2TLCell EXPORT S_Cur2TLSelect EXPORT S_Cur2BRSelect EXPORT S_Cur2BRMost EXPORT S_Cur2EditFlag EXPORT S_Cur2DefFormat EXPORT S_Cur2Format S_Cur2Window DC.L 0 S_Cur2Sheet DC.L 0 S_Cur2ContRect DC.W S_EditHeight+2 DC.W 0 S_Cur2SheetInfo S_Cur2ContHt DS.W 1 S_Cur2ContWd DS.W 1 S_Cur2RScrl DS.L 1 S_Cur2Bscrl DS.L 1 S_Cur2Grow DS.L 1 S_Cur2VPageSize DS.W 1 S_Cur2MaxTLCell DS.L 1 S_Cur2LEHandle DS.L 1 S_Cur2Heap DS.L 1 S_Cur2State ;----------- S_Cur2RowBlock DS.L 1 S_Cur2ContYPt DS.W 1 S_Cur2ContXPt DS.W 1 S_Cur2TLTitle DS.L 1 S_Cur2BRTitle DS.L 1 S_Cur2ChartCount DS.W 1 S_Cur2ChartList DS.L 1 S_Cur2ChangedList DS.L 1 S_Cur2RecalcList DS.L 1 S_Cur2ColumnWds DS.L 1 S_Cur2DefColWd DS.W 1 S_Cur2TLCell DS.L 1 S_Cur2TLSelect DS.L 1 S_Cur2BRSelect DS.L 1 S_Cur2BRMost DS.L 1 S_Cur2EditFlag DS.W 1 S_Cur2DefFormat DS.L 1 S_Cur2Format DS.L 1 ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Data.aii b/appleworksgs/SS/Src/Data.aii new file mode 100755 index 0000000..c0c7478 --- /dev/null +++ b/appleworksgs/SS/Src/Data.aii @@ -0,0 +1 @@ + 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\*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\VH' DC.W $40B DC.B cr DC.B ' Commas\*, 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\V*LlH' DC.W $504 DC.B cr DC.B ' Change Default Width\H' DC.W $505 DC.B cr DC.B ' Restore Width to Default\VH' DC.W $506 DC.B cr DC.B ' Set Titles\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\V*GgH' DC.W $601 DC.B cr DC.B ' Sort\H' DC.W $602 DC.B cr DC.B ' Protect\V**8H' DC.W $603 DC.B cr DC.B ' New Chart\H' DC.W $604 DC.B cr DC.B ' Modify Chart\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 ' 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 \ No newline at end of file diff --git a/appleworksgs/SS/Src/DataMenu.aii b/appleworksgs/SS/Src/DataMenu.aii new file mode 100755 index 0000000..087c197 --- /dev/null +++ b/appleworksgs/SS/Src/DataMenu.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_MemoryError IMPORT S_ActiveWindow IMPORT S_CurBRSelect IMPORT S_CurBScrl IMPORT S_CurContRect IMPORT S_CurEditFlag IMPORT S_CurMaxTLCell IMPORT S_CurRScrl IMPORT S_CurTLSelect IMPORT S_CurWindow IMPORT S_DoModifyChart IMPORT S_DoNewChart IMPORT S_DrawLocation IMPORT S_EndEdit IMPORT S_FixLE IMPORT S_GetCellDlog IMPORT S_HiliteCells IMPORT S_InvalidCellStr IMPORT S_SwapIn IMPORT S_Thumb IMPORT S_UpdateDoc ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_RefreshUpdateRgn ;----------------------------------------------------------------------------- ; ; S_Goto PROC EXPORT ;Using S_CurrentData ;Using S_ErrorData local Cell:l,Value:w,OldClipRgn:l error ErrFlag BEGIN +b stz ErrFlag Call S_SwapIn,in=(S_ActiveWindow:l) ; newcell: 0 == Cancelled, 0 w/carry set == error Call S_GetCellDlog,in=(#0:w,S_CurTLSelect:l),out=(Cell:l) bcc doOK Call D_AlertBox,in=(#OKBox:w,#S_InvalidCellStr:l),out=(a:w) doOK lda Cell ora Cell+2 jeq Exit lda S_CurEditFlag and #S_KeysInactive jne Exit Call S_RefreshUpdateRgn lda S_CurEditFlag and #S_EditingBit beq ChkBump Call S_EndEdit,in=(#-1:w),err=ErrFlag jcs memError lda S_CurEditFlag and #-1-S_EditingBit sta S_CurEditFlag ; Bump the window until the New cell at the top left ; ChkBump ; Bump Horizontally ; CmpWord Cell+2,S_CurMaxTLCell+2 blt setBValue lda S_CurMaxTLCell+2 setBValue dec a sta Value Tool _SetCtlValue,in=(Value:w,S_CurBScrl:l) Call S_Thumb,in=(S_CurBScrl:l) ; Bump Vertically ; CmpWord Cell,S_CurMaxTLCell blt setRValue lda S_CurMaxTLCell setRValue dec a sta Value Tool _SetCtlValue,in=(Value:w,S_CurRScrl:l) Call S_Thumb,in=(S_CurRScrl:l) ; The Cell is completely in view ; Tool _NewRgn,out=(:l) MoveLong 1:s,OldClipRgn Tool _GetClip,in=(:l) Tool _ClipRect,in=(#S_CurContRect:l) Call S_HiliteCells MoveWord Cell,S_CurTLSelect sta S_CurBRSelect MoveWord Cell+2,S_CurTLSelect+2 sta S_CurBRSelect+2 Call S_HiliteCells Tool _SetClip,in=(OldClipRgn:l) Tool _DisposeRgn,in=(OldClipRgn:l) bra doLE memError Call D_MemoryError ; The New cell needs to be displayed in the LE field. ; doLE Call S_FixLE Call S_DrawLocation Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_NewChart ; S_NewChart PROC EXPORT BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) Call S_DoNewChart RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_ModifyChart ; S_ModifyChart PROC EXPORT BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) Call S_DoModifyChart RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_RefreshUpdateRgn PROC EXPORT ;Using S_CurrentData BEGIN Tool _BeginUpdate,in=(S_CurWindow:l) Call S_UpdateDoc,in=(S_CurWindow:l) Tool _EndUpdate,in=(S_CurWindow:l) RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Dlog.aii b/appleworksgs/SS/Src/Dlog.aii new file mode 100755 index 0000000..551fe66 --- /dev/null +++ b/appleworksgs/SS/Src/Dlog.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT S_ActiveWindow IMPORT S_CurDefFormat IMPORT S_CurEditFlag IMPORT S_CurFormat IMPORT S_CurTLSelect IMPORT S_DoChecks IMPORT S_DoDefaultDlog IMPORT S_GetCellPtr IMPORT S_ListFormulasDlog IMPORT S_SetCurFormat IMPORT S_SwapIn ;--------------------------------------------------------------------------- ; ; S_SetDefaults ; S_SetDefaults PROC EXPORT ;Using S_CurrentData local CellPtr:l BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) in S_CurDefFormat:l out S_CurDefFormat:l XCall S_DoDefaultDlog lda S_CurEditFlag and #S_EditingBit beq doChecks ; not editting in S_CurTLSelect:l out CellPtr:l XCall S_GetCellPtr ora CellPtr beq setFormat ; cell empty MoveWord [CellPtr]:#S_CellFormat,a bpl doChecks ; cell not empty setFormat MoveLong S_CurDefFormat,S_CurFormat doChecks Call S_DoChecks RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_ListFormulas PROC EXPORT ;Using S_CurrentData BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) lda S_CurEditFlag and #S_EditingBit bne stopIdle Call S_SetCurFormat,in=(S_CurTLSelect:l) bra doDlog stopIdle doDlog Call S_ListFormulasDlog RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Dlog2.aii b/appleworksgs/SS/Src/Dlog2.aii new file mode 100755 index 0000000..85f3b9b --- /dev/null +++ b/appleworksgs/SS/Src/Dlog2.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_BLForgetLists IMPORT D_BLGetSel IMPORT D_BLMakeList IMPORT D_BLModalDialog IMPORT D_BLSelect IMPORT D_BlinkButton IMPORT D_CloseDialog IMPORT D_DigitsOnly IMPORT D_EscFilter IMPORT D_GetNewModalDialog IMPORT D_HeartBeatIdle IMPORT D_IsDigit IMPORT D_IsLetter IMPORT D_Set4Pat IMPORT S_Cell2Str IMPORT S_CopyIn IMPORT S_CopyOut IMPORT S_Cur2EditFlag IMPORT S_Cur2LEHandle IMPORT S_CurrentData2 IMPORT S_SetEdittingMenus IMPORT S_Text2Cell IMPORT S_TrackVertLine ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_ALeftRadio ENTRY S_AddButton ENTRY S_AddFuncStr ENTRY S_AlStr ENTRY S_AscRadio ENTRY S_AscStr ENTRY S_BoldBox ENTRY S_BoldStr ENTRY S_CellDlog ENTRY S_CellStrPtr ENTRY S_CloseFuncStr ENTRY S_ColRowStr ENTRY S_Column1Box ENTRY S_Column1Str ENTRY S_Column1ValStr ENTRY S_Column2Box ENTRY S_Column2Str ENTRY S_Column2ValStr ENTRY S_CommaStr ENTRY S_CtrStr ENTRY S_DRStr ENTRY S_DefOK ENTRY S_DefaultWidthBlurb ENTRY S_DefaultWidthStr ENTRY S_DeleteStr ENTRY S_DescStr ENTRY S_DirDlog ENTRY S_DirOK ENTRY S_DirStrPtr ENTRY S_DisplayStr ENTRY S_DollarStr ENTRY S_DownRadio ENTRY S_DownStr ENTRY S_FillStr ENTRY S_FixedStr ENTRY S_FmtStr ENTRY S_GenRadio ENTRY S_GenStr ENTRY S_GotoStr ENTRY S_KeyStr ENTRY S_LEText ENTRY S_LFCloseButton ENTRY S_LeftBox ENTRY S_LeftBoxVal ENTRY S_LeftStr ENTRY S_LeftTitleStr ENTRY S_ListFuncBlurb ENTRY S_ListFuncStr ENTRY S_MoveStr ENTRY S_MyFuckingCancelStr ENTRY S_OKStr ENTRY S_OptRect ENTRY S_OptText ENTRY S_ParenNegStr ENTRY S_PercentStr ENTRY S_PlaceLE ENTRY S_PlaceStr ENTRY S_RRStr ENTRY S_RedNegStr ENTRY S_RightStr ENTRY S_Row1Box ENTRY S_Row1Str ENTRY S_Row1ValStr ENTRY S_Row2Box ENTRY S_Row2Str ENTRY S_Row2ValStr ENTRY S_RowColStr ENTRY S_SciNotStr ENTRY S_SortCell ENTRY S_SortDlog ENTRY S_SortOK ENTRY S_SortStr ENTRY S_StyStr ENTRY S_ThruStr ENTRY S_TitleBlurb ENTRY S_TitleBlurbStr ENTRY S_TitleCancel ENTRY S_TitleCol1Str ENTRY S_TitleDlog ENTRY S_TitleOK ENTRY S_TitleRow1Str ENTRY S_TopBox ENTRY S_TopBoxVal ENTRY S_TopTitleStr ENTRY S_ULineStr ENTRY S_UpStr ENTRY S_WhichLE ENTRY S_WidthCancel ENTRY S_WidthOK ENTRY S_WidthThing ENTRY S_CellNumberFromLetters ENTRY S_CellNumberFromNumbers ENTRY S_ColLetterFromNumber ENTRY S_DlogRect ENTRY S_DrawLFMember ENTRY S_InsertStr ENTRY S_LFFilter ENTRY S_RowNumberFromNumber ENTRY S_SelectLFMember ENTRY S_ThingDef ENTRY S_TitleFilter ENTRY S_WidthFilter ;--------------------------------------------------------------------------- ; ; S_DlogRect ; ; action proc for drawing a rectangle in a dialog S_DlogRect PROC EXPORT ;USING S_ChartData input TheDlog:l,item:w local ptr:l,tmprect:r,rectptr:l BEGIN MoveLong !tmprect,rectptr Tool _GetDItemBox,in=(TheDlog:l,item:w,rectptr:l) _PenNormal Tool _SetPenSize,in=(#2:w,#1:w) Tool _FrameRect,in=(rectptr:l) _PenNormal RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_GetDirDlog(all:w):w ; ; all: 0==Fill in what direction? D,R ; 1==Insert in what direction? D,R ; 2==Delete in what direction? U,L ; ; direction: 0==Cancel,1==Left, 2==Right, 3==Up,4==Down ; Button: 4 5 6 7 S_GetDirDlog PROC EXPORT ;Using S_DlogData input all:w output direction:w local TheDlog:l,result:w,CtlHdl:l BEGIN +b moveword #4,direction lda all bne DoAll movelong #S_FillStr,S_DirStrPtr MoveLong #S_DownStr,S_DRStr MoveLong #S_RightStr,S_RRStr bra dodlog doall cmp #1 bne dodelete MoveLong #S_InsertStr,S_DirStrPtr MoveLong #S_DownStr,S_DRStr MoveLong #S_RightStr,S_RRStr bra dodlog dodelete MoveLong #S_DeleteStr,S_DirStrPtr MoveLong #S_UpStr,S_DRStr MoveLong #S_LeftStr,S_RRStr DoDlog call D_GetNewModalDialog,in=(#S_DirDlog:l),out=(TheDlog:l) DlogLoop tool _ModalDialog,in=(#D_EscFilter+$80000000:l),out=(result:w) cmp #3 blt Done beq DlogLoop subword a,#3,direction tool _GetControlDItem,in=(TheDlog:l,result:w),out=(CtlHdl:l) tool _SetCtlValue,in=(#1:w,CtlHdl:l) bra DlogLoop Done call D_CloseDialog,in=(TheDlog:l) cmpw result,#OK bne cancelout lda all cmp #2 bne exit SubWord Direction,#1,Direction bra exit cancelout stz direction exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_GetCellDlog(move:w,cell:l):l ; ; move: 0==Goto cell ; 1==Move cell ; ; cell: 0==No default ; ; newcell: 0 == Cancelled, 0 w/carry set == error S_GetCellDlog PROC EXPORT ;Using S_DlogData input move:w,cell:l output newcell:l local TheDlog:l,result:w,tmpstr:r,tmp:l error err BEGIN +b stz err stzl newcell IsNil cell bne DoConvert stz S_LEText bra Cont DoConvert call S_Cell2Str,in=(#S_LEText:l,cell:l) Cont lda move beq Goto movelong #S_MoveStr,S_CellStrPtr bra DoDlog Goto movelong #S_GotoStr,S_CellStrPtr DoDlog call D_GetNewModalDialog,in=(#S_CellDlog:l),out=(TheDlog:l) DlogLoop tool _ModalDialog,in=(#D_EscFilter+$80000000:l),out=(result:w) cmp #3 bge DlogLoop Done tool _GetIText,in=(TheDlog:l,#4:w,!tmpstr:l) call D_CloseDialog,in=(TheDlog:l) lda result cmp #Cancel beq exit lda tmpstr and #$FF bne Do2Cell inc err bra exit Do2Cell sta tmp call S_Text2Cell,in=(!tmpstr+1:l,tmp:w),out=(newcell:l) bcc exit stzl newcell inc err exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_DoSortDlog(default:l):(ascend:w,rowcol:w,cell:l) ; ; ascend: 0==ascending, 1==decending ; rowcol: 0==col by row, 1==row by col ; cell: 0 == Cancelled,0 w/carry set == error ; S_DoSortDlog PROC EXPORT ;Using S_DlogData input default:l output ascend:w,rowcol:w,newcell:l local TheDlog:l,result:w,CtlHdl:l,tmpstr:r,tmp:w error err BEGIN +b stz err stzl newcell moveword #1,rowcol stz ascend IsNil default bne DoConvert stz S_LEText bra DoDlog DoConvert call S_Cell2Str,in=(#S_LEText:l,default:l) DoDlog call D_GetNewModalDialog,in=(#S_SortDlog:l),out=(TheDlog:l) DlogLoop tool _ModalDialog,in=(#D_EscFilter+$80000000:l),out=(result:w) cmp #7 bge DlogLoop cmp #3 blt Done bne chk4 stz ascend bra setItem chk4 cmp #4 bne chk5 moveword #1,ascend bra setItem chk5 cmp #5 bne do6 moveword #1,rowcol bra setItem do6 stz rowcol setItem tool _GetControlDItem,in=(TheDlog:l,result:w),out=(CtlHdl:l) tool _SetCtlValue,in=(#1:w,CtlHdl:l) bra DLogLoop Done tool _GetIText,in=(TheDlog:l,#9:w,!tmpstr:l) call D_CloseDialog,in=(TheDlog:l) lda result cmp #Cancel beq exit lda tmpstr and #$FF bne Do2Cell inc err bra exit Do2Cell sta tmp call S_Text2Cell,in=(!tmpstr+1:l,tmp:w),out=(newcell:l) bcc exit stzl newcell inc err exit RETURN ENDP ;********************************************************************* ; ; S_TitleDialog ; ;********************************************************************* S_TitleDialog PROC EXPORT ;Using S_DlogData input OldColLeft:w,OldRowTop:w,OldColRight:w,OldRowBottom:w input LeftThere:w,TopThere:w local Item:w,Dialog:l,Left:w,Right:w output ColLeft:w,RowTop:w,ColRight:w,RowBottom:w error err BEGIN +b stz err stz S_WhichLE lda OldColLeft bne S_LeftStr stz S_Column1ValStr bra next1 S_LeftStr in OldColLeft:w,#S_Column1ValStr:l XCall S_ColLetterFromNumber next1 lda OldColRight bne S_RightStr stz S_Column2ValStr bra next2 S_RightStr in OldColRight:w,#S_Column2ValStr:l XCall S_ColLetterFromNumber next2 lda OldRowTop bne topstr stz S_Row1ValStr bra next3 topstr in OldRowTop:w,#S_Row1ValStr:l XCall S_RowNumberFromNumber next3 lda OldRowBottom bne bottomstr stz S_Row2ValStr bra next4 bottomstr in OldRowBottom:w,#S_Row2ValStr:l XCall S_RowNumberFromNumber next4 MoveWord LeftThere,S_LeftBoxVal MoveWord TopThere,S_TopBoxVal in #S_TitleDlog:l out Dialog:l XCall D_GetNewModalDialog dLoop in #S_TitleFilter+$80000000:l out Item:w XTool _ModalDialog cmp #1 beq getValues cmp #2 jeq doCancel cmp #5 beq doCheckBox cmp #4 bne dLoop doCheckBox in Dialog:l,Item:w out a:w XTool _GetDItemValue eor #1 in a:w,Dialog:l,Item:w XTool _SetDItemValue bra dLoop getValues in Dialog:l,S_LeftBox:w out a:w XTool _GetDItemValue bne doLeft stz ColLeft stz ColRight bra checkTop doLeft in Dialog:l,S_Column1Box:w,#CellScratch:l XTool _GetIText in #CellScratch:l out ColLeft:w XCall S_CellNumberFromLetters in Dialog:l,S_Column2Box:w,#CellScratch:l XTool _GetIText in #CellScratch:l out ColRight:w XCall S_CellNumberFromLetters lda ColLeft jeq notGood lda ColRight bne ChkColOrder MoveWord ColLeft,ColRight bra checkTop chkColOrder cmp ColLeft jlt notGood checkTop in Dialog:l,S_TopBox:w out a:w XTool _GetDItemValue bne dotop stz RowTop stz RowBottom brl doClose doTop in Dialog:l,S_Row1Box:w,#CellScratch:l XTool _GetIText in #CellScratch:l out RowTop:w XCall S_CellNumberFromNumbers in Dialog:l,S_Row2Box:w,#CellScratch:l XTool _GetIText in #CellScratch:l out RowBottom:w XCall S_CellNumberFromNumbers lda RowTop beq notGood lda RowBottom bne chkRowOrder MoveWord RowTop,RowBottom bra doClose chkRowOrder cmp RowTop bge doClose notGood Call D_AlertBox,in=(#OKBox:w,#S_BadTitleMsg:l),out=(a:w) brl DLoop doCancel MoveWord #-1,err MoveWord OldRowTop,RowTop MoveWord OldRowBottom,RowBottom MoveWord OldColLeft,ColLeft MoveWord OldColRight,ColRight doClose PushLong Dialog Call D_CloseDialog Exit RETURN CellScratch DS.B 8 S_BadTitleMsg str 'Invalid range specified for titles.' ENDP ;*********************************************************************** ; ; S_CellNumberFromLetters ; ;*********************************************************************** S_CellNumberFromLetters PROC EXPORT input Ptr:l output Number:w BEGIN lda [Ptr] and #$ff beq noText dec a beq onedigit SpaceLong ldy #1 lda [Ptr],y and #$ff sec sbc #'@' pha PushWord #26 _Multiply PullWord Number pla ldy #2 lda [Ptr],y and #$ff sec sbc #'@' clc adc Number sta Number bra exit onedigit ldy #1 lda [Ptr],y and #$ff sec sbc #'@' noText sta Number exit RETURN ENDP ;*********************************************************************** ; ; S_CellNumberFromNumbers ; ;*********************************************************************** S_CellNumberFromNumbers PROC EXPORT input Ptr:l local StrSize:w output Number:w BEGIN lda [Ptr] and #$ff beq noText dec a beq onedigit dec a beq twodigit dec a beq threedigit MoveWord #4,StrSize bra docall threedigit MoveWord #3,StrSize bra docall onedigit MoveWord #1,StrSize bra docall twodigit MoveWord #2,StrSize docall SpaceWord Addwls #1,Ptr PushWord StrSize PushWord #0 _Dec2Int PullWord Number bra exit noText sta Number exit RETURN ENDP ;*********************************************************************** ; ; S_RowNumberFromNumber ; ;*********************************************************************** S_RowNumberFromNumber PROC EXPORT input Number:w,Ptr:l local StrLength:w BEGIN lda Number cmp #10 bge notone MoveWord #1,StrLength MoveWord #1,[Ptr] brl docall notone cmp #100 bge nottwo MoveWord #2,StrLength MoveWord #2,[Ptr] bra docall nottwo cmp #1000 bge notthree MoveWord #3,StrLength MoveWord #3,[Ptr] bra docall notthree MoveWord #4,StrLength MoveWord #4,[Ptr] docall PushWord Number Addwls #1,Ptr PushWord StrLength PushWord #0 _Int2Dec RETURN ENDP ;*********************************************************************** ; ; S_ColLetterFromNumber(Number:w,ptr:l) ; ;*********************************************************************** S_ColLetterFromNumber PROC EXPORT input Number:w,Ptr:l local HighLetter:w,LowLetter:w BEGIN SpaceLong lda Number dec a pha PushWord #26 _UDivide PullWord HighLetter pla inc a sta LowLetter lda HighLetter beq oneletter clc adc #'@' short ldy #1 sta [Ptr],y lda LowLetter clc adc #'@' iny sta [Ptr],y lda #2 sta [Ptr] long bra exit oneletter MoveWord #1,[Ptr] lda LowLetter clc adc #'@' ldy #1 sta [Ptr],y exit RETURN ENDP ;************************************************************************ ; ; S_TitleFilter ; ;************************************************************************ S_TitleFilter PROC EXPORT ;Using S_DlogData input Dialog:l,Event:l,ItemPtr:l output Result:w BEGIN +b stz Result jsl D_HeartBeatIdle lda [Event] asl a tax jmp (EventTable,x) EventTable DC.W exit DC.W mouseDown DC.W exit DC.W keyDown DC.W exit DC.W keyDown DC.W exit DC.W exit DC.W exit mouseDown SpaceWord PushLong Dialog PushLong [Event]:#oWhere _FindDItem pla cmp #10 jlt exit sec sbc #10 sta S_WhichLE brl exit keyDown Cmpw [Event]:#oMessage,#$7f jeq exit cmp #ESC jeq doesc cmp #TAB jeq dotab cmp #' ' jlt exit ; See if it's a letter or digit lda S_WhichLE asl a tax jmp (leitemtable,x) leitemtable DC.W checknumber,checknumber,checkletter,checkletter checkletter MoveWord [Event]:#oMessage,a jsl D_IsLetter bcc letter MoveWord #0,[Event]:#oWhat brl exit letter MoveWord [Event]:#oMessage,a cmp #'a' jlt exit sec sbc #$20 sta [Event],y brl exit checknumber MoveWord [Event]:#oMessage,a jsl D_IsDigit jcc exit nogoaway MoveWord #0,[Event]:#oWhat brl exit doesc MoveWord #2,[ItemPtr] PushLong Dialog PushWord #2 jsl D_BlinkButton inc Result brl exit dotab inc S_WhichLE lda S_WhichLE cmp #4 jlt exit sec sbc #4 sta S_WhichLE exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_DlogData ; S_DlogData PROC EXPORT ;Using D_GlobalData EXPORT S_DirDlog EXPORT S_DirOK EXPORT S_DirCancel EXPORT S_DirText EXPORT S_DirStrPtr EXPORT S_RightRadio EXPORT S_RRStr EXPORT S_DownRadio EXPORT S_DRStr EXPORT S_CellDlog ; EXPORT S_CellText EXPORT S_CellStrPtr ; EXPORT S_CellLE EXPORT S_LEText EXPORT S_SortDlog EXPORT S_SortOK ; EXPORT S_SortCancel EXPORT S_AscRadio ; EXPORT S_DescRadio ; EXPORT S_RowColRadio ; EXPORT S_ColRowRadio ; EXPORT S_SortText ; EXPORT S_KeyText EXPORT S_SortCell EXPORT S_DefaultDlog EXPORT S_DefOK ; EXPORT S_DefCancel EXPORT S_ALeftRadio EXPORT S_ALeftVal ; EXPORT S_ACtrRadio EXPORT S_ACtrVal ; EXPORT S_ARightRadio EXPORT S_ARightVal EXPORT S_GenRadio EXPORT S_GenVal ; EXPORT S_FixedRadio EXPORT S_FixedVal ; EXPORT S_DollarRadio EXPORT S_DollarVal ; EXPORT S_PercentRadio EXPORT S_PercentVal ; EXPORT S_SciNotRadio EXPORT S_SciNotVal EXPORT S_BoldBox EXPORT S_BoldVal ; EXPORT S_UlineBox EXPORT S_UlineVal ; EXPORT S_CommaBox EXPORT S_CommaVal ; EXPORT S_RedNegBox EXPORT S_RedNegVal ; EXPORT S_ParenBox EXPORT S_ParenVal EXPORT S_OptText ; EXPORT S_AlText ; EXPORT S_StyText EXPORT S_OptRect ; EXPORT S_AlRect ; EXPORT S_StyRect ; EXPORT S_DecText EXPORT S_PlaceLE EXPORT S_PlaceStr EXPORT S_TitleDlog EXPORT S_TitleOK EXPORT S_TitleCancel EXPORT S_TitleBlurb EXPORT S_LeftBox EXPORT S_LeftBoxVal EXPORT S_TopBox EXPORT S_TopBoxVal EXPORT S_Column1Str EXPORT S_Column2Str EXPORT S_Row1Str EXPORT S_Row2Str EXPORT S_Column1Box EXPORT S_Column2Box EXPORT S_Row1Box EXPORT S_Row2Box EXPORT S_WidthDialog EXPORT S_WidthOK EXPORT S_WidthCancel EXPORT S_WidthThing EXPORT S_ThingRect EXPORT S_DefaultWidthBlurb ; EXPORT S_InThing EXPORT S_ListFunctionsDialog EXPORT S_AddButton EXPORT S_LFCloseButton EXPORT S_ListFuncBlurb EXPORT S_ListFuncBL EXPORT S_LFDialog EXPORT S_LFSize EXPORT S_DownStr EXPORT S_UpStr EXPORT S_LeftStr EXPORT S_RightStr EXPORT S_FillStr EXPORT S_DeleteStr EXPORT S_InsertStr EXPORT S_OKStr EXPORT S_MyFuckingCancelStr EXPORT S_KeyStr EXPORT S_SortStr EXPORT S_RowColStr EXPORT S_ColRowStr EXPORT S_AscStr EXPORT S_DescStr EXPORT S_GotoStr EXPORT S_MoveStr EXPORT S_BoldStr EXPORT S_ULineStr EXPORT S_CommaStr EXPORT S_RedNegStr EXPORT S_ParenNegStr EXPORT S_CtrStr EXPORT S_GenStr EXPORT S_FixedStr EXPORT S_DollarStr EXPORT S_PercentStr EXPORT S_SciNotStr EXPORT S_DisplayStr EXPORT S_FmtStr EXPORT S_AlStr EXPORT S_StyStr EXPORT S_TitleBlurbStr EXPORT S_LeftTitleStr EXPORT S_TopTitleStr EXPORT S_TitleCol1Str EXPORT S_ThruStr EXPORT S_TitleRow1Str EXPORT S_Column1ValStr EXPORT S_Column2ValStr EXPORT S_Row1ValStr EXPORT S_Row2ValStr EXPORT S_DefaultWidthStr EXPORT S_AddFuncStr EXPORT S_CloseFuncStr EXPORT S_ListFuncStr EXPORT S_WhichLE ;_________________________________ ; Direction Dialog ;_________________________________ S_DirDlog DC.W 48,185,112,462 DC.W 1 DC.L 0 DC.L S_DirOK,S_DirCancel,S_DirText DC.L S_DownRadio,S_RightRadio DC.L 0 S_DirOK DC.W 1 DC.W 45,155,58,230 DC.W buttonItem DC.L S_OKStr DC.W 0 DC.W 0 DC.L 0 S_DirCancel DC.W 2 DC.W 45,40,58,115 DC.W buttonItem DC.L S_MyFuckingCancelStr DC.W 0 DC.W 0 DC.L 0 S_DirText DC.W 3 DC.W 4,20,14,210 DC.W statText S_DirStrPtr DC.L 0 DC.W 0 DC.W 0 DC.L 0 S_RightRadio DC.W 5 DC.W 29,40,39,115 DC.W radioItem S_RRStr DC.L S_RightStr DC.W 0 DC.W 1 DC.L 0 S_DownRadio DC.W 7 DC.W 29,155,39,230 DC.W radioItem S_DRStr DC.L S_DownStr DC.W 1 DC.W 1 DC.L 0 ;_________________________________ ; Cell Dialog ;_________________________________ S_CellDlog DC.W 48,185,112,462 DC.W 1 DC.L 0 DC.L S_DirOK,S_DirCancel,S_CellText,S_CellLE DC.L 0 S_CellText DC.W 3 DC.W 16,40,29,140 DC.W statText S_CellStrPtr DC.L 0 DC.W 0 DC.W 0 DC.L 0 S_CellLE DC.W 4 DC.W 14,155,27,215 DC.W editLine DC.L S_LEText DC.W 6 ; 6 char LE width DC.W 0 DC.W 0 S_LEText DS.B 7 ;_________________________________ ; Sort Dialog ;_________________________________ S_SortDlog DC.W 40,155,130,510 DC.W 1 DC.L 0 DC.L S_SortOK,S_SortCancel,S_SortText DC.L S_AscRadio,S_DescRadio,S_RowColRadio,S_ColRowRadio DC.L S_SortCell,S_KeyText DC.L 0 S_SortOK DC.W 1 DC.W 69,187,82,262 DC.W buttonItem DC.L S_OKStr DC.W 0 DC.W 0 DC.L 0 S_SortCancel DC.W 2 DC.W 69,92,82,167 DC.W buttonItem DC.L S_MyFuckingCancelStr DC.W 0 DC.W 0 DC.L 0 S_AscRadio DC.W 3 DC.W 19,50,29,155 DC.W radioItem DC.L S_AscStr DC.W 1 DC.W 1 DC.L 0 S_DescRadio DC.W 4 DC.W 31,50,41,155 DC.W radioItem DC.L S_DescStr DC.W 0 DC.W 1 DC.L 0 S_RowColRadio DC.W 5 DC.W 19,185,29,330 DC.W radioItem DC.L S_RowColStr DC.W 1 DC.W 2 DC.L 0 S_ColRowRadio DC.W 6 DC.W 31,185,41,330 DC.W radioItem DC.L S_ColRowStr DC.W 0 DC.W 2 DC.L 0 S_SortText DC.W 7 DC.W 4,50,14,300 DC.W statText DC.L S_SortStr DC.W 0 DC.W 0 DC.L 0 S_KeyText DC.W 8 DC.W 52,117,62,167 DC.W statText DC.L S_KeyStr DC.W 0 DC.W 0 DC.L 0 S_SortCell DC.W 9 DC.W 50,177,63,237 DC.W editLine DC.L S_LEText DC.W 6 ; 6 char LE width DC.W 0 DC.W 0 ;_________________________________ ; Set Defaults Dialog ;_________________________________ S_DefaultDlog DC.W 20,85,150,562 DC.W 1 DC.L 0 DC.L S_DefOK,S_DefCancel DC.L S_ALeftRadio,S_ACtrRadio,S_ARightRadio DC.L S_GenRadio,S_FixedRadio,S_DollarRadio,S_PercentRadio,S_SciNotRadio DC.L S_BoldBox,S_UlineBox,S_CommaBox,S_RedNegBox,S_ParenBox DC.L S_OptText,S_AlText,S_StyText DC.L S_OptRect,S_AlRect,S_StyRect DC.L S_PlaceLE,S_DecText DC.L 0 S_DefOK DC.W 1 DC.W 108,375,121,450 DC.W buttonItem DC.L S_OKStr DC.W 0 DC.W 0 DC.L 0 S_DefCancel DC.W 2 DC.W 108,260,121,335 DC.W buttonItem DC.L S_MyFuckingCancelStr DC.W 0 DC.W 0 DC.L 0 S_ALeftRadio DC.W 3 DC.W 86,30,96,135 DC.W radioItem DC.L S_LeftStr S_ALeftVal DC.W 1 DC.W 1 DC.L 0 S_ACtrRadio DC.W 4 DC.W 96,30,106,135 DC.W radioItem DC.L S_CtrStr S_ACtrVal DC.W 0 DC.W 1 DC.L 0 S_ARightRadio DC.W 5 DC.W 106,30,116,135 DC.W radioItem DC.L S_RightStr S_ARightVal DC.W 0 DC.W 1 DC.L 0 S_GenRadio DC.W 6 DC.W 16,270,26,515 DC.W radioItem DC.L S_GenStr S_GenVal DC.W 1 DC.W 2 DC.L 0 S_FixedRadio DC.W 7 DC.W 26,270,36,515 DC.W radioItem DC.L S_FixedStr S_FixedVal DC.W 0 DC.W 2 DC.L 0 S_DollarRadio DC.W 8 DC.W 36,270,46,515 DC.W radioItem DC.L S_DollarStr S_DollarVal DC.W 0 DC.W 2 DC.L 0 S_PercentRadio DC.W 9 DC.W 46,270,56,515 DC.W radioItem DC.L S_PercentStr S_PercentVal DC.W 0 DC.W 2 DC.L 0 S_SciNotRadio DC.W 10 DC.W 56,270,66,515 DC.W radioItem DC.L S_SciNotStr S_SciNotVal DC.W 0 DC.W 2 DC.L 0 S_BoldBox DC.W 11 DC.W 16,30,26,135 DC.W checkItem DC.L S_BoldStr S_BoldVal DC.W 1 DC.B 0,0 DC.L 0 S_UlineBox DC.W 12 DC.W 26,30,36,135 DC.W checkItem DC.L S_ULineStr S_UlineVal DC.W 1 DC.B 0,0 DC.L 0 S_CommaBox DC.W 13 DC.W 36,30,46,135 DC.W checkItem DC.L S_CommaStr S_CommaVal DC.W 1 DC.B 0,0 DC.L 0 S_RedNegBox DC.W 14 DC.W 46,30,56,135 DC.W checkItem DC.L S_RedNegStr S_RedNegVal DC.W 1 DC.B 0,0 DC.L 0 S_ParenBox DC.W 15 DC.W 56,30,66,135 DC.W checkItem DC.L S_ParenNegStr S_ParenVal DC.W 1 DC.B 0,0 DC.L 0 S_OptText DC.W 16 DC.W 6,30,16,140 DC.W statText DC.L S_FmtStr DC.W 0 DC.W 0 DC.L 0 S_AlText DC.W 17 DC.W 76,30,86,111 DC.W statText DC.L S_AlStr DC.W 0 DC.W 0 DC.L 0 S_StyText DC.W 18 DC.W 6,270,16,370 DC.W statText DC.L S_StyStr DC.W 0 DC.W 0 DC.L 0 S_OptRect DC.W 19 DC.W 10,20,70,218 DC.W userItem+itemDisable DC.L S_DlogRect DC.W 0 DC.W 0 DC.L 0 S_AlRect DC.W 20 DC.W 81,20,121,218 DC.W userItem+itemDisable DC.L S_DlogRect DC.W 0 DC.W 0 DC.L 0 S_StyRect DC.W 21 DC.W 10,260,72,450 DC.W userItem+itemDisable DC.L S_DlogRect DC.W 0 DC.W 0 DC.L 0 S_DecText DC.W 22 DC.W 82,260,92,460 DC.W statText DC.L S_DisplayStr DC.W 0 DC.W 0 DC.L 0 S_PlaceLE DC.W 23 DC.W 80,317,93,337 DC.W editLine DC.L S_PlaceStr DC.W 1 ; 1 char LE width DC.W 0 DC.W 0 S_PlaceStr DS.B 2 ;****************************************************************** ; ; Titles dialog ; ;****************************************************************** S_TitleDlog DC.W 50,120,125,520 DC.W 1 DC.L 0 DC.L S_TitleOK DC.L S_TitleCancel DC.L S_TitleBlurb DC.L S_LeftBox DC.L S_TopBox DC.L S_Column1Str DC.L S_Column2Str DC.L S_Row1Str DC.L S_Row2Str DC.L S_Row1Box DC.L S_Column2Box DC.L S_Column1Box DC.L S_Row2Box DC.L 0 S_TitleOK DC.W 1 DC.W 55,240,70,350 DC.W ButtonItem DC.L S_OKStr DC.W 0 DC.W 0 DC.L 0 S_TitleCancel DC.W 2 DC.W 55,30,70,170 DC.W ButtonItem DC.L S_MyFuckingCancelStr DC.W 0 DC.W 0 DC.L 0 S_TitleBlurb DC.W 3 DC.W 5,30,18,150 DC.W StatText+ItemDisable DC.L S_TitleBlurbStr DC.W 0 DC.W 0 DC.L 0 S_LeftBox DC.W 4 DC.W 36,30,49,150 DC.W CheckItem DC.L S_LeftTitleStr S_LeftBoxVal DC.W 0 DC.W 0 DC.L 0 S_TopBox DC.W 5 DC.W 18,30,31,150 DC.W CheckItem DC.L S_TopTitleStr S_TopBoxVal DC.W 0 DC.W 0 DC.L 0 S_Column1Str DC.W 6 DC.W 38,170,50,238 DC.W StatText+ItemDisable DC.L S_TitleCol1Str DC.W 0 DC.W 0 DC.L 0 S_Column2Str DC.W 7 DC.W 39,270,51,338 DC.W StatText+ItemDisable DC.L S_ThruStr DC.W 0 DC.W 0 DC.L 0 S_Row1Str DC.W 8 DC.W 20,170,33,208 DC.W StatText+ItemDisable DC.L S_TitleRow1Str DC.W 0 DC.W 0 DC.L 0 S_Row2Str DC.W 9 DC.W 20,270,33,338 DC.W StatText+ItemDisable DC.L S_ThruStr DC.W 0 DC.W 0 DC.L 0 S_Column1Box DC.W 12 DC.W 36,240,49,268 DC.W EditLine+ItemDisable DC.L S_Column1ValStr DC.W 2 DC.W 0 DC.L 0 S_Column2Box DC.W 13 DC.W 36,342,49,370 DC.W EditLine+ItemDisable DC.L S_Column2ValStr DC.W 2 DC.W 0 DC.L 0 S_Row1Box DC.W 10 DC.W 18,228,31,268 DC.W EditLine+ItemDisable DC.L S_Row1ValStr DC.W 4 DC.W 0 DC.L 0 S_Row2Box DC.W 11 DC.W 18,338,31,378 DC.W EditLine+ItemDisable DC.L S_Row2ValStr DC.W 4 DC.W 0 DC.L 0 ;****************************************************************** ; ; WidthDialog ; ;****************************************************************** S_WidthDialog DC.W 60,320-(S_MaxCellWidth/2+20),125,320+(S_MaxCellWidth/2+20) DC.W 1 DC.L 0 DC.L S_WidthOK DC.L S_WidthCancel DC.L S_WidthThing DC.L S_DefaultWidthBlurb DC.L 0 S_WidthOK DC.W 1 DC.W 45,(S_MaxCellWidth+40)/2+20,58,(S_MaxCellWidth+40)/2+100 DC.W ButtonItem DC.L S_OKStr DC.W 0 DC.W 0 DC.L 0 S_WidthCancel DC.W 2 DC.W 45,(S_MaxCellWidth+40)/2-100,58,(S_MaxCellWidth+40)/2-20 DC.W ButtonItem DC.L S_MyFuckingCancelStr DC.W 0 DC.W 0 DC.L 0 S_WidthThing DC.W 3 S_ThingRect DC.W 20,20,20+S_ColLabelHeight,S_MaxCellWidth+20 DC.W UserItem+ItemDisable DC.L S_ThingDef DC.W 0 DC.W 0 DC.L 0 S_DefaultWidthBlurb DC.W 4 DC.W 5,20,15,370 DC.W StatText+ItemDisable DC.L S_DefaultWidthStr DC.W 0 DC.W 0 DC.L 0 ; S_InThing DS.B 2 ;********************************************************************** ; ; List Formula Dialog ; ;*********************************************************************** S_ListFunctionsDialog DC.W 50,170,151,470 DC.W 1 DC.L 0 DC.L S_ListFuncBlurb DC.L S_LFCloseButton DC.L S_AddButton DC.L 0 S_AddButton DC.W 1 DC.W 85,170,97,230 DC.W ButtonItem DC.L S_AddFuncStr DC.W 0 DC.W 0 DC.L 0 S_LFCloseButton DC.W 2 DC.W 85,70,97,130 DC.W ButtonItem DC.L S_CloseFuncStr DC.W 0 DC.W 0 DC.L 0 S_ListFuncBlurb DC.W 3 DC.W 5,20,17,200 DC.W StatText+ItemDisable DC.L S_ListFuncStr DC.W 0 DC.W 0 DC.L 0 S_ListFuncBL S_LFDialog DS.B 4 DC.W 20,20,82,258 DC.W 20,260,82,280 S_LFSize DS.B 2 DC.W 10 DC.W 1 DC.L S_DrawLFMember DC.L S_SelectLFMember DS.B 28 ;****************************************************************** ; ;Strings used in dialogs ; ;****************************************************************** S_DownStr STR 'Down' S_UpStr STR 'Up' S_LeftStr STR 'Left' S_RightStr STR 'Right' S_FillStr STR 'Fill in which direction?' S_DeleteStr STR 'Delete in which direction?' S_InsertStr STR 'Insert in which direction?' S_OKStr STR 'OK' S_MyFuckingCancelStr STR 'Cancel' S_KeyStr STR 'Key:' S_SortStr STR 'Sort using which method?' S_RowColStr STR 'Rows by column' S_ColRowStr STR 'Columns by row' S_AscStr STR 'Ascending' S_DescStr STR 'Descending' S_GotoStr STR 'Go to cell' S_MoveStr STR ' Move to' S_BoldStr STR 'Bold' S_ULineStr STR 'Underline' S_CommaStr STR 'Commas' S_RedNegStr STR 'Red negative numbers' S_ParenNegStr DC.B S_CtrStr-S_ParenNegStr-1 DC.B 'Parenthesize neg. #''s' S_CtrStr STR 'Center' S_GenStr STR 'General' S_FixedStr STR 'Fixed' S_DollarStr STR 'Dollars' S_PercentStr STR 'Percentage' S_SciNotStr STR 'Scientific notation' S_DisplayStr STR 'Display decimal place(s).' S_FmtStr STR ' Format Options' S_AlStr STR ' Alignment' S_StyStr STR ' Format Style' S_TitleBlurbStr STR 'Set title area:' S_LeftTitleStr STR ' Left titles' S_TopTitleStr STR ' Top titles' S_TitleCol1Str STR 'Columns:' S_ThruStr STR ' through ' S_TitleRow1Str STR 'Rows:' S_Column1ValStr DS.B 3 S_Column2ValStr DS.B 3 S_Row1ValStr DS.B 5 S_Row2ValStr DS.B 5 S_DefaultWidthStr STR 'Click in bar to set Default Column Width' S_AddFuncStr STR 'Add' S_CloseFuncStr STR 'Close' S_ListFuncStr STR 'Select function to add:' S_WhichLE DS.B 2 ENDP ;-------------------------------------------------------------------------- ; S_DoDefaultWidthDlog ; ; The pixel width is used at the New default column width unless the carry ; is set. (i.e. set the carry if 'CANCEL' is selected.) S_DoDefaultWidthDlog PROC EXPORT ;Using S_DlogData input StartWidth:w local Dialog:l output NewWidth:w error err BEGIN +b stz err SpaceLong PushLong #S_WidthDialog call D_GetNewModalDialog PullLong Dialog PushWord StartWidth PushLong Dialog PushWord S_WidthThing _SetDItemValue dloop SpaceWord PushLong #S_WidthFilter+$80000000 _ModalDialog pla cmp #2 beq docancel cmp #1 beq dook bra dloop dook SpaceWord PushLong Dialog PushWord #3 _GetDItemValue PullWord NewWidth bra exit docancel inc err exit PushLong Dialog call D_CloseDialog RETURN ENDP ;*************************************************************** ; ; S_ThingDef - WidthThing definition procedure ; ;*************************************************************** S_ThingDef PROC EXPORT ;Using S_DlogData input Dialog:l,ItemID:w local Value:w,Pixels:w,Point:l BEGIN +b MoveRect S_ThingRect,ScratchRect SpaceWord PushLong Dialog PushWord ItemId _GetDItemValue PullWord Value clc adc #20 sta Pixels MoveWord Pixels,ScratchRect+6 PushWord #LightYellow jsl D_Set4Pat PushLong #ScratchRect _PaintRect PushWord #Black jsl D_Set4Pat _PenNormal PushWord #2 PushWord #1 _SetPenSize MoveWord S_ThingRect,Point MoveWord Pixels,Point+2 PushLong Point _MoveTo PushWord #0 PushWord #S_ColLabelHeight-1 _Line _PenNormal MoveWord Point,ScratchRect AddWord Point+2,#2,ScratchRect+2 AddWord Point,#S_ColLabelHeight,ScratchRect+4 MoveWord S_ThingRect+6,ScratchRect+6 PushLong #S_BackPat2 _SetPenPat PushLong #ScratchRect _PaintRect _PenNormal MoveRect S_ThingRect,ScratchRect PushLong #ScratchRect _FrameRect RETURN ScratchRect DS.B 8 S_BackPat2 DC.W $F3F3,$3F3F,$F3F3,$3F3F DC.W $F3F3,$3F3F,$F3F3,$3F3F DC.W $F3F3,$3F3F,$F3F3,$3F3F DC.W $F3F3,$3F3F,$F3F3,$3F3F ENDP ;*************************************************************** ; ; S_WidthFilter - Filter to take care of the width thing ; ;*************************************************************** S_WidthFilter PROC EXPORT ;Using S_DlogData input Dialog:l,EventPtr:l,ItemPtr:l local LocPoint:l,Value:w,Pixels:w output Result:w BEGIN +b jsl D_HeartBeatIdle stz Result MoveWord [EventPtr]:#oWhat,a cmp #MouseDownEvt jne Exit ; Mouse down event ; MoveLong [EventPtr]:#oWhere,LocPoint PushLong !LocPoint _GlobalToLocal SpaceWord PushLong !LocPoint PushLong #S_ThingRect _PtInRect pla beq Exit SpaceWord PushLong Dialog PushWord S_WidthThing _GetDItemValue PullWord Value clc adc #20 sta Pixels SpaceWord PushWord Pixels PushWord #S_MinCellWidth+20 PushWord #S_MaxCellWidth+20 PushWord S_WidthThing+2 SubWord S_WidthThing+6,#1,s Call S_TrackVertLine,in=(:w,:w,:w,:w,:w) ; out = :w SubWord 1:s,#20,1:s PushLong Dialog PushWord S_WidthThing _SetDItemValue inc Result Exit RETURN ENDP ;*************************************************************** ; ; List formulas dialog ; ;************************************************************** S_ListFormulasDlog PROC EXPORT ;Using S_DlogData ;Using S_CurrentData2 local Item:w,FunctionNo:w,FuncStr:l,StrSize:w BEGIN +b Call S_CopyIn,in=(#S_CurrentData2:l) SpaceLong PushLong #S_ListFunctionsDialog call D_GetNewModalDialog PullLong S_LFDialog SpaceWord jsl E_GetNFuncs PullWord S_LFSize PushLong #S_ListFuncBL jsl D_BLMakeList Call D_BLSelect,in=(#S_ListFuncBL:l,#0:w) dloop SpaceWord PushLong #S_LFFilter+$80000000 jsl D_BLModalDialog PullWord Item cmp #2 jeq exit cmp #1 bne dloop lda S_Cur2EditFlag and #S_EditingBit bne addFunc lda S_Cur2EditFlag ora #S_EditingBit sta S_Cur2EditFlag Tool _LEActivate,in=(S_Cur2LEHandle:l) Tool _LEGetTextLen,in=(S_Cur2LEHandle:l),out=(x:w) Tool _LESetSelect,in=(#0:w,x:w,S_Cur2LEHandle:l) Tool _LEKey,in=(#$3D:w,#0:w,S_Cur2LEHandle:l) Call S_SetEdittingMenus addFunc SpaceWord PushLong #S_ListFuncBL jsl D_BLGetSel PullWord FunctionNo SpaceLong PushWord FunctionNo jsl E_GetFuncName PullLong FuncStr lda [FuncStr] and #$ff sta StrSize PushLong S_Cur2LEHandle _LEDelete Addwls #1,FuncStr PushWord StrSize PushLong S_Cur2LEHandle _LEInsert brl dloop exit jsl D_BLForgetLists PushLong S_LFDialog call D_CloseDialog Call S_CopyOut,in=(#S_CurrentData2:l) RETURN ENDP ;-------------------------------------------------------------------- S_LFFilter PROC EXPORT ;Using S_DlogData ;Using S_CurrentData2 input Dialog:l,EventPtr:l,ItemPtr:l output Result:w BEGIN +b stz result Cmpw [EventPtr]:#oWhat,#KeyDownEvt jeq dokey cmp #AutoKeyEvt jne notthisfilter dokey MoveWord [EventPtr]:#oMessage,a cmp #ESC jeq notthisfilter cmp #CR jeq notthisfilter sta theChar lda S_Cur2EditFlag and #S_EditingBit bne addChar lda S_Cur2EditFlag ora #S_EditingBit sta S_Cur2EditFlag Tool _LEActivate,in=(S_Cur2LEHandle:l) Tool _LEGetTextLen,in=(S_Cur2LEHandle:l),out=(x:w) Tool _LESetSelect,in=(#0:w,x:w,S_Cur2LEHandle:l) Call S_SetEdittingMenus addChar PushWord theChar PushWord [EventPtr]:#oModifiers PushLong S_Cur2LEHandle _LEKey bra exit notthisfilter SpaceWord PushLong Dialog PushLong EventPtr PushLong ItemPtr jsl D_EscFilter PullWord Result exit RETURN theChar DS.B 2 ENDP ;-------------------------------------------------------------------- S_DrawLFMember PROC EXPORT input ListRecPtr:l,ItemNo:w local String:l BEGIN SpaceLong PushWord ItemNo jsl E_GetFuncName PullLong String PushWord #2 PushWord #8 _Move PushLong String _DrawString RETURN ENDP ;-------------------------------------------------------------------- S_SelectLFMember PROC EXPORT ;Using S_DlogData input ListPtr:l,Item:w BEGIN +b Cmpw Item,#-1 bne activebutton lda LFBActiveFlag jeq exit SpaceLong PushLong S_LFDialog PushWord S_AddButton _GetControlDItem plx ply PushWord #255 phy phx _HiliteControl stz LFBActiveFlag bra exit activebutton lda LFBActiveFlag bne exit SpaceLong PushLong S_LFDialog PushWord S_AddButton _GetControlDItem plx ply PushWord #0 phy phx _HiliteControl inc LFBActiveFlag exit RETURN LFBActiveFlag DS.B 2 ENDP ;--------------------------------------------------------------------------- ; ; S_DoDefaultDlog ; S_DoDefaultDlog PROC EXPORT ;Using S_DlogData input oldformat:l output newformat:l local TheDlog:l,result:w,CtlHdl:l local bold:w,uline:w,comma:w,redneg:w,paren:w local left:w,ctr:w,right:w local gen:w,fixed:w,dollar:w,percent:w,scinot:w local decimals:w BEGIN +b movelong oldformat,newformat lda oldformat+2 and #S_CellDecPlace addword a,#$30,a xba ora #1 sta S_PlaceStr lda oldformat and #S_CellPercent jsr MakeBool sta S_PercentVal lda oldformat and #S_CellDollar jsr MakeBool sta S_DollarVal lda oldformat and #S_CellSciNote jsr MakeBool sta S_SciNotVal lda oldformat and #S_CellFixed jsr MakeBool sta S_FixedVal ora S_SciNotVal ora S_DollarVal ora S_PercentVal eor #1 sta S_GenVal lda oldformat and #S_CellBold jsr MakeBool sta S_BoldVal lda oldformat and #S_CellULine jsr MakeBool sta S_UlineVal lda oldformat and #S_CellComma jsr MakeBool sta S_CommaVal lda oldformat and #S_CellRedNeg jsr MakeBool sta S_RedNegVal lda oldformat and #S_CellParenNeg jsr MakeBool sta S_ParenVal stz S_ALeftVal stz S_ACtrVal stz S_ARightVal lda oldformat and #S_CellJustify cmp #S_CellLeftJustify beq DoLeft cmp #S_CellRightJustify beq DoRight DoCtr inc S_ACtrVal bra DidJust DoLeft inc S_ALeftVal bra DidJust DoRight inc S_ARightVal DidJust DoDlog call D_GetNewModalDialog,in=(#S_DefaultDlog:l),out=(TheDlog:l) DlogLoop tool _ModalDialog,in=(#D_DigitsOnly+$80000000:l),out=(result:w) beq DlogLoop cmp #3 blt Done cmp #11 blt DoRadio cmp #16 bge DlogLoop DoBox tool _GetControlDItem,in=(TheDlog:l,result:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(a:w) eor #1 tool _SetCtlValue,in=(a:w,CtlHdl:l) bra DlogLoop DoRadio tool _GetControlDItem,in=(TheDlog:l,result:w),out=(CtlHdl:l) tool _SetCtlValue,in=(#1:w,CtlHdl:l) brl DlogLoop Done cmpw result,#Cancel jeq DoClose stzl newformat tool _GetControlDItem,in=(TheDlog:l,#3:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(left:w) tool _GetControlDItem,in=(TheDlog:l,#4:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(ctr:w) tool _GetControlDItem,in=(TheDlog:l,#5:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(right:w) tool _GetControlDItem,in=(TheDlog:l,#6:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(gen:w) tool _GetControlDItem,in=(TheDlog:l,#7:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(fixed:w) tool _GetControlDItem,in=(TheDlog:l,#8:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(dollar:w) tool _GetControlDItem,in=(TheDlog:l,#9:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(percent:w) tool _GetControlDItem,in=(TheDlog:l,#10:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(scinot:w) tool _GetControlDItem,in=(TheDlog:l,#11:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(bold:w) tool _GetControlDItem,in=(TheDlog:l,#12:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(uline:w) tool _GetControlDItem,in=(TheDlog:l,#13:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(comma:w) tool _GetControlDItem,in=(TheDlog:l,#14:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(redneg:w) tool _GetControlDItem,in=(TheDlog:l,#15:w),out=(CtlHdl:l) tool _GetCtlValue,in=(CtlHdl:l),out=(paren:w) ; Decimal places tool _GetIText,in=(TheDlog:l,#23:w,!decimals:l) lda decimals and #$00FF beq setPlaces ; a = 0 on branch lda decimals+1 and #$000F setPlaces ora newformat+2 sta newformat+2 lda bold beq TryUline lda #S_CellBold ora newformat sta newformat TryUline lda uline beq TryCommas lda #S_CellUline ora newformat sta newformat Trycommas lda comma beq TryRed lda #S_CellComma ora newformat sta newformat TryRed lda redneg beq TryParen lda #S_CellRedNeg ora newformat sta newformat TryParen lda paren beq DidBoxes lda #S_CellParenNeg ora newformat sta newformat DidBoxes lda gen beq TryFixed lda #0 bra DidRadio TryFixed lda fixed beq TryDollar lda #S_CellFixed bra DidRadio TryDollar lda dollar beq TryPercent lda #S_CellDollar bra DidRadio TryPercent lda percent beq TrySciNot lda #S_CellPercent bra DidRadio TrySciNot lda scinot beq DidRadio lda #S_CellSciNote DidRadio ora newformat sta newformat lda right beq TryCtr lda #S_CellRightJustify bra DidRadio2 TryCtr lda ctr beq ItsLeft lda #S_CellCenterJustify bra DidRadio2 ItsLeft lda #S_CellLeftJustify DidRadio2 ora newformat sta newformat DoClose call D_CloseDialog,in=(TheDlog:l) exit RETURN MakeBool beq GotBool lda #1 GotBool rts ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Draw.aii b/appleworksgs/SS/Src/Draw.aii new file mode 100755 index 0000000..8bae922 --- /dev/null +++ b/appleworksgs/SS/Src/Draw.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_FastMult IMPORT D_Set4Pat IMPORT D_DrawText IMPORT D_DrawString IMPORT X_FormatValue IMPORT S_Cell2Str IMPORT S_CellWidth IMPORT S_ClipHandle IMPORT S_ColLab2Text IMPORT S_ColLabRect IMPORT S_CurBRSelect IMPORT S_CurBRTitle IMPORT S_CurContHt IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurEditFlag IMPORT S_CurPrinting IMPORT S_CurTLCell IMPORT S_CurTLSelect IMPORT S_CurTLTitle IMPORT S_DashMask IMPORT S_GetCellPtr IMPORT S_NormalMask IMPORT S_RowLabRect IMPORT S_WhereCell IMPORT S_WhichCell ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_BackPat ENTRY S_DrawRegion ENTRY S_FindLeftContent ENTRY S_FindRightContent ;---------------------------------------------------------------------------- ; S_DrawBorders (OffRight:w,OffBottom:w,Xpt:w,Ypt:w) ; S_DrawBorders PROC EXPORT input OffRight:w,OffBottom:w,Xpt:w,Ypt:w local Rect:r BEGIN lda OffRight beq chkBottom Tool _SetPenPat,in=(#S_BackPat:l) MoveWord #S_EditHeight+2,Rect MoveWord Xpt,Rect+2 AddWord Ypt,#S_RowHeight,Rect+4 AddWord Xpt,#S_MaxCellWidth,Rect+6 Tool _PaintRect,in=(!Rect:l) Tool _SetPenPat,in=(#S_NormalPat:l) Tool _MoveTo,in=(Xpt:w,#S_EditHeight+2:w) Tool _LineTo,in=(Xpt:w,Ypt:w) inc Xpt inc Xpt Tool _MoveTo,in=(Xpt:w,#S_EditHeight+2:w) Tool _LineTo,in=(Xpt:w,Ypt:w) chkBottom lda OffBottom beq Exit Tool _SetPenPat,in=(#S_BackPat:l) MoveWord Ypt,Rect MoveWord #0,Rect+2 AddWord Ypt,#S_RowHeight,Rect+4 AddWord Xpt,#S_MaxCellWidth,Rect+6 Tool _PaintRect,in=(!Rect:l) Tool _SetPenPat,in=(#S_NormalPat:l) Tool _MoveTo,in=(#0:w,Ypt:w) Tool _LineTo,in=(Xpt:w,Ypt:w) inc Ypt Tool _MoveTo,in=(#0:w,Ypt:w) Tool _LineTo,in=(Xpt:w,Ypt:w) Exit RETURN EXPORT S_BackPat S_BackPat DC.W $F3F3,$3F3F,$F3F3,$3F3F DC.W $F3F3,$3F3F,$F3F3,$3F3F DC.W $F3F3,$3F3F,$F3F3,$3F3F DC.W $F3F3,$3F3F,$F3F3,$3F3F S_NormalPat DC.W 0,0,0,0 DC.W 0,0,0,0 DC.W 0,0,0,0 DC.W 0,0,0,0 ENDP ;------------------------------------------------------------------------------ ; S_DrawCell(Cell:l,Xpt:w,Ypt:w) ; ; This routine will draw the given cell's value at the given x,y ; coordinates, and bounded by the given width. It clips to appropriate ; rectangle. S_DrawCell PROC EXPORT ;Using S_CurrentData ;Using D_GlobalData input Cell:l,Xpt:w,Ypt:w local CellPtr:l,StringPtr:l local Format:l,Rect:r,ChkPtr:l local Offset:w,ContCell:l,Color:w local ClipRight:w,ClipLeft:w,Justify:w error ErrorFlag BEGIN stz ErrorFlag stz Offset in Cell:l out CellPtr:l XCall S_GetCellPtr ora CellPtr jeq Quit ; Cell exists ; MoveWord #1,ClipRight sta ClipLeft MoveLong Cell,ContCell MoveLong [CellPtr]:#S_CellFormat,Format lda Format and #S_CellType cmp #S_CellTypeEmpty jeq Quit Tool _GetTextFace,out=(:w) ; leave on stack for 'Exit' ; Is it an overlap cell ; lda Format and #S_CellType jmi doOverlap lda Format and #S_CellBold beq textFaceSet lda 1,s ora #$01 ; set bold bit on Tool _SetTextFace,in=(a:w) textFaceSet lda Format and #S_CellTypeValue ; either constant or function bne doNumber ; Cell is of type Text ; lda S_CurEditFlag and #S_ViewFormulaBit beq doText lda Format and #S_CellTypeTextForm bne doFormula doText lda Format+2 and #S_CellCircular jne circularCell jsr ClrLeft jsr ClrRight jsr SetText jsr DrawString brl Exit doFormula MoveWord #4,Offset H_GetBlockPtr [CellPtr]:#S_CellContent,StringPtr in Cell:l,StringPtr:l out StringPtr:l XCall E_ExpandFormula jsr DrawString brl Exit doNumber lda S_CurEditFlag and #S_ViewFormulaBit beq doValue lda Format and #S_CellTypeTextForm bne doFormula doValue lda Format+2 and #S_CellCircular beq notCirc2 circularCell MoveWord #DarkRed,Color MoveLong #CircStr,StringPtr PushWord #40 bra drawNumber notCirc2 SpaceWord ; string length SpaceLong ; string ptr SpaceWord ; color Call S_CellWidth,in=(Cell+2:w),out=(:w) PushLong Format AddLong CellPtr,#S_CellValue,s Call X_FormatValue ;in=(:w,:l,:l),out=(:w,:l,:w) bcc OKvalue lda 9,s and #$FFFE ; turn any bold off. Tool _SetTextFace,in=(a:w) OKvalue PullWord Color PullLong StringPtr drawNumber lda Color pha xba ora 1,s sta 1,s asl a asl a asl a asl a ora 1,s sta 1,s Tool _SetForeColor,in=(:w) Call S_CellWidth,in=(Cell+2:w),out=(a:w) SubWord a,s,Offset jsr DrawString Tool _SetForeColor,in=(#0:w) brl Exit doOverlap cmp #S_CellTypeLeftPad beq fromRight in Cell:l out ContCell:l,Offset:w XCall S_FindLeftContent stz ClipLeft jsr ClrRight bra overCont fromRight in Cell:l out ContCell:l,Offset:w XCall S_FindRightContent stz ClipRight jsr ClrLeft overCont in ContCell:l out CellPtr:l XCall S_GetCellPtr MoveLong [CellPtr]:#S_CellFormat,Format lda Format and #S_CellBold beq textFaceSet2 lda 1,s ora #$01 ; set bold bit on Tool _SetTextFace,in=(a:w) textFaceSet2 jsr SetText jsr DrawString Exit jsr DrawUnder Tool _SetTextFace,in=(:w) Quit RETURN ;---------------------- CircStr str 'Circ.' ;---------------------- SetText H_GetBlockPtr [CellPtr]:#S_CellValue,StringPtr lda Format and #S_CellJustify sta Justify beq LeftJust ; Get String width for right and center justified text ; Tool _StringWidth,in=(StringPtr:l),out=(:w) ; Calculate relative position to start text from front of cell ; Call S_CellWidth,in=(ContCell+2:w),out=(a:w) SubWord a,s,a ; If Right justified, this is all ; ldx Justify cpx #S_CellCenterJustify bne justified ; If Center justified, there's more to do ; CenterJust tay bmi setC ; If current value is positive, zero must be in top bit after ; divide. clc bra divide ; If current value is negative, one must be in top bit after ; divide. setC sec divide ; Since we are centering around 1/2 of cell width, and the present ; value is (cell width - string width), dividing by 2 gives us ; (cell width)/2 - (string width)/2, which is what we want. ror a bra justified LeftJust lda #4 justified AddWord a,Offset,Offset rts ;---------------------- ClrRight lda Cell+2 inc a tax cmp #$02BF bge srDone in x:w,Cell:w out ChkPtr:l XCall S_GetCellPtr ora ChkPtr beq srDone MoveWord [ChkPtr]:#S_CellFormat,a bpl srDone and #S_CellType cmp #S_CellTypeRightPad bne srDone clrClipR stz ClipRight srDone rts ;---------------------- ClrLeft lda Cell+2 inc a tax cmp #10000 blt slDone in x:w,Cell:w out ChkPtr:l XCall S_GetCellPtr ora ChkPtr beq slDone MoveWord [ChkPtr]:#S_CellFormat,a bpl slDone and #S_CellType cmp #S_CellTypeLeftPad bne slDone clrClipL stz ClipLeft slDone rts ;---------------------- DrawString lda Ypt inc a sta Rect AddWord a,#S_TextOffset,Rect+4 Moveword Xpt,Rect+2 pha Call S_CellWidth,in=(Cell+2:w),out=(a:w) AddWord a,s,a inc a inc a sta Rect+6 lda ClipRight beq chkClipLeft dec Rect+6 dec Rect+6 chkClipLeft lda ClipLeft beq contDraw inc Rect+2 inc Rect+2 contDraw Tool _ClipRect,in=(!Rect:l) Tool _GetClipHandle,out=(:l) PushLong S_ClipHandle PushLong 5:s Tool _SectRgn,in=(:l,:l,:l) ; LaserWriter hack-around --- GS/OS laserwriter driver doesn't do ; EraseRect correctly. ; Tool _EraseRect,in=(!Rect:l) Call D_Set4Pat,in=(#White:w) Tool _PaintRect,in=(!Rect:l) Call D_Set4Pat,in=(#Black:w) AddWord Xpt,Offset,s lda Rect+4 dec a pha Tool _MoveTo,in=(:w,:w) call D_DrawString,in=(StringPtr:l) rts ;---------------------- DrawUnder lda Format and #S_CellULine beq DidUnder Tool _SetClip,in=(S_ClipHandle:l) ; AddWord Xpt,#2,s PushWord Xpt ; this hangs off both ends AddWord Ypt,#S_RowHeight,s _MoveTo Call S_CellWidth,in=(Cell+2:w),out=(:w) ; SubWord 1:s,#2,1:s ; pen is 2 pixels wide Tool _Line,in=(:w,#0:w) DidUnder rts ENDP ;----------------------------------------------------------------------------- ; S_DrawColLabels(Xpt:w,FCol:w,LCol:w) ; ; This routine draws the column labels in the given range starting at the ; given x coordinate (y = constant). S_DrawColLabels PROC EXPORT ;Using S_CurrentData input Xpt:w,FCol:w,LCol:w local Wcnt:w,Length:w,TextWd:w local Rect:r BEGIN ; Calculate the total length of the New labels ; MoveWord Xpt,Length MoveWord FCol,Wcnt bra AddWidth loop4 inc a sta Wcnt AddWidth Call S_CellWidth,in=(a:w),out=(a:w) AddWord a,Length,Length CmpWord Wcnt,LCol bne loop4 ; Paint the background light yellow ; lengthKnown Call D_Set4Pat,in=(#LightYellow:w) MoveWord S_ColLabRect,Rect MoveWord Xpt,Rect+2 MoveWord S_ColLabRect+4,Rect+4 MoveWord Length,Rect+6 Tool _PaintRect,in=(!Rect:l) Call D_Set4Pat,in=(#Black:w) ; Frame the New area ; Tool _MoveTo,in=(Xpt:w,#S_EditHeight+S_ColLabelHeight:w) Tool _LineTo,in=(Length:w,#S_EditHeight+S_ColLabelHeight:w) Tool _MoveTo,in=(Length:w,#S_EditHeight:w) Tool _LineTo,in=(Length:w,#S_EditHeight+S_ColLabelHeight:w) ; Draw the labels centered in the columns, with dividers ; MoveWord FCol,Wcnt lda LCol Call S_ColLab2Text sta LCol lda FCol Call S_ColLab2Text sta Buffer loop Tool _MoveTo,in=(Xpt:w,#S_EditHeight:w) Tool _LineTo,in=(Xpt:w,#S_EditHeight+S_ColLabelHeight:w) ; Draw label ; Tool _TextWidth,in=(#Buffer:l,#2:w),out=(TextWd:w) Call S_CellWidth,in=(Wcnt:w),out=(x:w) SubWord x,TextWd,a lsr a AddWord a,Xpt,s AddWord x,Xpt,Xpt Tool _MoveTo,in=(:w,#S_EditHeight+S_TextOffset+1:w) Call D_DrawText,in=(#Buffer:l,#2:w) ; Increment label by one ; skip CmpWord Buffer,LCol beq done inc Wcnt AddWord #$0100,Buffer,Buffer and #$FF00 cmp #$5B00 ; hex for 'Z' + 1 jlt loop lda Buffer and #$001F ora #$4140 ; keep most sig letter inc a sta Buffer brl loop done RETURN Buffer DS.B 2 ENDP ;----------------------------------------------------------------------------- ; S_DrawGrid(X2:w,Y2:w,X1:w,Y1:w,LCol:w) ; ; This routine will draw the grid in the content area of the spreadsheet ; starting at the x1,y1 cordinates and drawing to the x2,y2 ; coordinates. S_DrawGrid PROC EXPORT ;Using S_CurrentData ;Using S_ConstantData input X2:w,Y2:w,X1:w,Y1:w,LCol:w local Count:w,Wcnt:w BEGIN lda S_CurEditFlag and #S_GridOff jne Exit lda S_CurPrinting bne maskSet Tool _SetPenMask,in=(#S_DashMask:l) maskSet ; Draw the horizontal lines ; MoveWord Y1,Count loop3 Tool _MoveTo,in=(X1:w,Count:w) Tool _LineTo,in=(X2:w,Count:w) step3 AddWord #S_RowHeight,Count,Count CmpWord Y2,Count bge loop3 ; Draw the vertical lines ; MoveWord LCol,Wcnt MoveWord X1,Count loop4 Tool _MoveTo,in=(Count:w,Y1:w) Tool _LineTo,in=(Count:w,Y2:w) step4 Call S_CellWidth,in=(Wcnt:w),out=(a:w) AddWord a,Count,Count inc Wcnt CmpWord X2,Count bge loop4 Tool _SetPenMask,in=(#S_NormalMask:l) Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_DrawRowLabels(Ypt:w,FRow:w,LRow:w) ; ; This routine draws the row labels in the given range starting at the given ; y coordinate. (x = constant). S_DrawRowLabels PROC EXPORT ;Using S_CurrentData input Ypt:w,FRow:w,LRow:w local Rect:r BEGIN ; Calculate the total length of the New labels ; SubWord LRow,FRow,a inc a tax ldy #S_RowHeight Call D_FastMult AddWord a,Ypt,Rect+4 ; Paint the background light yellow ; Call D_Set4Pat,in=(#LightYellow:w) MoveWord Ypt,Rect MoveWord S_RowLabRect+2,Rect+2 MoveWord S_RowLabRect+6,Rect+6 Tool _PaintRect,in=(!Rect:l) Call D_Set4Pat,in=(#Black:w) ; Frame the New area ; Tool _MoveTo,in=(#S_NumLabelWidth:w,Ypt:w) Tool _LineTo,in=(#S_NumLabelWidth:w,Rect+4:w) Tool _MoveTo,in=(#0:w,Rect+4:w) Tool _LineTo,in=(#S_NumLabelWidth:w,Rect+4:w) ; Draw the labels with dividers ; loop Tool _MoveTo,in=(#0:w,Ypt:w) Tool _LineTo,in=(#S_NumLabelWidth:w,Ypt:w) Tool _Int2Dec,in=(FRow:w,#Buffer:l,#4:w,#0:w) in #S_NumLabOffSet-S_NumLabelWidth:w,#S_TextOffset:w XTool _Move Call D_DrawText,in=(#Buffer:l,#4:w) inc FRow AddWord Ypt,#S_RowHeight,Ypt CmpWord LRow,FRow bge loop RETURN Buffer DS.B 4 ENDP ;--------------------------------------------------------------------------- ; S_HiliteCells ; S_HiliteCells PROC EXPORT ;Using S_CurrentData local Rect:r BEGIN in S_CurTLSelect:l out a:w,a:w,Rect:l XCall S_WhereCell in S_CurBRSelect:l out Rect+4:l,a:w,a:w XCall S_WhereCell lda Rect bne cont1 MoveWord S_CurContYpt,Rect bra chk2 cont1 cmp S_CurContHt bge Exit chk2 lda Rect+2 bne cont2 MoveWord S_CurContXpt,Rect+2 bra chk3 cont2 cmp S_CurContWd bge Exit chk3 inc Rect inc Rect+2 inc Rect+2 lda Rect+4 beq Exit inc a cmp S_CurContHt blt cont3 lda S_CurContHt cont3 sta Rect+4 chk4 lda Rect+6 beq Exit inc a inc a cmp S_CurContWd blt cont4 lda S_CurContWd cont4 sta Rect+6 CmpWord Rect,Rect+4 bge Exit CmpWord Rect+2,Rect+6 bge Exit Tool _InvertRect,in=(!Rect:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_FindLeftContent( CurCell:l ): ContCell:l,Offset:w ; ; S_FindLeftContent PROC EXPORT ;Using S_CurrentData input CurCell:l output ContCell:l,Offset:w local CellPtr:l BEGIN stz Offset overlapLoop dec CurCell+2 Call S_CellWidth,in=(CurCell+2:w),out=(:w) SubWord Offset,s,Offset in CurCell:l out CellPtr:l XCall S_GetCellPtr MoveWord [CellPtr]:#S_CellFormat,a bmi overlapLoop MoveLong CurCell,ContCell RETURN ENDP ;--------------------------------------------------------------------------- ; S_FindRightContent( CurCell:l ): ContCell:l,Offset:w ; ; It may be the first cell. S_FindRightContent PROC EXPORT ;Using S_CurrentData input CurCell:l output ContCell:l,Offset:w local CellPtr:l BEGIN stz Offset overlapLoop Call S_CellWidth,in=(CurCell+2:w),out=(a:w) AddWord a,Offset,Offset inc CurCell+2 in CurCell:l out CellPtr:l XCall S_GetCellPtr MoveWord [CellPtr]:#S_CellFormat,a bmi overlapLoop MoveLong CurCell,ContCell RETURN ENDP ;-------------------------------------------------------------------------- ; ; S_DrawLocation PROC EXPORT ;Using S_CurrentData local StrPtr:l,TextWd:w BEGIN Tool _EraseRect,in=(#LocRect:l) CmpLong S_CurTLSelect,S_CurBRSelect bne doRangeStr MoveLong #Buffer,StrPtr Call S_Cell2Str,in=(#Buffer:l,S_CurTLSelect:l) bra doDraw doRangeStr MoveLong #RangeStr,StrPtr doDraw Tool _StringWidth,in=(StrPtr:l),out=(TextWd:w) SubWord #S_NumLabelWidth,TextWd,a lsr a Tool _MoveTo,in=(a:w,#S_EditHeight+S_TextOffset+1:w) Call D_DrawString,in=(StrPtr:l) RETURN LocRect DC.W S_EditHeight+2,0 DC.W S_EditHeight+S_ColLabelHeight,S_NumLabelWidth RangeStr str 'Range' Buffer DS.B 7 ENDP ;-------------------------------------------------------------------------- ; ; S_DrawBothTitles PROC EXPORT ;Using S_CurrentData local DoDrawRegion:w BEGIN stz DoDrawRegion Call S_DrawLocation CmpWord S_CurContXpt,#S_NumLabelWidth beq chkRowLabels inc DoDrawRegion in #S_NumLabelWidth:w in S_CurTLTitle+2:w,S_CurBRTitle+2:w ; only cols XCall S_DrawColLabels chkRowLabels CmpWord S_CurContYpt,#S_EditHeight+S_ColLabelHeight beq Exit in #S_EditHeight+S_ColLabelHeight:w in S_CurTLTitle:w,S_CurBRTitle:w ; only rows XCall S_DrawRowLabels lda DoDrawRegion beq Exit in S_CurContXpt:w,S_CurContYpt:w in #S_NumLabelWidth:w,#S_EditHeight+S_ColLabelHeight:w in S_CurTLTitle:l,S_CurBRTitle:l,#0:w in #S_NumLabelWidth:w XCall S_DrawRegion in S_CurContXpt:w,#S_EditHeight+S_ColLabelHeight:w XTool _MoveTo Tool _LineTo,in=(S_CurContXpt:w,S_CurContYpt:w) Tool _MoveTo,in=(#S_NumLabelWidth:w,S_CurContYpt:w) Tool _LineTo,in=(S_CurContXpt:w,S_CurContYpt:w) Exit RETURN ENDP ;-------------------------------------------------------------------------- ; ; S_DrawColTitles PROC EXPORT ;Using S_CurrentData input Xpt:w,FCol:w,LCol:w local Xpt2:w BEGIN CmpWord S_CurContYpt,#S_EditHeight+S_ColLabelHeight beq Exit in LCol:w,S_CurTLCell:w out Xpt2:w,a:w,a:w,a:w XCall S_WhereCell in Xpt2:w,S_CurContYpt:w in Xpt:w,#S_EditHeight+S_ColLabelHeight:w in FCol:w,S_CurTLTitle:w,LCol:w,S_CurBRTitle:w,#0:w in S_CurContXpt:w XCall S_DrawRegion Tool _MoveTo,in=(S_CurContXpt:w,S_CurContYpt:w) Tool _LineTo,in=(S_CurContWd:w,S_CurContYpt:w) Exit RETURN ENDP ;-------------------------------------------------------------------------- ; ; S_DrawRowTitles PROC EXPORT ;Using S_CurrentData input Ypt:w,FRow:w,LRow:w local Ypt2:w BEGIN CmpWord S_CurContXpt,#S_NumLabelWidth beq Exit in S_CurTLCell+2:w,LRow:w out a:w,Ypt2:w,a:w,a:w XCall S_WhereCell in S_CurContXpt:w,Ypt2:w in #S_NumLabelWidth:w,Ypt:w in S_CurTLTitle+2:w,FRow:w,S_CurBRTitle+2:w,LRow:w,#0:w in #S_NumLabelWidth:w XCall S_DrawRegion Tool _MoveTo,in=(S_CurContXpt:w,S_CurContYpt:w) Tool _LineTo,in=(S_CurContXpt:w,S_CurContHt:w) Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_DrawRegion PROC EXPORT ;Using S_CurrentData input Xpt2:w,Ypt2:w,Xpt:w,Ypt:w input TLCell:l,BRCell:l,DoHilite:w input LeftEdge:w local Rect:r,RectPtr:l,OldClip:l local Ycnt:w,Xcnt:w,CurCol:w BEGIN inc Ypt2 inc Xpt2 inc Xpt2 ; Set the clip area ; lda Ypt inc a sta Rect AddWord LeftEdge,#2,Rect+2 MoveWord S_CurContHt,Rect+4 MoveWord S_CurContWd,Rect+6 MoveLong !Rect,RectPtr Tool _SectRect,in=(RectPtr:l,!Ypt:l,RectPtr:l),out=(a:w) Tool _NewRgn,out=(OldClip:l) Tool _GetClip,in=(OldClip:l) Tool _NewRgn,out=(S_ClipHandle:l) Tool _RectRgn,in=(S_ClipHandle:l,RectPtr:l) Tool _SectRgn,in=(OldClip:l,S_ClipHandle:l,S_ClipHandle:l) Tool _SetClip,in=(S_ClipHandle:l) ; Erase, but don't get any border lines. ; CmpWord BRCell,#9999 blt ChkCol dec Ypt2 Tool _MoveTo,in=(#0:w,Ypt2:w) Tool _LineTo,in=(Xpt2:w,Ypt2:w) chkCol CmpWord BRCell+2,#$02BE blt doErase dec Xpt2 dec Xpt2 Tool _MoveTo,in=(Xpt2:w,#S_EditHeight+2:w) Tool _LineTo,in=(Xpt2:w,Ypt2:w) doErase Tool _EraseRect,in=(!Ypt:l) ; Draw grid, the moved endpts are okay. ; in Xpt2:w,Ypt2:w,Xpt:w,Ypt:w,TLCell+2:w XCall S_DrawGrid MoveWord Ypt,Ycnt bra skip5 ; Outer loop, for each row in the range, .... ; loop2 AddWord #S_RowHeight,Ycnt,Ycnt inc TLCell skip5 MoveWord TLCell+2,CurCol MoveWord Xpt,Xcnt bra skip6 ; Inner loop, for each cell in the current row, .... ; loop1 Call S_CellWidth,in=(CurCol:w),out=(a:w) AddWord a,Xcnt,Xcnt inc CurCol skip6 in CurCol:w,TLCell:w,Xcnt:w,Ycnt:w XCall S_DrawCell CmpWord CurCol,BRCell+2 blt loop1 CmpWord TLCell,BRCell blt loop2 lda DoHilite beq resetClip Tool _SetClip,in=(S_ClipHandle:l) Call S_HiliteCells resetClip Tool _SetClip,in=(OldClip:l) Tool _DisposeRgn,in=(OldClip:l) Tool _DisposeRgn,in=(S_ClipHandle:l) Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_PrintPage (TLCell:l,BRCell:l,Rect:r) BRCellPrinted:l ; ; S_PrintPage PROC EXPORT ;Using S_CurrentData input TLCell:l,BRCell:l input BRPoint:l,TLPoint:l output NextCol:w,NextRow:w local BRPointPrinted:l,GetBRLoc:w BEGIN stz GetBRLoc ; Determine the range to Update, and their coordinates ; in BRPoint:l out NextRow:l,BRPointPrinted:l XCall S_WhichCell CmpWord NextRow,TLCell ; rows only bne BRowOk sta BRCell inc a sta NextRow AddWord BRPointPrinted,#S_RowHeight+1,BRPoint bra chkRCol BRowOk cmp BRCell beq doAllVert blt doAllVert inc GetBRLoc bra chkRCol doAllVert lda BRPointPrinted inc a sta BRPoint lda NextRow dec a sta BRCell chkRCol CmpWord NextCol,TLCell+2 ; cols only bne RColOk sta BRCell+2 inc a sta NextCol dec a Call S_CellWidth,in=(a:w),out=(a:w) inc a inc a AddWord a,BRPointPrinted+2,BRPoint+2 bra gotBRCell RColOk cmp BRCell+2 beq doAllHorz blt doAllHorz inc GetBRLoc bra gotBRCell doAllHorz lda BRPointPrinted+2 inc a inc a sta BRPoint+2 lda NextCol dec a sta BRCell+2 gotBRCell lda GetBRLoc beq gotBRLoc in BRCell:l out :w,:w,a:w,a:w XCall S_WhereCell pla inc a sta BRPoint pla inc a inc a sta BRPoint+2 gotBRLoc Tool _ClipRect,in=(!TLPoint:l) dec BRPoint dec BRPoint+2 dec BRPoint+2 lda S_CurEditFlag and #S_GridOff bne skipTLlines Tool _MoveTo,in=(#0:w,#0:w) Tool _LineTo,in=(S_CurContWd:w,#0:w) Tool _MoveTo,in=(#0:w,#0:w) Tool _LineTo,in=(#0:w,S_CurContHt:w) skipTLlines lda S_CurContYpt beq doneTopTitle lda S_CurContXpt beq doneBothTitle in S_CurContXpt:w,S_CurContYpt:w in #0:w,#0:w in S_CurTLTitle:l,S_CurBRTitle:l,#0:w in #0:w XCall S_DrawRegion doneBothTitle in BRPoint+2:w,S_CurContYpt:w in S_CurContXpt:w,#0:w in TLCell+2:w,S_CurTLTitle:w in BRCell+2:w,S_CurBRTitle:w,#0:w in S_CurContXpt:w XCall S_DrawRegion Tool _MoveTo,in=(#0:w,S_CurContYpt:w) Tool _LineTo,in=(S_CurContWd:w,S_CurContYpt:w) doneTopTitle lda S_CurContXpt beq doneLeftTitle in S_CurContXpt:w,BRPoint:w in #0:w,S_CurContYpt:w in S_CurTLTitle+2:w,TLCell:w in S_CurBRTitle+2:w,BRCell:w,#0:w in #0:w XCall S_DrawRegion Tool _MoveTo,in=(S_CurContXpt:w,#0:w) Tool _LineTo,in=(S_CurContXpt:w,S_CurContHt:w) doneLeftTitle in BRPoint:l,S_CurContXpt:w,S_CurContYpt:w in TLCell:l,BRCell:l,#0:w in S_CurContXpt:w XCall S_DrawRegion RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Draw2.aii b/appleworksgs/SS/Src/Draw2.aii new file mode 100755 index 0000000..fc6210e --- /dev/null +++ b/appleworksgs/SS/Src/Draw2.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' ; INCLUDE 'Driver.equ' ; INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT S_CurBRTitle IMPORT S_CurContHt IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurTLCell IMPORT S_CurTLTitle IMPORT S_DrawRegion IMPORT S_SectRange IMPORT S_WhereCell IMPORT S_WhichCell ;----------------------------------------------------------------------------- ; S_RedrawCellRange( TLCell:l,BRCell:l ) ; ; This routine draws the values of the range of cells passed to it, ; including cells found in titles. S_RedrawCellRange PROC EXPORT ;Using S_CurrentData input BRCell:l,TLCell:l local WorkBRCell1:l,WorkTLCell1:l local WorkBRCell2:l,WorkTLCell2:l local InPtr:l,Work1Ptr:l,Work2Ptr:l local CurCol:w,Xcnt:w,Ycnt:w local Cell:l,Widths:l,Xpt2:w,Ypt2:w,Xpt:w,Ypt:w local WindowBRCell:l,ColOKFlag:w BEGIN lda BRCell ; everybody is sending ldx TLCell ; these inputs in the sta TLCell ; wrong order stx BRCell lda BRCell+2 ldx TLCell+2 sta TLCell+2 stx BRCell+2 in S_CurContWd:w,S_CurContHt:w out WindowBRCell:l,a:w,a:w XCall S_WhichCell MoveLong !WorkTLCell1,Work1Ptr MoveLong !WorkTLCell2,Work2Ptr MoveLong !TLCell,InPtr stz ColOKFlag MoveLong S_CurTLCell,WorkTLCell2 MoveLong WindowBRCell,WorkBRCell2 in Work2Ptr:l,InPtr:l,Work1Ptr:l out a:w XCall S_SectRange in WorkTLCell1:l out a:w,a:w,Xpt:w,Ypt:w XCall S_WhereCell in WorkBRCell1:l out Xpt2:w,Ypt2:w,a:w,a:w XCall S_WhereCell ; Does BothTitle need to be drawn ; CmpWord #S_EditHeight+S_ColLabelHeight,S_CurContYpt jeq doneBothTitle CmpWord #S_NumLabelWidth,S_CurContXpt jeq doneBothTitle ; Is BothTitle in range ; in InPtr:l,#S_CurTLTitle:l,Work2Ptr:l out a:w XCall S_SectRange bne doBoth brl doneBothTitle doBoth in S_CurContXpt:w,S_CurContYpt:w in #S_NumLabelWidth:w,#S_EditHeight+S_ColLabelHeight:w in S_CurTLTitle:l,S_CurBRTitle:l,#0:w in #S_NumLabelWidth:w XCall S_DrawRegion in S_CurContXpt:w,#S_EditHeight+S_ColLabelHeight:w XTool _MoveTo Tool _LineTo,in=(S_CurContXpt:w,S_CurContYpt:w) Tool _MoveTo,in=(#S_NumLabelWidth:w,S_CurContYpt:w) Tool _LineTo,in=(S_CurContXpt:w,S_CurContYpt:w) doneBothTitle ; Does Top Title need to be drawn ; lda WorkTLCell1+2 bne doTop brl doneTopTitle doTop lda WorkBRCell1+2 beq doneTopTitle inc ColOKFlag CmpWord #S_EditHeight+S_ColLabelHeight,S_CurContYpt beq doneTopTitle ; Is Top Title in range ; MoveWord S_CurTLTitle,WorkTLCell2 MoveWord #1,WorkTLCell2+2 MoveWord S_CurBRTitle,WorkBRCell2 MoveWord #702,WorkBRCell2+2 in Work2Ptr:l,InPtr:l,Work2Ptr:l out a:w XCall S_SectRange beq doneTopTitle in Xpt2:w,S_CurContYpt:w in Xpt:w,#S_EditHeight+S_ColLabelHeight:w in WorkTLCell1+2:w,S_CurTLTitle:w in WorkBRCell1+2:w,S_CurBRTitle:w,#0:w in S_CurContXpt:w XCall S_DrawRegion Tool _MoveTo,in=(S_CurContXpt:w,S_CurContYpt:w) Tool _LineTo,in=(S_CurContWd:w,S_CurContYpt:w) doneTopTitle ; Does Left Title need to be drawn ; lda WorkTLCell1 jeq Exit lda WorkBRCell1 jeq Exit CmpWord #S_NumLabelWidth,S_CurContXpt beq chkContArea ; Is Left Title in range ; MoveWord #1,WorkTLCell2 MoveWord S_CurTLTitle+2,WorkTLCell2+2 MoveWord #9999,WorkBRCell2 MoveWord S_CurBRTitle+2,WorkBRCell2+2 in Work2Ptr:l,InPtr:l,Work2Ptr:l out a:w XCall S_SectRange beq chkContArea in S_CurContXpt:w,Ypt2:w in #S_NumLabelWidth:w,Ypt:w in S_CurTLTitle+2:w,WorkTLCell1:w in S_CurBRTitle+2:w,WorkBRCell1:w,#0:w in #S_NumLabelWidth:w XCall S_DrawRegion Tool _MoveTo,in=(S_CurContXpt:w,S_CurContYpt:w) Tool _LineTo,in=(S_CurContXpt:w,S_CurContHt:w) chkContArea ; Does the Content area need to be drawn ; lda ColOKFlag beq Exit in Xpt2:w,Ypt2:w,Xpt:w,Ypt:w in WorkTLCell1:l,WorkBRCell1:l,#1:w in S_CurContXpt:w XCall S_DrawRegion Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Edit.aii b/appleworksgs/SS/Src/Edit.aii new file mode 100755 index 0000000..46303c8 --- /dev/null +++ b/appleworksgs/SS/Src/Edit.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE ':::Scrap:Scrap.equ' INCLUDE 'Heap.aii.i' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_BeachBall IMPORT D_BitMapChanged IMPORT D_BitMapPtr IMPORT D_GrowHandle IMPORT D_MemoryError IMPORT D_NeedHand IMPORT D_SetFileChanged IMPORT D_SetUndoStr IMPORT X_DialogFromScrap IMPORT X_DisposeScrap IMPORT X_PostScrap IMPORT S_AcceptCell IMPORT S_ActiveWindow IMPORT S_AddCellToChangedList IMPORT S_BadPasteMsg IMPORT S_BuildSimpleUndo IMPORT S_CalculateSheet IMPORT S_CellWidth IMPORT S_ChkCellProtect IMPORT S_CurBRSelect IMPORT S_CurContHt IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurDefFormat IMPORT S_CurEditFlag IMPORT S_CurEditRect IMPORT S_CurHeap IMPORT S_CurLEHandle IMPORT S_CurTLSelect IMPORT S_CurWindow IMPORT S_ErrorFormula IMPORT S_ErrorFormulaLength IMPORT S_ExtraData IMPORT S_ExtraDataMsg IMPORT S_FixLE IMPORT S_GetCellIndex IMPORT S_GetRealCell IMPORT S_INFFormula IMPORT S_INFFormulaLength IMPORT S_NAFormula IMPORT S_NAFormulaLength IMPORT S_NegINFFormula IMPORT S_NegINFFormulaLength IMPORT S_NewLineEdit IMPORT S_ParseText IMPORT S_ProtectedCell IMPORT S_ProtectedCellMsg IMPORT S_QTraverse IMPORT S_RedrawCellRange IMPORT S_RemoveCell IMPORT S_SetUndoOn IMPORT S_SwapIn IMPORT S_SwapOut IMPORT S_UndoHandle IMPORT S_UndoNames IMPORT S_UndoType IMPORT S_WhichCell ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_AddBufferToScrap ENTRY S_CheckFormula ENTRY S_ClearCell ENTRY S_CopyFrame ENTRY S_CopyRect ENTRY S_GetSSScrap ENTRY S_Image ENTRY S_PutSSScrap ENTRY S_ScrapBR ENTRY S_ScrapLeft ENTRY S_ScrapRight ENTRY S_ScrapTL ENTRY S_SetImage ;-------------------------------------------------------------------------; ; S_Clear ; ; S_Clear will clear the currently selected item(s) from the active ; document. S_Clear PROC EXPORT ;Using S_ScrapData ;Using S_CurrentData ;Using S_ProtectData ;Using S_ErrorData error ErrFlag BEGIN +b stz ErrFlag Call S_SwapIn,in=(S_ActiveWindow:l) lda S_CurEditFlag and #S_EditingBit beq notLE Tool _LEDelete,in=(S_CurLEHandle:l) brl Exit notLE in S_CurTLSelect:l,S_CurBRSelect:l,#S_ChkCellProtect:l XCall S_QTraverse bcc contClear Call D_AlertBox,in=(#OkBox:w,#S_ProtectedCellMsg:l),out=(a:w) brl Exit contClear MoveLong S_CurTLSelect,S_ScrapTL MoveLong S_CurBRSelect,S_ScrapBR in S_CurTLSelect:l,S_CurBRSelect:l XCall S_BuildSimpleUndo,err=ErrFlag bcs memError Call S_QTraverse,in=(S_ScrapTL:l,S_ScrapBR:l,#S_ClearCell:l) bcc redraw memError Call D_MemoryError redraw ldx #0 Call S_NewLineEdit,in=(x:w,x:w) in S_ScrapTL:l,S_ScrapBR:l XCall S_RedrawCellRange Call S_SetUndoOn,in=(#S_UndoClearType:w) lda S_CurEditFlag and #S_ManCalcBit bne Exit Call S_CalculateSheet Exit RETURN ENDP ;------------------------------------------------------------------------- ; ; S_ClearCell PROC EXPORT ;Using S_ScrapData input Cell:l,CellIndex:l error ErrorFlag BEGIN ; Note: cells will be added to ChangedList in S_RemoveCell ; Another Note: There is no need to execute this code on pad or empty ; cells. Put in branch around in that case. ldx #S_CellTypeEmpty in Cell:l,x:w,x:w,x:w,x:w out :l,:l XCall S_AcceptCell,err=ErrorFlag fixLRCells pla pla cmp S_ScrapRight blt OKright sta S_ScrapRight OKright pla pla cmp S_ScrapLeft bge Exit sta S_ScrapLeft Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_Copy (Window:l): ImageRoutine:l, Type:w, Scrap:l ; ; S_Copy will perform a copy of the currently selected item(s) in the given ; document. The output routine draws an image of the scrap for dragging and ; is defined: ; ; ImageRoutine(where:L) - draws the shape at where ; ; The routine should use the current port and penmode (don't change either). ; Pass back a 0 type for no scrap. S_Copy PROC EXPORT ;Using S_CurrentData ;Using X_ClipData input Window:l output ImageRoutine:l,SType:w,ScrapHandle:l local ScrapLen:l,LEScrapHandle:l error ErrorFlag BEGIN +b stz ErrorFlag Call S_SwapIn,in=(Window:l) MoveWord #0,SType Call S_SetImage,in=(S_CurTLSelect:l,S_CurBRSelect:l) MoveLong #S_Image,ImageRoutine lda S_CurEditFlag and #S_EditingBit beq notLE Tool _LECopy,in=(S_CurLEHandle:l),err=ErrorFlag jcs Exit Tool _LEGetScrapLen,out=(a:w) beq Exit sta ScrapLen stz ScrapLen+2 in ScrapLen:l out ScrapHandle:l XCall D_NeedHand,err=ErrorFlag bcs Exit Tool _LEScrapHandle,out=(LEScrapHandle:l),err=ErrorFlag in [LEScrapHandle]:l,[ScrapHandle]:l,ScrapLen:l XTool _BlockMove MoveWord #AsciiText,SType bra Exit notLE in S_CurTLSelect:l,S_CurBRSelect:l out ScrapHandle:l XCall S_GetSSScrap,err=ErrorFlag bcs Exit MoveWord #SSScrap,SType Exit RETURN ENDP ;--------------------------------------------------------------------- S_ScrapData PROC EXPORT EXPORT S_ScrapOrgCell EXPORT S_ScrapTL EXPORT S_ScrapTop EXPORT S_ScrapLeft EXPORT S_ScrapBR EXPORT S_ScrapBottom EXPORT S_ScrapRight EXPORT S_ScrapBufferSize EXPORT S_ScrapHandleSize EXPORT S_ScrapHandle EXPORT S_ScrapBuffer EXPORT S_ScrapParse EXPORT S_ScrapPasteType S_ScrapOrgCell DS.B 4 S_ScrapTL S_ScrapTop DS.B 2 S_ScrapLeft DS.B 2 S_ScrapBR S_ScrapBottom DS.B 2 S_ScrapRight DS.B 2 S_ScrapBufferSize DS.B 4 S_ScrapHandleSize DS.B 4 S_ScrapHandle DS.B 4 S_ScrapBuffer DS.B 4 S_ScrapParse DS.B 2 S_ScrapPasteType DS.B 2 ENDP ;-------------------------------------------------------------------------; ; S_Cut (Window:l): ImageRoutine:l ; ; S_Cut will perform a cut of the currently selected item(s) in the given ; document. The output routine draws an image of the scrap for dragging and ; is defined: ; ; ImageRoutine(where:L) - draws the shape at where ; ; The routine should use the current port and penmode (don't change either). ; Pass back a 0 for no scrap. S_Cut PROC EXPORT ;Using S_CurrentData ;Using S_UndoData input Window:l output ImageRoutine:l local SType:w,ScrapHandle:l error ErrFlag BEGIN +b stz ErrFlag in Window:l out ImageRoutine:l,SType:w,ScrapHandle:l XCall S_Copy,err=ErrFlag bcs Exit lda SType beq Exit Call X_PostScrap,in=(SType:w,ScrapHandle:l) Call S_Clear,err=ErrFlag ; some manipulation is needed here to get right undo string lda S_UndoHandle ora S_UndoHandle+2 beq Exit MoveWord #S_UndoCutType,S_UndoType asl a asl a tax PushLong S_UndoNames:x Call D_SetUndoStr,in=(:l,S_CurWindow:l) Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_Paste ( Window:l, Scrap:l, Type:w, Paste:w, Where:l) ; ; The input are: ; - Window, which window to paste in, usually the active one ; - Scrap, a handle to the data, dispose of it when you're done ; - Type, the type of scrap that is being passed. ; - Paste, What type 0 - from menu 1-directional (look at where) ; 2 - from import ; - Where, where paste was if Paste was type 1 ; Return any memory errors. S_Paste PROC EXPORT ;Using S_ScrapData ;Using S_CurrentData ;Using S_ProtectData ;Using S_ErrorData ;Using X_ClipData input Window:l,Scrap:l,Type:w,Paste:w,Where:l local Buffer:l,Rect:r,PasteType:w local ContentIndex:l,CellPtr:l error ErrorFlag BEGIN +b stz ErrorFlag stz ContentIndex stz ContentIndex+2 stz PasteType Cmpword Type,#SSScrap beq doSSScrap inc ErrorFlag brl Exit doSSScrap Call S_SwapIn,in=(Window:l) MoveLong Scrap,S_ScrapBuffer MoveWord Paste,S_ScrapPasteType CmpWord Paste,#1 jne normal ; menu paste same as import ; Put directional paste code here ; MoveWord S_CurEditFlag,a and #S_EditingBit beq notLE Tool _PtInRect,in=(!Where:l,#S_CurEditRect:l),out=(a:w) beq endBranch Call X_DialogFromScrap Tool _LEPaste,in=(S_CurLEHandle:l) endBranch brl Exit notLE MoveWord S_CurContYpt,Rect MoveWord S_CurContXpt,Rect+2 MoveWord S_CurContHt,Rect+4 MoveWord S_CurContWd,Rect+6 Tool _PtInRect,in=(!Where:l,!Rect:l),out=(a:w) beq endBranch in Where:l out S_ScrapTL:l,Where:l XCall S_WhichCell bra fixScrapRange ; CmpWord S_ScrapTop,#10000 ; jge Exit ; ; CmpWord S_ScrapLeft,#$02BF ; blt fixScrapRange ; brl Exit ; Set up for normal SS scrap ; normal MoveWord S_CurEditFlag,a and #S_EditingBit beq notLE2 Call X_DialogFromScrap Tool _LEPaste,in=(S_CurLEHandle:l) brl Exit notLE2 MoveLong S_CurTLSelect,S_ScrapTL fixScrapRange MoveLong [Scrap],Buffer AddWord S_ScrapLeft,[Buffer]:#S_ScrapCols,a dec a sta S_ScrapRight cmp #703 bge badPaste AddWord S_ScrapTop,[Buffer]:#S_ScrapRows,a dec a sta S_ScrapBottom cmp #10000 blt chkProtect badPaste Call D_AlertBox,in=(#OkBox:w,#S_BadPasteMsg:l),out=(a:w) brl Exit chkProtect ; Call D_SetCursor,in=(#WatchCursor:w) stz S_ProtectedCell stz S_ExtraData ; PushLong S_ScrapTL ; ; AddWord S_ScrapLeft,[Buffer]:#S_ScrapCols,a ;; dec a ; pha ; ; AddWord S_ScrapTop,[Buffer]:#S_ScrapRows,a ; dec a ; pha in S_ScrapTL:l,S_ScrapBR:l in #S_ChkCellProtect:l ;two longs on stack XCall S_QTraverse bcc chkOtherData Call D_AlertBox,in=(#OkBox:w,#S_ProtectedCellMsg:l),out=(a:w) brl Exit chkOtherData lda S_ExtraData beq doPaste Call D_AlertBox,in=(#OkCancelBox:w,#S_ExtraDataMsg:l),out=(a:w) cmp #OK beq doPaste brl Exit doPaste ; Call D_SetCursor,in=(#WatchCursor:w) lda Paste bne setImport MoveWord #S_UndoPasteType,PasteType bra contSetUndo setImport cmp #1 beq doHotPaste MoveWord #S_UndoImportType,PasteType bra contSetUndo doHotPaste Call D_SetFileChanged,in=(Window:l) CmpLong Window,S_ActiveWindow bne doPaste2 MoveWord #S_UndoPasteType,PasteType contSetUndo ; MoveLong [Scrap],Buffer ; ; PushLong S_CurTLSelect ; AddWord S_ScrapLeft,[Buffer]:#S_ScrapCols,a ; dec a ; pha ; AddWord S_ScrapTop,[Buffer]:#S_ScrapRows,a ; dec a ; pha PushLong S_ScrapTL in S_ScrapTL:l,S_ScrapBR:l XCall S_BuildSimpleUndo,err=ErrorFlag PullLong S_ScrapTL bcs memError doPaste2 MoveLong Scrap,S_ScrapBuffer MoveWord Paste,S_ScrapPasteType Call S_PutSSScrap,err=ErrorFlag memError Call S_FixLE in S_ScrapTL:l,S_ScrapBR:l XCall S_RedrawCellRange lda PasteType beq chkCalc Call S_SetUndoOn,in=(PasteType:w) chkCalc ; Stick code here to see if Appleworks Open should calculate ; lda S_CurEditFlag and #S_ManCalcBit bne savePaste Call S_CalculateSheet savePaste CmpLong S_ActiveWindow,S_CurWindow beq Exit Call S_SwapOut Exit Call X_DisposeScrap,in=(Type:w,Scrap:l) RETURN ENDP ;----------------------------------------------------------------------------- ; S_Image(where) draws an image of the copied cells. S_Image PROC EXPORT ;Using S_ImageData input Where:l BEGIN +b MoveLong Where,S_CopyRect AddLong Where,S_CopyFrame,S_CopyRect+4 Tool _FrameRect,in=(#S_CopyRect:l) RETURN ENDP ;----------------------------------- S_ImageData PROC EXPORT EXPORT S_CopyRect EXPORT S_CopyFrame S_CopyRect DS.B 8 S_CopyFrame DS.B 4 ENDP ;----------------------------------- S_SetImage PROC EXPORT ;Using S_ImageData ;Using S_CurrentData input TLCell:l,BRCell:l local MaxHeight:w,MaxWidth:w BEGIN SubWord S_CurContHt,S_CurContYpt,MaxHeight SubWord S_CurContWd,S_CurContXpt,MaxWidth SubWord BRCell,TLCell,a inc a cmp #35 bge setCurHt asl a sta S_CopyFrame asl a asl a AddWord a,S_CopyFrame,S_CopyFrame cmp MaxHeight blt setWidth setCurHt MoveWord MaxHeight,S_CopyFrame setWidth SubWord BRCell+2,TLCell+2,a inc a cmp #35 bge setCurWd stz S_CopyFrame+2 wdLoop Call S_CellWidth,in=(BRCell+2:w),out=(a:w) AddWord a,S_CopyFrame+2,S_CopyFrame+2 cmp MaxWidth bge setCurWd dec BRCell+2 CmpWord BRCell+2,TLCell+2 bge wdLoop bra Exit setCurWd MoveWord MaxWidth,S_CopyFrame+2 Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_GetScrapCell ; S_GetScrapCell PROC EXPORT ;Using S_ScrapData ;Using S_CurrentData ;Using SANEequs input Cell:l,CellIndex:l local Buffer:l,ContentSize:l,CellSize:w local CellPtr:l,ContentPtr:l,Format:w error ErrorFlag BEGIN stz ErrorFlag CmpWord S_ScrapBufferSize,#$7800 blt bufferOK Call S_AddBufferToScrap,err=ErrorFlag jcs Exit bufferOK H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellFormat,Format jmi Exit AddLong S_ScrapBuffer,S_ScrapBufferSize,Buffer ; Store the location ; SubWord Cell,S_ScrapOrgCell,a inc a MoveWord a,[Buffer]:#S_ScrapCellLoc iny iny SubWord Cell+2,S_ScrapOrgCell+2,a inc a sta [Buffer],y ; Store the format information ; MoveWord Format,[Buffer]:#S_ScrapFormat MoveWord [CellPtr]:#S_CellFormat+2,a and #$FFFF-S_CellProtect-S_CellCircular MoveWord a,[Buffer]:#S_ScrapFormat+2 MoveWord #S_ScrapValueSize,CellSize ; Store the last calculated value ; lda Format and #S_CellTypeValue jne getSane CmpLong [CellPtr]:#S_CellValue,[CellPtr]:#S_CellContent bne getString MoveWord #0,[Buffer]:#S_ScrapValueSize inc CellSize brl getContent getString H_GetBlockPtr [CellPtr]:#S_CellValue,ContentPtr lda [ContentPtr] and #$00FF inc a sta ContentSize stz ContentSize+2 PushLong ContentPtr AddLong Buffer,#S_ScrapValueSize,s PushLong ContentSize Tool _BlockMove AddWord ContentSize,CellSize,CellSize bra getContent getSane MoveWord #10,[Buffer]:#S_ScrapValueSize AddLong CellPtr,#S_CellValue,s AddLong Buffer,#S_ScrapValue,s Tool FX2X,in=(:l,:l) AddWord #11,CellSize,CellSize ; Store the content of the cell ; getContent H_GetBlockSize [CellPtr]:#S_CellContent,ContentSize lda ContentSize+2 ora ContentSize beq storeSize H_GetBlockPtr [CellPtr]:#S_CellContent,ContentPtr PushLong ContentPtr lda CellSize AddLong a,Buffer,s PushLong ContentSize Tool _BlockMove ; Store the cell size ; storeSize AddWord CellSize,ContentSize,[Buffer]:#S_ScrapCellSize AddLong a,S_ScrapBufferSize,S_ScrapBufferSize Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_ScrapValue2String PROC EXPORT ;Using S_CurrentData ;Using S_FormulaData ;Using SANEequs input Buffer:l output ContentIndex:l,CellType:w local ContentPtr:l,StringPtr:l,ContentSize:l local FormatPtr:l,ValuePtr:l error ErrFlag BEGIN stz ErrFlag MoveWord #S_CellTypeValue,CellType AddLong Buffer,#S_ScrapFormat,FormatPtr lda [FormatPtr] and #S_CellInvalid beq chkInf MoveWord #S_CellTypeFormula,CellType lda [FormatPtr] and #S_CellError beq doNa MoveLong #S_ErrorFormula,StringPtr MoveLong #S_ErrorFormulaLength,ContentSize brl saveContent doNa MoveLong #S_NAFormula,StringPtr MoveLong #S_NAFormulaLength,ContentSize brl saveContent chkInf AddLong Buffer,#S_ScrapValue,ValuePtr Tool FCLASSX,in=(ValuePtr:l) txa and #$00FF cmp #$00FE bne doValue MoveWord #S_CellTypeFormula,CellType txa bmi doNegInf MoveLong #S_INFFormula,StringPtr MoveLong #S_INFFormulaLength,ContentSize bra saveContent doNegInf MoveLong #S_NegINFFormula,StringPtr MoveLong #S_NegINFFormulaLength,ContentSize bra saveContent doValue stz ContentIndex stz ContentIndex+2 brl Exit saveContent H_NewBlock ContentSize,ContentIndex,ContentPtr,err=ErrFlag bcs Exit Tool _BlockMove,in=(StringPtr:l,ContentPtr:l,ContentSize:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_GetSSScrap ; S_GetSSScrap PROC EXPORT ;Using D_GlobalData ;Using S_ScrapData input TLCell:l,BRCell:l output ScrapHandle:l local Buffer:l,ScrapPtr:l error ErrFlag BEGIN stz ErrFlag MoveWord #1,>D_BitMapChanged lda >D_BitMapPtr+2 tax lda >D_BitMapPtr MoveLong ax,Buffer MoveLong ax,S_ScrapBuffer SubWord BRCell,TLCell,a inc a MoveWord a,[Buffer]:#S_ScrapRows SubWord BRCell+2,TLCell+2,a inc a MoveWord a,[Buffer]:#S_ScrapCols MoveWord #0,[Buffer]:#S_ScrapParseCode MoveWord #S_ScrapCells,S_ScrapBufferSize stz S_ScrapBufferSize+2 stz S_ScrapHandle stz S_ScrapHandle+2 stz S_ScrapHandleSize stz S_ScrapHandleSize+2 MoveLong TLCell,S_ScrapOrgCell in TLCell:l,BRCell:l,#S_GetScrapCell:l XCall S_QTraverse,err=ErrFlag bcs Exit Call S_AddBufferToScrap,err=ErrFlag bcs Exit MoveLong S_ScrapHandle,ScrapHandle Exit RETURN ENDP ;------------------------------------------------------------------------------ ; ; S_AddBufferToScrap PROC EXPORT ;Using S_ScrapData local ScrapHandle:l,NewSize:l,ScrapPtr:l error ErrFlag BEGIN stz ErrFlag MoveLong S_ScrapHandle,ScrapHandle lda ScrapHandle ora ScrapHandle+2 bne resizeHandle MoveLong S_ScrapBufferSize,ax MoveLong ax,NewSize Call D_NeedHand,in=(ax:l),out=(ax:l),err=ErrFlag jcs Exit MoveLong ax,S_ScrapHandle MoveLong ax,ScrapHandle bra moveData resizeHandle AddLong S_ScrapHandleSize,S_ScrapBufferSize,NewSize Call D_GrowHandle,in=(NewSize:l,ScrapHandle:l),err=ErrFlag bcc moveData Tool _DisposeHandle,in=(ScrapHandle:l) bra Exit moveData MoveLong [ScrapHandle],ScrapPtr PushLong S_ScrapBuffer AddLong ScrapPtr,S_ScrapHandleSize,s PushLong S_ScrapBufferSize XTool _BlockMove MoveWord NewSize,[ScrapPtr]:#S_ScrapSize sta S_ScrapHandleSize MoveWord NewSize+2,[ScrapPtr]:#S_ScrapSize+2 sta S_ScrapHandleSize+2 stz S_ScrapBufferSize stz S_ScrapBufferSize+2 Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_PutSSScrap PROC EXPORT ;Using S_ScrapData ;Using S_CurrentData ;Using SANEEqus local TLCell:l,BRCell:l,ScrapLimit:l local Cell:l,CellIndex:l,CellPtr:l local ContentIndex:l,ContentPtr:l local Buffer:l,TypeCell:w,Format:l local LCell:l,RCell:l,StringPtr:l,ScrapHandle:l local ParseCode:w local ContentStart:l,ContentSize:l,CellSize:w local ScrapSize:l,ValueSize:l error ErrorFlag BEGIN stz ErrorFlag MoveLong S_ScrapBuffer,ScrapHandle MoveLong [ScrapHandle],Buffer AddWord S_ScrapTop,[Buffer]:#S_ScrapRows,a dec a sta S_ScrapBottom AddWord S_ScrapLeft,[Buffer]:#S_ScrapCols,a dec a sta S_ScrapRight SubLong S_ScrapTL,#$10001,S_ScrapOrgCell ; Determine Parse Code ; MoveWord [Buffer]:#S_ScrapParseCode,ParseCode ; do Paste ; MoveLong [Buffer]:#S_ScrapSize,ScrapLimit MoveWord #S_ScrapCells,ScrapSize stz ScrapSize+2 MoveLong S_ScrapTL,TLCell MoveLong S_ScrapBR,BRCell in TLCell:l,BRCell:l,#S_ClearCell:l XCall S_QTraverse,err=ErrorFlag jcs Exit stz ValueSize+2 stz ContentStart+2 stz ContentSize+2 CmpLong ScrapSize,ScrapLimit jge Exit pasteLoop Call D_BeachBall stz ContentIndex stz ContentIndex+2 AddLong [ScrapHandle],ScrapSize,Buffer ; Figure cell location ; AddLong [Buffer]:#S_ScrapCellLoc,S_ScrapOrgCell,Cell ; Get the content of the cell ; MoveWord [Buffer]:#S_ScrapValueSize,a and #$00FF sta ValueSize AddWord a,#S_ScrapValue,ContentStart MoveWord [Buffer]:#S_ScrapCellSize,CellSize SubWord a,ContentStart,ContentSize CmpWord ParseCode,#2 jlt semiParsed SpaceWord SpaceLong ; This cludge makes A1 references refer to top,left of Paste ; ; when it is an import of ascii file. ; CmpWord S_ScrapPasteType,#2 bne notImport SubLong Cell,S_ScrapOrgCell,s bra contNotParsed notImport PushLong Cell contNotParsed PushLong ScrapHandle lda ContentStart inc a AddLong a,ScrapSize,s SubWord ContentSize,#1,s PushLong #DRec PushWord #1 Call S_ParseText,err=ErrorFlag PullLong ContentIndex PullWord TypeCell jcs Exit lda S_CurDefFormat and #$FFFF-S_CellType ora TypeCell sta Format MoveWord S_CurDefFormat+2,Format+2 CmpWord TypeCell,#S_CellTypeValue jne createCell Tool FDEC2X,in=(#DRec:l,#Number:l) brl createCell ; Scrap is either semi-parsed or fully - parsed ; semiParsed MoveLong [Buffer]:#S_ScrapFormat,Format MoveWord Format,a and #S_CellType sta TypeCell beq jmpCopyContent ; cell type text and #S_CellTypeTextForm ; any formula jeq createCell ; must be a value lda ParseCode bne parseFormula jmpCopyContent brl copyContent parseFormula ; Scrap is semi - parsed ; ; These come from AppleWorks and may never have calculated ; ; text fields. ; SpaceLong lda ContentStart inc a AddLong a,Buffer,s lda ContentSize dec a pha PushLong Cell PushWord #1 Call E_ParseFormula,err=ErrorFlag PullLong ContentIndex jcc createCell lda Format and #$FFFF-S_CellType-S_CellInvalid-S_CellError ; ora #S_CellTypeText ; = 0 sta Format stz TypeCell ; The Content field has the correct content ; copyContent H_NewBlock ContentSize,ContentIndex,ContentPtr,err=ErrorFlag jcs Exit AddLong [ScrapHandle],ScrapSize,Buffer AddLong Buffer,ContentStart,s PushLong ContentPtr PushLong ContentSize Tool _BlockMove lda Format and #S_CellTypeTextForm beq createCell ; If this is an SS formula, make sure that all cell references ; ; are within the spreadsheet. ; Call S_CheckFormula,in=(Cell:l,ContentPtr:l) ; Get a New cell ; createCell in Cell:l,Format:l,ContentIndex:l out LCell:l,RCell:l XCall S_AcceptCell,err=ErrorFlag jcs Exit ; Store the last calculated value ; AddLong [ScrapHandle],ScrapSize,Buffer in Cell:l out CellIndex:l XCall S_GetCellIndex H_GetBlockPtr CellIndex,CellPtr lda TypeCell and #S_CellTypeValue beq textInValue CmpWord ParseCode,#2 bne valueInScrap lda TypeCell and #S_CellTypeTextForm ; any formula jne wrapUp PushLong #Number bra moveNumber valueInScrap AddLong Buffer,#S_ScrapValue,s moveNumber AddLong CellPtr,#S_CellValue,s Tool FX2X,in=(:l,:l) brl wrapUp textInValue lda TypeCell jeq setValue ; type = Text AddWord ValueSize,#1,ValueSize H_NewBlock ValueSize,ContentIndex,ContentPtr,err=ErrorFlag bcc okTextValue ; No Space for text value ; H_GetBlockPtr CellIndex,CellPtr lda Format and #$FFFF-S_CellType ora #S_CellTypeFormula MoveWord a,[CellPtr]:#S_CellFormat Call S_RemoveCell,in=(Cell:l) brl Exit okTextValue AddLong [ScrapHandle],ScrapSize,Buffer AddLong Buffer,#S_ScrapValueSize,s PushLong ContentPtr PushLong ValueSize Tool _BlockMove H_GetBlockPtr CellIndex,CellPtr setValue MoveLong ContentIndex,[CellPtr]:#S_CellValue wrapUp Call S_AddCellToChangedList,in=(Cell:l) lda RCell+2 cmp S_ScrapRight blt OKright sta S_ScrapRight OKright lda LCell+2 cmp S_ScrapLeft bge fixSize sta S_ScrapLeft fixSize lda CellSize AddLong a,ScrapSize,ScrapSize CmpLong ScrapSize,ScrapLimit jlt pasteLoop Exit RETURN DRec DS.B 33 Number DS.B 10 ENDP ;----------------------------------------------------------------------------- ; ; S_CheckFormula PROC EXPORT input Cell:l,FormulaPtr:l local Start:w,Stop:w,RealCell:l BEGIN MoveWord [FormulaPtr]:#E_FormulaCells,Stop MoveWord #E_FormulaData,Start CmpWord Start,Stop jge Exit dependLoop SpaceLong AddWord Start,#3,y PushWord [FormulaPtr]:y dey dey PushWord [FormulaPtr]:y dey lda [FormulaPtr],y and #$00FF pha PushLong Cell Call S_GetRealCell PullLong RealCell lda RealCell beq trashIt cmp #10000 bge trashIt lda RealCell+2 beq trashIt cmp #703 blt nextDepend trashIt ldy Start iny MoveLong #S_NotACell,[FormulaPtr]:y nextDepend AddWord Start,#5,Start cmp Stop jlt dependLoop Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Edit2.aii b/appleworksgs/SS/Src/Edit2.aii new file mode 100755 index 0000000..a9f0c57 --- /dev/null +++ b/appleworksgs/SS/Src/Edit2.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_MemoryError IMPORT X_DialogFromScrap IMPORT X_GetScrap IMPORT X_SSScTypes IMPORT S_AcceptCell IMPORT S_ActiveWindow IMPORT S_AddCellToChangedList IMPORT S_BadPasteMsg IMPORT S_BuildSimpleUndo IMPORT S_CalculateSheet IMPORT S_ChkCellProtect IMPORT S_ClearCell IMPORT S_CurBRMost IMPORT S_CurBRSelect IMPORT S_CurEditFlag IMPORT S_CurLEHandle IMPORT S_CurTLSelect IMPORT S_DoChecks IMPORT S_DrawLocation IMPORT S_ExtraData IMPORT S_ExtraDataMsg IMPORT S_FixLE IMPORT S_GetCellPtr IMPORT S_GetDirDlog IMPORT S_GetSSScrap IMPORT S_HiliteCells IMPORT S_PasteValueMsg IMPORT S_ProtectedCell IMPORT S_ProtectedCellMsg IMPORT S_PutSSScrap IMPORT S_QTraverse IMPORT S_RedrawCellRange IMPORT S_ScrapBR IMPORT S_ScrapBottom IMPORT S_ScrapBuffer IMPORT S_ScrapLeft IMPORT S_ScrapOrgCell IMPORT S_ScrapRight IMPORT S_ScrapTL IMPORT S_ScrapTop IMPORT S_ScrapValue2String IMPORT S_SetBRMostCell IMPORT S_SetUndoOn IMPORT S_SwapIn ;---------------------------------------------------------------------------- ; S_PasteValues ; S_PasteValues PROC EXPORT ;Using S_ScrapData ;Using S_CurrentData ;Using X_ClipData ;Using SANEequs ;Using S_ErrorData ;Using S_ProtectData local ContentIndex:l,Cell:l,CellPtr:l local ScrapHandle:l,Buffer:l,SFlag:w local TLCell:l,BRCell:l,ScrapLimit:l local ContentPtr:l local TypeCell:w,Format:l local LCell:l,RCell:l,StringPtr:l local ContentStart:l,ContentSize:l,CellSize:w local ScrapSize:l,ValueSize:l error ErrorFlag BEGIN +b stz ErrorFlag stz ContentIndex stz ContentIndex+2 Call X_GetScrap,in=(#X_SSScTypes:l),out=(SFlag:w,ScrapHandle:l) beq needScrap MoveLong [ScrapHandle],Buffer MoveWord [Buffer]:#S_ScrapParseCode,a beq goodScrap needScrap Call D_AlertBox,in=(#OkBox:w,#S_PasteValueMsg:l),out=(a:w) lda SFlag jeq Quit brl Exit goodScrap Call S_SwapIn,in=(S_ActiveWindow:l) MoveWord S_CurEditFlag,a and #S_EditingBit beq notLE Call X_DialogFromScrap Tool _LEPaste,in=(S_CurLEHandle:l) brl Exit notLE MoveWord S_CurTLSelect,S_ScrapTop AddWord a,[Buffer]:#S_ScrapRows,a dec a sta S_ScrapBottom MoveWord S_CurTLSelect+2,S_ScrapLeft AddWord a,[Buffer]:#S_ScrapCols,a dec a sta S_ScrapRight ; Is it on the spread sheet ; cmp #703 bge badPaste CmpWord S_ScrapBottom,#10000 blt chkProtect badPaste Call D_AlertBox,in=(#OkBox:w,#S_BadPasteMsg:l),out=(a:w) brl Exit chkProtect ; Call D_SetCursor,in=(#WatchCursor:w) stz S_ProtectedCell stz S_ExtraData in S_ScrapTL:l,S_ScrapBR:l,#S_ChkCellProtect:l XCall S_QTraverse bcc chkOtherData Call D_AlertBox,in=(#OkBox:w,#S_ProtectedCellMsg:l),out=(a:w) brl Exit chkOtherData lda S_ExtraData beq DoPaste Call D_AlertBox,in=(#OkCancelBox:w,#S_ExtraDataMsg:l),out=(a:w) cmp #OK beq DoPaste brl Exit DoPaste PushLong S_ScrapTL PushLong S_ScrapBR in S_ScrapTL:l,S_ScrapBR:l XCall S_BuildSimpleUndo,err=ErrorFlag PullLong S_ScrapBR PullLong S_ScrapTL jcs pasteError MoveLong ScrapHandle,S_ScrapBuffer MoveLong [ScrapHandle],Buffer ; do Paste ; SubLong S_ScrapTL,#$10001,S_ScrapOrgCell MoveLong [Buffer]:#S_ScrapSize,ScrapLimit MoveWord #S_ScrapCells,ScrapSize stz ScrapSize+2 MoveLong S_ScrapTL,TLCell MoveLong S_ScrapBR,BRCell in TLCell:l,BRCell:l,#S_ClearCell:l XCall S_QTraverse,err=ErrorFlag jcs Exit stz ValueSize+2 stz ContentStart+2 stz ContentSize+2 CmpLong ScrapSize,ScrapLimit jge chkRedraw pasteLoop AddLong [ScrapHandle],ScrapSize,Buffer ; Figure cell location ; AddLong [Buffer]:#S_ScrapCellLoc,S_ScrapOrgCell,Cell ; Get the content of the cell ; MoveWord [Buffer]:#S_ScrapValueSize,a and #$00FF sta ValueSize AddWord a,#S_ScrapValue,ContentStart MoveWord [Buffer]:#S_ScrapCellSize,CellSize SubWord a,ContentStart,ContentSize ; Check the format for the cell type ; MoveLong [Buffer]:#S_ScrapFormat,Format MoveWord Format,a and #S_CellType sta TypeCell jeq copyContent ; cell type text cmp #S_CellTypeValue beq noContent cmp #S_CellTypeTextForm beq copyValueText ; Must be a value formula ; in Buffer:l out ContentIndex:l,TypeCell:w XCall S_ScrapValue2String,err=ErrorFlag jcs pasteError lda Format and #$FFFF-S_CellType ora TypeCell ; this might be formula sta Format ; if NA, ERROR, INF, etc. brl createCell noContent stz ContentIndex stz ContentIndex+2 brl createCell copyValueText AddLong Buffer,#S_ScrapValueSize,StringPtr MoveWord [StringPtr],a and #$00FF inc a sta ContentSize stz ContentSize+2 H_NewBlock ContentSize,ContentIndex,ContentPtr,err=ErrorFlag jcs pasteError AddLong Buffer,#S_ScrapValueSize,s Tool _BlockMove,in=(:l,ContentPtr:l,ContentSize:l) lda Format and #$FFFF-S_CellType ; ora #S_CellTypeText ;= 0 sta Format bra createCell copyContent H_NewBlock ContentSize,ContentIndex,ContentPtr,err=ErrorFlag jcs pasteError AddLong [ScrapHandle],ScrapSize,Buffer AddLong ContentStart,Buffer,s PushLong ContentPtr PushLong ContentSize Tool _BlockMove ; Get a New cell ; createCell in Cell:l,Format:l,ContentIndex:l out LCell:l,RCell:l XCall S_AcceptCell,err=ErrorFlag jcs pasteError ; Store the last calculated value ; in Cell:l out CellPtr:l XCall S_GetCellPtr AddLong [ScrapHandle],ScrapSize,Buffer lda Format and #S_CellType beq setTextValue AddLong Buffer,#S_ScrapValue,s AddLong CellPtr,#S_CellValue,s Tool FX2X,in=(:l,:l) bra wrapup setTextValue MoveLong ContentIndex,[CellPtr]:#S_CellValue wrapUp Call S_AddCellToChangedList,in=(Cell:l) lda RCell+2 cmp S_ScrapRight blt OKright sta S_ScrapRight OKright lda LCell+2 cmp S_ScrapLeft bge fixSize sta S_ScrapLeft fixSize lda CellSize AddLong a,ScrapSize,ScrapSize CmpLong ScrapSize,ScrapLimit bge chkRedraw brl pasteLoop pasteError Call D_MemoryError ; Redraw the necessary cells ; chkRedraw Call S_FixLE redraw in S_ScrapTL:l,S_ScrapBR:l XCall S_RedrawCellRange Call S_SetUndoOn,in=(#S_UndoPasteValuesType:w) lda S_CurEditFlag and #S_ManCalcBit bne Exit Call S_CalculateSheet Exit Tool _DisposeHandle,in=(ScrapHandle:l) Quit RETURN ENDP ;--------------------------------------------------------------------------- ; S_SelectAll ; S_SelectAll PROC EXPORT ;Using S_CurrentData BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) MoveWord S_CurEditFlag,a and #S_EditingBit beq findRange Tool _LEGetTextLen,in=(S_CurLEHandle:l),out=(x:w) Tool _LESetSelect,in=(#0:w,x:w,S_CurLEHandle:l) bra Exit findRange lda S_CurEditFlag and #S_BRMostBit beq BRset Call S_SetBRMostCell,in=(#0:w) lda #S_BRMostBit trb S_CurEditFlag BRset Call S_HiliteCells MoveWord #1,S_CurTLSelect sta S_CurTLSelect+2 MoveLong S_CurBRMost,S_CurBRSelect Call S_HiliteCells Call S_DoChecks Call S_FixLE Call S_DrawLocation Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_Fill ; S_Fill PROC EXPORT ;Using S_ScrapData ;Using S_CurrentData ;Using S_ErrorData local TLCell:l,LMost:w,RMost:w error ErrFlag BEGIN +b stz ErrFlag Call S_SwapIn,in=(S_ActiveWindow:l) lda S_CurEditFlag and #S_EditingBit jne Exit stzl S_ScrapBuffer MoveLong S_CurTLSelect,TLCell MoveWord S_CurTLSelect+2,LMost MoveWord S_CurBRSelect+2,RMost CmpWord S_CurTLSelect,S_CurBRSelect jeq chkFillCols CmpWord S_CurTLSelect+2,S_CurBRSelect+2 beq fillRows ; Put dialog for choosing row or column fill here ; ; direction: 0==Cancel,1==Left,2==Right,3==Up,4==Down Call S_GetDirDlog,in=(#0:w),out=(a:w) jeq Exit ; = cancel cmp #2 ; = right jeq chkFillCols cmp #4 ; = down jne Exit fillRows CmpWord S_CurTLSelect,S_CurBRSelect jeq Exit ; Call D_SetCursor,in=(#WatchCursor:w) PushWord TLCell+2 lda TLCell inc a pha in S_CurBRSelect:l,#S_ChkCellProtect:l XCall S_QTraverse bcc contRFill Call D_AlertBox,in=(#OkBox:w,#S_ProtectedCellMsg:l),out=(a:w) brl Exit contRFill PushWord TLCell+2 lda TLCell inc a pha Call S_BuildSimpleUndo,in=(:l,S_CurBRSelect:l),err=ErrFlag bcs cantFill in S_CurTLSelect:l,S_CurBRSelect+2:w,S_CurTLSelect:w out S_ScrapBuffer:l XCall S_GetSSScrap,err=ErrFlag bcs cantFill pasteRowLoop inc TLCell MoveLong TLCell,S_ScrapTL Call S_PutSSScrap,err=ErrFlag bcs cantFill CmpWord S_ScrapLeft,LMost bge chkRight1 sta LMost chkRight1 CmpWord S_ScrapRight,RMost blt cont1 sta RMost cont1 CmpWord TLCell,S_CurBRSelect blt pasteRowLoop brl redraw cantFill Call D_MemoryError brl redraw chkFillCols CmpWord S_CurTLSelect+2,S_CurBRSelect+2 jeq Exit ; Call D_SetCursor,in=(#WatchCursor:w) lda TLCell+2 inc a pha PushWord TLCell in S_CurBRSelect:l,#S_ChkCellProtect:l XCall S_QTraverse bcc contCFill Call D_AlertBox,in=(#OkBox:w,#S_ProtectedCellMsg:l),out=(a:w) brl Exit contCFill lda TLCell+2 inc a pha PushWord TLCell Call S_BuildSimpleUndo,in=(:l,S_CurBRSelect:l),err=ErrFlag bcs cantFill2 fillCols in S_CurTLSelect:l,S_CurTLSelect+2:w,S_CurBRSelect:w out S_ScrapBuffer:l XCall S_GetSSScrap,err=ErrFlag bcc pasteColLoop cantFill2 brl cantFill pasteColLoop inc TLCell+2 MoveLong TLCell,S_ScrapTL Call S_PutSSScrap,err=ErrFlag bcs cantFill2 CmpWord S_ScrapLeft,LMost bge chkRight2 sta LMost chkRight2 CmpWord S_ScrapRight,RMost blt cont2 sta RMost cont2 CmpWord TLCell+2,S_CurBRSelect+2 blt pasteColLoop redraw in LMost:w,S_CurTLSelect:w,RMost:w,S_CurBRSelect:w XCall S_RedrawCellRange Call S_SetUndoOn,in=(#S_UndoFillType:w) lda S_CurEditFlag and #S_ManCalcBit bne killHandle Call S_CalculateSheet killHandle lda S_ScrapBuffer ora S_ScrapBuffer+2 beq Exit Tool _DisposeHandle,in=(S_ScrapBuffer:l) Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Eval2.aii b/appleworksgs/SS/Src/Eval2.aii new file mode 100755 index 0000000..097e8fe --- /dev/null +++ b/appleworksgs/SS/Src/Eval2.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_BitMapChanged IMPORT D_BitMapPtr IMPORT D_SetCursor IMPORT S_AddCellToRecalcList IMPORT S_ColLab2Text IMPORT S_CurHeap IMPORT S_GetCellPtr IMPORT S_InsertDependency IMPORT S_RecalcMemError IMPORT S_RemoveDependency IMPORT S_SetCircularBits IMPORT S_UpdatePriorities ;--------------------------------------------------------------------- ; ; S_FormulaData PROC EXPORT EXPORT S_ErrorFormulaLength EXPORT S_NAFormulaLength EXPORT S_INFFormulaLength EXPORT S_NegINFFormulaLength EXPORT S_ErrorFormula EXPORT S_NAFormula EXPORT S_INFFormula EXPORT S_NegINFFormula S_ErrorFormulaLength equ 6 S_NAFormulaLength equ 6 S_INFFormulaLength equ 6 S_NegINFFormulaLength equ 8 S_ErrorFormula DC.B $4,0,$4,0,E_ERRORfToken,0 S_NAFormula DC.B $4,0,$4,0,E_NAfToken,0 S_INFFormula DC.B $4,0,$4,0,E_INFfToken,0 S_NegINFFormula DC.B $4,0,$4,0,E_NegToken,E_InfFToken,E_CalcToken,0 ENDP ;---------------------------------------------------------------------- S_EvalFormula PROC EXPORT ;Using S_CurrentData ;Using S_ErrorData ;Using SANEequs ;Using D_GlobalData input CellIndex:l local CellPtr:l local FormulaPtr:l,ValueStack:l local TypeStack:l,CellFormat:w local StrLen:l,StrPtr:l,Index:l,LookUpFlag:w local Cell:l,ContentIndex:l,OldFormat:w,OldValue:l error ErrFlag BEGIN stz ErrFlag ; Set up calculation stacks ; MoveWord #1,>D_BitMapChanged MoveLong >D_BitMapPtr,ValueStack AddLong #$7000,ValueStack,TypeStack ; Get formula ; H_GetBlockPtr CellIndex,CellPtr MoveLong [CellPtr]:#S_CellID,Cell H_GetBlockPtr [CellPtr]:#S_CellContent,FormulaPtr ; Evaluate formula ; in FormulaPtr:l,ValueStack:l,TypeStack:l in Cell:l XCall E_EvalExpr stx LookUpFlag ; Save the old value ; MoveLong [CellPtr]:#S_CellValue,OldValue MoveWord [CellPtr]:#S_CellFormat,x and #S_CellType sta OldFormat ; Move final result and type into the cell ; txa and #-1-S_CellTypeValue-S_CellError-S_CellInvalid MoveWord a,CellFormat lda [TypeStack] cmp #E_NumType jeq storeNum cmp #E_StrType jeq storeStr cmp #E_EmptyType ; jeq storeEmpty ; store as 0 jeq storeStr ; store as null string cmp #E_NAType beq storeNA ; bra storeErr storeErr lda CellFormat ora #S_CellInvalid+S_CellError+S_CellTypeValue brl doneEval storeNA lda CellFormat ora #S_CellInvalid+S_CellTypeValue brl doneEval ;storeEmpty ; store as 0 ; PushLong #ZeroValue ; AddLong CellPtr,#S_CellValue,s ; Tool FX2X,in=(:l,:l) ; lda CellFormat ; ora #S_CellTypeValue ; brl doneEval storeNum Tool FCLASSX,in=(ValueStack:l) FBSNAN storeErr FBQNAN storeErr PushLong ValueStack AddLong CellPtr,#S_CellValue,s Tool FX2X,in=(:l,:l) lda CellFormat ora #S_CellTypeValue brl doneEval storeStr stz StrLen+2 MoveWord [TypeStack]:#2,StrLen inc StrLen ; allocate space for str + len H_NewBlock StrLen,Index,StrPtr,err=ErrFlag bcc contStoreStr ; Cant allocate enough memory to Save the result, so we'll ; pretend that we haven't calculated it and return error. memError Call D_SetCursor,in=(#ArrowCursor:w) Call D_AlertBox,in=(#OKBox:w,#S_RecalcMemError:l),out=(a:w) Call S_AddCellToRecalcList,in=(Cell:l) brl Exit contStoreStr H_GetBlockPtr CellIndex,CellPtr MoveLong Index,[CellPtr]:#S_CellValue dec StrLen MoveWord StrLen,[StrPtr] IncL StrPtr Tool _BlockMove,in=(ValueStack:l,StrPtr:l,StrLen:l) lda CellFormat doneEval MoveWord a,[CellPtr]:#S_CellFormat ; If previous result was a string, free allocated space ; lda OldFormat and #S_CellTypeValue bne disposed H_DisposeBlock OldValue disposed lda LookUpFlag beq Exit ; This is for the LookUp functions. Circularity may come and ; go with evaluation. (Dynamic Circularity!) MoveLong [CellPtr]:#S_CellContent,ContentIndex Call S_RemoveDependency,in=(Cell:l,ContentIndex:l) H_GetBlockPtr ContentIndex,FormulaPtr Call E_FixCellList,in=(TypeStack:l,FormulaPtr:l) in Cell:l,ContentIndex:l XCall S_InsertDependency,err=ErrFlag jcs memError Call S_SetCircularBits,in=(Cell:l) Call S_UpdatePriorities,in=(Cell:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_GetMinMax( first:l, last:l, which:w): loc:l ; ; first and last are the endpoints of a range, which = 1 for MIN and 0 for MAX ; S_GetMinMax PROC EXPORT ;Using D_GlobalData input first:l,last:l,which:w output loc:l local TypeStack:l BEGIN +b lda which bne DoMax lda #E_MINfToken<<8 bra DoStore DoMax lda #E_MAXfToken<<8 DoStore sta S_MMOp MoveLong first,S_MM1st MoveLong last,S_MMLast MoveWord #1,>D_BitMapChanged AddLong #$7000,>D_BitMapPtr,TypeStack in #S_MinMax:l,>D_BitMapPtr:l,TypeStack:l,#$10001:l XCall E_EvalExpr MoveLong >D_BitMapPtr,loc RETURN S_MinMax DC.B $E,0,$E,0,$8A S_MM1st DS.B 4 DC.B $A S_MMlast DS.B 3 ;<- really 4, but... S_MMOp DS.B 2 ;<- upper byte DC.B E_RangeToken,4,0,E_EndFUNCToken,0 ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/FileIO.aii b/appleworksgs/SS/Src/FileIO.aii new file mode 100755 index 0000000..2c617bc --- /dev/null +++ b/appleworksgs/SS/Src/FileIO.aii @@ -0,0 +1 @@ + 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 version 1.0v1 beq versionOK blt doBadFileError ; File format is of incompatible version. So pop up dialog warn user ; and then exit with error. Call D_AlertBox,in=(#OkBox:w,#S_ErrorBadVersion:l),out=(a:w) MoveWord #-1,ErrorFlag brl ErrExit doBadFileError Call D_AlertBox,in=(#OKBox:w,#S_ErrorBadFile:l),out=(a:w) MoveWord #-1,ErrorFlag doProdosError1 brl ErrExit versionOK Call D_ReadLong2,in=(FileId:w),out=(S_FileSize:l),err=ErrorFlag bcs doProdosError1 lda S_FileSize ora S_FileSize+2 beq doBadFileError MoveWord #1,>D_BitMapChanged MoveLong >D_BitMapPtr,S_FilePtr stz S_FileBufferSize stz S_UsedBufferSize Call S_ReadInMore,err=ErrorFlag bcs doProdosError1 ; Read State values into sheet. in S_FilePtr:l,#S_CurState:l,#S_StateSize:l XTool _BlockMove lda #S_StateSize AddLong a,S_FilePtr,S_FilePtr AddWord #S_StateSize,S_UsedBufferSize,S_UsedBufferSize ; Clear the ChangedList, so that it will remain integral. We will ; load the list off of disk in S_LoadRecalculateList. stz S_CurChangedList stz S_CurChangedList+2 ; Read in the required Heap size. ; MoveLong S_FilePtr,Ptr ; MoveLong [Ptr],HeapSize AddLong #4,S_FilePtr,S_FilePtr AddWord #4,S_UsedBufferSize,S_UsedBufferSize H_NewHeap S_CurHeap,err=ErrorFlag jcs ErrExit stz S_CurRowBlock stz S_CurRowBlock+2 ; Read in the Heap Size and make sure it is available. ; This should speed up the fail time on large spreadsheets. ; No longer implemented. (6/8/89) MRH ; ; lda HeapSize ; ora HeapSize+2 ; beq ldColWds ; ; H_NeedSpace HeapSize,err=ErrorFlag ; bcc ldColWds ; ; brl doProdosError ; Read in the Column Widths. ldColWds Call S_LoadColWds,err=ErrorFlag bcs doProdosError ; Read in the Dependency information. ; Not implemented. ; AddLong #4,S_FilePtr,S_FilePtr AddWord #4,S_UsedBufferSize,S_UsedBufferSize ; Read in the Cells. Call S_LoadCellsIntoSheet,err=ErrorFlag bcs doProdosError Call S_ReadInMore,err=ErrorFlag bcs doProdosError ; Read in the Chart information. in S_FilePtr:l out ChartSize:l XCall S_LoadCharts,err=ErrorFlag bcs doProdosError AddLong S_FilePtr,ChartSize,S_FilePtr AddWord ChartSize,S_UsedBufferSize,S_UsedBufferSize ; Read in the Recalculate List. Call S_LoadRecalculateList,err=ErrorFlag bcc createSheet doProdosError brl ErrExit2 ; Create sheet. createSheet Call S_NewSheet,err=ErrorFlag jcs ErrExit2 ; Calculate all the dependent window values, Create the window ; controls, fill the LineEdit record, set the window's refcon and ; show the window before returning. ; Set up the controls ; MoveWord S_FileRSValue,S_RSValue MoveWord S_FileBSValue,S_BSValue Call S_InsertControls,err=ErrorFlag jcs ErrExit3 Call S_SetMaxTLCell Call S_NormalizeRange,in=(S_CurTLCell:l,S_CurMaxTLCell:l) pla pla PullLong S_CurTLCell ; If adjusted, set globals and control values ; ; and inval the content region. ; lda S_CurTLCell+2 dec a Tool _SetCtlValue,in=(a:w,S_CurBScrl:l) lda S_CurTLCell dec a Tool _SetCtlValue,in=(a:w,S_CurRScrl:l) Call S_ActivateScrlBars ; Were we editing, the current cell ; CmpLong S_CurTLSelect,S_CurBRSelect bne showWindow lda S_CurEditFlag and #-1-S_EditingBit sta S_CurEditFlag in S_CurTLSelect:l out CellIndex:l XCall S_GetCellIndex ora CellIndex beq showWindow in CellIndex:l XCall S_NewLineEdit showWindow Call D_SetRefCon,in=(S_CurSheet:l,Window:l) Call S_SwapOut Tool _ShowWindow,in=(Window:l) bra Exit ErrExit3 Tool _DisposeHandle,in=(S_CurSheet:l) ErrExit2 Call H_DisposeHeap Call S_DisposeRowBlock,in=(S_CurRowBlock:l) ErrExit ; lda ErrorFlag ; this is handled by the driver now. ; and #$FF00 ; cmp #$0200 ; bne Exit ; ; Call D_MemoryError Exit stz S_LoadingFile RETURN ENDP ;-------------------------------------------------------------------------; ; S_SaveDoc (FileId:w,Window:l,Type:w) ; ; S_SaveDoc is called to Save the given window's data to file. ; If type is 0 (Sworks type), a header is already written out to disk. ; Just add your information. ; If type is non-zero then it is Save As of a different file type, and you ; just need to write out the information, as the file is already open. S_SaveDoc PROC EXPORT ;Using D_IOData ;Using D_GlobalData ;Using S_ErrorData ;Using S_CurrentData ;Using S_FileIOData input FileId:w,Window:l,Type:w local FileSizeMark:l,SheetSizeMark:l,ChartSize:l local Ptr:l,HeapSize:l error ErrorFlag BEGIN +b stz ErrorFlag MoveWord FileId,S_FileID Call S_SwapIn,in=(Window:l) ; Based on type of Save call either Save as ascii text or Save as SS. lda Type jne notSWORKS ;>>>>>>>>>>>>>>>>>>>>>>>> Save SWORKS format <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* ; Regular Save goes here. Write out window frame variables and the heap contents. ; ; Write file format version. Call D_WriteWord2,in=(S_FileId:w,#S_FileVersion1v3:w),err=ErrorFlag bcs doProdosError1 ; Save room in file for the file size. Call D_GetMark2,in=(S_FileID:w),out=(FileSizeMark:l),err=ErrorFlag bcc setUpBuffer doProdosError1 brl Exit ; Set up the FileIOData. setUpBuffer MoveWord #1,>D_BitMapChanged stz S_UsedBufferSize stz S_FileSize stz S_FileSize+2 MoveLong >D_BitMapPtr,Ptr MoveLong #0,[Ptr] AddLong #4,Ptr,S_FilePtr MoveWord #4,S_UsedBufferSize ; Write out window frame information. Call S_SetBRMostCell,in=(#0:w) lda #S_BRMostBit trb S_CurEditFlag Tool _GetCtlValue,in=(S_CurRScrl:l),out=(S_FileRSValue:w) Tool _GetCtlValue,in=(S_CurBScrl:l),out=(S_FileBSValue:w) in #S_CurState:l,S_FilePtr:l,#S_StateSize:l XTool _BlockMove lda #S_StateSize AddLong a,S_FilePtr,S_FilePtr AddWord #S_StateSize,S_UsedBufferSize,S_UsedBufferSize ; Write out the required heap size. ; This has been removed for lack of anything better. The heap is no ; longer one large heap, so it is difficult to judge whether the heap size ; has any significance. We will continue to truncate the heap with the ; intent to reduce memory space. (6/8/89) MRH ; stz HeapSize ; stz HeapSize+2 ; ; lda S_CurHeap ; ora S_CurHeap+2 ; beq storeSize Call H_TruncHeap ; Tool _GetHandleSize,in=(S_CurHeap:l),out=(HeapSize:l) storeSize MoveLong S_FilePtr,Ptr ; MoveLong HeapSize,[Ptr] MoveLong #0,[Ptr] ; do this instead! AddLong #4,Ptr,S_FilePtr AddWord #4,S_UsedBufferSize,S_UsedBufferSize ; Write out the Column Widths. Call S_SaveColWds,err=ErrorFlag bcc writeDepend doProdosError2 brl Exit ; Write out Dependency information writeDepend ; Not implemented yet. ; MoveLong S_FilePtr,Ptr MoveLong #0,[Ptr] AddLong #4,S_FilePtr,S_FilePtr AddWord #4,S_UsedBufferSize,S_UsedBufferSize ; Write out the Cells. out SheetSizeMark:l XCall S_SaveCellsFromSheet,err=ErrorFlag bcs doProdosError2 AddLong FileSizeMark,SheetSizeMark,SheetSizeMark Call S_WriteOutMore,err=ErrorFlag bcs doProdosError3 ; Write out the Chart information. in S_FilePtr:l out ChartSize:l XCall S_SaveCharts,err=ErrorFlag bcs doProdosError3 AddLong S_FilePtr,ChartSize,S_FilePtr AddWord ChartSize,S_UsedBufferSize,S_UsedBufferSize ; Write out the Recalculate List. Call S_SaveRecalculateList,err=ErrorFlag bcc doFlush doProdosError3 brl Exit ; Flush everything out to disk. doFlush in S_FileID:w,>D_BitMapPtr:l,#0:w,S_UsedBufferSize:w out ax:l XCall D_Write2,err=ErrorFlag bcs doProdosError3 lda S_UsedBufferSize AddLong a,S_FileSize,S_FileSize ; Plug in the size values. StartOfFile equ 0 Call D_SetMark2,in=(S_FileId:w,#StartOfFile:w,FileSizeMark:l),err=ErrorFlag bcs doProdosError4 PushWord S_FileId SubLong S_FileSize,#4,s Call D_WriteLong2,in=(:w,:l),err=ErrorFlag bcs doProdosError4 Call D_SetMark2,in=(S_FileId:w,#StartOfFile:w,SheetSizeMark:l),err=ErrorFlag bcs doProdosError4 Call D_WriteLong2,in=(S_FileId:w,S_SheetSizeAcc:l),err=ErrorFlag doProdosError4 brl Exit notSWORKS ;>>>>>>>>>>>>>>>>>>>>>>>> Save ASCII format <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<* ; Ascii Save goes here. Put tabs between each cell, and carriage returns ; between each row. ; Save something for each cell in the spreadsheet ; lda S_CurEditFlag and #S_BRMostBit beq BRset Call S_SetBRMostCell,in=(#0:w) lda #S_BRMostBit trb S_CurEditFlag BRset ; Tool _HLock,in=(S_CurHeap:l) MoveWord #1,S_SaveAsciiCell sta S_SaveAsciiCell+2 in a:w,a:w,S_CurBRMost:l,#S_SaveCellAscii:l XCall S_QTraverse,err=ErrorFlag bcs asciiExit Call D_Write2,in=(S_FileID:w,#crChar:l,#1:l),out=(ax:l),err=ErrorFlag asciiExit ; Tool _HUnLock,in=(S_CurHeap:l) Exit RETURN crchar DC.B 13 ENDP ;--------------------------------------------------------------------------- ; ; S_ReadInMore PROC EXPORT ;Using D_IOData ;Using D_GlobalData ;Using S_FileIOData local ShiftSize:l,TempSize:l,ReadSize:l error ErrFlag BEGIN TempPtr equ TempSize stz ErrFlag lda S_FileSize ora S_FileSize+2 jeq Exit lda S_FileBufferSize bne notNewRead stz ShiftSize bra skip1 notNewRead CmpWord S_UsedBufferSize,#$6000 jlt Exit SubWord S_FileBufferSize,S_UsedBufferSize,ShiftSize skip1 stz ShiftSize+2 AddLong ShiftSize,S_FileSize,TempSize CmpLong TempSize,#$8000 blt useFileSize MoveWord #$8000,S_FileBufferSize bra doShift useFileSize MoveWord TempSize,S_FileBufferSize doShift SubWord S_FileBufferSize,ShiftSize,ReadSize stz ReadSize+2 SubLong S_FileSize,ReadSize,S_FileSize lda ShiftSize beq doRead in S_FilePtr:l,>D_BitMapPtr:l,ShiftSize:l XTool _BlockMove doRead stz S_UsedBufferSize MoveLong >D_BitMapPtr,S_FilePtr AddLong >D_BitMapPtr,ShiftSize,TempPtr Call D_Read2,in=(S_FileID:w,TempPtr:l,ReadSize:l),out=(ax:l),err=ErrFlag Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_WriteOutMore PROC EXPORT ;Using D_IOData ;Using D_GlobalData ;Using S_FileIOData local ShiftSize:l error ErrFlag BEGIN stz ErrFlag CmpWord S_UsedBufferSize,#$6000 blt Exit in S_FileID:w,>D_BitMapPtr:l,#0:w,S_UsedBufferSize:w out ax:l XCall D_Write2,err=ErrFlag bcs Exit lda S_UsedBufferSize AddLong a,S_FileSize,S_FileSize stz S_UsedBufferSize MoveLong >D_BitMapPtr,S_FilePtr Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_LoadColWds PROC EXPORT ;Using S_CurrentData ;Using S_FileIOData local Size:w,Ptr:l,WdArray:l error ErrFlag BEGIN stz ErrFlag MoveLong S_FilePtr,Ptr lda [Ptr] sta Size beq wrapUp ldy #0 H_NewBlock ay,S_CurColumnWds,WdArray,err=ErrFlag bcs Exit lda #2 AddLong a,Ptr,s in WdArray:l,#0:w,Size:w XTool _BlockMove wrapUp inc Size inc Size lda Size AddLong a,S_FilePtr,S_FilePtr AddWord Size,S_UsedBufferSize,S_UsedBufferSize Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_SaveColWds PROC EXPORT ;Using S_CurrentData ;Using S_FileIOData local Size:w,Ptr:l,WdArray:l error ErrFlag BEGIN stz ErrFlag MoveLong S_FilePtr,Ptr lda S_CurColumnWds ora S_CurColumnWds+2 bne customized stz Size bra wrapUp customized MoveWord #S_ColWdStructSize,Size H_GetBlockPtr S_CurColumnWds,WdArray PushLong WdArray lda #2 AddLong a,Ptr,s PushWord #0 PushWord Size Tool _BlockMove,in=(:l,:l,:l) wrapUp MoveWord Size,[Ptr] inc Size inc Size lda Size AddLong a,S_FilePtr,S_FilePtr AddWord Size,S_UsedBufferSize,S_UsedBufferSize Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_LoadRecalculateList PROC EXPORT ;Using S_CurrentData ;Using S_FileIOData local Ptr:l error ErrFlag BEGIN stz ErrFlag bra chkEnd loop Call S_ReadInMore,err=ErrFlag bcs Exit setChanged MoveLong S_FilePtr,Ptr Call S_AddCellToChangedList,in=([Ptr]:l) AddLong #4,Ptr,S_FilePtr AddWord #4,S_UsedBufferSize,S_UsedBufferSize chkEnd CmpWord S_UsedBufferSize,S_FileBufferSize bne loop Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_SaveRecalculateList PROC EXPORT ;Using S_CurrentData ;Using S_FileIOData local Ptr:l,Cell:l,CellPtr:l error ErrFlag BEGIN stz ErrFlag lda S_CurChangedList ora S_CurChangedList+2 beq Exit MoveLong S_CurChangedList,Cell loop Call S_WriteOutMore,err=ErrFlag bcs Exit setChanged MoveLong S_FilePtr,Ptr MoveLong Cell,[Ptr] AddLong #4,Ptr,S_FilePtr AddWord #4,S_UsedBufferSize,S_UsedBufferSize in Cell:l out CellPtr:l XCall S_GetCellPtr MoveLong [CellPtr]:#S_CellNext,Cell chkEnd lda Cell and Cell+2 cmp #-1 ; CmpLong Cell,#S_EndOfList bne loop Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_LoadCellsIntoSheet PROC EXPORT ;Using S_CurrentData ;Using S_FileIOData ;Using SANEequs local Ptr:l,CellSize:w,CellsLimit:l,CurCellOffset:l local ValueSize:l,ContentStart:l,ContentSize:l local Cell:l,Format:l,TypeCell:w,ContentIndex:l local ContentPtr:l,CellIndex:l,CellPtr:l error ErrFlag BEGIN stz ErrFlag MoveLong S_FilePtr,Ptr ; MoveWord [Ptr]:#S_FileRows,FileBottom ; MoveWord [Ptr]:#S_FileCols,FileRight MoveLong [Ptr]:#S_FileSheetSize,CellsLimit AddWord #S_FileSheet,S_UsedBufferSize,S_UsedBufferSize AddLong #S_FileSheet,S_FilePtr,S_FilePtr MoveWord #S_FileSheet,CurCellOffset stz CurCellOffset+2 stz ValueSize+2 stz ContentStart+2 stz ContentSize+2 CmpLong CurCellOffset,CellsLimit bge exitBranch2 pasteLoop Call D_BeachBall Call S_ReadInMore,err=ErrFlag bcc loadCell exitBranch2 brl Exit loadCell MoveLong S_FilePtr,Ptr ; Figure cell location ; MoveLong [Ptr]:#S_FileCellLoc,Cell ; Get the content of the cell ; MoveWord [Ptr]:#S_FileValueSize,a and #$00FF sta ValueSize AddWord a,#S_FileValue,ContentStart MoveWord [Ptr]:#S_FileCellSize,CellSize SubWord a,ContentStart,ContentSize ; Get the format and type of the cell ; MoveLong [Ptr]:#S_FileFormat,Format MoveWord Format,a and #S_CellType sta TypeCell ; Get the content of the cell ; cmp #S_CellTypeValue bne getContent stz ContentIndex stz ContentIndex+2 bra createCell getContent H_NewBlock ContentSize,ContentIndex,ContentPtr,err=ErrFlag bcs exitBranch AddLong Ptr,ContentStart,s PushLong ContentPtr PushLong ContentSize Tool _BlockMove ; Get a New cell ; createCell in Cell:l,Format:l,ContentIndex:l out ax:l,ax:l XCall S_AcceptCell,err=ErrFlag bcc storeLastVal exitBranch brl Exit ; Store the last calculated value ; storeLastVal in Cell:l out CellIndex:l XCall S_GetCellIndex H_GetBlockPtr CellIndex,CellPtr lda TypeCell and #S_CellTypeValue beq textInValue ; Store last calculated numeric value ; AddLong Ptr,#S_FileValue,s AddLong CellPtr,#S_CellValue,s Tool FX2X,in=(:l,:l) brl wrapUp ; Value is text. ; textInValue lda TypeCell jeq setValue ;type = Text AddWord ValueSize,#1,ValueSize H_NewBlock ValueSize,ContentIndex,ContentPtr,err=ErrFlag bcc gotSpace ; Remove the created cell, first change it to type value formula H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellFormat,a and #$FFFF-S_CellType ora #S_CellTypeFormula sta [CellPtr],y Call S_RemoveCell,in=(Cell:l) brl Exit gotSpace AddLong Ptr,#S_FileValueSize,s PushLong ContentPtr PushLong ValueSize Tool _BlockMove H_GetBlockPtr CellIndex,CellPtr setValue MoveLong ContentIndex,[CellPtr]:#S_CellValue wrapUp AddWord CellSize,S_UsedBufferSize,S_UsedBufferSize lda CellSize AddLong a,S_FilePtr,S_FilePtr lda CellSize AddLong a,CurCellOffset,CurCellOffset CmpLong CurCellOffset,CellsLimit jlt pasteLoop Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_SaveCellsFromSheet PROC EXPORT ;Using S_CurrentData ;Using S_FileIOData local Ptr:l output SheetSizeMark:l BEGIN AddWord #S_FileSheetSize,S_UsedBufferSize,a AddLong a,S_FileSize,SheetSizeMark MoveLong S_FilePtr,Ptr MoveWord S_CurBRMost,[Ptr]:#S_FileRows MoveWord S_CurBRMost+2,[Ptr]:#S_FileCols stz S_SheetSizeAcc+2 MoveWord #S_FileSheet,S_SheetSizeAcc MoveWord a,[Ptr]:#S_FileSheetSize MoveWord #0,[Ptr]:#S_FileSheetSize+2 AddWord #S_FileSheet,S_UsedBufferSize,S_UsedBufferSize lda #S_FileSheet AddLong a,S_FilePtr,S_FilePtr in #$10001:l,S_CurBRMost:l,#S_GetFileCell:l XCall S_QTraverse RETURN a ENDP ;--------------------------------------------------------------------------- ; S_GetFileCell ; S_GetFileCell PROC EXPORT ;Using S_CurrentData ;Using S_FileIOData ;Using SANEequs input Cell:l,CellIndex:l local Buffer:l,ContentSize:l,CellSize:w local CellPtr:l,ContentPtr:l,Format:l error ErrorFlag BEGIN stz ErrorFlag Call S_WriteOutMore,err=ErrorFlag jcs Exit bufferOK H_GetBlockPtr CellIndex,CellPtr MoveLong [CellPtr]:#S_CellFormat,Format lda Format jmi Exit MoveLong S_FilePtr,Buffer ; Store the location ; MoveLong Cell,[Buffer]:#S_FileCellLoc ; Store the format information ; MoveLong Format,[Buffer]:#S_FileFormat MoveWord #S_FileValueSize,CellSize ; Store the last calculated value ; lda Format and #S_CellTypeValue jne getSane CmpLong [CellPtr]:#S_CellValue,[CellPtr]:#S_CellContent bne getString MoveWord #0,[Buffer]:#S_FileValueSize inc CellSize brl getContent getString H_GetBlockPtr [CellPtr]:#S_CellValue,ContentPtr lda [ContentPtr] and #$00FF inc a sta ContentSize stz ContentSize+2 PushLong ContentPtr AddLong Buffer,#S_FileValueSize,s PushLong ContentSize Tool _BlockMove AddWord ContentSize,CellSize,CellSize bra getContent getSane MoveWord #10,[Buffer]:#S_FileValueSize AddLong CellPtr,#S_CellValue,s AddLong Buffer,#S_FileValue,s Tool FX2X,in=(:l,:l) AddWord #11,CellSize,CellSize ; Store the content of the cell ; getContent H_GetBlockSize [CellPtr]:#S_CellContent,ContentSize lda ContentSize+2 ora ContentSize beq storeSize H_GetBlockPtr [CellPtr]:#S_CellContent,ContentPtr PushLong ContentPtr lda CellSize AddLong a,Buffer,s PushLong ContentSize Tool _BlockMove ; Store the cell size ; storeSize AddWord CellSize,ContentSize,CellSize MoveWord a,[Buffer]:#S_FileCellSize AddWord a,S_UsedBufferSize,S_UsedBufferSize lda CellSize AddLong a,S_FilePtr,S_FilePtr lda CellSize AddLong a,S_SheetSizeAcc,S_SheetSizeAcc Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_SaveCellAscii PROC EXPORT ;Using S_CurrentData ;Using D_IOData input Cell:l,CellIndex:l local CellPtr:l,Format:w,ContentPtr:l error ErrorFlag BEGIN stz ErrorFlag H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellFormat,Format jmi Exit H_GetBlockPtr [CellPtr]:#S_CellContent,ContentPtr lda ContentPtr+2 ora ContentPtr bne chkForm SpaceWord ; pixel length SpaceLong ; string ptr SpaceWord ; color PushWord #$7FFF PushLong #$000F2000 AddLong CellPtr,#S_CellValue,s Call X_FormatValue pla PullLong ContentPtr pla beq chkRow chkForm lda Format and #S_CellTypeTextForm ; test for all formulas beq chkRow doFormula in Cell:l,ContentPtr:l out ContentPtr:l XCall E_ExpandFormula chkRow CmpWord S_SaveAsciiRow,Cell beq chkCol crLoop Call D_Write2,in=(S_FileID:w,#crChar:l,#1:l),out=(ax:l),err=ErrorFlag bcs Exit inc S_SaveAsciiRow CmpWord S_SaveAsciiRow,Cell blt crLoop MoveWord #1,S_SaveAsciiCol chkCol CmpWord S_SaveAsciiCol,Cell+2 beq writeString tabLoop Call D_Write2,in=(S_FileID:w,#tabchar:l,#1:l),out=(ax:l),err=ErrorFlag bcs Exit inc S_SaveAsciiCol CmpWord S_SaveAsciiCol,Cell+2 blt tabLoop writeString SpaceLong PushWord S_FileID AddLong ContentPtr,#1,s PushWord #0 lda [ContentPtr] and #$00FF pha Call D_Write2,err=ErrorFlag ; ,in=(:w,:l,:l),out=(:l) pla pla Exit RETURN tabchar DC.W 9 crchar DC.W 13 EXPORT S_SaveAsciiCell S_SaveAsciiCell S_SaveAsciiRow DS.W 1 S_SaveAsciiCol DS.W 1 ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Format.aii b/appleworksgs/SS/Src/Format.aii new file mode 100755 index 0000000..d0b9050 --- /dev/null +++ b/appleworksgs/SS/Src/Format.aii @@ -0,0 +1 @@ + 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 \ No newline at end of file diff --git a/appleworksgs/SS/Src/Key.aii b/appleworksgs/SS/Src/Key.aii new file mode 100755 index 0000000..21a0cba --- /dev/null +++ b/appleworksgs/SS/Src/Key.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- ; IMPORT KeyPad ; IMPORT appleKey IMPORT S_ActiveWindow IMPORT S_CellWidth IMPORT S_Clear IMPORT S_CurBRSelect IMPORT S_CurBScrl IMPORT S_CurContHt IMPORT S_CurContRect IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurEditFlag IMPORT S_CurLEHandle IMPORT S_CurMaxTLCell IMPORT S_CurRScrl IMPORT S_CurTLCell IMPORT S_CurTLSelect IMPORT S_DoChecks IMPORT S_DrawLocation IMPORT S_EndEdit IMPORT S_GetCellIndex IMPORT S_HiliteCells IMPORT S_NewEditCell IMPORT S_NewLineEdit IMPORT S_SetCurFormat IMPORT S_SetEdittingMenus IMPORT S_SwapIn IMPORT S_Thumb IMPORT S_WhereCell IMPORT S_WhichCell ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_DoPageDown ENTRY S_DoPageLeft ENTRY S_DoPageRight ENTRY S_DoPageUp ENTRY S_PageOver ;-------------------------------------------------------------------------; ; S_KeyDown ( TaskRecordPtr:l ) ; ; S_KeyDown is called by the driver to handle a key down event in the ; currently active window. S_KeyDown PROC EXPORT ;Using S_CurrentData input TaskRecordPtr:l local Key:w,Mods:w,NotArrow:w BEGIN +b stz NotArrow Call S_SwapIn,in=(S_ActiveWindow:l) Tool _SetPort,in=(S_ActiveWindow:l) lda S_CurEditFlag and #S_KeysInactive jne Exit ldy #2 lda [TaskRecordPtr],y and #$00FF sta Key ldy #14 lda [TaskRecordPtr],y sta Mods CmpLong S_CurTLSelect,S_CurBRSelect jne rangeSelected ldx #MaxCellTable lda Key loop cmp CellKeyTable,x beq foundkey dex dex bne loop notfound lda Mods and #appleKey jne Exit lda S_CurEditFlag and #S_EditingBit bne doEdit lda S_CurEditFlag ora #S_EditingBit sta S_CurEditFlag Tool _LEActivate,in=(S_CurLEHandle:l) Tool _LEGetTextLen,in=(S_CurLEHandle:l),out=(x:w) Tool _LESetSelect,in=(#0:w,x:w,S_CurLEHandle:l) Call S_SetCurFormat,in=(S_CurTLSelect:l) Call S_SetEdittingMenus doEdit Tool _LEKey,in=(Key:w,Mods:w,S_CurLEHandle:l) bra Exit foundkey lda Mods and #appleKey bne appledown lda S_CurEditFlag and #S_EditingBit bne editing jsr (CellTable,x) bra Exit editing jsr (CellEdit,x) bra Exit appledown jsr (CellApple,x) bra Exit rangeSelected ldx #MaxRangeTable lda Key Rloop cmp RangeKeyTable,x beq foundRkey dex dex bne Rloop RKeyNotFound bra Exit foundRkey lda Mods and #appleKey bne Rappledown jsr (RangeTable,x) bra Exit Rappledown jsr (RangeApple,x) Exit RETURN ;----------------------------- maxCellTable equ 16 maxRangeTable equ 10 CellKeyTable DC.W 0 DC.W 8 ; left arrow DC.W 21 ; right arrow DC.W 10 ; down arrow DC.W 11 ; up arrow DC.W 13 ; return DC.W 9 ; tab DC.W 27 ; esc DC.W 127 ; delete CellTable DC.W 0 DC.W cellLeft ; left arrow DC.W cellRight ; right arrow DC.W cellDown ; down arrow DC.W cellUp ; up arrow DC.W cellReturn ; return DC.W cellTab ; tab DC.W cellEsc ; esc DC.W rangeDelete ; delete CellEdit DC.W 0 DC.W enterLE ; left arrow DC.W enterLE ; right arrow DC.W cellDown ; down arrow DC.W cellUp ; up arrow DC.W cellReturn ; return DC.W cellTab ; tab DC.W cellEsc ; esc DC.W enterLE ; delete CellApple DC.W 0 DC.W doPageLeft ; apple-left arrow DC.W doPageRight ; apple-right arrow DC.W doPageDown ; apple-down arrow DC.W doPageUp ; apple-up arrow DC.W cellAppleReturn ; apple-return DC.W cellAppleTab ; apple-tab DC.W cellEsc ; esc DC.W nothing ; delete RangeKeyTable DC.W 0 DC.W 8 ; left arrow DC.W 21 ; right arrow DC.W 10 ; down arrow DC.W 11 ; up arrow DC.W 127 ; delete RangeTable DC.W 0 DC.W nothing ; left arrow DC.W nothing ; right arrow DC.W nothing ; down arrow DC.W nothing ; up arrow DC.W rangeDelete ; delete RangeApple DC.W 0 DC.W nothing ; apple-left arrow DC.W nothing ; apple-right arrow DC.W nothing ; apple-down arrow DC.W nothing ; apple-up arrow DC.W nothing ; apple-delete ;--------------------------- nothing rts ;--------------------------- enterLE Tool _LEKey,in=(Key:w,Mods:w,S_CurLEHandle:l) rts ;--------------------------- cellesc lda S_CurEditFlag and #S_EditingBit beq done Call S_EndEdit,in=(#0:w) lda S_CurEditFlag and #-1-S_EditingBit sta S_CurEditFlag Call S_DoChecks done rts ;--------------------------- rangeDelete Call S_Clear rts ;--------------------------- cellAppleTab inc NotArrow cellLeft pha PushWord S_CurTLSelect SubWord S_CurTLSelect+2,#1,3:s bne OKleft lda NotArrow beq Invalid MoveWord #$02BE,3:s ; hex for #ZZ SubWord 1:s,#1,1:s bne OKleft MoveWord #$270F,1:s ; hex for #9999 OKleft Call S_NewEditCell,in=(:l) brl setLocation ;--------------------------- cellTab inc NotArrow cellRight pha PushWord S_CurTLSelect AddWord S_CurTLSelect+2,#1,3:s cmp #$02BF ; hex for #ZZ + 1 blt OKright lda NotArrow beq Invalid MoveWord #1,3:s AddWord 1:s,#1,1:s cmp #$2710 ; hex for 10000 blt OKright MoveWord #1,1:s OKright Call S_NewEditCell,in=(:l) brl setLocation ;--------------------------- Invalid pla pla rts ;--------------------------- cellAppleReturn lda Mods and #KeyPad bne cellEnter inc NotArrow cellUp PushWord S_CurTLSelect+2 SubWord S_CurTLSelect,#1,s bne OKup lda NotArrow beq Invalid MoveWord #$270F,1:s ; hex for #9999 SubWord 3:s,#1,3:s bne OKup MoveWord #$02BE,3:s ; hex for #ZZ OKup Call S_NewEditCell,in=(:l) brl setLocation ;--------------------------- cellReturn lda Mods and #KeyPad bne cellEnter inc NotArrow cellDown PushWord S_CurTLSelect+2 AddWord S_CurTLSelect,#1,s cmp #$2710 ; hex for 10000 blt OKdown lda NotArrow beq Invalid MoveWord #1,1:s AddWord 3:s,#1,3:s cmp #$02BF ; hex for #ZZ + 1 blt OKdown MoveWord #1,3:s OKdown Call S_NewEditCell,in=(:l) bra setLocation ;--------------------------- cellEnter Call S_NewEditCell,in=(S_CurTLSelect:l) bra setLocation ;--------------------------- doPageLeft Call S_PageOver,in=(#S_DoPageLeft:l) bra setLocation doPageRight Call S_PageOver,in=(#S_DoPageRight:l) bra setLocation doPageUp Call S_PageOver,in=(#S_DoPageUp:l) bra setLocation doPageDown Call S_PageOver,in=(#S_DoPageDown:l) setLocation Call S_DoChecks Call S_DrawLocation rts ENDP ;----------------------------------------------------------------------------- ; S_PageOver( ShiftRoutine:l ) ; ; Direction = $0000FFFF means up ; $FFFF0000 left ; $00000001 down ; $00010000 right S_PageOver PROC EXPORT ;Using S_CurrentData input ShiftRoutine:l local NewCell:l local Value:w,Width:w local OldClipRgn:l,Col:w local ErrorFlag:w BEGIN ; The old Cell needs to be accepted, if edited. ; lda S_CurEditFlag and #S_EditingBit beq doShift Call S_EndEdit,in=(#-1:w),err=ErrorFlag jcs Exit clrEdit lda S_CurEditFlag and #-1-S_EditingBit sta S_CurEditFlag ; Bump the window until the New cell is completely in view ; doShift MoveWord ShiftRoutine,CallIt+1 MoveWord ShiftRoutine+1,CallIt+2 SpaceLong callIt Call * PullLong NewCell CmpLong NewCell,S_CurTLSelect jeq Exit ; The Cell is completely in view ; Tool _NewRgn,out=(:l) MoveLong 1:s,OldClipRgn Tool _GetClip,in=(:l) Tool _ClipRect,in=(#S_CurContRect:l) Call S_HiliteCells MoveWord NewCell,S_CurTLSelect sta S_CurBRSelect MoveWord NewCell+2,S_CurTLSelect+2 sta S_CurBRSelect+2 Call S_HiliteCells Tool _SetClip,in=(OldClipRgn:l) Tool _DisposeRgn,in=(OldClipRgn:l) ; The New cell needs to be displayed in the LE field. ; in NewCell:l out :l XCall S_GetCellIndex Call S_NewLineEdit,in=(:l) Exit RETURN ENDP ;------------------------------------------------------------------------ ; ; S_DoPageLeft PROC EXPORT ;Using S_CurrentData output NewCell:l local WorkWidth:w,dh:w BEGIN MoveLong S_CurTLSelect,NewCell Call S_WhereCell,in=(NewCell:l),out=(y:w,y:w,a:w,y:w) tay beq leftSide1 cmp S_CurContXpt beq leftSidePage cmp S_CurContWd bge leftSide1 leftSideHere MoveWord S_CurTLCell+2,NewCell+2 bra doLeftSide leftSide1 SubWord S_CurTLSelect+2,#1,NewCell+2 bne doLeftSide MoveWord #1,NewCell+2 bra doLeftSide leftSidePage SubWord S_CurContWd,S_CurContXpt,WorkWidth stz dh bra cond loop Call S_CellWidth,in=(NewCell+2:w),out=(a:w) AddWord a,dh,a cmp WorkWidth bge full sta dh cond dec NewCell+2 bne loop inc NewCell+2 lda dh beq Exit bra doLeftSide full inc NewCell+2 lda dh bne doLeftSide dec NewCell+2 doLeftSide CmpWord S_CurMaxTLCell+2,NewCell+2 bge setThumb sta NewCell+2 setThumb lda NewCell+2 dec a Tool _SetCtlValue,in=(a:w,S_CurBScrl:l) Call S_Thumb,in=(S_CurBScrl:l) Exit RETURN ENDP ;------------------------------------------------------------------------ ; ; S_DoPageRight PROC EXPORT ;Using S_CurrentData output NewCell:l local WorkWidth:w,dh:w,NewTLCol:l BEGIN MoveLong S_CurTLSelect,NewCell SubWord S_CurContWd,S_CurContXpt,WorkWidth stz dh Call S_WhereCell,in=(NewCell:l),out=(x:w,y:w,a:w,y:w) tay beq rightSide1 cmp S_CurContWd bge rightSide1 cpx S_CurContWd bge rightSidePage rightSideHere in S_CurContWd:w,S_CurContHt:w out NewCell+2:w,a:w,x:w,y:w XCall S_WhichCell cmp #702+1 jlt Exit MoveWord #702,NewCell+2 brl Exit rightSide1 MoveWord NewCell+2,a inc a sta NewTLCol sta NewCell+2 cmp #702+1 blt start1 MoveWord S_CurMaxTLCell+2,NewTLCol MoveWord #702,NewCell+2 brl gotTLCol loop1 sta dh start1 dec NewTLCol beq atZero Call S_CellWidth,in=(NewTLCol:w),out=(a:w) AddWord a,dh,a cmp WorkWidth blt loop1 inc NewTLCol brl gotTLCol atZero inc NewTLCol bra start2 loop2 sta dh inc NewCell+2 start2 Call S_CellWidth,in=(NewCell+2:w),out=(a:w) AddWord a,dh,a cmp WorkWidth blt loop2 bra gotTLCol rightSidePage MoveWord S_CurTLSelect+2,NewTLCol cmp S_CurMaxTLCell+2 blt pageCond MoveWord S_CurMaxTLCell+2,NewTLCol bra pageCond pageLoop inc NewCell+2 Call S_CellWidth,in=(NewCell+2:w),out=(a:w) AddWord a,dh,a cmp WorkWidth bge full sta dh pageCond CmpWord NewCell+2,#702 bne pageLoop bra gotTLCol full dec NewCell+2 lda dh bne gotTLCol inc NewCell+2 gotTLCol lda NewTLCol dec a Tool _SetCtlValue,in=(a:w,S_CurBScrl:l) Call S_Thumb,in=(S_CurBScrl:l) Exit RETURN ENDP ;------------------------------------------------------------------------ ; ; S_DoPageUp PROC EXPORT ;Using S_CurrentData output NewCell:l local WorkHeight:w,dv:w BEGIN MoveLong S_CurTLSelect,NewCell Call S_WhereCell,in=(NewCell:l),out=(y:w,y:w,y:w,a:w) tax beq up1 cmp S_CurContYpt beq upPage cmp S_CurContHt bge up1 upHere MoveWord S_CurTLCell,NewCell bra doUp up1 SubWord S_CurTLSelect,#1,NewCell bne doUp MoveWord #1,NewCell bra doUp upPage SubWord S_CurContHt,S_CurContYpt,WorkHeight stz dv bra cond loop AddWord #S_RowHeight,dv,a cmp WorkHeight bge full sta dv cond dec NewCell bne loop inc NewCell lda dv beq Exit bra doUp full inc NewCell lda dv bne doUp dec NewCell doUp CmpWord S_CurMaxTLCell,NewCell bge setThumb sta NewCell setThumb lda NewCell dec a Tool _SetCtlValue,in=(a:w,S_CurRScrl:l) Call S_Thumb,in=(S_CurRScrl:l) Exit RETURN ENDP ;------------------------------------------------------------------------ ; ; S_DoPageDown PROC EXPORT ;Using S_CurrentData output NewCell:l local WorkHeight:w,dv:w,NewTLRow:l BEGIN MoveLong S_CurTLSelect,NewCell SubWord S_CurContHt,S_CurContYpt,WorkHeight stz dv Call S_WhereCell,in=(NewCell:l),out=(y:w,x:w,y:w,a:w) tay beq down1 cmp S_CurContHt bge down1 cpx S_CurContHt bge downPage downHere in S_CurContWd:w,S_CurContHt:w out x:w,NewCell:w,x:w,y:w XCall S_WhichCell cmp #9999+1 jlt Exit MoveWord #9999,NewCell brl Exit down1 MoveWord NewCell,a inc a sta NewTLRow sta NewCell cmp #9999+1 blt start1 MoveWord S_CurMaxTLCell,NewTLRow MoveWord #9999,NewCell brl gotTLRow loop1 sta dv start1 dec NewTLRow beq atZero AddWord #S_RowHeight,dv,a cmp WorkHeight blt loop1 inc NewTLRow brl gotTLRow atZero inc NewTLRow bra start2 loop2 sta dv inc NewCell start2 AddWord #S_RowHeight,dv,a cmp WorkHeight blt loop2 bra gotTLRow downPage MoveWord S_CurTLSelect,NewTLRow cmp S_CurMaxTLCell blt pageCond MoveWord S_CurMaxTLCell,NewTLRow bra pageCond pageLoop inc NewCell AddWord #S_RowHeight,dv,a cmp WorkHeight bge full sta dv pageCond CmpWord NewCell,#9999 bne pageLoop bra gotTLRow full dec NewCell lda dv bne gotTLRow inc NewCell gotTLRow lda NewTLRow dec a Tool _SetCtlValue,in=(a:w,S_CurRScrl:l) Call S_Thumb,in=(S_CurRScrl:l) Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Misc.aii b/appleworksgs/SS/Src/Misc.aii new file mode 100755 index 0000000..f86aa35 --- /dev/null +++ b/appleworksgs/SS/Src/Misc.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_BeachBall IMPORT D_DisableMItems IMPORT D_EnableMItems IMPORT D_FastMult IMPORT D_GetRefCon IMPORT D_GrowHandle IMPORT D_NeedHandle IMPORT D_NewCtl IMPORT D_SetCursor IMPORT D_SetFileChanged IMPORT X_FormatValue IMPORT S_ActivateScrlBars IMPORT S_ActiveWindow IMPORT S_AdjustTitleOffset IMPORT S_AworksMemError IMPORT S_BSRect IMPORT S_BScrollTemp IMPORT S_BuildColWdUndo IMPORT S_CalcAutoStr IMPORT S_ColLabRect IMPORT S_CurBRMost IMPORT S_CurBRSelect IMPORT S_CurBRTitle IMPORT S_CurBScrl IMPORT S_CurChangedList IMPORT S_CurChartCount IMPORT S_CurChartList IMPORT S_CurColumnWds IMPORT S_CurContHt IMPORT S_CurContRect IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurCopySize IMPORT S_CurDefColWd IMPORT S_CurDefFormat IMPORT S_CurEditFlag IMPORT S_CurFormat IMPORT S_CurGrow IMPORT S_CurHeap IMPORT S_CurLEHandle IMPORT S_CurMaxTLCell IMPORT S_CurRScrl IMPORT S_CurRowBlock IMPORT S_CurSheet IMPORT S_CurSheetInfo IMPORT S_CurTLCell IMPORT S_CurTLSelect IMPORT S_CurTLTitle IMPORT S_CurTwiceVertLines IMPORT S_CurVPageSize IMPORT S_CurVertLineHandSize IMPORT S_CurVertLines IMPORT S_CurWindow IMPORT S_GetCellPtr IMPORT S_GetCellTableEntry IMPORT S_GrowRect IMPORT S_GrowTemp IMPORT S_InsertLeftPadCells IMPORT S_InsertRightPadCells IMPORT S_LEDestRect IMPORT S_LEViewRect IMPORT S_NormalizeRange IMPORT S_RSRect IMPORT S_RSViewSize IMPORT S_RScrollTemp IMPORT S_RemovePadCells IMPORT S_ResetCircularBits IMPORT S_RowLabRect IMPORT S_ScrlUpdate IMPORT S_SetUndoOff IMPORT S_SheetSize IMPORT S_ViewDataStr ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_FixPadCells ENTRY S_QTraverse ENTRY S_SetCellWidth ENTRY S_SwapOut ENTRY S_WhereCell ;--------------------------------------------------------------------------- ; S_CellWidth( Col:w ): Width:w ; ; This routine gets the width of a given cell in the current sheet. S_CellWidth PROC EXPORT ;Using S_CurrentData input Col:w output Width:w local WdArray:l error DefaultFlag BEGIN stz DefaultFlag lda S_CurColumnWds ora S_CurColumnWds+2 beq getDefault H_GetBlockPtr S_CurColumnWds,WdArray ldy Col lda [WdArray],y and #$00FF beq getDefault asl a asl a sta Width bra Exit getDefault MoveWord S_CurDefColWd,Width inc DefaultFlag Exit RETURN ENDP ;-------------------------------------------------------------------------- ; ; S_ChangeColWidth PROC EXPORT input Col:w,NewWidth:w local OldWidth:w error ErrFlag BEGIN stz ErrFlag Call S_BuildColWdUndo,in=(Col:w),err=ErrFlag bcs Exit Call S_CellWidth,in=(Col:w),out=(OldWidth:w) Call S_SetCellWidth,in=(Col:w,NewWidth:w),err=ErrFlag bcs Exit CmpWord OldWidth,NewWidth beq Exit Call S_AdjustTitleOffset in Col:w,#1:w,Col:w,#9999:w,#S_FixPadCells:l XCall S_QTraverse,err=ErrFlag Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_ChangeDef PROC EXPORT input Cell:l error ErrorFlag BEGIN stz ErrorFlag Call S_CellWidth,in=(Cell+2:w),out=(a:w) bcc Exit in Cell+2:w,#1:w,Cell+2:w,#9999:w,#S_FixPadCells:l XCall S_QTraverse,err=ErrorFlag Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_ColLab2Text ( Cell:a ) Text:a ; ; Input, an internal column number, is passed in the a-register, ; and output, a text form of the corsponding column, is returned in ; the a-register. S_ColLab2Text PROC EXPORT BEGIN dec a Tool _UDivide,in=(a:w,#26:w),out=(:w,:w) pla ; quotient beq OneChar xba ora 1,s ; remainder inc a xba ora #$4040 plx ; remainder bra Exit OneChar pla ; remainder inc a xba ora #$4020 Exit RETURN ENDP ;------------------------------------------------------------------------- ; S_CopyIn ; S_CopyIn PROC EXPORT ;Using S_CurrentData input DestPtr:l BEGIN in #S_CurWindow:l,DestPtr:l,#S_CurCopySize:l XTool _BlockMove RETURN ENDP ;------------------------------------------------------------------------- ; S_CopyOut ; S_CopyOut PROC EXPORT ;Using S_CurrentData input SrcPtr:l BEGIN in SrcPtr:l,#S_CurWindow:l,#S_CurCopySize:l XTool _BlockMove RETURN ENDP ;------------------------------------------------------------------------- ; S_FindRect ; S_FindRect PROC EXPORT ;Using S_CurrentData output TLCell:l,BRCell:l,Rect:r BEGIN PushLong TLCell PushLong BRCell Call S_NormalizeRange PullLong BRCell PullLong TLCell in TLCell:l out :w,:w,:w,:w XCall S_WhereCell pla bne OK1 lda S_CurContYpt OK1 sta Rect chk2 pla bne OK2 lda S_CurContXpt OK2 sta Rect+2 cont pla pla in BRCell:l out Rect+4:l,a:w,a:w XCall S_WhereCell RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_FixPadCells PROC EXPORT input Cell:l,CellIndex:l error ErrFlag BEGIN stz ErrFlag ; I believe we could do some checks to see if all this is ; necessary. in Cell:l out ax:l,ax:l XCall S_RemovePadCells,err=ErrFlag bcs Exit in Cell:l out ax:l XCall S_InsertLeftPadCells,err=ErrFlag bcs Exit in Cell:l out ax:l XCall S_InsertRightPadCells,err=ErrFlag Exit RETURN ENDP ;------------------------------------------------------------------------- ; ; S_InitState PROC EXPORT ;Using S_CurrentData error ErrorFlag BEGIN H_NewHeap S_CurHeap,err=ErrorFlag jcs Exit ; Initialize all of the sheet fields ; MoveWord #1,S_CurTLCell MoveWord a,S_CurTLSelect MoveWord a,S_CurBRSelect MoveWord a,S_CurBRMost MoveWord a,S_CurTLCell+2 MoveWord a,S_CurTLSelect+2 MoveWord a,S_CurBRSelect+2 MoveWord a,S_CurBRMost+2 MoveWord #9988,S_CurMaxTLCell ; TLRow = 9989 MoveWord #$2B9,S_CurMaxTLCell+2 ; TLCol = ZU MoveWord #S_EditHeight+S_ColLabelHeight,S_CurContYPt MoveWord #S_NumLabelWidth,S_CurContXPt lda #0 MoveWord a,S_CurTLTitle MoveWord a,S_CurTLTitle+2 MoveWord a,S_CurBRTitle MoveWord a,S_CurBRTitle+2 MoveWord a,S_CurRowBlock MoveWord a,S_CurRowBlock+2 MoveWord a,S_CurChartCount MoveWord a,S_CurChartList MoveWord a,S_CurChartList+2 MoveWord a,S_CurChangedList MoveWord a,S_CurChangedList+2 MoveWord a,S_CurColumnWds MoveWord a,S_CurColumnWds+2 MoveWord a,S_CurEditFlag MoveWord #S_DefaultColWd,S_CurDefColWd MoveLong #S_DefDefFormat,S_CurDefFormat ; MoveWord #S_DefDefFormat,S_CurDefFormat ; MoveWord #^S_DefDefFormat,S_CurDefFormat+2 MoveWord S_CurContYpt,S_RowLabRect MoveWord S_CurContXpt,S_ColLabRect+2 Exit RETURN ENDP ;---------------------------------------------------------------------------- ; S_InsertControls ; ; This routine calculates the size of the scroll bars to be made and inserts ; them into the window. This routine also set the sheet's content sizes. S_InsertControls PROC EXPORT ;Using S_CurrentData ;Using S_WindowData local Rect:r error ErrFlag BEGIN stz ErrFlag ; Set the control rects to the appropriate values ; also set the sheet's content sizes. Tool _GetPortRect,in=(!Rect:l) MoveWord #S_EditHeight+1,S_RSRect MoveWord #-2,S_BSRect+2 lda Rect+4 inc a sta S_BSRect+4 sta S_GrowRect+4 SubWord a,#S_GrowHeight+1,S_BSRect sta S_GrowRect sta S_CurContHt inc a sta S_RSRect+4 lda Rect+6 inc a inc a sta S_RSRect+6 sta S_GrowRect+6 SubWord a,#S_GrowWidth+1,S_RSRect+2 sta S_GrowRect+2 sta S_CurContWd inc a inc a sta S_BSRect+6 ; Determine the ViewSizes of the right scroll bar SpaceWord SpaceWord SubWord S_GrowRect,S_CurContYpt,s PushWord #S_RowHeight Tool _UDivide pla sta S_CurVPageSize inc a sta S_RSViewSize pla ; Create the controls in #S_RScrollTemp:l,S_CurWindow:l out S_CurRScrl:l XCall D_NewCtl in #S_BScrollTemp:l,S_CurWindow:l out S_CurBScrl:l XCall D_NewCtl in #S_GrowTemp:l,S_CurWindow:l out S_CurGrow:l XCall D_NewCtl MoveWord S_CurContHt,S_RowLabRect+4 MoveWord S_CurContWd,S_ColLabRect+6 RETURN ENDP ;-------------------------------------------------------------------------- ; ; S_IsCellCircular PROC EXPORT input Cell:l local CellPtr:l error ErrFlag BEGIN stz ErrFlag in Cell:l out CellPtr:l XCall S_GetCellPtr ora CellPtr beq Exit MoveWord [CellPtr]:#S_CellFormat+2,a and #S_CellCircular sta ErrFlag Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_LoadAWorksInfo PROC EXPORT ;Using S_CurrentData ;Using S_AttrData ;Using S_ErrorData input MesgHdl:l local Message:l,Pos:w,Col:w,UpdateRgn:l error ErrFlag BEGIN stz ErrFlag MoveLong [MesgHdl],Message MoveWord [Message]:#16,a bne recalcSet lda S_CurEditFlag ora #S_ManCalcBit sta S_CurEditFlag Tool _SetMItemName,in=(#S_CalcAutoStr:l,#S_CalculateItem:w) Call D_EnableMItems,in=(#S_RecalcMI:w,#5:w) recalcSet MoveWord [Message]:#18,a beq showSet lda S_CurEditFlag ora #S_ViewFormulaBit sta S_CurEditFlag Tool _SetMItemName,in=(#S_ViewDataStr:l,#S_ViewItem:w) showSet MoveLong [Message]:#20,S_CurDefFormat ; Set the column widths ; MoveWord #24-2,Pos MoveWord #1-1,Col loop MoveLong [MesgHdl],Message inc Pos inc Pos lda Col inc a cmp #128 bge done sta Col MoveWord [Message]:Pos,a cmp #S_MinCellWidth blt setMin cmp #S_MaxCellWidth blt setWidth lda #S_MaxCellWidth bra setWidth setMin lda #S_MinCellWidth setWidth tax Call S_ChangeColWidth,in=(Col:w,x:w),err=ErrFlag bcs memError Call D_BeachBall bra loop memError Call D_SetCursor,in=(#ArrowCursor:w) Call D_AlertBox,in=(#OKBox:w,#S_AworksMemError:l),out=(a:w) done MoveLong [MesgHdl],Message MoveWord [Message]:#8,S_CurTLTitle MoveWord [Message]:#10,S_CurBRTitle MoveWord [Message]:#12,S_CurTLTitle+2 MoveWord [Message]:#14,S_CurBRTitle+2 Call S_AdjustTitleOffset Call S_ActivateScrlBars Tool _NewRgn,out=(UpdateRgn:l) Tool _RectRgn,in=(UpdateRgn:l,#S_CurContRect:l) Tool _EraseRect,in=(#S_CurContRect:l) Call S_ScrlUpdate,in=(UpdateRgn:l) Tool _DisposeRgn,in=(UpdateRgn:l) ; MoveLong [MesgHdl],Message ; MoveLong [Message],S_CurTLCell Call D_SetFileChanged,in=(S_CurWindow:l) RETURN ENDP ;----------------------------------------------------------------------------- ; S_NewSheet() ; ; At the moment this routine does nothing more than allocate the required ; space for a New spreadsheet, and then lock it down. S_NewSheet PROC EXPORT ;Using S_CurrentData error ErrorFlag BEGIN stz ErrorFlag in #S_SheetSize:l,#0:w out S_CurSheet:l XCall D_NeedHandle,err=ErrorFlag jcs Exit in #S_LEDestRect:l,#S_LEViewRect:l,#255:w out S_CurLEHandle:l XTool _LENew,err=ErrorFlag bcc Exit Exit2 Tool _DisposeHandle,in=(S_CurSheet:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_QRTraverseTable (TLCell:l,BRCell:l,Routine:l) ; ; This routine traverses the range in the reverse order of QTraverseTable. ; The last cell of the last row is operated on first, and so on. The TraverseTable ; routines will invoke calls on any entry in the CellTable, while the QTraverse ; routine only calls real cells. TraverseRange invokes calls on all cells in the ; range. S_QRTraverseTable PROC EXPORT ;Using S_CurrentData input FCol:w,FRow:w,LCol:w,LRow:w,Routine:l local CurCol:w,RowIndex:l,RowPtr:l local ColOffset:w,ColIndex:l local RowBlock:l,RowBlockPtr:l,RowOffset:w error ErrorFlag BEGIN +b stz ErrorFlag lda #Callit+1 MoveWord RoutinePtr+1,>Callit+2 Call D_BeachBall PushWord FCol PushWord FRow Callit jsl * sta ErrorFlag bcs Exit CmpWord FCol,LCol blt loop1 CmpWord FRow,LRow blt loop2 Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_WhereCell ; S_WhereCell PROC EXPORT ;Using S_CurrentData input Cell:l output Rect:r local Temp:l BEGIN stz Rect stz Rect+2 stz Rect+4 stz Rect+6 MoveLong S_CurTLCell,Temp CmpWord Cell+2,S_CurTLCell+2 ; compare the columns blt CalcY MoveWord S_CurContXpt,Rect+2 loop CmpWord Temp+2,Cell+2 beq gotX Call S_CellWidth,in=(Temp+2:w),out=(a:w) inc Temp+2 AddWord a,Rect+2,Rect+2 cmp S_CurContWd bge OffRight bra loop gotX Call S_CellWidth,in=(Cell+2:w),out=(a:w) AddWord a,Rect+2,Rect+6 bra CalcY OffRight MoveWord S_CurContWd,Rect+2 sta Rect+6 CalcY SubWord Cell,Temp,a ; compare the rows blt Exit tax ldy #S_RowHeight Call D_FastMult sta Temp AddWord a,S_CurContYpt,Rect AddWord a,#S_RowHeight,Rect+4 CmpWord S_CurContHt,Rect bge Exit OffBottom sta Rect sta Rect+4 Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_WhichCell(Xin:w,Yin:w): Cell:l,Xout:w,Yout:w ; ; This routine determines which cell a given point is in. It also returns ; the point found in the upper left corner of the cell. S_WhichCell PROC EXPORT ;Using S_CurrentData input Xin:w,Yin:w output Cell:l,Xout:w,Yout:w BEGIN ; Start with the TLCell ; MoveWord S_CurContXpt,Xout MoveWord S_CurContYpt,Yout MoveLong S_CurTLCell,Cell ; Determine which column the point is in. ; bra start1 loop1 sta Xout inc Cell+2 start1 Call S_CellWidth,in=(Cell+2:w),out=(a:w) AddWord a,Xout,a cmp Xin bge done1 ldy Cell+2 cpy #$02BF blt loop1 done1 ; Determine which row the point is in. ; ldy Cell bra start2 loop2 sta Yout iny start2 AddWord #S_RowHeight,Yout,a cmp Yin bge done2 cpy #10000 blt loop2 done2 sty Cell RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Misc2.aii b/appleworksgs/SS/Src/Misc2.aii new file mode 100755 index 0000000..d745684 --- /dev/null +++ b/appleworksgs/SS/Src/Misc2.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_FastMult IMPORT S_CellWidth IMPORT S_ColLab2Text IMPORT S_QTraverseTable ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_InRange ;------------------------------------------------------------------------- ; S_AdjustCell ; S_AdjustCell PROC EXPORT output Cell:l,Xpt:w,Ypt:w ; these are both input BEGIN ; and output CmpWord Cell,#10000 blt OK1 MoveWord #9999,Cell SubWord Ypt,#S_RowHeight,Ypt OK1 CmpWord Cell+2,#$02BF blt OK2 MoveWord #$02BE,Cell+2 Call S_CellWidth,in=(Cell+2:w),out=(:w) SubWord Xpt,s,Xpt OK2 RETURN ENDP ;--------------------------------------------------------------------------- ; S_AdjustPoint ; S_AdjustPoint PROC EXPORT output Xpt:w,Ypt:w BEGIN lda Ypt bpl OKy stz Ypt OKy lda Xpt bpl Exit stz Xpt Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_Cell2Str ; S_Cell2Str PROC EXPORT input ptr:l,cell:l local offset:w,length:w begin moveword #0,[ptr] moveword #1,offset rcall S_ColLab2Text,in=(cell+2:a),out=([ptr]:#1:a) and #$00FF cmp #$0020 ; space bne Cont1 dec offset lda [ptr],y xba sta [ptr],y Cont1 inc offset inc offset moveword #1,length cmpw cell,#10 blt GotLength inc length cmp #100 blt GotLength inc length cmp #1000 blt GotLength inc length GotLength pushword cell lda offset addlong a,ptr,s pushword length pushword #0 _Int2Dec addword length,offset,a dec a ora [ptr] sta [ptr] return ENDP ;------------------------------------------------------------------------ ; ; S_DisposeRowBlock PROC EXPORT input RowBlock:l local RowPtr:l,RowOffset:w,RowHandle:l BEGIN lda RowBlock ora RowBlock+2 beq Exit MoveLong [RowBlock],RowPtr SubWord [RowPtr]:#S_KeyMax,[RowPtr]:#S_KeyMin,a asl a asl a AddWord a,#S_KeyArray,RowOffset loop SubWord RowOffset,#4,RowOffset cmp #S_KeyArray blt killRowBlock tay MoveLong [RowPtr]:y,RowHandle ora RowHandle beq loop Tool _DisposeHandle,in=(RowHandle:l) bra loop killRowBlock Tool _DisposeHandle,in=(RowBlock:l) Exit RETURN ENDP ;------------------------------------------------------------------------ ; ; S_GetDestCellRanges PROC EXPORT input OrigTL:l,OrigBR:l,DestTL:l,DestBR:l output Range1TL:l,Range1BR:l,Range2TL:l,Range2BR:l local JumpIndex:w BEGIN DestTop equ DestTL DestLeft equ DestTL+2 DestBottom equ DestBR DestRight equ DestBR+2 Range1Top equ Range1TL Range1Left equ Range1TL+2 Range1Bottom equ Range1BR Range1Right equ Range1BR+2 Range2Top equ Range2TL Range2Left equ Range2TL+2 Range2Bottom equ Range2BR Range2Right equ Range2BR+2 stz JumpIndex stzl Range1TL stzl Range1BR stzl Range2TL stzl Range2BR in OrigTL:l,OrigBR:l,DestLeft:w,DestTop:w out a:w XCall S_InRange beq OK1 lda #2 tsb JumpIndex OK1 in OrigTL:l,OrigBR:l,DestRight:w,DestBottom:w out a:w XCall S_InRange beq OK2 lda #4 tsb JumpIndex OK2 in OrigTL:l,OrigBR:l,DestRight:w,DestTop:w out a:w XCall S_InRange beq OK3 lda #8 tsb JumpIndex OK3 in OrigTL:l,OrigBR:l,DestLeft:w,DestBottom:w out a:w XCall S_InRange beq OK4 lda #16 tsb JumpIndex OK4 ldx JumpIndex jmp (JumpTable,x) Index4 MoveWord OrigTL,Range2Top MoveWord DestLeft,Range2Left MoveWord DestBottom,Range2Bottom lda OrigTL+2 dec a sta Range2Right Index20 MoveWord DestTop,Range1Top MoveWord DestLeft,Range1Left lda OrigTL dec a sta Range1Bottom MoveWord DestRight,Range1Right brl Exit Index16 MoveWord DestTop,Range2Top MoveWord DestLeft,Range2Left lda OrigTL dec a sta Range2Bottom MoveWord DestRight,Range2Right Index18 MoveWord OrigTL,Range1Top lda OrigBR+2 inc a sta Range1Left MoveWord DestBottom,Range1Bottom MoveWord DestRight,Range1Right brl Exit Index2 MoveWord DestTop,Range2Top lda OrigBR+2 inc a sta Range2Left MoveWord DestBottom,Range1Bottom MoveWord DestRight,Range1Right Index10 lda OrigBR inc a sta Range1Top MoveWord DestLeft,Range1Left MoveWord DestBottom,Range1Bottom MoveWord DestRight,Range1Right brl Exit Index8 lda OrigBR inc a sta Range2Top MoveWord DestLeft,Range2Left MoveWord DestBottom,Range2Bottom MoveWord DestRight,Range2Right Index12 MoveWord DestTop,Range1Top MoveWord DestLeft,Range1Left MoveWord DestBottom,Range1Bottom lda OrigTL+2 dec a sta Range1Right bra Exit Index0 MoveWord DestTop,Range1Top MoveWord DestLeft,Range1Left MoveWord DestBottom,Range1Bottom MoveWord DestRight,Range1Right ErrorIndex Exit RETURN JumpTable DC.W Index0 ; The corner assignments are DC.W Index2 DC.W Index4 ; ------------- DC.W ErrorIndex ; | 2 8 | DC.W Index8 ; | | DC.W Index10 ; | | DC.W Index12 ; | | DC.W ErrorIndex ; | 16 4 | DC.W Index16 ; ------------- DC.W Index18 DC.W Index20 ; This is the destination region DC.W ErrorIndex DC.W ErrorIndex DC.W ErrorIndex DC.W ErrorIndex DC.W Exit ; dest equals src ENDP ;---------------------------------------------------------------------- ; ; S_GetRealCell PROC EXPORT input RefCell:l,RefByte:w,CallingCell:l output RealCell:l BEGIN CmpLong RefCell,#S_NotACell bne isACell MoveLong RefCell,RealCell brl Exit isACell MoveWord RefCell,RealCell ; set row lda RefByte and #$0003 beq doNegRow cmp #2 bge getCol AddWord CallingCell,RealCell,RealCell bra getCol doNegRow SubWord CallingCell,RealCell,RealCell getCol ; set col MoveWord RefCell+2,RealCell+2 lda RefByte and #$000C beq doNegCol cmp #8 bge Exit AddWord CallingCell+2,RealCell+2,RealCell+2 bra Exit doNegCol SubWord CallingCell+2,RealCell+2,RealCell+2 Exit RETURN ENDP ;-------------------------------------------------------------------------- ; ; S_GetRefCell PROC EXPORT input CallingCell:l output RefCell:l,RefByte:w ; in/out parms BEGIN CmpLong RefCell,#S_NotACell beq Exit ; Adjust Row and Col for relative references, if necessary ; lda RefByte and #E_RefAbsAbs+$0080 sta RefByte and #E_RefAbsNeg bne ColOK CmpWord CallingCell+2,RefCell+2 blt posCol SubWord a,RefCell+2,RefCell+2 bra ColOK posCol SubWord RefCell+2,CallingCell+2,RefCell+2 lda #E_RefPosNeg ora RefByte sta RefByte ColOK lda RefByte and #E_RefNegAbs bne RowOK CmpWord CallingCell,RefCell blt posRow SubWord a,RefCell,RefCell bra RowOK posRow SubWord RefCell,CallingCell,RefCell lda #E_RefNegPos ora RefByte sta RefByte RowOK Exit RETURN ENDP ;------------------------------------------------------------------------ ; ; S_InRange PROC EXPORT input Cell1:l,Cell2:l,TestCell:l output Answer:w BEGIN stz Answer lda TestCell cmp Cell1 blt chkGERow2 beq OKRow cmp Cell2 blt OKRow beq OKRow bra Exit chkGERow2 cmp Cell2 blt Exit OKRow lda TestCell+2 cmp Cell1+2 blt chkGECol2 beq OKCol cmp Cell2+2 blt OKCol beq OKCol bra Exit chkGECol2 cmp Cell2+2 blt Exit OKCol inc Answer Exit RETURN ENDP ;----------------------------------------------------------------------------- ; S_NormalizeRange ( TLCell:l,BRCell:l ) ; ; These are input/output parameters! S_NormalizeRange PROC EXPORT output TLCell:l,BRCell:l BEGIN CmpWord TLCell+2,BRCell+2 ; compare the cols only blt doTop ldy BRCell+2 sty TLCell+2 sta BRCell+2 doTop CmpWord TLCell,BRCell ; compare the rows only blt Exit ldy BRCell sty TLCell sta BRCell Exit RETURN ENDP ;------------------------------------------------------------------------ ; ; S_SectRange PROC EXPORT input Range1Ptr:l,Range2Ptr:l,SectRangePtr:l output RangeValid:w BEGIN MoveWord #1,RangeValid ; Find Top ; CmpWord [Range1Ptr],[Range2Ptr] bge setTop lda [Range2Ptr] setTop sta [SectRangePtr] ; Find Left ; ldy #2 CmpWord [Range1Ptr]:y,[Range2Ptr]:y bge setLeft lda [Range2Ptr],y setLeft sta [SectRangePtr],y ; Find Bottom ; ldy #4 CmpWord [Range1Ptr]:y,[Range2Ptr]:y blt setBottom lda [Range2Ptr],y setBottom sta [SectRangePtr],y ; Find Right ; ldy #6 CmpWord [Range1Ptr]:y,[Range2Ptr]:y blt setRight lda [Range2Ptr],y setRight sta [SectRangePtr],y ; Compare if valid range ; lda [SectRangePtr],y ldy #2 cmp [SectRangePtr],y bge ColOK lda #0 sta RangeValid sta [SectRangePtr],y ldy #6 sta [SectRangePtr],y ColOK ldy #4 lda [SectRangePtr],y cmp [SectRangePtr] bge Exit lda #0 sta RangeValid sta [SectRangePtr],y sta [SectRangePtr] Exit RETURN ENDP ;--------------------------------------------------------------------- ; ; S_Text2Cell PROC EXPORT input TextPtr:l,Size:w output CellID:l local Len:w,Index:w,LLimit:w error ErrorFlag BEGIN stz ErrorFlag ; Get Column ; ldy #0 stz Len short colLoop cpy Size bge doneColLoop lda [TextPtr],y cmp #$41 ; hex for 'A' blt doneColLoop and #$DF ; make Upper case cmp #$5B ; hex for ('Z' + 1) bge doneColLoop sta [TextPtr],y iny inc Len bra colLoop doneColLoop long sty Index stz CellID+2 ; Check if it can be cell ; lda Len jeq noGood cmp #3 ; no cell col is 3 long bge noGood cmp #2 beq twoChars lda [TextPtr] and #$00FF SubWord a,#$0040,a ; hex for 'A' - 1 = '@' bra oneChar twoChars SubWord [TextPtr],#$4040,a ; hex for '@@' pha and #$00FF tax ldy #26 Call D_FastMult sta CellID+2 pla xba and #$00FF oneChar AddWord a,CellID+2,CellID+2 ; Get Row ; ldy Index stz Len short MoveWord #'1',LLimit rowLoop cpy Size bge doneRowLoop lda [TextPtr],y cmp LLimit ; hex for 'A' blt doneRowLoop cmp #'9'+1 bge doneRowLoop iny inc Len MoveWord #'0',LLimit bra RowLoop doneRowLoop long stz CellID lda Len beq noGood cmp #5 ; no cell row is 5 long bge noGood nextDigit ldy Index inc Index cpy Size bge Exit lda [TextPtr],y and #$00FF SubWord a,#$0030,s ldx CellID ldy #10 Call D_FastMult AddWord a,s,CellID bra nextDigit noGood inc ErrorFlag stz CellID stz CellID+2 Exit RETURN ENDP ;------------------------------------------------------------------------ ; ; S_TraverseDest PROC EXPORT input OrigTL:l,OrigBR:l,DestTL:l,DestBR:l,Routine:l local Range1TL:l,Range1BR:l,Range2TL:l,Range2BR:l error ErrorFlag BEGIN stz ErrorFlag in OrigTL:l,OrigBR:l in DestTL:l,DestBR:l out Range1TL:l,Range1BR:l,Range2TL:l,Range2BR:l XCall S_GetDestCellRanges lda Range2TL ora Range2TL+2 ora Range2BR ora Range2BR+2 beq doRange1 in Range2TL:l,Range2BR:l,Routine:l XCall S_QTraverseTable,err=ErrorFlag bcs Exit doRange1 lda Range1TL ora Range1TL+2 ora Range1BR ora Range1BR+2 beq Exit in Range1TL:l,Range1BR:l,Routine:l XCall S_QTraverseTable,err=ErrorFlag Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Mouse.aii b/appleworksgs/SS/Src/Mouse.aii new file mode 100755 index 0000000..924f281 --- /dev/null +++ b/appleworksgs/SS/Src/Mouse.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ; IMPORT ArrowCursor ; IMPORT LeftRightCursor ; IMPORT OkBox ; IMPORT appleKey ; IMPORT shiftKey ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_BitMapChanged IMPORT D_BitMapPtr IMPORT D_MemoryError IMPORT D_SetCursor IMPORT S_ActivateScrlBars IMPORT S_ActiveWindow IMPORT S_AdjustCell IMPORT S_AdjustPoint IMPORT S_AdjustSheetColumns IMPORT S_CalculateSheet IMPORT S_Cell2Str IMPORT S_ChangeColWidth IMPORT S_ColLabRect IMPORT S_CurBRSelect IMPORT S_CurBScrl IMPORT S_CurContHt IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurEditFlag IMPORT S_CurEditRect IMPORT S_CurGrow IMPORT S_CurLEHandle IMPORT S_CurRScrl IMPORT S_CurTLCell IMPORT S_CurTLSelect IMPORT S_CurTwiceVertLines IMPORT S_CurVertLines IMPORT S_CurWindow IMPORT S_DashMask IMPORT S_DeltaMove IMPORT S_DoChecks IMPORT S_DoMove IMPORT S_DrawLocation IMPORT S_DrawMove IMPORT S_FindRect IMPORT S_FixLE IMPORT S_GrowDoc IMPORT S_HScrlAction IMPORT S_HiliteCells IMPORT S_MoveSrcBR IMPORT S_MoveSrcTL IMPORT S_NoMoveReasonMsg IMPORT S_NormalMask IMPORT S_RefreshScreen IMPORT S_RowLabRect IMPORT S_SetCurFormat IMPORT S_SetEdittingMenus IMPORT S_SetUndoOn IMPORT S_SetVertLines IMPORT S_SwapIn IMPORT S_Thumb IMPORT S_VScrlAction IMPORT S_WhereCell IMPORT S_WhichCell ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_ColLabelClick ENTRY S_GIFinish ENTRY S_GIMiddle ENTRY S_GIScroll ENTRY S_GIStart ENTRY S_PointShootMove ENTRY S_SelectCells ENTRY S_SelectFinish ENTRY S_SelectMiddle ENTRY S_SelectScroll ENTRY S_SelectStart ENTRY S_TrackVertLine ;-------------------------------------------------------------------------; ; S_MouseInfo ( TaskRecordPtr:l ) ; ; S_MouseInfo is called by the driver to handle a mouse down event in ; the currently active window's info bar. S_MouseInfo PROC EXPORT input TaskRecordPtr:l BEGIN ; +b RETURN ENDP ;-------------------------------------------------------------------------; ; S_MouseUp ( TaskRecordPtr:l ) ; ; S_MouseUp is called by the driver when the preceding mouse down was in ; an SS window and a mouse up has occured. S_MouseUp PROC EXPORT input TaskRecordPtr:l BEGIN ; +b RETURN ENDP ;-------------------------------------------------------------------------; ; S_MouseDown ( Click:w,TaskRecordPtr:l,ClickPt2:l,ClickPt3:l ) ; ; S_MouseDown is called by the driver to handle a mouse down event in ; SS's currently active window. S_MouseDown PROC EXPORT ;Using S_CurrentData input Click:w,TaskRecordPtr:l,ClickPt2:l,ClickPt3:l local Point:l,Control:l local ModField:w,Rect:r BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) Tool _SetPort,in=(S_ActiveWindow:l) MoveLong [TaskRecordPtr]:#10,Point MoveWord [TaskRecordPtr]:#14,ModField out a:w in !Control:l,Point:l,S_CurWindow:l XTool _FindControl jeq notcontrol docontrol Call D_SetCursor,in=(#ArrowCursor:w) CmpLong Control,S_CurGrow bne dotrack out :l in #200:w,#70:w,Point:l,S_CurWindow:l XTool _GrowWindow Tool _SizeWindow,in=(:l,S_CurWindow:l) Call S_GrowDoc,in=(S_CurWindow:l) brl Exit dotrack Tool _GetCtlRefCon,in=(Control:l),out=(ax:l) asl a asl a tax in Point:l,ActionTable:x:l,Control:l out a:w XTool _TrackControl beq skipThumb ; Check if thumb was tracked. cmp #$81 bne skipThumb Call S_Thumb,in=(Control:l) skipThumb Call S_SetVertLines brl Exit notcontrol Tool _GlobalToLocal,in=(!Point:l) ; Handle Line Edit click ; Tool _PtInRect,in=(!Point:l,#S_CurEditRect:l),out=(a:w) beq notEdit CmpLong S_CurTLSelect,S_CurBRSelect jne Exit lda S_CurEditFlag and #S_EditingBit bne doLEClick lda S_CurEditFlag ora #S_EditingBit sta S_CurEditFlag Tool _LEActivate,in=(S_CurLEHandle:l) Call S_SetCurFormat,in=(S_CurTLSelect:l) Call S_SetEdittingMenus doLEClick Tool _LEClick,in=(TaskRecordPtr:l,S_CurLEHandle:l) brl Exit notEdit ; Any other mouse down in window checks can go here. ; MoveWord S_CurContWd,S_ColLabRect+6 Tool _PtInRect,in=(!Point:l,#S_ColLabRect:l),out=(a:w) beq chkRowSelect Call S_ColLabelClick,in=(Point:l,ModField:w) brl Exit chkRowSelect ; MoveWord S_CurContHt,S_RowLabRect+4 Tool _PtInRect,in=(!Point:l,#S_RowLabRect:l),out=(a:w) beq chkContent lda S_CurEditFlag and #S_EditingBit jne Exit lda ModField and #shiftKey beq doRowSelect lda S_CurTLSelect+2 cmp #1 jne Exit lda S_CurBRSelect+2 cmp #702 jne Exit doRowSelect in Point:l,ModField:w,#1:w,#0:w in #S_SelectStart:l,#S_SelectMiddle:l,#S_SelectFinish:l in #S_SelectScroll:l XCall S_SelectCells brl Exit chkContent MoveWord S_CurContYpt,Rect MoveWord S_CurContXpt,Rect+2 MoveWord S_CurContHt,Rect+4 MoveWord S_CurContWd,Rect+6 Tool _PtInRect,in=(!Point:l,!Rect:l),out=(a:w) beq Exit lda S_CurEditFlag and #S_EditingBit beq notGraphInput ldx #0 in Point:l,x:w,x:w,x:w in #S_GIStart:l,#S_GIMiddle:l,#S_GIFinish:l in #S_GIScroll:l XCall S_SelectCells bra Exit notGraphInput lda ModField and #appleKey beq doContSelect Call S_PointShootMove,in=(Point:l) bra Exit doContSelect ldx #0 in Point:l,ModField:w,x:w,x:w in #S_SelectStart:l,#S_SelectMiddle:l,#S_SelectFinish:l in #S_SelectScroll:l XCall S_SelectCells Exit RETURN ActionTable DC.L S_VScrlAction DC.L S_HScrlAction DC.L 0 ENDP ;----------------------------------------------------------------------- ; ; S_ColLabelClick PROC EXPORT ;Using S_CurrentData input Point:l,ModField:w local VertLineHandle:l local EditCol:w,VertLines:l,CurXPos:w local NewWidth:w,PrevVertLine:w BEGIN ldx S_CurTwiceVertLines jeq notColWd MoveLong S_CurVertLines,VertLineHandle MoveLong [VertLineHandle],VertLines txy lda Point+2 and #$FFFC loop dey dey jmi notColWd cmp [VertLines],y blt loop jne notColWd sty EditCol sta CurXPos tya beq first ; first vert line dey dey MoveWord [VertLines]:y,PrevVertLine bra trackIt first MoveWord S_CurContXpt,PrevVertLine trackIt Call D_SetCursor,in=(#LeftRightCursor:w) SpaceWord PushWord CurXPos AddWord PrevVertLine,#S_MinCellWidth,s AddWord 1:s,#S_MaxCellWidth-S_MinCellWidth,s cmp S_CurContWd blt contTrack lda S_CurContWd dec a and #$FFFC sta 1,s contTrack PushWord #S_EditHeight+2 PushWord S_CurContHt Call S_TrackVertLine,in=(:w,:w,:w,:w,:w) ; out= New pos pla CmpWord a,CurXPos jeq Exit SubWord a,PrevVertLine,NewWidth ; Call D_SetCursor,in=(#WatchCursor:w) lda EditCol lsr a AddWord a,S_CurTLCell+2,a Call S_ChangeColWidth,in=(a:w,NewWidth:w) bcs memError Call S_ActivateScrlBars Call S_SetUndoOn,in=(#S_UndoColWdType:w) Call S_AdjustSheetColumns bra refreshScreen memError Call D_MemoryError refreshScreen Call S_RefreshScreen,in=(#1:w) bra Exit notColWd lda S_CurEditFlag and #S_EditingBit bne Exit lda ModField and #shiftKey beq doSelect lda S_CurTLSelect cmp #1 bne Exit lda S_CurBRSelect cmp #9999 bne Exit doSelect in Point:l,ModField:w,#0:w,#1:w in #S_SelectStart:l,#S_SelectMiddle:l,#S_SelectFinish:l in #S_SelectScroll:l XCall S_SelectCells Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_SelectCells ; S_SelectCells PROC EXPORT ;Using S_CurrentData input Xpt:w,Ypt:w,Modfield:w,FixedCol:w,FixedRow:w input StartRoutine:l,MiddleRoutine:l,FinishRoutine:l input ScrollRoutine:l local OldClipRgn:l,NewClipRgn:l local WorkClipRgn:l,Work2Rgn:l local ClipRect:r local NewPt:l,MouseStatus:w local AnchorCell:l,NewCell:l,OldCell:l local ContWd:w,ContHt:w BEGIN MoveWord StartRoutine,StartCall+1 sta StartCall2+1 MoveWord StartRoutine+1,StartCall+2 sta StartCall2+2 MoveWord MiddleRoutine,MiddleCall+1 MoveWord MiddleRoutine+1,MiddleCall+2 MoveWord FinishRoutine,FinishCall+1 MoveWord FinishRoutine+1,FinishCall+2 MoveWord ScrollRoutine,ScrollCall+1 MoveWord ScrollRoutine+1,ScrollCall+2 MoveWord #S_EditHeight+2,ClipRect stz ClipRect+2 MoveWord S_CurContHt,ClipRect+4 sta ContHt MoveWord S_CurContWd,ClipRect+6 sta ContWd ; Set the Clip Rgn ; Tool _NewRgn,out=(:l) MoveLong 1:s,OldClipRgn Tool _GetClip,in=(:l) Tool _NewRgn,out=(:l) MoveLong 1:s,NewClipRgn Tool _RectRgn,in=(:l,!ClipRect:l) Tool _SectRgn,in=(NewClipRgn:l,OldClipRgn:l,NewClipRgn:l) Tool _SetClip,in=(NewClipRgn:l) Tool _NewRgn,out=(WorkClipRgn:l) Tool _NewRgn,out=(Work2Rgn:l) ; Common loop initialization ; in Xpt:w,Ypt:w out AnchorCell:l,a:w,a:w XCall S_WhichCell CmpWord AnchorCell+2,#703 jge cleanup CmpWord AnchorCell,#10000 jge cleanup MoveLong #$02BE270F,NewCell ; Check if shift-Select or just Select ; chkSelect lda ModField and #shiftKey bne ShiftSelect doStart SpaceLong SpaceLong PushLong AnchorCell PushWord FixedRow PushWord FixedCol PushLong WorkClipRgn PushLong Work2Rgn StartCall jsl * PullLong OldCell PullLong AnchorCell brl loop ; Initialize loop for shift-Select ; ShiftSelect lda FixedRow bne rowSet2 MoveWord AnchorCell,NewCell rowSet2 lda FixedCol bne colSet2 MoveWord AnchorCell+2,NewCell+2 colSet2 MoveLong S_CurTLSelect,AnchorCell MoveLong S_CurBRSelect,OldCell lda FixedRow bne OKanchorRow CmpWord NewCell,AnchorCell ; compare rows only bge OKanchorRow MoveWord OldCell,AnchorCell MoveWord S_CurTLSelect,OldCell OKanchorRow lda FixedCol bne OKanchorCol CmpWord NewCell+2,AnchorCell+2 ; compare cols only bge OKanchorCol MoveWord OldCell+2,AnchorCell+2 MoveWord S_CurTLSelect+2,OldCell+2 OKanchorCol lda #0 pha pha pha pha pha pha pha pha PushLong WorkClipRgn PushLong Work2Rgn StartCall2 jsl * pla pla pla pla MoveWord #-1,MouseStatus brl doMiddle ; Track mouse loop ; loop Tool _GetMouse,in=(!NewPt:l) MoveWord #-1,MouseStatus Tool _EventAvail,in=(#4:w,#EventRec:l),out=(a:w) beq stillDown Tool _GlobalToLocal,in=(#MousePos:l) MoveLong MousePos,NewPt stz MouseStatus stillDown Call S_AdjustPoint,in=(NewPt:l) PullLong NewPt chkScrolls lda FixedCol bne chkTop CmpWord NewPt+2,S_CurContXpt bge chkRight jsr scrollLeft bra chkTop chkRight cmp ContWd blt chkTop jsr scrollRight MoveWord ContWd,NewPt+2 chkTop lda FixedRow bne OKScroll CmpWord NewPt,S_CurContYpt bge chkBottom jsr scrollUp bra OKscroll chkBottom cmp ContHt blt OKscroll jsr scrollDown MoveWord ContHt,NewPt OKscroll in NewPt:l out :l,:l XCall S_WhichCell Call S_AdjustCell,in=(:l,:l) pla pla pla plx ldy FixedRow bne rowStored sta NewCell rowStored ldy FixedCol bne colStored stx NewCell+2 colStored lda MouseStatus beq mouseUp CmpLong NewCell,OldCell bne doMiddle brl loop mouseUp CmpLong NewCell,OldCell beq doFinish doMiddle PushLong AnchorCell PushLong OldCell PushLong NewCell MiddleCall jsl * MoveLong NewCell,OldCell lda MouseStatus beq doFinish brl loop doFinish PushLong AnchorCell PushLong OldCell FinishCall jsl * ; Clean up ; cleanup Call S_SetVertLines Tool _DisposeRgn,in=(WorkClipRgn:l) Tool _DisposeRgn,in=(Work2Rgn:l) Tool _DisposeRgn,in=(NewClipRgn:l) Tool _SetClip,in=(OldClipRgn:l) Tool _DisposeRgn,in=(OldClipRgn:l) RETURN ;-------------------------------- scrollLeft lda #5 bra ScrollH scrollRight lda #6 ScrollH pha pha PushLong S_CurBScrl jsr doScrollRoutine Tool _SetClip,in=(OldClipRgn:l) Call S_HScrlAction Tool _SetClip,in=(NewClipRgn:l) jsr doScrollRoutine pla rts ;-------------------------------- scrollUp lda #5 bra ScrollV scrollDown lda #6 ScrollV pha pha PushLong S_CurRScrl jsr doScrollRoutine Tool _SetClip,in=(OldClipRgn:l) Call S_VScrlAction Tool _SetClip,in=(NewClipRgn:l) jsr doScrollRoutine pla rts ;-------------------------------- doScrollRoutine PushLong AnchorCell PushLong OldCell ScrollCall jsl * rts ;-------------------------------- EventRec DS.B 10 MousePos DS.B 6 ENDP ;-------------------------------------------------------------------------- S_SelectData PROC EXPORT EXPORT S_SelectWorkRgn EXPORT S_SelectWork2Rgn S_SelectWorkRgn DS.B 4 S_SelectWork2Rgn DS.B 4 ENDP ;----------------------------------------------------------------------------- ; ; S_SelectScroll PROC EXPORT input Cell1:l,Cell2:l BEGIN RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_SelectStart PROC EXPORT ;Using S_CurrentData ;Using S_SelectData output AnchorCell:l,OldCell:l input StartCell:l,FixedRow:w,FixedCol:w input WorkClipRgn:l,Work2Rgn:l BEGIN MoveLong WorkClipRgn,S_SelectWorkRgn MoveLong Work2Rgn,S_SelectWork2Rgn lda StartCell ora StartCell+2 beq Exit ; Initialize loop for Select ; lda FixedRow ora FixedCol bne hiliteCell CmpLong StartCell,S_CurTLSelect bne hilitecell CmpLong StartCell,S_CurBRSelect beq setAnchor hiliteCell Call S_HiliteCells MoveLong #$00010001,S_CurTLSelect MoveLong #$02BE270F,S_CurBRSelect lda FixedRow bne rowSet MoveWord StartCell,S_CurTLSelect sta S_CurBRSelect rowSet lda FixedCol bne colSet MoveWord StartCell+2,S_CurTLSelect+2 sta S_CurBRSelect+2 colSet Call S_HiliteCells setAnchor MoveLong S_CurTLSelect,AnchorCell MoveLong S_CurBRSelect,OldCell Exit RETURN ENDP ;------------------------------------------------------------------------ ; ; S_SelectMiddle PROC EXPORT ;Using S_CurrentData ;Using S_SelectData input AnchorCell:l,OldCell:l,NewCell:l local OldRect:r,NewRect:r BEGIN PushLong AnchorCell PushLong OldCell pha pha pha pha Call S_FindRect PullLong OldRect PullLong OldRect+4 pla pla pla pla inc OldRect inc OldRect+2 inc OldRect+2 inc OldRect+4 inc OldRect+6 inc OldRect+6 Tool _RectRgn,in=(S_SelectWorkRgn:l,!OldRect:l) PushLong AnchorCell PushLong NewCell pha pha pha pha Call S_FindRect PullLong NewRect PullLong NewRect+4 PullLong S_CurBRSelect PullLong S_CurTLSelect inc NewRect inc NewRect+2 inc NewRect+2 inc NewRect+4 inc NewRect+6 inc NewRect+6 Tool _RectRgn,in=(S_SelectWork2Rgn:l,!NewRect:l) in S_SelectWorkRgn:l,S_SelectWork2Rgn:l,S_SelectWorkRgn:l XTool _XorRgn Tool _InvertRgn,in=(S_SelectWorkRgn:l) RETURN ENDP ;------------------------------------------------------------------------ ; ; S_SelectFinish PROC EXPORT ;Using S_CurrentData input AnchorCell:l,OldCell:l BEGIN Call S_FixLE Call S_DoChecks Call S_DrawLocation RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_GIScroll PROC EXPORT ;Using S_CurrentData ;Using S_SelectData input Cell1:l,Cell2:l local Rect:r BEGIN Tool _SetPenMode,in=(#$8002:w) ; not Xor Mode PushLong Cell1 PushLong Cell2 pha pha pha pha Call S_FindRect PullLong Rect PullLong Rect+4 pla pla pla pla inc Rect inc Rect+2 inc Rect+2 Tool _FrameRect,in=(!Rect:l) Tool _SetPenMode,in=(#0:w) RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_GIStart PROC EXPORT ;Using S_CurrentData ;Using S_SelectData output AnchorCell:l,OldCell:l input StartCell:l,FixedRow:w,FixedCol:w input WorkClipRgn:l,Work2Rgn:l local Rect:r BEGIN MoveLong WorkClipRgn,S_SelectWorkRgn MoveLong Work2Rgn,S_SelectWork2Rgn MoveWord StartCell,AnchorCell sta OldCell MoveWord StartCell+2,AnchorCell+2 sta OldCell+2 Tool _SetPenMode,in=(#$8002:w) ; not Xor Mode in StartCell:l out Rect+4:l,Rect:l XCall S_WhereCell inc Rect inc Rect+2 inc Rect+2 Tool _FrameRect,in=(!Rect:l) Tool _SetPenMode,in=(#0:w) RETURN ENDP ;------------------------------------------------------------------------ ; ; S_GIMiddle PROC EXPORT ;Using S_CurrentData ;Using S_SelectData input AnchorCell:l,OldCell:l,NewCell:l local Rect:r,RectPtr:l BEGIN Tool _SetPenMode,in=(#$8002:w) ; not Xor Mode MoveLong !Rect,RectPtr PushLong AnchorCell PushLong OldCell pha pha pha pha Call S_FindRect PullLong Rect PullLong Rect+4 pla pla pla pla inc Rect inc Rect+2 inc Rect+2 Tool _FrameRect,in=(RectPtr:l) PushLong AnchorCell PushLong NewCell pha pha pha pha Call S_FindRect PullLong Rect PullLong Rect+4 pla pla pla pla inc Rect inc Rect+2 inc Rect+2 Tool _FrameRect,in=(RectPtr:l) Tool _SetPenMode,in=(#0:w) RETURN ENDP ;------------------------------------------------------------------------ ; ; S_GIFinish PROC EXPORT ;Using S_CurrentData ;Using D_GlobalData input Cell1:l,Cell2:l local Len:w,Len2:w,TextPtr:l,Text2Ptr:l,Rect:r BEGIN Tool _SetPenMode,in=(#$8002:w) ; not Xor Mode PushLong Cell1 PushLong Cell2 pha pha pha pha Call S_FindRect PullLong Rect PullLong Rect+4 pla pla pla pla inc Rect inc Rect+2 inc Rect+2 Tool _FrameRect,in=(!Rect:l) Tool _SetPenMode,in=(#0:w) Tool _ClipRect,in=(#S_CurEditRect:l) MoveLong >D_BitMapPtr,TextPtr MoveWord #1,>D_BitMapChanged Call S_Cell2Str,in=(TextPtr:l,Cell1:l) lda [TextPtr] and #$00FF sta Len incl TextPtr CmpLong Cell1,Cell2 beq insertText MoveWord #$2E2E,[TextPtr]:Len ; hex for '..' tya inc a inc a sta Len AddLong a,TextPtr,Text2Ptr Call S_Cell2Str,in=(Text2Ptr:l,Cell2:l) lda [Text2Ptr] and #$00FF sta Len2 AddWord a,Len,Len ldy #1 loop lda [Text2Ptr],y dey sta [Text2Ptr],y iny iny cpy Len2 blt loop insertText Tool _LEDelete,in=(S_CurLEHandle:l) Tool _LEInsert,in=(TextPtr:l,Len:w,S_CurLEHandle:l) Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_TrackVertLine( CurXPos:w,MinXPos:w,MaxXPos:w,TopVerPos:w,BottomVerPos:w ) ; :NewXPos:w ; ; CurXPos, MinXPos and MaxXPos are x-coordinates with the lowest 2 bits ; cleared. S_TrackVertLine PROC EXPORT ;Using S_ConstantData output NewXPos:w input CurXPos:w,MinXPos:w,MaxXPos:w input TopVerPos:w,BottomVerPos:w local NewPt:l,MouseStatus:w,FieldPtr:l BEGIN ; Set pen mode and mask to draw dotted line. setPen Tool _SetPenMode,in=(#$8002:w) ; not Xor Mode Tool _SetPenMask,in=(#S_DashMask:l) CmpWord CurXPos,MinXPos blt set2Min cmp MaxXPos blt drawLine set2Max MoveWord MaxXPos,CurXPos bra drawLine set2Min MoveWord MinXPos,CurXPos drawLine Tool _MoveTo,in=(CurXPos:w,TopVerPos:w) Tool _LineTo,in=(CurXPos:w,BottomVerPos:w) ; Wait for the user to either let go of the mouse or move it. waitloop Tool _GetMouse,in=(!NewPt:l) Tool _StillDown,in=(#0:w),out=(MouseStatus:w) Call S_AdjustPoint,in=(NewPt:l) PullLong NewPt and #$FFFC sta NewPt+2 cmp MinXPos blt setNewMin cmp MaxXPos blt NewSet setNewMax MoveWord MaxXPos,NewPt+2 bra NewSet setNewMin MoveWord MinXPos,NewPt+2 NewSet lda MouseStatus beq doUnLine CmpWord NewPt+2,CurXPos beq waitloop ; Undraw the old line. doUnline Tool _MoveTo,in=(CurXPos:w,TopVerPos:w) Tool _LineTo,in=(CurXPos:w,BottomVerPos:w) ; Set the New draw point. setnew MoveWord NewPt+2,CurXPos ; If the user has not let go of the mouse then repeat loop. endloop lda MouseStatus jne drawLine ; User has released mouse so adjust New position of form bottom line ; and Update the view rect. Exit Tool _SetPenMode,in=(#0:w) Tool _SetPenMask,in=(#S_NormalMask:l) MoveWord CurXPos,NewXPos RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_PointShootMove PROC EXPORT ;Using S_CurrentData ;Using S_MoveData ;Using S_ErrorData input Point:l local DestTL:l error ErrFlag BEGIN stz ErrFlag in Point:l out DestTL:l,ax:l XCall S_WhichCell SubWord DestTL,S_CurTLSelect,S_DeltaMove SubWord DestTL+2,S_CurTLSelect+2,S_DeltaMove+2 lda S_DeltaMove ora S_DeltaMove+2 bne contMove Call D_AlertBox,in=(#OkBox:w,#S_NoMoveReasonMsg:l),out=(a:w) bra Exit contMove MoveLong S_CurTLSelect,S_MoveSrcTL MoveLong S_CurBRSelect,S_MoveSrcBR Call S_DoMove,err=ErrFlag bcc doHilite lda ErrFlag and #$FF00 cmp #$0200 bne Exit memError Call D_MemoryError doHilite Call S_HiliteCells AddWord S_CurTLSelect+2,S_DeltaMove+2,S_CurTLSelect+2 AddWord S_CurTLSelect,S_DeltaMove,S_CurTLSelect AddWord S_CurBRSelect+2,S_DeltaMove+2,S_CurBRSelect+2 AddWord S_CurBRSelect,S_DeltaMove,S_CurBRSelect Call S_HiliteCells Call S_DrawMove Call S_DrawLocation Call S_SetUndoOn,in=(#S_UndoMoveType:w) lda S_CurEditFlag and #S_ManCalcBit bne Exit Call S_CalculateSheet Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Move.aii b/appleworksgs/SS/Src/Move.aii new file mode 100755 index 0000000..fa3bca1 --- /dev/null +++ b/appleworksgs/SS/Src/Move.aii @@ -0,0 +1 @@ + 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_MemoryError IMPORT S_ActiveWindow IMPORT S_AddCellToChangedList IMPORT S_BadInsertMsg IMPORT S_BadMoveMsg IMPORT S_BadTransposeMsg IMPORT S_BuildMoveUndo IMPORT S_CalculateSheet IMPORT S_ChkCellProtect IMPORT S_ClearChangedBits IMPORT S_ClearChangedBits2 IMPORT S_CurBRSelect IMPORT S_CurDefFormat IMPORT S_CurEditFlag IMPORT S_CurTLSelect IMPORT S_DependHomeCell IMPORT S_DrawLocation IMPORT S_EnterRangeDep IMPORT S_ExtraData IMPORT S_ExtraDataMsg IMPORT S_FixFormula3 IMPORT S_FixLE IMPORT S_GetCellDlog IMPORT S_GetCellPtr IMPORT S_GetCellTableEntry IMPORT S_GetDirDlog IMPORT S_GetRealCell IMPORT S_GetRefCell IMPORT S_HiliteCells IMPORT S_InsertLeftPadCells IMPORT S_InsertRightPadCells IMPORT S_InvalidCellStr IMPORT S_NoMoveReasonMsg IMPORT S_NormalizeRange IMPORT S_ProtectedCellMsg IMPORT S_QRTraverseTable IMPORT S_QTraverse IMPORT S_QTraverseTable IMPORT S_RearrangePadCells IMPORT S_RedrawCellRange IMPORT S_RemoveCell IMPORT S_RemoveCellFromChangedList IMPORT S_RemoveRangeDep IMPORT S_ResetCircularity IMPORT S_SetCellTableEntry IMPORT S_SetCircularBits IMPORT S_SetUndoOn IMPORT S_SwapIn IMPORT S_TransposeCell IMPORT S_TrashCell IMPORT S_TraverseDest IMPORT S_TraverseRange IMPORT S_UndoInProgress ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_ChkContent ENTRY S_DoMove ENTRY S_DoTranspose ENTRY S_DrawMove ENTRY S_FixFormula ENTRY S_FixFormula2 ENTRY S_FixFormulaFlag ENTRY S_MergeDependLists ENTRY S_MoveCell ENTRY S_SplitDependList ENTRY S_TraverseDependFormulas ;---------------------------------------------------------- S_MoveData PROC EXPORT EXPORT S_DeltaMove EXPORT S_MoveSrcTL EXPORT S_MoveSrcBR EXPORT S_MoveDestTL EXPORT S_MoveDestBR EXPORT S_OrigTransDestTL EXPORT S_OrigTransDestBR EXPORT S_MoveNewCell EXPORT S_MoveOldCell S_DeltaMove DS.B 4 S_MoveSrcTL DS.B 4 S_MoveSrcBR DS.B 4 S_MoveDestTL DS.B 4 S_MoveDestBR DS.B 4 S_OrigTransDestTL DS.B 4 S_OrigTransDestBR DS.B 4 S_MoveNewCell DS.B 4 S_MoveOldCell DS.B 4 ENDP ;-------------------------------------------------------------------------- ; S_Insert ; S_Insert PROC EXPORT ;Using S_CurrentData ;Using S_MoveData ;Using S_ErrorData local TrashTL:l,TrashBR:l,DoTrash:w error ErrFlag BEGIN +b stz ErrFlag stz DoTrash Call S_SwapIn,in=(S_ActiveWindow:l) chkRowSelected lda S_CurTLSelect+2 cmp #1 bne chkColSelected lda S_CurBRSelect+2 cmp #702 beq shiftDown chkColSelected lda S_CurTLSelect cmp #1 bne askDirection lda S_CurBRSelect cmp #9999 jeq shiftRight askDirection ; direction: 0==Cancel,1==Left,2==Right,3==Up,4==Down Call S_GetDirDlog,in=(#1:w),out=(a:w) jeq Exit ; = cancel cmp #2 ; = right jeq shiftRight cmp #4 ; = down jne Exit shiftDown SubWord S_CurBRSelect,S_CurTLSelect,a inc a sta S_DeltaMove stz S_DeltaMove+2 MoveWord S_CurTLSelect+2,TrashTL+2 SubWord #10000,S_DeltaMove,TrashTL MoveWord S_CurBRSelect+2,TrashBR+2 MoveWord #9999,TrashBR Call S_QTraverse,in=(TrashTL:l,TrashBR:l,#S_ChkContent:l) bcs badInsert CmpWord S_CurBRSelect,TrashTL blt doMoveOnly cmp #9999 jge doTrashRect sta TrashBR inc DoTrash doMoveOnly MoveLong S_CurTLSelect,S_MoveSrcTL SubWord #9999,S_DeltaMove,S_MoveSrcBR MoveWord S_CurBRSelect+2,S_MoveSrcBR+2 bra doInsert shiftRight stz S_DeltaMove SubWord S_CurBRSelect+2,S_CurTLSelect+2,a inc a sta S_DeltaMove+2 SubWord #703,S_DeltaMove+2,TrashTL+2 MoveWord S_CurTLSelect,TrashTL MoveWord #702,TrashBR+2 MoveWord S_CurBRSelect,TrashBR Call S_QTraverse,in=(TrashTL:l,TrashBR:l,#S_ChkContent:l) bcc chkArea2 badInsert Call D_AlertBox,in=(#OKBox:w,#S_BadInsertMsg:l),out=(a:w) bra Exit chkArea2 CmpWord S_CurBRSelect+2,TrashTL+2 blt doMoveOnly2 cmp #702 bge doTrashRect sta TrashBR+2 inc DoTrash doMoveOnly2 MoveLong S_CurTLSelect,S_MoveSrcTL MoveWord S_CurBRSelect,S_MoveSrcBR SubWord #702,S_DeltaMove+2,S_MoveSrcBR+2 doInsert Call S_DoMove,err=ErrFlag bcc finish and #$FF00 cmp #$0200 bne Exit Call D_MemoryError bra setUndo finish lda DoTrash beq setUndo doTrashRect in TrashTL:l,TrashBR:l,#S_TrashCell:l XCall S_QTraverseTable,err=ErrFlag setUndo Call S_DrawMove Call S_SetUndoOn,in=(#S_UndoInsertType:w) lda S_CurEditFlag and #S_ManCalcBit bne Exit Call S_CalculateSheet Exit RETURN ENDP ;-------------------------------------------------------------------------- ; S_Delete ; S_Delete PROC EXPORT ;Using S_CurrentData ;Using S_MoveData error ErrFlag BEGIN +b stz ErrFlag Call S_SwapIn,in=(S_ActiveWindow:l) chkRowSelected lda S_CurTLSelect+2 cmp #1 bne chkColSelected lda S_CurBRSelect+2 cmp #702 beq shiftUp chkColSelected lda S_CurTLSelect cmp #1 bne askDirection lda S_CurBRSelect cmp #9999 beq shiftLeft askDirection ; direction: 0==Cancel,1==Left,2==Right,3==Up,4==Down Call S_GetDirDlog,in=(#2:w),out=(a:w) jeq Exit ; = cancel cmp #1 ; = left beq shiftLeft cmp #3 ; = up jne Exit shiftUp SubWord S_CurTLSelect,S_CurBRSelect,a dec a sta S_DeltaMove MoveWord #0,S_DeltaMove+2 lda S_CurBRSelect inc a sta S_MoveSrcTL MoveWord S_CurTLSelect+2,S_MoveSrcTL+2 SubWord #9999,S_DeltaMove,S_MoveSrcBR MoveWord S_CurBRSelect+2,S_MoveSrcBR+2 bra doDelete shiftLeft stz S_DeltaMove SubWord S_CurTLSelect+2,S_CurBRSelect+2,a dec a sta S_DeltaMove+2 MoveWord S_CurTLSelect,S_MoveSrcTL lda S_CurBRSelect+2 inc a sta S_MoveSrcTL+2 MoveWord S_CurBRSelect,S_MoveSrcBR SubWord #702,S_DeltaMove+2,S_MoveSrcBR+2 doDelete Call S_DoMove,err=ErrFlag bcc redraw and #$FF00 cmp #$0200 bne Exit Call D_MemoryError redraw Call S_DrawMove Call S_SetUndoOn,in=(#S_UndoDeleteType:w) lda S_CurEditFlag and #S_ManCalcBit bne Exit Call S_CalculateSheet Exit RETURN ENDP ;---------------------------------------------------------- ; S_Move ; S_Move PROC EXPORT ;Using S_CurrentData ;Using S_MoveData ;Using S_ErrorData local DestCell:l error ErrFlag BEGIN +b stz ErrFlag Call S_SwapIn,in=(S_ActiveWindow:l) ; newcell: 0 == Cancelled, 0 w/carry set == error Call S_GetCellDlog,in=(#1:w,#0:l),out=(DestCell:l) bcc doOK Call D_AlertBox,in=(#OKBox:w,#S_InvalidCellStr:l),out=(a:w) doOK lda DestCell ora DestCell+2 jeq Exit SubWord DestCell,S_CurTLSelect,S_DeltaMove SubWord DestCell+2,S_CurTLSelect+2,S_DeltaMove+2 lda S_DeltaMove ora S_DeltaMove+2 bne contMove Call D_AlertBox,in=(#OkBox:w,#S_NoMoveReasonMsg:l),out=(a:w) bra Exit contMove MoveLong S_CurTLSelect,S_MoveSrcTL MoveLong S_CurBRSelect,S_MoveSrcBR Call S_DoMove,err=ErrFlag bcc doHilite and #$FF00 cmp #$0200 bne Exit Call D_MemoryError doHilite Call S_HiliteCells AddWord S_CurTLSelect+2,S_DeltaMove+2,S_CurTLSelect+2 AddWord S_CurTLSelect,S_DeltaMove,S_CurTLSelect AddWord S_CurBRSelect+2,S_DeltaMove+2,S_CurBRSelect+2 AddWord S_CurBRSelect,S_DeltaMove,S_CurBRSelect Call S_HiliteCells Call S_DrawMove Call S_DrawLocation Call S_SetUndoOn,in=(#S_UndoMoveType:w) lda S_CurEditFlag and #S_ManCalcBit bne Exit Call S_CalculateSheet Exit RETURN ENDP ;-------------------------------------------------------------------------- ; S_Transpose ; S_Transpose PROC EXPORT ;Using S_CurrentData ;Using S_MoveData error ErrFlag BEGIN +b stz ErrFlag Call S_SwapIn,in=(S_ActiveWindow:l) MoveLong S_CurTLSelect,S_MoveSrcTL MoveLong S_CurBRSelect,S_MoveSrcBR Call S_DoTranspose,err=ErrFlag bcc setUndo and #$FF00 cmp #$0200 bne Exit Call D_MemoryError setUndo Call S_SetUndoOn,in=(#S_UndoTransposeType:w) MoveLong S_OrigTransDestTL,S_CurTLSelect MoveLong S_OrigTransDestBR,S_CurBRSelect in S_MoveSrcTL:l,S_MoveSrcBR:l XCall S_RedrawCellRange in S_MoveDestTL:l,S_MoveDestBR:l XCall S_RedrawCellRange lda S_CurEditFlag and #S_ManCalcBit bne Exit Call S_CalculateSheet Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_DoMove PROC EXPORT ;Using S_CurrentData ;Using S_MoveData ;Using S_ErrorData ;Using S_UndoData local SrcTL:l,SrcBR:l,CellPtr:l error ErrFlag BEGIN stz ErrFlag lda #S_BRMostBit tsb S_CurEditFlag MoveWord S_MoveSrcTL+2,SrcTL+2 AddWord a,S_DeltaMove+2,S_MoveDestTL+2 MoveWord S_MoveSrcTL,SrcTL AddWord a,S_DeltaMove,S_MoveDestTL MoveWord S_MoveSrcBR+2,SrcBR+2 AddWord a,S_DeltaMove+2,S_MoveDestBR+2 MoveWord S_MoveSrcBR,SrcBR AddWord a,S_DeltaMove,S_MoveDestBR ldx S_UndoInProgress bne chkProtect cmp #10000 bge badMove CmpWord S_MoveDestBR+2,#703 blt chkProtect badMove inc ErrFlag Call D_AlertBox,in=(#OkBox:w,#S_BadMoveMsg:l),out=(a:w) brl Exit ; Chk destination for protected cells ; chkProtect ; Call D_SetCursor,in=(#WatchCursor:w) stz S_ExtraData in S_MoveSrcTL:l,S_MoveSrcBR:l in S_MoveDestTL:l,S_MoveDestBR:l,#S_ChkCellProtect:l XCall S_TraverseDest,err=ErrFlag bcc chkExtraData inc ErrFlag Call D_AlertBox,in=(#OkBox:w,#S_ProtectedCellMsg:l),out=(a:w) brl Exit chkExtraData lda S_ExtraData beq contMove Call D_AlertBox,in=(#OkCancelBox:w,#S_ExtraDataMsg:l),out=(a:w) cmp #OK beq contMove inc ErrFlag brl Exit contMove Call S_BuildMoveUndo,err=ErrFlag bcs Exit in SrcTL:l,SrcBR:l in S_MoveDestTL:l,S_MoveDestBR:l,#S_TrashCell:l XCall S_TraverseDest,err=ErrFlag bcs Exit lda S_DeltaMove bmi doForward bne doBackward lda S_DeltaMove+2 bmi doForward doBackward in SrcTL:l,SrcBR:l,#S_MoveCell:l XCall S_QRTraverseTable,err=ErrFlag bra Exit doForward in SrcTL:l,SrcBR:l,#S_MoveCell:l XCall S_QTraverseTable,err=ErrFlag Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_DrawMove PROC EXPORT ;Using S_CurrentData ;Using S_MoveData BEGIN CmpWord S_MoveSrcBR,#10000 blt okSrcB MoveWord #9999,S_MoveSrcBR okSrcB CmpWord S_MoveSrcBR+2,#703 blt okSrcR MoveWord #702,S_MoveSrcBR+2 okSrcR in S_MoveSrcTL:l,S_MoveSrcBR:l XCall S_RedrawCellRange in S_MoveDestTL:l,S_MoveDestBR:l XCall S_RedrawCellRange redrawLE Call S_FixLE RETURN ENDP ;---------------------------------------------------------- ; S_DoTranspose ; S_DoTranspose PROC EXPORT ;Using S_CurrentData ;Using S_MoveData ;Using S_ErrorData ;Using S_UndoData error ErrFlag BEGIN stz ErrFlag stz S_ExtraData lda #S_BRMostBit tsb S_CurEditFlag MoveLong S_MoveSrcTL,S_MoveDestTL SubWord S_MoveSrcBR+2,S_MoveSrcTL+2,a AddWord a,S_MoveSrcTL,S_MoveDestBR SubWord S_MoveSrcBR,S_MoveSrcTL,a AddWord a,S_MoveSrcTL+2,S_MoveDestBR+2 MoveLong S_MoveDestTL,S_OrigTransDestTL MoveLong S_MoveDestBR,S_OrigTransDestBR ; ChkDest for protected cells or off sheet ; cmp #703 bge offSheet CmpWord S_MoveDestBR,#10000 blt onSheet offSheet inc ErrFlag Call D_AlertBox,in=(#OkBox:w,#S_BadTransposeMsg:l),out=(a:w) brl Exit onSheet CmpWord S_MoveDestBR,S_MoveSrcBR ; rows only beq chkDone bge horz2Vert lda S_MoveSrcBR+2 inc a pha PushWord S_MoveSrcTL bra doChk horz2Vert PushWord S_MoveSrcTL+2 lda S_MoveSrcBR inc a pha doChk ; Call D_SetCursor,in=(#WatchCursor:w) in S_MoveDestBR:l,#S_ChkCellProtect:l ; long on stack XCall S_QTraverse bcc chkExtraData inc ErrFlag Call D_AlertBox,in=(#OkBox:w,#S_ProtectedCellMsg:l),out=(a:w) brl Exit chkExtraData lda S_ExtraData beq chkDone Call D_AlertBox,in=(#OkCancelBox:w,#S_ExtraDataMsg:l),out=(a:w) cmp #OK beq chkDone inc ErrFlag brl Exit chkDone Call S_BuildMoveUndo,err=ErrFlag bcs Exit in S_MoveSrcTL:l,S_MoveSrcBR:l in S_MoveDestTL:l,S_MoveDestBR:l,#S_TrashCell:l XCall S_TraverseDest,err=ErrFlag bcs Exit in S_MoveSrcTL:l,S_MoveSrcBR:l,#S_TransposeCell:l XCall S_TraverseRange,err=ErrFlag Exit RETURN ENDP ;---------------------------------------------------------- ; S_MoveCell ; S_MoveCell PROC EXPORT ;Using S_CurrentData ;Using S_MoveData input Cell:l,SrcCellTableEntry:l local ClrSrcFlag:w,TestCirc:w local FakeSrcFlag:w,FakeDestFlag:w,DestExists:w local SrcCellType:w,SrcCellFormat:l,FormulaIndex:l local PreviousField:l,NextField:l local DependIndex:l,DestDepList:l,NewDepList:l,EntryToLeave:l local SingleDeps:l,RangeDeps:l,DestCellTableEntry:l,CellPtr:l error ErrorFlag BEGIN ProfileIn 2 ; Initialize flag variables stz ErrorFlag stz ClrSrcFlag stz TestCirc stz S_FixFormulaFlag ; for fixing formulas in S_FixFormula routines ; Globalize the Source and Destination Cells MoveWord Cell,S_MoveOldCell AddWord a,S_DeltaMove,S_MoveNewCell MoveWord Cell+2,S_MoveOldCell+2 AddWord a,S_DeltaMove+2,S_MoveNewCell+2 ; Determine the Situation: (i.e. Cell types of both the dest and ; src cells after the move.) ; This is accomplished by looking at both the src and dest ; cells at the beginning of the routine and using the least ; common denominator. ; We will also initalize several local variables while we are ; looking at the cells. lda SrcCellTableEntry+2 and #S_CellTableFlags sta FakeSrcFlag ; (re)set this flag for later use. beq startRealSrc MoveWord #S_CellTypeEmpty,SrcCellType MoveWord #0,SrcCellFormat+2 MoveLong SrcCellTableEntry,DependIndex brl adjustDepend startRealSrc H_GetBlockPtr SrcCellTableEntry,CellPtr MoveLong [CellPtr]:#S_CellDependOnMe,DependIndex MoveLong [CellPtr]:#S_CellNext,NextField MoveLong [CellPtr]:#S_CellPrevious,PreviousField MoveWord [CellPtr]:#S_CellFormat+2,SrcCellFormat+2 MoveWord [CellPtr]:#S_CellFormat,SrcCellFormat and #S_CellType sta SrcCellType bpl doRealCell lda DependIndex ; if this jumps to exit, then ora DependIndex+2 ; the cell was only a pad cell bne chkChangedLst ; with no dependencies. brl Exit ; While looking at a real src cell, adjust the cell's id doRealCell MoveLong [CellPtr]:#S_CellContent,FormulaIndex MoveLong S_MoveNewCell,[CellPtr]:#S_CellID ; Remove the original cell from the ChangedList, it won't be ; in the same location chkChangedLst lda NextField ora NextField+2 beq adjustDepend lda #0 MoveWord a,[CellPtr]:#S_CellNext MoveWord a,[CellPtr]:#S_CellNext+2 MoveWord a,[CellPtr]:#S_CellPrevious MoveWord a,[CellPtr]:#S_CellPrevious+2 in Cell:l,PreviousField:l,NextField:l XCall S_RemoveCellFromChangedList ; Adjust the cell's DependOnMe references ; ; This is now before adjusting the formula, ; ; because of circular formulas ; adjustDepend lda DependIndex ora DependIndex+2 beq chkFormula lda SrcCellFormat+2 and #S_CellCircular beq doTraverse MoveWord #S_RecentlyChangedBit2,S_FixFormulaFlag inc ClrSrcFlag doTraverse in Cell:l,SrcCellTableEntry:l in #S_FixFormula:l,#S_FixFormula2:l XCall S_TraverseDependFormulas chkFormula lda SrcCellType bmi breakDepends and #S_CellTypeTextForm ; any formula beq breakDepends ; Adjust the cell's formula ; in Cell:l,S_MoveNewCell:l,FormulaIndex:l XCall S_FixFormula3 lda ClrSrcFlag beq breakDepends ; Clear the FixFormula Circular bits that were stuck into the formulas ; during the FixFormula pass. We know that SrcCellTableEntry is still ; good, because Cell is a real cell containing a formula. in Cell:l,SrcCellTableEntry:l in #S_ClearChangedBits:l,#S_ClearChangedBits2:l XCall S_TraverseDependFormulas Call S_ClearChangedBits,in=(Cell:l,FormulaIndex:l) ; Break up depend list into its single cell and range parts. ; The single part will be attached to new location's range part ; and the original range part left at this location. breakDepends lda FakeSrcFlag beq startRealSrc2 ; This is where we will correct SrcCellTableEntry, if it was altered ; by the FixFormula routines. in Cell:l out :l XCall S_GetCellTableEntry pla sta DependIndex sta SrcCellTableEntry pla sta DependIndex+2 sta SrcCellTableEntry+2 ora DependIndex bne gotDepList brl insertNewCell ; this only happens when the only ; dependency is a range endpt. startRealSrc2 H_GetBlockPtr SrcCellTableEntry,CellPtr MoveLong [CellPtr]:#S_CellDependOnMe,DependIndex gotDepList in DependIndex:l out SingleDeps:l,RangeDeps:l XCall S_SplitDependList ; Adjust the cell's location ; in S_MoveNewCell:l out DestCellTableEntry:l XCall S_GetCellTableEntry ora DestCellTableEntry sta DestExists beq doDestEmpty lda DestCellTableEntry+2 and #S_CellTableFlags sta FakeDestFlag beq doPadDest2 ; What follows works for both empty and fake cells doDestEmpty MoveLong DestCellTableEntry,DestDepList bra gotDestDepList ; The destination cell has already been trashed. Only range ; references can remain. (This must be a pad cell.) doPadDest2 H_GetBlockPtr DestCellTableEntry,CellPtr MoveWord [CellPtr]:#S_CellDependOnMe,DestDepList MoveWord #0,[CellPtr]:y iny iny MoveWord [CellPtr]:y,DestDepList+2 MoveWord #0,[CellPtr]:y ; Take an initial guess of the EntryToLeave, and merge the ; dep lists. (Where to store it depends on the cell types.) gotDestDepList MoveLong RangeDeps,EntryToLeave in SingleDeps:l,DestDepList:l out NewDepList:l XCall S_MergeDependLists ; Look at the Src type and see if guess was right. lda FakeSrcFlag bne setDestCell ; guessed EntryToLeave right! lda SrcCellType bpl moveRealSrc ; guessed EntryToLeave right! ; Guessed EntryToLeave wrong! ; ; We are leaving a Pad Cell behind! H_GetBlockPtr SrcCellTableEntry,CellPtr MoveLong RangeDeps,[CellPtr]:#S_CellDependOnMe MoveLong SrcCellTableEntry,EntryToLeave ; Now we look at the Dest cell type to determine how to ; set the destination cell. setDestCell lda DestExists beq storeDepList lda FakeDestFlag beq storeDepsInDest ; We are creating a fake dest cell with the NewDepList ; storeDepList MoveLong NewDepList,SrcCellTableEntry bra resetIndices ; We must store the NewDepList in the Pad cell. storeDepsInDest H_GetBlockPtr DestCellTableEntry,CellPtr MoveLong NewDepList,[CellPtr]:#S_CellDependOnMe MoveLong DestCellTableEntry,SrcCellTableEntry bra resetIndices ; When moving a Real Src Cell, the following code should be used ; instead of the previous 'case' statement. moveRealSrc lda DestExists beq storeDepsInSrc lda FakeDestFlag bne storeDepsInSrc ; If the dest is a Pad cell, it needs to be disposed of. Call S_RemoveCell,in=(S_MoveNewCell:l) storeDepsInSrc H_GetBlockPtr SrcCellTableEntry,CellPtr MoveLong NewDepList,[CellPtr]:#S_CellDependOnMe inc TestCirc resetIndices Call S_SetCellTableEntry,in=(Cell:l,EntryToLeave:l) Call S_SetCellTableEntry,in=(S_MoveNewCell:l,SrcCellTableEntry:l) ; If cell is label, fix pad cells: if cell is formula, fix ; circularity lda SrcCellType jmi chkSrcCell and #S_CellTypeTextForm ; any formula beq fixPadCells lda SrcCellFormat+2 and #S_CellCircular beq setCircular lda RangeDeps+2 ; only reset circular if ora RangeDeps ; a formula is moved out beq setCircular ; of a range Call S_ResetCircularity,in=(Cell:l) setCircular lda DestDepList+2 ; only chk circular if ora DestDepList ; a formula is moved into beq fixPadCells ; a range Call S_SetCircularBits,in=(S_MoveNewCell:l) ; Remove old pad cells ; fixPadCells in S_MoveNewCell:l out :l,:l XCall S_RearrangePadCells,err=ErrorFlag pla plx cpx S_MoveDestBR+2 blt chkLeft1 stx S_MoveDestBR+2 chkLeft1 pla plx cpx S_MoveDestTL+2 bge removeSrcPads stx S_MoveDestTL+2 removeSrcPads lda ErrorFlag jne chkSrcCell in Cell:l out :l,:l XCall S_RearrangePadCells,err=ErrorFlag pla plx cpx S_MoveSrcBR+2 blt chkLeft2 stx S_MoveSrcBR+2 chkLeft2 pla plx cpx S_MoveSrcTL+2 bge chkForLabel stx S_MoveSrcTL+2 ; Insert New pad cells ; chkForLabel lda ErrorFlag bne chkSrcCell lda SrcCellType bne chkSrcCell ; 0 = label Call S_InsertRightPadCells,in=(S_MoveNewCell:l),out=(ax:l) cpx S_MoveDestBR+2 blt chkLeft3 stx S_MoveDestBR+2 chkLeft3 Call S_InsertLeftPadCells,in=(S_MoveNewCell:l),out=(ax:l) cpx S_MoveDestTL+2 bge chkSrcCell stx S_MoveDestTL+2 chkSrcCell lda EntryToLeave ora EntryToLeave+2 beq chkDestCell Call S_AddCellToChangedList,in=(Cell:l) chkDestCell lda SrcCellTableEntry ora SrcCellTableEntry+2 beq Exit insertNewCell Call S_AddCellToChangedList,in=(S_MoveNewCell:l) Exit ProfileOut 2 RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_SplitDependList PROC EXPORT ;Using S_CurrentData input OldDependList:l output SingleDeps:l,RangeDeps:l local DependList:l,DependPtr:l,RangeDepPtr:l local RangeStart:l,RangeSize:l local RangeIndexSize:l error ErrorFlag BEGIN stz ErrorFlag stz RangeDeps+2 stz RangeDeps stz SingleDeps+2 stz SingleDeps lda OldDependList+2 ora OldDependList jeq Exit ; branch no Dep list lda OldDependList+2 bpl doFullDepList ; branch full Dep list and #S_CellTableFlags cmp #S_CellTableRangeDep beq allRangeDeps ; branch short range Dep ; The incoming list was all single references, hence this original ; list is the outgoing SingleDeps. (RangeDeps = 0) allSingleDeps MoveLong OldDependList,SingleDeps brl Exit ; The incoming list was all range references, hence this original ; list is the outgoing RangeDeps. (SingleDeps = 0) allRangeDeps MoveLong OldDependList,RangeDeps brl Exit doFullDepList MoveWord OldDependList,DependList lda OldDependList+2 and #$FFFF-S_CellTableFlags sta DependList+2 H_GetBlockPtr DependList,DependPtr MoveLong [DependPtr]:#S_DependRangeList,RangeStart ; Check if the full list is homogenous (i.e. all ranges or all singles) CmpLong RangeStart,[DependPtr] beq allSingleDeps ; brange no range deps CmpLong RangeStart,#S_DependList beq allRangeDeps ; branch all range deps ; The original list contains both single and range deps ; If there is only one single dep or one range dep, Create ; short dep lists CmpLong RangeStart,#S_DependList+S_DependInc jne moreThanOneSingle ; There is only one single dependency. It will be a short list. MoveWord [DependPtr]:#S_DependList,SingleDeps MoveWord [DependPtr]:#S_DependList+2,a ora #S_CellTableSingDep sta SingleDeps+2 ; Check if there are more than one range dependencies. CmpLong [DependPtr],#S_DependList+S_DependInc+S_DependInc bne moreThanOneRange ; Yes, kill the old dep list. MoveWord [DependPtr]:#S_DependList+S_DependInc,RangeDeps MoveWord [DependPtr]:#S_DependList+S_DependInc+2,a ora #S_CellTableRangeDep sta RangeDeps+2 H_DisposeBlock DependList brl Exit ; Since the range part of the list is a full list, but the single ; part is not, we must move the data up and shorten the heap block. moreThanOneRange MoveLong OldDependList,RangeDeps SubLong [DependPtr],RangeStart,RangeSize SubLong [DependPtr],#S_DependInc,RangeIndexSize MoveLong RangeIndexSize,[DependPtr] MoveLong #S_DependList,[DependPtr]:#S_DependRangeList AddLong DependPtr,#S_DependList+S_DependInc,s AddLong DependPtr,#S_DependList,s PushLong RangeSize Tool _BlockMove,in=(:l,:l,:l) H_ResizeBlock DependList,RangeIndexSize ; resize smaller always works brl Exit ; The single part is a full list, so we will have to shorten the ; original dep list. But first we must handle the range part. moreThanOneSingle MoveLong OldDependList,SingleDeps SubLong [DependPtr],RangeStart,RangeSize CmpLong RangeSize,#S_DependInc bne moreThanOneOfBoth ; Only one range dep, so make a short list. AddLong DependPtr,RangeStart,RangeDepPtr MoveWord [RangeDepPtr],RangeDeps MoveWord [RangeDepPtr]:#2,a ora #S_CellTableRangeDep sta RangeDeps+2 brl fixSingleDeps ; The range list is also a full list. Create a block and copy the ; range part into it. moreThanOneOfBoth AddLong RangeSize,#S_DependList,RangeIndexSize H_NewBlock RangeIndexSize,RangeDeps,RangeDepPtr,err=ErrorFlag jcs Exit MoveLong RangeIndexSize,[RangeDepPtr] MoveLong #S_DependList,[RangeDepPtr]:#S_DependRangeList H_GetBlockPtr DependList,DependPtr AddLong DependPtr,RangeStart,s AddLong RangeDepPtr,#S_DependList,s PushLong RangeSize Tool _BlockMove,in=(:l,:l,:l) lda RangeDeps+2 ora #S_CellTableList sta RangeDeps+2 ; Fix SingleDeps block. fixSingleDeps MoveLong RangeStart,[DependPtr] H_ResizeBlock DependList,RangeStart ; resize smaller always works Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_MergeDependLists PROC EXPORT ;Using S_CurrentData input SingleDeps:l,RangeDeps:l output NewDepList:l local SingleDepSize:l,SingleDepPtr:l local RangeDepSize:l,RangeDepPtr:l local NewDepSize:l,NewDepPtr:l,WhichList:w error ErrorFlag BEGIN stz ErrorFlag stz WhichList stz NewDepList stz NewDepList+2 lda SingleDeps ora SingleDeps+2 beq noSingleDeps lda RangeDeps ora RangeDeps+2 bne bothDepsExist ; There are no range deps, so the merge only yields the single deps MoveLong SingleDeps,NewDepList brl Exit ; There are no single deps, so the merge only yields the range deps noSingleDeps MoveLong RangeDeps,NewDepList brl Exit ; Both kinds of deps are party to the merge. ; First figure the New size needed to hold the New ; dependency list bothDepsExist lda SingleDeps+2 bpl fullSingle MoveLong #S_DependStructSize,SingleDepSize bra gotSingleSize fullSingle and #$FFFF-S_CellTableFlags ; won't change the high bit sta SingleDeps+2 MoveWord #$8000,WhichList H_GetBlockPtr SingleDeps,SingleDepPtr MoveLong [SingleDepPtr],SingleDepSize gotSingleSize lda RangeDeps+2 bpl fullRange MoveLong #S_DependStructSize,RangeDepSize bra gotRangeSize fullRange and #$FFFF-S_CellTableFlags ; won't change the high bit sta RangeDeps+2 inc WhichList H_GetBlockPtr RangeDeps,RangeDepPtr MoveLong [RangeDepPtr],RangeDepSize gotRangeSize AddLong SingleDepSize,RangeDepSize,NewDepSize SubLong NewDepSize,#S_DependList,NewDepSize ; We have the New size, now we need to figure out where to store ; the New list. lda WhichList jeq makeNewList jmi stretchSingle ; There is a full Range List and a short Single list. ; Now stretch the RangeDeps and insert the SingleDeps at the ; beginning of this dependency list. MoveLong RangeDeps,NewDepList H_ResizeBlock RangeDeps,NewDepSize,NewDepPtr,err=ErrorFlag jcs Exit ; The range list is now big enough, we need to shift the ; range over to make room for the single deps. AddLong NewDepPtr,#S_DependList,s AddLong NewDepPtr,SingleDepSize,s SubLong RangeDepSize,#S_DependList,s Tool _BlockMove MoveWord SingleDeps,[NewDepPtr]:#S_DependList lda SingleDeps+2 and #$FFFF-S_CellTableFlags MoveWord a,[NewDepPtr]:#S_DependList+2 brl fixDependHeader ; Neither of the lists is a full list. Make one. makeNewList H_NewBlock NewDepSize,NewDepList,NewDepPtr,err=ErrorFlag jcs Exit MoveWord SingleDeps,[NewDepPtr]:#S_DependList lda SingleDeps+2 and #$FFFF-S_CellTableFlags MoveWord a,[NewDepPtr]:#S_DependList+2 bra insert1RangeDep ; The SingleDeps is a full list. ; So stretch the SingleDeps and insert the RangeDeps at the ; end of this dependency list. stretchSingle MoveLong SingleDeps,NewDepList H_ResizeBlock SingleDeps,NewDepSize,NewDepPtr,err=ErrorFlag jcs Exit ; We now have a block that already contains the single deps ; in the front part of the list. Add the RangeDeps. lda RangeDeps+2 bpl fullRangeDeps2 insert1RangeDep AddLong NewDepPtr,SingleDepSize,RangeDepPtr MoveWord RangeDeps,[RangeDepPtr] lda RangeDeps+2 and #$FFFF-S_CellTableFlags MoveWord a,[RangeDepPtr]:#2 bra fixDependHeader fullRangeDeps2 H_GetBlockPtr RangeDeps,s AddLong 1:s,#S_DependList,1:s AddLong NewDepPtr,SingleDepSize,s SubLong RangeDepSize,#S_DependList,s Tool _BlockMove,in=(:l,:l,:l) H_DisposeBlock RangeDeps ; We need to fix the header information at the beginning ; of the NewDepList. fixDependHeader MoveLong NewDepSize,[NewDepPtr] MoveLong SingleDepSize,[NewDepPtr]:#S_DependRangeList lda NewDepList+2 ora #S_CellTableList sta NewDepList+2 Exit RETURN ENDP ;---------------------------------------------------------------------------- ; S_TraverseDependFormulas ; ; This routine will traverse a Source cell's dependency list and call one ; of two routines for every DependOnMe in the list. This first routine is ; for single cell references and the second is for ranges. ; ; Call SingleFunc,in=(DependCell:l,FormulaIndex:l) ; ; Call RangeFunc,in=(DependCell:l,FormulaIndex:l),out=(MovedBool:w) ; ; This SingleFunc should not change the depend list. RangeFunc may, ; but must note this in the output. (1 = changed) ; S_TraverseDependFormulas PROC EXPORT ;Using S_CurrentData input SrcCell:l,SrcCellTableEntry:l,SingleFunc:l,RangeFunc:l local SrcCellPtr:l,DependIndex:l local DependPtr:l,Start:l,Stop:l local DestCell:l,DestCellPtr:l,FormulaPtr:l local Ptr:l,FakeSrcFlag:w error ErrorFlag BEGIN stz ErrorFlag ; First find out if the CellTableEntry is a Depend-list or a Cell Index lda SrcCellTableEntry+2 and #S_CellTableFlags sta FakeSrcFlag beq doRealSrc1 MoveLong SrcCellTableEntry,DependIndex bra chkDepIndex doRealSrc1 H_GetBlockPtr SrcCellTableEntry,SrcCellPtr MoveLong [SrcCellPtr]:#S_CellDependOnMe,DependIndex chkDepIndex lda DependIndex ora DependIndex+2 jeq Exit MoveWord SingleFunc,SingleCall+1 sta SingleCall2+1 MoveWord SingleFunc+1,SingleCall+2 sta SingleCall2+2 MoveWord RangeFunc,RangeCall+1 sta RangeCall2+1 MoveWord RangeFunc+1,RangeCall+2 sta RangeCall2+2 lda DependIndex+2 bpl fullList ; We have a short list. This requires only one call to either the ; single or range function. shortList MoveWord DependIndex,DestCell lda DependIndex+2 and #$FFFF-S_CellTableFlags sta DestCell+2 in DestCell:l out DestCellPtr:l XCall S_GetCellPtr lda DestCellPtr+2 ; Whoops! This needs to ora DestCellPtr ; be here, since in the beq goToExit ; move/swap of circular ; formulas it is possible MoveWord [DestCellPtr]:#S_CellFormat,a ; to imply that a cell exists bmi goToExit ; with a ref. that is not ; really there, or is only and #S_CellTypeTextForm ;any formula ; a pad cell. (I think the beq goToExit ; last check, for formulas, ; is not really necessary, ; but I am including it for ; completeness.) MRH 6/9/89 lda DependIndex+2 and #S_CellTableFlags cmp #S_CellTableRangeDep bne oneSingle ; One range function call SpaceWord PushLong DestCell PushLong [DestCellPtr]:#S_CellContent RangeCall2 jsl * sta ErrorFlag pla goToExit brl Exit ; One single function call oneSingle PushLong DestCell PushLong [DestCellPtr]:#S_CellContent SingleCall2 jsl * sta ErrorFlag brl Exit ;-------------------------------- ; Adjust the cell's DependOnMe single references ; We know that the Depend-list is an index fullList and #$FFFF-S_CellTableFlags sta DependIndex+2 H_GetBlockPtr DependIndex,DependPtr MoveLong #S_DependList,Start MoveLong [DependPtr]:#S_DependRangeList,Stop bra cmpEnd singleLoop AddLong DependPtr,Start,Ptr MoveLong [Ptr],DestCell in DestCell:l out DestCellPtr:l XCall S_GetCellPtr lda DestCellPtr+2 ; See the above comment ora DestCellPtr ; about similar code. beq nextSingle ; ; MoveWord [DestCellPtr]:#S_CellFormat,a ; bmi nextSingle ; ; and #S_CellTypeTextForm ;any formula ; beq nextSingle ; PushLong DestCell PushLong [DestCellPtr]:#S_CellContent SingleCall jsl * sta ErrorFlag jcs Exit H_GetBlockPtr DependIndex,DependPtr ; We must Deref again, because ; building Undo may move memory ; The list is still the same. nextSingle AddLong Start,#4,Start cmpEnd CmpLong Start,Stop blt singleLoop ;-------------------------------- ; Adjust the cell's DependOnMe range references, ; We still know that the Depend-list is still an index, ; and that DependPtr is accurate. MoveLong [DependPtr]:#S_DependRangeList,Start brl cmpEnd2 rangeLoop AddLong DependPtr,Start,Ptr MoveLong [Ptr],DestCell in DestCell:l out DestCellPtr:l XCall S_GetCellPtr lda DestCellPtr+2 ; See the above comments ora DestCellPtr ; about similar code. beq nextRange2 ; ; MoveWord [DestCellPtr]:#S_CellFormat,a ; bmi nextRange2 ; ; and #S_CellTypeTextForm ;any formula ; beq nextRange2 ; SpaceWord PushLong DestCell PushLong [DestCellPtr]:#S_CellContent RangeCall jsl * sta ErrorFlag pla bcs goToExit2 bne getListAgain H_GetBlockPtr DependIndex,DependPtr nextRange2 AddLong Start,#4,Start cmpEnd2 CmpLong Start,[DependPtr] blt rangeLoop goToExit2 bra Exit ; The following code is for finding the dependency list again after ; it was changed in the RangeFunc. Since we are only interested in ; range part of the list, we can not use the initialization code. getListAgain lda FakeSrcFlag beq doRealSrc2 in SrcCell:l out DependIndex:l XCall S_GetCellTableEntry bra gotDepList2 doRealSrc2 H_GetBlockPtr SrcCellTableEntry,SrcCellPtr MoveLong [SrcCellPtr]:#S_CellDependOnMe,DependIndex gotDepList2 lda DependIndex+2 ; Is there a list left. ora DependIndex beq Exit lda DependIndex+2 ; check for short list bpl fullList2 and #S_CellTableFlags cmp #S_CellTableSingDep beq Exit brl shortList ; We know that the Dep list is still an index. fullList2 and #$FFFF-S_CellTableFlags sta DependIndex+2 H_GetBlockPtr DependIndex,DependPtr ; Since the Dep list changed bra cmpEnd2 ; we will do this location again. Exit RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_FixDependList PROC EXPORT ;Using S_CurrentData ;Using S_MoveData input Cell:l local DependList:l,Stop:l,CellTableEntry:l local FakeCellFlag:w,Flags:w error ErrFlag BEGIN CellPtr equ CellTableEntry DependPtr equ DependList stz ErrFlag in Cell:l out CellTableEntry:l XCall S_GetCellTableEntry ora CellTableEntry ; this can happen when jeq Exit ; a cell refers to itself lda CellTableEntry+2 and #S_CellTableFlags sta FakeCellFlag beq doRealCell MoveLong CellTableEntry,DependList bra chkDependList doRealCell H_GetBlockPtr CellTableEntry,CellPtr MoveLong [CellPtr]:#S_CellDependOnMe,DependList chkDependList lda DependList+2 bpl fullList ; This is a short list. If it points to the S_MoveOldCell, ; change it to the S_NewMoveCell. and #S_CellTableFlags sta Flags lda DependList+2 and #$FFFF-S_CellTableFlags cmp S_MoveOldCell+2 bne toExit CmpWord DependList,S_MoveOldCell bne toExit MoveWord S_MoveNewCell,DependList lda S_MoveNewCell+2 ora Flags sta DependList+2 lda FakeCellFlag beq realCell Call S_SetCellTableEntry,in=(Cell:l,DependList:l) toExit brl Exit realCell MoveLong DependList,[CellPtr]:#S_CellDependOnMe bra Exit ; This is a full list. Change all occurances of the S_MoveOldCell ; to the S_MoveNewCell fullList and #$FFFF-S_CellTableFlags sta DependList+2 H_GetBlockPtr DependList,DependPtr ; lda DependPtr+2 ; ora DependPtr ; I dont know if this ; beq Exit ; ever happens AddLong DependPtr,[DependPtr],Stop AddLong DependPtr,#S_DependList,DependPtr formLoop CmpLong S_MoveOldCell,[DependPtr] bne fixedToHere MoveLong S_MoveNewCell,[DependPtr] fixedToHere AddLong DependPtr,#4,DependPtr CmpLong DependPtr,Stop blt formLoop Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_FixFormula PROC EXPORT ;Using S_CurrentData ;Using S_MoveData input Cell:l,FormulaIndex:l local FormulaPtr:l local Start:w,Stop:w,RealCell:l local RefByte:w error ErrFlag BEGIN ProfileIn 4 stz ErrFlag H_GetBlockPtr FormulaIndex,FormulaPtr MoveWord [FormulaPtr]:#E_FormulaCells,Stop MoveWord #E_FormulaData,Start ; No need to check first, a DependOnMe pointer assures at least ; one cell in formula dependLoop MoveWord [FormulaPtr]:Start,a and #$0080 jne notSingleCell lda [FormulaPtr],y ; this hack lets me and #S_RecentlyChangedBit ; know if this is a jne nextDepend ; newly changed reference SpaceLong AddWord Start,#3,y PushWord [FormulaPtr]:y dey dey PushWord [FormulaPtr]:y dey lda [FormulaPtr],y and #$00FF sta RefByte pha PushLong Cell Call S_GetRealCell PullLong RealCell CmpLong RealCell,S_MoveOldCell bne nextDepend in S_MoveNewCell:l,RefByte:w,Cell:l XCall S_GetRefCell pla ora S_FixFormulaFlag MoveWord a,[FormulaPtr]:Start iny PullLong [FormulaPtr]:y nextDepend AddWord Start,#5,Start bra cmpEnd notSingleCell AddWord Start,#10,Start cmpEnd CmpWord Start,Stop jlt dependLoop ProfileOut 4 RETURN EXPORT S_FixFormulaFlag S_FixFormulaFlag DC.W 0 ; This purpose of this flag is so that swaps can know if ; ; the cell is a recently converted cell reference. ; ENDP ;------------------------------------------------------------------------- ; ; S_FixFormula2 PROC EXPORT ;Using S_CurrentData ;Using S_MoveData ;Using S_DependData input Cell:l,FormulaIndex:l output Moved:w local Start:w,Stop:w,RealCell:l,RealCell2:l local RefByte:w,RefByte2:w,FormulaPtr:l,WhichEnd:w local RecentChange1:w,RecentChange2:w local NewRealCell:l,NewRealCell2:l error ErrorFlag BEGIN ProfileIn 5 stz ErrorFlag stz Moved H_GetBlockPtr FormulaIndex,FormulaPtr MoveWord [FormulaPtr]:#E_FormulaCells,Stop MoveWord #E_FormulaData,Start ; No need to check first, a DependOnMe pointer assures at least ; one cell in formula dependLoop stz WhichEnd MoveWord [FormulaPtr]:Start,a and #$0080 jeq notRange lda [FormulaPtr],y ; this hack lets me and #S_RecentlyChangedBit ; know if this is a sta RecentChange1 ; newly changed reference SpaceLong AddWord Start,#3,y PushWord [FormulaPtr]:y dey dey PushWord [FormulaPtr]:y dey lda [FormulaPtr],y and #$00FF sta RefByte pha PushLong Cell Call S_GetRealCell PullLong RealCell SpaceLong AddWord Start,#8,y PushWord [FormulaPtr]:y dey dey PushWord [FormulaPtr]:y dey lda [FormulaPtr],y and #$00FF sta RefByte2 pha lda [FormulaPtr],y ; this hack lets me and #S_RecentlyChangedBit ; know if this is a sta RecentChange2 ; newly changed reference PushLong Cell Call S_GetRealCell PullLong RealCell2 ; Are any changes necessary ; CmpLong RealCell,S_MoveOldCell bne same1 lda RecentChange1 bne same1 inc WhichEnd MoveLong S_MoveNewCell,NewRealCell bra chk2 same1 MoveLong RealCell,NewRealCell chk2 CmpLong RealCell2,S_MoveOldCell bne same2 lda RecentChange2 bne same2 lda #2 tsb WhichEnd MoveLong S_MoveNewCell,NewRealCell2 bra chkAny same2 MoveLong RealCell2,NewRealCell2 chkAny lda WhichEnd jeq nextDepend MoveLong Cell,S_DependHomeCell inc Moved Call S_NormalizeRange,in=(NewRealCell:l,NewRealCell2:l) in #S_EnterRangeDep:l ; 2 inputs already on stack XCall S_TraverseRange,err=ErrorFlag jcs memError Call S_NormalizeRange,in=(RealCell:l,RealCell2:l) in #S_RemoveRangeDep:l ; 2 inputs already on stack XCall S_TraverseRange,err=ErrorFlag H_GetBlockPtr FormulaIndex,FormulaPtr lda WhichEnd and #1 beq fixSecond in NewRealCell:l,RefByte:w,Cell:l XCall S_GetRefCell pla ora S_FixFormulaFlag MoveWord a,[FormulaPtr]:Start iny PullLong [FormulaPtr]:y fixSecond lda WhichEnd and #2 beq nextDepend in NewRealCell2:l,RefByte2:w,Cell:l XCall S_GetRefCell AddWord Start,#5,y pla ora S_FixFormulaFlag sta [FormulaPtr],y iny PullLong [FormulaPtr]:y nextDepend AddWord Start,#10,Start bra cmpEnd notRange AddWord Start,#5,Start cmpEnd CmpWord Start,Stop jlt dependLoop lda Moved beq Exit Call S_ResetCircularity,in=(Cell:l) Call S_SetCircularBits,in=(Cell:l) ; bra Exit memError Exit ProfileOut 5 RETURN ENDP ;------------------------------------------------------------------------ ; ; S_ChkContent PROC EXPORT ;Using S_CurrentData input Cell:l,CellIndex:l local CellPtr:l error ErrorFlag BEGIN stz ErrorFlag H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellFormat,a bmi Exit inc ErrorFlag Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Move2.aii b/appleworksgs/SS/Src/Move2.aii new file mode 100755 index 0000000..1a1cc0e --- /dev/null +++ b/appleworksgs/SS/Src/Move2.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'M16.Profile' INCLUDE 'SS.equ' ; INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT S_AcceptCell IMPORT S_AddCellToChangedList IMPORT S_BuildTrashUndo IMPORT S_DeltaMove IMPORT S_DependHomeCell IMPORT S_FixDependList IMPORT S_GetCellTableEntry IMPORT S_GetRealCell IMPORT S_GetRefCell IMPORT S_InRange IMPORT S_MoveCell IMPORT S_MoveDestBR IMPORT S_MoveDestTL IMPORT S_MoveOldCell IMPORT S_MoveSrcTL IMPORT S_NormalizeRange IMPORT S_OrigTransDestBR IMPORT S_OrigTransDestTL IMPORT S_RemoveRangeDep IMPORT S_ResetCircularity IMPORT S_SetCellTableEntry IMPORT S_SetCircularBits IMPORT S_SplitDependList IMPORT S_SwapCell IMPORT S_TraverseDependFormulas IMPORT S_TraverseRange ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_TrashFormula ENTRY S_TrashFormula2 ;------------------------------------------------------------------------- ; ; S_TrashCell PROC EXPORT ;Using S_CurrentData ;Using S_MoveData input Cell:l,CellTableEntry:l local DependList:l,DependPtr:l local CellPtr:l,FakeCellFlag:w local SingleList:l,RangeList:l local RangeStart:l,RangeSize:l error ErrFlag BEGIN ProfileIn 1 stz ErrFlag ; We know that there is something at this location. If it is only ; a depend list, we can skip the first part of this routine. lda CellTableEntry+2 and #S_CellTableFlags sta FakeCellFlag bne doTrashTraverse ; If a user-cell exists, we will first remove the cell (as if with ; a delete key). This will clean up any depend ptrs to this cell as ; well as fix up any pad cells. ldx #S_CellTypeEmpty in Cell:l,x:w,x:w,x:w,x:w out :l,:l XCall S_AcceptCell,err=ErrFlag pla plx cpx S_MoveDestBR+2 blt chkLeft1 stx S_MoveDestBR+2 chkLeft1 pla plx cpx S_MoveDestTL+2 bge getIndex stx S_MoveDestTL+2 getIndex lda ErrFlag jne Exit ; Now if there are any depend ptrs left at this location, we need to ; 'trash' the formulas that refer to this cell. First get the depend list. ; Call S_GetCellTableEntry,in=(Cell:l),out=(CellTableEntry:l) ora CellTableEntry jeq Exit lda CellTableEntry+2 and #S_CellTableFlags sta FakeCellFlag ; This will traverse the depend list and trash any cells that refer ; to this cell. doTrashTraverse MoveLong Cell,S_MoveOldCell in Cell:l,CellTableEntry:l,#S_TrashFormula:l,#S_TrashFormula2:l XCall S_TraverseDependFormulas,err=ErrFlag jcs Exit ; Get the DependList again. It could have changed, because trashing an ; endpt of a range will modify depend lists. lda FakeCellFlag beq doRealCell Call S_GetCellTableEntry,in=(Cell:l),out=(DependList:l) bra gotDepList doRealCell H_GetBlockPtr CellTableEntry,CellPtr MoveWord [CellPtr]:#S_CellDependOnMe,DependList MoveWord [CellPtr]:#S_CellDependOnMe+2,DependList+2 ; If nothing left, quit. gotDepList ora DependList bne gotDepList2 bra Exit ; Else, keep only the range part of the list. To do this we need ; to split up the list and Save the range part at the cell. We'll ; throw away the single part. gotDepList2 in DependList:l out SingleList:l,RangeList:l XCall S_SplitDependList,err=ErrFlag bcs Exit ; Save the range part. lda FakeCellFlag beq doPadCell2 Call S_SetCellTableEntry,in=(Cell:l,RangeList:l) bra depListSet doPadCell2 H_GetBlockPtr CellTableEntry,CellPtr MoveWord RangeList,[CellPtr]:#S_CellDependOnMe MoveWord RangeList+2,[CellPtr]:#S_CellDependOnMe+2 ; Throw away the single part. depListSet lda SingleList+2 bmi Exit and #$FFFF-S_CellTableFlags sta SingleList+2 ora SingleList beq Exit H_DisposeBlock SingleList Exit ProfileOut 1 RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_TrashFormula PROC EXPORT ;Using S_CurrentData ;Using S_MoveData input DependCell:l,FormulaIndex:l local FormulaPtr:l,Start:w,Stop:w,RealCell:l error ErrFlag BEGIN stz ErrFlag Call S_AddCellToChangedList,in=(DependCell:l) in DependCell:l,FormulaIndex:l XCall S_BuildTrashUndo,err=ErrFlag jcs Exit H_GetBlockPtr FormulaIndex,FormulaPtr MoveWord [FormulaPtr]:#E_FormulaCells,Stop MoveWord #E_FormulaData,Start ; No need to check first, a DependOnMe pointer assures at least ; one cell in formula dependLoop MoveWord [FormulaPtr]:Start,a and #$0080 jne notSingleCell SpaceLong AddWord Start,#3,y PushWord [FormulaPtr]:y dey dey PushWord [FormulaPtr]:y dey lda [FormulaPtr],y and #$00FF pha PushLong DependCell Call S_GetRealCell PullLong RealCell CmpLong RealCell,S_MoveOldCell bne nextDepend ldy Start iny MoveLong #S_NotACell,[FormulaPtr]:y nextDepend AddWord Start,#5,Start bra cmpEnd notSingleCell AddWord Start,#10,Start cmpEnd CmpWord Start,Stop jlt dependLoop Exit RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_TrashFormula2 PROC EXPORT ;Using S_CurrentData ;Using S_MoveData ;Using S_DependData input DependCell:l,FormulaIndex:l output Moved:w local FormulaPtr:l,Stop:w,Start:w local RealCell:l,RealCell2:l,WhichEnd:w error ErrFlag BEGIN stz ErrFlag stz Moved Call S_AddCellToChangedList,in=(DependCell:l) H_GetBlockPtr FormulaIndex,FormulaPtr MoveWord [FormulaPtr]:#E_FormulaCells,Stop MoveWord #E_FormulaData,Start ; No need to check first, a DependOnMe pointer assures at least ; one cell in formula dependLoop MoveWord [FormulaPtr]:Start,a and #$0080 jeq notRange SpaceLong AddWord Start,#3,y PushWord [FormulaPtr]:y dey dey PushWord [FormulaPtr]:y dey lda [FormulaPtr],y and #$00FF pha PushLong DependCell Call S_GetRealCell PullLong RealCell SpaceLong AddWord Start,#8,y PushWord [FormulaPtr]:y dey dey PushWord [FormulaPtr]:y dey lda [FormulaPtr],y and #$00FF pha PushLong DependCell Call S_GetRealCell PullLong RealCell2 CmpLong RealCell,S_MoveOldCell beq doAdjust1 CmpLong RealCell2,S_MoveOldCell jne nextDepend MoveWord #1,WhichEnd bra doAdjust doAdjust1 stz WhichEnd doAdjust MoveLong DependCell,S_DependHomeCell Call S_NormalizeRange,in=(RealCell:l,RealCell2:l) in #S_RemoveRangeDep:l ; 2 inputs already on stack XCall S_TraverseRange in DependCell:l,FormulaIndex:l XCall S_BuildTrashUndo,err=ErrFlag bcs Exit H_GetBlockPtr FormulaIndex,FormulaPtr lda WhichEnd bne doSecond ldy Start iny bra fixRange doSecond AddWord Start,#6,y fixRange MoveLong #S_NotACell,[FormulaPtr]:y inc Moved nextDepend AddWord Start,#10,Start bra cmpEnd notRange AddWord Start,#5,Start cmpEnd CmpWord Start,Stop jlt dependLoop lda Moved beq Exit Call S_ResetCircularity,in=(DependCell:l) Call S_SetCircularBits,in=(DependCell:l) Exit RETURN ENDP ;------------------------------------------------------------------------- ; ; S_TransposeCell PROC EXPORT ;Using S_MoveData input SrcCell:l local DestCell:l,SrcIndex:l error ErrorFlag BEGIN stz ErrorFlag SubWord SrcCell+2,S_MoveSrcTL+2,a AddWord a,S_MoveSrcTL,DestCell SubWord SrcCell,S_MoveSrcTL,a AddWord a,S_MoveSrcTL+2,DestCell+2 SubWord DestCell,SrcCell,S_DeltaMove SubWord DestCell+2,SrcCell+2,S_DeltaMove+2 in S_OrigTransDestTL:l,S_OrigTransDestBR:l,SrcCell:l out a:w XCall S_InRange beq notInRange lda S_DeltaMove+2 ; note: during a transpose bpl Exit ; only one direction is + Call S_SwapCell,in=(SrcCell:l),err=ErrorFlag bra Exit notInRange in SrcCell:l out SrcIndex:l XCall S_GetCellTableEntry ora SrcIndex beq Exit in SrcCell:l,SrcIndex:l XCall S_MoveCell Exit RETURN ENDP ;------------------------------------------------------------------------- ; ; S_FixFormula3 PROC EXPORT ;Using S_CurrentData input SrcCell:l,DestCell:l,FormulaIndex:l local FormulaPtr:l,Start:w,Stop:w,ChangedBit:w local RefByte:w,RealCell:l,RealCell2:l BEGIN ProfileIn 6 H_GetBlockPtr FormulaIndex,FormulaPtr MoveWord [FormulaPtr]:#E_FormulaCells,Stop MoveWord #E_FormulaData,Start brl chkDone formLoop SpaceLong AddWord Start,#3,y PushWord [FormulaPtr]:y dey dey PushWord [FormulaPtr]:y dey lda [FormulaPtr],y and #$00FF sta RefByte pha and #S_RecentlyChangedBit2 sta ChangedBit PushLong SrcCell Call S_GetRealCell PullLong RealCell Call S_GetRefCell,in=(RealCell:l,RefByte:w,DestCell:l) PullWord [FormulaPtr]:Start iny PullLong [FormulaPtr]:y AddWord Start,#5,Start ; ; This will fix some circularity problems ; ; ; lda ChangedBit ; beq cont1 ; ; CmpLong RealCell,DestCell ; bne cont1 ; ; MoveLong SrcCell,RealCell ;ont1 anop lda RefByte and #$0080 jeq singleRef SpaceLong AddWord Start,#3,y PushWord [FormulaPtr]:y dey dey PushWord [FormulaPtr]:y dey lda [FormulaPtr],y and #$00FF sta RefByte pha and #S_RecentlyChangedBit2 sta ChangedBit PushLong SrcCell Call S_GetRealCell PullLong RealCell2 Call S_GetRefCell,in=(RealCell2:l,RefByte:w,DestCell:l) PullWord [FormulaPtr]:Start iny PullLong [FormulaPtr]:y AddWord Start,#5,Start ; ; This will fix some circularity problems ; ; ; lda ChangedBit ; beq cont2 ; ; CmpLong RealCell2,DestCell ; bne cont2 ; ; MoveLong SrcCell,RealCell2 ;ont2 anop Call S_NormalizeRange,in=(RealCell:l,RealCell2:l) in #S_FixDependList:l ; 2 inputs on stack XCall S_TraverseRange bra chkDone ; This will fix some circularity problems ; The first fix solves the problem of the dest cell refering ; to the src cell, in which case the depend list is at the dest ; cell, but the src formula is being changed. singleRef CmpLong RealCell,SrcCell bne cont4 MoveLong DestCell,RealCell bra cont3 ; This solves the problem of cell that refers (singly) to itself. ; The depend list is at the src cell, but the formula ; is already changed. cont4 lda ChangedBit beq cont3 CmpLong RealCell,DestCell bne cont3 MoveLong SrcCell,RealCell cont3 Call S_FixDependList,in=(RealCell:l) chkDone CmpWord Start,Stop jlt formLoop ProfileOut 6 RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Move3.aii b/appleworksgs/SS/Src/Move3.aii new file mode 100755 index 0000000..93f2a8c --- /dev/null +++ b/appleworksgs/SS/Src/Move3.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT S_AddCellToChangedList IMPORT S_DeltaMove IMPORT S_FixFormula IMPORT S_FixFormula2 IMPORT S_FixFormula3 IMPORT S_FixFormulaFlag IMPORT S_GetCellTableEntry IMPORT S_InsertLeftPadCells IMPORT S_InsertRightPadCells IMPORT S_MergeDependLists IMPORT S_MoveDestBR IMPORT S_MoveDestTL IMPORT S_MoveNewCell IMPORT S_MoveOldCell IMPORT S_MoveSrcBR IMPORT S_MoveSrcTL IMPORT S_RearrangePadCells IMPORT S_RemoveCellFromChangedList IMPORT S_ResetCircularity IMPORT S_SetCellTableEntry IMPORT S_SetCircularBits IMPORT S_SplitDependList IMPORT S_TraverseDependFormulas ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_ClearChangedBits ENTRY S_ClearChangedBits2 ;-------------------------------------------------------------------------- ; S_SwapCell ; ; For the purposes of the comments in this routine, the following ; terminology will be used. User cell's are those cells that the user ; thinks of as cells. (These include labels, values, and 2 types of formulas. ; The cell type of user cells are always positive, and of non-user cells are ; always negative.) Pad cells are those cell structures in the cell table, used ; to indicate space for overlapping labels. Real cells will be the union of ; User and Pad cells. (This name is used because real cell structures exist.) ; Fake cells are cell table entries that consist of dependency lists. ; (Dependency lists always have some of the high 2 bits of the cell table entry ; non-zero for detection.) Empty cells are blank cell table entries. (For the ; purposes of this routine, empty cells treated as Fake cells because the ; code works.) S_SwapCell PROC EXPORT ;Using S_CurrentData ;Using S_MoveData ;Using S_SwapCellFixData input SrcCell:l local SrcCellTableEntry:l,SrcFakeFlag:w local SrcFormat:l,SrcCellType:w local SrcFormulaIndex:l,SrcDependIndex:l local SrcSingDepList:l,SrcRngDepList:l local NewSrcEntry:l,NewSrcDepList:l local DestCell:l,DestCellTableEntry:l,DestFakeFlag:w local DestFormat:l,DestCellType:w local DestFormulaIndex:l,DestDependIndex:l local DestSingDepList:l,DestRngDepList:l local NewDestEntry:l,NewDestDepList:l local CellPtr:l,PreviousCell:l,NextCell:l,ClrChangedBits:w error ErrorFlag BEGIN ; Initialize flag variables stz ErrorFlag stz SrcFakeFlag stz DestFakeFlag stz ClrChangedBits ; Determine the other cell to swap with AddWord SrcCell,S_DeltaMove,DestCell AddWord SrcCell+2,S_DeltaMove+2,DestCell+2 ; ; ; Adjust the src cell ; ; ; in SrcCell:l out SrcCellTableEntry:l XCall S_GetCellTableEntry ora SrcCellTableEntry beq fakeSrc1 ; branch empty cell lda SrcCellTableEntry+2 and #S_CellTableFlags beq realSrc1 ; branch real cell ; The following works for both fake and empty src cells. fakeSrc1 inc SrcFakeFlag MoveWord #S_CellTypeEmpty,SrcCellType MoveWord #0,SrcFormat+2 MoveLong SrcCellTableEntry,SrcDependIndex brl adjustDestCell realSrc1 H_GetBlockPtr SrcCellTableEntry,CellPtr MoveLong [CellPtr]:#S_CellContent,SrcFormulaIndex MoveLong [CellPtr]:#S_CellDependOnMe,SrcDependIndex MoveLong [CellPtr]:#S_CellFormat,SrcFormat MoveLong [CellPtr]:#S_CellNext,NextCell MoveLong [CellPtr]:#S_CellPrevious,PreviousCell lda SrcFormat+2 and #$FFFF-S_CellCircular MoveWord a,[CellPtr]:#S_CellFormat+2 lda SrcFormat and #S_CellType sta SrcCellType bmi chkChangedSrc ; branch pad cell ; Clear any circularity, we'll reset them at the end ; userSrc1 lda SrcFormat+2 and #S_CellCircular beq chkChangedSrc Call S_ResetCircularity,in=(SrcCell:l) ; Remove SrcCell from changed list if it is already there. ; chkChangedSrc lda NextCell+2 ora NextCell beq adjustDestCell lda #0 MoveWord a,[CellPtr]:#S_CellNext MoveWord a,[CellPtr]:#S_CellNext+2 MoveWord a,[CellPtr]:#S_CellPrevious MoveWord a,[CellPtr]:#S_CellPrevious+2 in SrcCell:l,PreviousCell:l,NextCell:l XCall S_RemoveCellFromChangedList ; ; ; Adjust the dest cell ; ; ; adjustDestCell in DestCell:l out DestCellTableEntry:l XCall S_GetCellTableEntry ora DestCellTableEntry beq fakeDest ; branch empty cell lda DestCellTableEntry+2 and #S_CellTableFlags beq realDest1 ; branch real cell ; The following works for both fake and empty Dest cells. fakeDest inc DestFakeFlag MoveWord #S_CellTypeEmpty,DestCellType MoveWord #0,DestFormat+2 MoveLong DestCellTableEntry,DestDependIndex brl adjustDepends realDest1 H_GetBlockPtr DestCellTableEntry,CellPtr MoveLong [CellPtr]:#S_CellContent,DestFormulaIndex MoveLong [CellPtr]:#S_CellDependOnMe,DestDependIndex MoveLong [CellPtr]:#S_CellFormat,DestFormat MoveLong [CellPtr]:#S_CellNext,NextCell MoveLong [CellPtr]:#S_CellPrevious,PreviousCell lda DestFormat+2 and #$FFFF-S_CellCircular MoveWord a,[CellPtr]:#S_CellFormat+2 lda DestFormat and #S_CellType sta DestCellType bmi chkChangedDest ; branch pad cell ; Clear any circularity, we'll reset them at the end ; userDest lda DestFormat+2 and #S_CellCircular beq chkChangedDest Call S_ResetCircularity,in=(DestCell:l) ; Remove DestCell from changed list if it is already there. chkChangedDest lda NextCell+2 ora NextCell beq adjustDepends lda #0 MoveWord a,[CellPtr]:#S_CellNext MoveWord a,[CellPtr]:#S_CellNext+2 MoveWord a,[CellPtr]:#S_CellPrevious MoveWord a,[CellPtr]:#S_CellPrevious+2 in DestCell:l,PreviousCell:l,NextCell:l XCall S_RemoveCellFromChangedList ; Adjust src cell's DependOnMe references adjustDepends lda SrcDependIndex ora SrcDependIndex+2 beq adjustDestDep ; Set up the globals used in the FixFormula routines stz S_FixFormulaFlag MoveLong SrcCell,S_MoveOldCell MoveLong DestCell,S_MoveNewCell ; The first changed bit allows for formulas with references to ; both cells involved, and the Fix routines will still work. ; The second changed bit allows for circular references to itself. lda DestDependIndex ora DestDependIndex+2 beq doFixFormFlag1 MoveWord #S_RecentlyChangedBit,S_FixFormulaFlag inc ClrChangedBits doFixFormFlag1 lda SrcFormat+2 and #S_CellCircular beq doTraverse1 lda #S_RecentlyChangedBit2 tsb S_FixFormulaFlag inc ClrChangedBits doTraverse1 in SrcCell:l,SrcCellTableEntry:l in #S_FixFormula:l,#S_FixFormula2:l XCall S_TraverseDependFormulas ; Adjust dest cell's DependOnMe references adjustDestDep lda DestDependIndex ora DestDependIndex+2 beq adjustFormulas stz S_FixFormulaFlag MoveLong DestCell,S_MoveOldCell MoveLong SrcCell,S_MoveNewCell lda DestFormat+2 and #S_CellCircular beq doTraverse2 MoveWord #S_RecentlyChangedBit2,S_FixFormulaFlag inc ClrChangedBits doTraverse2 in DestCell:l,DestCellTableEntry:l in #S_FixFormula:l,#S_FixFormula2:l XCall S_TraverseDependFormulas ; Adjust src cell's formula ; adjustFormulas lda SrcCellType bmi adjustDestFormula ; branch non-user cell and #S_CellTypeTextForm beq adjustDestFormula ; branch non-formula cell MoveLong SrcCell,S_MoveOldCell MoveLong DestCell,S_MoveNewCell in SrcCell:l,DestCell:l,SrcFormulaIndex:l XCall S_FixFormula3 ; Adjust dest cell's formula ; adjustDestFormula lda DestCellType bmi chkClrChangedBits ; branch non-user cell and #S_CellTypeTextForm beq chkClrChangedBits ; branch non-formula cell MoveLong DestCell,S_MoveOldCell MoveLong SrcCell,S_MoveNewCell in DestCell:l,SrcCell:l,DestFormulaIndex:l XCall S_FixFormula3 chkClrChangedBits lda SrcFakeFlag beq chkClrChgBits2 ; branch real cell in SrcCell:l out :l XCall S_GetCellTableEntry pla sta SrcCellTableEntry sta SrcDependIndex pla sta SrcCellTableEntry+2 sta SrcDependIndex+2 ora SrcCellTableEntry beq chkClrDest ; branch empty cell chkClrChgBits2 lda ClrChangedBits beq chkClrDest in SrcCell:l,SrcCellTableEntry:l in #S_ClearChangedBits:l,#S_ClearChangedBits2:l XCall S_TraverseDependFormulas lda SrcCellType bmi chkClrDest ; branch non-user cell and #S_CellTypeTextForm beq chkClrDest ; branch non-formula cell Call S_ClearChangedBits,in=(SrcCell:l,SrcFormulaIndex:l) chkClrDest lda DestFakeFlag beq chkClrDest2 ; branch real cell in DestCell:l out :l XCall S_GetCellTableEntry pla sta DestCellTableEntry sta DestDependIndex pla sta DestCellTableEntry+2 sta DestDependIndex+2 ora DestCellTableEntry beq doSwap ; branch empty cell chkClrDest2 lda ClrChangedBits beq doSwap in DestCell:l,DestCellTableEntry:l in #S_ClearChangedBits:l,#S_ClearChangedBits2:l XCall S_TraverseDependFormulas lda DestCellType bmi doSwap ; branch non-user cell and #S_CellTypeTextForm beq doSwap ; branch non-formula cell Call S_ClearChangedBits,in=(DestCell:l,DestFormulaIndex:l) ; Break up both depend lists into their single cell and range parts. ; The old single part will be attached to New location's range part ; and vise - versa. doSwap lda SrcFakeFlag bne splitSrcDeps ; branch fake or empty cell H_GetBlockPtr SrcCellTableEntry,CellPtr MoveLong [CellPtr]:#S_CellDependOnMe,SrcDependIndex ; Split up the depend list. ; splitSrcDeps in SrcDependIndex:l out SrcSingDepList:l,SrcRngDepList:l XCall S_SplitDependList ; Now break up the dest depend lists into its single cell and range parts. lda DestFakeFlag bne splitDestDeps ; branch fake or empty cell H_GetBlockPtr DestCellTableEntry,CellPtr MoveLong [CellPtr]:#S_CellDependOnMe,DestDependIndex splitDestDeps in DestDependIndex:l out DestSingDepList:l,DestRngDepList:l XCall S_SplitDependList ; Merge the Src's SingDepList with the Dest's RngDepList list in SrcSingDepList:l,DestRngDepList:l out NewDestDepList:l XCall S_MergeDependLists ; Merge the Dest's SingDepList with the Src's RngDepList list in DestSingDepList:l,SrcRngDepList:l out NewSrcDepList:l XCall S_MergeDependLists ; The following 3 labels represent the 3 ways to set up ; the NewSrcEntry used in this swap. ; 1) Nothing left in the Src cell. Set the depend list here. ; The New src is fake. ; 2) Pad Cell left in the Src position. Put the depend ; in the pad cell. ; 3) The Dest was user and is moving to the Src postion. Set the ; depend in the user cell. lda DestCellType bpl userSrc5 ; branch all <-> user lda SrcFakeFlag bne fakeSrc5 ; branch empty,fake <-> empty,fake,pad lda SrcCellType bmi padSrc5 ; branch pad <-> empty,fake,pad lda DestFakeFlag bne fakeSrc5 ; branch user <-> empty,fake ; A User Src is moving to a Pad Dest. The pad must be disposed of. ; A fake Src is left behind. ; Call S_RemoveCell,in=(DestCell:l) H_DisposeBlock DestCellTableEntry ; The following 9 cases get to the following code. ; empty,fake,user <-> empty,fake,pad fakeSrc5 MoveLong NewSrcDepList,NewSrcEntry lda SrcCellType jpl userDest6 ; branch user <-> empty,fake,pad lda DestFakeFlag jne fakeDest6 ; branch empty,fake <-> empty,fake brl padDest6 ; branch empty,fake <-> pad ;------------------------------------- ; The following 3 cases get to the following code. ; pad <-> empty,fake,pad padSrc5 H_GetBlockPtr SrcCellTableEntry,CellPtr MoveLong NewSrcDepList,[CellPtr]:#S_CellDependOnMe MoveLong SrcCellTableEntry,NewSrcEntry lda DestFakeFlag bne fakeDest6 ; branch pad <-> empty,fake bra padDest6 ; branch pad <-> pad ;------------------------------------- ; The following 4 cases get to the following code. ; all <-> user userSrc5 H_GetBlockPtr DestCellTableEntry,CellPtr MoveLong SrcCell,[CellPtr]:#S_CellID MoveLong NewSrcDepList,[CellPtr]:#S_CellDependOnMe MoveLong DestCellTableEntry,NewSrcEntry lda SrcFakeFlag bne fakeDest6 ; branch empty,fake <-> user lda SrcCellType bpl userDest6 ; branch user <-> user ; A User Dest is moving to a Pad Src. The pad must be disposed of. ; A fake Dest is left behind. ; Call S_RemoveCell,in=(SrcCell:l) H_DisposeBlock SrcCellTableEntry ; The following 3 labels represent the 3 ways to set up ; the NewDestEntry used in this swap. ; 1) Nothing left in the Dest cell. Set the depend list here. ; The New Dest is fake. ; 2) Pad Cell left in the Dest position. Put the depend ; in the pad cell. ; 3) The Src was real and is moving to the Dest postion. Set the ; depend in the real cell. ; The following 9 cases get to the following code. ; empty,fake,pad <-> empty,fake,user fakeDest6 MoveLong NewDestDepList,NewDestEntry bra resetIndices ;------------------------------------- ; The following 3 cases get to the following code. ; empty,fake,pad <-> pad padDest6 H_GetBlockPtr DestCellTableEntry,CellPtr MoveLong NewDestDepList,[CellPtr]:#S_CellDependOnMe MoveLong DestCellTableEntry,NewDestEntry bra resetIndices ;------------------------------------- ; The following 4 cases get to the following code. ; user <-> all userDest6 H_GetBlockPtr SrcCellTableEntry,CellPtr MoveLong DestCell,[CellPtr]:#S_CellID MoveLong NewDestDepList,[CellPtr]:#S_CellDependOnMe MoveLong SrcCellTableEntry,NewDestEntry ;------------------------------------- ; The following 16 cases get to the following code. ; all <-> all resetIndices Call S_SetCellTableEntry,in=(SrcCell:l,NewSrcEntry:l) Call S_SetCellTableEntry,in=(DestCell:l,NewDestEntry:l) ; If cells are labels, fix pad cells: if cells are formulas, fix ; circularity lda SrcCellType bpl chkSrcCirc lda DestCellType bpl chkDestCirc brl chkSrcChanged chkSrcCirc and #S_CellTypeTextForm beq chkDestCircCheck Call S_SetCircularBits,in=(DestCell:l) chkDestCircCheck lda DestCellType bmi fixSrcPadCells chkDestCirc and #S_CellTypeTextForm beq fixSrcPadCells Call S_SetCircularBits,in=(SrcCell:l) ; Remove old pad cells ; fixSrcPadCells in DestCell:l out :l,:l XCall S_RearrangePadCells,err=ErrorFlag pla plx cpx S_MoveDestBR+2 blt chkLeft1 stx S_MoveDestBR+2 chkLeft1 pla plx cpx S_MoveDestTL+2 bge fixDestPadCells stx S_MoveDestTL+2 fixDestPadCells lda ErrorFlag jne chkSrcChanged in SrcCell:l out :l,:l XCall S_RearrangePadCells,err=ErrorFlag pla plx cpx S_MoveSrcBR+2 blt chkLeft2 stx S_MoveSrcBR+2 chkLeft2 pla plx cpx S_MoveSrcTL+2 bge chkSrcLabel stx S_MoveSrcTL+2 ; Insert New pad cells ; chkSrcLabel lda ErrorFlag bne chkSrcChanged lda SrcCellType bne chkDestLabel ; 0 = label Call S_InsertRightPadCells,in=(DestCell:l),out=(ax:l) cpx S_MoveDestBR+2 blt chkLeft3 stx S_MoveDestBR+2 chkLeft3 Call S_InsertLeftPadCells,in=(DestCell:l),out=(ax:l) cpx S_MoveDestTL+2 bge chkDestLabel stx S_MoveDestTL+2 chkDestLabel lda DestCellType bne chkSrcChanged ; 0 = label Call S_InsertRightPadCells,in=(SrcCell:l),out=(ax:l) cpx S_MoveSrcBR+2 blt chkLeft4 stx S_MoveSrcBR+2 chkLeft4 Call S_InsertLeftPadCells,in=(SrcCell:l),out=(ax:l) cpx S_MoveSrcTL+2 bge chkSrcChanged stx S_MoveSrcTL+2 chkSrcChanged lda DestCellTableEntry ora DestCellTableEntry+2 beq chkDestChanged Call S_AddCellToChangedList,in=(SrcCell:l) chkDestChanged lda SrcCellTableEntry ora SrcCellTableEntry+2 beq Exit Call S_AddCellToChangedList,in=(DestCell:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; These routines clear the S_CellChangedBit of the cell reference's ; refbytes. S_ClearChangedBits PROC EXPORT ;Using S_CurrentData input Cell:l,FormulaIndex:l local FormulaPtr:l local Start:w,Stop:w BEGIN H_GetBlockPtr FormulaIndex,FormulaPtr MoveWord [FormulaPtr]:#E_FormulaCells,Stop MoveWord #E_FormulaData,Start bra chkEnd dependLoop MoveWord [FormulaPtr]:Start,a and #$FFFF-S_RecentlyChangedBit-S_RecentlyChangedBit2 sta [FormulaPtr],y AddWord Start,#5,Start chkEnd cmp Stop blt dependLoop RETURN #0 ENDP ;---------------------------------------------------------------------------- ; ; S_ClearChangedBits2 PROC EXPORT input Cell:l,FormulaIndex:l output Moved:w BEGIN stz Moved Call S_ClearChangedBits,in=(Cell:l,FormulaIndex:l) RETURN Moved ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Options.aii b/appleworksgs/SS/Src/Options.aii new file mode 100755 index 0000000..7355dfc --- /dev/null +++ b/appleworksgs/SS/Src/Options.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_DisableMItems IMPORT D_EnableMItems IMPORT D_FastMult IMPORT D_MemoryError IMPORT S_ActiveWindow IMPORT S_BuildColWdUndo IMPORT S_CalcAutoStr IMPORT S_CalcManStr IMPORT S_CalculateSheet IMPORT S_CellWidth IMPORT S_ChangeDef IMPORT S_ColLabRect IMPORT S_CurBRSelect IMPORT S_CurBRTitle IMPORT S_CurBScrl IMPORT S_CurContHt IMPORT S_CurContRect IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurDefColWd IMPORT S_CurEditFlag IMPORT S_CurMaxTLCell IMPORT S_CurRScrl IMPORT S_CurTLCell IMPORT S_CurTLSelect IMPORT S_CurTLTitle IMPORT S_CurVPageSize IMPORT S_DoDefaultWidthDlog IMPORT S_HideGridStr IMPORT S_RestoreWidth IMPORT S_RowLabRect IMPORT S_ScrlUpdate IMPORT S_SetMaxTLCell IMPORT S_SetUndoOff IMPORT S_SetUndoOn IMPORT S_SetVertLines IMPORT S_ShowGridStr IMPORT S_SwapIn IMPORT S_TitleDialog IMPORT S_TitleTooBigStr IMPORT S_TraverseRange IMPORT S_ViewDataStr IMPORT S_ViewFormStr ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_ActivateScrlBars ENTRY S_AdjustSheetColumns ENTRY S_AdjustTitleOffset ENTRY S_RefreshScreen ;--------------------------------------------------------------------------- ; ; S_ChangeCalcMode PROC EXPORT ;Using S_CurrentData ;Using S_AttrData BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) Call S_SetUndoOff lda S_CurEditFlag eor #S_ManCalcBit sta S_CurEditFlag and #S_ManCalcBit beq resetCalc Tool _SetMItemName,in=(#S_CalcAutoStr:l,#S_CalculateItem:w) Call D_EnableMItems,in=(#S_RecalcMI:w,#5:w) bra Exit resetCalc Call S_CalculateSheet Tool _SetMItemName,in=(#S_CalcManStr:l,#S_CalculateItem:w) Call D_DisableMItems,in=(#S_RecalcMI:w,#5:w) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_Recalc PROC EXPORT ;Using S_CurrentData BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) Call S_SetUndoOff Call S_CalculateSheet RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_ChangeView PROC EXPORT ;Using S_CurrentData ;Using S_AttrData BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) Call S_SetUndoOff lda S_CurEditFlag eor #S_ViewFormulaBit sta S_CurEditFlag and #S_ViewFormulaBit beq resetView Tool _SetMItemName,in=(#S_ViewDataStr:l,#S_ViewItem:w) bra redraw resetView Tool _SetMItemName,in=(#S_ViewFormStr:l,#S_ViewItem:w) redraw Call S_RefreshScreen,in=(#0:w) RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_ChangeDefWidth PROC EXPORT ;Using S_CurrentData local NewDefColWd:w error ErrFlag BEGIN +b stz ErrFlag Call S_SwapIn,in=(S_ActiveWindow:l) Call S_DoDefaultWidthDlog,in=(S_CurDefColWd:w),out=(a:w) bcs Exit sta NewDefColWd Call S_BuildColWdUndo,in=(#0:w),err=ErrFlag bcs memError MoveWord NewDefColWd,S_CurDefColWd in #1:w,#1:w,#702:w,#1:w in #S_ChangeDef:l XCall S_TraverseRange,err=ErrFlag bcc redraw memError Call D_MemoryError redraw Call S_AdjustTitleOffset Call S_ActivateScrlBars Call S_RefreshScreen,in=(#1:w) Call S_SetUndoOn,in=(#S_UndoColWdType:w) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_RestoreColWidth PROC EXPORT ;Using S_CurrentData BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) ; Call D_SetCursor,in=(#WatchCursor:w) in S_CurTLSelect+2:w,#1:w,S_CurBRSelect+2:w,#1:w in #S_RestoreWidth:l XCall S_TraverseRange bcc fixThings Call D_MemoryError fixThings Call S_AdjustSheetColumns Call S_ActivateScrlBars Call S_SetUndoOn,in=(#S_UndoColWdType:w) Call S_RefreshScreen,in=(#1:w) RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_SetTitles PROC EXPORT ;Using S_CurrentData ;Using S_ErrorData local Rect:r,RectPtr:l,TLTitle:l,BRTitle:l local LeftThere:w,TopThere:w BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) lda #0 sta TLTitle sta TLTitle+2 sta BRTitle sta BRTitle+2 sta LeftThere sta TopThere CmpWord #S_EditHeight+S_ColLabelHeight,S_CurContYpt bne setOldTopTitles CmpWord S_CurTLSelect+2,#1 bne cmpLeftTitles CmpWord S_CurBRSelect+2,#702 bne cmpLeftTitles MoveWord S_CurTLSelect,TLTitle MoveWord S_CurBRSelect,BRTitle bra cmpLeftTitles setOldTopTitles MoveWord #1,TopThere MoveWord S_CurTLTitle,TLTitle MoveWord S_CurBRTitle,BRTitle cmpLeftTitles CmpWord #S_NumLabelWidth,S_CurContXpt bne setOldLeftTitles CmpWord S_CurTLSelect,#1 bne doDialog CmpWord S_CurBRSelect,#9999 bne doDialog MoveWord S_CurTLSelect+2,TLTitle+2 MoveWord S_CurBRSelect+2,BRTitle+2 bra doDialog setOldLeftTitles MoveWord #1,LeftThere MoveWord S_CurTLTitle+2,TLTitle+2 MoveWord S_CurBRTitle+2,BRTitle+2 doDialog in TLTitle:l,BRTitle:l in LeftThere:w,TopThere:w out TLTitle:l,BRTitle:l XCall S_TitleDialog bcs Exit SubWord BRTitle,TLTitle,a cmp #35 bge tooBig SubWord BRTitle+2,TLTitle+2,a cmp #35 blt OKTitle tooBig Call D_AlertBox,in=(#OKBox:w,#S_TitleTooBigStr:l),out=(a:w) bra Exit OKtitle MoveLong TLTitle,S_CurTLTitle MoveLong BRTitle,S_CurBRTitle Call S_SetUndoOff Call S_AdjustTitleOffset Call S_ActivateScrlBars drawScreen Call S_RefreshScreen,in=(#2:w) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_ChangeGrid PROC EXPORT ;Using S_CurrentData ;Using S_AttrData BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) Call S_SetUndoOff lda S_CurEditFlag eor #S_GridOff sta S_CurEditFlag and #S_GridOff beq resetGrid Tool _SetMItemName,in=(#S_ShowGridStr:l,#S_GridItem:w) bra redraw resetGrid Tool _SetMItemName,in=(#S_HideGridStr:l,#S_GridItem:w) redraw Call S_RefreshScreen,in=(#0:w) Exit RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_AdjustTitleOffset PROC EXPORT ;Using S_CurrentData local NumCols:w,XOffset:w BEGIN lda S_CurBRTitle beq gotYOffset inc a SubWord a,S_CurTLTitle,a tay ldx #S_RowHeight Call D_FastMult gotYOffset AddWord a,#S_EditHeight+S_ColLabelHeight,S_CurContYpt lda S_CurBRTitle+2 beq gotXOffset inc a SubWord a,S_CurTLTitle+2,NumCols stz XOffset loop dec NumCols SpaceWord AddWord S_CurTLTitle+2,NumCols,s Call S_CellWidth ; in=(:w),out=(:w) AddWord s,XOffset,XOffset lda NumCols bne loop lda XOffset gotXOffset AddWord a,#S_NumLabelWidth,S_CurContXpt MoveWord S_CurContYpt,S_RowLabRect MoveWord S_CurContXpt,S_ColLabRect+2 Call S_AdjustSheetColumns RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_AdjustSheetColumns PROC EXPORT ;Using S_CurrentData BEGIN Call S_SetMaxTLCell ; Check if adjust of TLCell is needed ; CmpWord S_CurMaxTLCell,S_CurTLCell bge chkCol sta S_CurTLCell chkCol CmpWord S_CurMaxTLCell+2,S_CurTLCell+2 bge fixPadCells sta S_CurTLCell+2 fixPadCells Call S_SetVertLines RETURN ENDP ;------------------------------------------------------------------------- ; ; S_RefreshScreen PROC EXPORT ;Using S_CurrentData input RefreshType:w local UpdateRgn:l BEGIN PushWord S_CurContRect+2 PushWord S_CurContRect lda RefreshType bne colLabelSet MoveWord #S_EditHeight+S_ColLabelHeight+1,S_CurContRect colLabelSet CmpWord RefreshType,#2 beq rowLabelSet MoveWord #S_NumLabelWidth+2,S_CurContRect+2 rowLabelSet Tool _NewRgn,out=(UpdateRgn:l) Tool _RectRgn,in=(UpdateRgn:l,#S_CurContRect:l) Tool _EraseRect,in=(#S_CurContRect:l) Call S_ScrlUpdate,in=(UpdateRgn:l) Tool _DisposeRgn,in=(UpdateRgn:l) PullWord S_CurContRect PullWord S_CurContRect+2 RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_ActivateScrlBars PROC EXPORT ;Using S_CurrentData local RightOK:w BEGIN stz RightOK AddWord S_CurContYpt,#S_RowHeight,a cmp S_CurContHt blt activateVBar Tool _HiliteControl,in=(#$FF:w,S_CurRScrl:l) lda #S_KeysInactive tsb S_CurEditFlag bra chkWidth activateVBar inc RightOK Tool _HiliteControl,in=(#0:w,S_CurRScrl:l) lda S_CurVPageSize inc a tax in #-1:w,x:w,S_CurRScrl:l XTool _SetCtlParams chkWidth AddWord S_CurContXPt,#S_MinCellWidth,a cmp S_CurContWd blt activateHBar Tool _HiliteControl,in=(#$FF:w,S_CurBScrl:l) lda #S_KeysInactive tsb S_CurEditFlag bra Exit activateHBar Tool _HiliteControl,in=(#0:w,S_CurBScrl:l) in S_CurMaxTLCell+2:w,#S_BViewSize:w,S_CurBScrl:l XTool _SetCtlParams lda RightOK beq Exit lda #S_KeysInactive trb S_CurEditFlag Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Pie.aii b/appleworksgs/SS/Src/Pie.aii new file mode 100755 index 0000000..e81c03f --- /dev/null +++ b/appleworksgs/SS/Src/Pie.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;------------------------------------------ ; ; Equates from procedure S_PieData ; ;------------------------------------------ S_MaxPieCount equ 24 S_PieColWd equ 180 ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_ClosePicture IMPORT D_AlertBox IMPORT D_CheckPurge IMPORT D_Deref IMPORT D_DrawString IMPORT D_FastMult IMPORT D_KillFont IMPORT D_NeedHand IMPORT D_SelectFont IMPORT D_Set4Pat IMPORT X_FormatValue IMPORT S_ChartTitleLoc IMPORT S_MissingSlice IMPORT S_SliceStr IMPORT S_BadNum IMPORT S_BigPie IMPORT S_ChartColors IMPORT S_Cur2Heap IMPORT S_GetCellPtr IMPORT S_ItzaBar IMPORT S_NoData IMPORT S_NormalizeRange IMPORT S_PictRect IMPORT S_PieRect IMPORT S_TraverseRange IMPORT S_GetMinMax IMPORT S_NoINF ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY AngleToPt ENTRY S_Pie360 ENTRY S_PieArray ENTRY S_PieDiv ENTRY S_PieLegend ENTRY S_PieNegFlag ENTRY S_PieOffset ENTRY S_PieOne ENTRY S_PiePict ENTRY S_PieSliceCount ENTRY S_PieSum ENTRY S_PieTotal ENTRY S_PieTwo ENTRY S_PieZero ENTRY S_SlicePie ;--------------------------------------------------------------------------- ; ; S_MakePie ; ; S_MakePie PROC EXPORT ;Using S_CurrentData2 ;Using S_ChartData ;Using S_PieData ;Using SANEEQUS input charthdl:l output pict:l local arrayhdl:l,chart:l local color:w,OldClip:l local col:w,items:l local tmp:l,topl:l,botr:l error err begin stz err H_GetBlockPtr charthdl,chart call S_NormalizeRange,in=([chart]:#S_CRange:l,[chart]:#S_CRange+4:l) pulllong botr pulllong topl call S_GetMinMax,in=(topl:l,botr:l,#1:w),out=(:l) tool FCLASSX,in=(:l) txa asl a cmp #2*FCINF beq @INF call S_GetMinMax,in=(topl:l,botr:l,#0:w),out=(:l) tool FCLASSX,in=(:l) txa asl a cmp #2*FCINF bne @dopie @INF call D_AlertBox,in=(#1:w,#S_NoINF:l),out=(a:w) dec err brl exit @dopie subword botr,topl,a ina sta tmp subword botr+2,topl+2,a ina sta tmp+2 tool _Multiply,in=(tmp:w,tmp+2:w),out=(items:l) movelong items,tmp mull4 tmp tool _NewRgn,out=(OldClip:l),err=(err) jcs exit tool _GetClip,in=(OldClip:l) tool _ClipRect,in=(#S_PictRect:l) call D_NeedHand,in=(tmp:l),out=(arrayhdl:l),err=(err) jcs whoops2 rcall D_Deref,in=(arrayhdl:ax),out=(S_PieArray:ax) moveX S_PieZero,S_PieTotal stz S_PieOffset stz S_PieNegFlag call S_TraverseRange,in=(topl:l,botr:l,#S_PieSum:l),err=(err) jcs whoops lda S_PieOffset beq @nodata tool FCMPX,in=(#S_PieTotal:l,#S_PieZero:l) ; any real data? bvs OpenIt @nodata call D_AlertBox,in=(#1:w,#S_NoData:l),out=(a:w) dec err brl whoops OpenIt cmpw S_PieOffset,#S_MaxPieCount+1 blt ReallyOpen call D_AlertBox,in=(#1:w,#S_BigPie:l),out=(a:w) dec err brl whoops ReallyOpen tool _OpenPicture,in=(#S_Pictrect:l),out=(pict:l) movelong pict,S_PiePict moveword S_PieOffset,S_PieSliceCount stz S_PieOffset stz S_MissingSlice tool _PicComment,in=(#picLParen:w,#0:w,#0:l) call S_TraverseRange,in=(topl:l,botr:l,#S_PieDiv:l) tool _PicComment,in=(#picRParen:w,#0:w,#0:l) call S_SlicePie,in=(S_PieOffset:w,S_PieArray:l) ; Draw the title, at the bottom... tool _MoveTo,in=(S_ChartTitleLoc:l) _PenNormal ; necess. for #'s in case of 0's ==> no colour jsl D_KillFont rcall D_SelectFont,in=(#$FFFE:a,#$0800:x,#0:y) H_GetBlockPtr charthdl,chart addlong chart,#S_CName,s Call D_DrawString,in=(:l) jsl D_ClosePicture bcs @picErr call D_CheckPurge bcs KillIt lda S_MissingSlice beq Done call D_AlertBox,in=(#1:w,#S_SliceStr:l),out=(a:w) bra exit @picErr KillIt tool _KillPicture,in=(pict:l) call D_CheckPurge dec err ; cmpl items,#25 ; blt Done Done _PenNormal whoops tool _DisposeHandle,in=(arrayhdl:l) whoops2 tool _SetClip,in=(OldClip:l) tool _DisposeRgn,in=(OldClip:l) exit return ENDP ;--------------------------------------------------------------------------- ; ; S_PieSum ; ; check cell for negative value, RETURN error if found. ; add value to S_PieTotal S_PieSum PROC EXPORT ;Using SANEEQUS ;Using S_PieData ;Using S_ChartData ;Using S_CurrentData2 input cell:l local ptr:l,cellptr:l error err BEGIN +b stz err call S_GetCellPtr,in=(Cell:l),out=(CellPtr:l) ora CellPtr jeq Exit addlong cellptr,#S_CellFormat,ptr lda [ptr] and #S_CellTypeValue cmp #S_CellTypeText beq Exit AddLong cellptr,#S_CellValue,ptr lda S_ItzaBar bne ThatsAll tool FCMPX,in=(ptr:l,#S_PieZero:l) bpl Positive lda S_PieNegFlag bne DidFlag dec S_PieNegFlag DidFlag lda S_PieNegFlag bmi DoAdd bozo call D_AlertBox,in=(#1:w,#S_BadNum:l),out=(a:w) dec err bra exit Positive lda S_PieNegFlag bne DidNegFlag2 inc S_PieNegFlag DidNegFlag2 lda S_PieNegFlag bmi bozo DoAdd tool FADDX,in=(ptr:l,#S_PieTotal:l) ThatsAll inc S_PieOffset exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_PieDiv ; ; calculate size of each slice. S_PieDiv PROC EXPORT ;Using S_ChartData ;Using S_PieData ;Using SANEEQUS ;Using S_CurrentData2 input cell:l local p1:w,percent:r,a1:w,angle:r local cellptr:l local ptr:l,tmp:l,color:w,count:w,skip:w error err BEGIN +b stz err call S_GetCellPtr,in=(Cell:l),out=(CellPtr:l) ora CellPtr jeq Exit AddLong cellptr,#S_CellValue,cellptr moveX [cellptr],percent tool FCMPX,in=(#S_PieTotal:l,#S_PieZero:l) bne DoDiv moveX S_PieOne,percent bra DidDiv DoDiv tool FDIVX,in=(#S_PieTotal:l,!percent:l) DidDiv moveX percent,angle lda S_PieOffset asl a addlong a,S_PieArray,ptr tool FMULX,in=(#S_Pie360:l,!angle:l) tool FX2I,in=(!angle:l,!tmp:l) moveword tmp,[ptr] beq NoColor stz skip moveword S_PieOffset,color bra DoLegend NoColor inc skip inc S_MissingSlice DoLegend call S_PieLegend,in=(S_PieOffset:w,!percent:l,cellptr:l,skip:w) inc S_PieOffset exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_PieLegend ; ; Draw a single legend. ; ^^^^^^ ; Rect of color, percentage, value. S_PieLegend PROC EXPORT ;Using S_ChartData ;Using S_PieData input entry:w,percent:l,value:l,skip:w local offset:w,tmprect:r,string:l,col:w,colors:l local inccolor:w,ptr:l,drawcolor:w BEGIN stz inccolor lda S_PieSliceCount dec a cmp entry bne ContLegend cmp #0 beq ContLegend inc inccolor ContLegend movelong #S_ChartColors,colors tool _UDivide,in=(entry:w,#12:w),out=(entry:w,col:w) rcall D_FastMult,in=(entry:x,#13:y),out=(tmprect:a) rcall D_FastMult,in=(#S_PieColWd:x,col:y),out=(col:a) addword col,#S_PieLegendH,tmprect+2 addword tmprect,#8,tmprect+4 addword col,#S_PieLegendH+16,tmprect+6 tool _PicComment,in=(#picLParen:w,#0:w,#0:l) lda skip bne Didcolor lda entry asl a tay bne Do4Pat lda inccolor asl a ; 0 = blue, 2= red... asl a tay Do4Pat call D_Set4Pat,in=([colors]:y:w) tool _PaintRect,in=(!tmprect:l) _PenNormal tool _SetPenSize,in=(#2:w,#1:w) tool _FrameRect,in=(!tmprect:l) DidColor moveword tmprect+4,tmprect addword col,#S_PieLegendH+24,a tool _MoveTo,in=(a:w,tmprect:w) _PenNormal ; necess. for #'s in case of 0's ==> no colour jsl D_KillFont rcall D_SelectFont,in=(#$FFFE:a,#$0800:x,#0:y) in #60:w,#$11000:l,percent:l out a:w,string:l,a:w xcall X_FormatValue Call D_DrawString,in=(string:l) addword col,#S_PieLegendH+80,a tool _MoveTo,in=(a:w,tmprect:w) sublong value,#S_CellValue-S_CellFormat,ptr in #80:w,[ptr]:l,value:l out a:w,string:l,drawcolor:w xcall X_FormatValue lda DrawColor pha xba ora 1,s sta 1,s asl a asl a asl a asl a ora 1,s sta 1,s _SetForeColor Call D_DrawString,in=(string:l) tool _PicComment,in=(#picRParen:w,#0:w,#0:l) RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_SlicePie (count,array) ; count:w Number of slices. 1-15, inclusive ; array:l array[count] of angles for slicing. ; ; Routine to actually draw pie. Assumes PICT has already been ; opened or whatever offsets necessary have been made. ; ; Pie is drawn as the circle inscribed in the rect [0,0,150,300] ; S_SlicePie PROC EXPORT ;Using S_ChartData ;Using S_PieData input count:w,array:l local color:w,arc:w,tmp:l,colortab:l local offset:w,comment:w,single:w BEGIN lda count jeq exit sta single stz comment stz color stz offset stz arc movelong #S_ChartColors,colortab loop lda color asl a tay call D_Set4Pat,in=([colortab]:y:w) lda offset asl a tay moveword [array]:y,tmp jeq DidArc cmpw single,#1 ; in case of 1 item, full circle. beq DoPaint cmpw count,#1 bne DoComment subword #360,arc,tmp ; subvert round-off errors on last slice. DoComment tool _PicComment,in=(#picLParen:w,#0:w,#0:l) ; Avoid grouping inc comment ; single objects. DoPaint tool _PaintArc,in=(#S_PieRect:l,arc:w,tmp:w) _PenNormal tool _SetPenSize,in=(#2:w,#1:w) tool _FrameArc,in=(#S_PieRect:l,arc:w,tmp:w) subword tmp,arc,a cmp #360 ; no slices -- one pie. beq DidArc call AngleToPt,in=(arc:w),out=(a:w,x:w) pha phx _MoveTo tool _LineTo,in=(#S_PieHCtr:w,#S_PieVCtr:w) addword arc,tmp,arc call AngleToPt,in=(arc:w),out=(a:w,x:w) pha phx _MoveTo tool _LineTo,in=(#S_PieHCtr:w,#S_PieVCtr:w) lda comment beq DidArc tool _PicComment,in=(#picRParen:w,#0:w,#0:l) stz comment DidArc lda color inc a cmp #12 bne ContColor lda count dec a dec a ; Last color. bne OKFirst lda #2 ; Red bra ContColor OKFirst lda #0 ContColor sta color inc offset dec count jne loop exit RETURN ENDP **************************************************************** * * AngleToPt - take a reference rect and an angle to a point. * * Notes: The point RETURNed lies on the ellipse inscribed in the * rectangle. * * **************************************************************** AngleToPt PROC EXPORT ;Using SANEEQUS ;Using S_PieData ;Using S_ChartData input angle:w ; angle output point:l ; point (value) local tmp:l BEGIN lda angle Loop360 cmp #360 blt Did360 subword a,#360,a bra Loop360 Did360 sta angle ; Convert deg->rad ; y = (-cos(a)+1) ; 1/2 ; (rect_bot - rect_top) + rect_top ; x = (sin(a)+1) ; 1/2 ; (rect_right - rect_left) + rect_left tool FI2X,in=(!angle:l,#FlP1:l) tool FMULX,in=(#PI:l,#FlP1:l) tool FMULX,in=(#S_PieTwo:l,#FlP1:l) moveX S_Pie360,FlP3 tool FDIVX,in=(#FlP3:l,#FlP1:l) moveX FlP1,Flp2 tool FCOSX,in=(#FlP1:l) tool FSINX,in=(#FlP2:l) moveX FlP1,FlP3 moveX S_PieOne,FlP1 tool FSUBX,in=(#FlP3:l,#FlP1:l) tool FADDX,in=(#S_PieOne:l,#FlP2:l) subword S_PieRect+4,#1,tmp tool FI2X,in=(!tmp:l,#FlP3:l) tool FMULX,in=(#FlP3:l,#FlP1:l) moveX S_PieTwo,FlP3 tool FDIVX,in=(#FlP3:l,#FlP1:l) tool FX2I,in=(#FlP1:l,!point:l) subword S_PieRect+6,#1,tmp tool FI2X,in=(!tmp:l,#FlP3:l) tool FMULX,in=(#FlP3:l,#FlP2:l) moveX S_PieTwo,FlP3 tool FDIVX,in=(#FlP3:l,#FlP2:l) tool FX2I,in=(#FlP2:l,!point+2:l) RETURN PI DC.X "3.14159265358979323846264338327950288419716939937511" FlP1 DS.B 10 FlP2 DS.B 10 FlP3 DS.B 10 ENDP ;-------------------------------------------- Fix2Int PROC EXPORT tay bpl exit inx exit txa rtl ENDP ;-------------------------------------------- ; ; S_PieData ; S_PieData PROC EXPORT EXPORT S_PieNegFlag EXPORT S_PiePict EXPORT S_PieOffset EXPORT S_PieSliceCount EXPORT S_PieArray EXPORT S_PieTotal EXPORT S_PieZero EXPORT S_Pie360 EXPORT S_PieTwo EXPORT S_PieOne S_PieNegFlag DS.W 1 S_PiePict DS.L 1 S_PieOffset DS.W 1 S_PieSliceCount DS.W 1 S_PieArray DS.L 1 S_PieTotal DS.B 10 S_PieZero DC.X "0.0" S_Pie360 DC.X "360.0" S_PieTwo DC.X "2.0" S_PieOne DC.X "1.0" ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/SS.aii b/appleworksgs/SS/Src/SS.aii new file mode 100755 index 0000000..b92126a --- /dev/null +++ b/appleworksgs/SS/Src/SS.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'M16.Profile' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' INCLUDE 'Eval.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AddStrings IMPORT D_CheckPurge IMPORT D_DisposePtr IMPORT D_GetNewUntitled IMPORT D_GetPrintHandle IMPORT D_GetRefCon IMPORT D_KillFont IMPORT D_LoadSegment IMPORT D_MakeNewWin IMPORT D_NeedHand IMPORT D_PrOpenDoc IMPORT D_SelectFont IMPORT D_SetCursor IMPORT D_SetRefCon IMPORT D_UnloadSegment IMPORT S_ActivateScrlBars IMPORT S_ActiveWindow IMPORT S_BSRect IMPORT S_BSValue IMPORT S_BreakLink IMPORT S_CalcAutoStr IMPORT S_CalcManStr IMPORT S_ColLab2Text IMPORT S_ColLabRect IMPORT S_CurBRMost IMPORT S_CurBRSelect IMPORT S_CurBScrl IMPORT S_CurContHt IMPORT S_CurContRect IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurEditFlag IMPORT S_CurEditRect IMPORT S_CurGrow IMPORT S_CurLEHandle IMPORT S_CurMaxTLCell IMPORT S_CurPrinting IMPORT S_CurRScrl IMPORT S_CurRowBlock IMPORT S_CurSheet IMPORT S_CurTLCell IMPORT S_CurTLSelect IMPORT S_CurTwiceVertLines IMPORT S_CurVertLineHandSize IMPORT S_CurVertLines IMPORT S_CurWindow IMPORT S_DefWinRect IMPORT S_DisposeRowBlock IMPORT S_DoChecks IMPORT S_ExTitle IMPORT S_GetCellPtr IMPORT S_GrowRect IMPORT S_HideGridStr IMPORT S_InitState IMPORT S_InsertControls IMPORT S_KillLinks IMPORT S_LEHandle IMPORT S_LoadAWorksInfo IMPORT S_NewSheet IMPORT S_PrintPage IMPORT S_RSRect IMPORT S_RSValue IMPORT S_SetBRMostCell IMPORT S_SetMaxTLCell IMPORT S_SetUndoOff IMPORT S_SetUndoOff2 IMPORT S_SetVertLines IMPORT S_ShowGridStr IMPORT S_SwapIn IMPORT S_SwapOut IMPORT S_TBarColor IMPORT S_TitleColor IMPORT S_ViewDataStr IMPORT S_ViewFormStr IMPORT S_WinColors IMPORT S_WinPlane IMPORT S_WinRect IMPORT S_WinTitlePtr IMPORT S_WindowParms ;-------------------------------------------------------------------------; ; S_ActivateDoc ( Window:l ) ; ; S_ActivateDoc is called to make the given window the active window. ; The driver will make sure that the menu is as it was when the document was ; deactivated. (ie menu items are enabled, disabled, inserted and deleted ; just as they last were.) Any checks or menu item style changes, however, ; will have been lost and must be refreshed. S_ActivateDoc PROC EXPORT input Window:l local Sheet:l BEGIN +b Call S_SwapIn,in=(Window:l) CmpLong Window,S_ActiveWindow jeq setMenuChecks MoveLong Window,S_ActiveWindow Call S_SetVertLines ; Set the Calculate Menu string appropriately lda S_CurEditFlag and #S_ManCalcBit bne setAutoStr Tool _SetMItemName,in=(#S_CalcManStr:l,#S_CalculateItem:w) bra chkViewMode setAutoStr Tool _SetMItemName,in=(#S_CalcAutoStr:l,#S_CalculateItem:w) ; Set the View Menu string appropriately chkViewMode lda S_CurEditFlag and #S_ViewFormulaBit bne setDataStr Tool _SetMItemName,in=(#S_ViewFormStr:l,#S_ViewItem:w) bra chkGrid setDataStr Tool _SetMItemName,in=(#S_ViewDataStr:l,#S_ViewItem:w) chkGrid lda S_CurEditFlag and #S_GridOff beq resetGrid Tool _SetMItemName,in=(#S_ShowGridStr:l,#S_GridItem:w) bra chkLE resetGrid Tool _SetMItemName,in=(#S_HideGridStr:l,#S_GridItem:w) ; Set LE appropriately ; chkLE lda S_CurEditFlag and #S_EditingBit beq setMenuChecks Tool _LEActivate,in=(S_CurLEHandle:l) setMenuChecks Call S_DoChecks RETURN ENDP ;-------------------------------------------------------------------------; ; S_DeactivateDoc ( Window:l ) ; ; S_DeactivateDoc is called to deactivate the given document window. ; Active data is copied at this time to the windows information store. S_DeactivateDoc PROC EXPORT input Window:l local Sheet:l BEGIN +b ; Only deactivate if the window is still active ; CmpLong Window,S_ActiveWindow bne broughtOut Call S_SetUndoOff2 CmpLong Window,S_CurWindow bne notIn Tool _LEDeActivate,in=(S_CurLEHandle:l) Call S_SwapOut bra broughtOut notIn Call D_GetRefCon,in=(Window:l),out=(Window:l) MoveLong [Window],Sheet Tool _LEDeActivate,in=([Sheet]:#S_LEHandle:l) broughtOut stz S_ActiveWindow stz S_ActiveWindow+2 Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_DisposeDoc ( Window:l ) ; ; S_DisposeDoc is called to Close down a given window. Any data structures ; associated with the window should be removed. Note: The window will be ; closed by the driver so don't do that here. S_DisposeDoc PROC EXPORT input Window:l local Sheet:l BEGIN +b Call S_SwapIn,in=(Window:l) ; Dispose of sub-structures ; Call S_KillLinks Tool _LEDispose,in=(S_CurLEHandle:l) Call H_DisposeHeap Call S_DisposeRowBlock,in=(S_CurRowBlock:l) ; Dispose of the sheet itself ; Tool _DisposeHandle,in=(S_CurSheet:l) ; Deactivate the window, if necessary ; CmpLong Window,S_ActiveWindow bne clrCurData Call S_SetUndoOff MoveWord #0,S_ActiveWindow sta S_ActiveWindow+2 ; Clear Current Data ; clrCurData lda #0 Call S_SwapIn,in=(a:w,a:w) Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_GrowDoc ( Window:l ) ; ; S_GrowDoc adjusts and updates the given window after it has been ; resized in the driver. S_GrowDoc PROC EXPORT input Window:l local CtlHdl:l,CtlPtr:l local Rect:r,RectPtr:l,ChangedFlag:w BEGIN +b Call S_SwapIn,in=(Window:l) stz ChangedFlag ; Save the old control values ; Tool _GetCtlValue,in=(S_CurRScrl:l),out=(S_RSValue:w) Tool _GetCtlValue,in=(S_CurBScrl:l),out=(S_BSValue:w) ; Dispose of the old controls ; MoveLong !Rect,RectPtr MoveLong S_CurRScrl,CtlHdl MoveLong [CtlHdl],CtlPtr MoveLong [CtlPtr]:#8,Rect MoveLong [CtlPtr]:#12,Rect+4 Tool _EraseRect,in=(RectPtr:l) Tool _InvalRect,in=(RectPtr:l) Tool _DisposeControl,in=(CtlHdl:l) MoveLong S_CurBScrl,CtlHdl MoveLong [CtlHdl],CtlPtr MoveLong [CtlPtr]:#8,Rect MoveLong [CtlPtr]:#12,Rect+4 Tool _EraseRect,in=(RectPtr:l) Tool _InvalRect,in=(RectPtr:l) Tool _DisposeControl,in=(CtlHdl:l) MoveLong S_CurGrow,CtlHdl MoveLong [CtlHdl],CtlPtr MoveLong [CtlPtr]:#8,Rect MoveLong [CtlPtr]:#12,Rect+4 Tool _EraseRect,in=(RectPtr:l) Tool _InvalRect,in=(RectPtr:l) Tool _DisposeControl,in=(CtlHdl:l) ; Insert New controls ; Call S_InsertControls Call S_SetMaxTLCell ; Check if S_CurTLCell is less than S_CurMaxTLCell ; CmpWord S_CurMaxTLCell,S_CurTLCell bge checkCol sta S_CurTLCell inc ChangedFlag checkCol CmpWord S_CurMaxTLCell+2,S_CurTLCell+2 bge doOK sta S_CurTLCell+2 inc ChangedFlag doOK lda ChangedFlag beq Exit ; If adjusted, set globals and control values ; and inval the content Region. lda S_CurTLCell+2 dec a Tool _SetCtlValue,in=(a:w,S_CurBScrl:l) lda S_CurTLCell dec a Tool _SetCtlValue,in=(a:w,S_CurRScrl:l) Tool _EraseRect,in=(#S_CurContRect:l) Tool _InvalRect,in=(#S_CurContRect:l) Exit Call S_SetVertLines ; ?!?!?! can this be a ; non-active window Tool _InvalRect,in=(#S_RSRect:l) Tool _InvalRect,in=(#S_BSRect:l) Tool _InvalRect,in=(#S_GrowRect:l) Call S_ActivateScrlBars RETURN ENDP ;-------------------------------------------------------------------------; ; S_IdleProc ( InWindow:w, PortRectPtr:l, PointPtr:l, TickCount:l ) ; ; S_IdleProc is called every time through the driver's MainLoop for the ; active document. It should handle blinking carets and changing cursors. ; The Point is in local coordinates. InWindow is true if the mouse is ; currently over the active window. S_IdleProc PROC EXPORT input InMyWin:w,RectPtr:l,PtPtr:l,Time:l local Sheet:l,Cursor:w,VertLines:l,VertLineHandle:l BEGIN +b ; If no current window, exit ; lda S_ActiveWindow ora S_ActiveWindow+2 jeq Exit ; Idle LE field ; Call S_SwapIn,in=(S_ActiveWindow:l) Tool _SetPort,in=(S_ActiveWindow:l) MoveWord S_CurEditFlag,a and #S_EditingBit beq chkCursor Tool _LEIdle,in=(S_CurLEHandle:l) ; If in window, set the appropriate Cursor ; chkCursor MoveWord #ArrowCursor,Cursor lda InMyWin jeq GotCurs ; MoveWord S_CurContWd,S_ColLabRect+6 Tool _PtInRect,in=(PtPtr:l,#S_ColLabRect:l),out=(a:w) beq ChkContArea ldx S_CurTwiceVertLines beq SetPlusCurs MoveLong S_CurVertLines,VertLineHandle MoveLong [VertLineHandle],VertLines ldy #2 lda [PtPtr],y and #$FFFC txy loop dey dey bmi SetPlusCurs cmp [VertLines],y blt loop beq SetLRCurs bra SetPlusCurs SetLRCurs MoveWord #LeftRightCursor,Cursor bra GotCurs ChkContArea Tool _PtInRect,in=(PtPtr:l,#S_CurContRect:l),out=(a:w) beq ChkEditField SetPlusCurs MoveWord #PlusCursor,Cursor bra GotCurs ChkEditField Tool _PtInRect,in=(PtPtr:l,#S_CurEditRect:l),out=(a:w) beq GotCurs MoveWord #BeamCursor,Cursor GotCurs Call D_SetCursor,in=(Cursor:w) Exit RETURN ENDP ;------------------------------------------------------------------------ ; S_LoadMod () ; ; Called whenever the SS module is dynamically loaded S_LoadMod PROC EXPORT error ErrFlag BEGIN +b ProfileInit Call D_LoadSegment,in=(#segSS2:w,#2:w),out=(ax:l),err=ErrFlag bcs Exit Call D_LoadSegment,in=(#segHeap:w,#2:w),out=(ax:l),err=ErrFlag bcs Exit Call D_LoadSegment,in=(#segEVAL:w,#2:w),out=(ax:l),err=ErrFlag bcs Exit ; Call D_LoadSegment,in=(#segEvalSS:w,#2:w),out=(ax:l),err=ErrFlag ; bcs Exit Call D_NeedHand,in=(#100:l),out=(S_CurVertLines:l),err=ErrFlag bcc doOK stz S_CurVertLines stz S_CurVertLines+2 bra Exit doOK MoveLong #100,S_CurVertLineHandSize ; Call H_SegLoaded Call H_Init Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_MakeRoom ( ) ; ; S_MakeRoom will free up any memory that it can. S_MakeRoom PROC EXPORT input Window:l ;SRP 7/5/89 BEGIN ; +b RETURN ENDP ;----------------------------------------------------------------------------- ; S_MakeWin (NamePtr:l,Plane:l,RectPtr:l): Window:l ; ; This routine should Create a blank window with name NamePtr ; input - NamePtr a string, just like D_GetNewUntitled throw it away (D_DisposePtr) ; on a Close. ; output - window to use ; When called by the driver, this call is always followed by an Open. It ; should not make any calls to the driver that use window referencing ; (like D_SetRefCon). It should Create a window with no data structure as yet. S_MakeWin PROC EXPORT input Plane:l,RectPtr:l output Window:l error ErrorFlag BEGIN +b MoveLong Plane,S_WinPlane lda RectPtr ora RectPtr+2 beq setDefault MoveRect [RectPtr],S_WinRect bra makeWindow setDefault MoveRect S_DefWinRect,S_WinRect makeWindow ; Request for a New window ; Tool _NewWindow,in=(#S_WindowParms:l),out=(Window:l),err=ErrorFlag bcs noWindow ; Set the window up with invariant constants ; Tool _SetOriginMask,in=(#$FFFC:w,Window:l) Tool _GetFrameColor,in=(#S_WinColors:l,Window:l) Moveword #$020F,S_TBarColor Moveword #$0F00,S_TitleColor Tool _SetFrameColor,in=(#S_WinColors:l,Window:l) Tool _SetPort,in=(Window:l) Tool _SetPenSize,in=(#S_NormalPen:l) Tool _SetTextMode,in=(#4:w) Tool _SetFontFlags,in=(#4:w) bra Exit noWindow MoveLong #-1,Window Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_Message ( Type:Word, Message:Long ) ; ; S_Message is called by the driver to pass on a message. ; S_Message PROC EXPORT input Type:w,Message:l BEGIN +b lda Type cmp #S_ColWidthMsg bne chkBreakLink CmpLong [Message],S_ActiveWindow bne disposeHandle Tool _SetPort,in=(S_ActiveWindow:l) Call S_SwapIn,in=(S_ActiveWindow:l) Call S_LoadAWorksInfo,in=([Message]:#4:l) disposeHandle Tool _DisposeHandle,in=([Message]:#4:l) bra Exit chkBreakLink cmp #S_BreakLinkMsg bne Exit Call S_SwapIn,in=([Message]:#4:l) Call S_BreakLink,in=(Message:l) Call S_SwapOut Exit RETURN #0 ENDP ;-------------------------------------------------------------------------; ; S_NewDoc ( ModNum:w,Plane:l,RectPtr:l ) ; ; S_NewDoc will Open a blank document on the desktop. Any memory errors ; should be returned. If a New document is successfully created, call ; D_MakeNewWin so the driver can Create a window for it. S_NewDoc PROC EXPORT input Window:l error ErrorFlag BEGIN +b lda #0 sta ErrorFlag Call S_SwapIn,in=(a:w,a:w) ; a = 0 MoveLong Window,S_CurWindow ; Get space for the New sheet ; Call S_NewSheet,err=ErrorFlag jcs Exit2 Call S_InitState ; Set up the controls ; MoveWord #0,S_RSValue MoveWord a,S_BSValue Call S_InsertControls,err=ErrorFlag bcs Exit3 Call S_SetMaxTLCell Call S_ActivateScrlBars ; Done, let driver know all has gone well ; Call D_SetRefCon,in=(S_CurSheet:l,S_CurWindow:l) Call S_SwapOut bra Exit Exit3 Tool _DisposeHandle,in=(S_CurSheet:l) Exit2 Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_PrintChanged ( Window:l ) ; ; S_PrintChanged will adjust all the given window's page size dependent ; structures after the driver has changed the print record for the window. S_PrintChanged PROC EXPORT input Window:l BEGIN ; +b RETURN ENDP ;-------------------------------------------------------------------------; ; S_PrintDoc ( Window:Long ) ; ; S_PrintDoc is called by the driver to print the document belonging to ; the specified window. S_PrintDoc PROC EXPORT input Window:l local PrintHandle:l,PrintPtr:l,PrintPort:l local PageRect:r,TLPrintCell:l,BRPrintCell:l local NextCol:w,NextRow:w,OrigTL:l,RowMajorFlag:w error ErrFlag BEGIN +b iDev equ 2 iPageRect equ 8 wDev equ 24 bjDocLoop equ 86 stz ErrFlag stz RowMajorFlag Call S_SwapIn,in=(Window:l) Call D_GetPrintHandle,in=(Window:l),out=(PrintHandle:l) MoveLong [PrintHandle],PrintPtr MoveLong [PrintPtr]:#iPageRect,PageRect MoveLong [PrintPtr]:#iPageRect+4,PageRect+4 PushLong S_CurTLCell PushWord S_CurContHt PushWord S_CurContWd MoveWord PageRect+4,S_CurContHt MoveWord PageRect+6,S_CurContWd SubWord S_CurContYpt,#S_EditHeight+S_ColLabelHeight,S_CurContYpt SubWord S_CurContXpt,#S_NumLabelWidth,S_CurContXpt ; Open printer doc in PrintHandle:l,#0:l out PrintPort:l XCall D_PrOpenDoc Tool _PrError,out=(a:w) jne closeDoc MoveLong PrintPort,S_CurWindow MoveWord #-1,S_CurPrinting CmpLong S_CurTLSelect,S_CurBRSelect beq getAll MoveLong S_CurTLSelect,TLPrintCell MoveLong S_CurBRSelect,BRPrintCell bra DoPrint getAll Call S_SetBRMostCell,in=(#1:w) lda #S_BRMostBit tsb S_CurEditFlag MoveLong #$00010001,TLPrintCell MoveLong S_CurBRMost,BRPrintCell ; Print the pages DoPrint MoveLong TLPrintCell,OrigTL MoveWord [PrintPtr]:#wDev,x and #2 beq orientEq0 CmpWord [PrintPtr]:#iDev,#3 beq doRowMajor bra PageLoop orientEq0 CmpWord [PrintPtr]:#iDev,#3 beq PageLoop doRowMajor inc RowMajorFlag PageLoop Call D_CheckPurge,err=ErrFlag bcc openPage Tool _PrSetError,in=(#-128:w) closePage2 brl closePage openPage in PrintPort:l,#0:l XTool _PrOpenPage Tool _PrError,out=(ErrFlag:w) bne closePage2 Tool _SetPort,in=(PrintPort:l) Call D_KillFont RCall D_SelectFont,in=(#$FFFE:a,#$0800:x,#0:y) Tool _SetPenSize,in=(#S_NormalPen:l) Tool _SetTextMode,in=(#4:w) Tool _SetFontFlags,in=(#4:w) PushLong #S_WhitePat _SetBackPat ; Draw a page here MoveLong TLPrintCell,S_CurTLCell in TLPrintCell:l,BRPrintCell:l in PageRect+4:l,PageRect:l out NextCol:w,NextRow:w XCall S_PrintPage closePage Tool _PrClosePage,in=(PrintPort:l) Tool _PrError,out=(a:w) jne closeDoc lda ErrFlag jne closePrint lda RowMajorFlag bne doRowMajorCheck MoveWord NextRow,TLPrintCell CmpWord BRPrintCell,NextRow jge PageLoop MoveWord NextCol,TLPrintCell+2 MoveWord OrigTL,TLPrintCell CmpWord BRPrintCell+2,NextCol blt closePrint brl PageLoop doRowMajorCheck MoveWord NextCol,TLPrintCell+2 CmpWord BRPrintCell+2,NextCol jge PageLoop MoveWord NextRow,TLPrintCell MoveWord OrigTL+2,TLPrintCell+2 CmpWord BRPrintCell,NextRow blt closePrint brl PageLoop ; Close printer doc closeDoc sta ErrFlag closePrint Tool _PrCloseDoc,in=(PrintPort:l) Tool _PrError,out=(a:w) bne handleError lda ErrFlag bne handleError ; Print spooled file if neccessary MoveLong [PrintHandle],PrintPtr MoveWord [PrintPtr]:#bjDocLoop,a and #$00FF beq Printed in PrintHandle:l,#0:l,#StatusRecord:l XTool _PrPicFile Tool _PrError,out=(a:w) beq Printed handleError sta ErrFlag ; Just Close things up, the driver will handle the error ; Printed PullWord S_CurContWd PullWord S_CurContHt PullLong S_CurTLCell AddWord S_CurContYpt,#S_EditHeight+S_ColLabelHeight,S_CurContYpt AddWord S_CurContXpt,#S_NumLabelWidth,S_CurContXpt stz S_CurPrinting MoveLong Window,S_CurWindow Exit RETURN StatusRecord DS.B 28 S_WhitePat DC.L -1,-1,-1,-1,-1,-1,-1,-1 ENDP ;----------------------------------------------------------------------- ; S_RelockMem () ; ; Should relock handles unlocked during UnLockMem S_RelockMem PROC EXPORT input Window:l BEGIN ; +b Call H_ResetHeap RETURN ENDP ;------------------------------------------------------------------------ ; S_UnloadMod () ; ; Called whenever the SS module is dynamically unloaded S_UnloadMod PROC EXPORT BEGIN +b lda S_CurVertLines ora S_CurVertLines+2 beq doOK Tool _DisposeHandle,in=(S_CurVertLines:l) doOK ; Call H_SegUnloaded ; Call D_UnloadSegment,in=(#segEvalSS:w,#2:w) Call D_UnloadSegment,in=(#segEVAL:w,#2:w) Call D_UnloadSegment,in=(#segHeap:w,#2:w) Call D_UnloadSegment,in=(#segSS2:w,#2:w) RETURN ENDP ;----------------------------------------------------------------------- ; S_UnlockMem () ; ; Called when memory is in trouble. Should try to UnLock handles ; that are Locked. It's guaranteed that RelockMem will be called ; before control leaves the driver. (In other words, ReLockMem will be ; called as soon as memory has had the chance to compact.) S_UnlockMem PROC EXPORT input Window:l BEGIN ; +b Call H_UnsetHeap RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Sort.aii b/appleworksgs/SS/Src/Sort.aii new file mode 100755 index 0000000..953ab7e --- /dev/null +++ b/appleworksgs/SS/Src/Sort.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_AlertBox IMPORT D_CmpStrings IMPORT D_MemoryError IMPORT D_NeedHand IMPORT D_Sort IMPORT S_ActiveWindow IMPORT S_BuildSortUndo IMPORT S_CalculateSheet IMPORT S_CurBRMost IMPORT S_CurBRSelect IMPORT S_CurEditFlag IMPORT S_CurRowBlock IMPORT S_CurTLSelect IMPORT S_DeltaMove IMPORT S_DoSortDlog IMPORT S_GetCellIndex IMPORT S_InvalidCellStr IMPORT S_MoveDestBR IMPORT S_MoveDestTL IMPORT S_MoveSrcBR IMPORT S_MoveSrcTL IMPORT S_RedrawCellRange IMPORT S_SetBRMostCell IMPORT S_SetUndoOn IMPORT S_StartSortUndo IMPORT S_SwapCell IMPORT S_SwapIn ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_DoColSort ENTRY S_DoRowSort ENTRY S_SortCompare ENTRY S_SwapColumns ENTRY S_SwapRows ;------------------------------------------------------------------------- ; ; S_SortData PROC EXPORT EXPORT S_SortAscendDescendFlag S_SortAscendDescendFlag DS.B 2 ENDP ;-------------------------------------------------------------------------- ; ; S_Sort PROC EXPORT ;Using S_CurrentData ;Using S_SortData ;Using S_MoveData ;Using S_ErrorData local KeyCell:l,Type:w error ErrFlag BEGIN +b Call S_SwapIn,in=(S_ActiveWindow:l) ; ascend: 0==decending,1==ascending ; rowcol: 0==col by row,1==row by col ; cell: 0 == Cancelled, 0 w/carry set == error in S_CurTLSelect:l out S_SortAscendDescendFlag:w,Type:w,KeyCell:l XCall S_DoSortDlog bcc doOK Call D_AlertBox,in=(#OKBox:w,#S_InvalidCellStr:l),out=(a:w) doOK lda KeyCell ora KeyCell+2 jeq Exit lda S_CurEditFlag and #S_BRMostBit beq BRset Call S_SetBRMostCell,in=(#0:w) BRset lda #S_BRMostBit tsb S_CurEditFlag MoveWord S_CurTLSelect,S_MoveDestTL sta S_MoveSrcTL MoveWord S_CurTLSelect+2,S_MoveDestTL+2 sta S_MoveSrcTL+2 MoveWord S_CurBRSelect,S_MoveDestBR sta S_MoveSrcBR MoveWord S_CurBRSelect+2,S_MoveDestBR+2 sta S_MoveSrcBR+2 lda Type bne doRowSort doColSort ldx S_CurBRSelect+2 cpx S_CurBRMost+2 blt doCol2 ldx S_CurBRMost+2 doCol2 in S_CurTLSelect:l,x:w,S_CurBRSelect:w,KeyCell:w XCall S_DoColSort,err=ErrFlag bcc redraw bra memError doRowSort ldx S_CurBRSelect cpx S_CurBRMost blt doRow2 ldx S_CurBRMost doRow2 in S_CurTLSelect:l,S_CurBRSelect+2:w,x:w,KeyCell+2:w XCall S_DoRowSort,err=ErrFlag bcc redraw memError Call D_MemoryError redraw CmpWord S_MoveSrcBR+2,S_MoveDestBR+2 blt chkLeft sta S_MoveDestBR+2 chkLeft CmpWord S_MoveSrcTL+2,S_MoveDestTL+2 bge doDraw sta S_MoveDestTL+2 doDraw in S_MoveDestTL:l,S_MoveDestBR:l XCall S_RedrawCellRange Call S_SetUndoOn,in=(#S_UndoSortType:w) lda S_CurEditFlag and #S_ManCalcBit bne Exit Call S_CalculateSheet Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_DoRowSort PROC EXPORT ;Using S_CurrentData input FCol:w,FRow:w,LCol:w,LRow:w,KeyCol:w local ArrayHandle:l,ArrayPtr:l,ArraySize:w,Count:w local ArrayOffset:w,TargOffset:w,CurRow:w,CellPtr:l local TargRow:w,SrcRow:w error ErrorFlag BEGIN stz ErrorFlag SubWord LRow,FRow,a inc a sta Count asl a asl a sta ArraySize in #0:w,ArraySize:w out ArrayHandle:l XCall D_NeedHand,err=ErrorFlag jcs Exit ; Set up the original array, filled with cell indices ; MoveLong [ArrayHandle],ArrayPtr MoveWord FRow,CurRow stz ArrayOffset bra startInit initLoop inc CurRow AddWord ArrayOffset,#4,ArrayOffset startInit in KeyCol:w,CurRow:w out [ArrayPtr]:ArrayOffset:l XCall S_GetCellIndex ldy ArrayOffset ora [ArrayPtr],y bne cmpInit tya sta [ArrayPtr],y iny iny MoveWord #$FF00,[ArrayPtr]:y cmpInit CmpWord CurRow,LRow blt initLoop ; Sort the array ; in #0:w,Count:w,ArrayHandle:l,#S_SortCompare:l XCall D_Sort,err=ErrorFlag jcs memError ; Renumber array for easy sorting ; MoveLong [ArrayHandle],ArrayPtr stz ArrayOffset renumLoop ldy ArrayOffset iny iny lda [ArrayPtr],y bmi cmpRenum H_GetBlockPtr [ArrayPtr]:ArrayOffset,CellPtr SubWord [CellPtr]:#S_CellID,FRow,a asl a asl a MoveWord a,[ArrayPtr]:ArrayOffset cmpRenum AddWord ArrayOffset,#4,ArrayOffset CmpWord ArrayOffset,ArraySize blt renumLoop in #0:w,FCol:w,FRow:w,LCol:w,LRow:w XCall S_StartSortUndo ; Make Spreadsheet reflect the array ; stz CurRow stz ArrayOffset swapLoop MoveLong [ArrayHandle],ArrayPtr MoveWord [ArrayPtr]:ArrayOffset,TargOffset cmp ArrayOffset beq cmpSwapEnd bge doSwap targLoop MoveWord [ArrayPtr]:TargOffset,TargOffset cmp ArrayOffset beq cmpSwapEnd blt targLoop doSwap lsr a lsr a AddWord a,FRow,TargRow AddWord CurRow,FRow,SrcRow in FCol:w,SrcRow:w,LCol:w,TargRow:w XCall S_BuildSortUndo Call S_SwapRows,in=(FCol:w,SrcRow:w,LCol:w,TargRow:w) cmpSwapEnd inc CurRow AddWord ArrayOffset,#4,ArrayOffset CmpWord a,ArraySize blt swapLoop memError Tool _DisposeHandle,in=(ArrayHandle:l) Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_DoColSort PROC EXPORT ;Using S_CurrentData input FCol:w,FRow:w,LCol:w,LRow:w,KeyRow:w local ArrayHandle:l,ArrayPtr:l,ArraySize:w,Count:w local ArrayOffset:w,TargOffset:w,CurCol:w,CellPtr:l local TargCol:w,SrcCol:w error ErrorFlag BEGIN stz ErrorFlag SubWord LCol,FCol,a inc a sta Count asl a asl a sta ArraySize in #0:w,ArraySize:w out ArrayHandle:l XCall D_NeedHand,err=ErrorFlag jcs Exit ; Set up the original array, filled with cell indices ; MoveLong [ArrayHandle],ArrayPtr MoveWord FCol,CurCol stz ArrayOffset bra startInit initLoop inc CurCol AddWord ArrayOffset,#4,ArrayOffset startInit in CurCol:w,KeyRow:w out [ArrayPtr]:ArrayOffset:l XCall S_GetCellIndex ldy ArrayOffset ora [ArrayPtr],y bne cmpInit tya sta [ArrayPtr],y iny iny MoveWord #$FF00,[ArrayPtr]:y cmpInit CmpWord CurCol,LCol blt initLoop ; Sort the array ; in #0:w,Count:w,ArrayHandle:l,#S_SortCompare:l XCall D_Sort,err=ErrorFlag jcs memError ; Renumber array for easy sorting ; MoveLong [ArrayHandle],ArrayPtr stz ArrayOffset renumLoop ldy ArrayOffset iny iny lda [ArrayPtr],y bmi cmpRenum H_GetBlockPtr [ArrayPtr]:ArrayOffset,CellPtr SubWord [CellPtr]:#S_CellID+2,FCol,a asl a asl a MoveWord a,[ArrayPtr]:ArrayOffset cmpRenum AddWord ArrayOffset,#4,ArrayOffset CmpWord ArrayOffset,ArraySize blt renumLoop Call S_StartSortUndo,in=(#1:w,FCol:w,FRow:w,LCol:w,LRow:w) ; Make Spreadsheet reflect the array ; stz CurCol stz ArrayOffset swapLoop MoveLong [ArrayHandle],ArrayPtr MoveWord [ArrayPtr]:ArrayOffset,TargOffset cmp ArrayOffset beq cmpSwap bge doSwap targLoop MoveWord [ArrayPtr]:TargOffset,TargOffset cmp ArrayOffset beq cmpSwap blt targLoop doSwap lsr a lsr a AddWord a,FCol,TargCol AddWord CurCol,FCol,SrcCol in SrcCol:w,FRow:w,TargCol:w,LRow:w XCall S_BuildSortUndo Call S_SwapColumns,in=(SrcCol:w,FRow:w,TargCol:w,LRow:w) cmpSwap inc CurCol AddWord ArrayOffset,#4,ArrayOffset CmpWord a,ArraySize blt swapLoop memError Tool _DisposeHandle,in=(ArrayHandle:l) Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_SortCompare ( CellIndex1:l,CellIndex2:l ) : bool:w ; ; This routine compares the two cells contents according to ; S_SortAscendDescendFlag for the Sort routines. S_SortCompare PROC EXPORT ;Using S_CurrentData ;Using S_SortData ;Using SANEequs input CellIndex1:l,CellIndex2:l output OneGreaterFlag:w local CellPtr1:l,CellPtr2:l local Cell1Error:w,Cell1NA:w,Cell1Value:w,Cell1Text:w local Format:w BEGIN +b stz Cell1Error stz Cell1NA stz Cell1Value stz Cell1Text lda CellIndex1+2 bmi getCell2 H_GetBlockPtr CellIndex1,CellPtr1 MoveWord [CellPtr1]:#S_CellFormat,Format bmi getCell2 and #S_CellInvalid beq cell1OK lda Format and #S_CellError beq doCell1NA inc Cell1Error bra getCell2 doCell1NA inc Cell1NA bra getCell2 cell1OK lda Format and #S_CellTypeValue bne doCell1Value inc Cell1Text bra getCell2 doCell1Value inc Cell1Value getCell2 lda CellIndex2+2 jmi doTwoGreater H_GetBlockPtr CellIndex2,CellPtr2 MoveWord [CellPtr2]:#S_CellFormat,Format bmi doTwoGreater and #S_CellInvalid beq cell2OK lda Format and #S_CellError beq doCell2NA lda #0 bra doCell2Error cell2OK lda Format and #S_CellTypeValue bne chkCell2Value lda Cell1Text beq doCell2Text bra doTextCmp chkCell2Value lda Cell1Value beq doCell2Value AddLong CellPtr1,#S_CellValue,s AddLong CellPtr2,#S_CellValue,s lda S_SortAscendDescendFlag beq cmpValueAscend bra cmpValueDescend doCell2Error ora Cell1Error doCell2NA ora Cell1NA doCell2Value ora Cell1Value doCell2Text ora Cell1Text bne doTwoGreater doOneGreater MoveWord #1,OneGreaterFlag bra Exit doTwoGreater stz OneGreaterFlag Exit RETURN cmpValueAscend Tool FCPXX,in=(:l,:l) FBGT doOneGreater bra doTwoGreater cmpValueDescend Tool FCPXX,in=(:l,:l) FBLT doOneGreater bra doTwoGreater doTextCmp SpaceWord H_GetBlockPtr [CellPtr1]:#S_CellValue,s H_GetBlockPtr [CellPtr2]:#S_CellValue,s Call D_CmpStrings,in=(:l,:l,#0:w) ; out=(:w) lda S_SortAscendDescendFlag beq cmpTextAscend cmpTextDescend pla bmi doOneGreater bra doTwoGreater cmpTextAscend pla bmi doTwoGreater beq doTwoGreater brl doOneGreater ENDP ;--------------------------------------------------------------------------- ; S_SwapColumns (TLCell:l,BRCell:l) ; ; This routine traverses the first and last column of this given region ; and calls S_SwapCell if either of the two cells in a row is non-empty. S_SwapColumns PROC EXPORT ;Using S_CurrentData ;Using S_MoveData input Col1:w,FRow:w,Col2:w,LRow:w local RowBlock:l,RowHandle:l,RowPtr:l local RowBlockPtr:l,RowOffset:w local Col1Flag:l,Col2Flag:l local MinCol:w,MaxCol:w,MaxRow:w error ErrorFlag BEGIN stz ErrorFlag stz S_DeltaMove SubWord Col2,Col1,S_DeltaMove+2 bra startRow ; For each row in the range, .... ; nextRow inc FRow startRow MoveLong S_CurRowBlock,RowBlock ora RowBlock jeq Exit MoveLong [RowBlock],RowBlockPtr MoveWord [RowBlockPtr]:#S_KeyMax,MaxRow CmpWord FRow,[RowBlockPtr]:#S_KeyMin blt tooSmall cmp MaxRow blt okRow brl Exit tooSmall lda [RowBlockPtr],y dec a sta FRow MoveWord #S_KeyArray-4,RowOffset bra searchRow okRow SubWord a,[RowBlockPtr]:y,a asl a asl a AddWord a,#S_KeyArray,RowOffset searchLoop MoveLong [RowBlockPtr]:RowOffset,RowHandle ora RowHandle bne gotRow searchRow inc FRow AddWord RowOffset,#4,RowOffset CmpWord FRow,MaxRow bge rowQuit CmpWord LRow,FRow bge searchLoop rowQuit brl Exit gotRow MoveLong [RowHandle],RowPtr MoveWord [RowPtr]:#S_KeyMax,MaxCol MoveWord [RowPtr]:#S_KeyMin,MinCol CmpWord Col1,MinCol blt noCol1 cmp MaxCol bge noCol1 CmpWord Col2,MinCol blt noCol2 cmp MaxCol blt okCols ; No Col2, but Col1 is in structure ; noCol2 stz Col2Flag bra getCol1 noCol1 CmpWord Col2,MinCol blt gotoEnd cmp MaxCol blt zeroCol1 gotoEnd brl cmpRow zeroCol1 stz Col1Flag bra getCol2 okCols SubWord a,MinCol,a asl a asl a AddWord a,#S_KeyArray,y lda [RowPtr],y iny iny ora [RowPtr],y sta Col2Flag getCol1 SubWord Col1,MinCol,a asl a asl a AddWord a,#S_KeyArray,y lda [RowPtr],y iny iny ora [RowPtr],y sta Col1Flag bra chkCols getCol2 SubWord Col2,MinCol,a asl a asl a AddWord a,#S_KeyArray,y lda [RowPtr],y iny iny ora [RowPtr],y sta Col2Flag chkCols lda Col2Flag ora Col1Flag beq cmpRow Call S_SwapCell,in=(Col1:w,FRow:w),err=ErrorFlag bcs Exit cmpRow CmpWord FRow,LRow jlt nextRow Exit RETURN ENDP ;--------------------------------------------------------------------------- ; S_SwapRows (TLCell:l,BRCell:l) ; ; This routine traverses the first and last rows of this given region ; and calls S_SwapCell if either of the two cells in a column is non-empty. S_SwapRows PROC EXPORT ;Using S_CurrentData ;Using S_MoveData input FCol:w,Row1:w,LCol:w,Row2:w local RowIndex:l,RowPtr:l,ColIndex:l local ColOffset:w,MaxCol:w local RowBlock:l,RowBlockPtr:l local NextCol1:w,NextCol2:w error ErrorFlag BEGIN stz ErrorFlag lda S_CurRowBlock ora S_CurRowBlock+2 jeq Exit SubWord Row2,Row1,S_DeltaMove stz S_DeltaMove+2 stz NextCol1 stz NextCol2 bra start ; For each cell in the row, .... ; nextCol inc FCol start CmpWord NextCol1,FCol blt getCol1 jeq makeCall2 brl gotNextCol1 getCol1 MoveLong S_CurRowBlock,RowBlock MoveLong [RowBlock],RowBlockPtr CmpWord Row1,[RowBlockPtr]:#S_KeyMax bge noRow1 SubWord a,[RowBlockPtr]:#S_KeyMin,a bge row1InRange noRow1 brl noMoreRow1 row1InRange asl a asl a AddWord a,#S_KeyArray,y MoveLong [RowBlockPtr]:y,RowIndex ora RowIndex beq noRow1 ; Find first used Col Greater/Equal to FCol ; MoveLong [RowIndex],RowPtr MoveWord [RowPtr]:#S_KeyMax,MaxCol CmpWord FCol,MaxCol bge noRow1 sta NextCol1 SubWord a,[RowPtr]:#S_KeyMin,a bge col1InRange ; Try Mincol as NextCol1 ; lda [RowPtr],y dec a sta nextCol1 MoveWord #S_KeyArray-4,ColOffset bra startCol1Loop col1InRange asl a asl a AddWord a,#S_KeyArray,ColOffset tay MoveLong [RowPtr]:y,ColIndex ora ColIndex beq startCol1Loop brl makeCall2 findCol1Loop MoveLong [RowPtr]:ColOffset,ColIndex ora ColIndex bne gotNextCol1 startCol1Loop inc NextCol1 AddWord ColOffset,#4,ColOffset CmpWord NextCol1,MaxCol bge noMoreRow1 CmpWord LCol,NextCol1 bge findCol1Loop noMoreRow1 AddWord LCol,#1,NextCol1 gotNextCol1 CmpWord NextCol2,FCol jge chkFCol MoveLong S_CurRowBlock,RowBlock MoveLong [RowBlock],RowBlockPtr CmpWord Row2,[RowBlockPtr]:#S_KeyMax bge noRow2 SubWord a,[RowBlockPtr]:#S_KeyMin,a bge row2InRange noRow2 brl noMoreRow2 row2InRange asl a asl a AddWord a,#S_KeyArray,y MoveLong [RowBlockPtr]:y,RowIndex ora RowIndex beq noRow2 ; Find first used Col Greater/Equal to FCol ; MoveLong [RowIndex],RowPtr MoveWord [RowPtr]:#S_KeyMax,MaxCol CmpWord FCol,MaxCol bge noRow2 sta NextCol2 SubWord a,[RowPtr]:#S_KeyMin,a bge col2InRange ; Try MinCol as the next col ; lda [RowPtr],y dec a sta nextCol2 MoveWord #S_KeyArray-4,ColOffset bra startCol2Loop col2InRange asl a asl a AddWord a,#S_KeyArray,ColOffset tay MoveLong [RowPtr]:y,ColIndex ora ColIndex beq startCol2Loop bra makeCall2 findCol2Loop MoveLong [RowPtr]:ColOffset,ColIndex ora ColIndex bne chkFCol startCol2Loop inc NextCol2 AddWord ColOffset,#4,ColOffset CmpWord NextCol2,MaxCol bge noMoreRow2 CmpWord LCol,NextCol2 bge findCol2Loop noMoreRow2 AddWord LCol,#1,NextCol2 chkFCol CmpWord NextCol1,NextCol2 bge chkRow2 cmp LCol beq makeCall1 blt makeCall1 bra Exit chkRow2 CmpWord NextCol2,LCol beq makeCall1 bge Exit makeCall1 sta FCol makeCall2 Call S_SwapCell,in=(FCol:w,Row1:w),err=ErrorFlag bcs Exit CmpWord FCol,LCol bge Exit brl nextCol Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Undo.aii b/appleworksgs/SS/Src/Undo.aii new file mode 100755 index 0000000..0ee7d12 --- /dev/null +++ b/appleworksgs/SS/Src/Undo.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'M16.Profile' INCLUDE 'SS.equ' INCLUDE 'Driver.equ' INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_GrowHandle IMPORT D_MemoryError IMPORT D_NeedHand IMPORT D_SetFileChanged IMPORT D_SetUndoStr IMPORT S_AcceptCell IMPORT S_ActivateScrlBars IMPORT S_ActiveWindow IMPORT S_AddCellToChangedList IMPORT S_AdjustSheetColumns IMPORT S_CalculateSheet IMPORT S_CellWidth IMPORT S_ChangeColWidth IMPORT S_ChangeDef IMPORT S_CurBRSelect IMPORT S_CurDefColWd IMPORT S_CurEditFlag IMPORT S_CurTLSelect IMPORT S_CurWindow IMPORT S_DeltaMove IMPORT S_DoMove IMPORT S_DoTranspose IMPORT S_DrawMove IMPORT S_GetCellIndex IMPORT S_GetDestCellRanges IMPORT S_GetSSScrap IMPORT S_InRange IMPORT S_MoveDestBR IMPORT S_MoveDestTL IMPORT S_MoveSrcBR IMPORT S_MoveSrcTL IMPORT S_NewLineEdit IMPORT S_PutSSScrap IMPORT S_RedrawCellRange IMPORT S_RefreshScreen IMPORT S_ScrapBR IMPORT S_ScrapBottom IMPORT S_ScrapBuffer IMPORT S_ScrapLeft IMPORT S_ScrapPasteType IMPORT S_ScrapRight IMPORT S_ScrapTL IMPORT S_ScrapTop IMPORT S_SwapColumns IMPORT S_SwapIn IMPORT S_SwapRows IMPORT S_TraverseRange ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_BuildColWdUndo ENTRY S_BuildSimpleUndo ENTRY S_DeleteUndo ENTRY S_FixLE ENTRY S_SetUndoOff ENTRY S_UndoClearStr ENTRY S_UndoColWdStr ENTRY S_UndoCutStr ENTRY S_UndoDeleteStr ENTRY S_UndoEntryStr ENTRY S_UndoFillStr ENTRY S_UndoImportStr ENTRY S_UndoInsertStr ENTRY S_UndoMoveStr ENTRY S_UndoPasteFormatStr ENTRY S_UndoPasteStr ENTRY S_UndoPasteValuesStr ENTRY S_UndoSortStr ENTRY S_UndoTransposeStr ENTRY S_UndoTrashCells ;----------------------------------------------------------------------------- ; ; S_UndoData PROC EXPORT EXPORT S_UndoInProgress EXPORT S_NewUndoHandle EXPORT S_NewUndoLocation1 EXPORT S_NewUndoLocation2 EXPORT S_UndoType EXPORT S_UndoHandle EXPORT S_UndoLocation1 EXPORT S_UndoLocation2 EXPORT S_UndoNames EXPORT S_UndoColWdStr EXPORT S_UndoEntryStr EXPORT S_UndoClearStr EXPORT S_UndoCutStr EXPORT S_UndoPasteStr EXPORT S_UndoPasteValuesStr EXPORT S_UndoPasteFormatStr EXPORT S_UndoFillStr EXPORT S_UndoMoveStr EXPORT S_UndoDeleteStr EXPORT S_UndoInsertStr EXPORT S_UndoTransposeStr EXPORT S_UndoSortStr EXPORT S_UndoImportStr S_UndoInProgress DC.W 0 S_NewUndoHandle DS.B 4 S_NewUndoLocation1 DS.B 4 S_NewUndoLocation2 DS.B 4 S_UndoType DS.B 2 S_UndoHandle DS.B 4 S_UndoLocation1 DS.B 4 S_UndoLocation2 DS.B 4 S_UndoNames DC.L 0 DC.L S_UndoColWdStr DC.L S_UndoEntryStr DC.L S_UndoClearStr DC.L S_UndoCutStr DC.L S_UndoPasteStr DC.L S_UndoPasteValuesStr DC.L S_UndoPasteFormatStr DC.L S_UndoFillStr DC.L S_UndoMoveStr DC.L S_UndoDeleteStr DC.L S_UndoInsertStr DC.L S_UndoTransposeStr DC.L S_UndoSortStr DC.L S_UndoImportStr S_UndoColWdStr str 'Column Width Change' S_UndoEntryStr str 'Entry' S_UndoClearStr str 'Clear' S_UndoCutStr str 'Cut' S_UndoPasteStr str 'Paste' S_UndoPasteValuesStr str 'Paste Values' S_UndoPasteFormatStr str 'Paste Format' S_UndoFillStr str 'Fill' S_UndoMoveStr str 'Move' S_UndoDeleteStr str 'Delete' S_UndoInsertStr str 'Insert' S_UndoTransposeStr str 'Transpose' S_UndoSortStr str 'Sort' S_UndoImportStr str 'Import' ENDP ;----------------------------------------------------------------------------- ; ; S_SetUndoOn PROC EXPORT ;Using S_CurrentData ;Using S_UndoData input Type:w BEGIN Call S_SetUndoOff lda S_NewUndoHandle ora S_NewUndoHandle+2 beq Exit MoveWord Type,S_UndoType asl a asl a tax PushLong S_UndoNames:x lda Type bpl highBitOK lda 3,s ora #$8000 sta 3,s highBitOK Call D_SetUndoStr,in=(:l,S_CurWindow:l) ; Call D_EnableMItems,in=(#UndoBit:w,#3:w) MoveLong S_NewUndoHandle,S_UndoHandle stzl S_NewUndoHandle MoveLong S_NewUndoLocation1,S_UndoLocation1 stzl S_NewUndoLocation1 MoveLong S_NewUndoLocation2,S_UndoLocation2 stzl S_NewUndoLocation2 Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_SetUndoOff PROC EXPORT ;Using S_CurrentData ;Using S_UndoData EXPORT S_SetUndoOff2 ldx #0 bra SetItOff S_SetUndoOff2 ldx #1 SetItOff BEGIN +b txa bne skip Call D_SetFileChanged,in=(S_CurWindow:l) skip lda S_UndoType beq Exit Call S_DeleteUndo,in=(a:w,S_UndoHandle:l) stz S_UndoType stzl S_UndoHandle stzl S_UndoLocation1 stzl S_UndoLocation2 Call D_SetUndoStr,in=(#0:l,S_CurWindow:l) Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_DeleteUndo PROC EXPORT input Type:w,Handle:l local Ptr:l BEGIN lda Handle ora Handle+2 beq Exit lda Type dec a asl a adc #0 asl a tax jsr (DisposeTable,x) Exit RETURN DisposeTable DC.W DisposeHandle ; undo Col Wd DC.W DisposeHandle ; redo Col Wd DC.W DisposeHandle ; undo Entry DC.W DisposeHandle ; redo Entry DC.W DisposeHandle ; undo Clear DC.W DisposeHandle ; redo Clear DC.W DisposeHandle ; undo Cut DC.W DisposeHandle ; redo Cut DC.W DisposeHandle ; undo Paste DC.W DisposeHandle ; redo Paste DC.W DisposeHandle ; undo Paste Values DC.W DisposeHandle ; redo Paste Values DC.W DisposeHandle ; undo Paste Format DC.W DisposeHandle ; redo Paste Format DC.W DisposeHandle ; undo Fill DC.W DisposeHandle ; redo Fill DC.W DisposeMove ; undo Move DC.W DisposeMove ; redo Move DC.W DisposeMove ; undo Delete DC.W DisposeMove ; redo Delete DC.W DisposeMove ; undo Insert DC.W DisposeMove ; redo Insert DC.W DisposeMove ; undo Transpose DC.W DisposeMove ; redo Transpose DC.W DisposeHandle ; undo Sort DC.W DisposeHandle ; redo Sort DC.W DisposeHandle ; undo Import DC.W DisposeHandle ; redo Import DisposeHandle Tool _DisposeHandle,in=(Handle:l) rts ;----------------------- DisposeMove MoveOffset equ 0 TL1 equ 4 Range1Handle equ 8 TL2 equ 12 Range2Handle equ 16 TrashCellHandle equ 20 MoveLong [Handle],Ptr Tool _DisposeHandle,in=([Ptr]:#Range1Handle:l) MoveWord [Ptr]:#TL1,a beq chkTrash Tool _DisposeHandle,in=([Ptr]:#Range2Handle:l) chkTrash ldy #TrashCellHandle lda [Ptr],y ldy #TrashCellHandle+2 ora [Ptr],y beq finishMove Tool _DisposeHandle,in=([Ptr]:#TrashCellHandle:l) finishMove Tool _DisposeHandle,in=(Handle:l) rts ENDP ;----------------------------------------------------------------------------- ; ; S_Undo PROC EXPORT ;Using S_CurrentData ;Using S_UndoData ;Using S_ScrapData ;Using S_MoveData local Handle:l,Ptr:l,Size:l,Offset:w local Handle2:l,Ptr2:l,Offset2:w,Type:w error ErrFlag BEGIN +b stz ErrFlag Tool _SetPort,in=(S_ActiveWindow:l) Call S_SwapIn,in=(S_ActiveWindow:l) lda S_UndoType beq Exit MoveWord #1,S_UndoInProgress lda S_UndoType dec a asl a adc #0 asl a tax jsr (UndoTable,x) lda S_UndoType eor #$8000 Call S_SetUndoOn,in=(a:w) stz S_UndoInProgress Exit RETURN UndoTable DC.W UColWd ; undo Col Wd DC.W UColWd ; redo Col Wd DC.W USimple ; undo Entry DC.W USimple ; redo Entry DC.W USimple ; undo Clear DC.W USimple ; redo Clear DC.W USimple ; undo Cut DC.W USimple ; redo Cut DC.W USimple ; undo Paste DC.W USimple ; redo Paste DC.W USimple ; undo Paste Values DC.W USimple ; redo Paste Values DC.W USimple ; undo Paste Format DC.W USimple ; redo Paste Format DC.W USimple ; undo Fill DC.W USimple ; redo Fill DC.W UMove ; undo Move DC.W UMove ; redo Move DC.W UMove ; undo Delete DC.W UMove ; redo Delete DC.W UMove ; undo Insert DC.W UMove ; redo Insert DC.W UTranspose ; undo Transpose DC.W UTranspose ; redo Transpose DC.W USort ; undo Sort DC.W USort ; redo Sort DC.W USimple ; undo Import DC.W USimple ; redo Import UColWd MoveLong S_UndoHandle,Handle MoveLong [Handle],Ptr MoveWord [Ptr]:#4,a bne notDefault Call S_BuildColWdUndo,in=(#0:w),err=ErrFlag bcs memError1 MoveWord [Ptr]:#2,S_CurDefColWd in #1:w,#1:w,#702:w,#1:w in #S_ChangeDef:l XCall S_TraverseRange,err=ErrFlag bcc adjustColumns memError1 Call D_MemoryError bra adjustColumns notDefault SubWord [Ptr],#2,Size loop MoveLong [Handle],Ptr PushWord [Ptr]:Size dey dey PushWord [Ptr]:y dey dey sty Size Call S_ChangeColWidth,in=(:w,:w),err=ErrFlag bcs memError1 lda Size bne loop adjustColumns Call S_AdjustSheetColumns Call S_ActivateScrlBars Call S_RefreshScreen,in=(#1:w) rts ;----------------------- USimple MoveLong S_UndoLocation1,S_ScrapTL MoveLong S_UndoLocation2,S_ScrapBR in S_UndoLocation1:l,S_UndoLocation2:l XCall S_BuildSimpleUndo,err=ErrFlag bcs memError2 MoveWord #0,S_ScrapPasteType MoveLong S_UndoHandle,S_ScrapBuffer Call S_PutSSScrap,err=ErrFlag bcc redrawSimple memError2 Call D_MemoryError redrawSimple Call S_FixLE in S_ScrapTL:l,S_ScrapBR:l XCall S_RedrawCellRange lda S_CurEditFlag and #S_ManCalcBit bne doneSimple Call S_CalculateSheet doneSimple rts ;----------------------- UMove MoveOffset equ 0 TL1 equ 4 Range1Handle equ 8 TL2 equ 12 Range2Handle equ 16 TrashCellHandle equ 20 MoveLong S_UndoHandle,Handle MoveLong [Handle],Ptr MoveLong [Ptr],S_DeltaMove MoveLong S_UndoLocation1,S_MoveSrcTL MoveLong S_UndoLocation2,S_MoveSrcBR Call S_DoMove,err=ErrFlag bcs redrawMove MoveLong [Handle],Ptr MoveWord #0,S_ScrapPasteType MoveLong [Ptr]:#TL1,S_ScrapTL MoveLong [Ptr]:#Range1Handle,S_ScrapBuffer Call S_PutSSScrap,err=ErrFlag CmpWord S_ScrapLeft,S_MoveSrcTL+2 bge chkRightM sta S_MoveSrcTL+2 chkRightM CmpWord S_ScrapRight,S_MoveSrcBR+2 blt chkBottomM sta S_MoveSrcBR+2 chkBottomM CmpWord S_ScrapBottom,S_MoveSrcBR blt chkTopM sta S_MoveSrcBR chkTopM CmpWord S_ScrapTop,S_MoveSrcTL blt redrawMove sta S_MoveSrcTL redrawMove Call S_DrawMove lda ErrFlag bne memErrorMove MoveLong [Handle],Ptr MoveLong [Ptr]:#TL2,S_ScrapTL beq fixMove MoveLong [Ptr]:#Range2Handle,S_ScrapBuffer Call S_PutSSScrap,err=ErrFlag in S_ScrapTL:l,S_ScrapBR:l XCall S_RedrawCellRange ; This is also the last part of UTranspose ; fixTranspose lda ErrFlag bne memErrorMove fixMove MoveLong [Handle],Ptr in [Ptr]:#TrashCellHandle:l XCall S_UndoTrashCells,err=ErrFlag bcc fixLE3 memErrorMove Call S_DeleteUndo,in=(S_UndoType:w,S_NewUndoHandle:l) stzl S_NewUndoHandle Call D_MemoryError fixLE3 Call S_FixLE lda S_CurEditFlag and #S_ManCalcBit bne doneMove Call S_CalculateSheet doneMove rts ;----------------------- UTranspose MoveLong S_UndoLocation1,S_MoveSrcTL MoveLong S_UndoLocation2,S_MoveSrcBR Call S_DoTranspose,err=ErrFlag bcs redrawTrans MoveLong S_UndoHandle,Handle MoveLong [Handle],Ptr MoveWord #0,S_ScrapPasteType MoveLong [Ptr]:#TL1,S_ScrapTL MoveLong [Ptr]:#Range1Handle,S_ScrapBuffer Call S_PutSSScrap,err=ErrFlag CmpWord S_ScrapLeft,S_MoveSrcTL+2 bge chkRightT sta S_MoveSrcTL+2 chkRightT CmpWord S_ScrapRight,S_MoveSrcBR+2 blt chkBottomT sta S_MoveSrcBR+2 chkBottomT CmpWord S_ScrapBottom,S_MoveSrcBR blt chkTopT sta S_MoveSrcBR chkTopT CmpWord S_ScrapTop,S_MoveSrcTL blt redrawTrans sta S_MoveSrcTL redrawTrans in S_MoveSrcTL:l,S_MoveSrcBR:l XCall S_RedrawCellRange in S_MoveDestTL:l,S_MoveDestBR:l XCall S_RedrawCellRange brl fixTranspose ;----------------------- USort Tool _GetHandleSize,in=(S_UndoHandle:l),out=(Size:l) Call D_NeedHand,in=(Size:l),out=(ax:l),err=ErrFlag jcs memErrorSort2 MoveLong ax,Handle2 MoveLong ax,S_NewUndoHandle MoveLong S_UndoHandle,Handle MoveLong [Handle],Ptr MoveLong [Handle2],Ptr2 MoveWord #2,Offset AddWord Size,#4,Offset2 MoveWord [Ptr],[Ptr2] sta Type undoLoop1 SubWord Offset2,#12,Offset2 MoveLong [Ptr]:Offset,[Ptr2]:Offset2 AddWord Offset,#4,Offset AddWord Offset2,#4,Offset2 MoveLong [Ptr]:Offset,[Ptr2]:Offset2 AddWord Offset,#4,Offset cmp Size blt undoLoop1 ; New Undo handle built ; MoveWord S_UndoLocation1,S_NewUndoLocation1 sta S_MoveDestTL sta S_MoveSrcTL MoveWord S_UndoLocation1+2,S_NewUndoLocation1+2 sta S_MoveDestTL+2 sta S_MoveSrcTL+2 MoveWord S_UndoLocation2,S_NewUndoLocation2 sta S_MoveDestBR sta S_MoveSrcBR MoveWord S_UndoLocation2+2,S_NewUndoLocation2+2 sta S_MoveDestBR+2 sta S_MoveSrcBR+2 MoveWord #2,Offset undoLoop2 MoveLong [Handle],Ptr PushLong [Ptr]:Offset AddWord y,#6,y PushWord [Ptr]:y dey dey PushWord [Ptr]:y AddWord y,#4,Offset lda Type bne doCol Call S_SwapRows,in=(:l,:l),err=ErrFlag bra chkUndoEnd doCol Call S_SwapColumns,in=(:l,:l),err=ErrFlag chkUndoEnd bcs memErrorSort CmpWord Offset,Size blt undoLoop2 bra redrawSort memErrorSort Call S_DeleteUndo,in=(S_UndoType:w,S_NewUndoHandle:l) stzl S_NewUndoHandle memErrorSort2 Call D_MemoryError redrawSort CmpWord S_MoveSrcBR+2,S_MoveDestBR+2 blt chkLeftSort sta S_MoveDestBR+2 chkLeftSort CmpWord S_MoveSrcTL+2,S_MoveDestTL+2 bge doDrawSort sta S_MoveDestTL+2 doDrawSort in S_MoveDestTL:l,S_MoveDestBR:l XCall S_RedrawCellRange Call S_FixLE lda S_CurEditFlag and #S_ManCalcBit bne doneSort Call S_CalculateSheet doneSort rts ENDP ;----------------------------------------------------------------------------- ; ; S_BuildColWdUndo PROC EXPORT ;Using S_CurrentData ;Using S_UndoData input Col:w local Width:w,Handle:l,Ptr:l,Size:w error ErrFlag BEGIN stz ErrFlag stz Width lda S_NewUndoHandle ora S_NewUndoHandle+2 bne exists Call D_NeedHand,in=(#6:l),out=(ax:l),err=ErrFlag bcs Exit MoveLong ax,S_NewUndoHandle MoveLong ax,Handle MoveWord #6,Size bra addCol exists MoveLong S_NewUndoHandle,Handle MoveLong [Handle],Ptr AddWord [Ptr],#4,Size Call D_GrowHandle,in=(#0:w,a:w,Handle:l),err=ErrFlag bcs Exit addCol lda Col bne notDefault lda S_CurDefColWd bra storeWidth notDefault Call S_CellWidth,in=(Col:w),out=(a:w) bcs haveWidth storeWidth sta Width haveWidth MoveLong [Handle],Ptr MoveWord Size,[Ptr] dec a dec a tay MoveWord Col,[Ptr]:y dey dey MoveWord Width,[Ptr]:y Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_BuildSimpleUndo PROC EXPORT ;Using S_CurrentData ;Using S_UndoData input TLCell:l,BRCell:l error ErrFlag BEGIN stz ErrFlag MoveLong TLCell,S_NewUndoLocation1 MoveLong BRCell,S_NewUndoLocation2 in TLCell:l,BRCell:l out S_NewUndoHandle:l XCall S_GetSSScrap,err=ErrFlag bcc Exit stzl S_NewUndoHandle Exit RETURN ENDP ;--------------------------------------------------------------------------- ; ; S_BuildMoveUndo PROC EXPORT ;Using S_CurrentData ;Using S_UndoData ;Using S_MoveData local UndoHandle:l,UndoPtr:l local BRCell2:l,TLCell2:l,BRCell1:l,TLCell1:l local MoveHandle:l error ErrFlag BEGIN ProfileIn 0 stz ErrFlag MoveOffset equ 0 TL1 equ 4 Range1Handle equ 8 TL2 equ 12 Range2Handle equ 16 TrashCellHandle equ 20 Call D_NeedHand,in=(#24:l),out=(ax:l),err=ErrFlag jcs Exit MoveLong ax,S_NewUndoHandle MoveLong ax,UndoHandle MoveLong [UndoHandle],UndoPtr MoveLong S_MoveDestTL,S_NewUndoLocation1 MoveLong S_MoveDestBR,S_NewUndoLocation2 lda S_DeltaMove eor #-1 inc a sta [UndoPtr] ldy #MoveOffset+2 lda S_DeltaMove+2 eor #-1 inc a sta [UndoPtr],y in S_MoveSrcTL:l,S_MoveSrcBR:l in S_MoveDestTL:l,S_MoveDestBR:l out TLCell1:l,BRCell1:l,TLCell2:l,BRCell2:l XCall S_GetDestCellRanges in TLCell1:l,BRCell1:l out MoveHandle:l XCall S_GetSSScrap,err=ErrFlag jcs memError1 MoveLong [UndoHandle],UndoPtr MoveLong TLCell1,[UndoPtr]:#TL1 MoveLong MoveHandle,[UndoPtr]:#Range1Handle MoveWord #0,[UndoPtr]:#TrashCellHandle MoveWord a,[UndoPtr]:#TrashCellHandle+2 MoveLong TLCell2,[UndoPtr]:#TL2 beq Exit in TLCell2:l,BRCell2:l out MoveHandle:l XCall S_GetSSScrap,err=ErrFlag MoveLong [UndoHandle],UndoPtr bcs memError2 MoveLong MoveHandle,[UndoPtr]:#Range2Handle bra Exit memError2 Tool _DisposeHandle,in=([UndoPtr]:#Range1Handle:l) memError1 Tool _DisposeHandle,in=(UndoHandle:l) stz S_NewUndoHandle stz S_NewUndoHandle+2 Exit ProfileOut 0 RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_BuildTrashUndo PROC EXPORT ;Using S_CurrentData ;Using S_UndoData input Cell:l,FormulaIndex:l local UndoHandle:l,UndoPtr:l local TrashHandle:l,TrashPtr:l,ContentSize:l local OldSize:l,NewSize:l,TempSize:l error ErrFlag BEGIN TrashCellHandle equ 20 ; also defined in BuildMoveUndo TrashStructSize equ 0 TrashStructStart equ 4 TrashCellSize equ 0 TrashCell equ 2 TrashContent equ 6 stz ErrFlag MoveLong S_NewUndoHandle,UndoHandle lda UndoHandle+2 ora UndoHandle jeq Exit H_GetBlockSize FormulaIndex,ContentSize MoveLong [UndoHandle],UndoPtr MoveLong [UndoPtr]:#TrashCellHandle,TrashHandle lda TrashHandle+2 ora TrashHandle bne exists AddLong #TrashContent+TrashStructStart,ContentSize,NewSize Call D_NeedHand,in=(NewSize:l),out=(TrashHandle:l),err=ErrFlag jcs Exit MoveLong [UndoHandle],UndoPtr MoveLong TrashHandle,[UndoPtr]:#TrashCellHandle MoveLong [TrashHandle],TrashPtr brl addFormula exists MoveLong [TrashHandle],TrashPtr MoveLong [TrashPtr],OldSize AddLong #TrashContent,ContentSize,TempSize AddLong TempSize,OldSize,NewSize Call D_GrowHandle,in=(NewSize:l,TrashHandle:l),err=ErrFlag jcs Exit MoveLong [TrashHandle],TrashPtr AddLong #TrashStructStart,TrashPtr,s ; AddLong 1:s,TempSize,s lda 1,s clc adc TempSize pha pha lda 7,s adc TempSize+2 sta 3,s SubLong OldSize,#TrashStructStart,s Tool _BlockMove,in=(:l,:l,:l) addFormula MoveLong NewSize,[TrashPtr] AddWord #TrashContent,ContentSize,a MoveWord a,[TrashPtr]:#TrashCellSize+TrashStructStart MoveLong Cell,[TrashPtr]:#TrashCell+TrashStructStart H_GetBlockPtr FormulaIndex,s AddLong TrashPtr,#TrashContent+TrashStructStart,s PushLong ContentSize Tool _BlockMove,in=(:l,:l,:l) Exit RETURN ENDP ;---------------------------------------------------------------------------- ; ; S_UndoTrashCells PROC EXPORT ;Using S_CurrentData ;Using S_UndoData input TrashHandle:l local TrashPtr:l,TrashLoc:l,TrashLimit:l local CellIndex:l,CellPtr:l,CellSize:w,CellFormat:l local Cell:l,ContentSize:l,FormulaIndex:l,FormulaPtr:l error ErrFlag BEGIN TrashCellHandle equ 20 ; also defined in BuildMoveUndo TrashStructSize equ 0 TrashStructStart equ 4 TrashCellSize equ 0 TrashCell equ 2 TrashContent equ 6 stz ErrFlag lda TrashHandle ora TrashHandle+2 jeq Exit MoveLong #TrashStructStart,TrashLoc MoveLong [TrashHandle],TrashPtr MoveLong [TrashPtr],TrashLimit stz ContentSize+2 UntrashLoop AddLong [TrashHandle],TrashLoc,TrashPtr MoveWord [TrashPtr]:#TrashCellSize,CellSize MoveLong [TrashPtr]:#TrashCell,Cell SubWord CellSize,#TrashContent,ContentSize H_NewBlock ContentSize,FormulaIndex,FormulaPtr,err=ErrFlag jcs Exit ; Memory might move ; AddLong [TrashHandle],TrashLoc,TrashPtr AddLong TrashPtr,#TrashContent,s Tool _BlockMove,in=(:l,FormulaPtr:l,ContentSize:l) in Cell:l out CellIndex:l XCall S_GetCellIndex H_GetBlockPtr CellIndex,CellPtr ; We want any formulas (all cells) stored to show a current value of 0 ; so that we won't dispose of what should be the calculated string and ; dispose of a 0 index. MoveWord [CellPtr]:#S_CellFormat,a ora #S_CellTypeFormula sta CellFormat MoveWord [CellPtr]:#S_CellFormat+2,CellFormat+2 in Cell:l,CellFormat:l,FormulaIndex:l out ax:l,ax:l XCall S_AcceptCell,err=ErrFlag bcs Exit Call S_AddCellToChangedList,in=(Cell:l) lda CellSize AddLong a,TrashLoc,TrashLoc CmpLong TrashLoc,TrashLimit bge Exit brl UntrashLoop Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_StartSortUndo PROC EXPORT ;Using S_UndoData input Type:w,TLCell:l,BRCell:l local Handle:l,Ptr:l error ErrFlag BEGIN stz ErrFlag Call D_NeedHand,in=(#2:l),out=(ax:l),err=ErrFlag bcs Exit MoveLong ax,S_NewUndoHandle MoveLong ax,Handle MoveLong [Handle],Ptr MoveWord Type,[Ptr] MoveLong TLCell,S_NewUndoLocation1 MoveLong BRCell,S_NewUndoLocation2 Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_BuildSortUndo PROC EXPORT ;Using S_UndoData input TLCell:l,BRCell:l local Handle:l,Ptr:l,NewSize:l error ErrFlag BEGIN stz ErrFlag MoveLong S_NewUndoHandle,Handle ora Handle jeq Exit Tool _GetHandleSize,in=(Handle:l),out=(:l) AddLong s,#8,NewSize Call D_GrowHandle,in=(NewSize:l,Handle:l),err=ErrFlag bcs Exit MoveLong [Handle],Ptr AddLong #2,Ptr,s AddLong #10,Ptr,s SubLong NewSize,#10,s Tool _BlockMove,in=(:l,:l,:l) MoveLong TLCell,[Ptr]:#2 MoveLong BRCell,[Ptr]:#6 Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; S_FixLE PROC EXPORT ;Using S_CurrentData BEGIN CmpLong S_CurTLSelect,S_CurBRSelect bne setEmptyLE in S_CurTLSelect:l out :l XCall S_GetCellIndex bra setLE setEmptyLE lda #0 pha pha setLE Call S_NewLineEdit,in=(:l) RETURN ENDP ;------------------------------------------------------------------------ ; ; S_ProtectData PROC EXPORT EXPORT S_ProtectedCell EXPORT S_ExtraData S_ProtectedCell DS.B 2 S_ExtraData DS.B 2 ENDP ;------------------------------------------------------------------------ ; ; S_ChkCellProtect PROC EXPORT ;Using S_CurrentData ;Using S_ProtectData input Cell:l,CellIndex:l local CellPtr:l error ErrorFlag BEGIN stz ErrorFlag ; Since this routine is called with TraverseDest, (i.e. S_QTraverseTable) ; some calls may not be real cells. lda CellIndex+2 and #S_CellTableFlags bne Exit H_GetBlockPtr CellIndex,CellPtr MoveWord [CellPtr]:#S_CellFormat,a bmi Exit MoveWord [CellPtr]:#S_CellFormat+2,a bmi protected in S_CurTLSelect:l,S_CurBRSelect:l,Cell:l out a:w XCall S_InRange bne Exit inc S_ExtraData bra Exit protected inc S_ProtectedCell inc ErrorFlag Exit RETURN ENDP END \ No newline at end of file diff --git a/appleworksgs/SS/Src/Update.aii b/appleworksgs/SS/Src/Update.aii new file mode 100755 index 0000000..bb4fc37 --- /dev/null +++ b/appleworksgs/SS/Src/Update.aii @@ -0,0 +1 @@ + LOAD 'Macros.dump' INCLUDE 'SS.equ' ; INCLUDE 'Driver.equ' ; INCLUDE 'Heap.aii.i' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- IMPORT D_FastMult IMPORT S_CellWidth IMPORT S_ColLabRect IMPORT S_CurBScrl IMPORT S_CurContHt IMPORT S_CurContRect IMPORT S_CurContWd IMPORT S_CurContXpt IMPORT S_CurContYpt IMPORT S_CurEditRect IMPORT S_CurLEHandle IMPORT S_CurMaxTLCell IMPORT S_CurTLCell IMPORT S_CurVPageSize IMPORT S_DrawBorders IMPORT S_DrawBothTitles IMPORT S_DrawColLabels IMPORT S_DrawColTitles IMPORT S_DrawRegion IMPORT S_DrawRowLabels IMPORT S_DrawRowTitles IMPORT S_RowLabRect IMPORT S_SetVertLines IMPORT S_SwapIn IMPORT S_WhichCell ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY S_ScrlUpdate ;-------------------------------------------------------------------------; ; S_HScrlAction ( PartCode:word, ControlHandle:long ): Result:word ; ; S_HScrlAction PROC EXPORT ;Using S_CurrentData input PartCode:w,ControlHandle:l output Result:w local MaxColumn:w,Workspace:w,Value:w,Temp:w local ScrollRect:r,UpdateRgn:l,dh:w BEGIN +b ; Determine if the part is the thumb, or meaningless. lda PartCode cmp #5 blt Exit cmp #9 bge Exit ; Get the scroll bars current value. out Value:w in ControlHandle:l XTool _GetCtlValue ; Call the appropriate subroutine depending on which partcode ; is passed. lda PartCode sec sbc #5 asl a tax jsr (HScrollTable,x) Exit Return HScrollTable DC.W hScrlLf DC.W hScrlRt DC.W hPageLf DC.W hPageRt ;----------------------------------------------------------------------------- ; All of the entry points must make sure that dh contains the ; number of Pixels to scroll, value contains the New value for ; the scroll bar, and Temp contains the New column for the New ; TLCell hScrlLf lda S_CurTLCell+2 dec a sta Temp jeq quit Call S_CellWidth,in=(a:w),out=(dh:w) dec Value jmp hScrollRect hPageLf SubWord S_CurContWd,S_CurContXpt,Workspace lda S_CurTLCell+2 sta Temp stz dh bra cond1 loop1 Call S_CellWidth,in=(Temp:w),out=(a:w) AddWord a,dh,a cmp Workspace bge full1 sta dh dec Value cond1 dec Temp bne loop1 endloop1 inc Temp lda dh jeq quit jmp hScrollRect full1 tay ; a = next divider inc Temp lda dh jne hScrollRect MoveWord y,dh dec Value dec Temp jmp hScrollRect ;------------------------------------------ hScrlRt MoveWord S_CurTLCell+2,Temp CmpWord S_CurMaxTLCell+2,Temp jeq quit Call S_CellWidth,in=(Temp:w),out=(a:w) eor #$FFFF ; make a 2's comp neg number inc a sta dh inc Temp inc Value jmp hScrollRect hPageRt MoveWord S_CurMaxTLCell+2,MaxColumn SubWord S_CurContXpt,S_CurContWd,Workspace stz dh MoveWord S_CurTLCell+2,Temp bra cond2 loop2 Call S_CellWidth,in=(Temp:w),out=(:w) SubWord dh,s,a cmp Workspace blt full2 beq full2 sta dh inc Value inc Temp cond2 CmpWord Temp,MaxColumn blt loop2 endloop2 lda dh jeq quit jmp hScrollRect full2 tay ; a = next divider lda dh bne hScrollRect MoveWord y,dh inc Value inc Temp ;------------------------------------------ hScrollRect MoveWord Temp,S_CurTLCell+2 Tool _SetCtlValue,in=(Value:w,ControlHandle:l) MoveWord #S_EditHeight+2,ScrollRect AddWord S_CurContXpt,#2,ScrollRect+2 MoveLong S_CurContRect+4,ScrollRect+4 Tool _NewRgn,out=(UpdateRgn:l) Tool _ScrollRect,in=(!ScrollRect:l,dh:w,#0:w,UpdateRgn:l) Call S_ScrlUpdate,in=(UpdateRgn:l) Tool _DisposeRgn,in=(UpdateRgn:l) quit rts ENDP ;-------------------------------------------------------------------------; ; S_ScrlUpdate ( Region:l ) ; ; S_ScrlUpdate will Update the current graf port after scrolling has been ; done, according to the current sheet. S_ScrlUpdate PROC EXPORT ;Using S_CurrentData input Region:l local FCell:l,LCell:l,Xpt:w,Ypt:w,RgnPtr:l local Xpt2:w,Ypt2:w,OldClipRgn:l local OffBottom:w,OffRight:w,Rect:r,RectPtr:l BEGIN Tool _EmptyRgn,in=(Region:l),out=(a:w) jne Exit Tool _NewRgn,out=(OldClipRgn:l) Tool _GetClip,in=(OldClipRgn:l) Tool _SetClip,in=(Region:l) stz OffBottom stz OffRight MoveLong [Region],RgnPtr ; Determine the range to Update, and their coordinates ; in [RgnPtr]:#2:l out FCell:l,Xpt:w,Ypt:w XCall S_WhichCell ; in [RgnPtr]:#6:l ; out LCell:l,Xpt2:w,Ypt2:w ; XCall S_WhichCell SpaceLong SpaceWord SpaceWord MoveWord [RgnPtr]:#8,a ; The right and bottom sides cmp #2 blt push1 cmp S_CurContWd bge push1 dec a ; of the Region are shortened dec a ; so that on left and up push1 pha ; scrolling, only the number MoveWord [RgnPtr]:#6,a ; rows or cols inserted are beq push2 cmp S_CurContHt bge push2 dec a ; drawn. ; dec a ; (mistake) push2 pha jsl S_WhichCell PullWord Ypt2 PullWord Xpt2 PullLong LCell ; Check to see if either the right or bottom edges show ; lda LCell cmp #10000 ; first non-row blt OK1 sta OffBottom MoveWord #9999,LCell OK1 lda LCell+2 cmp #$02BF ; first non-col blt OK2 sta OffRight MoveWord #$02BE,LCell+2 OK2 ; Make the second coordinates Point to the bottom right corner, ; instead of the top right. lda OffBottom bne skip1 AddWord Ypt2,#S_RowHeight,Ypt2 skip1 lda OffRight bne skip2 Call S_CellWidth,in=(LCell+2:w),out=(:w) AddWord s,Xpt2,Xpt2 skip2 ; Redraw any label Rects necessary ; ; MoveWord S_CurContWd,S_ColLabRect+6 Tool _RectInRgn,in=(#S_ColLabRect:l,Region:l),out=(a:w) beq skip3 in Xpt:w,FCell+2:w,LCell+2:w XCall S_DrawColLabels skip3 MoveLong !Rect,RectPtr MoveWord #S_EditHeight+S_ColLabelHeight,Rect MoveWord S_CurContXpt,Rect+2 MoveWord S_CurContYpt,Rect+4 MoveWord S_CurContWd,Rect+6 Tool _RectInRgn,in=(RectPtr:l,Region:l),out=(a:w) beq skip4 in Xpt:w,FCell+2:w,LCell+2:w XCall S_DrawColTitles skip4 MoveWord #S_EditHeight,Rect stz Rect+2 MoveWord S_CurContYpt,Rect+4 MoveWord S_CurContXpt,Rect+6 Tool _RectInRgn,in=(RectPtr:l,Region:l),out=(a:w) beq skip5 Call S_DrawBothTitles skip5 ; MoveWord S_CurContHt,S_RowLabRect+4 Tool _RectInRgn,in=(#S_RowLabRect:l,Region:l),out=(a:w) beq skip6 in Ypt:w,FCell:w,LCell:w XCall S_DrawRowLabels skip6 MoveWord S_CurContYpt,Rect MoveWord #S_NumLabelWidth,Rect+2 MoveWord S_CurContHt,Rect+4 MoveWord S_CurContXpt,Rect+6 Tool _RectInRgn,in=(RectPtr:l,Region:l),out=(a:w) beq skip7 in Ypt:w,FCell:w,LCell:w XCall S_DrawRowTitles skip7 ; Draw the cells ; lda OffRight ora OffBottom beq borderDone in OffRight:w,OffBottom:w,Xpt2:w,Ypt2:w XCall S_DrawBorders borderDone in Xpt2:w,Ypt2:w,Xpt:w,Ypt:w in FCell:l,LCell:l,#1:w in S_CurContXpt:w XCall S_DrawRegion ; Clean Up ; Tool _SetClip,in=(OldClipRgn:l) Tool _DisposeRgn,in=(OldClipRgn:l) Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_Thumb ( Control:l ) ; ; S_Thumb will handle moving the thumb in any of the scroll bars. S_Thumb PROC EXPORT ;Using S_CurrentData input Control:l local ScrollRect:r,UpdateRgn:l,CtrlValue:w local dh:w,dv:w,OldTLRow:w,OldTLCol:w,WorkCol:w local negDH:w BEGIN stz negDH stz dh stz dv Tool _GetCtlValue,in=(Control:l),out=(CtrlValue:w) ; Determine which scroll bar has been affected ; CmpLong Control,S_CurBScrl beq doHthumb doVthumb ; Reset S_CurTLCell and set the Update Region ; MoveWord S_CurTLCell,OldTLRow lda CtrlValue inc a sta S_CurTLCell SubWord a,OldTLRow,a jeq Exit eor #-1 ; negate the answer inc a tay ; calculate dv ldx #S_RowHeight Call D_FastMult sta dv lda S_CurContYpt inc a sta ScrollRect stz ScrollRect+2 brl rgnSet doHthumb ; Reset S_CurTLCell and set the Update Region ; MoveWord S_CurTLCell+2,OldTLCol lda CtrlValue inc a sta S_CurTLCell+2 cmp OldTLCol jeq Exit blt includeDest ; The original TLCell is to the left inc negDH tax MoveWord OldTLCol,WorkCol stx OldTLCol bra startLoop ; The New TLCell is to the left includeDest sta WorkCol startLoop Call S_CellWidth,in=(WorkCol:w),out=(dh:w) hLoop inc WorkCol CmpWord WorkCol,OldTLCol beq doneLoop Call S_CellWidth,in=(WorkCol:w),out=(:w) AddWord s,dh,dh cmp S_CurContWd blt hLoop doneLoop lda negDH beq finishHthumb lda dh ; negate dh eor #-1 inc a sta dh finishHthumb Call S_SetVertLines MoveWord #S_EditHeight+2,ScrollRect AddWord S_CurContXpt,#2,ScrollRect+2 rgnSet MoveLong S_CurContRect+4,ScrollRect+4 ; Do the content Update ; Tool _NewRgn,out=(UpdateRgn:l) Tool _ScrollRect,in=(!ScrollRect:l,dh:w,dv:w,UpdateRgn:l) Call S_ScrlUpdate,in=(UpdateRgn:l) Tool _DisposeRgn,in=(UpdateRgn:l) Exit RETURN ENDP ;-------------------------------------------------------------------------; ; S_UpdateDoc ( Window:l ) ; ; S_UpdateDoc will Update the given window. S_UpdateDoc PROC EXPORT ;Using S_CurrentData input Window:l local ClipRect:r local ClipRgn:l,LongTemp:l,SUpdateRgn:l BEGIN +b ; Swap in sheet to Update ; Call S_SwapIn,in=(Window:l) ; Draw the controls ; Tool _DrawControls,in=(Window:l) Tool _EraseRect,in=(#S_CurEditRect:l) Tool _LEUpdate,in=(S_CurLEHandle:l) ; Draw the Seperator Line between the edit field and the sheet ; Tool _SetPenSize,in=(#S_ThickPen:l) Tool _MoveTo,in=(#0:w,#S_EditHeight:w) AddWord S_CurContWd,#S_GrowWidth,s Tool _LineTo,in=(:w,#S_EditHeight:w) Tool _SetPenSize,in=(#S_NormalPen:l) ; Everything drawn after this Point must be clipped to the ; content area Tool _NewRgn,out=(ClipRgn:l) ; Tool _GetClip,in=(ClipRgn:l) Tool _GetVisRgn,in=(ClipRgn:l) MoveWord #S_EditHeight+2,ClipRect stz ClipRect+2 MoveWord S_CurContHt,ClipRect+4 MoveWord S_CurContWd,ClipRect+6 Tool _NewRgn,out=(SUpdateRgn:l) Tool _RectRgn,in=(SUpdateRgn:l,!ClipRect:l) Tool _SectRgn,in=(SUpdateRgn:l,ClipRgn:l,SUpdateRgn:l) Call S_ScrlUpdate,in=(SUpdateRgn:l) ; Clean up ; ; Tool _SetClip,in=(ClipRgn:l) Tool _DisposeRgn,in=(ClipRgn:l) Tool _DisposeRgn,in=(SUpdateRgn:l) RETURN ENDP ;-------------------------------------------------------------------------; ; S_VScrlAction ( PartCode:word, ControlHandle:long ): Result:word ; ; S_VScrlAction PROC EXPORT ;Using S_CurrentData input PartCode:w,ControlHandle:l output Result:w local MaxValue:w,ViewSize:w,DataSize:w,Value:w local ScrollSize:w,ScrollRect:r,UpdateRgn:l,dv:w BEGIN +b ; Determine if the part is the thumb, or meaningless. lda PartCode cmp #5 blt Exit cmp #9 bge Exit ; Determine the maximum value for the scroll bar. lda S_CurMaxTLCell dec a sta MaxValue ; Get the scroll bars current value. in ControlHandle:l out Value:w XTool _GetCtlValue ; Call the appropriate subroutine depending on which partcode ; is passed. lda PartCode sec sbc #5 asl a tax jsr (VScrollTable,x) Exit Return VScrollTable DC.W vScrlUp DC.W vScrlDn DC.W vPageUp DC.W vPageDn ;----------------------------------------------------------------------------- vScrlUp lda #1 bra vUpMain vPageUp lda S_CurVPageSize vUpMain ; 'a' contains number of sta ScrollSize ; rows to scroll up lda Value jeq quit cmp ScrollSize blt vupto0 SubWord a,ScrollSize,Value bra vScrollRect vupto0 sta ScrollSize stz Value bra vScrollRect ;------------------------------------------ vScrlDn lda #1 bra vDnMain vPageDn lda S_CurVPageSize vDnMain ; 'a' contains the number sta ScrollSize ; of rows to scroll down lda Value cmp MaxValue jeq quit AddWord a,ScrollSize,a cmp MaxValue bge vdntoend sta Value bra vdnnormal vdntoend SubWord MaxValue,Value,ScrollSize MoveWord MaxValue,Value vdnnormal lda ScrollSize eor #$FFFF ; dn -> negative disp. inc a sta ScrollSize ;------------------------------------------ ; ScrollSize contains the number of rows to scroll, and ; Value contains the New value for the scroll control. vScrollRect ; Multiply the number of rows to scroll by #S_RowHeight. ; This multiply works for negative numbers, too. ldy ScrollSize ldx #S_RowHeight Call D_FastMult sta dv ; Update the window variables ; SubWord S_CurTLCell,ScrollSize,S_CurTLCell Tool _SetCtlValue,in=(Value:w,ControlHandle:l) ; Scroll the contents of the window ; lda S_CurContYpt inc a sta ScrollRect stz ScrollRect+2 MoveLong S_CurContRect+4,ScrollRect+4 Tool _NewRgn,out=(UpdateRgn:l) Tool _ScrollRect,in=(!ScrollRect:l,#0:w,dv:w,UpdateRgn:l) Call S_ScrlUpdate,in=(UpdateRgn:l) Tool _DisposeRgn,in=(UpdateRgn:l) quit rts ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Dbsc.equ b/appleworksgs/Scrap/Dbsc.equ new file mode 100755 index 0000000..b3004e3 --- /dev/null +++ b/appleworksgs/Scrap/Dbsc.equ @@ -0,0 +1 @@ +;------------------------------------------ ; ; Equates from procedure X_DBScrapData ; ;------------------------------------------ X_DBScType equ 0 X_DBRows equ 2 X_DBColumns equ 4 X_DBLabels equ 6 X_DBFormHeight equ 8 X_DBHeaderHeight equ 10 X_DBFooterHeight equ 12 X_DBDataOffset equ 14 X_DBScHeaderSize equ 18 X_DBFieldType equ 0 X_DBColumnType equ 1 X_DBRowType equ 2 X_DBCellType equ 3 X_DBFAttr equ 4 X_DBActive equ 1<<0 X_DBAutoStamp equ 1<<1 X_DBCopy equ 1<<2 X_DBDataExists equ 1<<3 X_DBFormula equ 1<<4 X_DBHeader equ 1<<5 X_DBHidden equ 1<<6 X_DBHour equ 1<<7 X_DBIntersect equ 1<<8 X_DBPending equ 1<<9 X_DBSelected equ 1<<10 X_DBShowWeekday equ 1<<11 X_DefaultDBAttr equ X_DBActive+X_DBDataExists+X_DBIntersect X_DBFListWidth equ X_DBFAttr+2 X_DefaultDBWidth equ 2*72 X_DBFieldRect equ X_DBFListWidth+2 X_DBFType equ X_DBFieldRect+8 X_DBText equ 0 X_DBPict equ 4 X_DBTextLabel equ 9 X_DBFAlign equ X_DBFType+2 X_DBLeft equ 0 X_DBFStyle equ X_DBFAlign+2 X_DBFColor equ X_DBFStyle+2 X_DBFDisplay equ X_DBFColor+2 X_DBFDecPoint equ X_DBFDisplay+2 X_DBFRFlags equ X_DBFDecPoint+40 X_DBRFlags equ 0 X_DefaultDBRFlags equ 1 X_DBRCells equ 2 X_DBCellEmpty equ 1<<4 X_DBCellNA equ 1<<5 X_DBCellError equ 1<<6 X_DBFormHorBorder equ 20 X_DBFormVerBorder equ 8 X_DBFormVerSpacing equ 4 X_DBFormHorSpacing equ 10 X_DBEntryWidth equ 200 X_DBEntryHeight equ 12 X_DBFormHt equ 2*X_DBFormVerBorder+14*X_DBFormVerSpacing+15*X_DBEntryHeight ;------------------------------------------ ; ; Equates from procedure X_DBAworksData ; ;------------------------------------------ X_CatNum equ 35 X_RecNum equ 36 X_RepNum equ 38 X_ListWidthTable equ 42 X_ListOrder equ 78 X_CatNameOrder equ 186 X_FirstCatName equ 357 X_CatNameSize equ 22 X_AWReportSize equ 600 \ No newline at end of file diff --git a/appleworksgs/Scrap/Scrap.equ b/appleworksgs/Scrap/Scrap.equ new file mode 100755 index 0000000..f066d31 --- /dev/null +++ b/appleworksgs/Scrap/Scrap.equ @@ -0,0 +1 @@ +;------------------------------------------ ; ; Equates from procedure X_ClipData ; ;------------------------------------------ X_Locked equ $8000 AppleText equ 0 ApplePict equ 1 SWText equ $100 WPText equ $101 StaticText equ $104 PICT equ $200 PLPict equ $204 GRPict equ $205 AsciiText equ $300 SSScrap equ $302 DBScrap equ $303 X_NullScrap equ -1 ;------------------------------------------ ; ; Equates from procedure X_SWScrapEquates ; ;------------------------------------------ X_FontFamily equ 0 X_FontStyle equ 2 X_FontSize equ 3 X_FontColor equ 4 X_NewFamily equ 1 X_Geneva equ $3 X_Monaco equ $4 X_Courier equ $16 X_Plain equ 0 ;------------------------------------------ ; ; Equates from procedure X_PLEquates ; ;------------------------------------------ X_LeftJust equ 0 X_CenterJust equ 1 X_RightJust equ 2 X_FullJust equ 3 X_SingleSpace equ 0 X_DoubleSpace equ 1 X_TripleSpace equ 2 X_CustomSpace equ 3 X_JustChange equ 5 X_SpaceChange equ 6 ;------------------------------------------ ; ; Equates from procedure X_WorksData ; ;------------------------------------------ X_EOF equ $FF X_BlankLine equ $D0 X_BoldBegin equ 1 X_BoldEnd equ 2 X_SuperBegin equ 3 X_SuperEnd equ 4 X_SubBegin equ 5 X_SubEnd equ 6 X_UnderBegin equ 7 X_UnderEnd equ 8 X_PrintPageNo equ 9 X_EnterKeyboard equ 10 X_StickySpace equ 11 ;------------------------------------------ ; ; Equates from procedure X_MSGSOffsets ; ;------------------------------------------ X_FontRecord equ 1 X_MSRuler equ 2 X_PageBreak equ 3 X_MSLeftMargin equ 1 X_MSIndent equ X_MSLeftMargin+2 X_MSRightMargin equ X_MSIndent+2 X_MSSpaceFlags equ X_MSRightMargin+2 X_MSNumTabs equ X_MSSpaceFlags+3 X_MSTab1 equ X_MSNumTabs+1 X_MSTab2 equ X_MSNumTabs+3 X_MSTab3 equ X_MSNumTabs+5 X_MSTab4 equ X_MSNumTabs+7 X_MSTab5 equ X_MSNumTabs+9 X_MSTab6 equ X_MSNumTabs+11 X_MSTab7 equ X_MSNumTabs+13 X_MSTab8 equ X_MSNumTabs+15 X_MSTab9 equ X_MSNumTabs+17 X_MSTab10 equ X_MSNumTabs+19 X_MSRulerSize equ 32 X_MSFontSize equ 3 X_MSFontFlags equ 4 X_MSFontColor equ 5 X_MSFontRecSize equ 7 ;------------------------------------------ ; ; Equates from procedure X_WPScrapData ; ;------------------------------------------ X_WPBlockHand equ 0 X_WPBlockOffset equ X_WPBlockHand+4 X_WPAttribute equ X_WPBlockOffset+2 X_WPRulerHand equ X_WPAttribute+2 X_WPPageBreak equ 1 X_Blocksize equ 3*1024 X_scr_or_Reserved equ 0 ; ---- RULER RECORD OFFSETS ---- X_scr_or_Status equ X_scr_or_Reserved+2 X_scr_or_LeftM equ X_scr_or_Status+2 X_scr_or_IndentM equ X_scr_or_LeftM+2 X_scr_or_RightM equ X_scr_or_IndentM+2 X_scr_or_NumTabs equ X_scr_or_RightM+2 X_scr_or_TabList equ X_scr_or_NumTabs+2 X_scr_or_tab1 equ X_scr_or_NumTabs+2 X_scr_or_tab2 equ X_scr_or_NumTabs+6 X_scr_or_tab3 equ X_scr_or_NumTabs+10 X_scr_or_tab4 equ X_scr_or_NumTabs+14 X_scr_or_tab5 equ X_scr_or_NumTabs+18 X_scr_or_tab6 equ X_scr_or_NumTabs+22 X_scr_or_tab7 equ X_scr_or_NumTabs+26 X_scr_or_tab8 equ X_scr_or_NumTabs+30 X_scr_or_tab9 equ X_scr_or_NumTabs+34 X_scr_or_tab10 equ X_scr_or_NumTabs+38 X_scr_maxTabs equ 10 ; Maximum number of tabs X_scr_ort_Location equ 0 ; ---- TAB RECORD OFFSETS ---- X_scr_ort_Type equ X_scr_ort_Location+2 X_scr_ort_EndTabRec equ X_scr_ort_Type+2 X_scr_r_single equ 1<<0 ; ---- STATUS BITS ---- X_scr_r_double equ 1<<1 X_scr_r_triple equ 1<<2 X_scr_r_widow equ 1<<3 X_scr_r_left equ 1<<4 X_scr_r_center equ 1<<5 X_scr_r_right equ 1<<6 X_scr_r_full equ 1<<7 X_scr_ch_left equ 1<<8 ; ---- CHANGE BITS (incl. above) ---- X_scr_ch_indent equ 1<<9 X_scr_ch_right equ 1<<10 X_scr_ch_tabs equ 1<<11 X_scr_r_spacing equ X_scr_r_single+X_scr_r_double+X_scr_r_triple X_scr_r_just equ X_scr_r_full+X_scr_r_center+X_scr_r_right+X_scr_r_left X_scr_r_defined equ X_scr_r_spacing+X_scr_r_widow+X_scr_r_just X_scr_r_reserved equ $ffff-X_scr_r_defined X_SpaceReset equ $ffff-X_scr_r_spacing X_JustReset equ $ffff-X_scr_r_just X_scr_rt_decimal equ -1 ; ---- TAB TYPES ---- X_scr_rt_left equ 0 X_scr_rt_right equ 1 X_scr_rt_leftm equ 2 ; \ X_scr_rt_indentm equ 3 ; > (for use by TrackTab only) X_scr_rt_rightm equ 4 ; / ;------------------------------------------ ; ; Equates from procedure X_WPFileData ; ;------------------------------------------ X_scpBlockHand equ 0 X_scpOffset equ 4 X_scpAttr equ 6 X_scpRulerHand equ 8 X_scpPixels equ 12 X_scpLinehand equ 14 X_scpLastLine equ 18 X_scpBytes equ 20 X_scpPgBrk equ 1 X_scpPicture equ $8000 X_WinHeaderSize equ 390 X_MarkBit EQU 1<<15 X_ClearMark EQU $7fff X_lp_badformat equ 2 X_lp_unsupported equ 3 X_lp_usesource equ 4 ;------------------------------------------ ; ; Equates from procedure X_FieldScannerData ; ;------------------------------------------ X_TabCR equ 0 X_SpaceCR equ 1 X_CRNumber equ 2 \ No newline at end of file diff --git a/appleworksgs/Scrap/Scrap.link b/appleworksgs/Scrap/Scrap.link new file mode 100755 index 0000000..e6254e6 --- /dev/null +++ b/appleworksgs/Scrap/Scrap.link @@ -0,0 +1 @@ + -lseg SCRAP Source:AWGS:Scrap:Obj:shell.aii.o Source:AWGS:Scrap:Obj:scrapeqs.aii.o Source:AWGS:Scrap:Obj:clip.aii.o Source:AWGS:Scrap:Obj:stuff.aii.o Source:AWGS:Scrap:Obj:swscrap.aii.o Source:AWGS:Scrap:Obj:wpscrap.aii.o Source:AWGS:Scrap:Obj:ssscrap.aii.o Source:AWGS:Scrap:Obj:dbscrap.aii.o Source:AWGS:Scrap:Obj:pict.aii.o Source:AWGS:Scrap:Obj:ascii.aii.o Source:AWGS:Scrap:Obj:dbscdata.aii.o Source:AWGS:Scrap:Obj:ssscdata.aii.o Source:AWGS:Scrap:Obj:grscrap.aii.o Source:AWGS:Scrap:Obj:ssstring.aii.o Source:AWGS:Scrap:Obj:fscanner.aii.o Source:AWGS:Scrap:Obj:wpscrap2.aii.o Source:AWGS:Scrap:Obj:imptxt.aii.o Source:AWGS:Scrap:Obj:plscrap2.aii.o Source:AWGS:Scrap:Obj:drawpl.aii.o Source:AWGS:Scrap:Obj:short.aii.o -lseg:dynamic WPIO Source:AWGS:Scrap:Obj:wpdisk.aii.o -lseg:dynamic TOASCII Source:AWGS:Scrap:Obj:ascii2.aii.o -lseg:dynamic TOWPSCRAP Source:AWGS:Scrap:Obj:wpscrap3.aii.o -lseg:dynamic IMPORTAWDB Source:AWGS:Scrap:Obj:dbaworks.aii.o -lseg:dynamic TODBSCRAP Source:AWGS:Scrap:Obj:dbscrap2.aii.o -lseg:dynamic IMPORTAWWP Source:AWGS:Scrap:Obj:wpaworks.aii.o -lseg:dynamic IMPORTMSGS Source:AWGS:Scrap:Obj:msgswp.aii.o -lseg:dynamic TOPICT Source:AWGS:Scrap:Obj:pict2.aii.o -lseg:dynamic TOSTATTEXT Source:AWGS:Scrap:Obj:plscrap.aii.o -lseg:dynamic IMPORTAWSS Source:AWGS:Scrap:Obj:ssaworks.aii.o -lseg:dynamic TOSSSCRAP Source:AWGS:Scrap:Obj:ssscrap2.aii.o -lseg:dynamic IMPORTPICT Source:AWGS:Scrap:Obj:sworkslp.aii.o \ No newline at end of file diff --git a/appleworksgs/Scrap/Scrap.make b/appleworksgs/Scrap/Scrap.make new file mode 100755 index 0000000..40e6403 --- /dev/null +++ b/appleworksgs/Scrap/Scrap.make @@ -0,0 +1 @@ +# # Scrap.make - Makefile for Scrap # # Copyright 1989, Claris Corporation. # # This is a sub-makefile, called recursively when ::AppleWorks.make is # executed. # # All modules (including Driver, Scrap, Pict., SS, DB, etc.) # should have similar makefiles in their respective folders. # # This makefile rebuilds the module object files as necessary and creates a # file containing the necessary steps to link this module with the rest of # AppleWorksGS. ::AppleWorks.make combines the link files from the modules # into a script which it executes to create an executable. #-------------------------------------------------------------------------------- # Variables AsmIIGSOptions = Segment = SCRAP Segment2 = WPIO Segment3 = TOASCII Segment4 = TOWPSCRAP Segment5 = IMPORTAWDB Segment6 = TODBSCRAP Segment7 = IMPORTAWWP Segment8 = IMPORTMSGS Segment9 = TOPICT Segment10 = TOSTATTEXT Segment11 = IMPORTAWSS Segment12 = TOSSSCRAP Segment13 = IMPORTPICT Module = Scrap ModuleDir = {AWGS}{Module}: SrcDir = {ModuleDir}Src: IncDir = {ModuleDir} ObjDir = {ModuleDir}Obj: Linkfile = {ModuleDir}{Module}.link Makefile = {ModuleDir}{Module}.make GlobalIncludes = {AWGS}Macros:Macros.dump {AWGS}Driver:Driver.equ {IncDir}Scrap.equ Objs = {ObjDir}shell.aii.o {ObjDir}scrapeqs.aii.o {ObjDir}clip.aii.o {ObjDir}stuff.aii.o {ObjDir}swscrap.aii.o {ObjDir}wpscrap.aii.o {ObjDir}ssscrap.aii.o {ObjDir}dbscrap.aii.o {ObjDir}pict.aii.o {ObjDir}ascii.aii.o {ObjDir}dbscdata.aii.o {ObjDir}ssscdata.aii.o {ObjDir}grscrap.aii.o {ObjDir}ssstring.aii.o {ObjDir}fscanner.aii.o {ObjDir}wpscrap2.aii.o {ObjDir}imptxt.aii.o {ObjDir}plscrap2.aii.o {ObjDir}drawpl.aii.o {ObjDir}short.aii.o Objs2 = {ObjDir}wpdisk.aii.o Objs3 = {ObjDir}ascii2.aii.o Objs4 = {ObjDir}wpscrap3.aii.o Objs5 = {ObjDir}dbaworks.aii.o Objs6 = {ObjDir}dbscrap2.aii.o Objs7 = {ObjDir}wpaworks.aii.o Objs8 = {ObjDir}msgswp.aii.o Objs9 = {ObjDir}pict2.aii.o Objs10 = {ObjDir}plscrap.aii.o Objs11 = {ObjDir}ssaworks.aii.o Objs12 = {ObjDir}ssscrap2.aii.o Objs13 = {ObjDir}sworkslp.aii.o #-------------------------------------------------------------------------------- # Main target {Linkfile} {Objs} {Objs2} {Objs3} {Objs4} {Objs5} {Objs6} {Objs7} {Objs8} {Objs9} {Objs10} {Objs11} {Objs12} {Objs13} {Makefile} @echo "Creating {LinkFile} " @echo " -lseg {Segment} {Objs} " > {Targ} @echo " -lseg:dynamic {Segment2} {Objs2} " >> {Targ} @echo " -lseg:dynamic {Segment3} {Objs3} " >> {Targ} @echo " -lseg:dynamic {Segment4} {Objs4} " >> {Targ} @echo " -lseg:dynamic {Segment5} {Objs5} " >> {Targ} @echo " -lseg:dynamic {Segment6} {Objs6} " >> {Targ} @echo " -lseg:dynamic {Segment7} {Objs7} " >> {Targ} @echo " -lseg:dynamic {Segment8} {Objs8} " >> {Targ} @echo " -lseg:dynamic {Segment9} {Objs9} " >> {Targ} @echo " -lseg:dynamic {Segment10} {Objs10} " >> {Targ} @echo " -lseg:dynamic {Segment11} {Objs11} " >> {Targ} @echo " -lseg:dynamic {Segment12} {Objs12} " >> {Targ} @echo " -lseg:dynamic {Segment13} {Objs13} " >> {Targ} # Global Scrap dependencies {Objs} {Objs2} {Objs3} {Objs4} {Objs5} {Objs6} {Objs7} {Objs8} {Objs9} {Objs10} {Objs11} {Objs12} {Objs13} {GlobalIncludes} # Clean out Objs clean @confirm "Delete {Module} objs and linkfile?" @if {status} == 0 then rm {Linkfile} {Objs} {Objs2} {Objs3} {Objs4} {Objs5} {Objs6} {Objs7} {Objs8} {Objs9} {Objs10} {Objs11} {Objs12} {Objs13} @end #-------------------------------------------------------------------------------- # Special Cases {ObjDir}clip.aii.o {ObjDir}dbaworks.aii.o {ObjDir}dbscdata.aii.o {ObjDir}dbscrap.aii.o {ObjDir}dbscrap2.aii.o {ObjDir}pict2.aii.o {ObjDir}plscrap.aii.o {IncDir}dbsc.equ {ObjDir}dbscrap.aii.o {ObjDir}plscrap.aii.o {ObjDir}short.aii.o {ObjDir}ssscdata.aii.o {ObjDir}ssaworks.aii.o {ObjDir}ssscrap.aii.o {ObjDir}ssscrap2.aii.o {ObjDir}ssstring.aii.o {ObjDir}ascii2.aii.o {IncDir}sssc.equ {ObjDir}shell.aii.o {Makefile} #-------------------------------------------------------------------------------- # Default rules .aii.o .aii AsmIIGS {DepDir}{Default}.aii -o {TargDir}{Default}.aii.o {AsmIIGSOptions} -i {AWGS}Macros,{AWGS}Driver,{AWGS}Scrap {ObjDir} {SrcDir} \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/ascii.aii b/appleworksgs/Scrap/Src/ascii.aii new file mode 100755 index 0000000..0293421 --- /dev/null +++ b/appleworksgs/Scrap/Src/ascii.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' IMPORT X_AsciitoWPScrap IMPORT D_BeachBall IMPORT D_CurCursor IMPORT X_DBtoPLScrap IMPORT D_GrowHandle IMPORT D_GrowLHandle IMPORT D_NeedHand IMPORT D_NeedHandle IMPORT X_OldCursor IMPORT X_ParBlockSize IMPORT D_SetCursor import X_PLtoAsciiScrap entry X_AsciiFilter X_DBtoAsciiScrap PROC EXPORT input Src:l local Intermed:l output Dest:l error err begin +b SpaceLong PushLong Src jsl X_DBtoPLScrap sta err PullLong Intermed jcs exit SpaceLong PushLong Intermed jsl X_PLtoAsciiScrap sta err PullLong Dest PushLong Intermed _DisposeHandle exit return err ENDP X_ImportAsciitoWPScrap PROC EXPORT input Src:l local Dptr:l,Size:l output Dest:l error err begin +b PushLong Src jsl X_AsciiFilter SpaceLong PushLong Src jsl X_AsciitoWPScrap sta err PullLong Dest jcs exit exit return ENDP X_AsciiFilter PROC EXPORT input Src:l local Sptr:l,Ssize:l,EndPtr:l begin +b MoveLong [Src],Sptr SpaceLong PushLong Src _GetHandleSize PullLong Ssize AddLong Sptr,Ssize,EndPtr cloop short lda [Sptr] tax lda CharTable,x sta [Sptr] long IncLong Sptr Cmpl Sptr,EndPtr blt cloop return CharTable DC.B ' ' ;0-Null DC.B ' ' ;1-SOH DC.B ' ' ;2-STX DC.B ' ' ;3-ETX DC.B ' ' ;4-EOT DC.B ' ' ;5-ENQ DC.B ' ' ;6-ACK DC.B ' ' ;7-BEL DC.B ' ' ;8-BS DC.B 9 ;9-TAB DC.B ' ' ;A-LF DC.B ' ' ;B-VT DC.B ' ' ;C-FF DC.B $D ;D-CR DC.B ' ' ;E-SO DC.B ' ' ;F-SI DC.B ' ' ;10-DLE DC.B ' ' ;11-DC1 DC.B ' ' ;12-DC2 DC.B ' ' ;13-DC3 DC.B ' ' ;14-DC4 DC.B ' ' ;15-NAK DC.B ' ' ;16-SYN DC.B ' ' ;17-ETB DC.B ' ' ;18-CAN DC.B ' ' ;19-EM DC.B ' ' ;1A-SUB DC.B ' ' ;1B-ESC DC.B ' ' ;1C-FS DC.B ' ' ;1D-GS DC.B ' ' ;1E-RS DC.B ' ' ;1F-US DC.B ' ' ;20-Space DC.B '!' ;21-Shout DC.B '"' ;22-Double quote DC.B '#' ;23-Pound DC.B '$' ;24-Dollar DC.B '%' ;25-Percent DC.B '&' ;26-Ampersand DC.B $27 ;27-Single quote DC.B '(' ;28-Left paren DC.B ')' ;29-Right paren DC.B '*' ;2A-Star DC.B '+' ;2B-Plus DC.B ',' ;2C-Comma DC.B '-' ;2D-Minus DC.B '.' ;2E-Period DC.B '/' ;2F-Slash DC.B '0' ;30-Zero DC.B '1' ;31-One DC.B '2' ;32-Two DC.B '3' ;33-Three DC.B '4' ;34-Four DC.B '5' ;35-Five DC.B '6' ;36-Six DC.B '7' ;37-Seven DC.B '8' ;38-Eight DC.B '9' ;39-Nine DC.B ':' ;3A-Colon DC.B ';' ;3B-Semicolon DC.B '<' ;3C-Less than DC.B '=' ;3D-Equal DC.B '>' ;3E-Greater than DC.B '?' ;3F-Question DC.B '@' ;40-At DC.B 'A' ;41-A DC.B 'B' ;42-B DC.B 'C' ;43-C DC.B 'D' ;44-D DC.B 'E' ;45-E DC.B 'F' ;46-F DC.B 'G' ;47-G DC.B 'H' ;48-H DC.B 'I' ;49-I DC.B 'J' ;4A-J DC.B 'K' ;4B-K DC.B 'L' ;4C-L DC.B 'M' ;4D-M DC.B 'N' ;4E-N DC.B 'O' ;4F-O DC.B 'P' ;50-P DC.B 'Q' ;51-Q DC.B 'R' ;52-R DC.B 'S' ;53-S DC.B 'T' ;54-T DC.B 'U' ;55-U DC.B 'V' ;56-V DC.B 'W' ;57-W DC.B 'X' ;58-X DC.B 'Y' ;59-Y DC.B 'Z' ;5A-Z DC.B '[' ;5B-Left Bracket DC.B '\' ;5C-Backslash DC.B ']' ;5D-Right Bracket DC.B '^' ;5E-Carat DC.B '_' ;5F-Underscore DC.B '`' ;60-Back quote DC.B 'a' ;61-a DC.B 'b' ;62-b DC.B 'c' ;63-c DC.B 'd' ;64-d DC.B 'e' ;65-e DC.B 'f' ;66-f DC.B 'g' ;67-g DC.B 'h' ;68-h DC.B 'i' ;69-i DC.B 'j' ;6A-j DC.B 'k' ;6B-k DC.B 'l' ;6C-l DC.B 'm' ;6D-m DC.B 'n' ;6E-n DC.B 'o' ;6F-o DC.B 'p' ;70-p DC.B 'q' ;71-q DC.B 'r' ;72-r DC.B 's' ;73-s DC.B 't' ;74-t DC.B 'u' ;75-u DC.B 'v' ;76-v DC.B 'w' ;77-w DC.B 'x' ;78-x DC.B 'y' ;79-y DC.B 'z' ;7A-z DC.B '{' ;7B-Left brace DC.B '|' ;7C-Pipe DC.B '}' ;7D-Right brace DC.B '~' ;7E-Tilde DC.B ' ' ;7F-Del DC.B '' ;80-A umlaut DC.B '' ;81-A circle DC.B $82 ;82-C cedilla DC.B $83 ;83-E aigu DC.B $84 ;84-N tilde DC.B $85 ;85-O umlaut DC.B $86 ;86-U umlaut DC.B $87 ;87-a aigu DC.B $88 ;88-a grave DC.B $89 ;89-a circumflex DC.B $8A ;8A-a umlaut DC.B $8B ;8B-a tilde DC.B $8C ;8C-a circle DC.B $8D ;8D-c cedilla DC.B $8E ;8E-e aigu DC.B $8F ;8F-e grave DC.B $90 ;90-e cicumflex DC.B $91 ;91-e umlaut DC.B $92 ;92-i aigu DC.B $93 ;93-i grave DC.B $94 ;94-i circumflex DC.B $95 ;95-i umlaut DC.B $96 ;96-n tilde DC.B $97 ;97-o aigu DC.B $98 ;98-o grave DC.B $99 ;99-o circumflex DC.B $9A ;9A-o umlaut DC.B $9B ;9B-o tilde DC.B $9C ;9C-u aigu DC.B $9D ;9D-u grave DC.B $9E ;9E-u circumflex DC.B $9F ;9F-u umlaut DC.B $A0 ;A0-Cross DC.B $A1 ;A1-Degree DC.B $A2 ;A2-Cent DC.B $A3 ;A3-Sterling DC.B $A4 ;A4-Section DC.B $A5 ;A5-Dot DC.B $A6 ;A6-Paragraph DC.B $A7 ;A7-Esse DC.B $A8 ;A8-Registered DC.B $A9 ;A9-Copyright DC.B $AA ;AA-Trademark DC.B $AB ;AB-Aigu DC.B $AC ;AC-Umlaut DC.B $AD ;AD-Not equal DC.B $AE ;AE-AE DC.B $AF ;AF-O slash DC.B $B0 ;B0-Infinity DC.B $B1 ;B1-Plus or minus DC.B $B2 ;B2-Less than or equal DC.B $B3 ;B3-Greater than or equal DC.B $B4 ;B4-Yen DC.B $B5 ;B5-Mu DC.B $B6 ;B6-Differential DC.B $B7 ;B7-Sum DC.B $B8 ;B8-Product DC.B $B9 ;B9-Pi DC.B $BA ;BA-Integral DC.B $BB ;BB-Feminine DC.B $BC ;BC-Masculine DC.B $BD ;BD-Omega DC.B $BE ;BE-ae DC.B $BF ;BF-o slash DC.B $C0 ;C0-Upside down question DC.B $C1 ;C1-Upside down exclamation DC.B $C2 ;C2-Not DC.B $C3 ;C3-Radical DC.B $C4 ;C4-Florin DC.B $C5 ;C5-Wavy lines DC.B $C6 ;C6-Delta DC.B $C7 ;C7-Much less than DC.B $C8 ;C8-Much greater than DC.B $C9 ;C9-Elipsis DC.B $CA ;CA-Sticky Space DC.B $CB ;CB-A grave DC.B $CC ;CC-A tilde DC.B $CD ;CD-O tilde DC.B $CE ;CE-OE DC.B $CF ;CF-oe DC.B $D0 ;D0-Dash DC.B $D1 ;D1-Hyphen DC.B $D2 ;D2-Left double quote DC.B $D3 ;D3-Right double quote DC.B $D4 ;D4-Left quote DC.B $D5 ;D5-Right quote DC.B $D6 ;D6-Divide DC.B $D7 ;D7-Lozenge DC.B $D8 ;D8-y umlaut DC.B $D9 ;D9 DC.B $DA ;DA DC.B $DB ;DB DC.B $DC ;DC DC.B $DE ;DD DC.B $DE ;DE DC.B $DF ;DF DC.B $E0 ;E0 DC.B $E1 ;E1 DC.B $E2 ;E2 DC.B $E3 ;E3 DC.B $E4 ;E4 DC.B $E5 ;E5 DC.B $E6 ;E6 DC.B $E7 ;E7 DC.B $E8 ;E8 DC.B $E9 ;E9 DC.B $EA ;EA DC.B $EB ;EB DC.B $EC ;EC DC.B $ED ;ED DC.B $EE ;EE DC.B $EF ;EF DC.B $F0 ;F0 DC.B $F1 ;F1 DC.B $F2 ;F2 DC.B $F3 ;F3 DC.B $F4 ;F4 DC.B $F5 ;F5 DC.B $F6 ;F6 DC.B $F7 ;F7 DC.B $F8 ;F8 DC.B $F9 ;F9 DC.B $FA ;FA DC.B $FB ;FB DC.B $FC ;FC DC.B $FD ;FD DC.B $FE ;FE DC.B $FF ;FF ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/ascii2.aii b/appleworksgs/Scrap/Src/ascii2.aii new file mode 100755 index 0000000..e9fd03c --- /dev/null +++ b/appleworksgs/Scrap/Src/ascii2.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' include 'sssc.equ' IMPORT X_AsciitoWPScrap IMPORT D_BeachBall IMPORT D_CurCursor IMPORT X_DBtoPLScrap IMPORT D_GrowHandle IMPORT D_GrowLHandle IMPORT D_NeedHand IMPORT D_NeedHandle IMPORT X_OldCursor IMPORT X_ParBlockSize IMPORT D_SetCursor import X_AsciiFilter IMPORT CellBody IMPORT D_Deref IMPORT EndCellBody IMPORT X_FSScratch IMPORT X_InitFieldScanner IMPORT X_NextField IMPORT X_FormatValue IMPORT D_UnLock import X_ClipData X_ScPLtoAsciiScrap PROC EXPORT ;Using D_CursorData ;Using X_ClipData input Src:l local Sptr:l,Ssize:l,Dptr:l,Dsize:l,Doff:l local EndDptr:l,EndSptr:l output Dest:l error err begin MoveWord >D_CurCursor,X_OldCursor stz err SpaceLong PushLong Src _GetHandleSize sta err PullLong Ssize jcs exit SpaceLong PushLong Ssize jsl D_NeedHand sta err PullLong Dest jcs exit MoveLong [Dest],Dptr Stzl Doff PushLong Src _HLock AddLong [Src],#7,Sptr AddLong [Src],Ssize,EndSptr loop Cmpl Sptr,EndSptr jge done shortm lda [Sptr] cmp #$20 bge normal cmp #$9 beq normal cmp #CR bne notcr longm Addwl #7,Sptr jsl D_BeachBall shortm lda #CR brl normal LONGA Off notcr cmp #1 bne notfont longm Addwl #3,Sptr brl loop LONGA Off notfont longm Addwl #2,Sptr brl loop LONGA Off normal sta [Dptr] longm IncLong Sptr IncLong Doff IncLong Dptr brl loop mem_err PushLong Dest _DisposeHandle PushLong Src _HUnlock brl exit done PushLong Src _HUnlock PushLong Doff PushLong Dest jsl D_GrowHandle exit PushWord X_OldCursor jsl D_SetCursor return err ENDP ;************************************************************************ ; ; X_WPtoAsciiScrap ; ;************************************************************************ X_ScWPtoAsciiScrap PROC EXPORT ;Using X_SWScrapEquates ;Using X_WPScrapData ;Using D_CursorData ;Using X_ClipData input Src:l local Sptr:l,Pars:w,Block:l,Bptr:l,Bsize:l local Dptr:l,Dsize:l,FirstPar:w,Offset:w,NextPar:w local Doff:l,Pptr:l output Dest:l error err begin MoveWord >D_CurCursor,X_OldCursor stz err Spacelong _MaxBlock PullLong Dsize SpaceLong PushLong Dsize PushWord #X_Locked jsl D_NeedHandle sta err PullLong Dest jcs exit1 PushLong Src _HLock MoveLong [Src],Sptr MoveWord [Sptr],Pars AddLong Sptr,#2,Pptr MoveLong [Pptr],Block PushLong Block _HLock MoveLong [Block],Bptr MoveWord [Bptr],Bsize MoveLong [Dest],Dptr stz Dsize+2 MoveWord Bsize,Dsize stzl Doff parloop jsl D_BeachBall MoveWord [Pptr]:#4,Offset AddWord Offset,#7,Offset charloop shortm ldy Offset lda [Bptr],y cmp #CR+1 jge notspecial cmp #9 jeq notspecial cmp #CR jeq X_DoCR cmp #1 jeq dofont longm AddWord Offset,#2,Offset brl charloop dofont longm AddWord Offset,#3,Offset brl charloop X_DoCR sta [Dptr] longm inc Doff bne x4 inc Doff+2 x4 inc Dptr bne x5 inc Dptr+2 x5 inc Offset dec Pars jeq exit AddLong Pptr,#X_ParBlockSize,Pptr Cmpl Block,[Pptr] jeq parloop MoveLong [Pptr],Block MoveLong [Block],Bptr MoveWord [Bptr]:#2,Bsize stz Bsize+2 lda Dsize clc adc Bsize sta Dsize bcc noadd1 inc Dsize+2 noadd1 SpaceLong PushLong Dsize PushLong Dest jsl D_GrowLHandle sta err PullLong Dptr jcs Exit AddLong Dptr,Doff,Dptr brl parloop LONGA Off notspecial sta [Dptr] longm inc Doff bne x1 inc Doff+2 x1 inc Dptr bne x2 inc Dptr+2 x2 inc Offset brl charloop exit PushLong Block _HUnlock PushLong Src _HUnlock PushLong Dest _HUnlock lda err jeq NoErrors pushlong Dest _DisposeHandle bra Exitcursor NoErrors lda Doff dec a tax bne nohistuff lda Doff+2 dec a bra histuff nohistuff lda Doff+2 histuff pha phx PushLong Dest jsl D_GrowHandle sta err ExitCursor PushWord X_OldCursor jsl D_SetCursor Exit1 return err ENDP ;*********************************************************************** ; ; X_SStoAsciiScrap ; From a D_SS-type scrap, generate an ascii textblock (handle) ; s.t. cells are seperated by tabs and rows by carriage returns. ; ;X_SSScrapRows ;X_SSScrapcols ;X_SSScrapParseCode ;X_SSScrapSize ;Size of handle ;X_SSScrapCells ;Start of data ; ;X_SSScrapCellLoc ;X_SSScrapCellSize ;X_SSScrapFormat ;X_SSScrapValueSize ;X_SSScrapValue *********************************************************************** X_ScSStoAsciiScrap PROC EXPORT ;Using X_SSScrapData ;Using D_CursorData ;Using X_ClipData input src:l output dest:l local sptr:l,cptr:l,cellcount:l,ascptr:l,colcount:w,colindex:w local dsize:l,tmp:l,strptr:l,newsize:l,rowindex:w,mysize:l error err begin MoveWord >D_CurCursor,X_OldCursor cpzl src bne GetPtr moveword #-1,err brl quit GetPtr rcall D_Deref,in=(src:ax),out=(sptr:ax) ; initial approximation of the size tool _MaxBlock,out=(mysize:l) call D_NeedHand,in=(mysize:l),out=(dest:l),err=(err) jcs exit moveword [sptr]:#X_SSScrapcols,colcount stzl dsize in [sptr]:#X_SSScrapRows:w,[sptr]:#X_SSScrapcols:w out cellcount:l xtool _Multiply addwl #X_SSScrapCells,sptr moveword #1,rowindex sta colindex CellLoop call D_BeachBall cpzl cellcount jeq EndCellLoop cmpw [sptr]:#X_SSScrapCellLoc,rowindex jne EmptyCell cmpw [sptr]:#X_SSScrapCellLoc+2,colindex jne EmptyCell moveword [sptr]:#X_SSScrapFormat,a and #X_SSCellType xba div16 a tax jmp (TypeTable,x) TypeTable DC.W TextCell,ValueCell,CalcTextCell,FormulaCell DC.W LpadCell,RpadCell,EmptyCell,EmptyCell TextCell stz tmp+2 moveword [sptr]:#X_SSScrapValue,a and #$00FF sta tmp addlong a,dsize,newsize call D_GrowHandle,in=(newsize:l,dest:l),err=(err) jcs abort movelong [dest],ascptr addlong sptr,#X_SSScrapValue+1,s addlong ascptr,dsize,s tool _BlockMove,in=(:l,:l,tmp:l) movelong newsize,dsize brl DidCell CalcTextCell stz tmp+2 moveword [sptr]:#X_SSScrapValueSize,a and #$00FF sta tmp addlong a,dsize,newsize call D_GrowHandle,in=(newsize:l,dest:l),err=(err) jcs abort movelong [dest],ascptr addlong sptr,#X_SSScrapValue,s addlong ascptr,dsize,s tool _BlockMove,in=(:l,:l,tmp:l) movelong newsize,dsize brl DidCell FormulaCell ValueCell spacelong spacelong pushword #256 pushlong [sptr]:#X_SSScrapFormat addlong #X_SSScrapValue,sptr,s call X_FormatValue ; in=(:w,:l,:l),out=(:w,:l,:w) ply pulllong strptr ply stz tmp+2 lda [strptr] and #$00FF tay lda [strptr],y and #$FF cmp #' ' bne GetSize dey GetSize sty tmp GotSize tya addlong a,dsize,newsize incl strptr call D_GrowHandle,in=(newsize:l,dest:l),err=(err) jcs abort movelong [dest],ascptr pushlong strptr addlong ascptr,dsize,s tool _BlockMove,in=(:l,:l,tmp:l) movelong newsize,dsize LPadCell RPadCell DidCell moveword [sptr]:#X_SSScrapCellSize,tmp stz tmp+2 addlong tmp,sptr,sptr EmptyCell incl dsize call D_GrowHandle,in=(dsize:l,dest:l),err=(err) jcs abort movelong [dest],ascptr addlong ascptr,dsize,ascptr ; set ascptr to last byte decl ascptr ; lda colindex ina sta colindex cmp colcount ble DoTab moveword #1,colindex inc rowindex lda #CR bra DoSep DoTab lda #Tab DoSep shortm sta [ascptr] longm ContCell decl cellcount brl CellLoop EndCellLoop exit rcall D_UnLock,in=(src:ax) tool _GetHandleSize,in=(dest:l),out=(dsize:l) IncLong dsize call D_GrowHandle,in=(dsize:l,dest:l) DecLong dsize AddLong [Dest],dsize,cptr MoveByte #CR,[cptr] quit call D_SetCursor,in=(X_OldCursor:w) return abort tool _DisposeHandle,in=(Dest:l) brl exit ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/clip.aii b/appleworksgs/Scrap/Src/clip.aii new file mode 100755 index 0000000..a151cbb --- /dev/null +++ b/appleworksgs/Scrap/Src/clip.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' include 'dbsc.equ' IMPORT D_AlertBox IMPORT X_AsciiFilter IMPORT X_CacheRefcon IMPORT X_CacheType IMPORT X_CompareHandles IMPORT X_ConvertScrap IMPORT X_CopyScrap IMPORT X_DisposeScrap IMPORT D_DrawClip IMPORT D_FixPaste IMPORT X_KillCacheScrap IMPORT X_KillOldScrap IMPORT D_NeedHand IMPORT X_ScrapRefCon IMPORT X_ScrapType ENTRY X_CheckDBPict entry X_PostScrap entry X_GetScrap entry X_CheckScrap ;********************************************************************* ; ; X_ReadStandardScrap - Takes what is off of the public clipboard ; and puts it on the internal. ; ;********************************************************************* X_ReadStandardScrap PROC EXPORT ;Using X_ClipData local ScrapSize:l,Handle:l,TempHand:l error err begin +b stz err ; Check for Q_Text scrap. There is no get scrap call in the scrap manager SpaceLong PushWord #AppleText _GetScrapSize sta err PullLong ScrapSize jcc Text_Scrap lda err cmp #$1610 ;See if scrap of type jeq PictScrap brl exit ;We have a Q_Text scrap, so make handle and get it text_scrap lda ScrapSize ora ScrapSize+2 jeq PictScrap SpaceLong PushLong ScrapSize jsl D_NeedHand ;Leave result on stack jcs mem_err MoveLong 1:s,Handle ; PushWord #AppleText ;for this call _GetScrap jcc noerr sta err brl exit noerr Cmpw X_CacheType,#AsciiText bne nocache1 MoveLong X_CacheRefcon,TempHand Cpzl [TempHand] beq nocache1 SpaceWord PushLong Handle PushLong X_CacheRefcon jsl X_CompareHandles pla jeq exit nocache1 PushLong Handle ; So we don't get control chars jsl X_AsciiFilter ; in the word processor PushWord #AsciiText PushLong Handle jsl X_PostScrap brl exit mem_err sta err ;Store the error and return pla pla brl exit ;We have a pict. Do the same thing. pictscrap SpaceLong PushWord #ApplePict _GetScrapSize sta err PullLong ScrapSize jcc dopict brl exit dopict lda ScrapSize ora ScrapSize+2 jeq exit SpaceLong PushLong ScrapSize jsl D_NeedHand ;Leave result on stack jcs mem_err MoveLong 1:s,Handle PushWord #ApplePict ;for this call _GetScrap jcc noerrpict sta err brl exit noerrpict Cmpw X_CacheType,#PICT bne nocache2 MoveLong X_CacheRefcon,TempHand Cpzl [TempHand] beq nocache2 SpaceWord PushLong Handle PushLong X_CacheRefcon jsl X_CompareHandles pla jeq exit nocache2 PushWord #PICT PushLong Handle jsl X_PostScrap exit _ZeroScrap return err ENDP ;********************************************************************* ; ; X_WriteStandardScrap - Takes the internal clipboard and puts it on the ; standard clipboard ; ;********************************************************************* X_WriteStandardScrap PROC EXPORT ;Using X_ClipData local RefCon:l,Type:w error err begin +b stz err lda X_ScrapType ;If there is no scrap, go away cmp #X_NullScrap jeq exit SpaceWord SpaceLong PushLong #StandardScraps jsl X_GetScrap sta err PullLong Refcon PullWord Type jcc doit _ZeroScrap SpaceWord SpaceLong PushLong #StandardScraps jsl X_GetScrap sta err PullLong Refcon PullWord Type bcc doit SpaceWord PushWord #OKBox PushLong #CantWriteStr jsl D_AlertBox pla MoveWord #-1,err brl exit CantWriteStr STR 'Not enough memory to convert the clipboard',CR,'for use with other applications.' doit lda Type beq Exit _ZeroScrap SpaceLong PushLong RefCon _GetHandleSize ;Leave result on stack for next call lda Type cmp #PICT bne Q_Text PushWord #ApplePict bra goon Q_Text PushWord #AppleText goon PushLong [Refcon] _PutScrap sta err PushWord Type PushLong Refcon jsl X_DisposeScrap exit return err StandardScraps DC.W PICT DC.W AsciiText DC.W 0 ENDP ;********************************************************************* ; ; X_PostScrap(Type:w,Refcon:l) ; ;********************************************************************* X_PostScrap PROC EXPORT ;Using X_ClipData input Type:w,Refcon:l local Message:l,Mptr:l begin +b lda X_ScrapType cmp #-1 beq post jsl X_KillOldScrap jsl X_KillCacheScrap ;Post the D_New one post MoveWord Type,X_ScrapType MoveLong RefCon,X_ScrapRefCon ;Place the scrap and type in the message Q_center. SpaceLong PushLong #12 jsl D_NeedHand PullLong Message bcs nomessage MoveLong [Message],Mptr MoveWord Type,[Mptr]:#6 MoveLong RefCon,[Mptr]:#8 PushWord #1 PushWord #$B0B0 PushLong Message _MessageCenter tool _DisposeHandle,in=(Message:l) nomessage jsl D_FixPaste ;Redraw the scrap now jsl D_DrawClip return ENDP ;********************************************************************* ; ; X_GetScrap(*TypeList:l):type:w,refcon:l ; ;********************************************************************* X_GetScrap PROC EXPORT ;Using X_ClipData input List:l local MainType:w,TempScrap:l output Type:w,RefCon:l error err begin +b stz err stz Type ;Check for existence of said scrap ourscrap lda X_ScrapType cmp #X_NullScrap jeq nomatch ;Get nearest type doit SpaceWord PushLong List jsl X_CheckScrap pla jeq nomatch ;Check for match sta Type Cmpw X_ScrapType,Type jeq sametype Cmpw X_CacheType,Type jne nocachehere MoveLong X_CacheRefcon,TempScrap Cpzl [TempScrap] jne notpurged PushLong X_CacheRefcon _DisposeHandle MoveWord #-1,X_CacheType brl nocachehere notpurged PushWord #0 PushLong X_CacheRefcon _SetPurge SpaceLong PushWord X_CacheType PushLong X_CacheRefcon jsl X_CopyScrap PullLong Refcon bcc usedcache MoveWord #-1,X_CacheType MoveLong X_CacheRefcon,RefCon brl exit usedcache PushWord #2 PushLong X_CacheRefcon _SetPurge brl exit nocachehere ;Convert the scrap into form we can use SpaceLong PushWord X_ScrapType PushLong X_ScrapRefCon PushWord Type jsl X_ConvertScrap sta err PullLong RefCon jcs exit makecache Cmpw X_CacheType,#X_NullScrap jeq nocachethrowaway PushWord X_CacheType PushLong X_CacheRefcon jsl X_DisposeScrap nocachethrowaway Cmpw Type,#WpText beq wrongtype cmp #PLPict beq wrongtype cmp #GRPict bne oktype wrongtype MoveWord #-1,X_CacheType brl exit oktype SpaceLong PushWord Type PushLong RefCon jsl X_CopyScrap PullLong X_CacheRefcon bcc wehavecache MoveWord #-1,X_CacheType brl exit wehavecache MoveWord Type,X_CacheType PushWord #2 PushLong X_CacheRefcon _SetPurge brl exit ;Make copy sametype SpaceLong PushWord X_ScrapType PushLong X_ScrapRefCon jsl X_CopyScrap sta err PullLong RefCon MoveWord X_ScrapType,Type exit lda err jeq goaway nomatch MoveWord #0,Type Cmpw #-1,err bne goaway stz err goaway return ENDP ;********************************************************************* ; ; X_CheckScrap(*TypeList):type:w ; ;********************************************************************* X_CheckScrap PROC EXPORT ;Using X_ClipData input List:l local PLTextFlag:w,FirstTextType:w,PICTFlag:w local GlobalList:l,Itemdex:w output Type:w begin +b stz Type Cmpw #X_NullScrap,X_ScrapType ;Can't match null scrap bne scrapthere brl exit scrapthere lda X_ScrapType cmp #DBScrap jeq dodbscrap stz PLTextFlag stz FirstTextType stz PICTFlag ldy #0 typeloop lda [List],y beq doneflags cmp X_ScrapType jeq foundmatch cmp #StaticText bne notpltext inc PLTextFlag notpltext and #$ff00 cmp #PICT bne notpict inc PICTFlag bra loopinc notpict lda FirstTextType bne loopinc lda [List],y sta FirstTextType loopinc iny iny bra typeloop doneflags lda X_ScrapType cmp #PLPict beq doplpict and #$ff00 cmp #PICT beq dopict lda FirstTextType sta Type brl exit doplpict lda PLTextFlag beq dopict ; PushLong X_ScrapRefCon ; jsl X_CheckText ; bcc dopict bra dopict lda #StaticText sta Type brl exit dopict lda PICTFlag beq exit lda #PICT foundmatch sta Type exit return dodbscrap ldy #0 stz PictFlag stz PLTextFlag dbtypeloop lda [List],y beq enddbloop cmp X_ScrapType jeq foundmatch pha and #$ff00 cmp #PICT bne nopict inc PictFlag bra dbinc nopict ldx PLTextFlag bne dbinc lda 1,s sta FirstTextType inc PLTextFlag dbinc pla iny iny bra dbtypeloop enddbloop lda PictFlag beq nodbpict PushLong X_ScrapRefCon jsl X_CheckDBPict jcs nodbpict MoveWord #PICT,Type brl exit nodbpict lda PLTextFlag beq nodbscrap MoveWord FirstTextType,Type brl exit nodbscrap MoveWord #-1,Type brl exit ENDP X_CheckDBPict PROC EXPORT ;Using X_DBScrapData input Refcon:l local Rptr:l error err begin stz err MoveLong [Refcon],Rptr lda [Rptr] cmp #X_DBCellType jne nogo ldy #X_DBRows lda [Rptr],y cmp #1 jne nogo ldy #X_DBColumns lda [Rptr],y cmp #1 jne nogo Addwl #X_DBScHeaderSize,Rptr ldy #X_DBFType lda [Rptr],y cmp #X_DBPict jne nogo brl exit nogo inc err exit return ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/dbaworks.aii b/appleworksgs/Scrap/Src/dbaworks.aii new file mode 100755 index 0000000..29d4bde --- /dev/null +++ b/appleworksgs/Scrap/Src/dbaworks.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' include 'dbsc.equ' IMPORT D_AlertBox IMPORT D_BeachBall IMPORT D_CurCursor IMPORT D_DateToStr import DBDate import X_DBTime IMPORT X_DefaultDBFieldBlock IMPORT FieldRecSize IMPORT X_FieldRecord IMPORT X_FieldRect IMPORT X_FieldWidth IMPORT D_GrowHandle IMPORT D_GrowLHandle IMPORT MinFieldSize IMPORT D_NeedHandle IMPORT X_OldCursor IMPORT X_SSScratch IMPORT X_ScratchRect IMPORT D_SetCursor IMPORT X_tenthsto80ths IMPORT D_TimeToStr import X_ClipData import D_NeedHand X_ScAWDBtoDBScrap PROC EXPORT input Src:l local Sptr:l,Dptr:l,NumReps:w,HeaderSize:w local Rows:w,Columns:w,ScrapSize:l,Rowdex:w local Coldex:w,FieldPtr:l,StringSize:w,FieldOff:l local DataPointer:l,StringBlock:l,SBPtr:l,FHSize:w local RowSize:l,ASptr:l,RealColumns:w,CatOffset:w local FieldsSkipped:w,SBSize:l,DataOffset:l,CatName:w local CatSize:w,Temp:l output Dest:l error err begin MoveWord >D_CurCursor,X_OldCursor ;Dereference source pointer MoveLong [Src],Sptr ;How big is AWHeader? MoveWord [Sptr],HeaderSize ;Get number of reports ldy #X_RepNum lda [Sptr],y and #$ff sta NumReps ;Now figure out how big this database is ldy #222 lda [Sptr],y and #$ff sta Columns MoveWord [Sptr]:#X_CatNum,a and #$ff sta RealColumns Cmpw Columns,RealColumns jeq noprob call D_AlertBox,in=(#OKCancelBox:w,#HiddenStr:l),out=(a:w) cmp #OK beq noprob MoveWord #-1,err brl exit HiddenStr STR 'You will lose the information in the',CR,'deleted categories.' noprob MoveLong [Src],Sptr ldy #X_RecNum lda [Sptr],y and #$7FFF ; strip off high-bit, incase it's a AW3.0 fileJ.K. sta Rows ;Get block to store strings in. SBSize=RealColumns*128 ;First multiply by 256 lda RealColumns xba tax and #$ff sta SBSize+2 txa and #$ff00 sta SBSize ;Then shift right once lsr SBSize+2 ror SBSize call D_NeedHand,in=(SBSize:l),out=(StringBlock:l),err=err bcc noerrx brl exit noerrx tool _MaxBlock,out=(ScrapSize:l) call D_NeedHand,in=(ScrapSize:l),out=(Dest:l),err=err bcc @1 tool _DisposeHandle,in=(StringBlock:l) brl exit @1 tool _Multiply,in=(Columns:w,#MinFieldSize:w),out=(:l) AddLong s,#X_DBScHeaderSize,ScrapSize call D_GrowHandle,in=(ScrapSize:l,Dest:l),err=err bcc @2 tool _DisposeHandle,in=(StringBlock:l) @2 ;Now do as much of the header as we can MoveLong [Dest],Dptr lda #X_DBColumnType sta [Dptr] MoveWord Rows,[Dptr]:#X_DBRows MoveWord Columns,[Dptr]:#X_DBColumns MoveWord #0,[Dptr]:#X_DBLabels MoveWord #X_DBFormHt,[Dptr]:#X_DBFormHeight MoveWord #0,[Dptr]:#X_DBHeaderHeight MoveWord #0,[Dptr]:#X_DBFooterHeight ;Copy defaults into working field header tool _BlockMove,in=(#X_DefaultDBFieldBlock:l,#X_FieldRecord:l,#FieldRecSize:l) ;Now do the field headers stz Coldex ;Initialize the form rectangle MoveWord #X_DBFormVerBorder,X_ScratchRect MoveWord #X_DBFormHorBorder,X_ScratchRect+2 MoveWord #X_DBFormVerBorder+X_DBEntryHeight,X_ScratchRect+4 MoveWord #X_DBFormHorBorder+X_DBEntryWidth,X_ScratchRect+6 MoveLong #X_DBScHeaderSize,FieldOff loop MoveLong [Src],Sptr MoveLong [StringBlock],SBptr jsl D_BeachBall lda Coldex cmp Columns jge endloop lda #MinFieldSize sta X_FieldRecord ;Get list width AddWord Coldex,#X_ListWidthTable,y lda [Sptr],y and #$ff jsl X_tenthsto80ths sta X_FieldWidth ;Get form rectangle MoveRect X_ScratchRect,X_FieldRect ;Get field name (growing the handle and adjusting the ;field size appropriately) lda Coldex clc adc #X_ListOrder tay lda [Sptr],y and #$ff dec a sta CatSize tool _Multiply,in=(CatSize:w,#X_CatNameSize:w),out=(ax:l) clc adc #X_FirstCatName tay sty CatOffset lda [Sptr],y and #$ff sta StringSize ; Addwl StringSize.<,X_FieldRecord ; Addwl StringSize.<,X_FieldRecord asl a clc adc X_FieldRecord sta X_FieldRecord bcc @1 inc X_FieldRecord+2 @1 lda StringSize asl a clc adc ScrapSize sta ScrapSize bcc @2 inc ScrapSize+2 @2 inc StringSize lda Coldex jsr Mul128 tay lda CatSize sta [SBPtr],y call D_GrowHandle,in=(ScrapSize:l,Dest:l),err=err bcc noerr1 tool _DisposeHandle,in=(Dest:l) tool _DisposeHandle,in=(StringBlock:l) brl exit noerr1 AddLong [Dest],FieldOff,FieldPtr tool _BlockMove,in=(#X_FieldRecord:l,FieldPtr:l,#FieldRecSize:l) ;Copy the name string MoveLong [Src],Sptr Addwls CatOffset,Sptr movelong 1:s,ASptr ; stx ASptr ; sta ASptr+2 Addwls #FieldRecSize,FieldPtr PushWord #0 PushWord StringSize _BlockMove ;At this point, FieldPtr/FieldOff point to the beginning of this field. ;Copy the formula string (null) Addwl #FieldRecSize,FieldOff Addwl StringSize,FieldOff AddLong [Dest],FieldOff,FieldPtr MoveWord #0,[FieldPtr] ;Store null string for formula. Extra zero is not a problem IncLong FieldPtr IncLong FieldOff ;header string in ASptr:l,FieldPtr:l,#0:w,StringSize:w xtool _BlockMove Addwl StringSize,FieldPtr Addwl StringSize,FieldOff MoveLong #0,[FieldPtr] ;data size Addwl #4,FieldPtr Addwl #4,FieldOff ;Adjust scratch rectangle for next field lda Coldex cmp #14 ;The fifteenth record is bottom beq bottomform AddWord X_ScratchRect,#X_DBEntryHeight+X_DBFormVerSpacing,X_ScratchRect AddWord X_ScratchRect,#X_DBEntryHeight,X_ScratchRect+4 ; direct offset brl doinc1 bottomform MoveWord #X_DBFormVerBorder,X_ScratchRect MoveWord #X_DBFormVerBorder+X_DBEntryHeight,X_ScratchRect+4 AddWord X_ScratchRect+2,#X_DBEntryWidth+X_DBFormHorSpacing,X_ScratchRect+2 AddWord X_ScratchRect+2,#X_DBEntryWidth,X_ScratchRect+6 doinc1 inc Coldex brl loop endloop MoveLong [Dest],Dptr MoveLong FieldOff,[Dptr]:#X_DBDataOffset ;Here we will process reports. For now, we are going to punt, and skip the ;reports tool _Multiply,in=(NumReps:w,#X_AWReportSize:w),out=DataOffset:l Addwl #2,DataOffset Addwl HeaderSize,DataOffset jsr FixPtrs ;We don't want to D_Read the standard values. lda [DataPointer] clc adc #2 sta Temp bne @1 inc DataPointer+2 @1 clc adc DataPointer sta DataPointer bcc noinc5 inc DataPointer+2 noinc5 Addwl Temp,DataOffset ;Now we have to do the actual data. This is really gross because AppleWorks ;does not store the data in the order we need, but the order that it was ;defined. stz Rowdex outer jsl D_BeachBall Addwl #2,DataPointer Addwl #2,DataOffset lda Rowdex cmp Rows jge endouter stz Coldex Stzl RowSize inner jsl D_BeachBall lda Coldex cmp RealColumns jge endinner ;Get string out of database lda [DataPointer] and #$ff cmp #$80 jlt normal cmp #$ff jeq skiprecord brl nottime dotime IncLong DataPointer IncLong DataOffset short ldy #1 lda [DataPointer],y sec sbc #$41 sta X_DBTime+2 long SpaceWord Addwls #2,DataPointer PushWord #2 PushWord #0 _Dec2Int pla and #$ff sta X_DBTime+1 call D_TimeToStr,in=(X_DBTime:l,#X_SSScratch:l,#0:w) Addwl #4,DataPointer Addwl #4,DataOffset brl dodateortimestr X_dodate IncLong DataPointer IncLong DataOffset SpaceWord Addwls #1,DataPointer PushWord #2 PushWord #0 _Dec2Int PullWord DBDate+2 lda DBDate+2 cmp #100 blt noprob100 clc adc #100 sta DBDate+2 noprob100 lda #0 short ldy #3 lda [DataPointer],y sec sbc #'A' sta DBDate+1 long SpaceWord Addwls #4,DataPointer PushWord #2 PushWord #0 _Dec2Int pla beq nodecday dec a nodecday short sta DBDate long call D_DateToStr,in=(DBDate:l,#X_SSScratch:l,#LongDate:w,#0:w) lda DBDate+2 bne notzero shortm lda X_SSScratch sec sbc #6 sta X_SSScratch longm notzero Addwl #6,DataPointer Addwl #6,DataOffset dodateortimestr lda X_SSScratch and #$ff inc a sta StringSize Addwl StringSize,ScrapSize Addwl #2,ScrapSize Addwl StringSize,RowSize Addwl #2,RowSize PushLong #X_SSScratch lda Coldex jsr Mul128 inc a inc a clc adc SBptr tax lda SBPtr+2 adc #0 pha phx pea 0 PushWord StringSize _BlockMove brl doinc2 doone lda Coldex jsr Mul128 inc a inc a tay lda #0 sta [SBPtr],y inc Coldex Addwl #2,ScrapSize Addwl #2,RowSize brl inner nottime and #$7f sta FieldsSkipped skiploop lda Coldex jsr mul128 inc a inc a tay lda #0 sta [SBPtr],y inc Coldex Addwl #2,ScrapSize Addwl #2,RowSize dec FieldsSkipped beq endsloop bra skiploop endsloop IncLong DataPointer IncLong DataOffset brl inner skiprecord lda RealColumns sec sbc Coldex sta FieldsSkipped beq endskloop skloop lda Coldex jsr mul128 inc a inc a tay lda #0 sta [SBPtr],y inc Coldex Addwl #2,ScrapSize Addwl #2,RowSize dec FieldsSkipped beq endskloop bra skloop endskloop brl endinner ;Grow the handle normal inc a sta StringSize lda [DataPointer] and #$ff00 cmp #$c000 jeq X_dodate cmp #$D400 jeq dotime Addwl StringSize,ScrapSize Addwl #2,ScrapSize Addwl StringSize,RowSize Addwl #2,RowSize ;Store the string in the string table PushLong DataPointer lda Coldex jsr Mul128 inc a inc a clc adc SBptr tax lda SBptr+2 pha phx pea 0 PushWord StringSize _BlockMove Addwl StringSize,DataPointer Addwl StringSize,DataOffset doinc2 inc Coldex brl inner endinner stz Coldex call D_GrowHandle,in=(ScrapSize:l,Dest:l),err=err bcc @1 tool _DisposeHandle,in=(Dest:l) tool _DisposeHandle,in=(StringBlock:l) brl exit @1 jsr FixPtrs ;This loop takes the strings out of the block and appends them to the scrap. inner2 jsl D_BeachBall lda Coldex cmp Columns jge endinner2 lda #0 sta [FieldPtr] Addwl #2,FieldPtr lda Coldex ;Get the string out of the block jsr Mul128 tay lda [SBptr],y jsr Mul128 inc a inc a tay lda [SBptr],y and #$ff beq emptystring inc a sta StringSize tya clc adc SBptr tax lda SBPtr+2 adc #0 pha phx PushLong FieldPtr pea 0 PushWord StringSize _BlockMove inc Coldex Addwl StringSize,FieldPtr Addwl StringSize,FieldOff Addwl #2,FieldOff brl inner2 emptystring Subwl #2,FieldPtr lda #X_DBCellEmpty sta [FieldPtr] Addwl #2,FieldPtr Addwl #2,FieldOff inc Coldex brl inner2 endinner2 IncLong DataPointer IncLong DataOffset call D_GrowHandle,in=(FieldOff:l,Dest:l) MoveLong FieldOff,ScrapSize inc Rowdex brl outer endouter tool _DisposeHandle,in=(StringBlock:l) exit call D_SetCursor,in=(X_OldCursor:w) return Mul128 xba lsr a rts FixPtrs AddLong [Src],DataOffset,DataPointer MoveLong [StringBlock],SBPtr MoveLong [Dest],Dptr AddLong Dptr,FieldOff,FieldPtr rts ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/dbscdata.aii b/appleworksgs/Scrap/Src/dbscdata.aii new file mode 100755 index 0000000..d4b0be6 --- /dev/null +++ b/appleworksgs/Scrap/Src/dbscdata.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' include 'dbsc.equ' X_DBScrapData PROC EXPORT EXPORT X_DefaultDBFieldBlock EXPORT X_EndDeafultDBBlock EXPORT X_FieldRecord EXPORT X_FieldHSize EXPORT X_FieldAttr EXPORT X_FieldWidth EXPORT X_FieldRect EXPORT X_FieldType EXPORT X_FieldAlignment EXPORT X_FieldStyle EXPORT X_FieldColor EXPORT X_FieldDisplay EXPORT X_FieldDecimals EXPORT X_FieldWS1 EXPORT X_FieldRFlags EXPORT X_FieldWS2 EXPORT X_EndFieldRecord EXPORT X_ScratchRect export fieldrecsize export minfieldsize ;Row block offsets X_DefaultDBFieldBlock DC.L 0 DC.W X_DefaultDBAttr DC.W X_DefaultDBWidth DS.B 8 DC.W 0 DC.W 0 DC.W 1<<3 DC.W 0 DC.W 0 DC.W 0 DS.B 40 DC.W 0 DS.B 36 X_EndDeafultDBBlock X_FieldRecord X_FieldHSize DS.B 4 X_FieldAttr DS.B 2 X_FieldWidth DS.B 2 X_FieldRect DS.B 8 X_FieldType DS.B 2 X_FieldAlignment DS.B 2 X_FieldStyle DS.B 2 X_FieldColor DS.B 2 X_FieldDisplay DS.B 2 X_FieldDecimals DS.B 2 X_FieldWS1 DS.B 40 X_FieldRFlags DS.B 2 X_FieldWS2 DS.B 36 X_EndFieldRecord X_ScratchRect DS.B 8 FieldRecSize equ X_EndFieldRecord-X_FieldRecord MinFieldSize equ FieldRecSize+7 ENDP X_DBAworksData PROC EXPORT EXPORT DBDate EXPORT X_DBTime DBDate DS.B 4 X_DBTime DS.B 4 ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/dbscrap.aii b/appleworksgs/Scrap/Src/dbscrap.aii new file mode 100755 index 0000000..5c892b2 --- /dev/null +++ b/appleworksgs/Scrap/Src/dbscrap.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' include 'dbsc.equ' include 'sssc.equ' IMPORT D_AlertBox IMPORT X_AsciiFilter IMPORT D_AuxHand IMPORT D_BeachBall IMPORT X_Blurb2 IMPORT X_Button1Text IMPORT X_Button2Text IMPORT X_Button3Text IMPORT D_CloseDialog IMPORT X_ContText IMPORT D_CurCursor IMPORT X_DefaultDBFieldBlock IMPORT D_DigitsOnly IMPORT X_FSBlurbString IMPORT FSDialogTemplate IMPORT X_FSScratch IMPORT FieldRecSize IMPORT X_FieldRecord IMPORT X_FormatMask IMPORT D_GetNewModalDialog IMPORT D_GrowHandle IMPORT X_InitFieldScanner IMPORT D_NeedHand IMPORT X_NextField IMPORT X_OldCursor IMPORT X_SStoAsciiScrap IMPORT X_PLtoAsciiScrap IMPORT D_SetCursor IMPORT X_WPtoAsciiScrap IMPORT X_DBButton1Text IMPORT X_DBButton2Text IMPORT X_DBButton3Text IMPORT X_DBContText entry X_AsciitoDBScrap import X_DoAsciitoDBScrap X_SStoDBScrap PROC EXPORT ;Using X_SSScrapData ;Using X_ClipData ;Using D_CursorData input Src:l local Intermed:l,Isize:l output Dest:l error err begin +b movelong #(-1-X_SSCellParenNeg),X_FormatMask SpaceLong PushLong Src jsl X_SStoAsciiScrap sta err PullLong Intermed jcs exit SpaceLong PushLong Intermed _GetHandleSize PullLong Isize DecLong Isize PushLong Isize PushLong Intermed jsl D_GrowHandle SpaceLong PushLong Intermed jsl X_AsciitoDBScrap sta err PullLong Dest PushLong Intermed _DisposeHandle exit movelong #-1,X_FormatMask return err ENDP X_SWtoDBScrap PROC EXPORT input Src:l local Intermed:l output Dest:l error err begin SpaceLong PushLong Src jsl X_PLtoAsciiScrap sta err PullLong Intermed jcs exit SpaceLong PushLong Intermed jsl X_AsciitoDBScrap sta err PullLong Dest PushLong Intermed _DisposeHandle exit return ENDP X_WPtoDBScrap PROC EXPORT input Src:l local Intermed:l output Dest:l error err begin SpaceLong PushLong Src jsl X_WPtoAsciiScrap sta err PullLong Intermed jcs exit SpaceLong PushLong Intermed jsl X_AsciitoDBScrap sta err PullLong Dest PushLong Intermed _DisposeHandle exit return ENDP X_AsciitoDBScrap PROC EXPORT ;Using X_FieldScannerData input Src:l output Dest:l error err begin SpaceLong PushLong Src PushWord #X_TabCR pea 0 jsl X_DoAsciitoDBScrap sta err PullLong Dest return ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/dbscrap2.aii b/appleworksgs/Scrap/Src/dbscrap2.aii new file mode 100755 index 0000000..63304d4 --- /dev/null +++ b/appleworksgs/Scrap/Src/dbscrap2.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' include 'dbsc.equ' IMPORT D_AlertBox IMPORT X_AsciiFilter IMPORT D_AuxHand IMPORT D_BeachBall IMPORT X_Blurb2 IMPORT X_Button1Text IMPORT X_Button2Text IMPORT X_Button3Text IMPORT D_CloseDialog IMPORT X_ContText IMPORT D_CurCursor IMPORT X_DefaultDBFieldBlock IMPORT D_DigitsOnly IMPORT X_FSBlurbString IMPORT FSDialogTemplate IMPORT X_FSScratch IMPORT FieldRecSize IMPORT X_FieldRecord IMPORT X_FormatMask IMPORT D_GetNewModalDialog IMPORT D_GrowHandle IMPORT X_InitFieldScanner IMPORT D_NeedHand IMPORT X_NextField IMPORT X_OldCursor IMPORT X_SStoAsciiScrap IMPORT X_PLtoAsciiScrap IMPORT D_SetCursor IMPORT X_WPtoAsciiScrap IMPORT X_DBButton1Text IMPORT X_DBButton2Text IMPORT X_DBButton3Text IMPORT X_DBContText import X_AsciitoDBScrap import X_ClipData import X_DoAsciitoDBScrap import X_NumberStr X_ScDoAsciitoDBScrap PROC EXPORT ;Using X_DBScrapData ;Using X_FieldScannerData ;Using D_CursorData ;Using X_ClipData input Src:l,SepFlag:w,ScanFields:w local Dptr:l,Dsize:l,Doff:l,ScrapPtr:l,D_AuxHand:l local Aptr:l,Asize:l,Aoff:l,MaxRow:w,MaxCol:w local Col:w,Result:w,StrSize:w,FieldPtr:l local DataOff:l,RowSize:l,Row:w,Cells:l local ScrapSize:l,Sptr:l output Dest:l error err begin MoveWord >D_CurCursor,X_OldCursor SpaceLong PushLong Src _GetHandleSize PullLong ScrapSize DecLong ScrapSize AddLong [Src],ScrapSize,Sptr short lda [Sptr] cmp #CR bne nocr long PushLong ScrapSize PushLong Src jsl D_GrowHandle bra scan nocr long ;Initialize scanner scan PushLong Src PushWord SepFlag PushWord ScanFields jsl X_InitFieldScanner ;Allocate string block SpaceLong PushLong #1024 jsl D_NeedHand sta err PullLong D_AuxHand jcs error ;Allocate handle for scrap SpaceLong _MaxBlock PullLong ScrapSize SpaceLong PushLong ScrapSize jsl D_NeedHand sta err PullLong Dest jcs exit ;Initialize sizes, field block to copy, etc. Stzl Dsize Stzl Doff PushLong #X_DefaultDBFieldBlock PushLong #X_FieldRecord PushLong #FieldRecSize _BlockMove lda #X_DBScHeaderSize jsr FixDptr jcs exit MoveWord #X_DBCellType,[Dptr] MoveWord #0,[Dptr]:#X_DBLabels MoveWord #0,[Dptr]:#X_DBFormHeight MoveWord #0,[Dptr]:#X_DBHeaderHeight MoveWord #0,[Dptr]:#X_DBFooterHeight MoveLong #X_DBScHeaderSize,Dsize MoveLong #X_DBScHeaderSize,Doff Stzl Cells MoveLong [D_AuxHand],Aptr Stzl Asize Stzl Aoff MoveWord #1,MaxRow sta MaxCol sta Col loop jsl D_BeachBall SpaceWord jsl X_NextField PullWord Result lda X_FSScratch and #$ff sta StrSize bne notempty brl test notempty clc adc #4 inc a jsr FixAptr jcs listerr MoveWord MaxRow,[Aptr] MoveWord Col,[Aptr]:#2 PushLong #X_FSScratch Addwls #4,Aptr pea 0 inc StrSize pei StrSize _BlockMove Addwl #4,Aoff Addwl StrSize,Aoff IncLong Cells test lda Result beq dofield bpl dorecord bra doendofscrap dofield Cmpw Col,MaxCol bge newmax bra nonewmax newmax MoveWord Col,MaxCol nonewmax inc Col brl loop dorecord Cmpw Col,MaxCol bge blah1 bra blah2 blah1 MoveWord Col,MaxCol blah2 MoveWord #1,Col inc MaxRow brl loop doendofscrap Cmpw Col,MaxCol bge blah3 bra blah4 blah3 MoveWord Col,MaxCol blah4 MoveLong [Dest],Dptr MoveLong MaxRow,[Dptr]:#X_DBRows MoveLong MaxCol,[Dptr]:#X_DBColumns SpaceLong PushWord #(FieldRecSize+13) PushWord MaxCol _Multiply pla sta DataOff plx stx DataOff+2 clc adc #X_DBScHeaderSize jcs listerr sta DataOff MoveLong DataOff,[Dptr]:#X_DBDataOffset MoveWord #1,Col MoveLong #(FieldRecSize+13),X_FieldRecord colloop jsl D_BeachBall lda #(FieldRecSize+13) jsr FixDptr jcs listerr PushLong #X_FieldRecord PushLong Dptr PushLong #FieldRecSize _BlockMove Addwl #FieldRecSize,Dptr MoveLong >FieldName,[Dptr] Addwl #4,Dptr MoveByte #0,[Dptr] IncLong Dptr MoveLong >FieldName,[Dptr] MoveLong #0,[Dptr]:#4 lda >FieldBody inc a sta >FieldBody bne @1 lda >FieldBody+2 inc a sta >FieldBody+2 @1 Addwl #(FieldRecSize+13),Doff lda Col cmp MaxCol bge endcolloop inc Col brl colloop endcolloop MoveWord #1,Row MoveLong [D_AuxHand],Aptr outer MoveWord #1,Col Stzl RowSize MoveLong Doff,FieldPtr inner jsl D_BeachBall Cmpl #0,Cells jeq blankcell Cmpw [Aptr],Row jne blankcell Cmpw [Aptr]:#2,Col jne blankcell Addwl #4,Aptr lda [Aptr] and #$ff inc a sta StrSize clc adc #2 jsr FixDptr jcs exit lda #0 sta [Dptr] Addwl #2,Dptr PushLong Aptr PushLong Dptr pea 0 PushWord StrSize _BlockMove Addwl StrSize,Aptr Addwl StrSize,Doff Addwl #2,Doff Addwl StrSize,RowSize DecLong Cells bra endinner blankcell lda #2 jsr FixDptr jcs listerr MoveWord #X_DBCellEmpty,[Dptr] Addwl #2,Doff IncLong RowSize endinner lda Col cmp MaxCol bge endouter inc Col brl inner endouter MoveLong [Dest],Dptr AddLong Dptr,FieldPtr,Dptr lda Row cmp MaxRow bge done inc Row brl outer done PushLong D_AuxHand _DisposeHandle PushLong Src _HUnlock brl exit listerr PushLong D_AuxHand _DisposeHandle error PushLong Dest _DisposeHandle exit PushWord X_OldCursor jsl D_SetCursor return FieldName DC.B 3 FieldBody DC.L $31313131 FixDptr clc adc Dsize sta Dsize bcc x2 inc Dsize+2 x2 pei Dsize+2 pei Dsize pei Dest+2 pei Dest jsl D_GrowHandle sta err bcc noprob rts noprob MoveLong [Dest],Dptr MoveLong Dptr,ScrapPtr AddLong Dptr,Doff,Dptr clc rts FixAptr clc adc Asize sta Asize bcc x3 inc Asize+2 x3 pei Asize+2 pei Asize pei D_AuxHand+2 pei D_AuxHand jsl D_GrowHandle sta err bcc noprob2 rts noprob2 AddLong [D_AuxHand],Aoff,Aptr clc rts ENDP X_ScImportAsciitoDBScrap PROC EXPORT ;Using X_FieldScannerData ;Using X_FSDialogData ;Using X_ClipData ;Using D_CursorData input Src:l local Dialog:l,ButtonValue:w,Fields:w output Dest:l error err begin PushLong Src jsl X_AsciiFilter MoveLong #X_Blurb2,X_FSBlurbString MoveLong #X_DBButton1Text,X_Button1Text MoveLong #X_DBButton2Text,X_Button2Text MoveLong #X_DBButton3Text,X_Button3Text MoveLong #X_DBContText,X_ContText stz ButtonValue SpaceLong PushLong #FSDialogTemplate jsl D_GetNewModalDialog sta err PullLong Dialog jcs exit PushWord #ArrowCursor jsl D_SetCursor dialogloop SpaceWord PushLong #(D_DigitsOnly+$80000000) _ModalDialog pla beq dialogloop cmp #Cancel jeq docancel cmp #OK jeq dook sec sbc #200 asl a tax jmp (buttontable,x) buttontable DC.W dobuttonone,dobuttontwo,dobuttonthree,dobuttonthree DC.W dobuttonthree dobuttonone PushWord #1 PushLong Dialog PushWord #200 _SetDItemValue stz ButtonValue brl dialogloop dobuttontwo PushWord #1 PushLong Dialog PushWord #201 _SetDItemValue MoveWord #1,ButtonValue brl dialogloop dobuttonthree PushWord #1 PushLong Dialog PushWord #202 _SetDItemValue MoveWord #2,ButtonValue brl dialogloop docancel MoveWord #-1,err PushWord #WatchCursor jsl D_SetCursor brl exit dook lda ButtonValue cmp #2 jne notcrnum PushLong Dialog PushWord #203 PushLong #X_NumberStr _GetIText lda X_NumberStr and #$ff beq dostringerr SpaceWord PushLong #(X_NumberStr+1) lda X_NumberStr and #$ff pha pea 0 _Dec2Int PullWord Fields bpl cont dostringerr SpaceWord PushWord #OKBox PushLong #FieldErrorString jsl D_AlertBox pla brl dialogloop notcrnum stz Fields cont MoveWord >D_CurCursor,X_OldCursor PushWord #WatchCursor jsl D_SetCursor SpaceLong PushLong Src PushWord ButtonValue PushWord Fields jsl X_DoAsciitoDBScrap sta err PullLong Dest PushWord X_OldCursor jsl D_SetCursor exit PushLong Dialog jsl D_CloseDialog return err FieldErrorString STR 'Please type the number of fields.' ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/drawpl.aii b/appleworksgs/Scrap/Src/drawpl.aii new file mode 100755 index 0000000..cf8627a --- /dev/null +++ b/appleworksgs/Scrap/Src/drawpl.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' IMPORT D_Deref IMPORT D_DrawText IMPORT D_GetStats IMPORT D_GetWdth IMPORT D_KillFont IMPORT D_SectClipRect IMPORT D_SelectFont ;------------------------------------------------------------------------------- ; ; X_DrawPLText ; X_DrawPLText PROC EXPORT INPUT TextHdl:l,RectPtr:l LOCAL OldFont:l,OldColor:w LOCAL ClipRgn:l,Just:w,Spacing:w,Remain:w LOCAL TextPtr:l,EndPtr:l,Pt:l LOCAL Offset:w,StartOffset:w,EndOffset:w LOCAL LineTop:w,MaxWidth:w,CurWidth:w,EndWidth:w LOCAL Font:l,Color:w,FontChanged:w LOCAL StartFont:l,StartColor:w LOCAL Ascent:w,Descent:w,Leading:w LOCAL EndAscent:w,EndDescent:w,EndLeading:w LOCAL MaxAscent:w,MaxDescent:w,MaxLeading:w LOCAL StartPar:w,theChar:w,SpaceCount:w LOCAL StartSeg:w,EndSeg:w,LeftOffset:w BEGIN tool _NewRgn,out=(ClipRgn:l) tool _GetClip,in=(ClipRgn:l) call D_SectClipRect,in=(RectPtr:l) tool _GetFontId,out=(OldFont:l) tool _GetForeColor,out=(OldColor:w) jsl D_KillFont rcall D_Deref,in=(TextHdl:ax),out=(TextPtr:ax) tool _GetHandleSize,in=(TextHdl:l),out=(:l) addlong s,TextPtr,EndPtr moveword #1,StartPar stz EndOffset moveword [RectPtr],LineTop subword [RectPtr]:#6,[RectPtr]:#2,MaxWidth LineLoop lda StartPar beq NotStart addwl EndOffset,TextPtr cmpl TextPtr,EndPtr bge Done jsr DoParag stz StartPar NotStart jsr CutLine jsr DrawLine jsr GetBaseOffset addword a,LineTop,a addword a,EndDescent,LineTop scmpw LineTop,[RectPtr]:#4 blt LineLoop Done tool _HUnlock,in=(TextHdl:l) tool _SetClip,in=(ClipRgn:l) tool _DisposeHandle,in=(ClipRgn:l) rcall D_SelectFont,in=(OldFont:ax,OldColor:y) RETURN DoParag movelong [TextPtr],Font moveword [TextPtr]:#4,a and #$ff sta Color moveword [TextPtr]:#5,a and #$ff sta Just moveword [TextPtr]:#6,a and #$ff sta Spacing moveword #7,Offset rts D_SetStuff moveword Offset,EndOffset moveword CurWidth,EndWidth moveword MaxAscent,EndAscent moveword MaxDescent,EndDescent moveword MaxLeading,EndLeading rts CutLine movelong Font,StartFont moveword Color,StartColor moveword Offset,StartOffset stz CurWidth stz SpaceCount stz EndOffset rcall D_SelectFont,in=(Font:ax,Color:y) rcall D_GetStats,out=(MaxAscent:a,MaxDescent:x,MaxLeading:y) stz FontChanged CharLoop moveword [TextPtr]:Offset,a inc Offset and #$ff sta theChar cmp #SPACE+1 blt SpecialCase lda FontChanged beq NoChange rcall D_SelectFont,in=(Font:a,Font+2:x,#0:y) rcall D_GetStats,out=(Ascent:a,Descent:x,Leading:y) cmpw Ascent,MaxAscent blt AscOk sta MaxAscent AscOk cmpw Descent,MaxDescent blt DscOk sta MaxDescent DscOk cmpw Leading,MaxLeading blt LdgOk sta MaxLeading LdgOk stz FontChanged NoChange CheckWidth rcall D_GetWdth,in=(theChar:a) addword a,CurWidth,CurWidth cmp MaxWidth blt CharLoop NoFit lda EndOffset bne Set jsr D_SetStuff Set brl CutExit SpecialCase asl a tax jmp (CutTable,x) DoSpace jsr D_SetStuff inc SpaceCount bra CheckWidth DoTab tool _UDivide,in=(CurWidth:w,#80:w),out=(Remain:w,a:w) subword #80,Remain,a addword a,CurWidth,a cmp MaxWidth bge TabNext sta CurWidth jsr D_SetStuff brl CharLoop TabNext dec Offset jsr D_SetStuff brl CutExit X_DoCR jsr D_SetStuff inc StartPar brl CutExit FontChange moveword [TextPtr]:Offset,Font inc Offset bra ChangeExit StyleChange movebyte [TextPtr]:Offset,Font+2 bra ChangeExit SizeChange movebyte [TextPtr]:Offset,Font+3 ChangeExit inc Offset inc FontChanged brl CharLoop CutExit rts DrawLine jsr DoJust addword [RectPtr]:#2,LeftOffset,s jsr GetBaseOffset addword a,LineTop,s _MoveTo stz FontChanged movelong StartFont,Font moveword StartColor,Color rcall D_SelectFont,in=(Font:ax,Color:y) moveword StartOffset,Offset moveword Offset,StartSeg CharLoop2 cmpw Offset,EndOffset jge DrawExit moveword [TextPtr]:Offset,a inc Offset and #$ff sta TheChar cmp #5 blt ChangeChar ; real characters lda FontChanged beq NoChange2 rcall D_SelectFont,in=(Font:ax,Color:y) stz FontChanged moveword Offset,StartSeg dec StartSeg NoChange2 cmpw TheChar,#TAB bne CharLoop2 DrawTab moveword Offset,EndSeg dec EndSeg jsr DrawSegment tool _GetPen,in=(!Pt:l) subword Pt+2,[RectPtr]:#2,a tool _UDivide,in=(a:w,#80:w),out=(Remain:w,a:w) subword #80,Remain,a tool _Move,in=(a:w,#0:w) moveword Offset,StartSeg bra CharLoop2 ChangeChar lda FontChanged bne DoJump moveword Offset,EndSeg dec EndSeg jsr DrawSegment inc FontChanged DoJump lda theChar asl a tax jmp (DrawTable,x) FontChange2 moveword [TextPtr]:Offset,Font inc Offset bra ChangeExit2 StyleChange2 movebyte [TextPtr]:Offset,Font+2 bra ChangeExit2 SizeChange2 movebyte [TextPtr]:Offset,Font+3 bra ChangeExit2 ColorChange2 moveword [TextPtr]:Offset,a and #$ff sta Color ChangeExit2 inc Offset brl CharLoop2 DrawExit moveword Offset,EndSeg jsr DrawSegment tool _SetSpaceExtra,in=(#0:l) rts DrawSegment lda StartSeg addlong a,TextPtr,s subword EndSeg,StartSeg,s jsl D_DrawText rts ;------------------------------------------------------------------------------ GetBaseOffset cmpw Spacing,#2 beq Triple cmp #1 beq Double Single lda EndLeading bra GetBaseExit Double lda EndAscent lsr a addword a,EndLeading,a bra GetBaseExit Triple addword EndAscent,EndLeading,a GetBaseExit addword a,EndAscent,a rts ;-------------------------------------------------------------------------------- DoJust stz LeftOffset lda Just beq JustExit cmp #1 beq DoCenter cmp #2 beq DoRight DoFull lda StartPar bne JustExit lda SpaceCount beq JustExit spacelong subword MaxWidth,EndWidth,s pushword SpaceCount _FixRatio _SetSpaceExtra bra JustExit DoRight subword MaxWidth,EndWidth,a bra SetLeft DoCenter subword MaxWidth,EndWidth,a lsr a SetLeft sta LeftOffset JustExit rts CutTable DC.W CharLoop ; 0 DC.W FontChange ; 1 DC.W StyleChange ; 2 DC.W SizeChange ; 3 DC.W ChangeExit ; 4 DC.W CharLoop ; 5 DC.W CharLoop ; 6 DC.W CharLoop ; 7 DC.W CharLoop ; 8 DC.W DoTab ; 9 DC.W CharLoop ;10 DC.W CharLoop ;11 DC.W CharLoop ;12 DC.W X_DoCR ;13 DC.W CharLoop ;14 DC.W CharLoop ;15 DC.W CharLoop ;16 DC.W CharLoop ;17 DC.W CharLoop ;18 DC.W CharLoop ;19 DC.W CharLoop ;20 DC.W CharLoop ;21 DC.W CharLoop ;22 DC.W CharLoop ;23 DC.W CharLoop ;24 DC.W CharLoop ;25 DC.W CharLoop ;26 DC.W CharLoop ;27 DC.W CharLoop ;28 DC.W CharLoop ;29 DC.W CharLoop ;30 DC.W CharLoop ;31 DC.W DoSpace ;32 DrawTable DC.W DrawExit ; 0 DC.W FontChange2 ; 1 DC.W StyleChange2 ; 2 DC.W SizeChange2 ; 3 DC.W ColorChange2 ; 4 ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/fscanner.aii b/appleworksgs/Scrap/Src/fscanner.aii new file mode 100755 index 0000000..60b87e2 --- /dev/null +++ b/appleworksgs/Scrap/Src/fscanner.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' import D_AlertBox ENTRY X_BlurbString ENTRY X_ButtonOne ENTRY X_ButtonThree ENTRY X_ButtonTwo ENTRY X_ContinueLine ENTRY X_FSCancel ENTRY X_FSCancelString ENTRY X_FSFields ENTRY X_FSFlag ENTRY FSMaxFields ENTRY X_FSOK ENTRY X_FSOKString ENTRY X_FSOff ENTRY X_FSScratch ENTRY X_FSSize ENTRY X_FSSrc ENTRY X_FSep ENTRY X_NumberLine ENTRY X_RSep entry X_FieldTooBig entry X_AlertFlag ;************************************************************************** ; ; FieldScanner - This scanner will scan an ascii handle and put the ; next field into a buffer using one of three different field ; separation schemes. ; ;************************************************************************** ;************************************************************************** ; ; X_InitFieldScanner - This initializes the scanner so that it knows how ; much Q_Text there is, and what the separators are. ; ; Inputs - ; Scrap - a handle with ascii Q_Text inside. ; SepFlag - A value telling which separtors to use ; 0 - Tabs between fields (columns), CRs between records (rows) ; 1 - Spaces between field , CRs between records (rows) ; 2 - CRs between fields, number of fields specified ; FieldsPerLine - Only used if 2 is the value of the SepFlag ; The number of fields per record ; ;************************************************************************** X_InitFieldScanner PROC EXPORT ;Using X_FieldScannerData input Scrap:l,SepFlag:w,FieldsPerLine:w local Ptr:l begin +b MoveLong Scrap,X_FSSrc SpaceLong PushLong Scrap _GetHandleSize PullLong X_FSSize MoveWord SepFlag,X_FSFlag Stzl X_FSOff MoveWord FieldsPerLine,FSMaxFields stz X_FSFields lda SepFlag asl a tax jmp (SepTable,x) SepTable DC.W dotabcr,dospacecr,docrnum dotabcr MoveWord #Tab,X_FSep MoveWord #CR,X_RSep bra exit dospacecr MoveWord #Space,X_FSep MoveWord #CR,X_RSep bra exit docrnum MoveWord #CR,X_FSep sta X_RSep exit return ENDP ;*********************************************************************** ; ; X_NextField(Result:W) - puts the next field into the X_FSScratch buffer and ; returns with a code: ; 0 - field separator ; 1 - record separator ; -1 - end of scrap (no more input) ; ;*********************************************************************** X_NextField PROC EXPORT ;Using X_FieldScannerData local Hand:l,Sptr:l output Result:w begin +b MoveLong X_FSSrc,Hand AddLong [Hand],X_FSOff,Sptr stz X_FSScratch ldy #0 loop Cmpl X_FSOff,X_FSSize jge endofscrap short lda [Sptr],y cmp X_FSep jeq field cmp X_RSep jeq record iny cpy #255 jge toobig tyx sta X_FSScratch,x long IncLong X_FSOff brl loop LONGA Off LONGI Off field tya sta X_FSScratch long lda X_FSFlag cmp #X_CRNumber beq checkforrecord IncLong X_FSOff stz Result brl exit checkforrecord inc X_FSFields Cmpw X_FSFields,FSMaxFields bge dorecord IncLong X_FSOff stz Result brl exit LONGA Off LONGI Off record tya sta X_FSScratch long dorecord stz X_FSFields IncLong X_FSOff MoveWord #1,Result brl exit LONGA Off LONGI Off toobig tya short sta X_FSScratch long MoveWord #-1,Result lda X_AlertFlag bne exit call D_AlertBox,in=(#OKBox:w,#X_FieldTooBig:l),out=(a:w) bra exit endofscrap tya short sta X_FSScratch long MoveWord #-1,Result exit return ENDP X_FieldScannerData PROC EXPORT EXPORT FSMaxFields EXPORT X_FSFields EXPORT X_FSFlag EXPORT X_FSSrc EXPORT X_FSOff EXPORT X_FSSize EXPORT X_FSScratch EXPORT X_FSep EXPORT X_RSep export X_FieldTooBig export X_AlertFlag FSMaxFields DS.B 2 X_FSFields DS.B 2 X_FSFlag DS.B 2 X_FSSrc DS.B 4 X_FSOff DS.B 4 X_FSSize DS.B 4 X_FSScratch DS.B 256 X_FSep DS.B 2 X_RSep DS.B 2 X_FieldTooBig STR 'There was a cell or field with more than 255',CR,'characters. The data was truncated.' X_AlertFlag DC.W 0 ENDP X_FSDialogData PROC EXPORT EXPORT FSDialogTemplate EXPORT X_FSOK EXPORT X_FSOKString EXPORT X_FSCancel EXPORT X_FSCancelString EXPORT X_BlurbString EXPORT X_FSBlurbString EXPORT X_Blurb1 EXPORT X_Blurb2 EXPORT X_ButtonOne EXPORT X_Button1Text EXPORT X_SSButton1Text EXPORT X_DBButton1Text EXPORT X_ButtonTwo EXPORT X_Button2Text EXPORT X_SSButton2Text EXPORT X_DBButton2Text EXPORT X_ButtonThree EXPORT X_Button3Text EXPORT X_SSButton3Text EXPORT X_DBButton3Text EXPORT X_NumberLine EXPORT X_ContinueLine EXPORT X_ContText EXPORT X_SSContText EXPORT X_DBContText FSDialogTemplate DC.W 50,100,135,540 DC.W 1 DC.L 0 DC.L X_FSOK DC.L X_FSCancel DC.L X_BlurbString DC.L X_ButtonOne DC.L X_ButtonTwo DC.L X_ButtonThree DC.L X_NumberLine DC.L X_ContinueLine DC.L 0 X_FSOK DC.W OK DC.W 65,225,80,325 DC.W ButtonItem DC.L X_FSOKString DC.W 0 DC.W 0 DC.L 0 X_FSOKString STR 'OK' X_FSCancel DC.W Cancel DC.W 65,100,80,200 DC.W ButtonItem DC.L X_FSCancelString DC.W 0 DC.W 0 DC.L 0 X_FSCancelString STR 'Cancel' X_BlurbString DC.W 3 DC.W 3,20,14,420 DC.W statText+itemDisable X_FSBlurbString DC.L 0 DC.W 0 DC.W 0 DC.L 0 X_Blurb1 STR 'Define row and column separators:' X_Blurb2 STR 'Define field and record separators:' X_ButtonOne DC.W 200 DC.W 15,30,26,420 DC.W radioItem X_Button1Text DC.L 0 DC.W 1 DC.W 1 DC.L 0 X_SSButton1Text STR 'Tabs between columns, returns between rows.' X_DBButton1Text STR 'Tabs between fields, returns between records.' X_ButtonTwo DC.W 201 DC.W 30,30,41,420 DC.W radioItem X_Button2Text DC.L 0 DC.W 0 DC.W 1 DC.L 0 X_SSButton2Text STR 'Spaces between columns, returns between rows.' X_DBButton2Text STR 'Spaces between fields, returns between records.' X_ButtonThree DC.W 202 DC.W 45,30,56,240 DC.W radioItem X_Button3Text DC.L 0 DC.W 0 DC.W 1 DC.L 0 X_SSButton3Text STR 'Returns between columns,' X_DBButton3Text STR 'Returns between fields,' X_NumberLine DC.W 203 DC.W 44,246,57,290 DC.W editLine DC.L 0 DC.W 3 DC.W 0 DC.L 0 X_ContinueLine DC.W 204 DC.W 46,296,58,420 DC.W statText X_ContText DC.L 0 DC.W 0 DC.W 0 DC.L 0 X_SSContText STR 'columns per row.' X_DBContText STR 'fields per record.' ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/grscrap.aii b/appleworksgs/Scrap/Src/grscrap.aii new file mode 100755 index 0000000..efcf2ab --- /dev/null +++ b/appleworksgs/Scrap/Src/grscrap.aii @@ -0,0 +1 @@ +***************************************************************** * * GRSCRAP - Graphics scrap routines. They go through a jump * table at the beginning of the static graphics segment * (GRSTAT). * * Entries are: * * X_CopyGRPict * X_FreeGRPict * X_GRPictToPict * ***************************************************************** load 'macros.dump' include 'driver.equ' include 'scrap.equ' IMPORT D_LoadSegName entry X_GetGRSTATAddr ***************************************************************** * * X_CopyGRPict - Copy a graphics picture * ***************************************************************** X_CopyGRPict PROC EXPORT input ingrpict:l output outgrpict:l local where:l error err begin +b call X_GetGRSTATAddr,out=where:l movew [where],slot+1 movew [where]:#1,slot+2 spacelong pushlong ingrpict slot jsl >0 sta err pulllong outgrpict return ENDP ***************************************************************** * * X_FreeGRPict - Free a graphics picture * ***************************************************************** X_FreeGRPict PROC EXPORT input thegrpict:l error err local where:l begin +b call X_GetGRSTATAddr,out=where:l movew [where]:#4,slot+1 movew [where]:#5,slot+2 pushlong thegrpict slot jsl >0 sta err return ENDP ***************************************************************** * * X_GRPictToPict - Convert graphics picture to PICT * ***************************************************************** X_GRPictToPict PROC EXPORT input ingrpict:l output outpict:l error err local where:l begin +b call X_GetGRSTATAddr,out=where:l movew [where]:#8,slot+1 movew [where]:#9,slot+2 spacelong pushlong ingrpict slot jsl >0 sta err pulllong outpict return ENDP ***************************************************************** * * X_GetGRSTATAddr -- Get the address of the static graphics segment. * Call the loader the first time; remember it after * that. * ***************************************************************** X_GetGRSTATAddr PROC EXPORT output where:l error err begin stz err cmpl #0,>theaddr bne gotit call D_LoadSegName,in=#grstatname:l,out=(>theaddr:l,?:w),err=err gotit movel >theaddr,where return theaddr DC.L 0 grstatname str 'GRSTAT' ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/imptxt.aii b/appleworksgs/Scrap/Src/imptxt.aii new file mode 100755 index 0000000..8e9f9e6 --- /dev/null +++ b/appleworksgs/Scrap/Src/imptxt.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' IMPORT X_AWWPtoWPScrap IMPORT D_Close IMPORT X_ConvertScrap IMPORT X_DisposeWPScrap IMPORT X_ImportWP IMPORT X_MSGStoWPScrap IMPORT D_Mark IMPORT D_MarkId IMPORT D_Message1 IMPORT D_MessageThere IMPORT D_NeedHandle IMPORT D_Open IMPORT D_OpenId IMPORT D_OpenNamePtr IMPORT D_Read IMPORT D_ReadId IMPORT D_ReadPtr IMPORT D_ReadRequest IMPORT D_ReadWord2 IMPORT D_SendMessage IMPORT D_Set_Mark IMPORT X_WPtoAsciiScrap IMPORT X_WPtoPLScrap import D_SetMark2 import D_Read2 X_ImportWPtoAscii PROC EXPORT input FileRef:w local Intermed:l output Dest:l error err begin SpaceLong PushWord FileRef jsl X_ImportWP sta err PullLong Intermed jcs exit SpaceLong PushLong Intermed jsl X_WPtoAsciiScrap sta err PullLong Dest PushLong Intermed jsl X_DisposeWPScrap exit return ENDP X_ImportWPtoPLText PROC EXPORT input FileRef:w local Intermed:l output Dest:l error err begin SpaceLong PushWord FileRef jsl X_ImportWP sta err PullLong Intermed jcs exit ; SpaceLong ; PushLong Intermed ; jsl X_WPtoAsciiScrap ; sta err ; PullLong Dest SpaceLong PushWord #WPText PushLong Intermed PushWord #StaticText jsl X_ConvertScrap sta err PullLong Dest PushLong Intermed jsl X_DisposeWPScrap exit return ENDP X_ImportAscii PROC EXPORT input Src:l output Dest:l error err begin MoveLong Src,Dest MoveWord #4,err return ENDP X_ImportMSGStoAscii PROC EXPORT input Src:l local Intermed:l output Dest:l error err begin SpaceLong PushLong Src jsl X_MSGStoWPScrap sta err PullLong Intermed jcs exit SpaceLong PushLong Intermed jsl X_WPtoAsciiScrap sta err PullLong Dest PushLong Intermed jsl X_DisposeWPScrap exit return ENDP X_ImportMSGStoPLText PROC EXPORT input Src:l local Intermed:l output Dest:l error err begin SpaceLong PushLong Src jsl X_MSGStoWPScrap sta err PullLong Intermed jcs exit SpaceLong PushLong Intermed jsl X_WPtoPLScrap sta err PullLong Dest PushLong Intermed jsl X_DisposeWPScrap exit return ENDP X_ImportAWWPtoAscii PROC EXPORT input Src:l local Intermed:l output Dest:l error err begin SpaceLong PushLong Src jsl X_AWWPtoWPScrap sta err PullLong Intermed jcs exit SpaceLong PushLong Intermed jsl X_WPtoAsciiScrap sta err PullLong Dest PushLong Intermed jsl X_DisposeWPScrap exit return ENDP X_ImportAWWPtoPLText PROC EXPORT input Src:l local Intermed:l output Dest:l error err begin SpaceLong PushLong Src jsl X_AWWPtoWPScrap sta err PullLong Intermed jcs exit SpaceLong PushLong Intermed jsl X_WPtoPLScrap sta err PullLong Dest PushLong Intermed jsl X_DisposeWPScrap exit return ENDP X_ImportGRScrap PROC EXPORT ;Using D_IOData ;Using X_WPFileData ;Using D_OpenData input FileRef:w local Total:l,Size:l,ColorHand:l output Dest:l error err begin +b stz err Stzl Total ; Skip past version number call D_ReadWord2,in=(FileRef:w),out=(a:w),err=err jcs exit ; Get size of header call D_ReadWord2,in=(FileRef:w),out=(Size:w),err=err jcs exit MoveLong #4,Total ; Get size of reference record call D_ReadWord2,in=(FileRef:w),out=(Size:w),err=err jcs exit Addwl #2,Total Addwl Size,Total ; Skip past it call D_SetMark2,in=(FileRef:w,#0:w,Total:l) ; Get size of color table call D_ReadWord2,in=(FileRef:w),out=(Size:w),err=err jcs exit Addwl #2,Total Addwl Size,Total SpaceLong PushWord #0 PushWord Size PushWord #$4000 jsl D_NeedHandle sta err PullLong ColorHand jcs exit MoveLong ColorHand,>D_Message1 MoveWord #3,>D_MessageThere call D_Read2,in=(FileRef:w,[ColorHand]:l,#0:w,Size:w),out=ax:l,err=err jcs exit ; Skip past print record call D_ReadWord2,in=(FileRef:w),out=(Size:w),err=err jcs exit Addwl #2,Total Addwl Size,Total call D_SetMark2,in=(FileRef:w,#0:w,Total:l),err=err jcs exit ; Ask graphics for a scrap from this file SpaceLong PushWord #5 PushWord #$0500 PushWord #0 PushWord FileRef jsl D_SendMessage sta err PullLong Dest exit return ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/msgswp.aii b/appleworksgs/Scrap/Src/msgswp.aii new file mode 100755 index 0000000..868c3c7 --- /dev/null +++ b/appleworksgs/Scrap/Src/msgswp.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' IMPORT D_AlertBox IMPORT X_BHand IMPORT X_BOffset IMPORT X_BRuler IMPORT D_BeachBall IMPORT X_CantImportStr IMPORT D_CurCursor IMPORT X_CurrentParRecord IMPORT X_DisposeWPScrap IMPORT D_GrowHandle IMPORT D_GrowLHandle IMPORT X_MakeStandardRuler IMPORT X_MassageWPScrap IMPORT D_Message1 IMPORT D_Message2 IMPORT D_MessageThere IMPORT D_NeedHand IMPORT D_NeedHandle IMPORT X_OldCursor IMPORT X_ParBlockSize IMPORT X_RulerSize IMPORT X_ScrStdRuler IMPORT D_SetCursor IMPORT X_ClipData ENTRY X_DoMSGStoWPScrap ;************************************************************************ ; ; X_MSGStoWPScrap ; ;************************************************************************ X_ScMSGStoWPScrap PROC EXPORT ;Using D_OpenData ;Using X_ClipData input Src:l local Sptr:l,Sstart:l,Send:l,Temp:l,Temp2:l output Dest:l error err begin lda #0 sta >D_MessageThere sta >D_Message1 sta >D_Message1+2 sta >D_Message2 sta >D_Message2+2 MoveLong [Src],Sptr MoveLong [Sptr]:#$18,Sstart MoveLong [Sptr]:#$1c,Send SpaceLong PushLong Src PushLong Sstart PushLong Send jsl X_DoMSGStoWPScrap sta err PullLong Dest jcs exit MoveLong [Dest],Temp2 Cmpw [Temp2],#2 bge notnull MoveLong [Temp2]:#2,Temp MoveLong [Temp],Temp2 Cmpw [Temp2]:#2,#13 bge notnull SpaceWord PushWord #OKBox PushLong #X_CantImportStr jsl D_AlertBox pla PushLong Dest jsl X_DisposeWPScrap MoveWord #-1,err brl exit notnull MoveLong [Src],Sptr MoveWord [Sptr]:#$1c,Sstart MoveWord [Sptr]:#$20,Send Cmpw Sstart,Send jeq dofooter Addwl #$20,Sstart SpaceLong PushLong Src PushLong Sstart PushLong Send jsl X_DoMSGStoWPScrap sta err PullLong >D_Message1 bcc noerr PushLong Dest _DisposeHandle lda #0 sta >D_Message1 sta >D_Message1+2 sta >D_MessageThere brl exit noerr MoveWord #1,>D_MessageThere dofooter MoveWord [Sptr]:#$20,Sstart MoveWord [Sptr]:#$24,Send Cmpw Sstart,Send jeq exit Addwl #$20,Sstart SpaceLong PushLong Src PushLong Sstart PushLong Send jsl X_DoMSGStoWPScrap sta err PullLong >D_Message2 bcc noerr2 PushLong Dest _DisposeHandle lda >D_Message1+2 pha lda >D_Message1 pha _DisposeHandle lda #0 sta >D_MessageThere sta >D_Message1 sta >D_Message1+2 sta >D_Message2 sta >D_Message2+2 bra exit noerr2 MoveWord #1,>D_MessageThere exit return ENDP X_DoMSGStoWPScrap PROC EXPORT ;Using X_WPScrapData ;Using X_MSGSOffsets ;Using X_SWScrapEquates ;Using X_ClipData ;Using X_WPFileData ;Using D_CursorData input Src:l,Sstart:l,Send:l local Sptr:l,Soff:l,Ssize:l local Dptr:l,Block:l,Bptr:l,Bsize:w,Dsize:l local Ruler:l,Rptr:l,RulerFlag:w,Bpars:w local Offset:w,CurPar:l,RealDptr:l,Doff:l,CurParSize:w output Dest:l error err begin MoveWord >D_CurCursor,X_OldCursor stz err PushLong Src _HLock MoveLong [Src],Sptr SubLong Send,Sstart,Ssize AddLong Sptr,Sstart,Sptr Cmpl Ssize,#$20 jeq blankdoc SpaceLong _MaxBlock PullLong Dsize SpaceLong PushLong Dsize PushWord #X_Locked jsl D_NeedHandle PullLong Dest MoveLong #2,Doff MoveLong #(X_ParBlockSize+2),Dsize SpaceLong PushLong Dsize PushLong Dest jsl D_GrowLHandle PullLong RealDptr AddLong RealDptr,#2,Dptr lda #0 sta [RealDptr] SpaceLong PushLong #X_RulerSize PushWord #X_Locked jsl D_NeedHandle PullLong Ruler MoveLong [Ruler],Rptr MoveLong Ruler,X_BRuler SpaceLong PushLong #X_Blocksize PushWord #X_Locked jsl D_NeedHandle PullLong Block MoveWord #4,Offset MoveWord #4,X_BOffset MoveLong [Block],Bptr MoveWord #X_Blocksize,[Bptr] MoveWord Offset,[Bptr]:#2 MoveLong Block,X_BHand MoveWord #X_Geneva,>CurHeader lda #0 sta >CurHeader+2 sta >CurHeader+4 shortm sta >CurHeader+6 lda #12 sta >CurHeader+3 longm PushLong #CurHeader lda Bptr clc adc Offset tax lda Bptr+2 adc #0 pha phx PushLong #7 _BlockMove AddLong Offset,#7,Offset PushLong #X_CurrentParRecord PushLong Dptr PushLong #X_ParBlockSize _BlockMove stz Bpars ;Initialize ruler jsl X_MakeStandardRuler jsr SetUpRuler PushLong #X_ScrStdRuler PushLong Rptr PushLong #X_RulerSize _BlockMove AddLong Sptr,#X_MSRulerSize,Sptr MoveLong #X_MSRulerSize,Soff MoveLong Sptr,CurPar MoveWord #0,CurParsize MoveWord #X_Blocksize,Bsize charloop shortm lda [Sptr] cmp #CR+1 jge normal cmp #9 jeq normal cmp #CR jne notcr ldy Offset sta [Bptr],y longm jsl D_BeachBall inc Offset lda Offset cmp Bsize blt noprob lda Bpars cmp #1 bne startagain jsr ResizeBlock bra noprob startagain jsr NewParBlock brl charloop noprob MoveWord Offset,[Bptr]:#2 AddWord Offset,#7,a cmp Bsize jge toosmall PushLong #CurHeader lda Bptr clc adc Offset tax lda Bptr+2 adc #0 pha phx PushLong #7 _BlockMove growdest AddLong Dsize,#X_ParBlockSize,Dsize AddLong Doff,#X_ParBlockSize,Doff SpaceLong PushLong Dsize PushLong Dest jsl D_GrowLHandle PullLong RealDptr AddLong RealDptr,DOff,Dptr MoveWord Offset,X_BOffset PushLong #X_CurrentParRecord PushLong Dptr PushLong #X_ParBlockSize _BlockMove AddWord Offset,#7,Offset lda [RealDptr] inc a sta [RealDptr] lda [Rptr] inc a sta [Rptr] inc Sptr bne x3 inc Sptr+2 x3 inc Soff bne crendofscrap inc Soff+2 crendofscrap Cmpl Soff,Ssize stz CurParSize jge done checkruler shortm lda [Sptr] cmp #X_MSRuler jeq doruler cmp #X_PageBreak jeq X_DoPageBreak longm MoveLong Sptr,CurPar Stz CurParSize inc Bpars brl charloop doruler longm jsr SetUpRuler PushLong Ruler _HUnlock SpaceLong PushLong #X_RulerSize PushWord #X_Locked jsl D_NeedHandle PullLong Ruler MoveLong [Ruler],Rptr PushLong #X_ScrStdRuler PushLong Rptr PushLong #X_RulerSize _BlockMove MoveLong Ruler,X_BRuler MoveLong Ruler,[Dptr]:#X_WPRulerHand AddLong Sptr,#X_MSRulerSize,Sptr AddLong Soff,#X_MSRulerSize,Soff stz CurParSize brl crendofscrap LONGA Off X_DoPageBreak lda #CR ldy Offset sta [Bptr],y longm inc Offset lda Offset cmp Bsize blt noprobpb lda Bpars cmp #1 bne startpb jsr ResizeBlock bra nottoosmall startpb jsr NewParBlock brl charloop noprobpb AddWord Offset,#7,a cmp Bsize jlt nottoosmall jsr GetNewBlock nottoosmall PushLong #CurHeader lda Bptr clc adc Offset tax lda Bptr+2 adc #0 pha phx PushLong #7 _BlockMove longm MoveWord #1,[Dptr]:#X_scpAttr MoveLong #0,[Dptr]:#X_scpRulerHand AddLong Doff,#X_ParBlockSize,Doff AddLong Dsize,#X_ParBlockSize,Dsize SpaceLong PushLong Dsize PushLong Dest jsl D_GrowLHandle PullLong RealDptr AddLong RealDptr,Doff,Dptr lda [RealDptr] inc a sta [RealDptr] MoveWord Offset,X_BOffset PushLong #X_CurrentParRecord PushLong Dptr PushLong #X_ParBlockSize _BlockMove MoveWord Offset,[Bptr]:#2 AddWord Offset,#7,Offset inc Sptr bne x100 inc Sptr+2 x100 inc Soff jne crendofscrap inc Soff+2 stz CurParSize brl crendofscrap toosmall jsr GetNewBlock brl growdest LONGA Off notcr cmp #X_FontRecord jne normal longm ldy #1 lda >CurHeader cmp [Sptr],y beq nonewfont AddWord Offset,#3,a cmp Bsize jlt dofontchange lda Bpars cmp #1 bne fontnewpar jsr ResizeBlock bra dofontchange fontnewpar jsr NewParBlock brl charloop dofontchange shortm lda #X_NewFamily ldy Offset sta [Bptr],y longm inc Offset ldy #1 lda [Sptr],y ldy Offset sta [Bptr],y sta >CurHeader AddWord Offset,#2,Offset nonewfont shortm ldy #X_MSFontFlags ldx #X_FontStyle lda >CurHeader,x cmp [Sptr],y beq nonewstyle longm AddWord Offset,#2,a cmp Bsize jlt dostylechange lda Bpars cmp #1 bne stylenewpar jsr ResizeBlock bra dostylechange stylenewpar jsr NewParBlock brl charloop dostylechange shortm lda #X_FontStyle ldy Offset sta [Bptr],y longm inc Offset shortm ldy #X_MSFontFlags lda [Sptr],y ldy Offset sta [Bptr],y ldx #X_FontStyle sta >CurHeader,x longm inc Offset shortm nonewstyle ldy #X_MSFontSize ldx #X_FontSize lda >CurHeader,x cmp [Sptr],y beq nonewsize longm AddWord Offset,#2,a cmp Bsize jlt dosizechange lda Bpars cmp #1 bne sizenewpar jsr ResizeBlock bra dosizechange sizenewpar jsr NewParBlock brl charloop dosizechange shortm lda #X_FontSize ldy Offset sta [Bptr],y longm inc Offset shortm ldy #X_MSFontSize lda [Sptr],y ldy Offset sta [Bptr],y ldx #X_FontSize sta >CurHeader,x longm inc Offset shortm nonewsize ldy #X_MSFontColor ldx #X_FontColor lda >CurHeader,x cmp [Sptr],y beq nochange longm AddWord Offset,#2,a cmp Bsize jlt docolorchange lda Bpars cmp #1 bne colornewpar jsr ResizeBlock bra docolorchange colornewpar jsr NewParBlock brl charloop docolorchange shortm lda #X_FontColor ldy Offset sta [Bptr],y longm inc Offset shortm ldy #X_MSFontColor lda [Sptr],y ldy Offset sta [Bptr],y ldx #X_FontColor sta >CurHeader,x longm inc Offset nochange longm AddLong Sptr,#X_MSFontRecSize,Sptr AddLong Soff,#X_MSFontRecSize,Soff AddWord CurParSize,#X_MSFontRecSize,CurParSize brl endofscraptest LONGA Off normal ldy Offset sta [Bptr],y longm inc Offset lda Offset cmp Bsize bge overflow cont inc Sptr bne x1 inc Sptr+2 x1 inc Soff bne x2 inc Soff+2 x2 inc CurParSize endofscraptest Cmpl Soff,Ssize jlt charloop brl done overflow lda Bpars bne noresize jsr ResizeBlock brl cont noresize jsr NewParBlock brl charloop done shortm lda #CR ldy Offset sta [Bptr],y longm inc Offset lda Offset sta [Bptr] ldy #2 sta [Bptr],y PushLong Block _Hunlock pea 0 PushWord Offset PushLong Block _SetHandleSize lda [Rptr] inc a sta [Rptr] PushLong Ruler _HUnlock lda [RealDptr] inc a sta [RealDptr] PushLong Dest _HUnlock PushLong Dest jsl X_MassageWPScrap exit PushWord X_OldCursor jsl D_SetCursor return err blankdoc SpaceLong PushLong #X_ParBlockSize+2 jsl D_NeedHand sta err PullLong Dest jcs exit Spacelong PushLong #12 jsl D_NeedHand sta err PullLong Block bcc noblankerr PushLong Dest _DisposeHandle brl exit noblankerr SpaceLong PushLong #X_RulerSize jsl D_NeedHand sta err PullLong Ruler bcc noblankrulererr PushLong Dest _DisposeHandle PushLong Block _DisposeHandle brl exit noblankrulererr MoveLong [Dest],Dptr MoveWord #1,[Dptr] MoveLong Block,[Dptr]:#2 MoveWord #4,[Dptr]:#X_scpOffset+2 MoveWord #0,[Dptr]:#X_scpAttr+2 MoveLong Ruler,[Dptr]:#X_scpRulerHand+2 MoveWord #0,[Dptr]:#X_scpPixels+2 MoveLong #0,[Dptr]:#X_scpLinehand+2 MoveWord #0,[Dptr]:#X_scpLastLine+2 jsr SetUpRuler PushLong #X_ScrStdRuler PushLong Ruler PushLong #X_RulerSize _PtrToHand PushLong #BlankTextBlock PushLong Block PushLong #12 _PtrToHand brl exit BlankTextBlock DC.W 12,12,3 DC.B 0,$c,0,0,0,$d CurHeader DS.B 7 ResizeBlock SpaceLong AddWord Bsize,#X_Blocksize,Bsize pea 0 PushWord Bsize PushLong Block jsl D_GrowLHandle PullLong Bptr MoveWord Bsize,[Bptr] rts NewParBlock jsr GetNewBlock AddWord Offset,#7,Offset PushLong #X_CurrentParRecord PushLong Dptr PushLong #X_ParBlockSize _BlockMove MoveLong CurPar,Sptr sec lda Soff sbc CurParSize sta Soff lda Soff+2 sbc #0 sta Soff+2 stz CurParSize stz Bpars rts GetNewBlock MoveWord [Bptr]:#2,[Bptr] pea 0 PushWord [Bptr] PushLong Block _HUnlock PushLong Block jsl D_GrowHandle MoveWord #X_Blocksize,Bsize SpaceLong PushLong #X_Blocksize PushWord #X_Locked jsl D_NeedHandle PullLong Block MoveLong [Block],Bptr MoveWord Bsize,[Bptr] MoveWord #4,[Bptr]:#2 MoveWord #4,Offset PushLong #Curheader lda Bptr clc adc #4 tax lda Bptr+2 adc #0 pha phx PushLong #7 _BlockMove MoveLong Block,X_BHand MoveWord Offset,X_BOffset rts MarginOffset equ 6 SetUpRuler MoveWord [Sptr]:#X_MSLeftMargin,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#X_scr_or_LeftM MoveWord [Sptr]:#X_MSRightMargin,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#X_scr_or_RightM MoveWord [Sptr]:#X_MSIndent,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#X_scr_or_IndentM MoveWord [Sptr]:#X_MSNumTabs,a and #$ff MoveWord a,X_ScrStdRuler:#X_scr_or_NumTabs MoveWord [Sptr]:#X_MSTab1,a MoveWord a,X_ScrStdRuler:#(X_scr_or_tab1) MoveWord [Sptr]:#X_MSTab2,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#(X_scr_or_tab2) MoveWord [Sptr]:#X_MSTab3,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#(X_scr_or_tab3) MoveWord [Sptr]:#X_MSTab4,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#(X_scr_or_tab4) MoveWord [Sptr]:#X_MSTab5,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#(X_scr_or_tab5) MoveWord [Sptr]:#X_MSTab6,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#(X_scr_or_tab6) MoveWord [Sptr]:#X_MSTab7,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#(X_scr_or_tab7) MoveWord [Sptr]:#X_MSTab8,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#(X_scr_or_tab8) MoveWord [Sptr]:#X_MSTab9,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#(X_scr_or_tab9) MoveWord [Sptr]:#X_MSTab10,a and #$fffe clc adc #MarginOffset MoveWord a,X_ScrStdRuler:#(X_scr_or_tab10) pea 0 ldy #X_MSSpaceFlags lda [Sptr],y and #$ff lsr a bcc notnospace tax lda 1,s ora #X_scr_r_single sta 1,s txa notnospace lsr a bcc notsingle tax lda 1,s ora #X_scr_r_single sta 1,s txa notsingle lsr a bcc notdouble tax lda 1,s ora #X_scr_r_double sta 1,s txa notdouble lsr a bcc nottriple tax lda 1,s ora #X_scr_r_triple sta 1,s txa nottriple lsr a bcc notleft tax lda 1,s ora #X_scr_r_left sta 1,s brl stastyle notleft lsr a bcc notcenter tax lda 1,s ora #X_scr_r_center sta 1,s bra stastyle notcenter lsr a bcc notright tax lda 1,s ora #X_scr_r_right sta 1,s bra stastyle notright lda 1,s ora #X_scr_r_full sta 1,s stastyle pla ldx #X_scr_or_Status sta X_ScrStdRuler,x rts ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/pict.aii b/appleworksgs/Scrap/Src/pict.aii new file mode 100755 index 0000000..4dc7d5d --- /dev/null +++ b/appleworksgs/Scrap/Src/pict.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'scrap.equ' IMPORT D_LoadSegName entry X_GetPLSCRAPAddr ENTRY X_PS_SegName ENTRY PS_TheAddr ;-------------------------------------------------------------------- ; ; Page layout scrap routines go through a jump table at the ; beginning of the static page layout segment (PLSCRAP). ; ; Entries are: ; ; X_CopyPLObj (ScrapHdl:l): CopyHdl:l ; X_KillPLObj (ObjHdl:l) ; X_PL2PictScrap (ObjHdl:l): PictHdl:l ; ;------------------------------------------------------------------------------ ; ; X_CopyPLObj (ScrapHdl:l) : CopyHdl:l ; X_CopyPLObj PROC EXPORT ;Using X_PS_Data INPUT ScrapHdl:l OUTPUT CopyHdl:l ERROR Err LOCAL Where:l BEGIN call X_GetPLSCRAPAddr,out=(Where:l) moveword [Where],slot+1 moveword [Where]:#1,slot+2 spacelong pushlong ScrapHdl slot jsl >0 sta Err pulllong CopyHdl RETURN ENDP ;----------------------------------------------------------------------------- ; ; X_KillPLObj (ObjHdl:l) ; X_KillPLObj PROC EXPORT ;Using X_PS_Data INPUT ObjHdl:l LOCAL Where:l BEGIN call X_GetPLSCRAPAddr,out=(Where:l) moveword [Where]:#4,slot+1 moveword [Where]:#5,slot+2 pushlong ObjHdl pushword #1 slot jsl >0 RETURN ENDP ;------------------------------------------------------------------------------ ; ; X_PL2PictScrap (ObjHdl:l) : PictHdl:l ; ; Converts a D_PL scrap to a picture. ; X_PL2PictScrap PROC EXPORT ;Using X_PS_Data INPUT ObjHdl:l OUTPUT PictHdl:l ERROR Err LOCAL Where:l BEGIN +b call X_GetPLSCRAPAddr,out=(Where:l) moveword [Where]:#8,slot+1 moveword [Where]:#9,slot+2 spacelong pushlong ObjHdl slot jsl >0 sta Err pulllong PictHdl Exit RETURN ENDP ;------------------------------------------------------------------------- ; ; X_GetPLSCRAPAddr () : WHere:l ; ; Getd the address of the PLSCRAP static segment. ; Call the loader the first time; remember it after that. ; X_GetPLSCRAPAddr PROC EXPORT ;Using X_PS_Data OUTPUT Where:l ERROR Err BEGIN stz err cmpl #0,>PS_TheAddr beq getit movelong >PS_TheAddr,Where bra Exit getit call D_LoadSegName,in=(#X_PS_SegName:l),out=(Where:l,a:w),err=Err movelong Where,>PS_TheAddr Exit RETURN ENDP ;----------------------------------------------------------------------------- ; ; X_PS_Data X_PS_Data PROC EXPORT EXPORT PS_TheAddr EXPORT X_PS_SegName PS_TheAddr DC.L 0 X_PS_SegName str 'PLSCRAP' ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/pict2.aii b/appleworksgs/Scrap/Src/pict2.aii new file mode 100755 index 0000000..d48de75 --- /dev/null +++ b/appleworksgs/Scrap/Src/pict2.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' include 'dbsc.equ' IMPORT D_NeedHand import X_ClipData X_ScDBtoPICT PROC EXPORT ;Using X_DBScrapData input Src:l local Sptr:l,Dptr:l,Dsize:l,Offset:l output Dest:l error err begin MoveLong [Src],Sptr lda [Sptr] cmp #X_DBCellType jne notvalid ldy #X_DBRows lda [Sptr],y cmp #1 jne notvalid ldy #X_DBColumns lda [Sptr],y cmp #1 jne notvalid Addwl #X_DBScHeaderSize,Sptr ldy #X_DBFType lda [Sptr],y cmp #X_DBPict jne notvalid MoveLong [Sptr],Offset AddLong Sptr,Offset,Sptr lda [Sptr] jne notvalid Addwl #2,Sptr MoveLong [Sptr],Dsize SpaceLong PushLong Dsize jsl D_NeedHand sta err PullLong Dest jcs exit MoveLong [Src],Sptr Addwl #X_DBScHeaderSize,Sptr AddLong Sptr,Offset,Sptr Addwl #2,Sptr Addwls #4,Sptr PushLong [Dest] PushLong Dsize _BlockMove bra exit notvalid MoveWord #-1,err bra exit exit return ENDP END \ No newline at end of file diff --git a/appleworksgs/Scrap/Src/plscrap.aii b/appleworksgs/Scrap/Src/plscrap.aii new file mode 100755 index 0000000..a430af6 --- /dev/null +++ b/appleworksgs/Scrap/Src/plscrap.aii @@ -0,0 +1 @@ + load 'macros.dump' include 'driver.equ' include 'scrap.equ' include 'dbsc.equ' include 'sssc.equ' IMPORT D_BeachBall IMPORT D_CurCursor IMPORT X_DefHeader IMPORT FieldRecSize IMPORT D_GrowHandle IMPORT D_GrowLHandle IMPORT D_NeedHandle IMPORT X_OldCursor IMPORT D_SetCursor import X_ClipData import X_CurHeader import X_SwitchFont import X_ParBlockSize import D_Deref import D_NeedHand import X_FormatValue import D_Unlock X_ScDBtoPLScrap PROC EXPORT ;Using X_DBScrapData ;Using X_ClipData ;Using X_SWScrapEquates ;Using D_CursorData input Src:l local Sptr:l,Columns:w,Dptr:l,Dsize:l,Doff:l local DataPtr:l,FieldPtr:l,Coldex:w,Cells:l local CurFieldPtr:l,RowHeaderSize:w,StrSize:w local StyleChanged:w,ColorChanged:w,PLSize:l local PLFlag:w,Temp:l output Dest:l error err begin MoveWord >D_CurCursor,X_OldCursor stz err ;Set up default header PushLong #X_DefHeader PushLong #X_CurHeader PushLong #7 _BlockMove SpaceLong _MaXBlock PullLong Dsize SpaceLong PushLong Dsize PushWord #$8000 jsl D_NeedHandle sta err PullLong Dest jcs exit ;Now lock source down PushLong Src _HLock ;Dereference all of the handles and initialize things MoveLong [Src],Sptr MoveLong [Dest],Dptr Stzl Dsize Stzl Doff AddLong Sptr,#X_DBScHeaderSize,FieldPtr AddLong Sptr,[Sptr]:#X_DBDataOffset,DataPtr MoveWord [Sptr]:#X_DBColumns,Columns ;Output the first paragraph header. lda #7 jsr FixDptr PushLong #X_CurHeader PushLong Dptr PushLong #7 _BlockMove Addwl #7,Doff ;If we have field headers only, we want to convert the text. Otherwise, ;we don't. So here we check and branch if we want to do this. lda [Sptr] asl a tax jmp (scraptypetable,x) scraptypetable DC.W fieldheaders,docolumns,dorows,docells,docells docolumns dorows docells ;Figure out how many cells we have cont1 SpaceLong PushWord [Sptr]:#X_DBRows PushWord Columns _Multiply PullLong Cells Cpzl Cells bne notempty AddLong [Dest],#7,Dptr shortm lda #CR sta [DPtr] longm brl done notempty stz Coldex MoveLong FieldPtr,CurFieldPtr ;I don't care about the junk at the beginning of a row. stz StyleChanged stz ColorChanged stz PLFlag ;Now we actually read the data and copy it. This is icky. ; Spin the beach ball. Get the cell status word. If cell is empty leave after bumping pointer past ; the status word. If cell is not empty then branch based on field type to read cell contents. loop jsl D_BeachBall lda [DataPtr] tax addwl #2,DataPtr cpx #X_DBCellEmpty jeq endcell ldy #X_DBFType lda [CurFieldPtr],y asl a tax jmp (TypeTable,x) TypeTable DC.W text,numeric,date,time,picture,pltext2 text ;Do formatting ldy #X_DBFColor lda [CurFieldPtr],y jeq checkstyle xba ora #X_FontColor pha lda #2 jsr FixDptr pla jcs error sta [Dptr] Addwl #2,Doff inc ColorChanged checkstyle ldy #X_DBFStyle lda [CurFieldPtr],y and #%0000000000000111 jeq text2 xba ora #X_FontStyle pha lda #2 jsr FixDptr pla jcs error sta [Dptr] Addwl #2,Doff inc StyleChanged ;Do text text2 lda [DataPtr] and #$ff sta StrSize jsr FixDptr jcs error Addwls #1,DataPtr PushLong Dptr pea 0 PushWord StrSize _BlockMove Addwl StrSize,Doff Addwl StrSize,DataPtr IncLong DataPtr lda ColorChanged beq nocolorchange lda #2 jsr FixDptr jcs error lda #X_FontColor sta [Dptr] Addwl #2,Doff stz ColorChanged nocolorchange lda StyleChanged jeq endcell lda #2 jsr FixDptr jcs error lda #X_FontStyle sta [Dptr] Addwl #2,Doff stz StyleChanged brl endcell numeric Addwl #10,DataPtr brl text date Addwl #4,DataPtr brl text time Addwl #4,DataPtr brl text picture MoveLong [DataPtr],PLSize Addwl #4,DataPtr AddLong DataPtr,PLSize,DataPtr brl endcell pltext2 Cmpl Doff,#7 jne crhere Stzl Dsize Stzl Doff brl getplhandle crhere lda #1 jsr FixDptr jcs error short lda #CR sta [Dptr] long IncLong Doff getplhandle MoveLong [DataPtr],PLSize jsr FixDptr2 jcs error Addwl #4,DataPtr PushLong DataPtr PushLong Dptr PushLong PLSize _BlockMove AddLong Doff,PLSize,Doff AddLong DataPtr,PLSize,DataPtr lda #7 jsr FixDptr jcs error PushLong #X_CurHeader PushLong Dptr PushLong #7 _BlockMove Addwl #7,Doff inc PLFlag endcell inc Coldex lda Coldex cmp Columns jlt notendofrow lda #1 jsr FixDptr jcs error short lda #CR sta [Dptr] long IncLong Doff stz Coldex MoveLong FieldPtr,CurFieldPtr DecLong Cells jne putheader lda Cells+2 jeq done putheader lda #7 jsr FixDptr jcs error PushLong #X_CurHeader PushLong Dptr PushLong #7 _BlockMove Addwl #7,Doff brl loop notendofrow AddLong CurFieldPtr,[CurFieldPtr],Temp MoveLong Temp,CurFieldPtr dodec DecLong Cells lda PLFlag bne clearpl lda #1 jsr FixDptr jcs error short lda #Tab sta [Dptr] long IncLong Doff brl loop clearpl stz PLFlag brl loop fieldheaders stz Coldex AddWord [Sptr]:#X_DBLabels,Columns,Columns lda Columns jeq done headloop MoveWord [FieldPtr]:#X_DBFType,a cmp #9 jlt notlabel lda #(EndLabel-Label) jsr FixDptr jcs error PushLong #Label PushLong Dptr PushLong #EndLabel-Label _BlockMove Addwl #(EndLabel-Label),Doff brl doheadinc Label DC.B '