Should I learn to program in C or ASM?

페이지 1/2
| 2

By Pineapple

Resident (47)

Pineapple의 아바타

19-08-2020, 21:35

I want to move beyond Basic to either C or ASM so I can make games for MSX, SG-1000 and Colecovision.
I am strongly leaning towards C, but I can understand the usefulness of ASM.
What are your opinions?
Which is the easiest to learn?
Which compiler, etc is the best?

Thanks for your help.

Login or 등록 to post comments

By Manuel

Ascended (19678)

Manuel의 아바타

19-08-2020, 21:56

It's simple I think: C is much easier to learn and easier to get quick results on, especially if you have a C compiler with some good libraries. But if you want to get all the juice out of the hardware, assembler is the way to go.
You can also combine: write performance critical parts in assembler and the glue code in C.

By MsxKun

Paragon (1134)

MsxKun의 아바타

19-08-2020, 22:07

ASM. Get full power.
Once you know it, it's pretty easy. A collateral good thing about it, it's you get to know your hardware. Pretty much nothing is in the middle between what you think and code and the machine you program for. So you become one Wink
So you don't only learn how to program, you also learn how a computer works, in deep.

The cons are... you learn how a computer works, in deep. If you change the computer, different architecture, you need to re-learn ;P Not from zero, some concepts will be the same, but some other things will be confusing. Example, the same Coleco, almost same architecture than MSX... well... if you do DI HALT on MSX, hangs. On a Coleco nothing won't happen. The interrupts works a bit different and that can cause some confusion at the beginning if you are pretty used to MSX and move to Coleco (or viceversa).

So... well, learn both. Use ASM Wink On MSX, for best perfomance and joyfullness. On other systems suit yourself Big smile

By Grauw

Ascended (10821)

Grauw의 아바타

19-08-2020, 22:35

I don’t think assembly itself is difficult. There are only simple operations which are pretty easy to understand. The harder part is understanding the various hardware that you access, but that is the same for other languages. I also think assembly is easy to get started with, you don’t need a big toolchain or libraries.

But you could also just give both options a try. Write a simple program that moves some sprites around or something in both languages, and see which you like most. Either way knowledge about the one language will be useful when you use the other.

By santiontanon

Paragon (1831)

santiontanon의 아바타

19-08-2020, 22:35

Each has pros and cons as people mentioned above. My suggestion is to learn the one you would be excited to learn. This is all a hobby, and I think the most important thing is to have fun while doing it Smile

By thegeps

Paragon (1251)

thegeps의 아바타

19-08-2020, 23:31

Do you need extreme performance? Asm is your way. Else you ca do a lot using C (I suppose, I don't know C...). You can learn both and use C for main structure (I think it is easier code some games' mechanisms in C than in asm) and asm for "performance needed" parts...

By ducasp

Paladin (712)

ducasp의 아바타

20-08-2020, 02:16

Don't restrain yourself, learn both, even using C there will be times that ASM knowledge will be a must... The only decent way to currently debug a C program in MSX is using emulators and debugging the resulting ASM code...

Also, even though there are several libraries, most of them conveniently packed in fusion-c for SDCC, or libs for ASCII or Hitek C compilers, not everything is implemented, and, depending on your plans, you won't escape from doing parts of your code in ASM because there is not a library that does what you want or how you want...

By the way, Pascal has its fans and also a great library support for MSX,not sure about coleco and sg-1000 though.

By djh1697

Paragon (1736)

djh1697의 아바타

20-08-2020, 02:43

I would recommend C, it is a transferable skill, although Z80 ASM can do some things that C cannot do as easily.

By Pineapple

Resident (47)

Pineapple의 아바타

20-08-2020, 04:11

The "transferable skill" part of C is what draws me towards it the most. Though I think that picking up some ASM skills later would be highly beneficial.

As for C, how do I get started?
What are the best (or easiest to use) programming tools?

I really only have experience using Clickteam Fusion, RFO Basic and MSX Basic, so my knowledge of compilers and the like is somewhat limited.

By bore

Master (182)

bore의 아바타

20-08-2020, 10:10

I recommend going with assembly first and save C for later.

Sometimes people who start with high level languages have problems understanding how indirect addressing works and other things that are very obvious in assembly.
If you start with assembly it will be a lot easier to understand what C does under the hood and why it is like it is.

By theNestruo

Champion (430)

theNestruo의 아바타

20-08-2020, 10:26

My suggestion would be coding a very small game prototype (e.g.: a two-color sprite moving with the cursors and gaining 100 points by picking a randomly placed item; no scenary, no walls) in both languages.
It shouldn't take you more than a few afternoons and you'll get a grasp of both languages; not much, but enough to decide for yourself which one do you feel more comfortable with.

페이지 1/2
| 2