English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 23 March 2019, 14:53   #1
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
How do you break it down as a noob?

So, I have dabbled a few times with trying to learn asm code on the Amiga. I've done a small amount of 6502 prior to this by hacking about on Atari Asteroids code and 6809 on the Vectrex so I kind of get the principals.

I seem to have a problem when it comes to the Amiga though in so much as I follow tutorials and things very, very quickly just get massively overwhelming and I'm not really too sure how to overcome this. I can't rule out my aging brain just not wanting to take it in but hopefully it's not that!

I'm no stranger to code. I have done so for a living since around 1990 but it's been higher level: VBDos, then C, C#, Java and so on.

I know this is a bit vague but any suggestions on how I might be able to break these things down and take it all in a bit better? I can't be the first person to have had this problem? Far from it I would think.
MartinW is offline  
Old 23 March 2019, 15:01   #2
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
Break it down in smaller pieces. You know C ? Then do C. You can then learn AmigaOS and even the hardware. Then 68k code is just another language.
meynaf is offline  
Old 23 March 2019, 17:01   #3
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
Well the whole point was to learn asm on the Amiga but yeah, I guess I could go back to trying C if the opinion is that would be a better way to start. Haven’t done C commercially since 2016 so I’m rusty but ok I imagine.
MartinW is offline  
Old 23 March 2019, 17:02   #4
Gorf
Registered User
 
Gorf's Avatar
 
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,294
"Have do you break it down as a noob"

Languages are not always easy ... e.g. your thread title produces a severe syntax error in my brain.
Gorf is offline  
Old 23 March 2019, 17:06   #5
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
Yep, spotted that but I couldn’t see an obvious way to edit it. Unless I missed it? Don’t see anything in Thread Tools
MartinW is offline  
Old 23 March 2019, 17:10   #6
lilalurl
Global Moderator
 
lilalurl's Avatar
 
Join Date: Aug 2001
Location: France
Posts: 3,289
Send a message via ICQ to lilalurl
Moderator privilege (to prevent users from abusing it and changing a thread title every now and then).
lilalurl is offline  
Old 23 March 2019, 17:13   #7
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
Quote:
Originally Posted by lilalurl View Post
Moderator privilege (to prevent users from abusing it and changing a thread title every now and then).
Thank you
MartinW is offline  
Old 23 March 2019, 17:13   #8
arcanist
Registered User
 
