I can only program in Assembly Language - help?

Status
Not open for further replies.

Piglet

New member
Hi,
I spent 20 years as a professional games programmer (from the C64 version of Tetris to several GBA titles that used my audio driver but didn't credit me.

My problem is that while I find assembly language second nature, I really cannot program in C/C++ and so on. I HAVE tried and all I ended up with as a C program that used the same logical operators that were treated in an assembly language program i.e. it took twice a long to do the same thin.

I have the source code of an MP2/MP2.5/MP3 decoder as well as an ACELP, MELP and LPC10 driver. I have also used the unused bits of ACELP *DAB/DAB+) as a broadcast of data for students. After all, it's a programming problem, not an audio problem.

My only problem is that for 20 years, a C programmer would point out what call and what variable would be needed and I went off and did it. For anyone wondering what I did, it was things like the 'Mode 7' floor on the 32X, Saturn, PSX & PC along with object scaling on BC racers. Games like Asterix on the Master system was just using my engine. That's the key bit - my code was optimised and commented.

So that's me. If someone gives me a chunk of C and asks for it to be rewritten in optimised assembly language.

So If someone has a basic shell, I would love to know about it. The current project is not-for-profit but I guess the people behind it WILL get famous. From under 1Kb per second to 48b per second are all covered, I just need help with the fiddly bits.
 
So If someone has a basic shell, I would love to know about it.

I don't quite know what you mean by "basic shell". Normally those words would mean something like unix-style login to a shell like zsh rather than bash. Combined with all this talk about assembly programming, kinda makes me think of the ancient Apple 2 monitor rom. But really, I'm not sure what you need, so here's some pretty generic info which might help.

With Teensy, the model is you compile (or assemble) and link everything together on your PC. The linker output format is ELF, which is a complicated mix of binary data and lots of metadata like symbol tables & debugging info. Then just the binary data is extracted from the ELF file into a HEX file. HEX files are ascii encoded with address & checksums, but otherwise they're only the raw binary data which gets written into the non-volatile memory.

In a very minimalist setup, you would somehow create the HEX file you want written onto your Teensy, and then use either the GUI-based or command line Teensy Loader program to write that HEX file onto the hardware.

Now I have some slightly unpleasant news for you, but hopefully it's not too bad. The path to getting a very minimal setup involves installing a huge environment. But then you can later delete the stuff you don't need... though I highly recommend getting it working first before you start deleting unwanted files (yes, we've had people do this and the result was a lot of frustration).

Here's the list of dev software which works with Teensy.

https://www.pjrc.com/store/teensy40.html#software

I'm guessing that last one is the way you'd like to work. To get there, you install the first. You don't actually have to ever run the Arduino IDE, but a copy does have to be on your hard drive for the Teensyduino installer to work. Then when you've finished installing everything, open a command line and change to one of those directories deep within the Arduino folder, and run "make".

Yeah, it's mostly C/C++ code. Ultimately it all gets compiled and linked to a HEX file, and Teensy Loader writes it to your board.

As Frank mentioned, you can write in assembly. Just name your files with .S instead of .c or .cpp. They'll get assembled into .o files, and then linked with everything else into the .ELF and then the .HEX data.

You can also put inline assembly into .c and .cpp files, but that involves a rather complex syntax to tell the compiler which of its variables you want mapped onto certain registers, and which registers your code will clobber, and memory barriers and other arcane compiler details.

Hopefully this helps. And if this isn't what you wanted, maybe explain a bit more what you meant by "basic shell" and I'll try to reply more specifically.

And if you do get up and running, I hope you might share any insight or learning experiences. We occasionally get people who say they want to use assembly language, or write everything completely from scratch, or both! Years ago we had someone actually bring up a completely from-scratch system on Teensy 3.2 (but not in assembly) and I believe there are some old forum threads and maybe a blog about it somewhere.

But as far as I can recall, nobody has yet done a lot with assembly. If you do, I really hope you'll share any experience & insight that might help others who wish to do everything the assembly way!
 
Status
Not open for further replies.
Back
Top