Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zx spectrum: new slot devices, floating bus restore, big mface tidy-up #7913

Merged
merged 10 commits into from
Jan 25, 2022

Conversation

TwistedTom
Copy link
Contributor

@TwistedTom TwistedTom commented Mar 31, 2021

2 new slot devices: spec-mate, micro-pokeer[sic]

reinstate floating bus, slot device friendly this time
(let devices have a callback, if by the last-in-chain slot device, iorq_r hasn't returned anything, return floating bus value instead of just returning 0xff)
add floating bus to applicable 128k machines (not +2A,+3 they don't have it)

split up multiface devices into hardware revisions (some bios roms weren't working because h/w is different)
added correct partial decoding of ports
fix issues with mface128, mface3 (missing logic)
add mprint missing stuff, parallel port
add mface3 pal
change default key for "magic button" (backspace is mapped for 128K machines and in natural keyboard mode)
don't clash with disk devices as it's possible to have 2 "magic button" devices chained eg. mface + beta, so use something else (numpad-) for disk devices
all models now work correctly with working disk interfaces: beta, opus, disciple/+d -> OK, kempston disk, +3 disk -> no write support

fix bug in specpls3 preventing paging lock being fully applied
move HC91+ clone into spectrum.cpp (it's a clone of 48k, not 128k)
add dual-bios cp/m roms (not working) and inf1 roms

sort out +2A,+3 bios roms:
redump english v4.0, v4.1 (the real chips are 2x 32KB not 4x 16KB)
add bios options to +2A
correct spanish v4.0 (is v4.1)
add spanish v4.0
make spanish dumps 2x 32KB not 4x 16KB to match real h/w

@TwistedTom
Copy link
Contributor Author

TwistedTom commented Mar 31, 2021

btw, has anyone got a schematic for Kempston disk interface? I had it once upon a time but can't find it now, would be nice to get that fully working...

@p1pkin
Copy link
Member

p1pkin commented Apr 5, 2021

btw, has anyone got a schematic for Kempston disk interface? I had it once upon a time but can't find it now, would be nice to get that fully working...

what you mean "get that fully working" ? Kempston Disc v3 was fully working at the point it was implemented.

Kempston Disc v2 AKA "Watford SP-DOS" in theory fine too, but at practice is useless / non working without missing system disc.

@TwistedTom
Copy link
Contributor Author

what you mean "get that fully working" ?

Seems there's no write support, at least creating a new .mfi image and attempting format fails. What little software is available is .dsk format which is read-only in Mame.
Was writing ever working? perhaps a regression... wd1770 is fairly popular and everything else seems to be working so I assumed its an issue with the device rather than the fdc.

@rb6502
Copy link
Contributor

rb6502 commented Apr 5, 2021

There was a major bug in the low-level floppy handling (common to all controller chips) that was fixed at the last minute for 0.230. Have you tested formatting on 0.230?

@TwistedTom
Copy link
Contributor Author

Have you tested formatting on 0.230?

Yes, I checked with official 0.230 binary release, not working.

@galibert
Copy link
Member

galibert commented Apr 5, 2021 via email

@TwistedTom
Copy link
Contributor Author

How do you do the formatting with a spectrum? Tell me as if I never used a spectrum, because I never used a spectrum :-)

Well you're in for a treat as the Kempston disc interface is a very odd syntax even by Spectrum standards ;-)

PRINT #4: FORMAT "disc_name": PRINT 1,80,2,1

last part is drive #1, 80 tracks, 2 sides, 1=6ms step rate
PRINT and FORMAT are tokenized not typed, so you want P for PRINT, extended-mode+0 for FORMAT, (extended-mode is caps-shift+symbol-shift, then hold symbol-shift+key)

@galibert
Copy link
Member

galibert commented Apr 5, 2021 via email

@TwistedTom
Copy link
Contributor Author

TwistedTom commented Apr 5, 2021

How should I start mame to have the correct interfaces? OG.

You just want kempdisc, it's not dependant on anything else being present or not, so:

mame spectrum -exp kempdisc

Also, I can rule out regression, I just tried the first official release which had kempdisc (0.223) and it's the same.

@Tafoid
Copy link
Contributor

Tafoid commented May 2, 2021

Is there any reason this is still sitting not applied?

@p1pkin
Copy link
Member

p1pkin commented May 2, 2021

in general it is OK, but I noticed one thing
@TwistedTom can you please recheck changes like "data &= something" replaced with "data = something" ? it was like that for a reason, and &= modified only specific bits just like real expansion devices, while other bits may retain original (bus) value. i.e. (some of) that devices was written with future full per-bit floating bus simulation in the mind.

@TwistedTom
Copy link
Contributor Author

@p1pkin yes it's intentional, the &= bit mask only worked when "data" was initialized with 0xff. If we're using floating bus value, then the mask no longer works as it can return any value.
eg. floating bus returns 0xfe, device sets bit 0, 0xfe & 0x01 = 0x00 -> fail, bit 0 is lost

Now we could introduce better masking obviously but i'm not sure it's necessary. It seems devices do return the whole byte (no un-used/hi-z bits). Take for example Kempston joystick, even though it only uses 5 bits, the un-used 3 are explicitly set low rather than left floating and some games even break if this is not the case. Multiple chained devices should never be using the same port anyway so in theory un-used bits shouldn't actually matter all that much (I don't think there's any scenario where software will read a certain port and expect certain bits from exp dev A and certain other bits from exp dev B simultaneously).
That said, it's of course possible there's cases where certain devices only use/return certain bits and leave others un-used/hi-z, so for full accuracy we would need to check every device h/w or schematic to confirm which bits.
In reality the games that use floating bus use certain ports which the devs chose not to conflict with known exp devices that existed at the time. It's possible devices that came later could use the same ports and conflict but I'm not aware of any such cases. The floating bus "trick" was discovered quite late in the Spectrums life so most well known exp devices did exist when the games were written.

@rb6502
Copy link
Contributor

rb6502 commented Jan 22, 2022

@TwistedTom Could you update this so it doesn't conflict and I'll apply it?

@TwistedTom
Copy link
Contributor Author

Had forgotten all about this!
Fixed the conflicts, have a feeling clang build will probably fail, gcc/windows is ok, don't have a local clang setup, better wait for autobuilds to complete...

@@ -122,7 +122,7 @@ void tsconf_state::tsconf_io(address_map &map)
map(0x0077, 0x0077).mirror(0xff00).rw(FUNC(tsconf_state::tsconf_port_77_zctr_r), FUNC(tsconf_state::tsconf_port_77_zctr_w)); // spi data
map(0x005f, 0x005f).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::sector_r), FUNC(beta_disk_device::sector_w));
map(0x007f, 0x007f).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::data_r), FUNC(beta_disk_device::data_w));
map(0x00fe, 0x00fe).select(0xff00).rw(FUNC(tsconf_state::spectrum_port_fe_r), FUNC(tsconf_state::tsconf_port_fe_w));
map(0x00fe, 0x00fe).select(0xff00).rw(FUNC(tsconf_state::spectrum_ula_r), FUNC(tsconf_state::tsconf_port_fe_w));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write function as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just rename, no change to functions. The proper decoding is any even port (a0=0) accesses ula, not specifically port 0xfe, so rename makes more sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. But there is FUNC(tsconf_state::tsconf_port_fe_w)) in same line. Is it compilable without renaming this as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's your function in tsconf class, so up to you if you want to rename them or not. It's just the functions back in base class (spectrum.cpp) that you're inheriting from that are renamed.

@rb6502 rb6502 merged commit eb3c4e6 into mamedev:master Jan 25, 2022
@TwistedTom TwistedTom deleted the mface branch January 25, 2022 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants