Giter VIP home page Giter VIP logo

c128_mister's Introduction

C128 for MiSTer

Based on C64_MiSTer by sorgelig.

Based on FPGA64 by Peter Wendrich with heavy later modifications by different people.

Features

  • C128, C64 and CP/M modes.
  • Chipset versions selectable from original C128 flat and newer C128 DCR.
  • Supports international versions of the C128.
  • Optional "pure" C64 mode (disables C128 extensions).
  • C1541 read/write/format support in raw GCR mode (*.D64, *.G64).
  • C1571 read/write/format support in raw GCR or MFM mode (*.D64, *.G64, *.D71, *.G71).
  • C1581 read/write support (*.D81).
  • Parallel IEC port for faster (~20x) loading time.
  • External IEC through USER_IO port, including Fast Serial.
  • VIC jailbars.
  • VIC register $D030 video manipulation tricks (used in some demos, e.g. RfO part 1)
  • VDC with 16k or 64k RAM and multiple colour palettes.
  • Almost all C64 and C128 cartridge formats (*.CRT).
  • Internal Function ROM support for ROMs up to 1Mb with MegaBit 128 support
  • Direct file injection (*.PRG) with detection of C128 or C64 mode.
  • Dual SID with several degree of mixing 6581/8580 from stereo to mono.
  • Similar to 6581 and 8580 SID filters.
  • REU 16MB and GeoRAM 4MB memory expanders.
  • OPL2 sound expander.
  • Pause option when OSD is opened.
  • 4 joysticks mode.
  • RS232 with VIC-1011 and UP9600 modes either internal or through USER_IO.
  • Loadable Kernal/drive ROMs.
  • Special reduced border mode for 16:9 display.
  • Smart Turbo mode (up to 4x speed) for the 8502.
  • Smart Turbo mode (2x speed) for the Z80.
  • Real-time clock.
  • (Optional) Multiple ROM sets and hardware variants using MRA files.

Features marked in bold are unique to the C128 core, the other features are inherited from the C64 core.

Usage

System and drive ROMs

ROM files need to be provided. The ROM images will be loaded by the MiSTer on start up of the core.

There are two ways to provide the ROMs for the core: using boot ROM files, or using MRA files.

Using boot ROM files

