1 line
21 KiB
ArmAsm
1 line
21 KiB
ArmAsm
|
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
; <20><><EFBFBD> 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]:
|