Skip to content

targets c65

LGB edited this page Aug 30, 2016 · 2 revisions

Commodore 65 emulation of Xemu

Some more "colourful" story: http://cubed-borka.blogspot.hu/2016/05/my-commodore-65-and-commodore-lcd.html

C65 emulator? Yes. Or kind of (so to be clear: it's C65 not C64) ... Quite limited currently though. For me, it worked to the level for BASIC prompt, and even for typing commands, or switching to C64 mode (GO64), or you can try write BASIC programs (NOTE: ROM 911001.bin seems not to work properly, but 910111.bin does).

What is emulated and what is not

  • 65CE02 "core" instructions, hopefully more-or-less correctly emulated. 65CE02 emulation is done by extending/modifying a 65C02 emulator (of mine) since 65CE02 is basically an extended 65C02, with only "some" differences (oh, yes, "some" ... well).
  • 4502 "core" extensions over 65CE02, ie MAP opcode, and special meaning of NOP (as EOM).
  • Though in theory 65CE02 does not use the old NMOS behaviour of RMW opcodes (ie, write twice), it introduces incompatibilties with C64 software. As it seems, Mega65 already uses the "old behaviour" for more compatibility, I try to follow this path as well.
  • Memory management: CPU "MAP"/"EOM" stuff, VIC3 register $30 ROM select and 2K colour SRAM mode, "C64-style" "CPU port". REC is not emulated.
  • DMAgic COPY/FILL should work, MIX/SWAP is only guessing. Modulo is not supported (and not so much information is available how it should work anyway, as with case of MIX).
  • 128K ROM / 128K RAM. Optionally (enabled by default) 512K RAM emulated in the upper region, though not in a REC compatible way. This even can cause problems, I guess.
  • FDC emulation may be used to read D81 disk images, but still there are bugs! Currently, the FDC part is the most ugly in source. SWAP bit is not emulated, which can cause even data corruptions ("fortunately" since everything is read-only, there is no chance to corrupt the disk image content itself).
  • VIC3 code is horrible, it merely emulates full frames in one rendering step only. Many things are not emulated: MCM/ECM for classic VIC2 modes, no border, no DAT, no V400 and interlace, and no H1280 mode. Though bitplane modes, programmable palette, 40/80 column text mode (even hardware character attribues now), and classic VIC2 hires mode should work. K2 demo is able to show the "busty woman" already with my emulator.
  • Sprites are emulated in a very lame and limited way. Multicolour sprites are not supported, and even the "under the screen" priority is not handled. Sprites in bitplane mode are incorrect now. Also, the "render a frame in once" scenario makes sprite multiplexing or any other tricks impossible. Sprite emulation is mainly included only for some simple tasks, ie "mouse pointer" in certain software, and for similar usages.
  • There is some SID emulation, but it's horrible, believe me :) Two SIDs are emulated with the help of SID emulation core from 'webSID' (see common/sid.c for more details). However the major problem is, that SID "audio rendering" is only done currently, if audo buffer is needed to fill. Moreover, the exact timing is nowehere in my implementation - I guess - compared to the original. Forgive me, I'm the lamest in the audio realm ...
  • No emulation for the UART, REC (Ram Expansion Controller)
  • CIA emulation (for real, part of 4510 and not even full CIAs from some aspects) is quite lame. Though it seems enough for keyboard and periodic IRQ generating in C64 mode at least
  • Keyboard is not fully implemented (not the extra keys like TAB - it seems it's handled by - surprisingly - by the UART part ...), and some mapping problems (ie, position based mapping for US host machine layout, some keys are still missing, I was lazy ...).

Compatibility

  • First "milestone" is already here, it can "boot" to BASIC, though :) Now, it also does its work with DIR command, if D81 image is given.
  • C65 standard boot is OK
  • C64 mode can be used (GO64)
  • GEOS kernal can be booted, the "chessboard" background can be seen
  • K2 demo is able to show the "busty woman" (320x200 256 colours, 8 bitplanes mode)
  • IFF demos has problems currently, I am not sure what is the problem yet (though there is a modified version on an FTP site - saying it should work and fixed - it is able to show at least the "King Tut" picture)

Basic usage of the emulator

  • You need to give the disk image (should be D81 in format!) name as the parameter of the executable, if you want disk access.
  • Press F11 to toggle between window/full screen mode
  • Press F10 to RESET.
  • Press F9 to exit
  • You may want to redirect stdout of emulator (especially on Linux/Unix if you run it from terminal) to avoid lots of debug messages

That's about all - currently :)