Giter VIP home page Giter VIP logo

box16's Introduction

Box16

Build status
Release

This is an emulator for the Commander X16 computer system. Unlike the official emulator, this has a few more dependencies, see the build instructions below. It compiles on Windows, Debian Linux, and Raspbian, and probably other Linux-based platforms.

Don't expect official "releases" until the physical X16 is out. Until then, there will be "non-releases" of Box16. Since this is originally forked from the Official X16 emulator, the goal is to remain fully compatible with the Official X16 emulator, but with feature-adds such as ImGui displays, and performance improvements from OpenGL acceleration.

Some of the feature-adds will be prototype or preview in nature, as this is also my platform for fixing bugs and adding features to the official emulator.

Features

  • CPU: Full 65C02 instruction set
  • VERA
    • Mostly cycle exact emulation
    • Supports almost all features:
      • composer
      • two layers
      • sprites
      • VSYNC, raster, sprite IRQ
  • Sound
    • PCM
    • PSG
    • YM2151
  • SD card: reading and writing (image file)
  • VIA
    • ROM/RAM banking
    • keyboard
    • mouse
    • gamepad
    • Counters/timers/IRQs

Missing Features

  • VERA
    • Does not support the "CURRENT_FIELD" bit
    • Interlaced modes (NTSC/RGB) don't render at the full horizontal fidelity

Binaries & Compiling

The emulator itself is dependent on SDL2 and OpenGL. However, to run the emulated system you will also need a compatible rom.bin ROM image. This will be loaded from the directory containing the emulator binary, or you can use the -rom .../path/to/rom.bin option.

WARNING: Older versions of the ROM might not work in newer versions of the emulator, and vice versa.

You can build a ROM image yourself using the build instructions in the x16-rom repo. The rom.bin included in the latest release of the emulator may also work with the HEAD of this repo, but this is not guaranteed.

Linux Build

Read resources/r41/README.box16 and build or acquire the necessary files.

The needed development packages are available as a distribution package with most major versions of Linux:

  • Debian: sudo apt-get install libgtk-3-dev libsdl2-dev
  • Fedora 37: sudo dnf install gtk3-devel SDL2-devel alsa-lib-devel
  • Raspbian: sudo apt-get install libgtk-3-dev libsdl2-dev
  • Ubuntu: sudo apt-get install build-essential libsdl2-dev libgtk-3-dev

Type make to build the source. The output will be box16 in the output directory. Remember you will also need a rom.bin as described above.

Windows Build

Read resources/r41/README.box16 and build or acquire the necessary files.

Install Microsoft Visual Studio Community 2022, make sure to include the following modules:

  • Desktop development with C++

Open build\vs2019\box16.sln with Visual Studio Community 2022. Select Build All from the Build menu.

The built .exe and associated files should be located in build\vs2022\out, plus a few more subdirectories based on the exact build generated.

Releases

As of 3 May 2022, the only release process is to package up the Windows builds. Creating these packages are meant as a convenience for Windows users who may not be willing to build Box16 for themselves.

Building release zips

Follow the instructions for making a Windows build, above.

Install the Windows Subsystem for Linux (WSL2). See the instructions at https://docs.microsoft.com/en-us/windows/wsl/install. As of 27 April 2022, most of this should be as simple as running "wsl --install" from a PowerShell or Windows Command Prompt with administrator permissions.

The needed development packages are available as a distribution package with most major versions of Linux, even for WSL2.

  • Debian: sudo apt-get install p7zip-full
  • Raspbian: sudo apt-get install p7zip-full

In the Linux shell, go to the build directory from your Box16 repository directory.

Type make release to create all the zip files.

Starting