To boot using rom files, a boot0.rom and boot1.rom file need to be placed in the games/C128 directory:

  • boot0.rom containing the system ROMs in this order:
    • ROM1: C64 Basic+C64 Kernal (16k total)
    • ROM4: C128 Editor+Z80 bios+C128 Kernal (16k total)
    • ROM2+3: C128 Basic (32k total)
    • Character ROM: C64+C128 or ASCII+DIN (8k)
  • boot1.rom containing the drive ROMs in this order:
    • 2x 1541 drive ROM (64k total) (repeat 4x if it's a 16k ROM image)
    • 2x 1571 drive ROM (64k total)
    • 2x 1581 drive ROM (64k total)

Each drive's ROM is repeated twice in boot1.rom. The first ROM is used for drive 8, the second for drive 9. This makes it possible to use different ROMs in the two drives. The 1541 ROM is 16k and needs to be repeated 4 times to fill the 64k space.

There are two optional boot roms:

  • boot2.rom for the optional Internal Function ROM (up to 1Mb with MegaBit 128 support)
  • boot3.rom for the optional External Function ROM (16 or 32k)
    • This is different from a cartridge (.CRT) file, it should be a plain ROM image without the cartridge headers

Using MRA files

(Advanced)

MRA files make it possible to create multiple ROM and hardware configurations and easily switch between them using the MiSTer main menu. Each configuration will show as a separate item in the Computer cores menu. MRA files were designed for use with the arcade cores, but they also work with computer cores.

Using MRA files requires the user to make manual changes to the MiSTer file layout as currently the update script does not support MRA files for computer cores.

An MRA file configures all system and drive roms as well as (optionally) the internal and external function ROMs. It also contains a configuration parameter that configures the "auto" choice of the CIA, SID and VDC chips and how the Caps Lock key is configured, making it possible to quickly switch between a 1985 flat C128 and a C128DCR hardware setup and the multitude of international language versions of the C128.

The following changes need to be made on the MiSTer SD-CARD or USB drive to use MRA files:

  • Copy the latest C128_XXXXXXXX.rbf file from the /_Computer/ folder to a (new) /_Computer/cores/ folder,
  • Download (some of) the *.mra files from the mra directory and place them in the /_Computer/ folder,
  • Download C128rom.zip and place that in the /games/mame/ folder.

The above steps need to be repeated when a new version of the core is released, as the update script will not update the *.rbf in the /_Computer/cores/ folder, and also the *.mra files might have been updated in the repository.

Loadable ROM

ROMs can also be loaded from the OSD via Hardware->System ROMs and Hardware->Drive ROMs menu options. These expect a ROM file with the same layout as boot0.rom and boot1.rom as described above respectively.

The Internal Function ROM can also be loaded from the OSD via Hardware->Internal Function ROM and this is similar to using the optional boot2.rom.

Keyboard

  • End - Run stop
  • F2, F4, F6, F8, Left/Up keys automatically activate Shift key.
  • F9 - 🡹 key.
  • F10 - = key.
  • F11 - Restore key, or Freeze key for some cartridges (e.g. Action Replay).
  • Super keys (Win/Apple) - C= key.
  • PgUp - Tape play/pause
  • PgDn - Line feed
  • Print Screen - Display 40/80
  • Pause/Break - No Scroll (* see note below)
  • Numpad * - Help

The AltGr key (right Alt) is used to access alternative function keys. Combined with AltGr the function keys are the C128 top-row special keys. To access these functions, press and hold AltGr while pressing any of the function keys:

  • AltGr+F1 - Esc
  • AltGr+F2 - Alt
  • AltGr+F3 - Tab
  • AltGr+F4 - Caps Lock or ASCII/DIN
  • AltGr+F5 - Help
  • AltGr+F6 - Line feed
  • AltGr+F7 - 40/80 display
  • AltGr+F8 - No scroll
  • AltGr+F11 - Restore (if a cartridge using Freeze key is active)

It is possible to access the C128 top-row cursor keys, and the numpad keys on a PC keyboard without numpad using AltGr combined with the similar keys:

  • AltGr+return - Numpad enter
  • AltGr+1 through 0 - Numpad 1 through 0
  • AltGr+- - Numpad -
  • AltGr++ - Numpad +
  • AltGr+. - Numpad .
  • AltGr+Cursor keys - Top-row cursor keys (** see note below)

Shift lock can be activated by pressing AltGr+Shift. This is a toggle, to release Shift lock, press the AltGr+Shift combination again.

keyboard-mapping

Keys marked in blue are the keys sent when combined with AltGr.

*): The Pause/Break key acts like the No scroll key, however the Pause/Break PC key is special as it does not send a signal when it is released. To solve this, when the Pause/Break key is pressed, the No scroll key signal to the C128 is pulsed for short period. To hold No scroll on the C128 for longer, either use AltGr+F8, or quickly double press Pause/break and press any key to release No scroll.

**): When the Z80 CPU is active the top-row cursor keys become the default and AltGr selects the regular cursor keys.

Using without keyboard

If your joystick/gamepad has more than 4 buttons then you can have some limited usage of keyboard. Joystick buttons Mod1 and Mod2 adds 12 frequently used keys to skip the intros and start the game. Considering default button maps RLDU, Fire1, Fire2,Fire3, Paddle Btn, following keys are possible to enter:

  • With holding Mod1: Cursor RLDU, Enter, Space, End (Run stop), Shift+End (DLOAD"*" then RUN)
  • With holding Mod2: 1, 2, 3, 4, 5, 0, Y, N
  • With holding Mod1+Mod2: F1, F2, F3, F4, F5, F6, F7, F8

Internal memory

In the OSD->Hardware menu, internal memory size can be selected as 128K or 256K. The latter activates RAM in banks 2 and 3. C128 basic does not detect or use this memory however, so it will still show 122365 bytes free.

Video mode

On a C128, the 40/80 Display switch on the keyboard selects which video mode the system will boot on, or switch to when pressing the Run stop+Restore key combination.

Since the MiSTer has a single video output, the video mode being shown needs to be selectable. The video output can be selected from the OSD menu or using the keyboard. Use the OSD->Video Output option to either make the video output follow the 40/80 Display state, or select the VIC or VDC video outputs independent of the state of the 40/80 Display switch.

VDC/80 column mode

In OSD->Audio & Video the VDC version, memory size and colour palette can be selected.

