View Single Post
Old 11 June 2017, 18:57   #30
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,516
Late reply, sorry..

Warning: very ugly example.. First half is only needed to get the filesystem message port.

Code:

	move.l 4.w,a6
	move.l a6,a5
	lea doslib(pc),a1
	moveq #0,d0
	jsr -$228(a6) ;OpenLibrary
	move.l d0,a6
	
	moveq #0,d4
	lea filename(pc),a0
	move.l a0,d1
	moveq #-2,d2
	jsr -$54(a6) ;Lock
	tst.l d0
	beq.s nofile
	move.l d0,d1
	lsl.l #2,d0
	move.l d0,a0
	move.l 12(a0),d4 ;filesystem msgport
	jsr -$5a(a6) ;UnLock
nofile
	move.l a6,a1
	move.l a5,a6
	jsr -$19e(a6) ;CloseLibrary

	tst.l d4
	beq.w end

	sub.l a1,a1
	jsr -$126(a6) ;FindTask
	move.l d0,a2
	add.w #92,a2 ;pr_MsgPort

	lea message(pc),a3
	lea dospacket(pc),a4
	
	move.l a3,(a4) ;dp_link = message
	move.l a4,10(a3) ;message->mn_Node.ln_Name = dospacket
	move.l a2,4(a4) ;dp_Port = pr_MsgPort
	move.l a2,14(a3) ;mn_ReplyPort = pr_MsgPort
	move.l #27,8(a4) ;dp_Type = ACTION_FLUSH

	move.l a3,a1
	move.l d4,a0
	; dospacket -> filesystem msgport
	jsr -$16e(a6) ;PutMsg
	; wait for reply
	move.l a2,a0
	jsr -$180(a6) ;WaitPort
	move.l a2,a0
	jsr -$174(a6) ;GetMsg

end	
	rts

filename
	dc.b "sys:",0
doslib
	dc.b "dos.library",0


	cnop 0,4
	; struct StandardPacket
message
	dcb.b 20,0
dospacket
	dcb.b 48,0
EDIT: msgport = dos/DeviceProc("dh0:") is quicker way to get filesystem port.

Last edited by Toni Wilen; 11 June 2017 at 22:15.
Toni Wilen is online now  
 
Page generated in 0.04289 seconds with 11 queries