Join Date: Dec 2017
Location: Austin, TX
Age: 41
Posts: 405
You could start in assembly if you wanted to, nothing wrong with it. The reason it'd be harder than C is because you're simultaneously learning the language and the hardware (or OS if that's your thing). It's also more verbose and you have to juggle a limited set of registers (though much easier than 6502) vs. unlimited set of variables.

Programming hardware registers or OS system calls is largely the same in either language, once you have the basics down. Both of those paths go quite deep. See the Hardware Reference or Libraries and Devices RKMs. Neither of them have much to do with the language at all.

You can also mix C and assembly, with assembly for the performance critical sections. That's how I'd approach a larger project regardless of skill level.
arcanist is offline  
Old 23 March 2019, 17:33   #9
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,986
I would go look at asm source code examples, and see if you can follow whats going on.

68000 is one of the easiest instruction sets to follow, its laid out intuitively and as you would expect it to be (i'm looking at you x86!!!).

Once you start to understand the instruction set and whats going on, then you will find it easier to understand why we do things a certain way to get Amiga related things happening.
Galahad/FLT is offline  
Old 23 March 2019, 17:59   #10
Gorf
Registered User
 
Gorf's Avatar
 
Join Date: May 2017
Location: Munich/Bavaria
Posts: 2,294
http://www.chibiakumas.com/68000/

The page looks way too colorful and ugly, but the information might be what you are looking for.
Especially since there are plenty of comparisons to 8-bit asm, that you already have some experience with..

This is not Amiga-specific, but 68k. Yet examples provided work on Amiga with vasm.

This would be the first step - next would be either AmigaOS specific calls (libraries and so on) or direct hardware access (custom chip registers), depending on what your goal is.

Last edited by Gorf; 23 March 2019 at 18:05.
Gorf is offline  
Old 23 March 2019, 18:14   #11
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
Blimey - that IS a colourful site

Thanks that looks like it's got some interesting stuff in there. I found mention in another thread a day or two ago about a VS Code extension for Amiga Assembler that integrated with vasm, vlink etc. and FS-UAE so yeah, despite wanting to do what I imagine most new people want to do and that is use an actual Amiga, that VSCode plus vasm and an emulator might well not be a bad idea.

So, I was thinking about the whole subject of C while out driving just now and as flippant as my reply might have been that the idea was to learn ASM, I think it's probably not a bad idea to do a bit of both if maybe it's faster initially to try some things out in C. I was already thinking of some things that I should probably try to work out because I ought to be able to use C for them and frankly, I should know how to do it - stuff like how to get stuff onto the screen etc.

So I guess the answer, at least initially is to take a step back, set some realistic goals and get there in whichever small steps that I can. And I think the way my brain works is that I at least need to try to read some manuals and work it out for myself rather than just being thrown code and not really understanding the why.

Then, yeah, as I start to grasp stuff then maybe looking at other peoples code may make more sense.
MartinW is offline  
Old 23 March 2019, 18:22   #12
Kalms
Registered User
 
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
Try writing out what you want to accomplish as C code first. Then translate that into assembly, chunk by chunk.

You have global variables both in C and assembly.

You have raw, linear logic in C. This maps to raw, linear logic in assembly.

You have flow control constructs in C. These map to conditional branches in assembly.

You have local variables in C;. These map to temp storage locations on the stack or registers in assembly.

You have function calls in C. These map to jsr/rts + locations on the stack or registers in assembly.

You have structs in C. These map to 'rs' constructs or lists of EQU constants + memory accesses with displacement in assembly.

You have arrays in C. Translate any array usage into pointer usage. You should then be able to translate the pointer usage to assembly code.

Perhaps that helps?
Kalms is offline  
Old 23 March 2019, 18:28   #13
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
I think it certainly will come in handy once I can get line 1 down - write out what I want to accomplish in C !
MartinW is offline  
Old 23 March 2019, 18:46   #14
arcanist
Registered User
 
Join Date: Dec 2017
Location: Austin, TX
Age: 41
Posts: 405
Quote:
Originally Posted by MartinW View Post
Thanks that looks like it's got some interesting stuff in there. I found mention in another thread a day or two ago about a VS Code extension for Amiga Assembler that integrated with vasm, vlink etc. and FS-UAE so yeah, despite wanting to do what I imagine most new people want to do and that is use an actual Amiga, that VSCode plus vasm and an emulator might well not be a bad idea.
Yes, I wouldn't recommend writing assembly on a live Amiga. You're going to see a lot of reboots.

FS-UAE's snapshots are really useful to get the system back into a good state. My development setup can go from crash to rebuild, deploy, and run in about a second. It's also got a useful monitor for debugging (F12 + D).

I think WinUAE might have an edge in C debugging with symbols? I didn't have a chance to play with it but I saw Toni did some work in that area.
arcanist is offline  
Old 23 March 2019, 18:57   #15
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
Ahh, I try to keep my Windows machine as clean as possible for gaming (modern gaming obviously). It has WinUAE on it but no dev tools. So it will be MacOS / FS-UAE if it's anything. Or I do have a linux partition on my gaming PC but may as well use my Mac if I'm going to do that - especially given it lives next to my real Amigas.
MartinW is offline  
Old 23 March 2019, 20:57   #16
Tigerskunk
Inviyya Dude!
 
Tigerskunk's Avatar
 
Join Date: Sep 2016
Location: Amiga Island
Posts: 2,770
Amiga ASM chipset coding is horrible in the beginning.
Maybe you should start with Photons Amiga asm tutorial which can be seen on youtube.
Thats a nice start.
Tigerskunk is offline  
Old 24 March 2019, 15:14   #17
LaBodilsen
Registered User
 
Join Date: Dec 2017
Location: Denmark
Posts: 179
Quote:
Originally Posted by Steril707 View Post
Amiga ASM chipset coding is horrible in the beginning.
Maybe you should start with Photons Amiga asm tutorial which can be seen on youtube.
Thats a nice start.
Second that, photons tutorial is a really good start, as it takes it all in very small steps. Link

And MartingW, i can feel your pain, as i felt it the same way when i first had to learn asm programming on amiga. but as with everything else, keep at it, and some day it will click.

WinUAE is all you need right now. Just setup a nice workbench and have Asm-One or Asm-Pro. a reboot is less than a sec, and it takes no time to start Asm-one again and reload the source.

Last edited by LaBodilsen; 24 March 2019 at 15:19.
LaBodilsen is offline  
Old 24 March 2019, 21:14   #18
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
Quote:
Originally Posted by Galahad/FLT View Post
I would go look at asm source code examples, and see if you can follow whats going on.
Have to say that I don't usually find this all that helpful, BUT, I just downloaded the source to Celtic Heart by PHX and I find it surprisingly followable! May have to dig deeper then.
MartinW is offline  
Old 25 March 2019, 00:05   #19
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
I put all my little examples on github when I was (re)learning amiga asm, might be useful for you, maybe not:

https://github.com/alpine9000/amiga_examples
alpine9000 is offline  
Old 26 March 2019, 14:43   #20
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
When your goal really is to do some oldschool 68k lowlevel coding, then I can only recommend debugging with UAE. It is the only way to debug your code after you have taken over the machine. This is something Amiga developers could only dream of, 30 years ago. And you can also learn a lot about the 68k this way.

Set a breakpoint for UAE in your code. I am using a no-op instruction which never occurs anywhere else, like EXG A7,A7 (dc.w $cf4f). Then fire up UAE, enter the debugger and type "fi cf4f". The emulation stops upon encountering this instruction and you can single-step through your code and analyse everything...

Of course, you should also run your code on real hardware from time to time. UAE is no perfect, and the real hardware is the reason why we do it!
phx is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Did I break my 1232? Signman support.Hardware 4 16 October 2016 15:59
Before I break something... (if I haven't already) asm1 support.Hardware 24 19 March 2009 01:54
Warranty seal on a mint A500: To break or not to break? StevenJGore support.Hardware 16 11 February 2009 23:21
break's and demos bobbybearing request.Demos 2 12 August 2006 21:44

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:37.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.22583 seconds with 16 queries