-----------------------------------
C64 keyer
-----------------------------------

This software is a small program written in 6502 assembly language that transforms the old C64 into a CW keyer.  When you move the joystick in port 2 left and right the C64 generates dots and dashes.  If you want to use a CW paddle, connect the CW paddle to the control port 2.

The program is divided into two parts:
- the actual code that, after executing some settings (SID parameters, start speed), generates dots and dashes when you move the joystick in port 2 left and right;
- a routine executed at each interrupt that increases or respectively decreases the speed when you push the "+" or the "-" keys on the keyboard.

Here is the link to the assembly code with comments:  keyer.txt

This is the hex machine code produced by the assembler (start=$C000):

78 A9 5F 8D 14 03 A9 C0
8D 15 03 58 A9 0F 8D 18
D4 A9 22 8D 01 D4 A9 00
8D 00 D4 8D 05 D4 A9 F0
8D 06 D4 85 02 AD 00 DC
C9 77 D0 11 A9 11 A0 FF
20 52 C0 A9 10 A0 55 20
52 C0 4C 25 C0 C9 7B D0
E4 A9 11 A0 55 20 52 C0
A9 10 A0 55 20 52 C0 4C
25 C0 8D 04 D4 A6 02 EA
CA D0 FC 88 D0 F7 60 A5
CB C9 28 D0 02 C6 02 C9
2B D0 02 E6 02 4C 31 EA


This is the BASIC program for the C64 (just type it at the prompt and run it).

10 REM KEYER BY IK2PIH
11 FORX=49152TO49263:READA:POKEX,A:NEXT
12 SYS49152
13 DATA 120,169,095,141,020,003,169,192
14 DATA 141,021,003,088,169,015,141,024
15 DATA 212,169,034,141,001,212,169,000
16 DATA 141,000,212,141,005,212,169,240
17 DATA 141,006,212,133,002,173,000,220
18 DATA 201,119,208,017,169,017,160,255
19 DATA 032,082,192,169,016,160,085,032
20 DATA 082,192,076,037,192,201,123,208
21 DATA 228,169,017,160,085,032,082,192
22 DATA 169,016,160,085,032,082,192,076
23 DATA 037,192,141,004,212,166,002,234
24 DATA 202,208,252,136,208,247,096,165
25 DATA 203,201,040,208,002,198,002,201
26 DATA 043,208,002,230,002,076,049,234

The machine code is coded into the DATA statements of the BASIC program.
The second row of the BASIC program is the loader (loads the machine code into  memory from address $C000 to $C06F (from 49152 to 49263), the third row (the SYS statement) runs the program in machine code.
To run the program type "RUN" at the command prompt; to exit the program press the two keys <RUN/STOP> and <RESTORE> on the keyboard of the C64.

You can run the program also in an emulator (I used VICE).
Here is the link of a disk image in d64 format used by VICE: keyer.d64
Attach the d64 disk image to the drive 8, type  LOAD"KEYER",8  to load the program from disk and then type RUN to execute the program.


  • [Back to the home page]

  • Some screenshots


    Loading the program from disk with VICE

    Loading the program from disk with VICE



    The BASIC program: loader and machine code (DATA statements)

    The BASIC program: loader and machine code


  • [Back to the home page]