Turbo-R and out(c),0

By Metalion

Paragon (1509)

Metalion さんの画像

07-05-2022, 16:59

Hi everyone,

To make things clear : out(c),0 does not work on the R800, but does work on the Z80 of the MSX Turbo R, right ?

ログイン/登録して投稿

By gdx

Enlighted (5485)

gdx さんの画像

07-05-2022, 17:58

Some docs say that with CMOS Z80 it's OUT (C),255 instead of OUT (C),0 on TTL Z80. I will try to test it soon and also on turbo R.

Edit: I just tested on turbo R.

Z80 mode: OUT (C),255
Turbo R mode: NOP

I tested with the program below and the color 4 becomes white only in Z80 mode.

; OUT (C),0 test

	org	0D000h-7

	db	0feh
	dw	start
	dw	end
	dw	start

start:
	ld	c,099h
	di
	ld a,4
	out	(c),a
	ld	a,80h+16
	out	(c),a
	inc	c	; C = 9Ah
	out	(c),0
	nop
	out	(c),0
	ei
	ret
end:

I will test on a MSX1 with a CMOS Z80 and another with a TTL Z80 next time.

By Parn

Paladin (781)

Parn さんの画像

07-05-2022, 17:57

Is this a reliable way to check the processor type? Is it useful?

By Metalion

Paragon (1509)

Metalion さんの画像

07-05-2022, 18:19

Thanks GDX for your test. I guess if the out(c),0 worked in Z80 mode on the Turbo-R with your test, the color 4 would have gone to black ?

By gdx

Enlighted (5485)

gdx さんの画像

07-05-2022, 19:40

I confirm on my MSX1 with a CMOS Z80 it's OUT (C),255 and on the MSX1 with a TTL Z80, it's OUT (C),0.
I tested with the program below in screen 0.

	org	0D000h-7

	db	0feh
	dw	start
	dw	end
	dw	start

start:
	ld	c,099h
	di
	out	(c),0
	ld	a,80h+7
	out	(c),a
	ei
	ret
end:

The screen becomes black with the TTL Z80 and white with the CMOS Z80.

Metalion wrote:

on the Turbo-R with your test, the color 4 would have gone to black ?

No, nothing change because it's a NOP instead of OUT (C),255 in Turbo R mode.

There are also mirrors of the Z80 undocumented instructions that become NOPs in R800 mode. I had checked it a long time ago.

By Metalion

Paragon (1509)

Metalion さんの画像

07-05-2022, 20:30

I was refering to that:

gdx wrote:

Z80 mode: OUT (C),255
Turbo R mode: NOP

Your test redefines color 4, so if I understand correctly:
. TTL Z80 : out(c),0 - the color 4 goes to black
. CMOS Z80 : out(c),255 - the color 4 goes to white
. R800 : nop - the color 4 stays the same

Correct ?

By ro

Scribe (4698)

ro さんの画像

07-05-2022, 22:05

Is this a known. Thing? First time for me, what's cooking? Some context?

By gdx

Enlighted (5485)

gdx さんの画像

08-05-2022, 02:44

Metalion wrote:

Your test redefines color 4, so if I understand correctly:
. TTL Z80 : out(c),0 - the color 4 goes to black
. CMOS Z80 : out(c),255 - the color 4 goes to white
. R800 : nop - the color 4 stays the same

Correct ?

Yes, the first test change the color palette of the color 4. So because it doesn't work on MSX1, I made a second test that change the background and border color. (It juste make a writting to the register 7.) Make the test in SCREEN 0 because only the border color changes in SCREEN 1.
I have an MSX1 in which I had replaced the Z80 with a CMOS.

By Grauw

Ascended (10580)

Grauw さんの画像

08-05-2022, 02:14

I’ve also confirmed this a while ago, and implemented it for openMSX.

By gdx

Enlighted (5485)

gdx さんの画像

08-05-2022, 02:38

Thank you, Grauw. This means that all Z80s in MSX engine are CMOS.

gdx wrote:

There are also mirrors of the Z80 undocumented instructions that become NOPs in R800 mode. I had checked it a long time ago.

It can be useful to make wait times for direct accessed to FM sound chip for example.
There are examples of use in the JoySNES adapter manual.

Edit: I used it for the mouse routine below.

https://www.msx.org/wiki/Mouse/Trackball#Direct_usage_of_mouse