antoine-source/appleworksgs/SS/Src/Misc2.aii

1 line
12 KiB
Plaintext
Raw Normal View History

2023-03-04 02:45:20 +00:00
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 Mov