[mortenbs.com home]
Music
Music
IT
IT
Videos
Videos
Contact
Contact
[icon] Commodore 64 | mortenbs.com
Last updated Jan 2012.

The Commodore 64, truly an important part of the computer history.

Using 5.25" diskettes or tape casettes, mostly game-programs were loaded into it's 64 Kb -
of memory. The program was run by it's ~1 MHz processor, to a TV or monitor at 320x200 -
pixels and 16 colors (8:5 aspect).

    
Few pictures of my old Commodore 64 setup, 1991-1995.

[icon] Commodore 64 Music


[icon] C64 Music

Commodore 64 week-end, games and music
C64, Games and music from the Commodore 64. Showing clips from various games. Uridium, Giana Sisters, Yie ar kung-fu, Buggy Boy, Boulderdash, Bubble Bobble, Commando, Park Patrol, Rainbow Island, Stix, Oils Well, and Toki. Also few nice trailers with music.

[Ico] [Commodore 64 week-end, games and music]


[Cloud][Cloud][Giana][Giana][Giana]
Giana Sisters.

 


See also
[icon] C64 Examples | Commodore 64 - Programming examples for the Commodore 64. About 20 years ago I was still a child, and a...
[icon] C64 Games | Commodore 64 - C64 Games | Commodore 64
[icon] C64 Synth | Commodore 64 - C64 Synth | Commodore 64


Various C64 basic commands
CommandDescription
NEWClear memory, new program...
RUNRun program
LOAD"$",8Load device 8
LOAD"NAME",8Load program on disk, device 8
SAVE"@:filename",8Overwrite file, device 8
OPEN 1,8,15,"N:NAME,01":CLOSE 1Format disk, device 8 (clear memory first)
OPEN 1,8,15,"S:filename":CLOSE 1Delete file, device 8
OPEN 1,8,15,"R:NEW-NAME=OLD-NAME":CLOSE 1Rename file, device 8
LISTList all
LIST 10List line number 10
LIST -100List all lines to 100
LIST 110-400List from line 110 to 400
LIST 1000-List from line 1000
REM >>Comment<<Comments/remarks
Multiple commands can be separated in a single call by ":" (colon)

C64 Variables and data types
TypeRangeData type PCDescriptionVar ex.
BYTE$00..$FF (0..255)BYTE 8 bit unsigned B
INT$0000..$FFFF (0..65535)WORD 16 bit unsigned I%
FLOAT2.94E-39..1.70E+38, +/- 2-128..2127FLOAT  F
STRlen(S$)STRING(255) Max 255 chars S$
Variable names should not be longer than 2 characters...
String variable names is extended by "$", and integer names is extended by "%".

C64 Data type conversion
CommandTitleDescription
B=VAL(S$)STR to BYTE
I%=VAL(S$)STR to INT
F=VAL(S$)STR to FLOAT
S$=STR$(B)BYTE to STR
S$=STR$(I%)INT to STR
S$=STR$(F)FLOAT to STR
B=ASC(S$)CHAR (STR) to BYTEASCII value
S$=CHR$(B)BYTE to CHAR (STR)ASCII value
HB=INT(I%/256)INT to BYTE (high)Extract high BYTE from INT
LB=I%-(INT(I%/256)*256)INT to BYTE (low)Extract low BYTE from INT

Extract low and high byte from integer
I%=2047
HB=INT(I%/256)
LB=I%-(HB*256)

C64 Colors
IDTitleColor
0
 BLACK
191D19
1
 WHITE
FCF9FC
2
 RED
933A4C
3
 CYAN
B6FAFA
4
 PURPLE
D27DED
5
 GREEN
6ACF6F
6
 BLUE
4F44D8
7
 YELLOW
FBFB8B
8
 ORANGE
D89C5B
9
 BROWN
7F5307
10
 LIGHT RED
EF839F
11
 DARK GRAY
575753
12
 GRAY
A3A7A7
13
 LIGHT GREEN
B7FBBF
14
 LIGHT BLUE
A397FF
15
 LIGHT GRAY
EFE9E7
C64 color & display commands
CommandDescription
POKE 53280,0Black border color
POKE 53281,0Black background color
POKE 646,1White text/cursor color
POKE 53265,PEEK(53265) AND 23Turn off screen display
POKE 53265,PEEK(53265) OR 16Turn on screen display

