15 August 2022, 22:43 | #1 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Recognising a disk change in DOS?
Hi all,
I have a multi-disk game I'm developing and I'm trying to build a disk swap prompt, the way I've went about doing this is to revive the system when a disk change is needed and prompt the user that the file required is on another floppy disk, the user then needs to change the disk and press the fire button. My routine for checking a specific disk is in the drive is to simply check the presence of a file using DOS->Open(), disk 1 contains a file like "diskid.1", disk 2 "diskid.2". If the file is missing then it re-prompts the user, if not it exits the routine and loads the files from the disk it needs. I'm finding when the disk swap changes my program isn't regonising the change, it's almost like a refresh of the file structure needs to take place but as I put the next disk in I here it whirl and eventually stop so I know the system is doing "something" with it. It feels like I'm missing a step here to get Open to recognise the new disk file table that's been inserted but I don't know what. Happy to post code if needed, but can anyone shed any light please? Geezer |
15 August 2022, 23:01 | #2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
I would try something with input.device.
IECLASS_DISKREMOVED The disk has been removed IECLASS_DISKINSERTED The disk has been inserted |
15 August 2022, 23:05 | #3 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
|
16 August 2022, 09:56 | #4 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
It sounds strange that the OS doesn't properly detect the disk was changed, when it actually does detect insertion of a floppy. Do you perhaps have a file/lock open on the previous disk or something?
As far as I understand the events mentioned by Ross, they inform your application, not the OS, so I don't think they will help with your issue. Last edited by hooverphonique; 16 August 2022 at 10:21. |
16 August 2022, 12:43 | #5 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
I tried using "RUN" to start my executable as well in the thought that the game executable could be being locked but that has had no effect so I'm unsure what's going on. I can only assume I have a lock somewhere, but unsure of an easy way to lookup a lock list. EDIT - I recall using a util from back in the day called SnooDOS, I might try and bust that out to help. Last edited by mcgeezer; 16 August 2022 at 12:55. |
|
16 August 2022, 13:12 | #6 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
I like this one: http://aminet.net/util/moni/ARTM2_04.lha
|
16 August 2022, 13:20 | #7 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
hmm, how do you open the 'diskid'?
With something like "DISKNAMEn:diskid"? That the system looks for in the 'current directory' first and for that it asks you the disk of the executable? |
16 August 2022, 13:27 | #8 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
A look in SnoopDOS revealed there was a Lock created on the executable which I couldn't remember doing. I then had a look at some of the Workbench boot code and sure enough calles to Lock(). Bypassing this makes things work but I'm unsure how necessary the code is to make it work from Workbench. I didn't write this code, I think it came from one of the Devpac disks on how to launch executables correctly from Workbench. Code:
WORKBENCH_BOOT MACRO ThisTask equ $114 pr_CLI equ $ac pr_MsgPort equ $5c sm_ArgList equ $24 cli_CommandName equ $10 movea.l ExecBase,a6 lea DOSNAME,a1 jsr _LVOOldOpenLibrary(a6) movea.l d0,a5 ; dosbase movea.l ThisTask(a6),a3 move.l pr_CLI(a3),d3 ; d3 = CLI or WB (NULL) bne.s _from_cli _from_wb: ; Get startup message if we started from Workbench lea pr_MsgPort(a3),a0 jsr _LVOWaitPort(a6) ; wait for a message lea pr_MsgPort(a3),a0 jsr _LVOGetMsg(a6) ; then get it movea.l d0,a3 ; a3 = WBStartup message movea.l sm_ArgList(a3),a0 move.l (a0),d5 ; (wa_Lock) FileLock on program dir exg a5,a6 ; _dos bsr.s _common ; Reply to the startup message jsr _LVOForbid(a6) ; it prohibits WB to unloadseg me lea (a3),a1 jmp _LVOReplyMsg(a6) ; reply to WB message and exit _from_cli: ; Get FileLock via command name if we started from CLI link a3,#-256 ; Copy BCPL string to C-style string lea (sp),a1 lsl.l #2,d3 movea.l d3,a0 move.l cli_CommandName(a0),a0 adda.l a0,a0 adda.l a0,a0 move.b (a0)+,d0 .c: move.b (a0)+,(a1)+ subq.b #1,d0 bne.b .c clr.b (a1) ; Get a lock on the program and its parent exg a5,a6 ; _dos move.l sp,d1 ; d1 = STRPTR name (command string) moveq #SHARED_LOCK,d2 ; d2 = accessMode jsr _LVOLock(a6) move.l d0,d7 move.l d0,d1 jsr _LVOParentDir(a6) move.l d7,d1 move.l d0,d3 ; d3 = Lock on CLI program dir move.l d0,d5 ; d5 = common Lock jsr _LVOUnLock(a6) unlk a3 _common: move.l d5,d1 jsr _LVOCurrentDir(a6) ; CD to the program dir move.l d0,d4 ; d4 = initial launch directory lea infodata(pc),a0 lea id_UnitNumber(a0),a2 move.l d5,d1 move.l a0,d2 jsr _LVOInfo(a6) tst.l d0 beq.b _rts move.l (a2),d0 ; d0 = current floppy device for the main exe movem.l d3/d4/a3/a5/a6,-(sp) bsr START movem.l (sp)+,d3/d4/a3/a5/a6 move.l d3,d1 ; UnLock program dir or zero (from WB) jsr _LVOUnLock(a6) move.l d4,d1 ; CD to the initial directory jsr _LVOCurrentDir(a6) lea (a6),a1 lea (a5),a6 jsr _LVOCloseLibrary(a6) moveq #0,d0 _rts: rts cnop 0,4 infodata: ds.l 12 ENDM |
|
16 August 2022, 14:21 | #9 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
gah!
If I'm not wrong this is code I wrote... But when I wrote it the purpose was exactly the opposite, that is to go back to the directory of the executable and then load the files from its dir (that is, making sure that it works the same way even if started from other positions) |
16 August 2022, 14:31 | #10 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Code:
but I'm unsure how necessary the code is to make it work from Workbench Something like: Code:
ThisTask equ $114 pr_CLI equ $ac pr_MsgPort equ $5c movea.l ExecBase,a6 movea.l ThisTask(a6),a5 tst.l pr_CLI(a5) ; CLI or WB (==NULL)? bne.s _common ; jump if from CLI _from_wb: ; Get startup message if we started from Workbench lea pr_MsgPort(a5),a0 jsr _LVOWaitPort(a6) ; wait for a message lea pr_MsgPort(a5),a0 jsr _LVOGetMsg(a6) ; then get it movea.l d0,a5 ; a5 = WBStartup message bsr.s _common ; Reply to the startup message jsr _LVOForbid(a6) ; it prohibits WB to unloadseg me lea (a5),a1 jmp _LVOReplyMsg(a6) ; reply to WB message and exit _common: movem.l a5/a6,-(sp) bsr START movem.l (sp)+,a5/a6 moveq #0,d0 _rts: rts Last edited by ross; 16 August 2022 at 15:13. |
16 August 2022, 19:02 | #11 | |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Quote:
It works a treat Ross, top man. I've dropped you a PM for a special request. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
MS DOS disk games? | utri007 | Retrogaming General Discussion | 48 | 04 March 2022 21:16 |
Not a DOS disk? | B14ck W01f | support.WinUAE | 4 | 14 October 2020 13:22 |
Change keymap on DOS application | fstarred | support.Apps | 15 | 09 May 2018 14:55 |
Disk shows as DOS[A] on WB? | Pioneer500 | support.Hardware | 7 | 26 April 2013 20:10 |
PCMCIA fault: DOS error code 225 - Not a valid DOS disk | 4am | support.Hardware | 2 | 07 April 2012 10:20 |
|
|