Page 1 of 1 |
Frant
King's Bounty
Posts: 24433
Location: Your Mom
|
Posted: Fri, 16th Aug 2024 08:05 Post subject: Frant's Amiga 68K assembler adventures |
|
 |
Part 1:
So I felt the urge to really get back into 68K assembler on the Amiga and this time stick with it.
I haven't done any real programming on the Amiga since 1994. I've made 2-3 attempts to get into it again the last couple of years but then forgot about it (truth: gave up after an hour).
I really believed that it would all come back to me almost instantly as I started. Oh how wrong I was. I remember the basics of it but I soon realized I had forgotten a TON of important things like various addressing variations, advanced use of registers and a lot that's needed to actually write useful code.
I created a disk with AsmTwo, the best assembler for OG Amiga coding IMHO, this particular version based on AsmOne, focusing on pure A500 68000 OCS/ECS assembly for effectiveness and saving a lot of RAM for actual code.
So I downloaded a startup sample source code from an online assembler course to get me started. A startup routine sets up everything needed for demo coding including turning off most of the OS, system interrupts etc. which gives me full control of the system and RAM.
Let's just say that the sample startup source code is 75% gibberish to me. Granted, it was written by a very skilled and advanced demo coder from a group called Scoopex which explains the dense and complex (for me) code he wrote.
(link to the page: Coppershade
I started AsmTwo, reserved 100KB chipmem for code and data and loaded "PhotonsMiniStartup.S" and was presented with this:
It was mainly me going "huh? what's that? what's he doing? how..?". I recognized all the mnemonics like move.*, bne/bra, lea, add etc. but the addressing modes of registers, jumps and branching was just gibberish to me.
I realised I had to go simple and re-learn a lot of the basic stuff before being able to follow more advanced code. I guess that's what happens when you haven't programmed in ~30 years. So I decided to write the simplest program I could think of:
Code: |
loop:
add.w #$0001, $dff180 ; add 1 to the background color register
btst #6, $bfe001 ; is the left mouse button tested?
bne loop ; no? goto loop
rts ; otherwise return to assembler/os
|
That obviously worked since it's one of the most simple things you can do in assembler. No setup, no initialization of various system components (except for testing the mouse button), no calls to the operating system etc.
Now I have to take the next step re-learning my old hobby.
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!
"Thank you to God for making me an Atheist" - Ricky Gervais
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
Ankh
Posts: 23226
Location: Trelleborg
|
Posted: Fri, 16th Aug 2024 09:43 Post subject: |
|
 |
Keep us updated!
shitloads of new stuff in my pc. Cant keep track of it all.
|
|
Back to top |
|
 |
LeoNatan
Banned
Posts: 73193
Location: Ramat Gan, Israel 🇮🇱
|
Posted: Fri, 16th Aug 2024 14:47 Post subject: |
|
 |
Any reason to go with direct assembly and not with C and something like https://github.com/bebbo/amiga-gcc ?
I understand if it’s for nostalgia purposes and you want to relive the experiences you had when your were writing the assembly yourself. But if the source of your hunger is making actual software, it is more than likely that a modern compiler will produce a more optimized binary than you would, and your velocity is likely to skyrocket.
|
|
Back to top |
|
 |
Frant
King's Bounty
Posts: 24433
Location: Your Mom
|
Posted: Fri, 16th Aug 2024 17:55 Post subject: |
|
 |
Nah, I'm only doing it for fun, not for productivity. It's partly because of nostalgia but also a way to stimulate my brain.
The goal is to make an intro or a demo at some point. Pure assembler is fun on Amiga. I have total control over everything in the machine and the mindset of programming in assembler on the Amiga is quite rewarding (at least when you get something to work).
Assembler on the Amiga is the most efficient language for games, demos, intros etc. Most games were written in 68K assembler for that very reason.
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!
"Thank you to God for making me an Atheist" - Ricky Gervais
|
|
Back to top |
|
 |
Nalo
nothing
Posts: 13437
|
Posted: Fri, 6th Dec 2024 18:42 Post subject: |
|
 |
|
|
Back to top |
|
 |
Frant
King's Bounty
Posts: 24433
Location: Your Mom
|
|
Back to top |
|
 |
Ankh
Posts: 23226
Location: Trelleborg
|
|
Back to top |
|
 |
Frant
King's Bounty
Posts: 24433
Location: Your Mom
|
Posted: Sat, 7th Dec 2024 22:16 Post subject: |
|
 |
Thanks. I prefer paper books that I can have next to me when I code. I'll find my HRM. I know in which room it is, I just have to look through stuff.
I think I've found a really good example of a startup routine. Every single line is commented which makes it a lot easier to understand.
https://bumbershootsoft.wordpress.com/2024/08/10/amiga-500-bare-metal-startup-code/
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!
"Thank you to God for making me an Atheist" - Ricky Gervais
|
|
Back to top |
|
 |
Page 1 of 1 |
All times are GMT + 1 Hour |