You can start box16/box16.exe either by double-clicking it, or from the command line. The latter allows you to specify additional arguments.

  • When starting box16 without arguments, it will pick up the system ROM (rom.bin) from the executable's directory.
  • -abufs <number> Is provided for backward-compatibility with x16emu toolchains, but is non-functional in Box16.
  • -bas lets you specify a BASIC program in ASCII format that automatically typed in (and tokenized).
  • -create_patch <patch_target.bin> creates a ROM patch file, which can then patch the current ROM to match the specified patch target.
  • -debug <address> adds a breakpoint to the debugger.
  • -dump {C|R|B|V} configure system dump (e.g. -dump CB):
    • C: CPU registers (7 B: A,X,Y,SP,STATUS,PC)
    • R: RAM (40 KiB)
    • B: Banked RAM (2 MiB)
    • V: Video RAM and registers (128 KiB VRAM, 32 B composer registers, 512 B pallete, 16 B layer0 registers, 16 B layer1 registers, 16 B sprite registers, 2 KiB sprite attributes)
  • -echo [{iso|raw}] (e.g. -echo iso) causes all KERNAL/BASIC output to be printed to the host's terminal. Enable this and use the BASIC command "LIST" to convert a BASIC program to ASCII (detokenize):
    • By default, everything but printable ASCII will be escaped.
    • iso will escape everything but non-printable ISO-8859-1 characters and convert the output to UTF-8.
    • raw will not do any substitutions.
  • -gif <file.gif>[,wait] records frames generated by the VERA to the specified gif file (e.g. -gif capture.gif or -gif capture.gif,wait)
    • Recording normally begins immediately.
    • ,wait will begin the gif file, but immediately pause recording.
    • POKE $9FB5,0 will pause GIF recording
    • POKE $9FB5,1 will snapshot a single frame
    • POKE $9FB5,2 will unpause GIF recording
  • -help lists all command line options and then exits.
  • -hypercall_path <path> sets the default path for all LOAD and SAVE calls to BASIC and the kernal.
  • -ignore_ini will ignore the contents of any ini file that Box16 might be aware of. This option is not saved to the ini file.
  • -ignore_patch will ignore the contents of any patch file that Box16 might be aware of.
  • -ini <custom.ini> will allow manually specifying an ini file for Box16 to use.
  • -keymap tells the KERNAL to switch to a specific keyboard layout. Use it without an argument to view the supported layouts.
  • -log enables one or more types of logging (e.g. -log KS):
    • K: keyboard (key-up and key-down events)
    • S: speed (CPU load, frame misses)
    • V: video I/O reads and writes
  • -nobinds will disable most emulator keyboard bindings, allowing the X16 to see most keys and key chords.
  • -nohostieee will disable IEEE-488 hypercalls. These are normally enabled unless an SD card is attached or -serial is specified.
  • -nopanels will disable loading panel settings from the ini file. This option is not saved to the ini file.
  • -nopatch is an alias for -ignore_patch.
  • -nosound can be used to specify that the audio subsystem should not be enabled in the first place. This is incompatible with -sound.
  • -nvram lets you specify a 64 byte file for the system's non-volatile RAM. If it does not exist, it will be created once the NVRAM is modified.
  • -patch <patch.bpf> specify a patch file to apply to the current ROM.
  • -prg lets you specify a .prg file that gets injected into RAM after start.
  • -quality {nearest|linear|best} lets you specify video scaling quality.
  • -ram <ramsize> will adjust the amount of banked RAM emulated, in KB. (8, 16, 31, 64, ... 2048)
  • -rom <rom.bin> will allow you to override the KERNAL/BASIC/ROM file used by the emulator.
  • -rtc will set the real-time clock to the current system time and date.
  • -run executes the application specified through -prg or -bas using RUN or SYS, depending on the load address.
  • -save_ini will save Box16's settings to an ini file (at a default location, unless otherwise specified with -ini)
  • -scale {1|2|3|4} sizes the Box16 window to scale video output to an integer multiple of 640x480. (e.g. -scale 2)
  • -sdcard <sdcard.img> lets you specify an SD card image (partition table + FAT32).
  • -serial Enables serial bus emulation (experimental).
  • -sound <device> lets you specify a specific sound device to use. If given an improper device or no device, will list all audio devices and exit. Incompatible with -nosound.
  • -stds will automatically load all kernal and BASIC labels, if available.
  • -sym <filename> will load a VICE label file. Note that not all VICE debug commands are available. (e.g. -sym myprg.lbl)
  • -test {0, 1, 2, 3} will automatically invoke the TEST command with the provided test number.
  • -verbose enables additional output messages from Box16.
  • -version will print the version of Box16 and then exit.
  • -warp causes the emulator to run as fast as possible, possibly faster than a real X16.
  • -wav <file.wav>[{,wait|,auto}] records audio to the specified wav file (e.g. -wav audio.wav or -wav audio.wav,wait)
    • Recording normally begins immediately.
    • ,wait will start with recording paused.
    • ,auto will start with recording paused, but recording will automatically start at the first non-zero audio signal.
    • POKE $9FB6,0 will pause wav recording
    • POKE $9FB6,1 will unpause wav recording
    • POKE $9FB6,2 will unpause wav recording at the fist non-zero audio signal
  • -vsync {none|get|wait} uses specified vsync rendering strategy to avoid visual tearing. Some drivers may not support all types of vsync.
    • none: Use if the content area remains white after start. Disables vsync.
    • get: Default, should work with OpenGL ES >= 3.0
    • wait: Alternative, should work with OpenGL >= 3.2
  • -ymirq will enable interrupts from the YM2151 audio chip (this is disabled by default to match the behavior of the official emulator r38)
  • -ymstrict will enable strict enforcement of the YM2151's busy status, dropping writes to the chip if it's busy at the time of write (this is disabled by default to match the behavior of the official emulator r38)

