Emulation

From F256 Foenix
Jump to navigationJump to search

FoenixIDE

The FoenixIDE provides emulation of various Foenix Retro Systems including,

System Descripton
F256K(816) The F256K computer with integrated keyboard and WDC65C816 processor.
F256K The F256K computer with integrated keyboard and WDC65C02 processor.
Jr(816) The F256 Jr. computer with a WDC65C816 processor.
Jr The F256 Jr. computer with a WDC65C02 processor.
U+ The C256 Foenix U+ (4Meg RAM Config) - Legacy
U The C256 Foenix U (2Meg RAM Config) - Legacy
C The C256 Foenix FMX - Legacy
B The C256 Foenix (original) - Legacy

Installation

The current Windows installation file (FoenixIDE.Setup.msi) and source code can be found here, https://github.com/Trinity-11/FoenixIDE/releases

Foenijs

A web-based emulator in development for the F256Jr and F256K, with 65c02.

Most of the primary functions work, including all text & graphics modes with raster effects, SD Card images, USB gamepads, and PSG square wave sound. SuperBASIC runs well, but a number of .pgz programs don't quite work fully yet.

A standout feature is the CPU and stack debugging support. If your program doesn't run correctly on here, and you'd like to help from the 65c02 side of things, contact user wf2 on the Foenix Discord.

https://www.white-flame.com/foenijs/

MAME

This emulator is currently under development (23 Mar 2025). See here: https://github.com/dtremblay/mame

Releases are published in GitHub and announced in Discord: https://discord.com/channels/691915291721990194/1330998392481906768

(a work-in-progress sdcard .img file containing many games, tools and media files prepared in March 2025 can be found here: https://github.com/Mu0n/F256MiscGoodies/tree/main/SDCard_Collection consult the readme of that page to get the right file)


MAME is available for Linux, Mac and Windows. Future development of the F256 machines will support the 6809 and 68000 processors.

Currently, only the F256K is partially implemented.

  • Memory Management Unit (MMU) at address $0
  • SD Card with SPI
  • Matrix Keyboard with VIA
  • Game Controllers: Atari Joysticks with VIA
  • Text display, Sprites, Tiles and Bitmaps (respecting the layers)
  • Interrupts: SOF, SOL, RTC, Timers, VIA0, VIA1
  • Timers: Real-Time Clock (RTC), Timer0 (at 25Mhz) and Timer1 (at SOF 60 or 70Hz)
  • Math processor
  • Random Number Generator (RNG)
  • Sound Chips: PSG (dual - stereo), OPL, SID (dual - stereo)
  • Direct Memory Access (DMA)

Unimplemented features:

  • UART (serial port)
  • IEC
  • CODEC
  • NES/SNES Game Controllers
  • PS/2 Mouse and Keyboard
  • WIFI
  • Buzzer and status LEDs
  • Debug port
  • DIP switches
  • External Memory Cartridge
How to Run MAME

MAME has quite an extensive list of features that can be enabled and disabled.

To run F256K in full screen mode:

./f256 f256k

To run in window mode:

./f256 f256k -window -resolution 800x600

To set a disk image (for the SD Card):

./f256 f256k -harddisk sdcard.img

To disable sound:

./f256 f256k -sound none

To collect logs:

./f256 f256k -log

Within MAME emulator, you can see the frame rate (in percent) by pressing the F11 key.

You can modify settings and key assignments using the TAB key.

You can see the debug console (to step in CPU memory and view memory values) using the back-tick key `.

Exit the emulator using the ESC key.

Note: all these keys can be modified, so these are the default settings.

Creating an SD Card Image to use in MAME Emulator and Foenix IDE

These instructions require a Linux Operating System or MinGW.

Create a blank image of 64 blocks of 1 MB:

dd if=/dev/zero of=sdcard.img bs=1M count=64


Partition the image:

parted sdcard.img --script mklabel msdos

parted sdcard.img --script mkpart primary fat32 1MiB 100%


You need to know the starting sector for the next step. To find the starting sector: fdisk -l sdcard.img

You'll get something like this:

Device Boot Start End Sectors Size Id Type

sdcard.img1 2048 131071 129024 63M c W95 FAT32 (LBA)

The starting sector is "2048" in the listing above.


Create a Loop Device for Formatting

Map the partition to a loop device:

sudo losetup -o $((2048 * 512)) --sizelimit $((129024 * 512)) /dev/loop0 sdcard.img


Format it: sudo mkfs.vfat -F 32 /dev/loop0

Detach it: sudo losetup -d /dev/loop0

The disk image is now ready, but it's empty. To copy files into the disk, you need to mount it. After it's mounted, you can copy files to it.


mkdir /mnt/f256

sudo mount -o loop,offset=$((2048 * 512)) sdcard.img /mnt/f256

cp myfile.txt mnt/

sudo umount mnt