Pagezero |
C64 Specs |
C64 Technical Data |
6510A 8bit CPU, 1.02 MHz (NTSC) or 0.98 MHz (PAL), Compatible with 6502 |
64Kbytes RAM (used for both work RAM and video RAM) 16Kbytes KERNAL/BASIC ROM 4Kbytes Character ROM (156 unique chars & many duplicated/inverted chars) 1024x4bit Color RAM |
40x25 Character Text mode, or 320x200 (or 160x200) Pixels Bitmap mode 40x25 Color attributes used for both Text and Bitmap modes High resolution allows two colors (out of 16) per 8x8 tile Low resolution allows four colors (out of 16) per 4x8 tile 8 Sprites (each HiRes 24x21 one color, or LowRes 12x21 three colors) Horizontal and vertical sprite magnification (normal and double size) Sprite-to-Sprite and Sprite-to-Background collision detection |
3 independent tone generators - each with 9 octaves Each voice includes programmable ADSR generator (Attack, Decay, Sustain, Release) and control of sawtooth, triangle, square, variable pulse and noise waveforms Full filtering capabilities with low, high and band pass filters External sound input |
66 Keys, including not more than two (2) cursor keys |
User port Serial port (for Printer or Disk drive) ROM cartridge port 2 Joystick/paddle ports 2 Video ports (Monitor or TV) C1530 Cassette drive interface port (aka Datasette) |
External Supply, +5V DC and 9V AC(!). |
C64 I/O Map |
0000 MOS 6510 CPU On-Chip I/O Port Direction 0001 MOS 6510 CPU On-Chip I/O Port Data - Memory and Datasette |
D000 Sprite 0 X Pos D001 Sprite 0 Y Pos D002 Sprite 1 X Pos D003 Sprite 1 Y Pos D004 Sprite 2 X Pos D005 Sprite 2 Y Pos D006 Sprite 3 X Pos D007 Sprite 3 Y Pos D008 Sprite 4 X Pos D009 Sprite 4 Y Pos D00A Sprite 5 X Pos D00B Sprite 5 Y Pos D00C Sprite 6 X Pos D00D Sprite 6 Y Pos D00E Sprite 7 X Pos D00F Sprite 7 Y Pos D010 Sprites 0-7 X Pos (msb of X coord.) D011 VIC Control Register (1) D012 Read Raster / Write Raster Value for Compare IRQ D013 Lightpen Latch X Pos D014 Lightpen Latch Y Pos D015 Sprite display Enable: 1 = Enable D016 VIC Control Register (2) D017 Sprites 0-7 Expand 2x Vertical (Y) D018 VIC Memory Control Register D019 VIC Interrupt Flag Register D01A IRQ Mask Register: 1 = Interrupt Enabled D01B Sprite to Background Display Priority D01C Sprites 0-7 Multi-Color Mode Select D01D Sprites 0-7 Expand 2x Horizontal (X) D01E Sprite to Sprite Collision Detect D01F Sprite to Background Collision Detect D020 Border Color D021 Background Color 0 D022 Background Color 1 D023 Background Color 2 D024 Background Color 3 D025 Sprite Multi-Color Register 0 D026 Sprite Multi-Color Register 1 D027 Sprite 0 Color D028 Sprite 1 Color D029 Sprite 2 Color D02A Sprite 3 Color D02B Sprite 4 Color D02C Sprite 5 Color D02D Sprite 6 Color D02E Sprite 7 Color D02F-D03F Not used (always FFh) D040-D3FF Mirrors of above VIC registers (repeated each 40h bytes) |
D400 Voice 1: Frequency Control - Low-Byte D401 Voice 1: Frequency Control - High-Byte D402 Voice 1: Pulse Waveform Width - Low-Byte D403 Voice 1: Pulse Waveform Width - High-Nybble D404 Voice 1: Control Register D405 Envelope Generator 1: Attack / Decay Cycle Control D406 Envelope Generator 1: Sustain / Release Cycle Control D407 Voice 2: Frequency Control - Low-Byte D408 Voice 2: Frequency Control - High-Byte D409 Voice 2: Pulse Waveform Width - Low-Byte D40A Voice 2: Pulse Waveform Width - High-Nybble D40B Voice 2: Control Register D40C Envelope Generator 2: Attack / Decay Cycle Control D40D Envelope Generator 2: Sustain / Release Cycle Control D40E Voice 3: Frequency Control - Low-Byte D40F Voice 3: Frequency Control - High-Byte D410 Voice 3: Pulse Waveform Width - Low-Byte D411 Voice 3: Pulse Waveform Width - High-Nybble D412 Voice 3: Control Register D413 Envelope Generator 3: Attack / Decay Cycle Control D414 Envelope Generator 3: Sustain / Release Cycle Control D415 Filter Cutoff Frequency: Low-Nybble (Bits 2-0) D416 Filter Cutoff Frequency: High-Byte D417 Filter Resonance Control / Voice Input Control D418 Select Filter Mode and Volume D419 Analog/Digital Converter Game Paddle 1 (0-255) D41A Analog/Digital Converter Game Paddle 2 (0-255) D41B Oscillator 3 Random Number Generator D41C Envelope Generator 3 Output D41D-D41F Not used (always 00h) D420-D7FF Mirrors of above SID registers (repeated each 20h bytes) |
D800-DBFF Color RAM (1000 Nybbles, plus 24 unused Nybbles) |
DC00 Data Port A (Keyboard, Joystick, Paddles): Game Port 2 DC01 Data Port B (Keyboard, Joystick, Paddles, Lightpen): Game Port 1 DC02 Data Direction Register - Port A DC03 Data Direction Register - Port B DC04 Timer A: Low-Byte DC05 Timer A: High-Byte DC06 Timer B: Low-Byte DC07 Timer B: High-Byte DC08 Time-of-Day Clock: 1/10 Seconds DC09 Time-of-Day Clock: Seconds DC0A Time-of-Day Clock: Minutes DC0B Time-of-Day Clock: Hours + AM/PM Flag (Bit 7) DC0C Synchronous Serial I/O Data Buffer DC0D CIA Interrupt Control Register (Read IRQs/Write Mask) DC0E CIA Control Register A DC0F CIA Control Register B DC10-DCFF Mirrors of above CIA1 registers (repeated each 10h bytes) |
DD00 Data Port A (Serial Bus, RS-232, VIC Memory Control) DD01 Data Port B (User Port, RS-232) DD02 Data Direction Register - Port A DD03 Data Direction Register - Port B DD04 Timer A: Low-Byte DD05 Timer A: High-Byte DD06 Timer B: Low-Byte DD07 Timer B: High-Byte DD08 Time-of-Day Clock: 1/10 Seconds DD09 Time-of-Day Clock: Seconds DD0A Time-of-Day Clock: Minutes DD0B Time-of-Day Clock: Hours + AM/PM Flag (Bit 7) DD0C Synchronous Serial I/O Data Buffer DD0D CIA Interrupt Control Register (Read NMIs/Write Mask) DD0E CIA Control Register A DD0F CIA Control Register B DD10-DDFF Mirrors of above CIA2 registers (repeated each 10h bytes) |
DE00-DEFF Reserved for Future I/O Expansion DF00-DFFF Reserved for Future I/O Expansion |
DE00-DEFF Open I/O slot #1 (CP/M Enable) 256 Bytes DF00-DFFF Open I/O slot #2 (Disk) 256 Bytes |
C64 Interrupts and NMIs |
Expansion Port <-- /IRQ-pin VIC <-- Lightpen Trigger VIC <-- Sprite to Sprite Collision VIC <-- Sprite to Background Collision VIC <-- Raster Compare Match CIA #1 <-- Timer A Interrupt CIA #1 <-- Timer B Interrupt CIA #1 <-- TOD Alarm Interrupt CIA #1 <-- Serial Port Interrupt CIA #1 <-- FLAG <-- Cassette Read CIA #1 <-- FLAG <-- Serial Bus SRQ |
Expansion Port <-- /NMI-pin Memory Controller <-- Trigger/Capaciator <-- Keyboard RESTORE-key CIA #2 <-- Timer A Interrupt CIA #2 <-- Timer B Interrupt CIA #2 <-- TOD Alarm Interrupt CIA #2 <-- Serial Port Interrupt CIA #2 <-- FLAG <-- User Port <-- Custom Hardware connected to Pin B CIA #2 <-- FLAG <-- User Port <-- RS-232 Adapter: Received Data Input CIA #2 <-- FLAG <-- User Port <-- Centronics Printer Adaper: Busy |
probably possible to "disable" the RESTORE-key by a not-acknowledged CIA interrupt signal ??? |
C64 Memory Banking and Datasette |
Bit Expl. 0-7 Direction for Bit 0-7 of Port 0001h (0=Input, 1=Output) |
Bit Expl. 0 /LORAM Signal (*) (0=RAM, 1=BASIC ROM at A000-BFFF) 1 /HIRAM Signal (*) (0=RAM, 1=Kernal ROM at E000-FFFF) 2 /CHAREN Signal (*) (0=Character ROM, 1=I/O at D000-DFFF) 3 Cassette Data Output (Pulse) 4 Cassette Switch Sense (0=Switch Opened, 1=Switch Closed) (0=play button down) 5 Cassette Motor Control (0=Motor On, 1=Motor Off) 6-7 Not used |
Normal Operation 8K Expansion 16K Expansion Val /game=/exrom=high /game=high,/exrom=low /game=low,/exrom=low 0 RAM RAM IO/C,KERNAL 1 IO/C IO/C IO/RAM 2 IO/C,KERNAL IO/C,KERNAL IO/C,KERNAL,ROMH 3 IO/C,KERNAL,BASIC IO/C,KERNAL,BASIC,ROML IO/C,KERNAL,ROMH,ROML |
Addr Bytes Content 0000 2 IO ;CPU On-chip I/O ports (no RAM here) 0002 254 RAM ;BIOS system data 0100 256 RAM ;CPU Stack 0200 1.5K RAM ;BIOS system data 0800 30K RAM ;Normal BASIC Program space 8000 8K RAM or ROML ;Optional Cartridge ROML space A000 8K RAM or BASIC or ROMH ;BASIC ROM, or ROMH space C000 4K RAM ;RAM only D000 4K RAM or IO or CHAR ;I/O Ports+Colour RAM or CHAR ROM E000 8K RAM or KERNAL ;KERNAL ROM |
8000h-8001h Cold Start Vector 8002h-8003h Warm Start Vector 8004h-8008h ASCII ID Code "CBM80" with Bit7 set in the first 3 letters |
E000-FFFF=ROMH, 8000-9FFF=ROML, D000-DFFF=IO, 0000-0FFF=RAM, other=N/A |
7 - unused (Flash 8: 0=8MHz/1=1MHz) 6 - unused (C128: ASCII/DIN sense/switch (1=ASCII/0=DIN)) |
C64 Video Controller |
C64 VIC Control Registers |
Bit Name Expl. 7 RC8 Raster Compare Bit 8 (See below, Port D012h) 6 ECM Extended Color Text Mode (0=Normal, 1=Extended) 5 BMM Bitmap Mode (0=Text, 1=Bitmap) 4 DEN Display Enable (0=Blank/Border Color, 1=Enable BG/MOB) 3 RSEL Row Select Display Height (0=24 Rows, 1=25 Rows) 0-2 Y0-2 Smooth Scroll Y Position (0-7) |
Bit Name Expl. 6-7 - Unused 5 RES ALWAYS SET THIS BIT TO 0 ! --- Huh, what/why ??? 4 MCM Multi-Color Mode (0=Disable, 1=Enable) 3 CSEL Column Select Display Width (0=38 Columns, 1=40 Columns) 0-2 X0-2 Smooth Scroll to X Position (0-7) |
Bit Name Expl. 0-7 RC0-7 Raster Compare/Scanline |
Bit Name Expl. 4-7 VM# Video Matrix Base Address Bit 13-10 1-3 CB# Character Dot-Data Base Address Bit 13-11 0 - Not used |
1000h or 9000h --> 1st half of Character ROM (D000h) 1800h or 9800h --> 2nd half of Character ROM (D800h) |
Bit Name Expl. 7 IRQ Set on Any Enabled VIC IRQ Condition (0=None, 1=IRQ) 4-6 - Not used 3 ILP Lightpen Triggered IRQ Flag (0=None, 1=IRQ) 2 IMMC Sprite to Sprite Collision IRQ Flag (0=None, 1=IRQ) 1 IMBC Sprite to Background Collision IRQ Flag (0=None, 1=IRQ) 0 IRST Raster Compare IRQ Flag (0=None, 1=IRQ) |
Bit Name Expl. 4-7 - Not used 3 ELP Lightpen Triggered (0=Disable, 1=Enable) 2 EMMC Sprite to Sprite Collision (0=Disable, 1=Enable) 1 EMBC Sprite to Background Collision (0=Disable, 1=Enable) 0 ERST Raster Compare (0=Disable, 1=Enable) |
C64 VIC Sprite Registers |
Bit Name Expl. 0-7 M#E Sprite 0-7 Enable (0=Hidden, 1=Display) |
Bit Name Expl. 0-7 M#YE Sprite 0-7 Expand Y (0=Normal, 1=Magnified by two) |
Bit Name Expl. 0-7 M#DP Sprite 0-7 Priority (0=Above BG, 1=Behind BG) OR VICE-VERSA ??? |
Bit Name Expl. 0-7 M#MC Sprite 0-7 Multi Color (0=Normal, 1=Multi Color) |
Bit Name Expl. 0-7 M#XE Sprite 0-7 Expand X (0=Normal, 1=Magnified by two) |
Bit Name Expl. 0-7 M#M Sprite 0-7 Collision Flag (0=Normal, 1=Collision) |
Bit Name Expl. 0-7 M#D Sprite 0-7 Collision Flag (0=Normal, 1=Collision) |
C64 VIC Color Registers |
0 Black 8 Orange 1 White 9 Brown 2 Red 10 Light red 3 Cyan 11 Dark grey 4 Purple 12 Medium grey 5 Green 13 Light green 6 Blue 14 Light blue 7 Yellow 15 Light grey |
Sprite 0 1 2 3 4 5 6 7 Port D027 D028 D029 D02A D02B D02C D02D D02E |
C64 VIC Background Display Modes |
BMM ECM MCM Mode Name 0 0 0 Standard Character Mode 0 0 1 Multi-Color Character Mode 0 1 0 Extended Color Character Mode 0 1 1 Reserved 1 0 0 Standard Bitmap Mode 1 0 1 Multi-Color Bitmap Mode 1 1 0 Reserved 1 1 1 Reserved |
2048 Bytes Character Data (256 tiles) 1000 Bytes Video Matrix Data (40x25 tile numbers) 1000 Nybbles Color RAM (40x25 color attributes) |
8000 Bytes Character Data (40x25 tiles) - Addressed by CB13 1000 Bytes Video Matrix Data (40x25 color attributes) 1000 Nybbles Color RAM (40x25 color attributes) |
0 BG color 0 (Port D021h) (0-15) 1 Color as selected by Nybble (0-15) |
0 BG color 0 (Port D021h) (0-15) 1 Color as selected by Nybble LSBs (0-7) |
0 BG color 0 (Port D021h) (0-15) 1 BG color 1 (Port D022h) (0-15) 2 BG color 2 (Port D023h) (0-15) 3 Color as selected by Nybble LSBs (0-7) |
0 BG Color 0-3 (Port D021h-D024h) (0-15) 1 Color as selected by Nybble (0-15) |
0 LSBs of video matrix entry (0-15) 1 MSBs of video matrix entry (0-15) |
0 BG Color 0 (Port D021h) (0-15) 1 MSBs of video matrix entry (0-15) 2 LSBs of video matrix entry (0-15) 3 Video Matrix Color Nybble (0-15) |
C64 VIC Sprite Display |
0 Transparent (-) 1 Sprite Color (Port D027h-D02Eh) (0-15) |
0 Transparent (-) 1 Sprite Multi Color 0 (Port D025h) (0-15) 2 Sprite Color (Port D027h-D02Eh) (0-15) 3 Sprite Multi Color 1 (Port D026h) (0-15) |
C64 VIC Character Sets |
CHR ASCII CHARSET ROM CHARSET 1 ROM CHARSET 2 0Xh \\\\\\\\\\\\\\\\ @ABCDEFGHIJKLMNO @abcdefghijklmno 1Xh \\\\\\\\\\\\\\\\ PQRSTUVWXYZ[\]^\ pqrstuvwxyz[\]^\ 2Xh !"#$%&'()*+,-./ !"#$%&'()*+,-./ !"#$%&'()*+,-./ 3Xh 0123456789:;<=>? 0123456789:;<=>? 0123456789:;<=>? 4Xh @ABCDEFGHIJKLMNO \\\\\\\\\\\\\\\\ \ABCDEFGHIJKLMNO 5Xh PQRSTUVWXYZ[\]^\ \\\\\\\\\\\\\\\\ PQRSTUVWXYZ\\\\\ 6Xh \\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\ 7Xh \\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\ |
SET CPU Address VIC Addresses 1 D000h-D7FFh 1000h-17FFh or 9000h-97FFh 2 D800h-DFFFh 1800h-1FFFh or 9800h-9FFFh |
C64 VIC Rendering |
YY_POS 3bit internal counter (vertical position in current char row) PIC_ON 1bit internal flag (picture output enable) BORDER 1bit CHAR_ADDR 10bit internal screen matrix address (of current char row) ROW_BUF 40x12bit internal buffer for 8bit tile numbers & 4bit colors |
C64 VIC Dimensions and Timings |
Item NTSC PAL Oscillator 14.318181 MHz 17.734472 MHz Divider Osc/14 Osc/18 System Clock 1.022727 MHz 0.985248 MHz Frame Rate ca. 60Hz ca. 50Hz Scanlines 263 312 Clks/Line 65 63 |
NTSC: 6567R5 6A: 64 cycles/line x 262 lines. NTSC: 6567R8 and newer: 65 cycles/line x 263 lines. |
C64 Sound Interface |
Bit Expl. 7 Select Random Noise Waveform, 1 = On 6 Select Pulse Waveform, 1 = On 5 Select Sawtooth Waveform, 1 = On 4 Select Triangle Waveform, 1 = On 3 Test Bit: 1 = Disable Oscillator 1/1/1 - That is "1/1/1" for all voicechannels ??? 2 Ring Modulate Osc. 1/2/3 with Osc. 3/1/2 Output, 1 = On 1 Synchronize Osc. 1/2/3 with Osc. 3/1/2 Frequency, 1 = On 0 Gate Bit: 1 = Start Att,Dec,Sus, 0 = Start Release |
Bit Expl. 4-7 Select Attack Cycle Duration: 0-15 0-3 Select Decay Cycle Duration: 0-15 |
Bit Expl. 4-7 Select Sustain Cycle Duration: 0-15 0-3 Select Release Cycle Duration: 0-15 |
----- Control Registers ----- |
Bit Expl. 4-7 Select Filter Resonance: 0-15 3 Filter External Input: 1 = Yes, 0 = No 2 Filter Voice 3 Output: 1 = Yes, 0 = No 1 Filter Voice 2 Output: 1 = Yes, 0 = No 0 Filter Voice 1 Output: 1 = Yes, 0 = No |
Bit Expl. 7 Cut-Off Voice 3 Output: 1 = Off, 0 = On 6 Select Filter High-Pass Mode: 1 = On 5 Select Filter Band-Pass Mode: 1 = On 4 Select Filter Low-Pass Mode: 1 = On 0-3 Select Output Volume: 0-15 |
C64 Complex Interface Adapters |
C64 CIA #1 Data Ports (Keyboard, Joystick) |
Bit Dir. Expl. 7-0 Out Select Keyboard Column 7-0 (0=Select, 1=Not select) 7-6 Out Select Analog Paddle (01b=Paddle 1, 10b=Paddle 2) ??? 5 - Used for Keyboard only (See above, Bit 7-0) 4 In Joystick 2 Fire (0=Pressed, 1=Released) 3 In Joystick 2 Right, Paddle 2 Y-Button (0=Moved/Pressed, 1=Released) 2 In Joystick 2 Left, Paddle 2 X-Button (0=Moved/Pressed, 1=Released) 1 In Joystick 2 Down (0=Moved, 1=Released) 0 In Joystick 2 Up (0=Moved, 1=Released) |
Bit Dir. Expl. 7-0 In Keyboard Row 7-0 Input (0=Pressed, 1=Released) 7 Out Timer B Toggle/Pulse Output (Output from Timer B) 6 Out Timer A Toggle/Pulse Output (Output from Timer A) 5 In Used for Keyboard only (See above, Bit 7-0) 4 In Joystick 1 Fire (or Lightpen) (0=Pressed, 1=Released) 3 In Joystick 1 Right, Paddle 1 Y-Button (0=Moved/Pressed, 1=Released) 2 In Joystick 1 Left, Paddle 1 X-Button (0=Moved/Pressed, 1=Released) 1 In Joystick 1 Down (0=Moved, 1=Released) 0 In Joystick 1 Up (0=Moved, 1=Released) |
1) Read joysticks 2) Read keyboard columns 3) Read joysticks again |
1st Joystick = Joystick A = JOY B = CIA Port A (DC00h) = Port 2 2nd Joystick = Joystick 1 = JOY A = CIA Port B (DC01h) = Port 1 |
C64 CIA #2 Data Ports (Serial, VIC, User Port) |
Bit Dir. Expl. 7 Serial Bus Data Input 6 Serial Bus Clock Pulse Input 5 Serial Bus Data Output 4 Serial Bus Clock Pulse Output 3 Serial Bus ATN Signal Output 2 User / RS-232 Data Output / CNTR "/Strobe" 1-0 Out VIC Memory Bank XOR 3 (Default=3, see VIC Port D018h) |
Bit Dir. Expl. 7 Out Timer B Toggle/Pulse Output (Output from Timer B) 6 Out Timer A Toggle/Pulse Output (Output from Timer A) 7 User / RS-232 Data Set Ready 6 User / RS-232 Clear to Send 5 User 4 User / RS-232 Carrier Detect 3 User / RS-232 Ring Indicator 2 User / RS-232 Data Terminal Ready 1 User / RS-232 Request to Send 0 User / RS-232 Received Data |
00 Keyboard 01 Datassette(TM) 02 RS-232C device 03 CRT display 04 Serial bus printer 08 Serial bus disk drive unit 1 09 Serial bus disk drive unit 2 0A Serial bus disk drive unit 3 0B Serial bus disk drive unit 4 |
C64 CIA #1/#2 Timers, Interrupt, and Control Registers |
Bit Expl. 7-0 Data Direction for Port A/B Bits 7-0 each (0=Input, 1=Output) |
Is that eventually 00-11 or actually 12,01-11 Hours ??? |
Bit Expl. 7 Any enabled interrupt (0=None, 1=Yes) / Set-Clear Flag (0=Clear, 1=Set) 6-5 Not used (always read out as zero) 4 FLAG External IRQ/NMI Input, CIA #1 - IRQ - Cassette Read, Serial Bus SRQ Input CIA #2 - NMI - User, RS-232 Received Data Input, CNTR Busy 3 Serial Port Interrupt 2 Time-of-Day Clock Alarm Interrupt 1 Timer B Interrupt 0 Timer A Interrupt |
Bit Expl. 7 Time-of-Day Clock Frequency (0=9VAC/60Hz, 1=9VAC/50Hz) 6 Serial Port I/O Mode Output (0=Input, 1=Output) 5 Timer A Counts (0=System 02 Clock, 1=CNT Signals) 4 Timer A Force Load (0=No, 1=Yes) 3 Timer A Run Mode (0=Continuous, 1=One-Shot) 2 Timer A Output-to-Port-B Mode (0=Pulse, 1=Toggle) 1 Timer A Output-to-Port-B Enable (0=Disable, 1=Enable) 0 Timer A Start/Stop (0=Stop, 1=Start) |
Bit Expl. 7 Time-of-Day Write Mode (0=Set Clock, 1=Set Alarm) 6-5 Timer B Mode Select: 0 = Count System 02 Clock Pulses 1 = Count Positive CNT Transitions 2 = Count Timer A Underflow Pulses 3 = Count Timer A Underflows While CNT Positive 4-0 Same as for above Timer A, but for Timer B respectively. |
VIC20 Specs |
VIC20 Tech Data |
CPU: 6502A, 1.02 MHz (NTSC), 1.11 MHz (PAL) ROM: 16K Basic/Kernal ROM, 4K Character ROM (2 sets of 256 characters) RAM: 5K RAM (expandable to 40K RAM max), 1Kx4bit Color RAM Video: 22x23 tiles, 176x184 pix (1bit HiRes), or 88x184 pix (2bit MultiColor) Color: 16 Color Palettte, 2 or 4 Colors (Hires/Multi), 1 unique color/tile Sound: 3x Square Wave, 1x Noise, 1x Volume (shared for all 4 channels) Ports: One Joystick port, User Port, Expansion Port, Serial Port, Cassette Keyboard: Matrix with 8x8 Keys, plus Restore Key |
VIC20 Memory and I/O Map |
Addr. Size Expl. 0000h 1K RAM (BIOS,KERNAL,STACK) 0400h 3K Expansion RAM 1000h 4K RAM (3.5K BASIC/USER, 0.5K Screen RAM) 2000h 24K Expansion RAM (or ROM) 8000h 1K Character ROM Uppercase and all Symbols (Normal) 8400h 1K Character ROM Uppercase and all Symbols (Reversed) 8800h 1K Character ROM Upper/lowercase and some Symbols (Normal) 8C00h 1K Character ROM Upper/lowercase and some Symbols (Reversed) 9000h I/O Area (VIC Chip, VIA1, VIA2) 9400h Color RAM (1024x4bit) 9800h Expansion I/O Area 2 9C00h Expansion I/O Area 3 A000h 8K Expansion ROM (or RAM) C000h 8K BASIC ROM E000h 8K KERNAL ROM |
Basic RAM must be located in a continous memory block. Screen RAM must be located in built-in 4K RAM. Color RAM address bit9 must match Screen RAM address bit9. |
Expansion Total RAM Basic RAM Screen RAM Color RAM Basic Space None 5K 1000h-1DFFh 1E00h-1FFFh 9600h-97FFh 3.5K 3K 8K 0400h-1DFFh 1E00h-1FFFh 9600h-97FFh 6.5K 8K..35K 13K..40K 1200h-7FFFh 1000h-11FFh 9400h-95FFh 11.5K..27.5K |
A000h-A001h Cold Start Vector (invoked after RESET with S=FFh, D=0, I=1) A002h-A003h Warm Start Vector A004h-A008h ASCII ID Code "A0CBM" with Bit7 set in the last 3 letters |
9000h Horizontal Screen Origin, and Interlace 9001h Vertical Screen Origin 9002h Horizontal Screen Size, and Screen Base 9003h Vertical Screen Size, Raster, and Character Size 9004h Raster Value 9005h Video Memory Base Addresses 9006h Lightpen Horizontal 9007h Lightpen Vertical 9008h Paddle X Position 9009h Paddle Y Position 900Ah Voice 1 Square/Bass 900Bh Voice 2 Square/Alto 900Ch Voice 3 Square/Soprano 900Dh Voice 4 Noise 900Eh Sound Volume, and Auxiliary Color 900Fh Screen Color, Border Color, and Reverse Mode |
91x0h Input/Output Register B (IRB/ORB) 91x1h Input/Output Register A (IRA/ORA) 91x2h Data Direction Register B (DDRB) 91x3h Data Direction Register A (DDRA) 91x4h T1 Low-order Counter/Latch (T1C_L) 91x5h T1 High-order Counter/Latch (T1C_H) 91x6h T1 Low-order Latch (T1L_L) 91x7h T1 High-order Latch (T1L_H) 91x8h T2 Low-Order Latch/Counter (T2C_L) 91x9h T2 High-Order Counter (T2C_H) 91xAh Shift Register (SR) 91xBh Auxiliary Control Register (ACR) 91xCh Peripheral Control Register (PCR) 91xDh Interrupt Flag Register (IFR) (Request/Acknowledge) 91xEh Interrupt Enable Register (IER) (Enable/Disable) 91xFh Input/Output Register A' (IRA'/ORA') |
VIC20 Video and Audio |
Bit7 Interlace mode (0=Off/Normal, 1=On) (NTSC Only) (PAL: No Effect) Bit6-0 Left Border width (in FOUR pixel steps) |
Bit0-7 Upper Border Height (in TWO pixel steps) |
Bit7 Screen Base A9 (1 = +0200h) (see Port 9005h), and Color RAM Base A9 (0=9400h, 1=9600h) Bit6-0 Number of video columns (Default = 22 columns; 176 pixels) |
Bit7 Bit 0 of Raster value (Bits 8-1 are in Port 9004h) Bit6-1 Number of video rows (Default is 23 rows; 184 pixels) Bit0 Character size (0=Normal 8x8, 1=Large 8x16) |
Bit7-0 Bits 8-1 of Raster value (Bit 0 is in Port 9004h) |
([9004h]-[9001h]) * 2 + [9003h].Bit7 |
Bit Expl. 7 Screen Base A13 (0=ROM, 1=RAM) (Must be RAM, obviously) 6 Screen Base A12 (1 = +1000h) 5 Screen Base A11 (1 = +0800h) 4 Screen Base A10 (1 = +0400h) - Screen Base A9 (1 = +0200h) (A9 defined in Port 9002h) 3 Character Base A13 (0=ROM, 1=RAM) 2 Character Base A12 (1 = +1000h) 1 Character Base A11 (1 = +0800h) 0 Character Base A10 (1 = +0400h) |
CPU VIC Content 0000h-03FFh (see note) 1K Internal RAM 0400h-0FFFh No 3K Expansion RAM 1000h-1FFFh Characters/Screen 4K Internal RAM 8000h-8FFFh Characters 4K Character ROM 9000h-9FFFh No 4K I/O Area |
Bit7-0 Light pen position in pixels (00h=upper/left) |
Bit7-0 Paddle Input (0-FFh) (A/D converted variable resistance) |
Bit 7 Sound Enable (0=Off, 1=On) Bit 6-0 Sound Frequency (0-127); F = Baseclock / (127-X) |
Bit 7-4 Auxiliary color (0-15) (Color 3 for Multi-Color tiles) Bit 3-0 Volume for all Sound channels (0=Off, 15=Loudest) |
Bit 7-4 Background/Screen Color (0-15) (Color 0 of all tiles) Bit 3 Character Reverse Mode (0=Inverted, 1=Normal) Bit 2-0 Border Color (0-7) (also Color 1 of Multi-Color tiles) |
Bit7-4 Not used (returns garbage when reading) Bit3 Resolution/Depth (0=Hi-Res 8x8, 2 color, 1=Multi-Color 4x8, 4 color) Bit2-0 Character Color (0-7) (Indepent color for each tile) |
Hi-Res Multi-Color Color Source Color 0 Color 0 Screen color (0-15) (Port 900Fh, Bit4-7) - Color 1 Border color (0-7) (Port 900Fh, Bit0-2) Color 1 Color 2 Character color (0-7) (Color RAM) - Color 3 Auxiliary color (0-15) (Port 900Eh, Bit4-7) |
0 Black 8 Orange 1 White 9 Light Orange 2 Red 10 Light Red (Pink) 3 Cyan (Green+Blue) 11 Light Cyan 4 Purple (Red+Blue) 12 Light Purple 5 Green 13 Light Green 6 Blue 14 Light Blue 7 Yellow (Green+Red) 15 Light Yellow |
Type NTSC 60Hz PAL 50Hz Oscillator 14.318181 MHz 17.734472 MHz Divider Osc/14 Osc/16 System Clock 1.022727 MHz 1.108405 MHz Visible ???x??? ???x??? Scanlines 261 312 Clks/Line 65 clks 71 clks Clks/Char 2 clks 2 clks |
VIC20 Versatile Interface Adapters (VIA 1 and 2) |
Bit Pin(s) Purpose/Example PB0 USR.C RS232 Received data (Sin) (0=Low) PB1 USR.D RS232 Request to Send (RTS) (0=Low) PB2 USR.E RS232 Data terminal ready (DTR) (0=Low) PB3 USR.F RS232 Ring indicator (RI) (0=Low) PB4 USR.H RS232 Received line signal (DCD) (0=Low) PB5 USR.J Not used with RS232 (0=Low) PB6 USR.K RS232 Clear to send (CTS) (0=Low) PB7 USR.L RS232 Data set ready (DSR) (0=Low) |
Bit Pin(s) Purpose/Example PA0 SIO.4 Serial CLK IN (0=Low) PA1 SIO.5 Serial DATA IN (0=Low) PA2 JOY.1/USR.4 Joy S0 Up ;JOY S0,S1,S2,S4 controlled by VIA #1 Port A PA3 JOY.2/USR.5 Joy S1 Down ;JOY S3: see VIA #2 Port B PA4 JOY.3/USR.6 Joy S2 Left/Paddle Switch X (0=Low) PA5 JOY.6/USR.7 Joy S4 Fire/Lightpen (0=Low) PA6 CAS.6/USR.8 Cassette switch sense (0=Low) PA7 SIO.3/USR.9 Serial ATN out (1=Low) (Inverted) |
Item Pin(s) Purpose/Example T1 Timer 1 T2 Timer 2 SHFT Shift register CA1 KEYB Restore key (0=Low=Pressed) CA2 CAS.3 Cassette motor control (?=On) CB1 USR.B Interrupt signal for received RS-232 data CB2 USR.M Transmitted RS-232 data /INT CPU.6/EXP.W CPU Non Maskable Interrupt (and Expansion Port) (NMI) |
Bit Pin(s) Purpose/Example PB0-7 COL.0-7 Keyboard Column scan (0=Low) PB3 COL.3/CAS.5 Cassette write line (0=Low) PB7 COL.7/JOY.4 Joy S3 Right/Paddle Switch Y (0=Low) |
Bit Pin(s) Purpose/Example PA0-7 ROW.0-7 Keyboard Row scan (0=Low) |
Item Pin(s) Purpose/Example T1 Timer 1 (used for 60Hz Jiffy clock interrupt) T2 Timer 2 SHFT Shift register CA1 CAS.4 Cassette read line (0=Low) CA2 SIO.4 Serial CLK OUT (1=Low) (Inverted) CB1 SIO.1 Serial SRQ IN (0=Low) CB2 SIO.5 Serial DATA OUT (1=Low) (Inverted) /INT CPU.4/EXP.19 CPU Interrupt Request (and Expansion Port) (IRQ) |
VIC20 Pinouts for Input/Output Devices |
Pin Control Name Purpose 1 VIA1.PA2 JOY0 Up 2 VIA1.PA3 JOY1 Down 3 VIA1.PA4 JOY2 Left/Paddle Switch X 4 VIA2.PB7 JOY3 Right/Paddle Switch Y 5 VIC.POTY POTY Paddle Position Y 6 VIA1.PA5 JOY4 Fire/Lightpen 7 - 5V +5V (max 100mA) 8 - GND Ground 9 VIC.POTX POTX Paddle Position X |
1 +5V REG (max 10mA) 2 GND 3 AUDIO 4 VIDEO LOW (VIC20: via 3.9uH & capacitor, VIC20CR: shortcut with Pin 5) 5 VIDEO HIGH (direct output without loop/capacitor, otherwise same as Pin 4) |
1 SERIAL SRQ IN 2 GND 3 SERIAL ATN OUT 4 SERIAL CLC IN/OUT 5 SERIAL DATA IN/OUT 6 /RESET (or N.C.) |
A-1 GND B-2 +5V C-3 CASSETTE MOTOR (VIA1.CA2) (+9V) D-4 CASSETTE READ (VIA2.CA1) E-5 CASSETTE WRITE (VIA2.PB3) F-6 CASSETTE SWITCH (VIA1.PA6) |
1 GND Ground A GND Ground 2 5V +5VDC max 100mA B CB1 RS232 Interrupt for Sin 3 /RES /RESET C PB0 RS232 Received data (Sin) 4 PA2 JOY0 Up D PB1 RS232 Request to Send (RTS) 5 PA3 JOY1 Down E PB2 RS232 Data terminal ready (DTR) 6 PA4 JOY2 Left/Paddle Switch X F PB3 RS232 Ring indicator (RI) 7 PA5 JOY4 Fire/Lightpen H PB4 RS232 Received line signal (DCD) 8 PA6 Cassette switch sense J PB5 Not used with RS232 9 PA7 SERIAL ATN OUT K PB6 RS232 Clear to send (CTS) 10 9V 9VAC Phase 1 max 100mA L PB7 RS232 Data set ready (DSR) 11 9V 9VAC Phase 2 max 100mA M CB2 RS232 Transmitted data (Sout) 12 GND Ground N GND Ground |
Pin Name Description 2-9 CD0-7 Data bus Bits 0-7 B-S CA0-13 Address bus Bits 0-13 (upper bits decoded in /IO,/RAM,/BLK) 10-12 /BLK1-3 8K decoded RAM/ROM blocks 1,2,3 at 2000h,4000h,6000h 13 /BLK5 8K decoded ROM block 5 at A000h 14-16 /RAM1-3 1K decoded RAM blocks 1,2,3 at 0400h,0800h,0C00h T-U /IO2-3 I/O blocks 2,3 (located at 9800h,9C00h) (eg. IEEE adapter) 17 VR/W Read/Write line from VIC chip (high-read, low-write) 18 CR/W Read/Write line from CPU chip (high-read, low-write) V PHI2 Phase 2 system clock 19 /IRQ 6502 Interrupt Request ("keyboard scan and system clock") W /NMI 6502 Non Maskable Interrupt (WARMSTART, RUN/STOP-RESTORE) X /RESET 6502 RESET pin 21 +5V Supply 1,22,A,Z GND System ground 20 (NC) Not connected Y SNDIN Not connected (VIC20), or Audio In (VIC20CR) |
1 N.C. 2 COMP COLOR 3 SYNC & LUMINANCE 4 R/W 5-16 DB11-0 17,18 POTX,POTY 19 SOUND OUT 20 GND 21-34 A0-13 (Note: A13 is gained from /BLK4 signal) 35,36 P01,P02 Clock Out, NTSC: X/14 = 1.02MHz, PAL: X/16 = 1.11MHz 37 LPEN 38,39 X02,X01 Clock In, NTSC: 14318181Hz, PAL:17734472Hz 40 VCC 5VDC |
C16/PLUS4 Specs |
C16/PLUS4 Tech Data |
CPU 7501/8501 - 6502 compatible with on-chip 7bit I/O Port 16K DRAM (3FFEh bytes can be used) (shared as WRAM and VRAM) 32K ROM (BASIC V3.5, separate KERNALs for PAL-B and NTSC-M) TED (Text Editing Device) for Video, Sound, Timers, Keyboard Four cursor keys (unfortunately arranged all in one row) |
Character graphics, high resolution graphics, Enhanced Colour Mode and reverse characters Multicolour graphics (4x8 character or graphics cells) Writable horizontal and vertical sync counters Horizontal raster position register Same chip for both NTSC-M and PAL-B 1.NTSC: 14318181/16 Hz NTSC = 0.894886 MHz (single), or 1.789773 MHz (twice) 2.PAL: 17734472/20 Hz PAL = 0.886724 MHz (single), or 1.773447 MHz (twice) Double clock mode for faster operation |
C16/PLUS4 Memory and I/O Map |
0000h-0001h I/O CPU 7501/8501 On-chip I/O Port 0002h-7FFFh RAM 8000h-BFFFh RAM or LO ROM (Basic, Function LO, Cart 1 LO, Cart 2 LO) C000h-FBFFh RAM or HI ROM (Kernal, Function HI, Cart 1 HI, Cart 2 HI) FC00h-FCFFh RAM or HI ROM (Kernal) FD00h-FF3Fh I/O Area FF40h-FFFFh RAM or HI ROM (Kernal, Function HI, Cart 1 HI, Cart 2 HI) |
D000h-D7FFh 256 non-inverted tiles |
FCF1h-FCF3h Jump to interrupt routine for cartridge FCF4h-FCF6h Jump to cartridge reenable routine FCF7h-FCF9h Jump to long fetch routine FCFAh-FCFCh Jump to long jump routine FCFDh-FCFFh Jump to long interrupt routine |
0000h - CPU 7501/8501 On-Chip I/O Port Direction 0001h - CPU 7501/8501 On-Chip I/O Port Data (Cassette, Serial, User Port) |
FD00h-FD0Fh - User Port RS232 Controller 6551A (Plus/4 Only - Not C16/C116) FD10h-FD1Fh - Cassette Sense / User Port 8bit Parallel I/O FD30h-FD3Fh - 6529B Keyboard Column Output Latch FDD0h-FDDFh - ROM Bank Latch |
FF00h - Timer 1 Counter/Reload LSB FF01h - Timer 1 Counter/Reload MSB FF02h - Timer 2 Counter LSB FF03h - Timer 2 Counter MSB FF04h - Timer 3 Counter LSB FF05h - Timer 3 Counter MSB FF06h - Video Control Register 1 FF07h - Video Control Register 2 FF08h - Keyboard / Joystick Latch FF09h - Interrupt request register FF0Ah - Interrupt mask register FF0Bh - Raster interrupt register FF0Ch - Hardware-cursor position MSB (2bit) (Bit7-2 unused) FF0Dh - Hardware-cursor position LSB (8bit) FF0Eh - Sound 1 Frequency LSB (8bit) FF0Fh - Sound 2 Frequency LSB (8bit) FF10h - Sound 1 (or 2 ?) Frequency MSB (2bit) (Bit7-2 unused) FF11h - Sound control register FF12h - Bitmap/Character Memory Control and Sound 2 Frequency MSB FF13h - System Clock and Character Memory Control FF14h - Screen/Color Memory Control FF15h - Background Color 0 FF16h - Background Color 1 FF17h - Background Color 2 FF18h - Background Color 3 FF19h - Border Color FF1Ah - Current Character Position MSB (2bit) (Bit7-2 unused) FF1Bh - Current Character Position LSB (8bit) FF1Ch - Current Scanline MSB (1bit) (Bit7-1 unused) FF1Dh - Current Scanline LSB (8bit) FF1Eh - Actual position of horizontal scanning. R/W!. FF1Fh - Flashing Counter and Character Scanline Index |
FF3Eh - CPU/Screen/Color ROM Enable FF3Fh - CPU/Screen/Color RAM Enable |
8000h-8002h Entrypoint (started by JSR 8000h) 8003h-8005h Another Entrypoint, not used by BIOS (?) 8006h Desired Entry Time (00h=Never, 01h=Immediately, 02h..FFh=Later) 8007h-8009h ASCII ID "CBM" |
C16/PLUS4 Keyboard, Joystick, Cassette, Serial, Sound, User Port |
7-0 Keyboard Column 7-0 Selection (0=Select, 1=Deselect) |
7-3 Not used 2 Joystick 1 (0=Select, 1=Deselect) 1 Joystick 2 (0=Select, 1=Deselect) 0 Not used |
7-0 State of Row 7-0 for any selected columns (0=Pressed, 1=Released) 7 Joystick 2 Fire (0=Pressed, 1=Released) 6 Joystick 1 Fire (0=Pressed, 1=Released) 3 Joystick 1/2 Right (0=Moved, 1=Released) 2 Joystick 1/2 Left (0=Moved, 1=Released) 1 Joystick 1/2 Down (0=Moved, 1=Released) 0 Joystick 1/2 Up (0=Moved, 1=Released) |
Bit Dir Expl. 7 In Serial Data In (and PLUS/4: Cas Sense) (0=Low, 1=High) 6 In Serial Clock In (0=Low, 1=High) 5 - Not used (no pin-out on 7501/8501) (N/A) 4 In Cassette Read (0=Low, 1=High) 3 Out Cassette Motor (0=9VDC, 1=Off) (Inverted) 2 Out Serial ATN Out (and PLUS/4: User Port) (0=High, 1=Low) (Inverted) 1 Out Serial Clock Out, Cassette Write (0=High, 1=Low) (Inverted) 0 Out Serial Data Out (0=High, 1=Low) (Inverted) |
7-0 User Port 6529B, 8bit Parallel I/O (PLUS/4 Only) 2 Cassette Sense In (C16 and C116 Only) |
reg=1024-(111860.781/frq[Hz]) (NTSC) reg=1024-(111840.45 /frq[Hz]) (PAL) |
Bit7 D/A mode. See below for more. Bit6 Sound #2 noise on/off. If You set both, the square will sound. Bit5 Sound #2 squarewave on/off. Bit4 Sound #1 squarewave on/off. Bit0-3 Volume. Maximum value is 8. //OR:// 0=Off, F=Highest |
C16/PLUS4 Interrupts (Raster and Timers) |
Bit7 Set on Any-Enabled-IRQ Condition (0=None, 1=IRQ) Bit6 Timer 3 Interrupt Request (0=None, 1=IRQ / Acknowledge) Bit5 Unused Bit4 Timer 2 Interrupt Request (0=None, 1=IRQ / Acknowledge) Bit3 Timer 1 Interrupt Request (0=None, 1=IRQ / Acknowledge) Bit2 Lightpen Interrupt Request (Not implemented?) Bit1 Raster Interrupt Request (0=None, 1=IRQ / Acknowledge) Bit0 Unused |
Bit7 Unused Bit6 Timer 3 Interrupt (0=Disable, 1=Enable) Bit5 Unused Bit4 Timer 2 Interrupt (0=Disable, 1=Enable) Bit3 Timer 1 Interrupt (0=Disable, 1=Enable) Bit2 Lightpen Interrupt (Not implemented?) Bit1 Raster Interrupt (0=Disable, 1=Enable) Bit0 High bit of Raster FF0Bh (see there) |
C16/PLUS4 Memory Control (CPU and Video) |
Bit7-6 Unused Bit5-3 Bitmap Base Address (in 8K steps) (ROM/RAM see FF12h.Bit2) Bit2 Character/Bitmap ROM/RAM (0=RAM, 1=ROM) (Address see FF13h.Bit7-2) Bit1-0 Sound 2 Frequency MSB (see Sound chapter) |
Bit7-2 Character Base Address (in 1K steps) (ROM/RAM see FF12h.Bit2) Bit1 Force single clock mode Bit0-??-Memory State READ ONLY (0=RAM, 1=ROM) (change via FF3Eh/FF3Fh) Bit0-??-Status of Clock |
Bit7-3 Video-ram Base Address (in 2K steps) (ROM/RAM see FF3Eh/FF3Fh) Bit2-0 Unused |
Port Write Read RAM Read ROM FF3E ROM SELECT ? HI ROM FF3F RAM SELECT ? HI ROM |
A3-A2 HI-ROM C000h-FFFFh Select (0=Kernal, 1=FuncHI, 2=Cart1Hi, 3=Cart2Hi) A1-A0 LO-ROM 8000h-BFFFh Select (0=Basic, 1=FuncLO, 2=Cart1LO, 3=Cart2LO) |
C16/PLUS4 Video - Control |
Bit7 TEST Internal TED Test (Should be always 0) Bit6 ECM Enhanced color mode (0=Normal, 1=Extended) Bit5 BMM Bitmap mode (0=Text, 1=Bitmap) Bit4 DEN Display Enable (0=Blank/Border Color, 1=Display Enable) Bit3 RSEL 24/25 rows screen (0=24 Rows, 1=25 Rows) Bit2-0 Y2-0 Vertical smooth-scrolling |
Bit7 Reverse Mode (0=Reverse/128 Chars, 1=No Reverse/256 Chars) If 0, higmost char-bit tells if char should appear in inverse. Bit6 NTSC Select Video Format (0=PAL, 1=NTSC) (Don't change!) Bit5 RES TED stop. If set, the TED stops it's counters and screen-generating, only single clock and refresh cycles remain. PROJECT 64: Flashing (0=Yes, 1=No) Bit4 MCM Multicolor mode (0=Normal, 1=Multicolor) Bit3 CSEL 40/38 columns screen (0=38 Columns, 1=40 Columns) Bit2-0 X2-0 Horizontal smooth-scrolling |
C16/PLUS4 Video - Cursor and Color |
Bit7 Not used Bit6-4 Luminance (Not used for Color Black) Bit3-0 Color |
0 ------ Black 8 RRG--- Orange 1 R-G-B- White 9 R-g--- Brown 2 RR---- Red 10 R-GG-- Yellow-Green 3 --GGBB Cyan 11 RR--B- Pink 4 RR--BB Purple 12 --G-BB Blue-Green 5 --GG-- Green 13 R---BB Light Blue 6 ----BB Blue 14 --g-B- Dark Blue 7 RRGG-- Yellow 15 GG--B- Light Green |
C16/PLUS4 Video - Rendering |
Bit7 Unused Bit6-3 Flashing counter. It's value increases with every frame, and TED fits it's flashing feature to this register's reaching to 15. Bit2-0 Actual vertical scanning-line in a character-row (R/W!) |
C16/PLUS4 Video Modes |
1K color memory (1st 400h bytes of Color/Screen memory) bit7 Flashing (Hires Text Mode only) bit6-4 Luminance (Not used for Color Black) bit3 Multicolor (Multicolor Text Mode only) bit3-0 Color (Only Bit2-0 in Multicolor Text Mode) 1K screen memory (2nd 400h bytes of Color/Screen memory) bit7 Inversion (Hires Text Mode, with FF07h/Bit7=0 only) bit7-6 Extended BG Color (Extended Text Mode only) bit7-0 Tile number 0-255 (max 127 or 63 for Inversion / Extended BG) 2K character memory (800h bytes) (for 256 tiles) |
0 Background color 0 (Port FF15h) 1 Color Memory (with Flashing Bit in Bit7) |
0 Background color 0-3 (Port FF15h-FF18h) select by upper 2bit of tileno 1 Color Memory (Bit7 probably unused?) |
0 0 Background color 0 (Port FF15h) - 1 Background color 1 (Port FF16h) - 2 Background color 2 (Port FF17h) 1 3 Color Memory (Bit3 selects Hires (0) or Color (1) tile-mode) (Multicolor mode uses only 6 bits for color/luminance) (Bit7 in Color Memory probably unused?) |
1K intensity memory (1st 400h bytes of Color/Screen memory) bit7 Not used bit6-4 Luminance MSB (Not used for Color Black) bit3 Not used bit2-0 Luminance LSB (Not used for Color Black) 1K color memory (2nd 400h bytes of Color/Screen memory) bit7-4 Color MSB bit3-0 Color LSB 8K bitmap (2000h bytes) (consisting of 40x25 tiles) |
0 Color LSB with Luminance MSB 1 Color MSB with Luminance LSB |
0 Background color 0 (Port FF15h) 1 Color LSB with Luminance MSB 2 Color MSB with Luminance LSB 3 Background color 1 (Port FF16h) |
C16/PLUS4 Dimensions and Timings |
Item NTSC PAL Oscillator 14.318181 MHz 17.734472 MHz Divider Osc/16 Osc/20 Single Clock 0.894886 MHz 0.886724 MHz Twice Clock 1.789773 MHz 1.773447 MHz Frame Rate 60Hz 50Hz Scanlines 262 312 Clks/Line 57 single clks 57 single clks |
Dot clock = 8 times processor clock Two blocked DMA fetches per character line Writable horizontal and vertical sync counters Horizontal raster position register |
C16/PLUS4 Pin-Outs |
1 C16/C116: 5VDC via 330 Ohm - PLUS/4: N.C. 2 GND 3 ATN OUT 4 CLK IN/OUT 5 DATA IN/OUT 6 /RESET OUT |
1 JOY0 Up (TED K0 Input) 2 JOY1 Down (TED K1 Input) 3 JOY2 Left (TED K2 Input) 4 JOY3 Right (TED K3 Input) 5 5VDC 6 BINA Fire (TED K6 or K7 Input) 7 GND 8 SELECT (Amplified CPU databus D1 or D2 signal) |
SELECT C16 C116 PLUS/4 BINA BASIC D1=LOW JOY2 JOY1/JOYB JOY1 K7 JOY(2) D2=LOW JOY1 JOY0/JOYA JOY0 K6 JOY(1) |
1 GND 2 5VDC 3 MOTOR (9VDC) 4 CAS RD 5 CAS WRT 6 SENSE 7 GND |
1 LUM 2 GND 3 AUDIO OUT 4 COMP 5 EXT AUDIO IN 6 COLOR 7 N.C. 8 C16/C116: 5VDC - PLUS4: N.C. |
Y-F A0-A15 21-14 D0-D7 4,5,C /IRQ, R/W, /RESET B,6,7,8 C1 LOW, C1 HIGH, C2 LOW, C2 HIGH 9,10 /CS1, /CS0 11,12,13 /CAS, MUX, BA D,E,24,22 /RAS, Phi0, Phi2, AEC 2,3 5VDC I,A,CC,25 GND AA,BB N.C. Z N.C. (RAMEN ?) 23 EXT AUDIO IN |
M,E,D,B8?,H,L,C 6551A TxD,DTR,RTS,RxC,DCD,DSR,RxD 1,12,A,N GND 2 5VDC 10,11 9VAC1, 9VAC2 9 SIO ATN 3 /RESET (OUT) F,J,7,6,5,4,K,B8? 6529B P7-P0 |
Keyboard Matrix |
Bit Col0 Col1 Col2 Col3 Col4 Col5 Col6 Col7 Row0 DEL "3" "5" "7" "9" "+" PND "1" Row1 RET "W" "R" "Y" "I" "P" "*" <-- Row2 RIGHT "A" "D" "G" "J" "L" ";" CTRL Row3 F7 "4" "6" "8" "0" "-" HOME "2" Row4 F1 "Z" "C" "B" "M" "." RSHIFT SPC Row5 F3 "S" "F" "H" "K" ":" "=" <C=> Row6 F5 "E" "T" "U" "O" "@" "^" "Q" Row7 DOWN LSHIFT "X" "V" "N" "," "/" STOP |
C64 "-" "+" POUND HOME DOWN RIGHT RSHIFT <-- "^" "@" C16 UP DOWN LEFT RIGHT "@" POUND ESC? HOME "+" "-" |
<-- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - PND HOME DEL F1 CTRL Q W E R T Y U I O P @ * ^ RESTORE F3 STP SHL A S D F G H J K L :[ ;] = [RETURN] F5 C= SHIFT Z X C V B N M ,< .> /? SHIFT U/D L/R F7 [ _ _ _ _ _ SPACE _ _ _ _ _] |
ESC TAB ALT CAPS HLP LF 40 SCR UP DOWN LFT RGT F1 F3 F5 F7 <-- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - PND HOME DEL 7 8 9 + CTRL Q W E R T Y U I O P @ * ^ RESTORE 4 5 6 - STP SHL A S D F G H J K L :[ ;] = [RETURN] 1 2 3 EN- C= SHIFT Z X C V B N M ,< .> /? SHIFT U/D L/R [-0-] . TER [ _ _ _ _ _ SPACE _ _ _ _ _] |
ESC 1 2 3 4 5 6 7 8 9 0 L R U D DEL F1 CTRL Q W E R T Y U I O P @ + - HOME F2 RN SL A S D F G H J K L ; : * RETRN F3 C= SHF Z X C V B N M , . / SHF $ = HELP [------SPACE------] |
F1 F2 F3 HELP HOME? DEL? ESC 1 2 3 4 5 6 7 8 9 0 + - * CTRL Q W E R T Y U I O P @ RET RUN $ A S D F G H J K L [ ] = _|_ C= SHF Z X C V B N M , . / SHF | [------SPACE------] |
F1 F2 F3 HELP <-- reset button (side) ESC 1 2 3 4 5 6 7 8 9 0 + - = HOME DEL CTRL Q W E R T Y U I O P @ PND * CTRL RN SL A S D F G H J K L [ ] RETURN C= SHF Z X C V B N M , . / SHF _|_ [-----SPACE-----] | |
Key Full name Normal use Shifted use HOME CLR/HOME Move cursor to 0,0 Move to 0,0 and clear screen DEL INST/DEL Backspace Insert one SPACE not moving cursor STP RUN/STOP Stop/Break Start Cassette Loading (LOAD+RUN) C= COMMODORE Keycombinations... Toggle Character Set 1 and 2 U/D CRSR Cursor Down Cursor Up L/R CRSR Cursor Right Cursor Left F1/F2 FUNCTION F1 F2 F3/F4 FUNCTION F3 F4 F5/F6 FUNCTION F5 F6 F7/F8 FUNCTION F7 F8 |
KERNAL Functions |
The KERNAL then checks for the presence of an autostart ROM cartridge at location C64:8000h, VIC20:A000h. If this is present, normal initialization is suspended, and control is transferred to the car- tridge code. |
KERNAL Load/Save Functions |
The following codes are used by the Commodore 64 to stand for the CBM devices listed below: ADDRESS DEVICE 0 Keyboard 1 Datassette(TM) 2 RS-232C device 3 CRT display 4 Serial bus printer 8 CBM serial bus disk drive Device numbers 4 or greater automatically refer to devices on the serial bus. A command to the device is sent as a secondary address on the serial bus after the device number is sent during the serial attention handshaking sequence. If no secondary address is to be sent, the Y index register should be set to 255. |
Registers affected: A, X, Y |
KERNAL General File Input/Output |
Preparatory routines: CHKIN, OPEN Error returns: See READST Description: If the channel is the keyboard, this subroutine removes one character from the keyboard queue and returns it as an ASCII value in the accumulator. If the queue is empty, the value returned in the accumulator will be zero. Characters are put into the queue automatically by an interrupt driven keyboard scan routine which calls the SCNKEY routine. The keyboard buffer can hold up to ten characters. After the buffer is filled, additional characters are ignored until at least one character has been removed from the queue. If the channel is RS-232, then only the A register is used and a single character is returned. See READST to check validity. If the channel is serial, cassette, or screen, call BASIN routine. |
How to Use: 1) Call this routine using a JSR instruction. 2) Check for a zero in the accumulator (empty buffer). 3) Process the data. EXAMPLE: ;WAIT FOR A CHARACTER WAIT JSR GETIN CMP #0 BEQ WAIT |
+-----------------------------------------------------------------------+ | NOTE: Care must be taken when using this routine to send data to a | | specific serial device since data will be sent to all open output | | channels on the bus. Unless this is desired, all open output channels | | on the serial bus other than the intended destination channel must be | | closed by a call to the KERNAL CLRCHN routine. | +-----------------------------------------------------------------------+ |
Description: This routine is called to clear all open channels and re- store the I/O channels to their original default values. It is usually called after opening other I/O channels (like a tape or disk drive) and using them for input/output operations. The default input device is 0 (keyboard). The default output device is 3 (the Commodore 64 screen). If one of the channels to be closed is to the serial port, an UNTALK signal is sent first to clear the input channel or an UNLISTEN is sent to clear the output channel. By not calling this routine (and leaving lis- tener(s) active on the serial bus) several devices can receive the same data from the Commodore 64 at the same time. One way to take advantage of this would be to command the printer to TALK and the disk to LISTEN. This would allow direct printing of a disk file. This routine is automatically called when the KERNAL CLALL routine is executed. |
Description: This routine is used to close a logical file after all I/O operations have been completed on that file. This routine is called after the accumulator is loaded with the logical file number to be closed (the same number used when the file was opened using the OPEN routine). |
Description: This routine closes all open files. When this routine is called, the pointers into the open file table are reset, closing all files. Also, the CLRCHN routine is automatically called to reset the I/O channels. |
KERNAL Serial Bus Low Level Functions |
This routine always buffers one character. (The routine holds the previous character to be sent back.) So when a call to the UNLSN routine is made to end the data transmission, the buffered character is sent with an End Or Identify (EOI) set. Then the UNLSN command is sent to the device. |
In: A=Device Number (0-1Fh) Error returns: See READST Registers affected: A |
Communication registers: A Preparatory routines: LISTEN Error returns: See READST Registers affected: A Description: This routine is used to send a secondary address to an I/O device after a call to the LISTEN routine is made, and the device is commanded to LISTEN. The routine can NOT be used to send a secondary address after a call to the TALK routine. A secondary address is usually used to give setup information to a device before I/O operations begin. When a secondary address is to be sent to a device on the serial bus, the address must first be ORed with $60. |
In: N/A - Out: A=Destroyed Error returns: See READST |
In: N/A - Out: A=Destroyed Error returns: See READST |
KERNAL System Control |
Description: This routine sets up the 6567 video controller chip in the Commodore 64 for normal operation. The KERNAL screen editor is also initialized. This routine should be called by a Commodore 64 program cartridge. |
Description: This routine initializes all input/output devices and routines. It is normally called as part of the initialization procedure of a Commodore 64 program cartridge. |
Description: This routine is used to test RAM and set the top and bottom of memory pointers accordingly. It also clears locations $0000 to $0101 and $0200 to $03FF. It also allocates the cassette buffer, and sets the screen base to $0400. Normally, this routine is called as part of the initialization process of a Commodore 64 program cartridge. |
Description: This routine restores the default values of all system vectors used in KERNAL and BASIC routines and interrupts. (See the Memory Map for the default vector contents). The VECTOR routine is used to read and alter individual system vectors. |
Get: In: Cy=1, Y:X=Target Address - Out: A,X,Y=Destroyed Set: In: Cy=0, Y:X=Source Address - Out: A,X,Y=Destroyed |
Set: In: Cy=0, Y:X=Address Get: In: Cy=1 - Out: Y:X=Address (usually 800h on C64) |
Set: In: Cy=0, Y:X=Address Get: In: Cy=1 - Out: Y:X=Address (usually A000h on C64) |
In: N/A - Out: A,X,Y=Destroyed |
Out: X=Width, Y=Height (40x25 for C64/C16, 22x23 for VIC20) |
Set: In: Cy=0, X=0..24, Y=0..39 - Out: A=Destroyed Get: In: Cy=1 - Out: X=0..24, Y=0..39 |
In: N/A - Out: Y:X:A=Time in 1/60 seconds (jiffies) The clock range is 24 hours, 0..5183999 (0..4F19FFh) jiffies, and starts over at zero when exceeding that range. |
In: A.Bit7 Timeout Flag (0=Set/Enable, 1=Reset/Disable) - Out: Same |
Description: When the timeout flag is set, the Kernal will wait for a device on the IEEE port for 64 milliseconds. If the device does not respond to the Data Address Valid (DAV) signal within that time then the Kernal will recognize an error condition and leave the handshake sequence. |
In: N/A - Out: A,X=Destroyed, Zeroflag=STOP Flag |
KERNAL Error Handling |
ERROR RETURNS: A return from a KERNAL routine with the CARRY set indicates that an error was encountered in processing. The accumulator will contain the number of the error. NOTE: Some KERNAL I/O routines do not use these codes for error messages. Instead, errors are identified using the KERNAL READST routine. |
If an error occurs during a KERNAL routine, the carry bit is set, and the number of the error message is returned in the accumulator. Num Expl. 0 Routine terminated by the <STOP> key 1 Too many open files 2 File already open 3 File not open 4 File not found 5 Device not present 6 File is not an input file 7 File is not an output file 8 File name is missing 9 Illegal device number 240 Top-of-memory change RS-232 buffer allocation/deallocation |
Bit Expl. 0 Serial Bus: Time out write 1 Serial Bus: Time out read 2 Cassette: Short Block 3 Cassette: Long Block 4 Cassette: Any mismatch/Unrecoverable read error 5 Cassette: Checksum error 6 Cassette: End of file, Serial Bus: EOI line (End Or Identify) 7 Cassette: End of tape, Serial Bus: Device not present |
Communication registers: A Registers affected: A Bit7 0=Disable, 1=Enable Control Messages (eg. PRESS PLAY ON CASSETTE) Bit6 0=Disable, 1=Enable Error Messages (eg. FILE NOT FOUND) |
KERNAL First Kilobyte RAM (0000h-03FFh) |
Address Name Expl. 0000h D6510 C64: 6510 On-Chip Data-Direction Register 0001h R6510 C64: 6510 On-Chip Data-Input/Output Register 0002h C64: Unused |
0000h VIC20: USR Function JMP Opcode (4Ch) (C64: see 0310h) 0001h-0002h VIC20: USR Function Vector (MSB,LSB) (C64: see 0311h) 0003h-0004h ADRAY1 Jump Vector: Convert Float--Integer 0005h-0006h ADRAY2 Jump Vector: Convert Integer--Float 0007h CHARAC Search Character 0008h ENDCHR Flag: Scan for Quote at End of String 0009h TRMPOS Screen Column From Last TAB 000Ah VERCK Flag: 0=Load, 1=Verify 000Bh COUNT Input Buffer Pointer / Number of Subscripts 000Ch DIMFLG Flag: Default Array DIMension 000Dh VALTYP Data Type: FFh=String, 00h=Numeric 000Eh INTFLG Data Type: 80h=Integer, 00h=Float 000Fh GARBFL Flag: DATA scan/LIST quote/Garbage Coll 0010h SUBFLG Flag: Subscript Ref / User FNx Function Call 0011h INPFLG Flag: 00h=INPUT, 40h=GET, 98h=READ 0012h TANSGN Flag: ATN/TAN sign / Comparison Result 0013h Flag: INPUT Prompt 0014h-0015h LINNUM Temp: Integer Value (see Float conversion 0003h,0005h) 0016h TEMPPT Pointer Temporary String Stack 0017h-0018h LASTPT Last Temp String Address 0019h-0021h TEMPST Stack for Temporary Strings 0022h-0025h INDEX Utility Pointer Area (0022h: INDEX1, 0024h: INDEX2) 0026h-002Ah RESHO Floating-Point Product of Multiply 002Bh-002Ch TXTTAB Pointer: Start of BASIC Program 002Dh-002Eh VARTAB Pointer: Start of BASIC Variables (End of Basic program) 002Fh-0030h ARYTAB Pointer: Start of BASIC Arrays (End of Variables) 0031h-0032h STREND Pointer: Start of free memory (End of Arrays+1) 0033h-0034h FRETOP Pointer: Bottom of String Storage (End of Free memory) 0035h-0036h FRESPC Utility String Pointer 0037h-0038h MEMSIZ Pointer: Highest Address Used by BASIC (End of Strings) 0039h-003Ah CURLIN Current BASIC Line Number 003Bh-003Ch OLDLIN Previous BASIC Line Number 003Dh-003Eh OLDTXT Pointer: BASIC Statement for CONT 003Fh-0040h DATLIN Current DATA Line Number 0041h-0042h DATPTR Pointer: Current DATA Item Address 0043h-0044h INPPTR Vector: INPUT Routine 0045h-0046h VARNAM Current BASIC Variable Name 0047h-0048h VARPNT Current BASIC Variable Address (Pointer) 0049h-004Ah FORPNT Pointer: Index Variable for FOR/NEXT 004Bh-0060h Temp Pointer / Data Area 004Bh-004Ch VARTXT Temporary storage for TXTPTR during READ, INPUT, GET 004Dh OPMASK Mask used during FRMEVL / Comparison symbol accumulator 004Eh-0052h TEMPF3 Temporary storage for FLPT value. 0053h FOUR6 Length of String Variable during Garbage collection. 0054h-0056h JMPER Jump Vector used in Function Evaluation (4Ch, LSB, MSB) 0057h-005Bh TEMPF1 Temporary storage for FLPT value. 005Ch-0060h TEMPF2 Temporary storage for FLPT value. |
0061h-0066h FAC Floating-Point Accumulator 1 (Exp,4-Byte Mantissa,Sign) 0067h SGNFLG Pointer: Series Evaluation Constant 0068h BITS Floating-Point Accumulator 1 (Overflow Digit) 0069h-006Eh ARG Floating-Point Accumulator 2 (Exp,4-Byte Mantissa,Sign) 006Fh ARISGN Sign Comparison Result: Accumulator 1 vs 2 0070h FACOV Floating-Point Accumulator 1 (Low-Order, Rounding) 0071h-0072h FBUFPT Pointer: Cassette Buffer 0073h-0078h CHRGET Subroutine: Get Next Byte of BASIC Text 0079h CHRGOT Subroutine: Entry to Get Same Byte of Text Again 007Ah-007Bh TXTPTR Pointer: Current Byte of BASIC Text 007Ch-008A Subroutine: Rest of the CHRGET/CHRGOT Subroutines 008Bh-008Fh RNDX Floating RND Function Seed Value |
0090h STATUS Kernal I/O Status Word: ST 0091h STKEY Flag: STOP key / RVS key 0092h SVXT Timing Constant for Tape 0093h VERCK Flag: 0=Load, 1=Verify 0094h C3PO Flag: Serial Bus-Output Character Buffered 0095h BSOUR Buffered Character for Serial Bus 0096h SYNO Cassette Sync No. / Tape EOT received 0097h Temp Data Area / Register save 0098h LDTND Number of Open Files / Index to File Table 0099h DFLTN Default Input Device (normally 0=Keyboard) 009Ah DFLTO Default Output (CMD) Device (normally 3=Screen) 009Bh PRTY Tape Character Parity 009Ch DPSW Flag: Tape Byte-Received 009Dh MSGFLG Flag: 80h=Direct Mode, 00h=Program RUN 009Eh PTR1 Tape Pass 1 Error Log 009Fh PTR2 Tape Pass 2 Error Log 00A0h-00A2h TIME 60Hz Real-Time Jiffy Clock (approx) 1/60 Sec 00A3h-00A4h Temp Data Area 00A5h CNTDN Cassette Sync Countdown 00A6h BUFPNT Pointer: Tape I/O Buffer 00A7h INBIT RS-232 Input Bits / Cassette Temp 00A8h BITCI RS-232 Input Bit Count / Cassette Temp 00A9h RINONE RS-232 Flag: Check for Start Bit 00AAh RIDATA RS-232 Input Byte Buffer/Cassette Temp 00ABh RIPRTY RS-232 Input Parity / Cassette Short Cnt 00ACh-00ADh SAL Pointer: Tape Buffer / Screen Scrolling 00AEh-00AFh EAL Tape End Addresses/End of Program 00B0h-00B1h CMP0 Tape Timing Constants 00B2h-00B3h TAPE1 Pointer: Start of Tape Buffer 00B4h BITTS RS-232 Out Bit Count / Cassette Temp 00B5h NXTBIT RS-232 Next Bit to Send/ Tape EOT Flag 00B6h RODATA RS-232 Out Byte Buffer 00B7h FNLEN Length of Current File Name 00B8h LA Current Logical File Number 00B9h SA Current Secondary Address 00BAh FA Current Device Number 00BBh-00BCh FNADR Pointer: Current File Name 00BDh ROPRTY RS-232 Out Parity / Cassette Temp 00BEh FSBLK Cassette Read / Write Block Count 00BFh MYCH Serial Word Buffer 00C0h CAS1 Tape Motor Interlock 00C1h-00C2h STAL I/O Start Address (VIC20:8000h, C64:A000h) (both wrong?) 00C3h-00C4h MEMUSS Tape Load Temps / VIC20: KERNAL setup pointer 00C5h LSTX Current Key Pressed (40h=None) (0-3Fh=Key Number) The Key Numbers differ on C64/VIC20. If more than 1 key is down, the key with the highest number shows up here. Not used for special keys like SHIFT, CTRL, etc. 00C6h NDX Number of Chars in Keyboard Buffer (see also: 0277h) 00C7h RVS Flag: Reverse Chars (01h=On/Yes, 00h=Off/Not Used) 00C8h INDX Pointer: End of Logical Line for INPUT 00C9h-00CAh LXSP Cursor X,Y Position at Start of INPUT 00CBh SFDX C64: Flag: Print Shifted Chars. 00CBh VIC20: Current key pressed (same as 00C5h) 00CCh BLNSW Cursor Blink enable (0=Flash Cursor) (copy of 00C6h) 00CDh BLNCT Timer: Countdown to Toggle Cursor 00CEh GDBLN Character Under Cursor 00CFh BLNON Flag: Last Cursor Blink On/Off 00D0h CRSW Flag: INPUT or GET from Keyboard / from screen 00D1h-00D2h PNT Pointer: Cursor Current Screen Line Address 00D3h PNTR Cursor Column on Current Line 00D4h QTSW Flag: Editor in Quote Mode (00h=No/Direct Cursor) 00D5h LNMX Screen Line Length, screen_width*(1..4)-1 00D6h TBLX Current Cursor Line Number (see also: 00D1h-00D2h,00D3h) 00D7h Temp Data Area, last inkey/checksum/buffer 00D8h INSRT Insert Mode (00h=Disable, NNh=Number of spaces left) 00D9h-00F2h LDTB1 Screen Line Link Table / Editor Temps 00F3h-00F4h USER Pointer: Current Screen Color RAM location 00F5h-00F6h KEYTAB Pointer: Current Keyboard Decode Table (Norm,Shift,etc.) 00F7h-00F8h RIBUF RS-232 Input Rcv Buffer Pointer 00F9h-00FAh ROBUF RS-232 Output Tx Buffer Pointer 00FBh-00FEh FREKZP User Program Zero-Page Space (not used by BASIC/KERNAL) 00FFh BASZPT BASIC Temp Data Area |
0100h-01FFh Micro-Processor System Stack Area 0100h-010Ah Floating to String Work Area 0100h-013Eh BAD Tape Error Log |
0200h-0258h BUF System INPUT Buffer 0259h-0262h LAT KERNAL Table: Active OPEN Logical File Numbers 0263h-026Ch FAT KERNAL Table: Device Number for each File 026Dh-0276h SAT KERNAL Table: Secondary Address for each File 0277h-0280h KEYD Keyboard Buffer Queue (see also: 00C6h,0289h) 0281h-0282h MEMSTR Pointer: Bottom of Memory for Operating System 0283h-0284h MEMSIZ Pointer: Top of Memory for Operating System 0285h TIMOUT Flag: Kernal Variable for IEEE or Serial Timeout 0286h COLOR Current Character Color Code 0287h GDCOL Background Color Under Cursor 0288h HIBASE Start of Screen Memory (MSB=Page) 0289h XMAX Size of Keyboard Buffer (max 0Ah, see also: 0277h,0289h) 028Ah RPTFLG Flag: Key Repeat (00h=Cursor Keys, 80h=All keys) 028Bh KOUNT Key Repeat Speed Counter 028Ch DELAY Key Repeat Delay Counter 028Dh SHFLAG Keyboard Flags (Bit0=Shift, Bit1=Commodore, Bit2=Ctrl) 028Eh LSTSHF Last Keyboard Shift Pattern 028Fh-0290h KEYLOG Vector: Keyboard Table Setup / Decode Logic 0291h MODE Flag: SHIFT+COMMODORE Case Switch (0=Enable,80h=Disable) 0292h AUTODN Flag: Auto Scroll Down (0=On, other=Off) 0293h M51CTR RS-232: 6551 Control Register Image 0294h MS1CDR RS-232: 6551 Command Register Image 0295h-0296h M51AJB RS-232 Non-Standard BPS (Time/2-100) USA 0297h RSSTAT RS-232: 6551 Status Register Image 0298h BITNUM RS-232 Number of bits left to send 0299h-029Ah BAUDOF RS-232 Baud Rate: Full Bit Time (us) 029Bh RIDBE RS-232 Index to Input Buffer End 029Ch RIDBS RS-232 Start of Input Buffer (Page) 029Dh RODBS RS-232 Start of Output Buffer (Page) 029Eh RODBE RS-232 Index to Output Buffer End 029Fh-02A0h IRQTMP Holds IRQ Vector During Tape I/O 02A1h-02FFh VIC20: Program indirects 02A1h ENABL C64: RS-232 Enables 02A2h C64: TOD Sense During Cassette I/O 02A3h C64: Temp Storage For Cassette Read 02A4h C64: Temp D1 IRQ Indicator For Cassette Read 02A5h C64: Temp For Line Index 02A6h C64: PAL/NTSC Flag, 0= NTSC, 1 = PAL 02A7h-02FFh C64: Unused 0300h-0301h IERROR Vector: Print BASIC Error Message 0302h-0303h IMAIN Vector: BASIC Warm Start 0304h-0305h ICRNCH Vector: Tokenize BASIC Text (Crunch) 0306h-0307h IQPLOP Vector: BASIC Text LIST (Print Tokens) 0308h-0309h IGONE Vector: BASIC Char. Dispatch / Start new Basic code link 030Ah-030Bh IEVAL Vector: BASIC Token Evaluation / arithmetic element link 030Ch-030Fh SxREG Storage for 6502 Registers A,X,Y,P 0310h-0313h VIC20: Unused ? 0310h USRPOK C64: USR Function JMP Opcode (4Ch) (VIC20: see 0000h) 0311h-0312h USRADD C64: USR Function Vector (LSB,MSB) (VIC20: see 0001h) 0313h C64: Unused 0314h-0315h CINV CPU IRQ Vector (redirected IRQ with A,X,Y pushed) 0316h-0317h CBINV CPU BRK Vector (redirected BRK with A,X,Y pushed) 0318h-0319h NMINV CPU NMI Vector (redirected NMI without anything pushed) 031Ah-031Bh IOPEN KERNAL OPEN Vector 031Ch-031Dh ICLOSE KERNAL CLOSE Vector 031Eh-031Fh ICHKIN KERNAL CHKIN Vector 0320h-0321h ICKOUT KERNAL CHKOUT Vector 0322h-0323h ICLRCH KERNAL CLRCHN Vector 0324h-0325h IBASIN KERNAL CHRIN Vector 0326h-0327h IBSOUT KERNAL CHROUT Vector 0328h-0329h ISTOP KERNAL STOP Vector 032Ah-032Bh IGETIN KERNAL GETIN Vector 032Ch-032Dh ICLALL KERNAL CLALL Vector 032Eh-032Fh USRCMD User-Defined Vector 0330h-0331h ILOAD KERNAL LOAD Vector 0332h-0333h ISAVE KERNAL SAVE Vector 0334h-033Bh Unused |
033Ch-03FBh TBUFFR Tape I/O Buffer (General purpose RAM when CAS not used) 03FCh-03FFh Unused |
Versatile Interface Adapter 6522 (VIA) |
Bit Expl. 7-0 Input/Output lines PB7..PB0 (0=Low, 1=High) |
Bit Expl. 7-0 Input/Output lines PA7..PA0 (0=Low, 1=High) |
Bit Expl. 7-0 Direction for Data Port Bits 7-0 (0=Input, 1=Output) |
Reading port 04h/05h returns the upper/lower T1 counter value. Reading port 06h/07h returns the lower/upper T1 latch value. Reading port 04h resets the T1 interrupt flag (IFR.6). Writing port 04h/05h or 06h/07h sets lower/upper bits of the T1 <latch>. Writing port 05h copies the 16bit T1 latch to the 16bit T1 counter. Writing port 05h/07h resets the T1 interrupt flag (IFR.6). |
Writing to 08h sets the T2 low-order <latch>. Writing to 09h sets the T2 high-order <counter>. Writing to 09h also copies lower-order latch to low-order counter. Writing to 09h additionally resets the T2 interrupt flag (IFR.5). Reading from 08h/09h returns the low/high-order T2 counter value. Reading from 08h additionally resets the T2 interrupt flag (IFR.5). |
Reading/writing SR resets the shift counter, and, in most shift modes, starts the transfer and generates an interrupt once the shift counter reaches a value of eight. |
Bit Expl. 7 T1 Toggle PB7 Output (0=Disable, 1=Invert PB7 upon underflow) 6 T1 Continous Mode (0=One-Shot, 1=Restart upon underflow) 5 T2 Clock Source (0=System clock, 1=PB6 negative edge) 4 Shift Register Direction (0=Shift In, 1=Shift Out) 3-2 Shift Register Mode (0-3, see below) 1 PB Latching Enable (0=Disable, 1=Latch PB on CB1 Interrupt Flag) 0 PA Latching Enable (0=Disable, 1=Latch PA on CA1 Interrupt Flag) |
0=Free-Run (when Bit4=1), or Disabled (when Bit4=0) 1=Shift at System 02 Clock rate divided by (2+T2C_L) 2=Shift at System 02 Clock rate divided by 2 3=Shift at external CB1 clock rate |
Bit Expl. 7-5 CB2 Input/Output Control (0-7, see below) 4 CB1 Input Control (0-1, see below) 3-1 CA2 Input/Output Control (0-7, see below) 0 CA1 Input Control (0-1, see below) |
0 (In) Interrupt on negative CX2 edge, Acknowldge by read/write Port PX 1 (In) Interrupt on negative CX2 edge, Independent (without ack via PX) 2 (In) Interrupt on positive CX2 edge, Acknowldge by read/write Port PX 3 (In) Interrupt on positive CX2 edge, Independent (without ack via PX) 4 (Out) Handshake (CX2=LOW on write Port B, CX2=HIGH on active CX1 edge) 5 (Out) Pulse (CX2=LOW for 1 cycle on write to Port PX) 6 (Out) Manual (CX2=LOW) 7 (Out) Manual (CX2=HIGH) |
0 (In) Interrupt on negative CX1 edge, Acknowldge by read/write Port PX 1 (In) Interrupt on positive CX1 edge, Acknowldge by read/write Port PX |
Bit Set by Cleared by 0 CA2 Active edge Read or write ORA (except in Independed mode) 1 CA1 Active edge Read or write ORA 2 Completed 8 shifts Read or write SR 3 CB2 Active edge Read or write ORB (except in Independed mode) 4 CB1 Active edge Read or write ORB 5 T2 Underflow Read T2 low or write T2 high 6 T1 Underflow Read T1 low or write T1 high 7 Any enabled interrupt Cleared only when (IER AND IFR AND 7Fh)=00h |
Write IFR 0-6 Interrupt Acknowledge (0=Keep, 1=Set to Zero) Write IFR 7 No function (Don't care) Read IFR 0-6 Interrupt Request Flags (0=None, 1=Interrupt Request) Read IFR 7 Interrupt signal, set when IER AND IFR AND 7Fh is nonzero |
Write/IER 0-6 Select Interrupt Enable Bits (0=Keep, 1=Set to Bit7) Write/IER 7 New Value for Selected IER Bits (0=Disable, 1=Enable) Read/IER 0-6 Current Value of IER Bits 0-6 (0=Disabled, 1=Enabled) Read/IER 7 Not used (Always 1) |
Pin(s) Dir Purpose PA0-7 I/O Eight general purpose I/O pins PB0-7 I/O Eight general purpose I/O pins PB6 In Optionally used as Timer T2 clock source (negative edge) PB7 Out Optionally toggled on each T1 Timer underflow CA1/CB1 In Edge triggered IRQ (with optional Port A/B latching) CA2/CB2 In Edge triggered IRQ (with optional Port A/B Acknowledge) CA1/CB1 In Port A/B handshake input CA2/CB2 Out Fixed High/Low, or Port A/B Handshake output CB1/CB2 I/O Shift-Register clock/data IRQ Out Interrupt signal send to CPU's /IRQ or /NMI input |
Disk Drive |
Disk Tech Details |
CPU 6502 ???MHz, 16K ROM, 2K RAM, two 6522 I/O and timer chips Read/Write Speed ??? Serial Bus Rate ??? Two serial bus sockets (one towards computer, other for further devices) Power Supply: 100-240V AC, 25 Watts (internally using +5V and +12V) Height 97 mm, Width 200 mm, Depth 374 mm, Weight 16 tons Diskettes: Standard mini 5 1/4", Single Sided (SS), Single Density (SD) Formatting: 35 Tracks, 17-21 sectors per track, 256 bytes per sector Total Capacity: 174848 bytes (683 blocks, 256 bytes each) Free Space: 168656 bytes (664 blocks, 256-2 bytes each) Directory: 144 files per diskette, 16 characters per filename (19 blocks) |
Disk Accessing the Drive |
LOAD "*",8 ;load first file on disk (or recently accessed file) LOAD "FILENAME",8 ;load a specific file by name LOAD "FILENAME",8:RUN ;load and start a file LOAD "$",8:LIST ;load and view the directory LOAD "$0:FILE*",8:LIST ;load and view specific names in the directory SAVE "FILENAME",8 ;save a file to disk SAVE "@0:FILENAME",8 ;save a file to disk and delete old file of same name VERIFY "FILENAME",8 ;compare specified file with program in memory |
/filename load a program from disk > or @ read and display error channel >$ or @$ read and display directory >cmd or @cmd send command to drive |
LOAD file_name, device_number [,command_number] SAVE file_name, device_number [,command_number] VERIFY file_name, device_number OPEN file_number, device_number, channel_number [,file_name] PRINT# file_number, variable list INPUT# file_number, variable list GET# file_number, variable list CLOSE file_number STATUS, CHR$, ASC |
Addr Name Expl. FFBA SETLFS Set logical/physical/secondary address (fileno,device,channel) FFBD SETNAM Set length and address of filename FFC0 OPEN Open a file (parameters must be prepared by SETLFS/SETNAM) FFC3 CLOSE Close a file FFC6 CHKIN Select file_number for CHRIN FFC9 CHKOUT Select file_number for CHROUT FFCC CLRCHN Clear all channels (undoes or terminates CHKIN/CHKOUT ???) FFCF CHRIN Read a byte from the file being selected by CHKIN FFD2 CHROUT Write a byte to the file being selected by CHKOUT |
device_number values 8-11 for 1st-4th attached drive unit (usually 8) drive_number always 0 for normal drives, value 0-1 for dual drives file_number file handle in computer (use any value 1-127) channel_number file handle in drive (0-1 reserved, 2-14 data, 15 cmd/err) file_name ASCII filename (misused to contain parameters in some cases) command_number |
When using the PRINT# statement, if you use commas (,) to separate items on the line, the items will be separated by some blank spaces, as if it were being formatted for the screen. Semicolons (;) don't result in any extra spaces. |
Numeric data written in the file takes the form of a string, as if the STR$ function had been performed on it before writing it out. The first character will be a blank space if the number is positive, and a minus sign (-) if the number is negative. Then comes the number, and the last character is the cursor right character. |
Disk Command and Error Channel |
"COMMAND:parameters",0dh "SPECIAL-COMMAND:parameters",0dh |
"C:parameters",0dh "S-C:parameters",0dh |
"NEW:name,id" format the entire disk, and set disk name and 2 chars ID "NEW:name" clears the directory without re-formatting the whole disk "COPY:newfile=oldfile" copy a file (source and dest both on same disk) "COPY:newfile=f1,f2,f3,f4" copy max 4 files into 1 file "RENAME:newname=oldname" rename a file "SCRATCH:name" delete a file (may use wildcards) "INITIALIZE" closes any open files and reboots the drive "VALIDATE" defragments the disk (do not use with random files) "DUPLICATE" reserved for dual drives (1:1 copy of a whole disk) |
NEW "N COPY "C:new file=:original file RENAME "R:new name=old name" SCRATCH "S:file name" INITIALIZE "I VALIDATE "V DUPLICATE not for single drives C64/default speed "UI+" VIC 20 speed "UI-" |
BLOCK-ALLOCATE "B-A: drive track block" BLOCK-FREE "B-F: drive track block" BLOCK-READ "B-R: channel drive track block" BLOCK-WRITE "B-W: channel drive track block" BLOCK-EXECUTE "B-E: channel drive track block" BUFFER-POINTER "B-P: channel position" USER1 (UA) (READ) "U1: channel drive track block" USER2 (UB) (WRITE) "U2: channel drive track block" |
POSITION "P", channel+96, record_lsb, record_msb [,position] |
MEMORY-READ "M-R", address_lsb, address_msb MEMORY-WRITE "M-W", address_lsb, address_msb, length, data[length] MEMORY-EXECUTE "M-E", address_lsb, address_msb USER Commands "Un" |
U3 or UC jump to 0500h U4 or UD jump to 0503h U5 or UE jump to 0506h U6 or UF jump to 0509h U7 or UG jump to 050Ch U8 or UH jump to 050Fh U; or UJ jump to [FFFC] power-up vector |
"NN,NAME,TR,BL",0dh |
00 OK - No error. 01 NAME??? - No error. Response to SCRATCH (TR=number of files deleted) 02-19 N/A - No error. Reserved for status messages (should be ignored) 20 READ ERROR - Block header not found 21 READ ERROR - No sync mark found on track 22 READ ERROR - Data block not present 23 READ ERROR - Checksum error in data block 24 READ ERROR - Byte decoding error 25 WRITE ERROR - Write-verify error 26 WRITE PROTECT ON - Attempt to write with closed write-protect notch 27 READ ERROR - Checksum error in header 28 WRITE ERROR - No sync mark found after written data block 29 DISK ID MISMATCH - Unformatted disk or bad header 30 SYNTAX ERROR - Invalid command parameters 31 SYNTAX ERROR - Unrecognized command 32 SYNTAX ERROR - Command/parameters longer than 58 characters 33 SYNTAX ERROR - Wildcards used in OPEN/SAVE command 34 SYNTAX ERROR - Missing filename in command string 39 SYNTAX ERROR - Unrecognized command. "Command file not found" ??? 50 RECORD NOT PRESENT - Reading past the last record. Positioning to a record beyond end of file in a relative file. If the intent is to expand the file by adding the new record (with a PRINT# command), the error message may be ignored. INPUT or GET should not be attempted after this error is detected without first repositioning. 51 OVERFLOW IN RECORD - Writing exceeds record boundary. 52 FILE TOO LARGE - Record position in relative file exceeds disk space 60 WRITE FILE OPEN - Tried to open a file for read while open for write 61 FILE NOT OPEN - Tried to access a file that is not open 62 FILE NOT FOUND - The requested file does not exist 63 FILE EXISTS - The filename of the file being created already exists 64 FILE TYPE MISMATCH - File type does not match file type in directory 65 NO BLOCK - B-A command fail (TR,BL=next free block, 00,00=None) 66 ILLEGAL TRACK AND SECTOR - Illegal track or block number 67 ILLEGAL SYSTEM T OR S - Illegal system track or block 70 NO CHANNEL - Too many channels used, or requested channel not free 71 DIRECTORY ERROR - BAM messed up (on floppy disk, or in drive RAM) 72 DISK FULL - Disk or directory full. Close requires 2 free blocks 73 CBM DOS V2.6 1541 - Power-up message (note that 73 is also used below) 73 DOS MISMATCH - DOS2.X cannot <write> to old DOS1-formatted disks 74 DRIVE NOT READY - Disk missing |
10 OPEN 1, 8, 15 ;open the error channel 20 INPUT# 1, A, B$, T, B ;read error_code, error_name, track, block 30 PRINT A, B$, T, B ;display it RUN ;start (INPUT works only with line numbers) |
Disk Data Channels & File Types |
OPEN file_name_field: "[@]0:filename[,file_type,direction]" |
PRG or P - Sequential Program (with BASIC tokens, used for LOAD/SAVE) SEQ or S - Sequential Data File (typically containing ASCII text data) USR or U - Sequential User File (unspecified content) |
OPEN file_name_field: "filename,L,", record_length |
"P", channel+96, record_lsb, record_msb [,character_position] |
character_position specifies the address (1..size) inside of the record. If it is not specified, character_position defaults to 1. HOW does that separate between ending chr(0dh) and character_pos ??? Include the character_position number, when adding fields. WHY ??? |
OPEN file_name_field: "\[n]" |
PRINT# cmd_file_number, "BLOCK-ALLOCATE:drive track block" PRINT# cmd_file_number, "BLOCK-FREE: drive track block" |
PRINT# cmd_file_number, "BLOCK-READ: data_channel drive track block" PRINT# cmd_file_number, "U1: data_channel drive track block" |
PRINT# cmd_file_number, "BLOCK-WRITE: data_channel drive track block" PRINT# cmd_file_number, "U2: data_channel drive track block" |
PRINT# cmd_file_number, "BUFFER-POINTER:data_channel location" |
!! When the data is being put into the buffer, a pointer in the DOS keeps !! track of how many characters there are, when you perform the BLOCK-WRITE !! operation, that pointer is recorded on the disk (WHAT WHERE HOW ???). |
Disk Programming the Disk Controller |
FORMAT FOR BLOCK-EXECUTE: PRINT#file#, "B-E: data_channel drive track block" |
MEMORY-READ: PRINT#file#, "M-R",addr_lsb,addr_msb |
MEMORY-WRITE: PRINT#file#, "M-W", addr_lsb, addr_msb, len, data[len] |
"M-E", addr_lsb, addr_msb ;jump to addr Any address in RAM or ROM "U3" or "UC" ;jump to 500h Buffer 2, Index 00h "U4" or "UD" ;jump to 503h Buffer 2, Index 03h "U5" or "UE" ;jump to 506h Buffer 2, Index 06h "U6" or "UF" ;jump to 509h Buffer 2, Index 09h "U7" or "UG" ;jump to 50Ch Buffer 2, Index 0Ch "U8" or "UH" ;jump to 50Fh Buffer 2, Index 0Fh "U;" or "UJ" ;jump to [FFFC] Power-up vector |
Disk Format |
Track Numbers Block Numbers Total Size (Tracks * Blocks) 1..17 0..20 17*21=357 18..24 0..18 7*19=133 25..30 0..17 6*18=108 31..35 0..16 5*17=85 |
Index Expl. 00,01 Track and sector of first directory block (18,01) 02 ASCII character "A" indicating 4040 format (41h) 03 Null flag for future DOS use. (00h) 04-8F Bit map of available blocks for tracks 1-35 |
Index Expl. 90-A1 144-161 Disk name 18 characters padded with shifted spaces A2-A3 162-163 Disk ID two characters A4 164 Shifted space (A0h) A5-A6 165,166 DOS version "2" and format type "A" (32h,41h) A6-A7 Shifted spaces (A0h,A0h) AB-FF Nulls, not used (00h filled) |
Index Expl. 00,01 Track and sector of next directory block 02-1F File entry 1 22-3F File entry 2 42-5F File entry 3 62-7F File entry 4 82-9F File entry 5 A2-BF File entry 6 C2-DF File entry 7 E2-FF File entry 8 |
Index Expl. 00 128+type File type OR'ed with 80h to indicate properly closed file. Types: 0=DELeted, 1=SEQuential, 2=PROGram, 3=USER, 4=RELative 01,02 Track and sector of 1st data block. 03-12 File name 16 characters padded with shifted spaces (=A0h). ??? Relative file only: track and sector for first side sector block. ??? Relative file only: Record size. 13-1B Unused (zero filled). ??? Track and sector of replacement file when OPEN@ is in effect. 1C-1D Number of blocks in file: low byte, high byte. |
00,01 Track and sector of next sequential data block. 02-FF 254 bytes of data with carriage returns as record terminators. |
00,01 Track and sector of next block in program file. 02-FF 254 bytes of program info stored in CBM memory format (with key words tokenized). End of file is marked by three zero bytes. |
00-FF Data |
00,01 Track and block of next side sector block. 02 Side sector number. (0-5) 03 Record length. 04-0F Track and block of side sector number 0-5. 10-FF Track and block pointers to 120 data blocks. |
00,01 Track and block of next data block. 02-FF 254 bytes of data. |
Header: SYNC, 08, ID1, ID2, TRK, BLK, CHKSUM, GAP1 Data Field: SYNC, 07, DATA[256], CHKSUM, GAP |
Disk and File Images |
- Original 16bit memory address (typically MEMBOT+1) - BASIC line(s) - Two zero bytes (End of BASIC program) - Binary data (eg. machine code) (if any) |
- 16bit pointer to next line (in respect to original load address) - 16bit line number - BASIC expressions (consisting of tokens and ascii text) - One zero byte (End of line) |
<FILENAME>.<T><NN> |
P - Program file (PRG) S - Sequential file (SEQ) U - User file (USR) D - Deleted file (DEL) R - Relative file (REL) |
Index Size Expl. 00h 07h+1 Image ID "C64File", ended by 00h 08h 10h+1 Original 16 character C64 Filename, padded with 00h 19h 01h Record size for REL files (00h for other files) 1ah ... Original file image with load address (same as .PRG file) |
Disk Memory Map and I/O Ports |
0000-07FF Work RAM (2 KBytes) 0800-17FF Not used 1800-180F I/O - VIA#1 (serial data & control) 1810-1BFF Not used 1C00-1C0F I/O - VIA#2 (drive data & control) 1C10-BFFF Not used C000-FFFF Disk ROM (16 KBytes) |
0000-0103 System Area 0104-01FF Stack Area 0200-02FF System Area 0300-03FF Buffer 0 0400-04FF Buffer 1 0500-05FF Buffer 2 0600-06FF Buffer 3 0700-07FF Buffer 4 |
PB 7, CB2: ATN IN PB 6,5: Device address preset switches PB 4: ATN acknowledge OUT PB 3: CLOCK OUT PB 2: CLOCK IN PB 1: DATA OUT PB 0: DATA IN |
PA data to and from read/write head PB 7: SYNC IN PB 6,5: Bit rate D1 and D0 PB 4: WPS - Write Protect Sense (1 = On) PB 3: ACT - LED on drive PB 2: MTR - drive motor PB 0,1: step motor for head movement CA 1: Byte ready CA 2: SOE - Set Overflow Enable for 6502 CA 3: (CA three?) read/write |
Disk Configuration |
open 1,x,15:print#1,"m-w" chr$(119) chr$(0) chr$(2) chr$(y+32) chr$(y+64) |
Device Jumper A/1 Jumper B/2 8 Don't cut Don't cut (default) 9 Cut Don't cut 10 Don't cut Cut 11 Cut Cut |
OPEN 1,8,15,"UI-":CLOSE 1 ;VIC 20 speed OPEN 1,8,15,"UI+":CLOSE 1 ;Commodore 64 speed (default) |
CPU 65XX Microprocessor |
CPU Registers and Flags |
Bits Name Expl. 8 A Accumulator 8 X Index Register X 8 Y Index Register Y 16 PC Program Counter 8 S Stack Pointer (see below) 8 P Processor Status Register (see below) |
Bit Name Expl. 0 C Carry (0=No Carry, 1=Carry) 1 Z Zero (0=Nonzero, 1=Zero) 2 I IRQ Disable (0=IRQ Enable, 1=IRQ Disable) 3 D Decimal Mode (0=Normal, 1=BCD Mode for ADC/SBC opcodes) 4 B Break Flag (0=IRQ/NMI, 1=BRK/PHP opcode) 5 - Not used (Always 1) 6 V Overflow (0=No Overflow, 1=Overflow) 7 N Negative/Sign (0=Positive, 1=Negative) |
CPU Memory Addressing |
Name Native Nocash Implied - A,X,Y,S,P Immediate #nn nn Zero Page nn [nn] Zero Page,X nn,X [nn+X] Zero Page,Y nn,Y [nn+Y] Absolute nnnn [nnnn] Absolute,X nnnn,X [nnnn+X] Absolute,Y nnnn,Y [nnnn+Y] (Indirect,X) (nn,X) [[nn+X]] (Indirect),Y (nn),Y [[nn]+Y] |
CPU Memory and Register Transfers |
A8 nz---- 2 TAY Transfer Accumulator to Y Y=A AA nz---- 2 TAX Transfer Accumulator to X X=A BA nz---- 2 TSX Transfer Stack pointer to X X=S 98 nz---- 2 TYA Transfer Y to Accumulator A=Y 8A nz---- 2 TXA Transfer X to Accumulator A=X 9A ------ 2 TXS Transfer X to Stack pointer S=X |
A9 nn nz---- 2 LDA #nn Load A with Immediate A=nn A5 nn nz---- 3 LDA nn Load A with Zero Page A=[nn] B5 nn nz---- 4 LDA nn,X Load A with Zero Page,X A=[nn+X] AD nn nn nz---- 4 LDA nnnn Load A with Absolute A=[nnnn] BD nn nn nz---- 4* LDA nnnn,X Load A with Absolute,X A=[nnnn+X] B9 nn nn nz---- 4* LDA nnnn,Y Load A with Absolute,Y A=[nnnn+Y] A1 nn nz---- 6 LDA (nn,X) Load A with (Indirect,X) A=[WORD[nn+X]] B1 nn nz---- 5* LDA (nn),Y Load A with (Indirect),Y A=[WORD[nn]+Y] A2 nn nz---- 2 LDX #nn Load X with Immediate X=nn A6 nn nz---- 3 LDX nn Load X with Zero Page X=[nn] B6 nn nz---- 4 LDX nn,Y Load X with Zero Page,Y X=[nn+Y] AE nn nn nz---- 4 LDX nnnn Load X with Absolute X=[nnnn] BE nn nn nz---- 4* LDX nnnn,Y Load X with Absolute,Y X=[nnnn+Y] A0 nn nz---- 2 LDY #nn Load Y with Immediate Y=nn A4 nn nz---- 3 LDY nn Load Y with Zero Page Y=[nn] B4 nn nz---- 4 LDY nn,X Load Y with Zero Page,X Y=[nn+X] AC nn nn nz---- 4 LDY nnnn Load Y with Absolute Y=[nnnn] BC nn nn nz---- 4* LDY nnnn,X Load Y with Absolute,X Y=[nnnn+X] |
85 nn ------ 3 STA nn Store A in Zero Page [nn]=A 95 nn ------ 4 STA nn,X Store A in Zero Page,X [nn+X]=A 8D nn nn ------ 4 STA nnnn Store A in Absolute [nnnn]=A 9D nn nn ------ 5 STA nnnn,X Store A in Absolute,X [nnnn+X]=A 99 nn nn ------ 5 STA nnnn,Y Store A in Absolute,Y [nnnn+Y]=A 81 nn ------ 6 STA (nn,X) Store A in (Indirect,X) [[nn+x]]=A 91 nn ------ 6 STA (nn),Y Store A in (Indirect),Y [[nn]+y]=A 86 nn ------ 3 STX nn Store X in Zero Page [nn]=X 96 nn ------ 4 STX nn,Y Store X in Zero Page,Y [nn+Y]=X 8E nn nn ------ 4 STX nnnn Store X in Absolute [nnnn]=X 84 nn ------ 3 STY nn Store Y in Zero Page [nn]=Y 94 nn ------ 4 STY nn,X Store Y in Zero Page,X [nn+X]=Y 8C nn nn ------ 4 STY nnnn Store Y in Absolute [nnnn]=Y |
48 ------ 3 PHA Push accumulator on stack [S]=A 08 ------ 3 PHP Push processor status on stack [S]=P 68 nz---- 4 PLA Pull accumulator from stack A=[S] 28 nzcidv 4 PLP Pull processor status from stack P=[S] |
CPU Arithmetic/Logical Operations |
69 nn nzc--v 2 ADC #nn Add Immediate A=A+C+nn 65 nn nzc--v 3 ADC nn Add Zero Page A=A+C+[nn] 75 nn nzc--v 4 ADC nn,X Add Zero Page,X A=A+C+[nn+X] 6D nn nn nzc--v 4 ADC nnnn Add Absolute A=A+C+[nnnn] 7D nn nn nzc--v 4* ADC nnnn,X Add Absolute,X A=A+C+[nnnn+X] 79 nn nn nzc--v 4* ADC nnnn,Y Add Absolute,Y A=A+C+[nnnn+Y] 61 nn nzc--v 6 ADC (nn,X) Add (Indirect,X) A=A+C+[[nn+X]] 71 nn nzc--v 5* ADC (nn),Y Add (Indirect),Y A=A+C+[[nn]+Y] |
E9 nn nzc--v 2 SBC #nn Subtract Immediate A=A+C-1-nn E5 nn nzc--v 3 SBC nn Subtract Zero Page A=A+C-1-[nn] F5 nn nzc--v 4 SBC nn,X Subtract Zero Page,X A=A+C-1-[nn+X] ED nn nn nzc--v 4 SBC nnnn Subtract Absolute A=A+C-1-[nnnn] FD nn nn nzc--v 4* SBC nnnn,X Subtract Absolute,X A=A+C-1-[nnnn+X] F9 nn nn nzc--v 4* SBC nnnn,Y Subtract Absolute,Y A=A+C-1-[nnnn+Y] E1 nn nzc--v 6 SBC (nn,X) Subtract (Indirect,X) A=A+C-1-[[nn+X]] F1 nn nzc--v 5* SBC (nn),Y Subtract (Indirect),Y A=A+C-1-[[nn]+Y] |
29 nn nz---- 2 AND #nn AND Immediate A=A AND nn 25 nn nz---- 3 AND nn AND Zero Page A=A AND [nn] 35 nn nz---- 4 AND nn,X AND Zero Page,X A=A AND [nn+X] 2D nn nn nz---- 4 AND nnnn AND Absolute A=A AND [nnnn] 3D nn nn nz---- 4* AND nnnn,X AND Absolute,X A=A AND [nnnn+X] 39 nn nn nz---- 4* AND nnnn,Y AND Absolute,Y A=A AND [nnnn+Y] 21 nn nz---- 6 AND (nn,X) AND (Indirect,X) A=A AND [[nn+X]] 31 nn nz---- 5* AND (nn),Y AND (Indirect),Y A=A AND [[nn]+Y] |
49 nn nz---- 2 EOR #nn XOR Immediate A=A XOR nn 45 nn nz---- 3 EOR nn XOR Zero Page A=A XOR [nn] 55 nn nz---- 4 EOR nn,X XOR Zero Page,X A=A XOR [nn+X] 4D nn nn nz---- 4 EOR nnnn XOR Absolute A=A XOR [nnnn] 5D nn nn nz---- 4* EOR nnnn,X XOR Absolute,X A=A XOR [nnnn+X] 59 nn nn nz---- 4* EOR nnnn,Y XOR Absolute,Y A=A XOR [nnnn+Y] 41 nn nz---- 6 EOR (nn,X) XOR (Indirect,X) A=A XOR [[nn+X]] 51 nn nz---- 5* EOR (nn),Y XOR (Indirect),Y A=A XOR [[nn]+Y] |
09 nn nz---- 2 ORA #nn OR Immediate A=A OR nn 05 nn nz---- 3 ORA nn OR Zero Page A=A OR [nn] 15 nn nz---- 4 ORA nn,X OR Zero Page,X A=A OR [nn+X] 0D nn nn nz---- 4 ORA nnnn OR Absolute A=A OR [nnnn] 1D nn nn nz---- 4* ORA nnnn,X OR Absolute,X A=A OR [nnnn+X] 19 nn nn nz---- 4* ORA nnnn,Y OR Absolute,Y A=A OR [nnnn+Y] 01 nn nz---- 6 ORA (nn,X) OR (Indirect,X) A=A OR [[nn+X]] 11 nn nz---- 5* ORA (nn),Y OR (Indirect),Y A=A OR [[nn]+Y] |
C9 nn nzc--- 2 CMP #nn Compare A with Immediate A-nn C5 nn nzc--- 3 CMP nn Compare A with Zero Page A-[nn] D5 nn nzc--- 4 CMP nn,X Compare A with Zero Page,X A-[nn+X] CD nn nn nzc--- 4 CMP nnnn Compare A with Absolute A-[nnnn] DD nn nn nzc--- 4* CMP nnnn,X Compare A with Absolute,X A-[nnnn+X] D9 nn nn nzc--- 4* CMP nnnn,Y Compare A with Absolute,Y A-[nnnn+Y] C1 nn nzc--- 6 CMP (nn,X) Compare A with (Indirect,X) A-[[nn+X]] D1 nn nzc--- 5* CMP (nn),Y Compare A with (Indirect),Y A-[[nn]+Y] E0 nn nzc--- 2 CPX #nn Compare X with Immediate X-nn E4 nn nzc--- 3 CPX nn Compare X with Zero Page X-[nn] EC nn nn nzc--- 4 CPX nnnn Compare X with Absolute X-[nnnn] C0 nn nzc--- 2 CPY #nn Compare Y with Immediate Y-nn C4 nn nzc--- 3 CPY nn Compare Y with Zero Page Y-[nn] CC nn nn nzc--- 4 CPY nnnn Compare Y with Absolute Y-[nnnn] |
24 nn xz---x 3 BIT nn Bit Test A AND [nn], N=[nn].7, V=[nn].6 2C nn nn xz---x 4 BIT nnnn Bit Test A AND [..], N=[..].7, V=[..].6 |
E6 nn nz---- 5 INC nn Increment Zero Page [nn]=[nn]+1 F6 nn nz---- 6 INC nn,X Increment Zero Page,X [nn+X]=[nn+X]+1 EE nn nn nz---- 6 INC nnnn Increment Absolute [nnnn]=[nnnn]+1 FE nn nn nz---- 7 INC nnnn,X Increment Absolute,X [nnnn+X]=[nnnn+X]+1 E8 nz---- 2 INX Increment X X=X+1 C8 nz---- 2 INY Increment Y Y=Y+1 |
C6 nn nz---- 5 DEC nn Decrement Zero Page [nn]=[nn]-1 D6 nn nz---- 6 DEC nn,X Decrement Zero Page,X [nn+X]=[nn+X]-1 CE nn nn nz---- 6 DEC nnnn Decrement Absolute [nnnn]=[nnnn]-1 DE nn nn nz---- 7 DEC nnnn,X Decrement Absolute,X [nnnn+X]=[nnnn+X]-1 CA nz---- 2 DEX Decrement X X=X-1 88 nz---- 2 DEY Decrement Y Y=Y-1 |
CPU Rotate and Shift Instructions |
0A nzc--- 2 ASL A Shift Left Accumulator SHL A 06 nn nzc--- 5 ASL nn Shift Left Zero Page SHL [nn] 16 nn nzc--- 6 ASL nn,X Shift Left Zero Page,X SHL [nn+X] 0E nn nn nzc--- 6 ASL nnnn Shift Left Absolute SHL [nnnn] 1E nn nn nzc--- 7 ASL nnnn,X Shift Left Absolute,X SHL [nnnn+X] |
4A 0zc--- 2 LSR A Shift Right Accumulator SHR A 46 nn 0zc--- 5 LSR nn Shift Right Zero Page SHR [nn] 56 nn 0zc--- 6 LSR nn,X Shift Right Zero Page,X SHR [nn+X] 4E nn nn 0zc--- 6 LSR nnnn Shift Right Absolute SHR [nnnn] 5E nn nn 0zc--- 7 LSR nnnn,X Shift Right Absolute,X SHR [nnnn+X] |
2A nzc--- 2 ROL A Rotate Left Accumulator RCL A 26 nn nzc--- 5 ROL nn Rotate Left Zero Page RCL [nn] 36 nn nzc--- 6 ROL nn,X Rotate Left Zero Page,X RCL [nn+X] 2E nn nn nzc--- 6 ROL nnnn Rotate Left Absolute RCL [nnnn] 3E nn nn nzc--- 7 ROL nnnn,X Rotate Left Absolute,X RCL [nnnn+X] |
6A nzc--- 2 ROR A Rotate Right Accumulator RCR A 66 nn nzc--- 5 ROR nn Rotate Right Zero Page RCR [nn] 76 nn nzc--- 6 ROR nn,X Rotate Right Zero Page,X RCR [nn+X] 6E nn nn nzc--- 6 ROR nnnn Rotate Right Absolute RCR [nnnn] 7E nn nn nzc--- 7 ROR nnnn,X Rotate Right Absolute,X RCR [nnnn+X] |
CPU Jump and Control Instructions |
4C nn nn ------ 3 JMP nnnn Jump Absolute PC=nnnn 6C nn nn ------ 5 JMP (nnnn) Jump Indirect PC=WORD[nnnn] 20 nn nn ------ 6 JSR nnnn Jump and Save Return Addr. [S]=PC+2,PC=nnnn 40 nzcidv 6 RTI Return from BRK/IRQ/NMI P=[S], PC=[S] 60 ------ 6 RTS Return from Subroutine PC=[S]+1 |
10 dd ------ 2** BPL/JNS disp ;N=0 (plus/positive) 30 dd ------ 2** BMI/JS disp ;N=1 (minus/negative/signed) 50 dd ------ 2** BVC/JNO disp ;V=0 (no overflow) 70 dd ------ 2** BVS/JO disp ;V=1 (overflow) 90 dd ------ 2** BCC/BLT/JNC/JB disp ;C=0 (less/below/no carry) B0 dd ------ 2** BCS/BGE/JC/JAE disp ;C=1 (above/greater/equal/carry) D0 dd ------ 2** BNE/BZC/JNZ/JNE disp ;Z=0 (not zero/not equal) F0 dd ------ 2** BEQ/BZS/JZ/JE disp ;Z=1 (zero/equal) |
00 ---1-- 7 BRK Force Break B=1 [S]=PC+1,[S]=P,I=1,PC=[FFFE] -- ---1-- ?? /IRQ Interrupt B=0 [S]=PC,[S]=P,I=1,PC=[FFFE] -- ---1-- ?? /NMI NMI B=0 [S]=PC,[S]=P,I=1,PC=[FFFA] -- ---1-- T+6 /RESET Reset PC=[FFFC],I=1 |
IRQs are executed whenever "/IRQ=LOW AND I=0". NMIs are executed whenever "/NMI changes from HIGH to LOW". |
18 --0--- 2 CLC Clear carry flag C=0 58 ---0-- 2 CLI Clear interrupt disable bit I=0 D8 ----0- 2 CLD Clear decimal mode D=0 B8 -----0 2 CLV Clear overflow flag V=0 38 --1--- 2 SEC Set carry flag C=1 78 ---1-- 2 SEI Set interrupt disable bit I=1 F8 ----1- 2 SED Set decimal mode D=1 |
EA ------ 2 NOP No operation No operation |
CPU Illegal Opcodes |
87 nn ------ 3 SAX nn STA+STX [nn]=A AND X 97 nn ------ 4 SAX nn,Y STA+STX [nn+Y]=A AND X 8F nn nn ------ 4 SAX nnnn STA+STX [nnnn]=A AND X 83 nn ------ 6 SAX (nn,X) STA+STX [WORD[nn+X]]=A AND X A7 nn nz---- 3 LAX nn LDA+LDX A,X=[nn] B7 nn nz---- 4 LAX nn,Y LDA+LDX A,X=[nn+Y] AF nn nn nz---- 4 LAX nnnn LDA+LDX A,X=[nnnn] A3 nn nz---- 6 LAX (nn,X) LDA+LDX A,X=[WORD[nn+X]] B3 nn nz---- 5* LAX (nn),Y LDA+LDX A,X=[WORD[nn]+Y] |
00+yy nzc--- SLO op ASL+ORA op=op SHL 1 // A=A OR op 20+yy nzc--- RLA op ROL+AND op=op RCL 1 // A=A AND op 40+yy nzc--- SRE op LSR+EOR op=op SHR 1 // A=A XOR op 60+yy nzc--v RRA op ROR+ADC op=op RCR 1 // A=A+op+cy C0+yy nzc--- DCP op DEC+CMP op=op-1 // A-op E0+yy nzc--v ISC op INC+SBC op=op+1 // A=A-op-(1-cy) |
07+xx nn 5 nn [nn] 17+xx nn 6 nn,X [nn+X] 03+xx nn 8 (nn,X) [WORD[nn+X]] 13+xx nn 8 (nn),Y [WORD[nn]+Y] 0F+xx nn nn 6 nnnn [nnnn] 1F+xx nn nn 7 nnnn,X [nnnn+X] 1B+xx nn nn 7 nnnn,Y [nnnn+Y] |
0B nn nzc--- 2 ANC #nn AND+ASL A=A AND nn, C=N ;bit7 to carry 2B nn nzc--- 2 ANC #nn AND+ROL A=A AND nn, C=N ;same as above 4B nn nzc--- 2 ALR #nn AND+LSR A=(A AND nn) SHR 1 6B nn nzc--v 2 ARR #nn AND+ROR A=(A AND nn), V=Overflow(A+A), A=A/2+C*80h, C=A.Bit6 CB nn nzc--- 2 AXS #nn CMP+DEX X=(X AND A)-nn EB nn nzc--v 2 SBC #nn SBC+NOP A=A-nn cy? BB nn nn nz---- 4* LAS nnnn,Y LDA+TSX A,X,S = [nnnn+Y] AND S |
xx ------ 2 NOP (xx=1A,3A,5A,7A,DA,FA) xx nn ------ 2 NOP #nn (xx=80,82,89,C2,E2) xx nn ------ 3 NOP nn (xx=04,44,64) xx nn ------ 4 NOP nn,X (xx=14,34,54,74,D4,F4) xx nn nn ------ 4 NOP nnnn (xx=0C) xx nn nn ------ 4* NOP nnnn,X (xx=1C,3C,5C,7C,DC,FC) xx ------ - KIL (xx=02,12,22,32,42,52,62,72,92,B2,D2,F2) |
8B nn nz---- 2 XAA #nn ((2)) TXA+AND A=X AND nn AB nn nz---- 2 LAX #nn ((2)) LDA+TAX A,X=nn BF nn nn nz---- 4* LAX nnnn,X LDA+LDX A,X=[nnnn+X] 93 nn ------ 6 AHX (nn),Y ((1)) [WORD[nn]+Y] = A AND X AND H 9F nn nn ------ 5 AHX nnnn,Y ((1)) [nnnn+Y] = A AND X AND H 9C nn nn ------ 5 SHY nnnn,X ((1)) [nnnn+X] = Y AND H 9E nn nn ------ 5 SHX nnnn,Y ((1)) [nnnn+Y] = X AND H 9B nn nn ------ 5 TAS nnnn,Y ((1)) STA+TXS S=A AND X // [nnnn+Y]=S AND H |
AHX {adr} = stores A&X&H into {adr} SHX {adr} = stores X&H into {adr} SHY {adr} = stores Y&H into {adr} |
CPU Assembler Directives/Syntax |
65XX-style 80XX-style Expl. .native .nocash select native or nocash syntax *=$c100 org 0c100h sets the assumed origin in memory *=*+8 org $+8 increments origin, does NOT produce data label label: sets a label equal to the current address label=$dc00 label equ 0dc00h assigns a value or address to label .by $00 db 00h defines a (list of) byte(s) in memory .byt $00 defb 00h same as .by and db .wd $0000 dw 0000h defines a (list of) word(s) in memory .end end indicates end of source code file |nn [|nn] force 16bit "00NN" instead 8bit "NN" #<nnnn nnnn AND 0FFh isolate lower 8bits of 16bit value #>nnnn nnnn DIV 100h isolate upper 8bits of 16bit value |
.65xx Select 6502 Instruction Set .nes Create NES ROM-Image with .NES extension .c64_prg Create C64 file with .PRG extension/stub/fixed entry .c64_p00 Create C64 file with .P00 extension/stub/fixed entry/header .vic20_prg Create VIC20/C64 file with .PRG extension/stub/relocated entry end entry End of Source, the parameter specifies the entrypoint |
CPU Glitches |
CPU The 65XX Family |
6501 Some sort of 6502 prototype 6502 Used in the CBM floppies and some other 8 bit computers. 6507 Used in Atari 2600, 28pins (only 13 address lines, no /IRQ, no /NMI). 6510 Used in C64, with built-in 6bit I/O port. 7501 Used in C16,C116,Plus/4, with built-in 7bit I/O Port, without /NMI pin. 8500 Used in C64-II, with different pin-outs. 8501 Same as 7501 8502 Used in C128s. |
65C02 Extension of the 6502, used in the C16, C116 and the Plus/4 computers? 65SC02 Small version of the 65C02 which lost a few opcodes again. 65CE02 Extension of the 65C02, used in the C65. 65816 Extended 6502 with new opcodes and 16 bit operation modes. 2A03 Nintendo NES/Famicom, modified 6502 with built-in sound controller. |
CPU Local Usage |
Z80 Microprocessor Cartridge |
C64 Z80 Opcode Disassembled Comment 1000 0000 00 nop ;\the Commodore Z80 needs three NOPs 1001 0001 00 nop ; to stabilize after mode switching 1002 0002 00 nop ;/ 1003 0003 21 02 F5 ld hl,0F502h ;\the actual Z80 'program' increment 1006 0006 34 inc (hl) ;/a byte in VRAM (C64 address=0502h) 1007 0007 3E 01 ld a,01h ;\turn off Z80 again by I/O port 1009 0009 32 00 CE ld (0CE00h),a ;/(C64 address=DE00h) 100C 000C 00 nop ;\ 100D 000D 00 nop ; again three NOPs to 'destabilize' 100E 000E 00 nop ;/ 100F 000F C3 jp 0000h ;-Huh? Should never execute this... |
10 poke 56333,127 :rem [DC0Dh]=7Fh, turn off 6510 irq's 20 poke 56832,00 :rem [DE00h]=00h, turn on z80 card & execute Z80 code 30 poke 56333,129 :rem [DC0Dh]=81h, turn on 6510 irq's when z80 done |
External Connectors |
Pin Name Expl. 1 Switch 0 Joystick Up 2 Switch 1 Joystick Down 3 Switch 2 Joystick Left, or Paddle X-Button 4 Switch 3 Joystick Right, or Paddle Y-Button 5 POTY Paddle Y-Axis 6 Switch 4 Joystick Fire, or Lightpen (Port 1 only) 7 +5V Power Supply (max 50mA) 8 GND Ground 9 POTX Paddle X-Axis |
Pin Expl. Pin Expl. Pin Expl. Pin Expl. 1 GND 12 BA A GND N A9 2 +5V 13 /DMA B /ROMH P A8 3 +5V 14 D7 C /RESET R A7 4 /IRQ 15 D6 D /NMI S A6 5 R/W 16 D5 E 02 T A5 6 Dot Clock 17 D4 F A15 U A4 7 I/O1 18 D3 H A14 V A3 8 /GAME 19 D2 J A13 W A2 9 /EXROM 20 D1 K A12 X A1 10 I/O2 21 D0 L A11 Y A0 11 /ROML 22 GND M A10 Z GND |
Pin Expl. ++ ++ 1 Luminance / +-+ \ 2 GND + 8 7 + 3 Audio Out | 3 6 1 | 4 Video Out + 5 4 + 5 Audio In \ 2 / 6 Chrominance +---+ (7) N.C. (8) +5V DC |
Pin Expl. ++ ++ 1 Serial /SRQ In / +-+ \ 2 GND + 5 1 + 3 Serial ATN Out | 6 | 4 Serial CLK In/Out + 4 2 + 5 Serial Data In/Out \ 3 / 6 /RESET +---+ |
Pin Expl. A-1 GND B-2 +5V DC C-3 Cassette Motor (WHAT=On ???) (+9V UNREG DC ?) D-4 Cassette Read E-5 Cassette Write F-6 Cassette Sense (Switch PLAY Pressed ???, WHAT=Yes ???) |
Pin Expl. Pin Expl. 1 GND A GND 2 +5V DC (max 100 mA) B /FLAG2 3 /RESET C PB0 4 CNT1 D PB1 5 SP1 E PB2 6 CNT2 F PB3 7 SP2 H PB4 8 /PC2 J PB5 9 SER. ATN OUT K PB6 10 9V AC1 (max 100 mA) L PB7 11 9V AC2 (max 100 mA) M PA2 12 GND N GND |
Pin Expl. ++ ++ 1 GND / +-+ \ 2 GND (or N.C.) + 7 6 + 3 GND | 3 1 | 4 +5V DC + 5 4 + 5 +5V DC \ 2 / 6 +/-9V AC1 +---+ 7 +/-9V AC2 |
Transmit Function |
Name Pin Pin Name PA2 USR.M ----------------- PRN.1 /STROBE PB0-7 USR.C-L ----------------- PRN.2-9 DATA0-7 FLAG USR.B ----------------- PRN.11 BUSY GND USR.A,N ----------------- PRN.19-24 GND GND USR.A,N ----------------- PRN.14 /AUTOLF /INTRES EXP.C ----------------- PRN.16/31 /INIT /EXROM EXP.9 ---|>|---+---+--- PRN.17/36 /SELECT +5VDC EXP.2 --[3K3]--' '--- ROM.20 /CS /ROML EXP.11 ----------------- ROM.22 /OE GND EXP.1 ----------------- ROM.14 GND +5VDC EXP.2 ----------------- ROM.1,26-28 A13-15,VCC D0-7 EXP.21-14 ----------------- ROM.11-13,15-19 D0-7 A0-12 EXP.Y-K ----------------- ROM.10-3,25,24,21,23,2 A0-12 |
1E 81 00 00 C3 C2 CD 38 30 A9 1B 8D 11 D0 A9 08 8D 16 D0 A9 04 09 10 8D 18 D0 A9 03 8D 00 DD A9 00 8D 15 D0 A9 00 A9 02 8D 20 D0 8D 21 D0 A9 01 A2 00 9D 00 D8 9D 00 D9 9D 00 DA 9D 00 DB E8 D0 F1 A9 20 A2 00 9D 00 04 9D 00 05 9D 00 06 9D 00 07 E8 D0 F1 A9 00 85 0C 85 0D 60 48 C9 0D D0 07 A9 00 85 0C 4C 95 80 C9 0A D0 05 E6 0D 4C 95 80 A9 00 85 0B A5 0D 0A 0A 65 0D 0A 0A 26 0B 0A 26 0B 65 0C 85 0A A9 04 65 0B 85 0B 68 48 29 3F A2 00 81 0A E6 0C 68 60 68 85 08 68 85 09 E6 08 D0 02 E6 09 A2 00 A1 08 E6 08 D0 02 E6 09 C9 00 F0 06 20 5B 80 4C A3 80 6C 08 00 A9 3B 8D 02 DD A9 00 8D 03 DD 60 A9 04 2C 00 DD D0 FB AE 01 DD 2C 00 DD F0 FB 8A 60 A0 00 A9 04 2C 00 DD D0 FB AD 01 DD 91 02 C8 A9 04 2C 00 DD F0 FB AD 01 DD 91 02 C8 D0 E4 E6 03 60 A9 00 A8 99 02 00 99 00 02 99 00 03 C8 D0 F4 A9 3C 85 B2 A9 03 85 B3 A9 A0 8D 84 02 A9 08 8D 82 02 A9 04 8D 88 02 60 A9 E7 85 01 A9 2F 85 00 A2 00 8E 16 D0 20 A3 FD 20 F7 80 20 15 FD 20 5B FF 58 4C 3B 81 20 53 E4 20 BF E3 20 22 E4 A2 FB 9A D0 00 A2 80 4C 4E 81 8A 20 87 81 86 2D 84 2E A9 76 A0 A3 20 1E AB 20 59 A6 20 33 A5 A9 04 85 C6 A2 09 BD 7D 81 9D 77 02 CA 10 F7 A9 A4 48 A9 7F 48 A9 04 4C 7B 02 52 55 4E 0D 2C 00 DD F0 FB 60 08 78 20 BA 80 A9 05 8D 20 D0 20 C5 80 85 02 20 C5 80 85 03 20 C5 80 85 04 20 C5 80 85 05 20 C5 80 85 06 20 C5 80 85 07 A9 00 8D 20 D0 20 D6 80 C6 05 D0 F9 A9 04 2C 00 DD D0 FB A9 0F 8D 20 D0 A6 02 A4 03 28 60 |
Joystick Y-Cable |
C64 Port 1 ----|>|----+---- Joystick Switch C64 Port 2 ----|>|---/ C64 Ground ---------------- Joystick Ground |
Links |