There are four colour palettes selectable for the VDC:

  • Default: the "standard" TTL RGBI colour palette
  • Analogue: the palette when using resistors to convert TTL RGBI to analogue RGB
  • Monochrome: TTL monochrome monitor, with two levels of intensity
  • Composite: the black and white image on the composite pin of the DB9 TTL RGBI connector

The VDC can be programmed to generate non-standard video modes that the MiSTer video scaler does not handle very well. These modes would not work with most monitors on a real C128 either. They can cause the scaler to stop working (it will usually recover when switching video output to the VIC) or produce extreme flickering on the video output.

Cartridges

To load a cartridge from the OSD menu it must be in .CRT format. C64 and C128 cartridges will be detected based on the CRT header and the core will start in the correct mode.

To convert a binary ROM image into a .CRT, the cartconv tool from Vice can be used, usually like this:

cartconv.exe -t c128 -l 0x8000 -i cart.bin -o cart.crt

The -t c128 option is needed for C128 cartridges to add the header indicating this is a C128 cartridge. Otherwise the cartridge will be detected as a C64 cartridge and the core will start up in C64 mode.

The -l 0x8000 option is needed to indicate the image should be located at address $8000. Some external ROMs might need to be located at $C000, in that case -l 0xC000 should be used.

Autoload a Cartridge or Internal Function ROM

In OSD->Hardware page you can choose Boot Cartridge or Internal Function ROM, so everytime the core is loaded, this cartridge or ROM will be loaded too.

Turbo modes

Turbo mode can be enabled separately for each CPU. Turbo modes are mostly useful for software written in Basic, or "productivity" software. Software that is dependant on exact system timing, like some games and demos, will generally not function correctly when turbo mode is enabled. Any disk access will disable the turbo mode for a short time enough to finish disk operations.

8502 Speed: x2 mode makes the 8502 CPU always run in 2 MHz mode, equal to the standard C128 turbo mode, but with the VIC still operational. The x3 and x4 modes run the 8502 even faster at 3 and 4 MHz respectively.

Z80 Speed: The Z80 in a C128 runs at 4 MHz, but is throttled half the time to give the VIC access to the system bus, effectively making it execute at 2 MHz. The x2 speed setting runs the Z80 CPU without throtteling at the full 4 MHz.

RS232

Primary function of RS232 is emulated dial-up connection to old-fashioned BBS.

Note: Most turbo drive ROM kernals have no RS232 routines so most RS232 software don't work with these kernals!

GeoRAM

Supported up to 4MB of memory. GeoRAM is connected if no other cart is loaded. It's automatically disabled when cart is loaded, then enabled when cart unloaded.

REU

Supported standard 512KB, expanded 2MB with wrapping inside 512KB blocks (for compatibility) and linear 16MB size with full 16MB counter wrap. Support for REU files.

GeoRAM and REU don't conflict each other and can be both enabled.

USER_IO pins

USER_IO USB 3.0 name Signal name
0 D+ RS232 RX
1 D- RS232 TX
2 TX- IEC /CLK
3 GND_d IEC /RESET
4 RX+ IEC /DATA
5 RX- IEC /ATN
6 TX+ IEC /SRQ

All signals are 3.3V LVTTL and must be properly converted to required levels!

The IEC /SRQ (USER_IO6) line is required for IEC fast serial operation with an external 1571 or 1581 drive. You will need a MiSTer user port adapter that connects the /SRQ line. Assume a MiSTer user port to IEC adapter does not connect this line unless it is explicitly stated that it supports the C128 fast serial protocol.

Real-time clock

RTC is PCF8583 connected to tape port. To get real time in GEOS, copy CP-CLOCK64-1.3 from supplied disk to GEOS system disk.

Raw GCR mode

C1541/C1571 implementation works in raw GCR mode (D64/D71 format is converted to GCR and then back when saved), so some non-standard tracks are supported if G64/G71 file format is used. Support formatting and some copiers using raw track copy. Speed zones aren't supported (yet), but system follows the speed setting, so variable speed within a track should work. Protected disk in most cases won't work yet and still require further tuning of access times to comply with different protections.

"Pure" 64 mode

With OSD->Hardware->C64 mode the C64 mode of the C128 can be switched between "C128 extensions" and "Pure 64". In "C128 extensions" the 64 mode is identical to the C64 mode of the C128, which is not 100% identical to a real C64. When set to "Pure 64", the 64 mode is more similar to a real C64.

In "pure" mode the I/O space is identical to a real C64 instead of the C128 extended I/O which includes the VDC and two extra registers for the VIC. Also, the keyboard layout is modified, e.g. the keys on the numeric keypad map to the normal keys instead of the C128 extended keys.

c128_mister's People

Contributors

asturur avatar bbond007 avatar ch570512 avatar eriks5 avatar hno avatar lagomorph avatar makigumo avatar nanner55 avatar raparici avatar sajattack avatar sorgelig avatar stat-mat avatar tomxp411 avatar vpelletier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c128_mister's Issues

Support for Serial Service Request In for User Port

Hi,

I'm currently designing a new revision for the SNAC2IEC adapter together with venice1200. For the new revision I want to implement the Serial Service Request In line (C128 IEC port pin 1 used for Fast Serial Clock). Because C64 didn't use this signal there is currently no user IO pin defined for this signal. If I've checked correctly IO6 on the user port should be free to use. Therefore my question is if you can assign user port IO6 to the Serial Service Request In line even if the Fast Serial Clock isn't implemented on your core yet?

Thanks for the reply in advance.

In C128 mode disk images mounted in the internal drive can't be accessed when "external iec" is enabled

When in C128 mode and the "External IEC" option is enabled (but no external drive is attached), disk images mounted in an internal drive (using Mount #8 or Mount #9) can't be accessed (LOAD "$",8 hangs at SEARCHING FOR $).

This works fine in C64_Mister and even in the C64 mode of this core.

I noticed this in the 20240110 release, but I tested a few older releases and it seems it never worked.

VDC output jittery or noisy under certain conditions

Describe the bug
VDC output is jittery on analogue displays, and noisy on HDMI output in combination with certain video filters.

Expected behaviour
Output should be stable.

Additional context
This is caused by the asynchronous clocking of the VDC module.

Servant function ROM "Go 64" option does not work

Describe the bug
When using the Servant function ROM, the Go 64 function hangs instead of entering C64 mode

Links
boot2.rom attached
function-servant.zip

To Reproduce
Core settings irrelevant to triggering the bug. Start the machine with the function ROM in the internal function slot, press 9 (Go 64) at the Servant menu and press RETURN

Expected behavior
C64 mode is entered

Additional context
External function ROM slot not tested

Questions for the New MRA branch (Feature)

Hi,

I would like to thank for your work the C128 core. I follow commits !

I have a question regarding the MRA branch.
Is the MRA will become mandatory to use the C128 core ? Or it will be possible to continue to use boot rom's and custom kernal on the OSD ?

Normally MRA are use specifically for the Arcade Core and the Console or Computers core use MGL files.
MGL file also permits to have favorites and launch crt, prg directy on C64 core without start the core and load the game file in the OSD.

Thanks in advance for your return.

Multi Screen

Discussed in #17

Originally posted by trbocode February 22, 2023
I wondered about the possibility of multi screen in the core, mainly because its implemented in another core, the GBA2P.
I checked how its done over there, and its by cropping a large DRAM framebuffer that includes both video outputs - By telling the image is small on one side, and feeding the scaler the other side of it.
I am not too versed in FPGA development, so I don't know if its suitable here.

Regression - loading issue with Below the Root.

Observed on C128_20240110.rbf when loading Below the Root (GB64 version) the game crashes with JiffyDos, loads OK with stock kernal.

This issue isn't present on C128_20231209.rbf with JiffyDos enabled but can load if I force 1541 instead of leaving AUTO.

C128DCR Basic 8.mra

Hi,
many Thanks for this great Core!

I'am testing the MRAs and got the JiffyDOS (bought it) Version working.

But not the Basic 8 Version.
I dowloaded the Basic 8 Rom file from here
https://commodore.software/downloads/download/623-commodore-128-roms/12365-basic-8-rom
renamed the file to "basic-8-dst.rom", zipped it and get "md5 mismatch for rom 0" and after this "Missing/invalid boot0.rom/MRA" shown.

The MRA doesn't contain the MD5 for the "basic-8-dst.rom" file so I can't check the rom.
Any Idea what's wrong?

Cheers

AltGr (right Alt) not working on US keyboard

I am using a US keyboard and I am not able to get the AltGr (right Alt) key working. Right Alt works the same as left Alt. Example: AltGr F5 does not produce 'Help'. AltGr-F5 = 'run' (same as F6). AltGr-F1 = 'DLOAD"' (same as F2).

AltGr * does not change to 80 columns. It prints a symbol.

Missing key feature

Hi, the real C128 have two features:
pressing Commodore key during reset or power on, C128 start directly in c64 mode without the need to type "GO 64" in C128 basic
pressing Run/stop during power on or reset C128 start in monitor mode. this feature is very useful because if you reset c128+run/stop you do not lose the basic program in memory.
i notice if i press C= key (Windows key) while pressing core reset button on mister nothing happen, it do a standard reset. same with run/stop key pressed (END key)

Modifiying drive roms or IFR while using MRA does not work

Describe the bug
When using an MRA to load the core, Drive ROM (menu FC4) or Internal Function ROM (menu FC5) customization is overwritten by the MRA during boot.

To Reproduce

  • Boot from MRA
  • Load another drive rom set (OSD->Hardware->Drive ROMs)
  • Restart core from same MRA again
  • Drive ROMs will be ROMs from MRA, not rom set chosen in menu

Same for Internal Function ROM, and also cartridges if MRA contains an External Function ROM.

Expected behavior
ROMs loaded using FC menu feature should not be overwritten.

DesTerm 2.00 self-extracting executable crashes C128

Testing was against 7b4d77f

When attempting to run the DesTerm 2.00 self-extractor, the binary crashes (with a garbled display in 40-column mode or with a series of "RUN?" and "SCNCLR?" outputs in 80-column mode) instead of the expected extraction introduction screen.

Steps to reproduce:

  • Insert the attached d71 image in drive 8
  • Execute the following command:

DLOAD"DES200-1.SFX"

  • Once loaded, execute the command RUN

Expected output (from VICE 3.6.1) looks as follows on a 40-column screen:

vice-screen-2022121410492916

REU issues

Describe the bug
REU does not work properly in C128 and Z80 modes, seems to work fine in C64 mode

More investigation needed

VDC incorrect resolution bug and reset bug

I commented on your YouTube video "MiSTer FPGA C128 core first look" where I mentioned the serial port/modem capabilities. I downloaded and installed the latest core from here (Release 20220606). My MiSTeR is also fully updated. Using NTSC mode, V2 VDC, and default settings for everything else, I ran DesTerm 128 v2.0 available from here (run it from the DesTerm 128 v2.0 program.d64 disk image). When I ran the program it switches the VDC to some kind of Hi-Resolution mode that was way outside of the usable range of my flat screen monitor. I then hooked it up to a CRT VGA monitor that was able to display the screen but the aspect ratio and refresh rate were very strange, something like 1616x249 8.12KHz. After the program finishes loading (takes a long time, ~5 minutes) all of its modules, it puts the VDC back into a normal text-type mode which showed up correctly again with a normal resolution. But you might want to investigate why the VDC is corrupting the startup image and putting out a strange picture. Please see the picture below showing what it should look like and the photos of how its coming out.
desterm 128 v2 0
PXL_20220622_035904008
PXL_20220622_035917635

Also, a different bug was observed where the core would not reset properly or at all using the Reset selection on the MiSTeR F12 menu. Only a cold reboot would restore the core to normal operation.

The C64 UART Modem functionality did work, although it was not very reliable and would stop functioning sometimes for unknown reasons. Only a cold restart would make it work again. But this is not necessarily the fault of the C128 core because I've also found it to be unreliable on the C64 core too using CCGMS and NovaTerm. I'll continue to test it and report issues found if you're able to correct any of them.
Thanks!

80 columns screen noisy

80 columns screen is very noisy and off centre on the right
40 columns screen is rock solid and stable
i'm using HDMI out

Dag Erik

Erik,

Werk je nog aan je concept verder? Ik ben een C128 fan en zou graag met je willen spreken over je verdere implementaties indien mogelijk van je FPGA. Ik woon in België.

Er zullen veel mensen zijn die je concept zullen willen.
Wat je zou moeten beschouwen, is dat de 8563 Video Display Controller (VDC) 64K zou moeten bevatten, zodat de video display in 640x400 resolutie kan werken!

Laat je aub iets weten?
Ik heb een eigen GITHUB site, volg gewoon mijn repos.

Sven

D81 formatting fails

Testing was performed on commit 7b4d77f

When attempting to format a d81/1581 image, formatting never complates. Steps to reproduce:

  • Mount d81 disk image in drive 8
  • Issue the command:

HEADER"MYDISK",IMD

  • Respond to the "ARE YOU SURE?" prompt with Y

The format attempt will never return. This does not occur with g71/1571.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.