unusedinode/ec64
home download screenshots documentation technical details disk images links
 
Index
Compiling

If you are in the ec64 base directory just type make. After succesful compilation you should find a binary in the bin/ directory. If you want to change some compiletime settings then you should edit the Config file.

ec64 consists of different parts: sys, io, ui, rom, core. Some of them are pure x86 assembler (sys, rom, core), one is pure C (ui) and one is a mix of assembler and C (io).

If you want to compile ec64 on your own you need nasm-0.98, there seem to float some versions around the net which won't work for ec64. They generate broken object files, so ec64 immediately crashes after start.

For assembler files you need nasm-0.98. If you have problems while compiling, perhaps you have an older version (0.97 may cause problems). Or the parameters in your NASM Environment Variable may conflict with compile time settings. Try "unset NASM" before compiling.

Each C file is compiled in 3 steps

  • compiling the .c file with gcc to an .s file with AT & T syntax
  • filtering this .s file through sed, resulting in a .S file
  • assembling this .S file with gas to an .o file
Yes this looks a little bit strange, because this could be done in one step with a single gcc call. But i've decided to do this to filter out some instructions out of the .s file, maybe this is obsolete if i would use some more advanced gcc options ;-)

Installation

After successful compilation, copy the binary to a place you like (/usr/bin or $HOME/bin might be a good place). If your kernel has support for a "real" fb device you can start this binary as normal user. If you have no fb device or you use vga16fb ec64 will try to access the VGA registers directly, but for this task ec64 needs root rights, either you start it as root, or you use the setuid mechanism, execute the following commands as root:


		chown root:root ec64
		chmod 4111 ec64

		
Notes
  • vesafb may cause problems, because the driver can't change color depth at run time.
  • check the file permissions of your audio and fb device, if you run ec64 as normal user, this user has to have read/write permissions on this devices.
  • For additional fb device drivers you should have a look at the GGI Project. In the GGI package you will find KGIcon drivers, which also have a fb device interface.
Usage
ec64 runs on console only. This means you can't start it from a pseudoterminal (like xterm). Note that programs like ttysnoop or screen also make use of pseudoterminals.

Some seconds after starting ec64 the blue C64 screen should appear. Now you are in "Keyboard mode" this means (nearly) all pressed keys will be mapped to the C64 keyboard. Here some special keys (all other keys can be examined through testing ;-):


		PC Keyboard		| C64 Keyboard
		------------------------+------------------------
		Shift Left		| SHIFT Left
		Shift Right		| SHIFT Right
		Ctrl Left, Ctrl Right	| CONTROL
		Alt			| C=
		TAB			| RUNSTOP
		Pause			| RESTORE

		

The following keys have a special meaning to the emulator itself:

  • Ctrl+ESC quits ec64
  • F9 switches between the input modes: Keyboard, Joystick 1, Joystick 2, Monitor
  • F10 makes the Statusline always visible
  • F11 makes the Monitor always visible (in large resolutions this is always the case)
  • F12 takes a screenshot, if this feature was compiled in ec64

In "Joystick mode" only SPACE and the Cursorkeys are used to emulate a joystick on Port 1 or 2

Monitor Commands

In "Monitor mode" you are able to manipulate the emulation. The breakpoint commands are not very useful yet, so i don't explain very much details about them.

version
displays the ec64 version
load <d64|g64> <filename>
loads a D64 disk image in the C1541 drive (G64 not supported at the moment).
save <d64|g64> <filename>
saves the D64 disk image currently in the C1541 drive (G64 not supported at the moment).

NOTE: If you have no disk image loaded the C1541 drive contains an unformatted disk, this means you can't extract a D64 image.

cycles
displays the emulated cycles
stop
stops the emulation
continue
continues the emulation
reset <soft|hard>
resets the emulation. Soft means a warmstart and hard a cold start
sync <on|off>
If sync is off the emulation runs at full host CPU speed. If sync is on the emulation runs as fast as the original C64 (maybe slower if your system is too slow)
script <filename>
all commands you can enter in the monitor, can also be loaded as a script.

NOTE: you can produce endless loops if a script file executes itself via the script command