C64 input commands
CommandDescription
INPUT "QUERY: ";S$:PRINT "INPUT WAS: ";S$Keyboard input text
10 GET K$:IF K$="" THEN 10Keyboard input char/key
J=PEEK(56321)Read joystick port 1
J=PEEK(56320)Read joystick port 2
IF (J AND 1)=0 THEN S$="UP"Check joystick value if moved up
IF (J AND 2)=0 THEN S$="DOWN"Check joystick value if moved down
IF (J AND 4)=0 THEN S$="LEFT"Check joystick value if moved left
IF (J AND 8)=0 THEN S$="RIGHT"Check joystick value if moved right
IF (J AND 16)=0 THEN S$="FIRE"Check joystick value if pushed fire

C64 keyboard commands
CommandDescription
POKE 788,52Turn RUN/STOP key off
POKE 788,49Turn RUN/STOP key on
POKE 657,128Turn SHIFT key off
POKE 657,0Turn SHIFT key on
POKE 792,193Turn RESTORE key off
POKE 792,71Turn RESTORE key on
POKE 198,0Clear keyboard buffer
POKE 650,127No keyboard repeat
POKE 650,0Normal keyboard repeat
POKE 56341,12Fast cursor speed [1..255]
POKE 56341,25Normal cursor speed

[Ico] Commodore 64 (unshifted) character set
000102030405060708090A0B0C0D0E0F
00#0#1#2#3#4#5#6#7#8#9#10#11#12#13#14#15
01#16#17#18#19#20#21#22#23#24#25#26#27#28#29#30#31
02#32#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47
03#48#49#50#51#52#53#54#55#56#57#58#59#60#61#62#63
04#64#65#66#67#68#69#70#71#72#73#74#75#76#77#78#79
05#80#81#82#83#84#85#86#87#88#89#90#91#92#93#94#95
06#96#97#98#99#100#101#102#103#104#105#106#107#108#109#110#111
07#112#113#114#115#116#117#118#119#120#121#122#123#124#125#126#127
08#128#129#130#131#132#133#134#135#136#137#138#139#140#141#142#143
09#144#145#146#147#148#149#150#151#152#153#154#155#156#157#158#159
0A#160#161#162#163#164#165#166#167#168#169#170#171#172#173#174#175
0B#176#177#178#179#180#181#182#183#184#185#186#187#188#189#190#191
0C#192#193#194#195#196#197#198#199#200#201#202#203#204#205#206#207
0D#208#209#210#211#212#213#214#215#216#217#218#219#220#221#222#223
0E#224#225#226#227#228#229#230#231#232#233#234#235#236#237#238#239
0F#240#241#242#243#244#245#246#247#248#249#250#251#252#253#254#255
[Ico] Commodore 64 (shifted) character set
000102030405060708090A0B0C0D0E0F
00#0#1#2#3#4#5#6#7#8#9#10#11#12#13#14#15
01#16#17#18#19#20#21#22#23#24#25#26#27#28#29#30#31
02#32#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47
03#48#49#50#51#52#53#54#55#56#57#58#59#60#61#62#63
04#64#65#66#67#68#69#70#71#72#73#74#75#76#77#78#79
05#80#81#82#83#84#85#86#87#88#89#90#91#92#93#94#95
06#97#98#99#100#101#102#103#104#105#106#107#108#109#110#111
07#112#113#114#115#116#117#118#119#120#121#122#123#124#125#126#127
08#128#129#130#131#132#133#134#135#136#137#138#139#140#141#142#143
09#144#145#146#147#148#149#150#151#152#153#154#155#156#157#158#159
0A#160#161#162#163#164#165#166#167#168#169#170#171#172#173#174#175
0B#176#177#178#179#180#181#182#183#184#185#186#187#188#189#190#191
0C#192#193#194#195#196#197#198#199#200#201#202#203#204#205#206#207
0D#208#209#210#211#212#213#214#215#216#217#218#219#220#221#222#223
0E#224#225#226#227#228#229#230#231#232#233#234#235#236#237#238#239
0F#240#241#242#243#244#245#246#247#248#249#250#251#252#253#254#255

C64 Sound waveforms
WaveformVoice settingMOS6581MOS8580
[icon] 017 Triangle
[icon] 033 Sawtooth
[icon] 065 Square, duration 1
[icon] 065 Square, duration 5
[icon] 065 Square, duration 7
[icon] 065 Square, duration 10
[icon] 065 Square, duration 15
[icon] 129 Noise
The C64 square waveform has a duration parameter [0..15] that changes the waveform as seen above.
You can listen to waveform examples of each waveform setting above, from both MOS6581 and MOS8580 sound chip.
More information about the samples here: C64 Synth v1.0

