MSX-DOS Page 0 swap without disabling interrupts (Development Foros MSX)MSX Resource Center            
                       
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 55 invitados y 5 miembros en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - MSX-DOS Page 0 swap without disabling interrupts

Ir a la página ( 1 | 2 Siguiente página )
Autor

MSX-DOS Page 0 swap without disabling interrupts

MicroTech
msx lover
Mensajes: 122
Publicado: Abril 18 2007, 08:53   
I was wondering if a "trick" like this could work but, before trying, I wish to ask if anybody has already tried out

Under MSXDOS 2, but should work also on DOS 1:
- allocate a segment (let's say S4)
- copy the first 256 bytes of page 0 to the first 256 bytes of S4
- put S4 in page 0
- run a routine (residing completely in page 1) who writes data to page 0 (S4) not writing the first 256 bytes and WITHOUT disabling interrupts
- restore original page 0 segment

Can I use this tecnique "safely"?
Thanks
MicroTech

jltursan
msx professional
Mensajes: 887
Publicado: Abril 18 2007, 10:34   
I assume that you're redefining the interrupt vector on $38 to point to your own ISR...
IIRC the ISR is not in the first 256 bytes of page 0; so if you don't disable interrupts and don't change the ISR vector and it still points to its original address, when a new interrupt raises it will jump inside of your data.
About disabling the interrupts, it's always safer to do it because you're never sure when it will raise one. If you keep enabled the ints, sooner or later a hangup will occur (if you do this operation frequently).
MicroTech
msx lover
Mensajes: 122
Publicado: Abril 18 2007, 11:27   
Hi jitursan!
I'm not going to catch interrupts.
On the contrary copying (and maintaining unaltered) the first 256 bytes of page 0 on the first 256 bytes in S4, I want interrupts to continue to work even if the original segment in page 0 (tipically segment #3) is no more in his default position.
When an interrupt happens, cpu should restart at 0x38 and here find the copy of the original jump to handler (afaik in page 3).


jltursan
msx professional
Mensajes: 887
Publicado: Abril 18 2007, 14:45   
Quote:

When an interrupt happens, cpu should restart at 0x38 and here find the copy of the original jump to handler (afaik in page 3).



...but I'm fairly sure that it finally executes code located on page 0; so if the original $0100-$3FFF code is not present it will crashes for sure.
¿Why not create a dummy ISR entry modifying the $38 vector just to catch the IM1 interrupt?, ¿or maybe switch to IM2 (defining a new ISR outside page 0) to avoid calling address $38?

Edit: I've just check what exactly happens when $38 is called and as usual it jumps to an address contained in page 0, $0C3C (KEYINT). So, if you only preserve the first $100 bytes, when the interrupt happens it will try to execute your code at this address. If you put an EI/RET here you'll mask the interrupt inside your own page 0.
MicroTech
msx lover
Mensajes: 122
Publicado: Abril 18 2007, 15:38   
Well, maybe I didn't explain myself very well: I want to use this trick in DOS mode.
About BASIC mode you are right: the trick does not work.

About using IM2: that's a very powerful possibility, even thinking to move the jump table in page 3... but I read somewhere that not all MSX machines are designed to pull-up buses so reading from a "ghost" device (when z80 gets the interrupt "specific" code) it is not sure you will get all '1's.
I think IM2 should work on 99% of running machines.

jltursan
msx professional
Mensajes: 887
Publicado: Abril 18 2007, 18:16   
You've explain yourself well, it's me that I've forgotten that you're talking about DOS. In DOS I've no idea of where's pointing the vector at $38. If you're able to provide the ISR, there's no problem about that I guess.
About IM2, the only problem that I know about reading the bus is that you can't predict the value read as it will be a "random" one. So usually to make work a IM2 mode you need to set up a fake vector table with 257 identical values. This way the jump address will be ever the same.
msd
msx professional
Mensajes: 618
Publicado: Abril 18 2007, 19:44   
Maybe check if any values are modified between address 0 to 0xff by the bios. If not I see no reason why your 'trick' wouldn't work. I've tought of doing this myself too once. Never did tho.
NYYRIKKI
msx master
Mensajes: 1528
Publicado: Abril 18 2007, 22:41   
I can't see any reason why this should not work. Actually I'm sure it should work.

The default interrupt routine as well as other DOS support routines are in page 3. How ever I've newer used this "trick"... sometimes I've copyed the data and changed page 3 and even changed the page Z80 is executing, but for some reason I've newer needed to change page 0 with interrupts...

MicroTech
msx lover
Mensajes: 122
Publicado: Octubre 04 2007, 15:57   
It works
nikodr
msx addict
Mensajes: 491
Publicado: Octubre 04 2007, 19:25   
If you want bios on page 0 i think im2 would help.

As i am new and i am slowly trying to learn machine code,i want to ask the following why is it that msx does not have NMI (non maskable interrupts)?

Wouldn't it have some practical use to help the user in case the machine has non recoverable hardware errors?

Would it make it easier for msx users to have nmi ,along with a debuging interface to check for errors like corruption in system memory area or data corruption detected on system and peripherial buses?

[D-Tail]

msx guru
Mensajes: 3020
Publicado: Octubre 04 2007, 22:49   
In MSX, NMI is unconnected. You could hardwire the pin to a switch or something, so that you can actually perform the NMI, but you should probably write your own NMI handling routine.
nikodr
msx addict
Mensajes: 491
Publicado: Octubre 04 2007, 23:34   
That means that someone could create a test cartridge that with the help of nmi interupts could test the machine for the errors i mentioned?

Wouldn't that be very cool?to have a cartridge that could assist in case of non recoverable hardware errors?

it would be the no 1 rom for people that want to fix faulty msx computers!Anyone interested to make one ?
ro
msx guru
Mensajes: 2347
Publicado: Octubre 05 2007, 07:57   
in DOS it should work indeed. Only first 256 bytes are vital. The ISR on #38 usually has a jump to hi-mem location (page 3) and from there it'll do a far-call into a ROM page. The same goes for nON-DOS (basic and stuff) now I think of it....

Alex
msx lover
Mensajes: 100
Publicado: Octubre 05 2007, 22:23   
Quote:

That means that someone could create a test cartridge that with the help of nmi interupts could test the machine for the errors i mentioned?

Wouldn't that be very cool?to have a cartridge that could assist in case of non recoverable hardware errors?

it would be the no 1 rom for people that want to fix faulty msx computers!Anyone interested to make one ?


The NMI signal of the Z80 is not connected to the cartridge port. In fact it is not connected to any bus at all. So having the cartridge alone is not sufficient. You must open the MSX and solder a switch to the NMI-pin of the Z80. Otherwise you don't have the necessary hardware to trigger the NMI.
Alex
msx lover
Mensajes: 100
Publicado: Octubre 05 2007, 22:30   
Quote:

in DOS it should work indeed. Only first 256 bytes are vital. The ISR on #38 usually has a jump to hi-mem location (page 3) and from there it'll do a far-call into a ROM page. The same goes for nON-DOS (basic and stuff) now I think of it....


In DOS it will indeed work. Only the first 256 bytes and all memory above the TPA are reserved for the system. In the area in between (0x100 - TPA) you can do whatever you want.

Though, note that under DOS2 you should ideally set page 4 (or whatever other page) with the set-segment function of DOS2. Otherwise you run the risk that the interrupt routine of DOS2 will restore the wrong segment in page 0 when returning to the application.

There is a hack to workaround this problem (the program map.com) but it does not work well on an MSX turbo R that has an internal memory expansion above 512 kB


 
Ir a la página ( 1 | 2 Siguiente página )
 







(c) 1994 - 2008 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation