Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > noob requires help to start coding
2005-01-14 22:56
spinal
Account closed

Registered: Jan 2005
Posts: 47
noob requires help to start coding

ok here goes, i would like to code something for the C64, don't have a clue where to start, i cnow a little C, a little more BASIC and havent even looked at ASM, so what im asking is -

Is there a good C cross-compiler that i can download from anywhere? (assuming that it is free)
2005-01-14 23:36
Frantic

Registered: Mar 2003
Posts: 1648
Yes there is..

http://www.cc65.org/
2005-01-14 23:54
spinal
Account closed

Registered: Jan 2005
Posts: 47
I cant download that for some reason, internet explorer wont let me!?! is it hosted anywhere other than that site?
2005-01-15 09:55
spinal
Account closed

Registered: Jan 2005
Posts: 47
ok, i think ive got the compiler, but not any examples/helps, also i dont know how to set it up? can anyone help me?
2005-01-15 11:05
yago

Registered: May 2002
Posts: 333
IIRC, there is even a plasma-effect, coded in C, in the Examples.
My Advice in setting up: Get rid of Internet Explorer and Windows.
2005-01-15 21:30
spinal
Account closed

Registered: Jan 2005
Posts: 47
ok, ill ask this in better english -

how do I set up CC64 and are there any example files that are NOT hosted on the official site?
2005-01-15 21:38
Graham
Account closed

Registered: Dec 2002
Posts: 990
i think before coding anything you should first learn how to use a c64 at all.
2005-01-15 23:14
spinal
Account closed

Registered: Jan 2005
Posts: 47
*sorry* How do i set up CC65 etc.
2005-01-16 08:52
Raf

Registered: Nov 2003
Posts: 343
if you mean you would like to code demo or kinda like that using cc65 you're out of luck. as far as I know (for short time I was keen on cc65 including hunting for bugs and preparing one-file cool installer for win32) the only examples are those shipped with cc65 package + few ones outside. they're not big thingies, however compiled program are rather slow and big. If I have written something useflu using (And I'll find it :P ) I can send you effort of my work.
2005-01-16 10:20
Graham
Account closed

Registered: Dec 2002
Posts: 990
seriously, forget about C-programming on c64. the only thing you'll be able to do is some tools with lame performance. for anything else you will need assembler.
2005-01-16 10:25
hollowman

Registered: Dec 2001
Posts: 474
one useful thing made with cc65 is cvote by magervalp
http://www.paradroid.net/cvote/

but really, to begin to hack around in asm is a much better choise if you want to start coding on c64
2005-01-16 10:49
Cruzer

Registered: Dec 2001
Posts: 1048
I agree with Graham and Hollowman, although I haven't tried out C on c64. It might be better than basic atleast.
2005-01-16 22:45
RaveGuru

Registered: Apr 2002
Posts: 43
First of all, you should start with learning the VIC-II chip coz that's where most of the C64 magic happens.. unless you're planning to do tools and music stuff only.

2005-01-17 00:15
cadaver

Registered: Feb 2002
Posts: 1160
My suggestion: experiment with C64 features by using BASIC first if ASM seems scary, but eventually go to directly to ASM. That way you don't have to deal with any side-effects & weirdnesses of the C runtime library + compiler, instead all code will be yours so it'll be easier for you to understand.

BASIC & ASM both contribute to a delightful spaghetti coding style - and I'm seriously of the opinion that JMP/GOTO are much better for controlling the flow of average C64 game or demo than wimpy C function calls :)
2005-01-17 01:08
JackAsser

Registered: Jun 2002
Posts: 2014
I used CC65 first with inline assembly when needed and that's a choice I regret. If you want to use the CC65 package, only use the CA65 assembler and the LD65 linker. Those two are great tools but forget C, it will only make you understand less on the C64.

/JackAsser
2005-01-18 18:50
chatGPZ

Registered: Dec 2001
Posts: 11386
Mmmh I probably wouldnt suggest cc65 to someone who wants to learn about the c64 either.... but still imho its a great tool, and you ofcourse can write useful things with it. not demos or games or anything else that involves a lot of timing and/or speed critical things, no doubt. but tools that for the most part need to look nice and which basically dont do anything besides wait for user input - certainly worth thinking about. but you'll have to know about the c64 _and_ the quirks of cc65 so you dont end up in the horrible bloat and slowness of badly written (or ported) C-code :)
2005-01-18 21:21
enthusi

Registered: May 2004
Posts: 677
Hum, I tried CC65 for a while and it does indeed not help much :) Most of c64-programming is less about 6502-asm or even C but knowing VIC and SID and whatever you want. So simple C wont help much. I intended to use it for game-logic and code the critical stuff in inline asm. Clever idea, huh? :o) well, I burried that Idea pretty soon. C ist not THAT slow actually and you can always optimize but its big and you have little control over it and after a handful of inline_asm you lose track of it and lose the one advantage of c - its 'structure'.
So better start with basic and soon go on with asm since its just basic-style (even if many might disagree :)
Also bugfixing asm can be much easier than C. As unbelievable as it sounds.
The best about C would be that small programs could be ported to unix or vice versa. But cc65 for example has no floatingpointoperations (for a good reason).
I once wrote a pretty small c-program that compiled with gcc and cc65 :o) it just printed out some astronomical data though...
2005-01-18 21:59
RaveGuru

Registered: Apr 2002
Posts: 43
...And then again, the reason we do it on the C64 is....

...becoz we don't want to do it on a unix!! ;-)

2005-01-18 22:22
spinal
Account closed

Registered: Jan 2005
Posts: 47
So you guys are saying i shoudn't use C on the C64...
OK then, ill first do some BASIC, only problem is, i dont have an origional C64 anymore, and im using VICE, does anyone know how to map the keyboard so the keys match up? i dont like having to remember that '#' = '=' and ']' = '*' etc. I would like to be able to type BASIC code without it ending up as complete gibberish!!
2005-01-19 08:26
yago

Registered: May 2002
Posts: 333
You can crossdevelop BASIC-Programs with your favorite Text-editor.
Then use "petcat -w2" to produce the loadable Program.
petcat is a part of VICE, there are also other Tokenizer.

@enthusi: Did you take a look at k2devel.sourceforge.net/doc_k2asm.html ? Pretty "structurized" ASM
2005-01-19 11:22
enthusi

Registered: May 2004
Posts: 677
@yago, no I havent until now.
Nice :)
I just wanted to point out that C isnt THAT slow and that I'd rather code something in C than nothing in asm.
Actually, right now, In coding several things in asm :o)
Also, when I mean asm I mean NO cross-asm, so this might add to the difference c-asm.
As long as anyone codes anything for the c64 Im happy :)
Be it brainfuck or forth (java excluded).
2005-01-21 17:44
Raf

Registered: Nov 2003
Posts: 343
spinal : VICE allows to remap keyboard , actually linux version of vice is configured as PC layout by default - not c64 alike (so pressing shift+2 gives @ instead of " ) and this should also be confgiurable under windows.
2005-01-22 21:34
spinal
Account closed

Registered: Jan 2005
Posts: 47
can i assume that BASIC would be too slow for a side-scrolling platform game? (cos thats what i would like to eventually do)
2005-01-22 21:44
Graham
Account closed

Registered: Dec 2002
Posts: 990
no, as i said: on c64 you have to use assembler for EVERYTHING except a few tools which spend 99% of their time waiting on user input and printing text.
2005-01-25 22:31
spinal
Account closed

Registered: Jan 2005
Posts: 47
are you saying BASIC is NOT too slow, or that it IS?
2005-01-25 22:49
tlr

Registered: Sep 2003
Posts: 1790
Quote: are you saying BASIC is NOT too slow, or that it IS?

BASIC _is_ too slow. You need to code in assembly to do demo stuff.
2005-01-26 08:22
Oswald

Registered: Apr 2002
Posts: 5094
spinal: to give you an idea: to calculate a 256 byte long sinus table takes about 1 minute in basic.
2005-01-26 08:25
enthusi

Registered: May 2004
Posts: 677
morning :)
I think all basic indeed good for is testing stuff.
Simple stuff. Like making sprites or something. If you already did it in basic, it well get even simpler in asm. The main prob about basic and speed is, that its 'unpredictable' - there are many rather odd ways to speed up basic. Non of them is nice ;)
In your case, I'd take a nice asm-tutorial thats not all too technical and start right away. Maybe with a monitor-prg frist but you will soon want an assembler I guess. First programs are just as easy as in basic and acutaully they make more sense.
I think this one is nice for very first steps:
http://www.redizajn.sk/tnd64/assemble_it.html
Have fun & code well,
enthusi
2005-01-26 09:49
Puterman
Account closed

Registered: Jan 2002
Posts: 188
enthusi: I wouldn't recommend Richard's tutorial, there's so much stuff in it that just doesn't make sense.

Check out Programmer's Reference Guide or C=Hacking instead.
2005-01-26 10:14
JackAsser

Registered: Jun 2002
Posts: 2014
Stop whining and start coding for christ sake!

1. IO-map: http://www.hut.fi/Misc/cbm/docs/c64-io.html
2. OP-Codes: http://www.oxyron.de/html/opcodes02.html
3. Assembler: http://www.cc65.org/
4. Emulator: http://www.viceteam.org/
5. People to ask: Channel #c-64 @ IRCNet
6. Brain

I used then above recipe and it worked out pretty well...

/JackAsser
2005-01-26 10:18
iopop

Registered: Dec 2001
Posts: 317
also worth to check out is this one. The Best C64 Ml tutorial collection

if you're not able to do a demo after reading that one, you prolly not should do c64 stuff at all..
2005-01-26 10:42
TDJ

Registered: Dec 2001
Posts: 1879
Quote: also worth to check out is this one. The Best C64 Ml tutorial collection

if you're not able to do a demo after reading that one, you prolly not should do c64 stuff at all..


Hell, even I used that collection to finally start coding in ML on c-64!!

(All my demos from before 2001 were done in LOGO. Remember that, LOGO? The turtle rocked!)
2005-01-26 11:00
H.O
Account closed

Registered: Oct 2002
Posts: 70
Not to advocate Basic, but it actually can be used for some stuff. What is important is that speed isnt important and of course you can't do anything that requires timing.

For example, an adventure is easy to do in basic and has decent speed. Simpler arcade games (like a simpler version of galaxians) can also be done since you can put all moving items into sprites, and then just check sprite-to-sprite-collisions.

But, once we need more then 8 sprites, smooth scrolling of characters, etc, then basic is no longer an option. A game like "Space invaders" could be done in Basic, but it would have jerky movements. A game like "Scramble" wouldnt work at all since you would get neither smooth scrolling or be able to scroll the whole screen at decent speed in basic.

The few first "demos" that I wrote actually was in basic. Naturally, that meant that the scrolls would be very ugly since you cant time smooth scrolling in basic. On the other hand, if you make a scroller in sprites, using sprite movements, then it would look decent in Basic (but you might get raster glitches)

There also is compiled basic for the c64, but the version I tried oh-so-many-years-ago didnt increase speed that much. Around 3 times faster then regular basic, which is still way too slow for any raster timing.

There was also a decent Pascal compiler for the c-64, but I cant recall what kind of speeds you could get with it.

So, basically (pun intended) you can do some stuff with Basic (or compiled languages) on the c-64, but you become very limited in what you can create. Ever since I learned ML, the only things I used basic for myself was simpler stuff, like scroll-text-editors, sprite-editors, movement calculation, etc.
2005-01-26 11:14
Oswald

Registered: Apr 2002
Posts: 5094
heh, once I did a "quite" "smooth" upscroller in basic :) d011+print to scroll up a line :)

and I have learned ASM from a hungarian book about c64, which only explained the CPU specs and adressing in 3 pages, and in short each instruction (it expected that you already know asm) I only coded in basic before that...

/me rulez :)
2005-01-26 14:48
T.M.R
Account closed

Registered: Dec 2001
Posts: 749
Quote: heh, once I did a "quite" "smooth" upscroller in basic :) d011+print to scroll up a line :)

and I have learned ASM from a hungarian book about c64, which only explained the CPU specs and adressing in 3 pages, and in short each instruction (it expected that you already know asm) I only coded in basic before that...

/me rulez :)


No, you a show-off... =-)

i learnt from a VIC20 machine code book and the addresses from the C64 manual; kids today have it so easy with their cross assemblers and online documentation and tutorials!! =-)
2005-01-26 15:20
hollowman

Registered: Dec 2001
Posts: 474
Quote: No, you a show-off... =-)

i learnt from a VIC20 machine code book and the addresses from the C64 manual; kids today have it so easy with their cross assemblers and online documentation and tutorials!! =-)


i'd say learning asm from richards tutorial is more impressive
2005-01-26 16:24
enthusi

Registered: May 2004
Posts: 677
Hm, I posted the link less for learning it all, but to see what's possible and it's good for that. A quick start :) I think most people are pissed by pages of introduction to hex,dec lda/sta blabla... So if someone's really new - what more impressive than seeing how fast and small things can be (this counts for 'coding' only :).
My opinion.
@Jackasser: nice links, but I prefer not to use the brain as last option...

And its true: dont talk - do it!
And to some amount: dont read - do it!

There is ALOT out there but noone needs to know it all at once.
Hmm, if I wait maybe I find some more super-clever stuff I can declare. Like pi=3 or something...
2006-02-27 01:28
THE TEA DRINKER

Registered: Jul 2005
Posts: 39
If you're new to coding on c64 I would advice the basic first begin with simple stuff then go to more advanced basic stuff then it will also be easier to understand assembler/machine code languages.

I have an idea of how Oswald did that smooth scroller in basic but I guess he used some data lines for it on the basic.

Let us try a lame example of how many ways there is to do the same thing basic/machine code/assembler languages.

Let say we want black color on the border and screenbackground.
I think the easy way is basic, if you're a beginner on codeing on c64.

poke 53281,0:poke 53280,0 (if you want that in your program use a line number in basic)
Like this:
10 poke 53281,0:poke 53280,0

Just for fun how is that in machinecode languages ?

lda#$00
sta$d020
sta$d021
rts

so can you convert machinecode/assembler to basic ?

I would say yes, but this is not a very easy task, but this is just a lame example, so I give it a try.

so the basic would look like this, well proberly not the best one as I call this is a machine code basic initilation routine.

10 a=0:for i=49152to49160
20 if i=-1thenend
30 a=a+1:read a:print a
40 poke i,a:next i
50 data 169,0,141,32,208,141,33,208,96,-1

if you want to call that from basic after run and nothing happend then type sys49152, I have difficult to explain this, maybe another user can do this for the new one that want to learn coding on the c64.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Earthshaker/Silicon ..
Slajerek/Samar
Bieno/Commodore Plus
Naufr4g0
Alakran_64
csabanw
Bansai/BSILabs
fugu/Excess
MWR/Visdom
celticdesign/G★P/M..
Sychamis
Guests online: 110
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.075 sec.