CTRL check peek (Development Foros MSX)MSX Resource Center MSXdev 2008 - MSX1 development bonanza!           
                       
English Nederlands Español Português Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 123 invitados y 0 miembros en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - CTRL check peek

Autor

CTRL check peek

Rikusu

msx professional
Mensajes: 954
Publicado: Abril 17 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
Mensajes: 3446
Publicado: Abril 17 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
Mensajes: 612
Publicado: Abril 17 2004, 21:15   
Does anybody know how you can check if the "B" drive is virtual or real?
BiFi
msx guru
Mensajes: 3142
Publicado: Abril 17 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
Mensajes: 954
Publicado: Abril 17 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
Mensajes: 1197
Publicado: Abril 17 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
Mensajes: 3142
Publicado: Abril 17 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
Mensajes: 954
Publicado: Abril 17 2004, 22:20   
Thanks, that was wat I was looking for
msd
msx professional
Mensajes: 612
Publicado: Abril 17 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
Mensajes: 3446
Publicado: Abril 17 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
Mensajes: 3142
Publicado: Abril 17 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 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation