ThorstenBr / A2DVI-Firmware

Firmware project for the Apple II A2DVI digital video card
MIT License
30 stars 7 forks source link
6502 appleii dvi hdmi pico retrocomputing

A2DVI Firmware: Digital Video for Apple II Computers

This is a firmware project for a digital DVI/HDMI video card for Apple II. It directly produces a digital video stream from the Apple II's memory content. The signal is output via an HDMI connector, connecting the Apple II to modern displays with HDMI (or DVI) inputs. No more analog signal conversion required.

A2DVI PCB v2.0

A2DVI PCB v1.2

The project is a collaboration with Ralle Palaveev. His related hardware project is here:

The hardware is based on the PICO controller board. Both, original PICO (RP2040) and newer PICO2 (RP2350) modules are supported. Separate firmware is provided for the two PICO variants.

PICO_vs_PICO2

Currently, there is no difference in A2DVI functionality when using PICO or PICO2. PICO2 is pin-compatible but has a more powerful CPU, more memory, more flash and improved I/O. However, the original PICO is capable enough for A2DVI - and still has resources available for future extensions.

About the A2DVI-Firmware

The firmware is based on a combination of the Apple II VGA firmware projects by Mark Aikens and David Kuder. The DVI signal generation is based on the PicoDVI library by Luke Wren. However, A2DVI uses custom rendering code, to convert the Apple II memory content to a "TMDS" bit stream directly - skipping the intermediate step of generating a VGA buffer for PicoDVI first.

Here's a brief look at the architecture:

                      +-------------------------------------------------------------------------+
                      |                   PICO Microcontroller (RP2040 or RP2350)               |
                      |                                                                         |
     +------+         |     +---------+         +-----------------+        +-----------------+  |
     | 6502 |_________|_____| PIO #1  |_________|   ARM Core #1   |________|   ARM Core #2   |  |
     | CPU  |  Apple  |GPIO |I/O State|  32bit  |6502 bus snooping| Shared |PICO DVI + custom|  |
     +------+   Bus   |Pins | Machine |  FIFO   |memory shadowing | Memory |  TMDS rendering |  |
                      |     +---------+         +-----------------+        +-------+---------+  |
                      |                                                         DMA|1.2GByte/s  |
                      |                                                       +----+----+       |
                      |                                                       | PIO #2  |       |
                      |                                                       |I/O State|       |
                      |                                                       | Machine |       |
                      |                                                       +---+++---+       |
                      |                                                       GPIO|||3x252mbit/s|
                      +-----------------------------------------------------------|||-----------+
                                                                            +-----+++------+
                                                                            |HDMI connector|
                                                                            | 640x480@60Hz |
                                                                            +--------------+

Configuration

The firmware supports various configuration properties. There are configuration utility disks for ProDOS and DOS3.3.

You can also manually type and save the configuration program. It takes just 15 lines of BASIC. See here for more.

Config Utility

Config Utility Page 2

Machine Type

The A2DVI firmware tries to auto-detect your machine type - and adjusts various features and register sets accordingly.

This also automatically adjusts the character set, if the current selection does not match the machine (with firmware >= v1.1):

If you do not want the automatic font switching (i.e. you want to use an Apple II font on the IIe), then disable the auto-detection by setting a fixed machine type.

If your A2DVI is installed in a specific/fixed machine, it's recommended to set "machine type" to the matching fixed type.

DVI/HDMI Resolution

Choose between 640x480@60Hz or 720x480@60Hz video output:

Rendering Options

The following screenshots show a comparison of double-HIRES with analog effects disabled (plain rendering) and with the effects enabled:

A2DVI Rendering Options

PAL vs NTSC

The config option offers an option to chose between PAL and NTSC. This currently only has marginal effects, e.g. changes the flashing frequency for Apple //e (differed between NTSC and PAL).

Built-in Fonts

The firmware has built-in support for various fonts. Additional custom fonts can be uploaded using normal Apple II/IIe video ROM binaries.

Included fonts for Apple IIe:

Included fonts for Apple II:

Custom Fonts

Custom video ROMs for Apple II and IIe are supported and can be uploaded with the ProDOS/DOS configuration utility.

Supported formats:

The configuration utility automatically detects the correct format of the uploaded video ROM (based on the file size), since the Apple II and IIe video ROMs used different formats (bit reversed & inverted).

A2DVI Custom Fonts

Configurable Custom Switch/Push-Button

Advanced control options for the "language rocker switch" of your Euro-Apple IIe are configurable. For machines without this switch, you can install a custom push button or rocker switch and connect it to the "ALTCHR" input of A2DVI.

The switch normally toggles the machine's character set (local language vs US character set). You can enable advanced behavior, so quickly rocking the switch back and forth changes the display mode. So you no longer need to enter the configuration menu in order to change between color, monochrome or other display modes.

Menu options for switching behavior:

Use the ALTCHR language switch (Euro-Machines) or connect a custom switch/push-button to quickly cycle the available display modes:

A2DVI Cycle Video Modes

The new display configuration is briefly shown below the screen area when using the rocker switch/push button to cycle the mode:

A2DVI Mode Display

See here for more details about the installation of a custom external switch / connecting to the language rocker switch.

Dual Language Support for Euro-Machines

The A2DVI-Firmware has dual language support. If you have a "Euro-Apple IIe" with the language switch on the bottom side of your Apple II keyboard, then select "ALTCHR SWITCH: TOGGLE CHARACTER SET" (or one of the advanced modes) in the configuration utility and select, both, the primary and secondary character set (primary is any font/character set, secondary is any US character set).

If you don't know what the language switch on the Euro Apple IIs was for, see this video: https://www.youtube.com/watch?v=cvEjy_uI0gY

In order for the language switch to work, an additional wire needs to be installed. Connect the single pin on the A2DVI card to the language switch signal "ALTCHR", at J19, front pin facing towards the keyboard:

Wiring the language switch

Language Rocker Switch

Video7 Support

Video7 provided additional color text and video modes for the Apple IIe. Some of these modes were also available with other video cards, like the "Apple Extended 80 column Text/AppleColor Card".

A2DVI supports these extended video modes - even if your Apple IIe only has a standard 80 column card (and no extended video card).

The extra video modes:

The following photo shows the difference of the default vs enhanced DHGR video mode (as supported by DazzleDraw). This video mode provides a mix of 140x192 pixels in 16 colors (just like default DHGR), but uses an unused 8th data bit to switch to a 560pixel/line monochrome resolution for a block of 7 bits:

Video7

Another example showing the Video7 16color with hires monochrome pixel mix mode:

Video7

Videx Support

Stock Apple IIs did not support 80 column display. A popular extension were "Videx" video cards, which provided 80 column support - and support for various character sets.

A2DVI is able to display the Videx 80 column video mode on an Apple II. Enable the Videx support by selecting the Videx character set in the menu (US, German, French, Spanish, ...).

The Videx support of A2DVI is currently "passive" only:

A2DVI Videx

RAMWorks Support

If your Apple //e has installed a RAMWorks-compatible memory expansion (>128KB), then enable the "RAMWorks" option in the menu. RAMWorks introduced a new register which changed the memory bank switching behavior, which A2DVI needs to know about.

Debug Monitor

The configuration menu offers a debugging feature. Enabling the "DEBUG MONITOR" shows extra lines above and below the normal Apple II screen (in red):

A2DVI Debug Monitor

The first line shows the status of switches controlling Apple II's video subsystem:

The second line shows soft switches controlling Apple II(e)'s memory subsystem:

The line below the Apple II screen shows 6502 activity:

The displayed program counter and stack pointer isn't exact science. Of course, the 6502 runs to far quickly to see all addresses. And the card doesn't know the register contents of the 6502, however, it sees every bus cycle and every memory access. So it sees access to the stack area (0x100-0x1ff) and the addresses of instruction fetches. This can be helpful when debugging a program. It's also just cool (though maybe a bit nerdy :) ) to be able to see what the 6502 is currently doing.

ROMX Support

The A2DVI firmware supports the font selection protocol of ROMX/ROMXe devices.

Startup Diagnostics

When the Apple II does not appear to boot, a diagnostics screen is displayed instead, showing the state of the 6502 bus. This may become helpful with certain type of Apple II mainboard defects.

A2DVI Startup Diagnostics

Photos

Here are some photos showing A2DVI in action - using the DVI/HDMI connection.

Yes, I know you cannot tell from blurry photos whether these were from an analog or digital connection - or even from an emulator. But - trust me... :D

Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4 Screenshot 5 Screenshot 7 Screenshot 6

Firmware Updates

Firmware updates of an A2DVI card are easy and safe:

  1. Switch off your Apple II. (It's otherwise safe to update the A2DVI card while it is still plugged in the Apple II.)
  2. Press the white "BOOTSEL" button on top of the A2DVI's PICO module. Keep the button depressed.
  3. While the button is still depressed, connect the USB cable between your PC/Mac and the PICO module.
  4. Your PC/Mac should recognize a new mass storage device.
  5. Drag & drop the firmware file from the Release's ZIP-file (e.g. "A2DVI-vX.Y.uf2", see Releases) to the mass storage drive.
  6. After 2 seconds the LED should light up. The firmware update is complete.
  7. Disconnect the USB cable. Switch on the Apple II... :)

A2DVI Firmware Update

Project Status: Completed Features

License

The A2DVI firmware is released under the MIT License:

A2DVI was an idea by Ralle Palaveev. His matching hardware project:

The firmware project is based on awesome work from the following Apple II Analog VGA projects:

This project uses a customized variant of the PicoDVI library - and reuses many of Luke's genius ideas for the custom Apple II to DVI/TMDS encoding:


Apple II Forever!