Run box16 -help to see all command line options.

Keyboard Layout

The X16 uses a PS/2 keyboard, and the ROM currently supports several different layouts. The following table shows their names, and what keys produce different characters than expected:

Name Description Differences
en-us US [`] ⇒ [←], [~] ⇒ [π], [\] ⇒ [£]
en-gb United Kingdom [`] ⇒ [←], [~] ⇒ [π]
de German [§] ⇒ [£], [´] ⇒ [^], [^] ⇒ [←], [°] ⇒ [π]
nordic Nordic key left of [1] ⇒ [←],[π]
it Italian [\] ⇒ [←], [|] ⇒ [π]
pl Polish (Programmers) [`] ⇒ [←], [~] ⇒ [π], [\] ⇒ [£]
hu Hungarian [\] ⇒ [←], [|] ⇒ [π], [§] ⇒ [£]
es Spanish [|] ⇒ π, \ ⇒ [←], Alt + [<] ⇒ [£]
fr French [²] ⇒ [←], [§] ⇒ [£]
de-ch Swiss German [^] ⇒ [←], [°] ⇒ [π]
fr-be Belgian French [²] ⇒ [←], [³] ⇒ [π]
fi Finnish [§] ⇒ [←], [½] ⇒ [π]
pt-br Portuguese (Brazil ABNT) [\] ⇒ [←], [|] ⇒ [π]

Keys that produce international characters (like [ä] or [ç]) will not produce any character.

Since the emulator tells the computer the position of keys that are pressed, you need to configure the layout for the computer independently of the keyboard layout you have configured on the host.

Use the F9 key to cycle through the layouts, or set the keyboard layout at startup using the -keymap command line argument.

The following keys can be used for controlling games:

Keyboard Key NES Equivalent
Ctrl A
Alt B
Space SELECT
Enter START
Cursor Up UP
Cursor Down DOWN
Cursor Left LEFT
Cursor Right RIGHT

Functions while running

  • Ctrl + R will reset the computer.
  • Ctrl + V will paste the clipboard by injecting key presses.
  • Ctrl + S will save a system dump (configurable with -dump) to disk.
  • Ctrl + F and Ctrl + Return will toggle full screen mode.
  • Ctrl + = and Ctrl + + will toggle warp mode.
  • Ctrl + A will attach the SD Card image, if available.
  • Ctrl + D will detach the SD Card image.

On the Mac, use the Cmd key instead.

GIF Recording

With the argument -gif, followed by a filename, a screen recording will be saved into the given GIF file. Please exit the emulator before reading the GIF file.

If the option ,wait is specified after the filename, it will start recording on POKE $9FB5,2. It will capture a single frame on POKE $9FB5,1 and pause recording on POKE $9FB5,0.

PEEK($9FB5) returns a 0 if recording is disabled, 1 if recording is enabled but not active, 2 if snapshotting a single frame, and 3 if recording.

WAV Recording

With the argument -wav, followed by a filename, a audio recording will be saved into the given WAV file. Please exit the emulator before reading the WAV file.

If the option ,wait is specified after the filename, it will start recording on POKE $9FB6,1. If the option ,auto is specified after the filename, it will start recording on the first non-zero audio signal, or on POKE $9FB6,1. POKE $9FB6,0 will pause recording, and POKE $9FB6,2 will pause recording until the next non-zero audio signal.

PEEK($9FB6) returns 0 if recording is disabled, 1 if recording is enabled but not active, 2 if recording is paused waiting on a non-zero audio signal, and 3 if recording.

BASIC and the Screen Editor

On startup, the X16 presents direct mode of BASIC V2. You can enter BASIC statements, or line numbers with BASIC statements and RUN the program, just like on Commodore computers.

  • To stop execution of a BASIC program, hit the RUN/STOP key (Esc in the emulator), or Ctrl + C.
  • To insert characters, first insert spaces by pressing Shift + Backspaces, then type over those spaces.
  • To clear the screen, press Shift + Home.
  • The X16 does not have a STOP + RESTORE function.

SD Card Images

The command line argument -sdcard lets you attach an image file for the emulated SD card. Using an emulated SD card makes filesystem operations go through the X16's DOS implementation, so it supports all filesystem operations (including directory listing though DOS"$ command channel commands using the DOS statement) and guarantees full compatibility with the real device.

Images must be greater than 32 MB in size and contain an MBR partition table and a FAT32 filesystem. The file sdcard.img.zip in this repository is an empty 100 MB image in this format.

On macOS, you can just double-click an image to mount it, or use the command line:

# hdiutil attach sdcard.img
/dev/disk2              FDisk_partition_scheme
/dev/disk2s1            Windows_FAT_32                  /Volumes/X16 DISK
# [do something with the filesystem]
# hdiutil detach /dev/disk[n] # [n] = number of device as printed above

On Linux, you can use the command line:

# sudo losetup -P /dev/loop21 disk.img
# sudo mount /dev/loop21p1 /mnt # pick a location to mount it to, like /mnt
# [do something with the filesystem]
# sudo umount /mnt
# sudo losetup -d /dev/loop21

On Windows, you can use the OSFMount tool.

Host Filesystem Interface

If the system ROM contains any version of the KERNAL, and there is no SD card image attached, the LOAD ($FFD5) and SAVE ($FFD8) KERNAL calls (and BASIC statements) are intercepted by the emulator for device 8 (the default). So the BASIC statements will target the host computer's local filesystem:

  LOAD"$
  LOAD"FOO.PRG
  LOAD"IMAGE.PRG",8,1
  SAVE"BAR.PRG

Note that this feature is very limited! Manually reading and writing files (e.g. OPEN in BASIC) is not supported by the host filesystem interface. Use SD card images for this.

The emulator will interpret filenames relative to the directory it was started in. On macOS, when double-clicking the executable, this is the home directory.

To avoid incompatibility problems between the PETSCII and ASCII encodings, you can

  • use lower case filenames on the host side, and unshifted filenames on the X16 side.
  • use Ctrl+O to switch to the X16 to ISO mode for ASCII compatibility.
  • use Ctrl+N to switch to the upper/lower character set for a workaround.

Dealing with BASIC Programs

BASIC programs are encoded in a tokenized form, they are not simply ASCII files. If you want to edit BASIC programs on the host's text editor, you need to convert it between tokenized BASIC form and ASCII.

  • To convert ASCII to BASIC, reboot the machine and paste the ASCII text using Ctrl + V (Mac: Cmd + V). You can now run the program, or use the SAVE BASIC command to write the tokenized version to disk.
  • To convert BASIC to ASCII, start box16 with the -echo argument, LOAD the BASIC file, and type LIST. Now copy the ASCII version from the terminal.

Using the KERNAL/BASIC environment

Please see the KERNAL/BASIC documentation.

Debugger

There are a number of debugging windows that can be displayed:

  • Two independent memory dump windows.
  • A disassembly and CPU status window.
  • A VERA memory dump and status window.

The debugger keys are similar to the Microsoft Debugger shortcut keys, and work as follows

Key Description
F1 resets the shown code position to the current PC
F2 resets the 65C02 CPU but not any of the hardware.
F5 is used to return to Run mode, the emulator should run as normal.
F9 sets the breakpoint to the currently code position.
F10 steps 'over' routines - if the next instruction is JSR it will break on return.
F11 steps 'into' routines.
F12 is used to break back into the debugger.

The STP instruction (opcode $DB) will break into the debugger automatically.

Effectively keyboard routines only work when the debugger is running normally. Single stepping through keyboard code will not work at present.

Forum

https://www.commanderx16.com/forum/

Wiki

https://github.com/commanderx16/x16-emulator/wiki

License

Copyright (c) 2019-2023 Michael Steil <[email protected]>, www.pagetable.com, et al.
Portions copyright (c) 2021-2023 Stephen Horn, et al.
All rights reserved. License: 2-clause BSD

Release Notes

Non-Release 41.1 ("Koutoubia Mosque")

  • Improved hypercall performance
  • -ignore_patch is now saved to ini file.
  • Saving which panels are open.
  • Keymappings now match r41 kernal.
  • Optimized VIA timer implementation.
  • Moved imgui.ini location to match box16.ini
  • Added -nohypercalls to disable all hypercalls.
  • Added VERA feature: AUDIO_CTRL bit 6 FIFO_EMPTY (ZeroByteOrg)
  • Improved parsing of addresses when loading symbols from a VICE Label File. (claudiobrotto)
  • Improved framerate consistency for 60Hz displays, possibly others too.
  • Added -noemucmdkeys from x16emu (aliased to -nobinds)
  • Added -wuninit from x16emu to print a warning when the X16 accesses uninitialized RAM.
  • Added -randram from x16emu to randomize the contents of RAM, more closely matching hardware behavior.
  • Added -widescreen from x16emu to display the X16's graphics in a widescreen format instead of the default 4:3.
  • Disassembler improvements:
    • Disassembler now follows into current RAM and ROM bank.
    • Added inline buttons to toggle breakpoints in disassembler.
    • Added 'F9' to toggle breakpoint on current instruction.
  • Ported fixes/updates from x16emu:
  • Bugfixes:
    • Fixed warp mode toggling.
    • Fixed YM busy flag when emulator audio is disabled.
    • Fixed crash on Linux when listing directories with subdirectories.
    • Disabled patch loading when patch path exists but is empty. (jburks)
    • Fixed RTC to increment on CPU simulation.
    • Fixed various false-positives in a check that disabled v-sync.
    • Pulled fix from Imgui to fix docked windows when the window is minimized.
    • Fixed display of 16x16x1 w/ t256c tiles.
    • Fixed empty default set to dump when the X16 detects a crash condition
    • Fixed VIA writes to IFR registers

box16's People

Contributors

akumanatt avatar biermanncarl avatar claudiobrotto avatar cnelson20 avatar cosmicr avatar flightcontrol-user avatar frosty-j avatar indigodarkwolf avatar irmen avatar jburks avatar mooinglemur avatar pontaoski avatar zerobyteorg 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

box16's Issues

ini file can't be found when launched from another directory.

At some point, I pulled out SDL_GetBasePath() as the directory root for finding files. I don't recall the reasons why, so I probably just thought it was unnecessary. However! Turns out this is important after all, if someone is in another directory and tries to invoke box16, box16 is now expecting the ROM, ini file, and other tidbits to be located in the directory that the command line is on, not the directory of the executable.

Since box16 is trying to maintain 100% compatibility with the official x16 emulator, it's important that this be addressed to restore the original locating behavior.

error in (absolute) path handling

I've observed a problem in the path handling when attempting to load a program with -prg.
It seems as if it prepends ./ to the path, if it's not relative:

/home/irmen/Downloads/spinner.prg
irmen@neptune  ➤  ./box16/box16 -prg ~/Downloads/spinner.prg 
Cannot open .//home/irmen/Downloads/spinner.prg!
irmen@neptune  ➤  ./box16/box16 -prg /home/irmen/Downloads/spinner.prg 
Cannot open .//home/irmen/Downloads/spinner.prg!

It works fine if you supply a relative path.
This is on Manjaro/Arch Linux.

Feature Request: make debug

It would be nice if the Makefile had a target debug that performed a build with the following changes:

  • No optimizations
  • Generates debugger symbol files
  • Enables -Wall and -Werror

Cleaning up the code to actually build under this new target is not required. This is a target for making sure the code is very clean, and eventually (once it builds) making it easier for Linux contributors to debug their work.

Bug: Box16 doesn't actually run at "realtime" speed.

It runs at ~98% realtime, even by its own arithmetic. This seems to be because the timing code doesn't consider the possibility that a frame plus a usleep call might result in the frame ever so slightly longer than 16,666μs, and doesn't allow subsequent frames to shave off the difference to make up for it.

Feature Request: Option to disable annoying keybinds

Default to "enabled bindings", but there should be an option to disable the annoying keybinds like Ctrl-S and Ctrl-R which, while certainly of some use to someone, broadly interfere with other applications as well which depend on those keychords.

Bug: Flickering in Sprite preview on Raspbian/Linux.

For some reason, the Sprite preview flickers between the "correct" sprite data and seemingly garbage data.

To reproduce:

  1. Start the emulator.
  2. MOUSE 1 in the console.
  3. Open the Sprite Settings overlay. (Windows -> VERA Debugging -> Sprite Settings)
  4. Observe flickering. Some mouse movement might be required.

Housecleaning: Alphabetize/update the usage text blob

Command line options have been added and removed, and some have changed behavior. While I think the set of command line options and their documentation is up-to-date, it would be easier to keep track of that if the list were sorted alphabetically, as opposed to the very ad-hoc jumble they're in right now.

VERA Monitor overlay crash

Setting H scale value to 0 crashes the emulator. This is easy to do inadvertently by backspacing the current value out of the input field when you intend to erase it and change it to something new.

Feature Request: Emulate SD card access on the host filesystem.

Being able to mount and work with SD card images and the FAT32 filesystem is great and all, but requires additional backend work from developers to create SD card images for their projects. Certainly, I had a fun adventure getting a toolchain that worked to my own satisfaction, only to be sorely disappointed when the ROM/kernal didn't actually support the operations I wanted to experiment with anyways. But that was then, and looking forward, it would be nice to not have to build an SD card image in order to have SD card emulation.

So wish list item: Emulate the SD card as if it were created from the local filesystem.

Feature Request: A/V export (mpeg, etc.)

There's gif exporting, there's wav exporting, it seems reasonable to consider welding these two ideas together somehow to export an A/V file. This is obviously more involved than the existing solutions, so this is longer-term, or something to do while we wait for updated hardware information and/or official emulator r40.

Feature Request: Dockable imgui windows

Imgui has a feature that can be enabled to make windows dockable to the edges of the display. It would be nice to enable this feature so folks can drag windows around and dock them where they wish. As part of this, it would be nice to split some of the ASM debugging functionality into separate windows. It may also be desirable, then, to change the default organization of windows, perhaps to emulate a certain large and popular IDE by a major software company. Or some other IDE that's popular among the community.

LOAD command doesn't work with latest develop ROM

I tested the latest development commit of box16 with the latest development commit of the ROM and found I was getting "File Not Found" errors when trying to load programs in the emulator. To clarify, I'm not using any sort of -sdcard argument, so this is an issue with loading from the current directory. I bisected the issue to commanderx16/x16-rom@dd66237 (or its parent commit, but I don't think it's that one). I'm guessing that the shifting of functions from moving things to the new bank messed up the function hooking. This isn't an issue with using the latest release ROM, but it's something to keep in mind for the next release.

Feature Request: Interface for external debugging

It would be nice if folks could launch Box16 in such a way that they could "attach" to it with an external IDE like Atom or VS Code, or even Visual Studio (or maybe GDB?) and be able to set breakpoints, step through their code, inspect machine state, etc., etc., just as one might when debugging some native executable with debugging information.

This is currently very open-ended in its definition and scope. Personally, I don't have a lot of insight into the technical side of this (yet).

Feature Request: Optional CRT filter for NTSC mode

One of the things I'd like to take advantage of, with there being OpenGL acceleration now, is fragment shaders to apply a display device filter, specifically a CRT filter that can be enabled when outputting in NTSC mode. It would be nice if this were more than just "add scanlines": Color mixing and phosphor glow effects would be good, generally trying to mimic the full texture and feel of a CRT.

See also:
https://www.vice.com/en/article/qj83yp/final-fantasy-remasters-reignite-controversies-over-pixel-art
https://twitter.com/CRTpixels

Feature Request: Cache individual waveform renderings

This would be a nice-to-have feature for rendering PSG and eventually YM2151 channel data. For the effect I'm thinking about, consider the following Youtube videos:
https://www.youtube.com/watch?v=iLWF1vEbOuc
https://www.youtube.com/watch?v=OfcYpfxipvU

It may be worth experimenting with how to present this data as well, such as finding a way to align it cleanly the way the above videos do. Perhaps centered on the midpoint between the maximum signal value and the minimum signal value?

Writing to VIA IFR doesn't clear the set bits

When writing to IFR, it should clear any bits that are set in the write. (bar bit 7, which should be preserved)

image

This disables VIA interrupts, and then should clear the bits.

10 poke $9f0e, $7f
20 a=peek($9f0d)
30 print a
40 poke $9f0d, a
50 print peek($9f0d)

expected:
image

Emulator:
image

Port hypercall changes from x16emu

x16emu now hooks ACPTR and MACPTR, among others, instead of SAVE and LOAD.

The point of the new hypercalls on x16emu is to better emulate filesystem access times on the emulator. It might be worth keeping SAVE and LOAD, depending on a hypercall emulation setting, but the point in any event is to maintain compatibility with x16emu.

Feature Request: Add CPU stack view next CPU status on ASM Monitor.

Just needs to be a literal list of bytes starting from $100 + SP and displaying through $1FF.

At some future point, adding a proper "callstack" that could show labeled addresses and record which pushes came from jsr or interrupts vs. other pushes would be grand, as well.

Feature Request: Option to pause execution and open debug windows on `brk` instruction

It may be useful for folks writing debuggable software if the brk instruction can pause execution and open debugging windows, similar to the behavior of stp. This should be guarded by an option setting, though, and default to false, to maintain backwards compatibility with x16emu. Toggling the setting should be exposed through UI and a command-line option.

compilation errors with new gcc 12.1.0

Manjaro linux, gcc 12.1.0:

(note: similar errors occur when compiling the official emulator)

    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 64 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~
In function ‘void expand_4bpp_data(uint8_t*, const uint8_t*, int)’,
    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 80 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~
In function ‘void expand_4bpp_data(uint8_t*, const uint8_t*, int)’,
    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 96 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~
In function ‘void expand_4bpp_data(uint8_t*, const uint8_t*, int)’,
    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 112 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~
In function ‘void expand_4bpp_data(uint8_t*, const uint8_t*, int)’,
    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 128 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~
In function ‘void expand_4bpp_data(uint8_t*, const uint8_t*, int)’,
    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 144 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~
In function ‘void expand_4bpp_data(uint8_t*, const uint8_t*, int)’,
    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 160 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~
In function ‘void expand_4bpp_data(uint8_t*, const uint8_t*, int)’,
    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 176 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~
In function ‘void expand_4bpp_data(uint8_t*, const uint8_t*, int)’,
    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 192 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~
In function ‘void expand_4bpp_data(uint8_t*, const uint8_t*, int)’,
    inlined from ‘void render_sprite_line(uint16_t)’ at ../src/vera/vera_video.cpp:410:20,
    inlined from ‘void render_line(uint16_t)’ at ../src/vera/vera_video.cpp:747:21:
../src/vera/vera_video.cpp:371:22: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
  371 |                 *dst = (*src) & 0xf;
      |                 ~~~~~^~~~~~~~~~~~~~
../src/vera/vera_video.cpp: In function ‘void render_line(uint16_t)’:
../src/vera/vera_video.cpp:407:32: note: at offset 208 into destination object ‘unpacked_sprite_line’ of size 64
  407 |                 uint8_t        unpacked_sprite_line[64];
      |                                ^~~~~~~~~~~~~~~~~~~~

Feature Request: command line options to load additional files at boot

From @ZeroByteOrg:

Talking to MooingLemur last night, I had an idea that might make for a good enhancement (if my understanding of official R39 behavior now works)...
It's my understanding that HostFS now takes on the same speed (more or less) as SDimage due to the fact that the hook is now on ACPTR / MACPTR and not LOAD / SAVE

If that's the case, then it might be nice to add a commandline option to bootstrap-load additional files than just -prg

pglewis is doing that dancing baby demo, and was saying how each time he runs the program to test a change, it takes a while to load all the graphics and sound. So I thought a bootstrap load for arbitrary files to arbitrary locations in memory at startup might be a nice feature to speed up this sort of thing....
like -load file,addr -load file,addr -vload file,addr

Note that Box16 is still hooking LOAD and SAVE, it should probably hook ACPTR and MACPTR the way x16emu does now.

freezes when loading certain symbol files

The emulator freezes without showing a window or printing an error message when loading my symbol files.
Here's an example that triggers the issue:

al 8a6 .prog8_slabs
al 817 ._prog8_entrypoint
al 834 .cx16
al 862 .cx16:init_system_phase2
al 834 .cx16:init_system
al 871 .cx16:restore_irq
al 88a .cx16:restore_irq:_orig_irqvec
al 834 .c64
al 88c .prog8_lib
al 890 .prog8_lib:retval_interm_w
al 88d .prog8_lib:retval_interm_b
al 88c .prog8_lib:retval_interm_ub
al 892 .prog8_lib:orig_stackpointer
al 893 .prog8_lib:prog8_init_vars
al 88e .prog8_lib:retval_interm_uw
al 8a6 .prog8_program_end
al 825 .main
al 825 .main:_label
al 825 .main:start
al 832 .main:start:_prog8_breakpoint_1
al 833 .main:start:_label_local
; vice monitor breakpoint list now follows
; 1 breakpoints have been defined
del
break $832

This is an example of a combined symbol and breakpoints "mon list" file that Prog8 generates.
I think the freeze issue is triggered by the extra commands at the end.

The "mon list" file is basically a list of commands that the Vice monitor executes before launch. Command line option ref
As such it can contain any command the vice monitor accepts also when typed in interactively, there are quite a few!
But I only use it for 2 things: to define labels and to define breakpoints. So prog8 outputs symbol/monlist files containing:

  • al short for add-label
  • del short for delete that (without arguments) deletes all currently defined breakpoints just to make sure only the defined breakpoints in the program remain active
  • break short for breakpoint
  • ; line comment

Error in relative path handling

Copied from Discord:

JimmyDansbo — Today at 3:05 PM
When starting box16 with the -rom option it assumes that the path provided is from the box16 executables directory instead of the current directory

Sepia — Today at 3:54 PM
Well, it had been the other way at one point, assuming the path provided was relative to where the command line was located, but the original emulator assumes the path is the box16 executables directory, so that was a compatibility-breaking change and I put it back.
So you can bug it on Github, but unfortunately it's not going to be fixed unless I decide to intentionally break compatibility with the official emulator.

ZeroByte — Today at 4:07 PM
what happens if you specify an absolute path on the cmdline?
e.g. -rom ./myrom.bin
or -rom /home/user/somedir/myrom.bin
ok - decided to just test it... @JimmyDansbo - absolute paths beginning with / will use any location.
at least it does in Linux

JimmyDansbo — Today at 4:12 PM
Sure, absolute paths will always work, but normal behavior for a program is to use current working directory as a reference instead of using the directory where the binary is located.
In my home directory, I have x16-rom directory and box16 directory. If start box16 from my home directory with the following command: box16/build/box16/box16 -rom x16-rom/build/x16/rom.bin it will not work

ZeroByte — Today at 4:14 PM
hmm - gonna try the official emu in a similar vein

JimmyDansbo — Today at 4:14 PM
official emu works as every other linux program 😉

ZeroByte — Today at 4:18 PM
hahaha - I just found a bug in the official emu
x16emu -rom .
it boots the emu with null ROM instead of giving "cannot open rom.bin" error msg.
it tries to open the directory itself as if it were the ROM file
okay, so the official emu's behavior is as follows:
if -rom is specified, search relative to the PWD at execution time
else look in exe directory

JimmyDansbo — Today at 4:20 PM
hehe
Yeah, that would be the normal way of doing it for any binary on linux

DesertFish — Today at 4:27 PM
if -rom is specified, search relative to the PWD at execution time
else look in exe directory
I think it now always looks in exe dir regardless of parameter
(I requested the change to look in exe dir for the rom.bin as default)

ZeroByte — Today at 4:46 PM
I've tried a bazillion permutations on the official emu. If -rom is not specified, then it looks in the exe directory, and only there. If -rom is specified on the cmd line, then that is opened relative to the PWD.

JimmyDansbo — Today at 4:47 PM
Yes, but box16 does not try to open rom relative to current working directory

ZeroByte — Today at 4:49 PM
Sepia stated that he didn't want to break compatibility so I thought I'd give it a thorough putting through its paces just to make sure.

DesertFish — Today at 4:50 PM
My use case is the situation where -rom is not specified

ZeroByte — Today at 4:53 PM
And for a final check - I ran box16 from somewhere different than either the specified ROM or the specified PRG arguments, using only relative paths to reach each one. box16 clearly builds rom path relative to the exe in all cases, and prg path relative to PWD
Sepia - just so you don't miss this in the TL;DR thread above- the official emu uses PWD-relative path for the -rom argument if provided, else EXE directory if not specified.

Sepia — Today at 5:01 PM
I see. Okies, that's totally a valid bug then. I'll see if I can fix it properly this time. 😛

Palette shows colour values in RGBA

This is probably an enhancement, rather than a bug.

The palette shows the colour in 32bit RGBA, rather than 12bit X16 colours. Showing colour number would be handy as well.

image

Bug: Emulator doesn't render on some drivers.

See also: (Discord)

I'm walking through the debugger. It's something related to OpenGL. glGetSynciv is always coming back GL_UNSIGNALED and glClientWaitSync is always coming back GL_TIMEOUT_EXPIRED. Both of those conditions skip the rendering step. Looks like maybe a driver thing.
Yup, when I remove both USE_GL_GET_SYNC and USE_GL_CLIENT_WAIT_SYNC it works.

The fix I would like to see:

  • Add a bool to the options struct in options.h to toggle vsync. Default to false.
  • Add an appropriate command-line flag to enable the bool in options.cpp and store its setting in the ini file.
  • Use the new bool to choose whether to attempt to execute the vsync code in display_process().

Linker problems on some Linux platforms

Ubuntu (20.04) and Linux Mint have linker troubles for some reason. I'm not sure why, and I don't know what to do to troubleshoot this further at this point.

Feature Request: Export VGM file

It would be nice to have an option to capture writes to audio and export them to a VGM file. Export should be able to be enabled, but timing should only start with the first subsequent write to audio devices (e.g. trim any "dead air" that occurs before music is being played).

Bonus points if MIDI is implemented and this can export writes resulting from MIDI input in addition to vanilla writes to the audio devices. Something to consider when implementing, or perhaps means issue #2 should be implemented before this.

Feature Request: Generic keybinding interface and menu

This seems like a fairly bog-standard feature and idea, since there are other things where keybinds may be useful, add a generic interface for mapping key bindings to specific features, actions, and toggles.

This could, and maybe even should, include the debugging keys on the ASM Monitor window.

Feature Request: YM2151 timer and IRQ support

The YM2151 routines do not clock the timers, and the IRQ line is not connected to the system yet. Per Kevin (TexElec), the IRQ line is indeed connected, so it would be beneficial to activate these timers in the emulation. Furthermore, the chip also has a purely internal feature CSM which causes a keyDn event on all 8 channels whenever TimerA overflows, which does not function properly unless the timers are clocked.

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.