01 May 2021, 12:38 | #1 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 421
|
View Amos generated assembly code?
This is a long shot, but does anyone know if there's a way to look at the generated assembly code that Amos produces? I've looked the through the menus and extensions, but I can't see any way of doing it.
I'm trying to learn Amiga ASM at the moment, and it'd be great if I could just set something up in Amos and then look at what the assembly code was doing. I'm fairly familiar with what Amos can do, so to be able to translate and compare would be a real boon! If not then no problem. Just thought I'd ask as it seemed like a good idea. (Apologies if this is in the wrong section, but it does concern Amos) |
01 May 2021, 12:56 | #2 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,643
|
use a machine code monitor program or similar - it will show you the assembly in the generated executable..
|
01 May 2021, 12:58 | #3 |
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 855
|
Compile the code without including amos.library and disassemble it. To easily find where the piece of code you're interested in actually starts, write something like this:
Code:
A=$12345678 <your code> That said, this method won't help you learn - and actually might well give you bad ideas - because the compiled AMOS code is not efficient and is full of jumps to amos.library routines. Edit: here's a quick example. Let's consider this simple piece of AMOS code: Code:
A=$12345678 Add A,1 This is the generated assembly code: Code:
MOVE.L #$12345678,D3 MOVE.L D3,2(A6) MOVEQ.L #1,D3 ADD.L D3,2(A6) 1. puts the value $12345678 in the data register d3; 2. stores the content of d3 into the memory location pointed by the value stored in the address register a6 plus 2 (such memory location is evidently the memory space assigned to the variable A); 3. puts the value 1 in the data register d3; 4. adds the value of the data register d3 to the value stored in the memory space of the variable A. A much better translation - and still 1:1, without any human-conceived trickery - would have been: Code:
move.l #$12345678,2(a6) addq.l #1,2(a6) Code:
move.l #$12345678,d3 addq.l #1,d3 move.l d3,2(a6) A good optimizing compiler would instead write the optimal code: Code:
move.l #$12345679,2(a6) Last edited by saimo; 01 May 2021 at 13:26. |
01 May 2021, 13:46 | #4 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 421
|
Thanks for the replies folks!
@saimo I'm not too fussed about the code being super optimised. It's just to get a general overview of what's happening/how it's happening, which I think would be enough. I've seen other examples which aren't optimised, but have still helped me a lot because they're specific to a task. For other tasks I can't seem to find any examples at all, so I thought this would be a nice compromise. Either way, that's some great info you've provided, so I'll give that a try. I'd only be doing very simple things anyway, but as I say, it's just to get an idea. Thanks! |
01 May 2021, 14:00 | #5 |
Also known as GarethQ
Join Date: May 2019
Location: Twickenham / U.K.
Posts: 733
|
So I am not an assembler programmer at all, but on the cusp of wanting to learn it myself. This resource below has quite a few books from back in the day on the subject:
https://commodore.bombjack.org/books...ming_Guide.zip |
01 May 2021, 14:12 | #6 | ||
Registered User
Join Date: Aug 2010
Location: Italy
Posts: 855
|
Quote:
Quote:
|
||
01 May 2021, 17:27 | #7 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 421
|
@fxgogo Thanks for the link! I've downloaded.
@saimo Thanks for the reference, I don't think I have that book, though I do have the HRM. I've got a little "sort of" game demo working in assembly language (in that I can move an image around the screen with a gamepad with some screen boundaries etc.), but it was just to try and gather code references for things I can't really find any examples for (H-Flipping, Split screens, etc.). These things are so easy to do in Amos, so I thought it may be a good resource if I could see the ASM. |
01 May 2021, 22:54 | #8 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,130
|
Thanks for the info saimo.
Now I wonder how AmigaBasic by Micro$oft worked. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga Assembly extension for Visual Studio Code | prb28 | Coders. Asm / Hardware | 342 | 15 December 2023 21:22 |
Could someone please sense check this assembly code? | Ernst Blofeld | Coders. Asm / Hardware | 4 | 06 February 2021 15:26 |
assembly code to test for assign (2.0+) | jotd | Coders. System | 2 | 27 December 2017 23:16 |
Generated code for sprites | Zarchos | Coders. Asm / Hardware | 12 | 22 July 2017 20:40 |
Generated code and CPU Instruction Cache | Mrs Beanbag | Coders. Asm / Hardware | 11 | 23 May 2014 11:05 |
|
|