Change to purely block-oriented protocol

This commit is contained in:
Elliot Nunn 2021-02-11 12:24:04 +08:00
parent f0fe0c6f58
commit f3fbb86c64
2 changed files with 14 additions and 9 deletions

View File

@ -279,15 +279,15 @@ while 1:
# break # wait for another request, you mofo!
elif boot_type == 128:
boot_seq, boot_blkoffset, boot_bytelen, boot_imgname = struct.unpack_from('>HLL32p', data)
boot_seq, boot_blkoffset, boot_blkcnt, boot_imgname = struct.unpack_from('>HLL32p', data)
boot_imgname = boot_imgname.decode('mac_roman')
for ofs in range(0, boot_bytelen, 512):
thisblk = image2dict[boot_imgname][boot_blkoffset*512+ofs:boot_blkoffset*512+ofs+512]
for blk in range(boot_blkoffset, boot_blkoffset + boot_blkcnt):
thisblk = image2dict[boot_imgname][blk*512:blk*512+512]
sock.sendto(mk_ddp(
dest_node=llap_src_node, dest_socket=ddp_src_socket,
src_node=99, src_socket=99,
proto_type=10,
data=struct.pack('>BBHL', 129, 1, boot_seq, ofs) + thisblk
data=struct.pack('>BBHL', 129, 1, boot_seq, blk-boot_blkoffset) + thisblk
),
(MCAST_ADDR, MCAST_PORT))

View File

@ -266,8 +266,8 @@ gTheirPB dc.l 0 ; pointer to the pending ParamBlk
gQuery
gQTypeVer dc.w 0 ; part of gQuery
gQSeqNum dc.w 0 ; part of gQuery
gQOffset dc.l 0 ; part of gQuery
gQLen dc.l 0 ; part of gQuery
gQOffset dc.l 0 ; part of gQuery: block offset
gQLen dc.l 0 ; part of gQuery: block count
gQFilename dcb.b 32 ; part of gQuery ; set by the init code
gQueryEnd
gWDS dcb.b 2+4+2+4+2
@ -352,8 +352,10 @@ DrvrTransmitRequest ; On entry, A0=pb. Trashes A0-A4/D0 so be careful. Uses our
add.l $2E(A0),D0 ; + ioPosOffset (in blocks)
move.l D0,gQOffset-g(A2) ; -> "offset" field of request
move.l $24(A0),D0 ; ioReqCount (in bytes)
sub.l $28(A0),D0 ; - ioActCount (in bytes)
move.l $24(A0),D0 ; [ioReqCount (in bytes)
sub.l $28(A0),D0 ; - ioActCount (in bytes)]
lsr.l #4,D0
lsr.l #5,D0 ; / 512
move.l D0,gQLen-g(A2) ; -> "length" field of request
lea gAddr,A3
@ -429,7 +431,10 @@ DrvrSockListener ; works closely with the Prime routine
lea gTheirPB,A5
move.l (A5),A5
move.l $28(A5),D2 ; keep this in D2 because we will use it in a sec
cmp.l -4(A3),D2 ; ioActCount = this offset?
move.l -4(A3),D3
lsl.l #4,D3
lsl.l #5,D3
cmp.l D3,D2 ; ioActCount = this offset?
bne.s .outoforder
move.l $20(A5),A3 ; ioBuffer