type <text>
types something on the C64 keyboard, this is useful for scripting. Special characters are escaped through a ^. If keys should be pressed at once (for example RUNSTOP and RESTORE), they have to be surrounded by a `.

		^l	SHIFT Left
		^r	SHIFT Right
		^c	CONTROL
		^o	C=
		^1	F1
		^2	F2
		^3	F3
		^4	F4
		^5	F5
		^6	F6
		^7	F7
		^8	F8
		^L	(<=)
		^E	(L)
		^H	HOME
		^I	INST
		^U	(^)
		^T	RESTORE
		^S	RUNSTOP
		^N	RETURN
		^D	CURSOR DOWN
		^R	CURSOR RIGHT

		

Examples:

  • type hello
  • type \ world ; if your text contains spaces you have to add a leading \
  • type \10 print"hello world"^N20 goto 10^Nrun^Ndummy^Sdummy`^S^T` ; test it and you will see what happens :-)

wait <number of frames>
waits the given number of frames (useful for scripts)
bpadd <modulid> <bptype> <bpflags> [start_address [end_address [value [mask]]]]
add a breakpoint. Available modulid's are: c64cpu c1541cpu. bptyte's: ro, rd, rs, wd, ws. Can also be written as read_opcode, read_data, read_stack, write_data, write_stack.

Examples:

  • bpadd c64cpu ro +trap 1000 1fff

bplist <modulid> <bptype>
lists the breakpoints for modulid and bptype
bpdel <modulid> <bptype> <bpnumber>
deletes a breakpoint
exit
quits ec64
quit
quits ec64
help
shows all available commands
Commandline Options

		Usage: ec64 [-h] [-d <file>] [-s <file>] [-dsp <file>] [-fb <file>] [-f]
		            [-vm <mode>]

		  -h          this help
		  -s <file>   load and execute script on startup
		  -d <file>   load d64 file on startup
		  -dsp <file> audio device file
		  -fb <file>  fb device file
		  -f          fullscreen 400x300@60Hz on fb device
		              (MAY BE NOT SUPPORTED ON ALL DEVICES!)
		  -vm <mode>  vga mode (supported values: 320x240, 360x240)

		
Notes
  • ec64 runs slower under ModeX than with the fb device, especially while massive screen changes and sprite movement.
  • if the emulation seems to hang, probably a C64 program used some features which are not implemented at the moment. If something strange happens the emulation will be stopped and you get a message to the monitor.
FAQ
I have loaded a d64 image (either via -d-command line switch or with the load command in monitor mode) but nothing happens ?

You have just done that: loaded a disk image. This means you have inserted a disk in the C1541 disk drive. Now you need to issue the usual commands on a C64, to load something from the floppy. For showing disk contents use LOAD"$",8. For loading a program in memory use LOAD"programname",8 When the READY. prompt appears again type RUN. Games often use some tricks to automagically start the loaded program, so you only need to load the program with absolute address in memory via LOAD"programname",8,1. Or if you are really lazy LOAD"*",8,1 will also work, if the first program on disk is that what you want.

I have started ec64 on console, but it only says couldn't initialize video or something like ioctl(FBIOPUT_VSCREENINFO) failed , so whats wrong ?

Especially newer distributions boot Linux with the VESA frame buffer driver (vesafb) enabled. Execute cat /proc/fb to find out if this is the case. This driver is unable to change resolution or color depth. So either you use a fb driver suitable for your graphics card or you switch vesafb off. If you use lilo as your boot loader you may either try adding append = "video=vesa:off" to your boot image in /etc/lilo.conf. Or if you have a line starting with vga =  try uncommenting this first. This will hopefully switch off vesafb on next boot and ec64 will be able to use its built in VGA driver.

Change Log

ec64-0.17-20031221:

  • the only thing that changed is the displayed eMail and Webaddress

ec64-0.17-20020914:

  • the nasty gpm trick is not needed any more, because of KDSETMODE
  • additional support for the 320x240 resolution under ModeX
  • VIC: fixed a bug causing reset <soft|hard> to throw an exception

ec64-0.17-20011013:

  • VIC: fixed a bug in bus_cycle_62

ec64-0.17-20010915:

  • minor compilation fixes for newer gcc versions in gpm.c
  • CPU: fixed a bug in opcode_jmp_indirect

ec64-0.17-20010304:

  • CPU now emulates most (but not all) illegal opcodes
  • screenshots possible
  • bug with large virtual resolutions fixed
  • fullscreen video support for fb devices (if your fb supports 400x300@60Hz)
  • support for ModeX 360x240 via direct VGA access (no fb device needed, but you have to run ec64 with root rights, because of sys_ioperm)
  • splitted ec64 in different parts: sys, io, ui, core (some of them are now written in C)
  • sprites are now displayed (but slow)
  • first working SID emulation
  • better keymapping (using raw keyboard mode)
  • first working joystick emulation (via keyboard)
  • builtin monitor with basic functionality

ec64-0.09-20000430:

  • redesigned nearly everything (but cascaded CIA timers not reimplemented)
  • 4bpp support with vga16fb
  • faster than ec64-0.05 (realtime on pentium 166+)
  • VIC x scrolling works now
  • sprite DMA is implemented, but no sprites are displayed

ec64-0.05-19991219 (first official release):

  • runs on a pentium 300+ in realtime
  • no SID emulation
  • VIC is emulated without sprites and x scrolling
  • CPU emulates only legal opcodes

Todo
  • DISC: recognize SYNC not only on byte boundaries
  • SID: sync and ring modulation and filters
  • CIA: cascaded timers
  • VIA: latched/unlatched mode
  • VIC: sprite collision detection
  • VIC: fix sporadic DMA timing misbehavior
  • VIC: speed up sprite decoding
  • CPU: the missing illegal opcodes