Enabling turbo mode in Assembly on Panasonic 2+/Turbo R machines

Página 1/3
| 2 | 3

Por albs_br

Champion (326)

Imagen del albs_br

03-07-2021, 21:55

Hi, guys. As the topic title implies i'm trying to enable turbo mode using Assembly.

I test the comands found on the wiki in Basic and worked fine.
I translated the code to Assembly (above) and it don't work. The "eternal loop" is just to make sure the execution reached the end of subroutine.
I tested on openMSX.
Am I doing some stupid mistake here?

EnableTurboMode:
    ; &H2D = BIOS_HWVER
    ; IF PEEK(&H2D)=2 THEN OUT 64,8:IF INP(64)=247 THEN OUT 65,0
    ; source: <a href="https://www.msx.org/wiki/Panasonic_FS-A1FX" title="https://www.msx.org/wiki/Panasonic_FS-A1FX">https://www.msx.org/wiki/Panasonic_FS-A1FX</a>

    ; IF PEEK(&H2D)=2
    ld      a, (BIOS_HWVER)
    cp      2
    ret     nz

    ; OUT 64,8
    ld      a, 8
    out     (64), a

    ; IF INP(64)=247
    in      a, (64)
    cp      247
    ret     nz

    ; OUT 65,0
    xor     a
    out     (65), a

.eternalLoop: ; debug
    jp .eternalLoop

    ret
Login sesión o register para postear comentarios

Por ro

Scribe (4456)

Imagen del ro

03-07-2021, 22:10

With turbo, u mean switching to r800?
If so, use bios call 0x0180 for that.

Por santiontanon

Paragon (1470)

Imagen del santiontanon

03-07-2021, 22:27

Your code looks almost identical to the one I use in Tales of Popolon to activate the turbo mode in Panasonic machines, but there are slight differences, which maybe are the problem? Take a look at lines 39-49 here: https://github.com/santiontanon/talesofpopolon/blob/master/s...

Por albs_br

Champion (326)

Imagen del albs_br

03-07-2021, 22:28

No, not switching to R800, it's enabling the Z80 turbo mode (5.37 MHz) as stated on wiki (I suppose the Turbo R also has this feature, am I right?).

Por mars2000you

Enlighted (5970)

Imagen del mars2000you

03-07-2021, 22:45

The Turbo R does not have this feature.

Por albs_br

Champion (326)

Imagen del albs_br

03-07-2021, 23:20

mars2000you wrote:

The Turbo R does not have this feature.

Thanks, so in case of Turbo R, I will switch to R800.

Anyway, i'm doing my tests on Panasonic WSX emulated on openMSX.

Por albs_br

Champion (326)

Imagen del albs_br

03-07-2021, 23:23

santiontanon wrote:

Your code looks almost identical to the one I use in Tales of Popolon to activate the turbo mode in Panasonic machines, but there are slight differences, which maybe are the problem? Take a look at lines 39-49 here: https://github.com/santiontanon/talesofpopolon/blob/master/src/top-main.asm

Your code is essentially the same as mine, 247 with all bits inverted is 8. I tested and it don't work as well.

Is there any specific moment or condition to execute this snipet of code (in/out VBLANK, interrupions enabled/disabled, before/after set screen mode, etc)?

Por santiontanon

Paragon (1470)

Imagen del santiontanon

04-07-2021, 00:39

Wow, that is surprising, since that code has been tested and actually works. Just to rule out some basics, how are you testing to see if the code works? are you running some code loop afterwards to see if it runs faster after executing the code that turns on turbo?

Por Manuel

Ascended (18093)

Imagen del Manuel

04-07-2021, 00:28

albs_br wrote:
mars2000you wrote:

The Turbo R does not have this feature.

Thanks, so in case of Turbo R, I will switch to R800.

Anyway, i'm doing my tests on Panasonic WSX emulated on openMSX.

Note that on a real machine, the sound pitch also changes. That is not emulated. See also https://github.com/openMSX/openMSX/issues/799

Por albs_br

Champion (326)

Imagen del albs_br

04-07-2021, 00:43

santiontanon wrote:

Wow, that is surprising, since that code has been tested and actually works. Just to rule out some basics, how are you testing to see if the code works? are you running some code loop afterwards to see if it runs faster after executing the code that turns on turbo? (and also, which machine are you testing on? just to see if I can test on the same to verify again on my end)

The method is very simple and direct, to see the background color lines I'm used on Go Penguin. The 1,5x boost makes a huge difference and left lots of idle time on each frame. It is easilly checked on WebMSX which has the Turbo feature on its interface.

I'm testing on Gradiente Expert (MSX1) and Panasonic WSX (2+) both emulated on openMSX.

Code is on github, as always (entry point is main.s):
https://github.com/albs-br/penguin-platformer/blob/master/main.s

Por Grauw

Ascended (10025)

Imagen del Grauw

04-07-2021, 03:54

You can find expanded I/O port documentation here.

Some practical considerations you should be aware of:

1. As Manuel mentioned, the PSG pitch is 1.5 times higher in the 5.37 MHz turbo mode. You need to compensate for this when writing PSG tone, noise and envelope period values in your music and sfx player routine (multiply the periods by 1.5 and clamp them).

2. Detecting the Toshiba MSX-ENGINE’s expanded I/O register does not guarantee the machine has turbo implemented, e.g. the Sanyo MSX2+s use the same MSX-ENGINE but the turbo flag has no effect, and the same applies to the turboR. Therefore you need to perform a speed test after enabling it to confirm the turbo is active. You need to know this to enable the pitch adjustment in point 1.

Página 1/3
| 2 | 3