At 08:31 PM 2/5/99 +0100, you wrote:

>DOS 2 & memory
>--------------
>I found out that the DOS2 page-switch routines are
>kinda slow. Does anybody know a simple, "legal", and
>compatible way to speed up those bottlenecks?

Slow?
This is what PUT_P2 does on my GT:

                jp      #EE3A
#EE3A:  
                ld      (#F2C9),a
                out     (#FE),a
                ret

If that is too slow for your program, maybe you are simply doing too many
page switches...

But, if you really need to do it faster, here are a couple of suggestions:

You can "safely" assume that the jump table only contains "C3 ll hh"
entries. So you can jump to "hhll" instead of jumping into the jump table.
Saves one jp instruction.

A bit more risky solution is to use the addresses #F2C7..#F2CA hardcoded in
your program. I think that will work on all current DOS2 implementations,
but it's not good conduct. Anyway, this will save one CALL/RET pair, which
only a couple of clockticks, so don't do it unless you really need the speed.

>Oh - another question comes in mind:
>In DOS1 you are not allowed to "ask" the outs (#fe...) about
>the page number which they may contain.
>
>-> How will I know which ones are selected?

You can assume the mapper registers are initialised like this:
#FC : mapper page 3
#FD : mapper page 2
#FE : mapper page 1
#FF : mapper page 0
This is true in DOS, BASIC and when booting. I can't think of any other
situation from which your program is executed.

>-> Is there a _STANDARD_ definition which
>   memmaps are selected after the bootstrap?

See above.

>DOS2 and Interrupts:
>--------------------
>I want to redirect the standard-interrupt (with use of
>IMx). Will I get troubles if there is NO(!) ROM selected
>in page0/1 the whole time? - I dont wanna load in this
>situation, only wanna switch mem...

As long as there is an interrupt handler where the Z80 expects it, there is
no problem. An interrupt handler can be located in RAM.

You can use IM2 to set up an interrupt handler at any address, but it's
cumbersome to make it compatible. There was a discussion about this on this
list a while ago.
If putting the interrupt handler at #0038 is no problem, you can stick with
the normal interrupt mode (IM1).

There are a couple of things an interrupt handler must do:
- tell the device that caused the interrupt that it can stop asking for an
interrupt (example: read VDP status register 0)
- after that and before the end of the interrupt handler, execute the EI
instruction
- modify absolutely none of the registers that are used by the program
running 

About that last point:
The default MSX interrupt handler pushes all registers (normal and
alternative) to the stack. This is safe, but slow.
If you choose not to use the alternative registers in your program, and not
to use them and IX and IY in your interrupt routine, you can make a much
faster interrupt handler:

intHandler:
                ex      af,af'
                exx
                ... handle interrupt ...
                exx
                ex      af,af'
                ei
                ret

For a normal 50/60Hz interrupt, such a speedup is not necessary. But if you
use more frequent interrupts (line interrupts, OPL1 or OPL4 timer), it
could be a good idea.

>hope to get interesting answers...

Thanks for the opportunity to boost the tech-level on this list.
I wonder why there is more chatting on this list than on the MSX IRC
channel...

Today's MSX soundcard trivia:
Did you know that you shouldn't put the MoonSound volume too high? If you
do, it will clip the sound and it will sound bad.
I made a single channel that plays a sample which uses the full amplitude
range. I put the volume for that channel on maximum and put the mixer on
maximum too. About one third of the sample was clipped! And this occurs
when playing a single channel, the other 23 were silent.
Does anyone know what mixer setting MoonBlaster uses? I use %010 (2) for
both channels now, that avoids clipping in most cases and is still loud
enough.

Bye,
                Maarten


****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****

Reply via email to