CTRL check peek (Development MSX Fora)MSX Resource Center PassionMSX MSX2 contest           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 120 gasten en 2 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - CTRL check peek

Schrijver

CTRL check peek

Rikusu

msx professional
Berichten: 948
Geplaatst: 17 April 2004, 20:09   
Does anybody remember which PEEK to use to check whether the computer has been booted with CTRL pressed down or not? Thanks in advance.
manuel
msx guru
Berichten: 3368
Geplaatst: 17 April 2004, 20:35   
You can't check that with a PEEK.
Most of the time you need CTRL because you need the extra memory. In basic, just use the FREE(0) function to see if it's enough. If not, someone must have forgotten to press CTRL.
You *can* check with a PEEK how many drives are connected. If it's only 1, CTRL was pressed. However, when using harddisks, this won't work! You'll get 5 drives instead of 6 (using 4 partitions) and not 1... That's why I don't recommend this method. (Had to change lots of loaders for this...)
msd
msx professional
Berichten: 607
Geplaatst: 17 April 2004, 21:15   
Does anybody know how you can check if the "B" drive is virtual or real?
BiFi
msx guru
Berichten: 3142
Geplaatst: 17 April 2004, 21:36   
yep, hook a routine on the 3-byte hook on $F42F. If it's called when you switch drives to display the 'set disk for drive' text, it's a virtual drive.
Rikusu

msx professional
Berichten: 948
Geplaatst: 17 April 2004, 21:53   
Then what was the PEEK to check how many drives are available? The FREE(0) method doesn't seem to be very trustworthy either, since the amount of memory in BASIC differs per system type as well, or am I mistaken? Is there in every BASIC version an equal amount of memory available?
flyguille
msx master
Berichten: 1182
Geplaatst: 17 April 2004, 22:06   
if you need know if the "B" is availabe, just do the next:

10 on error goto 100
20 FILES"B:"
30 REM the b: is available
40 ....

100 RESUME 110
110 REM the b: isn't available

but, that generate a list... you can list a unavailable file like FILE "xxxxx.xxx" with weird chrs ... so, on ERROR handle routine, you can check if the error is a "file not found" or a "disk offline" or "bad unit name".


BiFi
msx guru
Berichten: 3142
Geplaatst: 17 April 2004, 22:07   
Without any other interfaces you can check whether the CTRL-key is pressed by peeking $FB21. If it's 1 (1 drive) CTRL was pressed during boot, 2 (2 drives) say it didn't. This only works when there's only the floppy drive connected. Any more interfaces move this up to $FB23, $FB25 or $FB27, depending on the number of interfaces. Pretty tricky things since there's no universal way of detecting that.
Rikusu

msx professional
Berichten: 948
Geplaatst: 17 April 2004, 22:20   
Thanks, that was wat I was looking for
msd
msx professional
Berichten: 607
Geplaatst: 17 April 2004, 22:46   
Quote:

yep, hook a routine on the 3-byte hook on $F42F. If it's called when you switch drives to display the 'set disk for drive' text, it's a virtual drive.



I want to know it before I access a drive
manuel
msx guru
Berichten: 3368
Geplaatst: 17 April 2004, 23:08   
Quote:

Thanks, that was wat I was looking for



OK, but please don't use it to detect whether CTRL was pressed...

I used to check if FREE(0) was > 24000. This worked in my cases.
You're right, the amount of RAM depends on the system, but not too much. For 64kB systems with diskdrive, 24000 will be sufficient, I think.
BiFi
msx guru
Berichten: 3142
Geplaatst: 17 April 2004, 23:26   
Quote:

I want to know it before I access a drive

Well, access it before @ init time. You might want to set the $F323 pointer as well though, to capture any disk errors in case there's a physical drive. Otherwise access the FDC directly, which is highly dependant on the FDC the machine uses. Alex Wulms should be able to help you with that, including detection. He did that with the format tool which uses the fastcopy 3 FDC drivers.
 
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.