English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 22 January 2022, 01:37   #1
earok
Registered User
 
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
Best way of detecting game is running on floppy?

This is what I've got currently, which kind of works, but only on Kickstart 2.0 upwards and assumes that a drive with 1760 blocks or less must be a disk (so may not work as expected on an unexpectedly tiny hard drive or an unexpectedly large floppy)

Is there a better way of doing this for any Kickstart?

Code:
NEWTYPE InfoData
id_NumSoftErrors.l;	/* number of soft errors on disk */
id_UnitNumber.l;	/* Which unit disk is (was) mounted on */
id_DiskState.l;		/* See defines below */
id_NumBlocks.l;		/* Number of blocks on disk */
id_NumBlocksUsed.l;	/* Number of block in use */
id_BytesPerBlock.l;
id_DiskType.l;		/* Disk Type code */
id_VolumeNode.l;	/* BCPL pointer to volume node */
id_InUse.l;		/* Flag, zero if not in use */
END NEWTYPE

DEFTYPE .InfoData DiskInfoData

if ExecVersion < 36
  ;Just assume a floppy is being used in A500 or older
 IsFloppy = true
else
  ;Test that storage is 1760 blocks or less, ergo likely to be floppy
  if Info_(GetProgramDir_(),&DiskInfoData)
	if DiskInfoData\id_NumBlocks <= 1760
		IsFloppy = true
	endif
  endif
endif
earok is offline  
Old 22 January 2022, 09:55   #2
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
flashback does that dos.Info call to know if animations should be loaded (hard disk) or not (floppy, would take a lot of time to load).

Instead, I opted for a file called "floppy" in the same dir. People who install my games on hard drive will forget to copy that file And whdload mode ignores it too.

Last edited by jotd; 23 January 2022 at 00:33.
jotd is offline  
Old 22 January 2022, 13:12   #3
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
What is your reason for detecting a floppy disk?
The 1760 blocks assumption will certainly fail for a ramdrive.device disk (
RAD:
) of the same size or for a High Density floppy disk.

Maybe it's possible to find the exec device behind a DOS device node, which should be trackdisk.device for you?
phx is offline  
Old 22 January 2022, 14:01   #4
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
I know it might be a bit crude as a method, but I would just do a custom bootblock that somehow signals to the main executable that I started from floppy (AddPort() is fine too).
If I don't have the flag then, even if I'm actually on floppy (like someone tampered my bootblok) then I run generic code that uses the filesystem for files.

An alternative is to use trackdisk.device (or the trackloader) to search for a tag in some sector.

This however is outside of natural Blitz Basic stuff, sorry
ross is offline  
Old 22 January 2022, 16:41   #5
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
I would do a variation on that but set a longsword at address $0 when booted from floppy, done and easy.
Galahad/FLT is offline  
Old 23 January 2022, 00:09   #6
earok
Registered User
 
Join Date: Dec 2013
Location: Auckland
Posts: 3,539
Reason for wanting to detect floppy is to delay exiting OS-friendly mode long enough for all floppy drive operations to be fully stopped etc (prevent disk sounds and disk light from being active during gameplay).

Totally agreed that it's not an ideal approach given that other things could have a similar amount of space to a floppy, also was hoping to find a Kickstart 1.3 friendly approach.


I'll use the "floppy file" approach, cheers.
earok is offline  
Old 23 January 2022, 00:34   #7
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,160
Amigajay reported that my games locked up the cdtv machine. Probably because of a similiar reason: the cdtv sends a spurious interrupt because of the CD drive hardware.

A solution is to turn off cdtv.device, and turn it on again before exiting. I have yet to implement that. whdload does that, and JST does that too.
jotd is offline  
Old 23 January 2022, 02:11   #8
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
Quote:
Originally Posted by jotd View Post
Amigajay reported that my games locked up the cdtv machine. Probably because of a similiar reason: the cdtv sends a spurious interrupt because of the CD drive hardware.

A solution is to turn off cdtv.device, and turn it on again before exiting. I have yet to implement that. whdload does that, and JST does that too.
Or use the delay program I wrote for Earok for the same problem on A1200/CD32 where the a file system close doesn't come fast enough in a multitasking environment before its shut down.

Used on Capital Punishment and some others which it fixed.
Galahad/FLT is offline  
Old 10 March 2022, 14:32   #9
aNdy/AL/COS
Registered User
 
aNdy/AL/COS's Avatar
 
Join Date: Jan 2022
Location: Wales
Posts: 91
Can someone please explain this 'floppy file' approach please?

While my game is loading up from floppy, it shows a loading screen and plays some music. However, it's also runnable from HD and as the assets load quicker, you get a few seconds of music before it cuts off. Not good presentation wise!

I'd like to detect a floppy load so it will play music, or a HD load so not to bother.

Basically, with some crude pseudo-code:

IF FLOPPYLOAD = TRUE
load and play loading music
ELSE
don't bother with loading music
ENDIF

I know I could do an Exec check and assume anything 1.3 and below will be floppy anyway, but it'd be nice to check for 2.04 and above in case.

Thanks!

Last edited by aNdy/AL/COS; 10 March 2022 at 14:40.
aNdy/AL/COS is offline  
Old 10 March 2022, 18:57   #10
Cobe
Registered User
 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 41
Posts: 999
What about using amigados.

If df0:your.exe exists floppy=true
Else
Floppy=false
Cobe is offline  
Old 10 March 2022, 19:02   #11
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
Quote:
Originally Posted by aNdy/AL/COS View Post
Can someone please explain this 'floppy file' approach please?

While my game is loading up from floppy, it shows a loading screen and plays some music. However, it's also runnable from HD and as the assets load quicker, you get a few seconds of music before it cuts off. Not good presentation wise!

I'd like to detect a floppy load so it will play music, or a HD load so not to bother.

Basically, with some crude pseudo-code:

IF FLOPPYLOAD = TRUE
load and play loading music
ELSE
don't bother with loading music
ENDIF

I know I could do an Exec check and assume anything 1.3 and below will be floppy anyway, but it'd be nice to check for 2.04 and above in case.

Thanks!
If you're using AmigaDOS, best way would be to provide your own Installer solution or use the existing Commodore one and have a file on the disk called "floppy" which isn't copied when installing, check for presence of that file, adjust accordingly.
Galahad/FLT is offline  
Old 10 March 2022, 19:44   #12
aNdy/AL/COS
Registered User
 
aNdy/AL/COS's Avatar
 
Join Date: Jan 2022
Location: Wales
Posts: 91
@Galahad/FLT: Ah! 'Floppy' file understood, a nice clean method! Many thanks for the explanation!

Quote:
Originally Posted by Cobe View Post
What about using amigados.
If df0:your.exe exists floppy=true
Else
Floppy=false
I've just implemented this and it's a decent workaround! Thanks for the suggestion!

Last edited by aNdy/AL/COS; 10 March 2022 at 21:50.
aNdy/AL/COS is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you insert a floppy image while emulation is running? ral-clan support.FS-UAE 3 14 November 2021 21:39
Running a game from WB1.3 installed from a floppy KKR75 support.Games 15 11 October 2019 06:33
A1200 : Floppy Drive not detecting disks burf2000 support.Hardware 1 01 September 2015 01:23
Amiga os 4.1 running on cd32 with floppy drive installed. fondpondforever Amiga scene 7 25 June 2013 21:52
Running floppy games on a CD32 Shatterhand Amiga scene 11 24 October 2007 06:33

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:31.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11992 seconds with 15 queries