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

Pagina 2/3
1 | | 3

Van gdx

Enlighted (6106)

afbeelding van gdx

04-07-2021, 09:02

Grauw wrote:

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.

No, because the corresponding expanded I/O ports are not enabled by writting the ID 8 in these cases. The register is accessible with this method on Panasonic MSX2+ only.

Extended I/O ports are all for devices but there is confusion because the first 29 ports are reserved for several makers without the corresponding devices having been decided. I will correct the wiki page soon.

PS: The routine in MSX2+ wiki pages checks if the BIOS in MSX2+. This is not useless because there are PCs that sometimes give a random value when reading the unused I/O port. That prevents this rare problem.

Van Grauw

Ascended (10707)

afbeelding van Grauw

04-07-2021, 14:25

gdx wrote:
Grauw wrote:

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.

No, because the corresponding expanded I/O ports are not enabled by writting the ID 8 in these cases. The register is accessible with this method on Panasonic MSX2+ only.

Extended I/O ports are all for devices but there is confusion because the first 29 ports are reserved for several makers without the corresponding devices having been decided. I will correct the wiki page soon.

I repeat, the expanded I/O ports with device ID 8 are also present on the Sanyo PHC-70FD, 70FD2 and 35J, which do not implement the turbo mode.

However reading the openMSX source code, apparently bit 2 of the register at I/O 65H indicates whether turbo is available (1 = not available), so this would be a better alternative to confirm the presence of turbo rather than a speed test.

From MSXMatsushita::peekSwitchedIO:

byte result = firmwareSwitch.getStatus() ? 0x7F : 0xFF;
// bit 0: turbo status, 0=on
if (turboEnabled) {
    result &= ~0x01;
}
// bit 2: 0 = turbo feature available
if (turboAvailable) {
    result &= ~0x04;
}
return result;

Van gdx

Enlighted (6106)

afbeelding van gdx

04-07-2021, 14:30

Grauw wrote:

I repeat, the expanded I/O ports with device ID 8 are also present on the Sanyo PHC-70FD, 70FD2 and 35J, which do not implement the turbo mode.

From what you affirm, MSX datapack is therefore false or Sanyo did not meet the standard and it should be quite easy to add the Turbo mode to Sanyo computers.

Grauw wrote:

However reading the source openMSX code, apparently bit 2 of the register at I/O 65H indicates whether turbo is available (1 = not available), so there may be a better alternative to confirm the presence of turbo rather than performing a speed test.

openMSX 0.15.0 indicate 255.

Van Grauw

Ascended (10707)

afbeelding van Grauw

04-07-2021, 14:42

More details here: https://github.com/openMSX/openMSX/issues/989

Apparently the function is not implemented by the T9769 MSX-ENGINE but by a M60014 gate array in the Panasonic machines, and the Sanyo machines have a M60013 gate array.

gdx wrote:
Grauw wrote:

However reading the source openMSX code, apparently bit 2 of the register at I/O 65H indicates whether turbo is available (1 = not available), so there may be a better alternative to confirm the presence of turbo rather than performing a speed test.

openMSX 0.15.0 indicate 255.

Sorry I meant expanded I/O register 41H (65 decimal).

Van gdx

Enlighted (6106)

afbeelding van gdx

04-07-2021, 15:08

Grauw wrote:

Apparently the function is not implemented by the T9769 MSX-ENGINE but by a M60014 gate array in the Panasonic machines, and the Sanyo machines have a M60013 gate array.

I assumed that these expanded I/O ports are externaly handled but I have doubts now. Maybe just a signal to turn this mode on or off.

Grauw wrote:

Sorry I meant expanded I/O register 41H (65 decimal).

I would meant I get 255 with: OUT 64,8: PRINT INP(64)
Not 247 nor 128. (on Sanyo and Turbo R)

Van Grauw

Ascended (10707)

afbeelding van Grauw

04-07-2021, 15:19

It works here with openMSX 17.0 emulating the Sanyo PHC-70FD machine.

out 64,8:print inp(64)
 247
Ok

Please forget about my mention of the turboR earlier, it does not have this ASIC.

Van Grauw

Ascended (10707)

afbeelding van Grauw

04-07-2021, 15:44

I updated the wiki page with a check for bit 2 (“turbo available”) before modifying bit 0 (“turbo enable”). I also updated the example on the MAP.

Van max_iwamoto

Hero (628)

afbeelding van max_iwamoto

04-07-2021, 16:00

Here is the code I used to enable turbo if available for Panasonic Turbo-R, Panasonic MSX2+ with Turbo (WSX), and Brazilian Expert:

TUR_SER:
	LD	HL,0180h
	LD	A,(HL)
	CP	C3h		; check for Turbo-R or ANY NEWER MSX COMPUTER with Turbo
	JR	NZ,.chkWSX

	LD	A,81h		; Turbo ON!
	JP	(HL)

.chkWSX:			; Panasonic WSX
	LD	BC,0840h
	OUT	(C),B
	IN	A,(C)
	CPL
	CP	B
	JR	NZ,.chkEXP
;
	IN	A,(41h)
	AND	%11111110	; 0 = turbo , 1 = no turbo
	OUT	(41h),A
	RET

.chkEXP:			; Expert
	LD	DE,FAA7h
	LD	HL,(1387h)
	RST	20h
	RET	NZ
	LD	DE,1393h
	LD	HL,(1389h)
	RST	20h
	RET	NZ
	LD	DE,B6DBh
	LD	HL,(1393h)
	RST	20h
	RET	NZ
;
	IN	A,(B6h)
	OR	%10000000	; 0 = no turbo , 1 = turbo
	OUT	(B6h),A
	RET

Van gdx

Enlighted (6106)

afbeelding van gdx

04-07-2021, 17:21

@Grauw

Quote:

IF PEEK(&H2D)=2 THEN OUT 64,8:IF INP(64)=247 THEN IF (INP(65) AND 4)=0 THEN OUT 65,0

Why "AND 4"?

Van Grauw

Ascended (10707)

afbeelding van Grauw

04-07-2021, 18:10

To check the value of bit 2 to know if turbo is available.

Based on this you can also let your sound routines adjust the PSG periods by x1.5.

If you would want to be absolutely perfect you could even only manipulate the bit 0:

OUT 64,8:IF INP(64)=247 THEN IF (INP(65) AND 4)=0 THEN OUT 65,INP(65) AND 254
OUT 64,8:IF INP(64)=247 THEN IF (INP(65) AND 4)=0 THEN OUT 65,INP(65) OR 1

Additionally, if the goal is to exclude computers without pull-ups on the bus, perhaps change the check to MSX2 and up? Assuming all MSX2 computers have pull-ups on the bus (not certain about that).

IF PEEK(45)>=1 THEN

p.s. According to openMSX machine definitions, National FS-4500 and FS-4700F also have these Panasonic expanded I/O ports, without turbo function just like the Sanyos.

Pagina 2/3
1 | | 3