C64 Sound commands
CommandDescription
POKE 54296,15Set volume [0..15] (Master)
POKE 54276,17Set voice 1 waveform [17 tri/33 saw/65 square/129 noise]
POKE 54283,33Set voice 2 waveform [17 tri/33 saw/65 square/129 noise]
POKE 54290,129Set voice 3 waveform [17 tri/33 saw/65 square/129 noise]
POKE 54275,15Set voice 1 square duration [0..15] (High byte)
POKE 54282,15Set voice 2 square duration [0..15] (High byte)
POKE 54289,15Set voice 3 square duration [0..15] (High byte)
POKE 54274,0Set voice 1 square duration [0] (Low byte)
POKE 54281,0Set voice 2 square duration [0] (Low byte)
POKE 54288,0Set voice 3 square duration [0] (Low byte)
POKE 54277,(ATTACK1*16)+DECAY1Set voice 1 attack [0..15] + decay [0..15]
POKE 54284,(ATTACK2*16)+DECAY2Set voice 2 attack [0..15] + decay [0..15]
POKE 54291,(ATTACK3*16)+DECAY3Set voice 3 attack [0..15] + decay [0..15]
POKE 54278,(SUSTAIN1*16)+RELEASE1Set voice 1 sustain [0..15] + release [0..15]
POKE 54285,(SUSTAIN2*16)+RELEASE2Set voice 2 sustain [0..15] + release [0..15]
POKE 54292,(SUSTAIN3*16)+RELEASE3Set voice 3 sustain [0..15] + release [0..15]
POKE 54272,2145-(INT(2145/256)*256)Set voice 1 frequency (ex. 2145=C3) (Low byte)
POKE 54273,INT(2145/256)Set voice 1 frequency (ex. 2145=C3) (High byte)
POKE 54279,2703-(INT(2703/256)*256)Set voice 2 frequency (ex. 2703=E3) (Low byte)
POKE 54280,INT(2703/256)Set voice 2 frequency (ex. 2703=E3) (High byte)
POKE 54286,3215-(INT(3215/256)*256)Set voice 3 frequency (ex. 3215=G3) (Low byte)
POKE 54287,INT(3215/256)Set voice 3 frequency (ex. 3215=G3) (High byte)
POKE 53295,(RESONANCE*16)+FILTER_VOICESet resonance [0..15] + filter voice number [1/2/3]
FOR N=1 TO 500:NEXTPause...
POKE 54272,0:POKE 54273,0Stop sound, voice 1
POKE 54279,0:POKE 54280,0Stop sound, voice 2
POKE 54286,0:POKE 54287,0Stop sound, voice 3
FOR N=1 TO 500:NEXTPause...
FOR N=54272 TO 54296:POKE N,0:NEXTReset sound...

C64 Sound: Table of musical notes
OctaveCC#DD#EFF#GG#AA#B
0268284301318337358379401425451477506
15365686026376757167588038519029551012
2107211361204127513511432151716071703180419112025
3214522732408255127032864303432153406360838234050
4429145474817510354075728606964306812721776478101
5858390949634102071081411457121391286013625144351529416293
6171671818819269204152162922915242782572127251288713058832407
7343343637638539408304325845830485565144354502577436117664814



[pil] Your comment or message

-

Links
[icon] Commodore 64 - Wikipedia, the free encyclopedia - The Commodore 64 is an 8-bit home computer introduced by the now defunct manufacturer...
[icon] BASIC - C64-Wiki - The acronym BASIC stands for "Beginner’s All-purpose Symbolic Instruction...
[icon] VIC-1541 - C64-Wiki - Short name for the Commodore disk drive VIC-1541 (also CBM-1541 or Commodore-1541; in...
[icon] Commodore 64 PETSCII codes - Commodore 64 PETSCII codes
[icon] Commodore 64 Programmer's Reference Guide - The Commodore 64 Programmers Reference Guide teels you everything you need to know about...
[icon] Power64 Documentation - C64 BASIC - Here is a short summary of the commands for the built in Commodore 64 BASIC V2. Note that...
[icon] List of 8-bit computer hardware palettes - Wikipedia, the free encyclopedia, This is a list of color palettes of some of the most...

C64 sound SID
[icon] FASTFINGERS Commodore 64 Lead Synthesizer - This is the revival of the Commodore 64 Lead Synthesizer FASTFINGERS. It will be...
[icon] BASIC – Sounds even better! - This time, I am going to apply what I wrote last time, to the game we are creating. The...

See also
[icon] C64 Examples | Commodore 64 - Programming examples for the Commodore 64. About 20 years ago I was still a child, and a...
[icon] C64 Games | Commodore 64 - C64 Games | Commodore 64
[icon] C64 Synth | Commodore 64 - C64 Synth | Commodore 64
[icon] IT - IT/Technology. Various projects and information about computer technology and electronic...
[icon] Videos - List of videos that are available on the mortenbs.com website.


[icon] mortenbs.com