mac-rom/ProcessMgr/PuppetString.MacDraw.a
Elliot Nunn 4325cdcc78 Bring in CubeE sources
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
2017-12-26 09:52:23 +08:00

338 lines
9.6 KiB
Plaintext

;
; File: PuppetString.MacDraw.a
;
; Contains: Puppet string conversion table custumized for MacDraw
;
; Written by: Phil Goldman
;
; Copyright: © 1986-1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <0> x/xx/86 PYG New Today.
;
;--------------------------------------------------------------------
;--------------------------------------------------------------------
;
; This table is used to convert puppet instructions to event sequences specifically
; for MacDraw. MacDraw is identified as having a creator equal to 'MDRW'. The basic
; instructions are handled by the default table defined in PuppetString.Default.a
;
;--------------------------------------------------------------------
PRINT OFF
LOAD 'ProcessMgrIncludes.D'
INCLUDE 'PuppetStringDefs.a'
PRINT ON
FUNC
BLANKS ON
STRING ASIS
LayoutMenuID EQU 6
GridOnOffItem EQU 9
ExtraMenuID EQU 14
ExtraGridOffItem EQU 13
TableTop
NumberOfEntries DC.B (EntriesBottom-EntriesTop)/6,0
EntriesTop
ResetEntry DC.W pstEventCode
DC.L RstEvtCode-TableTop
CutEntry DC.W pstMenuItem
DC.W 3,3
CopyEntry DC.W pstMenuItem
DC.W 3,4
PasteEntry DC.W pstMenuItem
DC.W 3,5
SelectRectEntry DC.W pstEventList
DC.L SREvtList-TableTop
SelectAllEntry DC.W pstMenuItem
DC.W 3,9
MemCopyEntry DC.W pstIllegalInstr
DC.L 0
OutlineRectEntry DC.W pstEventCode
DC.L OREvtCode-TableTop
GridOnOffEntry DC.W pstMenuItem
DC.W LayoutMenuID,GridOnOffItem
EntriesBottom
RstEvtList
;RstEvtParamCount DC.W 0
RstEvtListOffset DC.L 6
RstEvtListCount DC.W (RstEvtListBottom-RstEvt1)/evtBlkSize
RstEvt1
RstEvt1what DC.W mButDwnEvt+evtMouseLocal+evtIsImportant
RstEvt1message DC.L 0
RstEvt1when DC.L 0
RstEvt1where DC.W 5,5
RstEvt1modifiers DC.W 0
RstEvt2
RstEvt2what DC.W mButUpEvt+evtMouseLocal+evtIsUnimportant
RstEvt2message DC.L 0
RstEvt2when DC.L 0
RstEvt2where DC.W 5,5
RstEvt2modifiers DC.W $80
RstEvt3
RstEvt3what DC.W app4Evt
RstEvt3message DC.B ((GridOnOffEntry-EntriesTop)/6)+2,0,0,0
RstEvt3when DC.L 0
RstEvt3where DC.W 0,0
RstEvt3modifiers DC.W $80
RstEvtListBottom
RstEvtCode
SUBQ #4,SP ;make room for result
MOVE.W #LayoutMenuID,-(SP) ;push menu id
_GetMHandle
TST.L (SP) ;could we find it (might be DA menubar)
BNE.S RstEvtCodeFoundLayout ;if so, branch
MOVE.L (SP)+,A0 ;get rid of 0 on stack and clear A0
BRA.S RstEvtCodeDone ;return w/ an error
RstEvtCodeFoundLayout
MOVE.W #GridOnOffItem,-(SP) ;push item num
PEA LayoutItemString ;push address of string in Layout menu
_GetItem
SUBQ #4,SP ;make room for result
MOVE.L #'MENU',-(SP)
MOVE.W #ExtraMenuID,-(SP) ;push menu id
_GetResource
MOVE.W #ExtraGridOffItem,-(SP) ;push item num
PEA ExtraItemString ;push address of string in Layout menu
_GetItem
MOVEQ.L #0,D0 ;clear out d0
LEA LayoutItemString,A0
MOVE.B (A0)+,D0 ;d0.w <- length of LayoutItemString
SWAP D0
LEA ExtraItemString,A1
MOVE.B (A1)+,D0 ;d0.w <- length of LayoutItemString
_CmpString
LEA RstEvt3what,A0 ;get data to be set in A0
BEQ.S RstEvtCodeAreEqual ;branch if strings were equal
MOVE.W #nullEvt,(A0) ;don't do menu selection
BRA.S RstEvtCodeMakeHdl
RstEvtCodeAreEqual
MOVE.W #app4Evt,(A0) ;do menu selection
RstEvtCodeMakeHdl
LEA RstEvtList,A0 ;get top of list
MOVE.L #RstEvtListBottom-RstEvtList,D0 ;get size of list
_PtrToHand
BEQ.S RstEvtCodeDone ;if no error, branch
SUB.L A0,A0 ;clear out a0
RstEvtCodeDone
MOVE.L (SP)+,A1 ;get return address
ADDQ.W #4,SP ;get rid of parameter
MOVE.L A0,(SP) ;handle is return value
JMP (A1)
LayoutItemString DC.L 0,0,0,0,0,0
ExtraItemString DC.L 0,0,0,0,0,0
SREvtList
SRParamCount DC.W (SREvtListOffset-SRParams)/6
SRParams
SRParam1 DC.L SRParam1LocStart-TableTop
DC.W SRParam1LocEnd-SRParam1LocStart
SRParam2 DC.L SRParam2LocStart-TableTop
DC.W SRParam2LocEnd-SRParam2LocStart
SREvtListOffset DC.L 6
SREvtListCount DC.W (SREvtListBottom-SREvt1)/evtBlkSize
SREvt1
SREvt1what DC.W mButDwnEvt+evtMouseLocal+evtIsImportant
SREvt1message DC.L 0
SREvt1when DC.L 0
SREvt1where DC.W 5,5
SREvt1modifiers DC.W 0
SREvt2
SREvt2what DC.W mButUpEvt+evtMouseLocal+evtIsUnimportant
SREvt2message DC.L 0
SREvt2when DC.L 0
SREvt2where DC.W 5,5
SREvt2modifiers DC.W $80
SREvt3
SREvt3what DC.W mButDwnEvt+evtMouseEither+evtIsImportant
SREvt3message DC.L 0
SREvt3when DC.L 0
SRParam1LocStart
SREvt3where DC.W 0,0
SRParam1LocEnd
SREvt3modifiers DC.W 0
SREvt4
SREvt4what DC.W mButUpEvt+evtMouseEither+evtIsUnimportant
SREvt4message DC.L 0
SREvt4when DC.L 0
SRParam2LocStart
SREvt4where DC.W 0,0
SRParam2LocEnd
SREvt4modifiers DC.W $80
SREvtListBottom
OREvtList
OREvtListOffset DC.L 6
OREvtListCount DC.W (OREvtListBottom-OREvt11)/evtBlkSize
OREvt11
OREvt11what DC.W mButDwnEvt+evtMouseLocal+evtIsImportant
OREvt11message DC.L 0
OREvt11when DC.L 0
OREvt11where DC.W 42,10
OREvt11modifiers DC.W 0
OREvt12
OREvt12what DC.W mButUpEvt+evtMouseLocal+evtIsUnimportant
OREvt12message DC.L 0
OREvt12when DC.L 0
OREvt12where DC.W 42,10
OREvt12modifiers DC.W $80
OREvt13
OREvt13what DC.W mButDwnEvt+evtMouseEither+evtIsImportant
OREvt13message DC.L 0
OREvt13when DC.L 0
ORParam11LocStart
OREvt13where DC.W 0,0
ORParam11LocEnd
OREvt13modifiers DC.W 0
OREvt14
OREvt14what DC.W mButUpEvt+evtMouseEither+evtIsUnimportant
OREvt14message DC.L 0
OREvt14when DC.L 0
ORParam12LocStart
OREvt14where DC.W 0,0
ORParam12LocEnd
OREvt14modifiers DC.W $80
OREvt21
OREvt21what DC.W mButDwnEvt+evtMouseLocal+evtIsImportant
OREvt21message DC.L 0
OREvt21when DC.L 0
OREvt21where DC.W 42,10
OREvt21modifiers DC.W 0
OREvt22
OREvt22what DC.W mButUpEvt+evtMouseLocal+evtIsUnimportant
OREvt22message DC.L 0
OREvt22when DC.L 0
OREvt22where DC.W 42,10
OREvt22modifiers DC.W $80
OREvt23
OREvt23what DC.W mButDwnEvt+evtMouseEither+evtIsImportant
OREvt23message DC.L 0
OREvt23when DC.L 0
ORParam21LocStart
OREvt23where DC.W 0,0
ORParam21LocEnd
OREvt23modifiers DC.W 0
OREvt24
OREvt24what DC.W mButUpEvt+evtMouseEither+evtIsUnimportant
OREvt24message DC.L 0
OREvt24when DC.L 0
ORParam22LocStart
OREvt24where DC.W 0,0
ORParam22LocEnd
OREvt24modifiers DC.W $80
OREvt31
OREvt31what DC.W mButDwnEvt+evtMouseLocal+evtIsImportant
OREvt31message DC.L 0
OREvt31when DC.L 0
OREvt31where DC.W 42,10
OREvt31modifiers DC.W 0
OREvt32
OREvt32what DC.W mButUpEvt+evtMouseLocal+evtIsUnimportant
OREvt32message DC.L 0
OREvt32when DC.L 0
OREvt32where DC.W 42,10
OREvt32modifiers DC.W $80
OREvt33
OREvt33what DC.W mButDwnEvt+evtMouseEither+evtIsImportant
OREvt33message DC.L 0
OREvt33when DC.L 0
ORParam31LocStart
OREvt33where DC.W 0,0
ORParam31LocEnd
OREvt33modifiers DC.W 0
OREvt34
OREvt34what DC.W mButUpEvt+evtMouseEither+evtIsUnimportant
OREvt34message DC.L 0
OREvt34when DC.L 0
ORParam32LocStart
OREvt34where DC.W 0,0
ORParam32LocEnd
OREvt34modifiers DC.W $80
OREvt41
OREvt41what DC.W mButDwnEvt+evtMouseLocal+evtIsImportant
OREvt41message DC.L 0
OREvt41when DC.L 0
OREvt41where DC.W 42,10
OREvt41modifiers DC.W 0
OREvt42
OREvt42what DC.W mButUpEvt+evtMouseLocal+evtIsUnimportant
OREvt42message DC.L 0
OREvt42when DC.L 0
OREvt42where DC.W 42,10
OREvt42modifiers DC.W $80
OREvt43
OREvt43what DC.W mButDwnEvt+evtMouseEither+evtIsImportant
OREvt43message DC.L 0
OREvt43when DC.L 0
ORParam41LocStart
OREvt43where DC.W 0,0
ORParam41LocEnd
OREvt43modifiers DC.W 0
OREvt44
OREvt44what DC.W mButUpEvt+evtMouseEither+evtIsUnimportant
OREvt44message DC.L 0
OREvt44when DC.L 0
ORParam42LocStart
OREvt44where DC.W 0,0
ORParam42LocEnd
OREvt44modifiers DC.W $80
OREvtListBottom
OREvtCodeErr
CLR.L 8(SP) ;return 0
MOVE.L (SP)+,(SP) ;trash the param
RTS
OREvtCode
LEA OREvtList,A0 ;addr of list
MOVE.L #OREvtListBottom-OREvtList,D0 ;size of list
_PtrToHand ;get copy
BNE.S OREvtCodeErr ;if error, branch
MOVE.L (SP)+,D0 ;get ret addr
MOVE.L (SP)+,A1 ;get evt record
MOVE.L A0,(SP) ;handle is retrun value
MOVE.L D0,-(SP) ;put back ret addr
; Here comes a whole lotta parameter stuffing... It may look stupid to AND
; the message field with a constant, rather than the lomem LO3BYTES, and it is.
; The reason is that the pstEventList puppet event message field is defined to
; hold a pointer in the low three bytes. Ergo, this is not a stripaddress
; operation, it is a field extraction operation.
MOVE.L (A0),A0 ;hdl->ptr of evt list
MOVE.L evtMessage(A1),D0 ;get pointer to param block
ANDI.L #$0FFFFFF,D0 ;mask it to size
MOVEA.L D0,A1 ;stick it in address reg
; Do param subst for ulh of rect
MOVE.W (A1),ORParam11LocStart-OREvtList(A0)
MOVE.W (A1),ORParam12LocStart-OREvtList(A0)
MOVE.W (A1),ORParam21LocStart-OREvtList(A0)
MOVE.W (A1)+,ORParam42LocStart-OREvtList(A0)
MOVE.W (A1),ORParam11LocStart-OREvtList+2(A0)
MOVE.W (A1),ORParam32LocStart-OREvtList+2(A0)
MOVE.W (A1),ORParam41LocStart-OREvtList+2(A0)
MOVE.W (A1)+,ORParam42LocStart-OREvtList+2(A0)
; Do param subst for lrh of rect
MOVE.W (A1),ORParam22LocStart-OREvtList(A0)
MOVE.W (A1),ORParam31LocStart-OREvtList(A0)
MOVE.W (A1),ORParam32LocStart-OREvtList(A0)
MOVE.W (A1)+,ORParam41LocStart-OREvtList(A0)
MOVE.W (A1),ORParam12LocStart-OREvtList+2(A0)
MOVE.W (A1),ORParam21LocStart-OREvtList+2(A0)
MOVE.W (A1),ORParam22LocStart-OREvtList+2(A0)
MOVE.W (A1),ORParam31LocStart-OREvtList+2(A0)
RTS
END