Normalise ServerDA code a bit

This commit is contained in:
Elliot Nunn 2021-03-29 14:24:27 +08:00
parent f01f467218
commit 6cd42fbc5f

View File

@ -20,20 +20,20 @@ kWinH equ 72
**************************** DESK ACCESSORY ENTRY **************************
DAEntry ; See Device Manager IM:2
DC.B $04 ; dCtlEnable only
DC.B 0 ; Lower byte is unused
DC.W 5*60 ; 5 sec periodic update
DC.W $42 ; mouseDown updateEvt
DC.W 0 ; No menu for this accessory
dc.b $04 ; dCtlEnable only
dc.b 0 ; Lower byte is unused
dc.w 5*60 ; 5 sec periodic update
dc.w $42 ; mouseDown updateEvt
dc.w 0 ; No menu for this accessory
DC.W DAOpen-DAEntry ; Open routine
DC.W DADone-DAEntry ; Prime - unused
DC.W DACtl-DAEntry ; Control
DC.W DADone-DAEntry ; Status - unused
DC.W DAClose-DAEntry ; Close
dc.w DAOpen-DAEntry ; Open routine
dc.w DADone-DAEntry ; Prime - unused
dc.w DACtl-DAEntry ; Control
dc.w DADone-DAEntry ; Status - unused
dc.w DAClose-DAEntry ; Close
DATitle
DC.B 15, 'NetBoot Server', 0 ; DA Name (& Window Title)
dc.b 15, 'NetBoot Server', 0 ; DA Name (& Window Title)
dc.b 0, 0, $20, 1 ; traditional version
gBackendRefnum
@ -48,8 +48,8 @@ HackQueueHeader
************************ DESK ACCESSORY OPEN ROUTINE ***********************
DAOpen
MOVEM.L A1-A4,-(SP) ; preserve A1-A4
MOVE.L A1,A4 ; MOVE DCE pointer to a reg
movem.l A1-A4,-(SP) ; preserve A1-A4
move.l A1,A4 ; MOVE DCE pointer to a reg
; Install the backend driver (anywhere in the unit table)
move.w $18(A1),D0 ; dCtlRefNum, so we need A0 to be intact
@ -69,29 +69,29 @@ DAOpen
lea HackQueueHeader,A1
move.l A1,(A0)
SUBQ.L #4,SP ; FUNCTION = GrafPtr
MOVE.L SP,-(SP) ; push a pointer to it
DC.W $A874 ; _GetPort ; push it on top of stack
TST.L $1E(A4) ; DCtlEntry.dCtlWindow do we have a window?
BNE StdReturn ; If so, return, Else
subq.l #4,SP ; FUNCTION = GrafPtr
move.l SP,-(SP) ; push a pointer to it
dc.w $A874 ; _GetPort ; push it on top of stack
tst.l $1E(A4) ; DCtlEntry.dCtlWindow do we have a window?
bne StdReturn ; If so, return, Else
******************************* NEW WINDOW ROUTINE *************************
MOVE.L #156,D0 ; WindowRecord size
DC.W $A11E ; _NewPtr ; allocate space for record
SUBQ #4,SP ; FUNCTION = WindowRef
MOVE.L A0,-(SP) ; address of storage
PEA theWindow ; boundsRect
PEA DATitle ; title
CLR.W -(SP) ; visible flag FALSE
MOVE.W #16,-(SP) ; window proc = rDocProc, 16px rounding
MOVE.L #-1,-(SP) ; window in front
MOVE.B #1,-(SP) ; goAway box TRUE
MOVE.l #-1,-(SP) ; refCon = -1 (special)
DC.W $A913 ; __NewWindow
MOVE.L (SP)+,A0
MOVE.L A0,$1E(A4) ; DCtlEntry.DCtlWindow save windowPtr
MOVE.W $18(A4),$6C(A0) ; DCtlEntry.DCtlRefNum system window
move.l #156,D0 ; WindowRecord size
dc.w $A11E ; _NewPtr ; allocate space for record
subq #4,SP ; FUNCTION = WindowRef
move.l A0,-(SP) ; address of storage
pea theWindow ; boundsRect
pea DATitle ; title
clr.w -(SP) ; visible flag FALSE
move.w #16,-(SP) ; window proc = rDocProc, 16px rounding
move.l #-1,-(SP) ; window in front
move.b #1,-(SP) ; goAway box TRUE
move.l #-1,-(SP) ; refCon = -1 (special)
dc.w $A913 ; __NewWindow
move.l (SP)+,A0
move.l A0,$1E(A4) ; DCtlEntry.DCtlWindow save windowPtr
move.w $18(A4),$6C(A0) ; DCtlEntry.DCtlRefNum system window
subq #4,SP ; Space for _NewControl results
move.l A0,D3
@ -166,82 +166,82 @@ DAOpen
StdReturn
DC.W $A873 ; __SetPort ; old port on stack
MOVEM.L (SP)+,A1-A4 ; restore regs
dc.w $A873 ; __SetPort ; old port on stack
movem.l (SP)+,A1-A4 ; restore regs
************************ DESK ACCESSORY DONE ROUTINE ***********************
DADone
MOVEQ #0,D0 ; return no error
RTS ; all done, exit
moveq #0,D0 ; return no error
rts ; all done, exit
************************ DESK ACCESSORY CLOSE ROUTINE **********************
DAClose
MOVEM.L A1-A4,-(SP) ; preserve A1-A4
MOVE.L A1,A4 ; MOVE DCE ptr to A4
movem.l A1-A4,-(SP) ; preserve A1-A4
move.l A1,A4 ; MOVE DCE ptr to A4
SUBQ.L #4,SP ; FUNCTION = GrafPtr
MOVE.L SP,-(SP) ; push a pointer to it
DC.W $A874 ; __GetPort ; get it, now it's on TOS
subq.l #4,SP ; FUNCTION = GrafPtr
move.l SP,-(SP) ; push a pointer to it
dc.w $A874 ; __GetPort ; get it, now it's on TOS
MOVE.L $1E(A4),-(SP) ; DCtlEntry.DCtlWindow push the window
DC.W $A914 ; __DisposeWindow ; dispose of the window
move.l $1E(A4),-(SP) ; DCtlEntry.DCtlWindow push the window
dc.w $A914 ; __DisposeWindow ; dispose of the window
CLR.L 2(A3) ; DCtlEntry.DCtlWindow mark DCE properly
BRA.S StdReturn ; all done with close, exit
clr.l 2(A3) ; DCtlEntry.DCtlWindow mark DCE properly
bra.s StdReturn ; all done with close, exit
********************** DESK ACCESSORY CONTROL ROUTINE **********************
DACtl
MOVE.L A4,-(SP) ; preserve reg
MOVE.L A1,A4 ; move DCE ptr to A4
MOVE.W $1A(A0),D0 ; get the control opCode
SUB.W #64,D0 ; = 64? (event)
BEQ.S DoCtlEvent
move.l A4,-(SP) ; preserve reg
move.l A1,A4 ; move DCE ptr to A4
move.w $1A(A0),D0 ; get the control opCode
sub.w #64,D0 ; = 64? (event)
beq.s DoCtlEvent
CtlDone
MOVE.L A4,A1 ; put DCE ptr back in A1
MOVE.L (SP)+,A4 ; restore reg
MOVEQ #0,D0 ; return no error
MOVE.L $8FC,-(SP) ; jump to IODone
RTS
move.l A4,A1 ; put DCE ptr back in A1
move.l (SP)+,A4 ; restore reg
moveq #0,D0 ; return no error
move.l $8FC,-(SP) ; jump to IODone
rts
************************** EVENT HANDLING ROUTINE **************************
DoCtlEvent
MOVE.L A3,-(SP) ; save reg
MOVE.L $1C(A0),A3 ; CntrlParam.CSParam = event pointer
MOVE.W 0(A3),D0 ; EventRecord.what
CMP.W #1,D0
BEQ.S CtlEvtMouse
SUBQ #6,D0 ; updateEvt is it an update?
BNE.S CtlEvtDone ; If not, exit
move.l A3,-(SP) ; save reg
move.l $1C(A0),A3 ; CntrlParam.CSParam = event pointer
move.w 0(A3),D0 ; EventRecord.what
cmp.w #1,D0
beq.s CtlEvtMouse
subq #6,D0 ; updateEvt is it an update?
bne.s CtlEvtDone ; If not, exit
MOVE.L 2(A3),-(SP) ; EventRecord.message push windowPtr
DC.W $A922 ; __BeginUpdate ; begin the update operation
move.l 2(A3),-(SP) ; EventRecord.message push windowPtr
dc.w $A922 ; __BeginUpdate ; begin the update operation
MOVE.L 2(A3),-(SP) ; EventRecord.message push windowPtr again
DC.W $A873 ; __SetPort
BSR DrawWindow ; draw our items
move.l 2(A3),-(SP) ; EventRecord.message push windowPtr again
dc.w $A873 ; __SetPort
bsr DrawWindow ; draw our items
MOVE.L 2(A3),-(SP) ; EventRecord.message one more time
DC.W $A923 ; __EndUpdate ; end of update
move.l 2(A3),-(SP) ; EventRecord.message one more time
dc.w $A923 ; __EndUpdate ; end of update
CtlEvtDone
MOVE.L (SP)+,A3 ; restore reg
BRA.S CtlDone ; exit
move.l (SP)+,A3 ; restore reg
bra.s CtlDone ; exit
CtlEvtMouse
subq #4,SP ; Save the GrafPort (good manners)
move.l SP,-(SP)
dc.w $A874 ; _GetPort to the stack space we made
move.l $1E(A4),-(SP) ; dCtlWindow
DC.W $A873 ; _SetPort
dc.w $A873 ; _SetPort
move.l 10(A3),-(SP); Get D4 as the point in our coords
move.l SP,-(SP)
@ -301,9 +301,9 @@ CtlEvtMouse
jsr (A0)
.noControlClicked
DC.W $A873 ; _SetPort to restore the GrafPort
dc.w $A873 ; _SetPort to restore the GrafPort
BRA CtlEvtDone
bra CtlEvtDone
****************************** FONT METRICS *******************************
@ -320,7 +320,7 @@ DrawWindow
bsr DrawFakeGrowBox
Exit
RTS
rts
***************************** SUBROUTINES ****************************