From 71d90cf249cc28477ff1910e25fd789e817fa947 Mon Sep 17 00:00:00 2001 From: Elliot Nunn Date: Sun, 2 May 2021 18:08:44 +0800 Subject: [PATCH] Done some junk, ATP not working --- Client.a | 104 +++++++++++++++++++++++++++++++++++++-------------- Makefile | 8 ++-- ServerDA.a | 29 +++++++------- ServerDRVR.a | 80 +++++++++++++++++++++++++++++++++------ Structs.a | 12 ++++++ 5 files changed, 177 insertions(+), 56 deletions(-) create mode 100644 Structs.a diff --git a/Client.a b/Client.a index 809e7c3..956e37c 100644 --- a/Client.a +++ b/Client.a @@ -1,7 +1,4 @@ - move.w #$abab,D0 - dc.w $A9C9 - - + include 'Structs.a' ; fe* constants kUserRecLen equ 568 kInitialWaitMsec equ 10000 @@ -31,16 +28,10 @@ ResumeAfterCopy ; Salvage some possibly useful information from ATBOOT, while it is still running: ; Server address + lea gServer,A1 move.l 8(SP),A0 ; global pointer - move.l 24(A0),D0 ; AddrBlock - lea gSaveAddr,A0 - move.b #10,15(A0) ; hardcode DDP protocol ID - move.b D0,13(A0) ; socket - lsr.w #4,D0 - lsr.w #4,D0 - move.b D0,11(A0) ; node - swap D0 - move.w D0,7(A0) ; network + move.l 24(A0),(A1) ; AddrBlock + addq.b #1,(A1) ; increment the socket number by 1 ; User record lea gUserRec,A1 @@ -103,6 +94,37 @@ GoHereFromReadTrap move.w #-51,D0 ; ioRefNum ; also delete .ATBOOT for neatness dc.w $A03E ; _DrvrRemove + ; Open .ATP + lea -$32(SP),SP + move.l SP,A0 + bsr DrvrClearBlock + pea ATPName + move.l (SP)+,$12(A0) ; ioNamePtr + dc.w $A000 ; _Open + lea $32(SP),SP + + ; ask about every image, draw them on the screen + + + lea ATPName,A0 + move.w #4,D0 + lea $0,A1 + move.l #100,D1 + move.l #'Elmo',D2 + bsr AskQuestion + + move.w #$E111,D0 + dc.w $A9C9 + + + + + + + + + + ; A3 = our driver in sysheap (plus user record) move.l #DrvrEnd-DrvrBase+kUserRecLen,D0 dc.w $A51E ; NewPtrSys @@ -144,25 +166,50 @@ GoHereFromReadTrap move.l $16(A4),D0 dc.w $A04E ; _AddDrive (A0=DQE, D0=drvnum/drefnum) - ; Open .MPP (still open?) & our DDP socket - lea -$32(SP),SP - move.l SP,A0 - bsr DrvrClearBlock - pea MPPName - move.l (SP)+,$12(A0) ; ioNamePtr - dc.w $A000 ; _Open - move.w #248,$1A(A0) ; csCode = openSkt - move.b #10,$1C(A0) ; socket = 10, same as ATBOOT uses - pea DrvrSockListener-DrvrBase(A3) - move.l (SP)+,$1E(A0) ; listener - dc.w $A004 ; _Control - lea $32(SP),SP - ; Re-execute the _Read trap in ROM movem.l (SP)+,A0-A6/D0-D7 rts -MPPName dc.b 4, '.MPP', 0 +ATPName dc.b 4, '.ATP', 0 + +AskQuestion ; A0=txbuf/D0=txlen/A1=rxbuf/D1=rxlen/D2=userdata -> D0=rxlen +.pb equ -$34 +.bds equ .pb-12 +.size equ .pb + + movem.l D3-D7/A2-A4,-(SP) + link A6,#.size + + move.l A6,A4 + moveq #(-.size)/2-1,D4 +.clrloop clr.w -(A4) + dbra D4,.clrloop + + move.l A0,A4 ; request buffer address + lea .bds(A6),A3 ; Buffer Descriptor Structure + move.w D1,(A3) ; populate it with buffer addr/maxlen + move.l A1,2(A3) + + lea .pb(A6),A0 + move.l D2,$12(A0) + move.w #-11,$18(A0) ; ioRefNum = .ATP + move.w #255,$1A(A0) ; csCode = sendRequest + move.l gServer,$1E(A0) ; addrBlock + move.b gUserRec,$1E+3(A0) ; addrBlock socket (EBP) + move.w D0,$22(A0) ; reqLength + move.l A4,$24(A0) ; reqPointer + move.l A3,$28(A0) ; bdsPointer + move.l #$010400FF,$2C(A0) + ; numOfBuffs/timeoutVal/numOfResps/retryCount + + dc.w $A004 ; _Control + bne.s .returnError + move.w 6(A3),D0 +.returnError + + unlk A6 + movem.l (SP)+,D0-D7/A0-A4 + rts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -188,6 +235,7 @@ gQuery dcb.b 20 ; really need to consider the length of this gWDS dcb.b 2+4+2+4+2+4+2 ; room for an address and two data chunks gMyPB dcb.b $32+2 ; allow us to clear it with move.l's odd +gServer dc.l 0 gSaveAddr dcb.b 16 gAddr dcb.b 16 even diff --git a/Makefile b/Makefile index e299d4f..3b5bb9c 100644 --- a/Makefile +++ b/Makefile @@ -103,10 +103,10 @@ ServerDA ServerDA.idump ServerDA.rdump: ServerDA.bin ServerDRVR.bin rfx cp ServerDRVR.bin ServerDA.rdump//DRVR/-16000 testda: FORCE ServerDA ServerDA.idump ServerDA.rdump BootstrapFloppy.dsk - rm -rf /tmp/testda; mkdir -p /tmp/testda/Desktop\ Folder; cp ServerDA ServerDA.idump ServerDA.rdump /tmp/testda/Desktop\ Folder/ - MakeHFS -s 400k -n TestDA -d now -i /tmp/testda /tmp/testda.dsk - rsync Big.dsk /tmp/Big.dsk - ./twovmacs.bash "BootstrapFloppy.dsk" "/tmp/Big.dsk /tmp/testda.dsk" + rm -rf /tmp/testda; mkdir -p /tmp/testda/System\ Folder/Startup\ Items; DumpHFS Big.dsk /tmp/testda; cp ServerDA ServerDA.idump ServerDA.rdump /tmp/testda/System\ Folder/Startup\ Items/ + rfx rm /tmp/testda/System\ Folder/System//lmgr/0 + MakeHFS -s 20m -n TestDA -d now -i /tmp/testda /tmp/testda.dsk + ./twovmacs.bash "BootstrapFloppy.dsk" "/tmp/testda.dsk" diff --git a/ServerDA.a b/ServerDA.a index 7ccec8a..8446545 100644 --- a/ServerDA.a +++ b/ServerDA.a @@ -4,9 +4,12 @@ **** *************************************************************************** + include 'Structs.a' ; fe* constants + ; My global variables in a dCtlStorage handle ; The first $9C bytes are occupied by a window rec (of which grafPort is part) + rsReset rs.b $9C ; grafPort and windowRecord gPB rs.l 1 ; keep PB&DCE together; both are pointers gDCE rs.l 1 @@ -19,15 +22,6 @@ gDiskBtn rs.l 1 gList rs.l 1 gSize rs.b 0 -; "File entry" list (stored as a handle in dCtlStorage) -feQLink equ 0 ; long -feQType equ 4 ; word -feRefNum equ 6 ; word -feConnCnt equ 8 ; byte -fePermssn equ 9 ; byte -feListRow equ 10 ; word rowNum within List -feFileName equ 12 ; variable length pascal string - ; Initial window size kWinW equ 219 kWinH equ 72 @@ -553,6 +547,7 @@ OpenBtn dc.w $A71E ; _NewPtrSysClear move.l A0,D0 beq.s .cancelOpen + move.w #feCurVers,feVers(A0) move.w 24(SP),feRefNum(A0) ; IORefNum...feRefNum move.b 17(SP),fePermssn(A0) ; IOPermssn...fePermssn moveq.l #1,D0 @@ -563,10 +558,6 @@ OpenBtn lea -feFileName(A1),A0 ; hack to get our register back move.l A0,A2 - ; And append it to the interrupt-time-accessible queue - move.l gBackendQHdr,A1 - dc.w $A96F ; _Enqueue - ; Append the entry to the list subq #2,SP move.w #1,-(SP) ; one row @@ -587,6 +578,18 @@ OpenBtn move.w #88,-(SP) dc.w $A9E7 ; _LSetCell + ; Glue together a unique ID from Ticks and whatever else + move.l $16A,D0 + swap D0 + move.w feListRow(A2),D1 + eor.w D1,D0 + move.l D0,feUnique(A2) + + ; Lastly append it to the interrupt-time-accessible queue + move.l A2,A0 + move.l gBackendQHdr,A1 + dc.w $A96F ; _Enqueue + .cancelOpen unlk A6 rts diff --git a/ServerDRVR.a b/ServerDRVR.a index 69c4f05..70fe0a6 100644 --- a/ServerDRVR.a +++ b/ServerDRVR.a @@ -1,6 +1,8 @@ ; I implement a "BootServer" on the AppleTalk network ; The Server Desk Accessory installs me in the system heap and opens me + include 'Structs.a' ; fe* constants + ServerHeader dc.w $4000 ; dNeedLock dc.w 0 ; delay @@ -47,6 +49,12 @@ gABPAddress ; Address of the Apple Boot Protocol client: dcb.b 1 ; backup of high byte of dest network ; (MUST copy byte 16 to 7 for every use) +gABPImageReply ; reply to rbImageRequest packet + dc.b 4 ; rbImageData + dc.b 1 ; protocol version (always 1) + dc.w 0 ; imageID (we always use 0) + dc.w 0 ; increment block number here (offset 4) + gABPUserReply ; reply to rbMapUser packet dc.b 2 ; rbUserReply dc.b 1 ; protocol version (always 1) @@ -56,13 +64,12 @@ gABPUserReply ; reply to rbMapUser packet dc.w 0 ; imageID (we always use 0) dc.w 0 ; error code dc.l (BlobEnd-Blob)/ATBOOT_BLK_SIZE ; block count - ; we could put an arbitrary 568b "user record" here + ; arbitrary <=568b "user record" begins at offset 18 here +gEBPSocket + dc.b $55 ; EBP socket number + even -gABPImageReply ; reply to rbImageRequest packet - dc.b 4 ; rbImageData - dc.b 1 ; protocol version (always 1) - dc.w 0 ; imageID (we always use 0) - dc.w 0 ; increment block number here (offset 4) +gEBPPB dcb.b $34 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -114,16 +121,24 @@ TryOpenMPP .returnYes sub #$32,SP - lea .MPP,A0 - move.l A0,$12(SP) ; IOFileName - clr.b $1B(SP) ; IOPermssn move.l SP,A0 + lea .MPP,A1 + move.l A1,$12(A0) ; IOFileName = .MPP + clr.b $1B(A0) ; IOPermssn dc.w $A000 ; _Open tst.w $10(A0) ; IOResult: check it + bne.s .failOpen + lea .ATP,A1 + move.l A1,$12(A0) ; IOFileName = .ATP + clr.b $1B(A0) ; IOPermssn + dc.w $A000 ; _Open + tst.w $10(A0) ; IOResult: check it +.failOpen add #$32,SP rts .MPP dc.b 4, '.MPP', 0 +.ATP dc.b 4, '.ATP', 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -132,7 +147,7 @@ RegisterForTransitions rts ; register for the LAP Manager queue if possible ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Listen - sub #$32,SP ; OPEN DDP SOCKET + sub #$32,SP ; OPEN DDP SOCKET (Apple Boot Protocol) move.w #-10,$18(SP) ; ioRefNum = MPP move.w #248,$1A(SP) ; csCode = openSkt clr.b $1C(SP) ; socket = auto-assign @@ -144,6 +159,45 @@ Listen move.b $1C(SP),(A0) ; save socket number there add #$32,SP + lea gEBPPB,A0 ; OPEN ATP SOCKET (Elliot Boot Protocol) + move.w #-11,$18(A0) ; ioRefNum = ATP + move.w #254,$1A(A0) ; csCode = openATPSkt + clr.b $1C(A0) ; atpSocket = any + clr.l $1E(A0) ; addrBlock = any + dc.w $A004 ; _Control + lea gEBPSocket,A1 + move.b $1C(A0),(A1) + + + + + + ; Some nasty debug code to work on... + + move.b $1C(A0),D7 ; get atpSocket + + move.w #$34-1,D0 +.clrlp clr.b (A0,D0) + dbra D0,.clrlp + + move.w #-11,$18(A0) ; ioRefNum = ATP + move.b D7,$1C(A0) ; atpsocket + + + + + + + ; NB: refnum, atpSocket already set + move.w #253,$1A(A0) ; csCode = getRequest + pea EBPHandler + move.l (SP)+,$C(A0) ; ioCompletion + clr.w $22(A0) ; reqLength = 0 + clr.l $24(A0) ; reqPointer = none + move.w #20,$22(A0) ; reqLength = 20 + move.l $2AE,$24(A0) ; reqPointer = ROMBase + dc.w $A404 ; _Control ,async + sub #$32,SP ; ADVERTISE NBP SERVICE move.w #-10,$18(SP) ; ioRefNum = MPP move.w #253,$1A(SP) ; csCode = registerName @@ -232,7 +286,7 @@ SocketListener ; Socket listener registers documented in IM clr.w -(A1) lea gABPUserReply,A0 move.l A0,-(A1) - move.w #18,-(A1) + move.w #18+1,-(A1) lea gABPAddress,A0 move.l A0,-(A1) clr.w -(A1) @@ -313,6 +367,10 @@ AllDoneCompletionRoutine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +EBPHandler dc.w $A9FF + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + Blob incbin 'Client.bin.summed' ; built from Client.a BlobEnd diff --git a/Structs.a b/Structs.a new file mode 100644 index 0000000..f77bf78 --- /dev/null +++ b/Structs.a @@ -0,0 +1,12 @@ +; Disk image elements, in a queue +feCurVers equ 1 + rsReset +feQLink rs.l 1 ; OS queue element +feQType rs.w 1 +feVers rs.w 1 ; version this structure because it is publicly accessible +feRefNum rs.w 1 ; refnum of open file +feConnCnt rs.b 1 ; counter of connected computers +fePermssn rs.b 1 ; r/rw? +feListRow rs.w 1 ; rowNum within GUI List +feUnique rs.l 1 ; globally unique ID for this image on this server +feFileName rs.b 0 ; variable length pascal string