MiSTer-devel / PET2001_MiSTer

Commodore PET for MiSTer
14 stars 9 forks source link

Please allow for EDITOR ROM switching #10

Open rhester72 opened 1 year ago

rhester72 commented 1 year ago

Controlling NTSC vs. PAL on PET requires swapping the EDITOR ROM.

The baked-in ROM is PAL, which messes up timing for NTSC (see CLOCK! in issue #4 of CURSOR magazine).

sorgelig commented 1 year ago

I've added System ROM loading in new commit. Description of ROM is in readme.

rhester72 commented 1 year ago

Confirmed, thank you!

This demonstrates another issue...the core video frequency appears to be fixed at 59.6Hz, rather than being driven by the system ROMs (as on original hardware), which also affects clock pacing. Should I open a different issue for that?

sorgelig commented 1 year ago

I don't see in core any traces of programmed video controller. I don't think it allows to program video timings from ROM. It's possible there were different models for PAL and NTSC. Since PET2001 had integrated monitor, not TV, i wonder why it should have different TV systems.

sorgelig commented 1 year ago

I did more study of PET models. 50/60Hz mode and 80-column mode are available only in later models with CRTC chip. Current PET2001 implementation is first model, without CRTC. So it's impossible to change the video timings without implementing more advanced PET models.

rhester72 commented 1 year ago

I wasn't sure whether the core was intended as a literal PET 2001 or something more like a PET 4032, fair enough. It looks like the real-world target you're after is the PET 2001-32N. In either case, the built-in ROM (Pet2001_RomType40.mif) is faulty. =)

The makeup of the built-in is as follows:

901465-23 - BASIC 4.1 ROM $B (fixed version)
901465-20 - BASIC 4 $C
901465-21 - BASIC 4 $D
901498-01 - Screen editor for BASIC 4, normal keyboard, CRTC, 40 columns, 50 Hz
901447-10 - Character generator for BASIC 2/4
901465-22 - KERNAL for BASIC 4

The editor ROM chosen (901498-01) is problematic for two reasons. First, as you point out, it assumes a programmable CRTC, which isn't implemented (and indeed wasn't available in the PET2001). Second, it's intended for 50Hz machines, which causes the RTC to run 20% too fast (12 minutes of TI$ time elapses for every 10 minutes of wall clock time).

In that event, I'd suggest replacing 901498-01 with 901447-29 (Screen editor for BASIC 4, normal keyboard, no CRTC, 40 columns) for better compatibility and to correct the clock issue.

I've attached a 32K ROM for this that should be easily converted to MIF format (though I don't know how).

Pet2001_RomType40-2001.zip

rhester72 commented 1 year ago

[EDIT: names corrected for consistency with most sources]

For completeness' sake (considering the multiple MIF files currently shipped with the code), I'm attaching reconstituted versions of every PET 2001 BASIC ROM set, properly selected against actual period-era hardware.

Sourced from http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/ and http://mhv.bplaced.net/cbmroms/cbmroms.php with direction on some sets from http://www.zimmers.net/anonftp/pub/cbm/magazines/cursor/Cursor_Issues.pdf page 46.

The gist boils down to this:

BASIC 1 shipped with the very first PET 2001. The initial (old) release was extremely buggy and the high BASIC ROM was quickly replaced in production as a result. It had an upper/lowercase character set reversed from future versions. These are commonly referred to as the "original" ROMs.

BASIC 2 shipped later with the 30xx and PET 2001 xN model series and made available as an upgrade to original PET 2001 owners, It corrected the reversed character set (thus breaking some software!), added a machine language monitor and finally allowed IEEE-488 devices to work. Before this, it was only tape! These are referred to as the "upgrade" ROMs.

BASIC 4 shipped with the 40xx model series and was never officially made available for the original PET 2001, but could be fitted successfully. It kept the 'fixed' character set, had a greatly enhanced and expanded BASIC (including built-in disk commands) and required a special EDITOR ROM for the PET 2001 that did not require a CRTC display (supporting the 9" PET models). A few minor bugfixes to the BASIC ROM distinguish this from the 4.0 (old) set. These are commonly referred to as the "4.0" ROMs.

Note that some 'peculiarities' exist with 9" screen PET EDITOR ROMs (like the calculator-style keyboard PET 2001) that changed in later models containing a CRTC (e.g. PET 4032):

PET2001-BASIC.zip/

sorgelig commented 1 year ago

Thank you for info and rom sets. I've updated the repo