17 January 2024, 18:41 | #1 |
Registered User
Join Date: Jan 2010
Location: Germany
Posts: 67
|
VASM wrong opcode generated?
Hello guys,
I am playing around with VASM and came across something odd(?) If I assemble asl.b #1,d1 it will produce the opcode $D201 which is in my opinion add.b d1,d1 instead. If I take a look into the M68k manual I would expect opcode $E301 for asl.b #1,d1 Am I doing something wrong or is this a bug? I am using vasm 1.9f. |
17 January 2024, 18:48 | #2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,479
|
Some optimizations are active by default (see manual).
To disable all: -no-opt on command line or opt o- in source. You can disable and enable the various optimizations individually with other commands (always see manual). |
17 January 2024, 19:00 | #3 |
Registered User
Join Date: Jan 2010
Location: Germany
Posts: 67
|
WOW that was fast
Thanks ross , this fixed the issue. |
17 January 2024, 19:47 | #4 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,303
|
vasm does that for a reason: for a 1 or 2 bit shift, it's faster to add the register with itself.
That said, I'm not sure that add.b d1,d1 is strictly equivalent to asl.b #1,d1 as there's the arithmetic part that isn't there in lsl. |
17 January 2024, 20:15 | #5 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,479
|
Quote:
Therefore, in this case, the optimization is legitimate But you are right about being careful with this optimization. |
|
17 January 2024, 20:40 | #6 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,423
|
On a kinda-but-not-fully related question:
Can you disable these optimisations using opt -o for only part of a single file? If so, how do you enable the default stuff again, opt +o? |
17 January 2024, 20:52 | #7 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,479
|
Sure!
You can insert opt in the source only for the part of the code on which you want to enable or disable that optimization. (but the code may become less portable..) |
17 January 2024, 21:52 | #8 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,510
|
|
17 January 2024, 22:11 | #9 |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 2,006
|
Yes, default asembler optimisations its always bug for me. I remember ROM original module code, perhaps from wb.find. When jmp was replaced with bra.b (if I remember right). And it was bug.
Anyway for this case i dont see reason for use asl command, for me is totally useles. Lsl is much logical for me. |
17 January 2024, 22:14 | #10 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,479
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about XREF vs XDEF (vasm 1.8 vs vasm 1.9) | roondar | Coders. Asm / Hardware | 8 | 01 May 2023 20:59 |
VASM wrong assembling? | deadwood | Coders. Asm / Hardware | 32 | 01 January 2015 23:25 |
WinUAE message - Opcode 0CD9... | Bigby | support.WinUAE | 2 | 01 February 2014 19:42 |
New opcode for 68000 family | clenched | request.UAE Wishlist | 15 | 14 April 2009 15:02 |
Hidden Amiga 68000 opcode? | pmc | Coders. General | 20 | 14 May 2007 09:10 |
|
|