flat assembler
Message board for the users of flat assembler.

Index > Main > fasmg bug for 8086, 80186, 80286 imul dx, cx

Author
Thread Post new topic Reply to topic
Shia



Joined: 02 Aug 2025
Posts: 2
Shia 14 Nov 2025, 12:21
Assembling this code in fasmg

Code:
INCLUDE=$PATH_TO_FASMG/fasmg/packages/x86/include/cpu fasmg hello.asm    


Code:
include '8086.inc'
imul dx, cx
    


Results in this error:

on 8086.inc
Code:
hello.asm [2]:
        imul dx, cx
imul? [0]
Error: extra characters on line.
    


on 80186 80286
Code:
flat assembler  version g.kp60
hello.asm [2]:
        imul dx, cx
imul? [63]
Custom error: invalid combination of operands.
    


Looking on https://www.felixcloutier.com/x86/imul it seems that IMUL r16, r/m16 is a valid instruction.
Post 14 Nov 2025, 12:21
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8468
Location: Kraków, Poland
Tomasz Grysztar 14 Nov 2025, 13:28
The modern instruction set references do not have the precise information on the pre-CPUID era instruction sets. I would recommend to use a classic reference like Ralph Brown's opcodes list that has comments about the CPU generation when a specific instruction variant was introduced:
OPCODES.LST wrote:
68 PUSH imm ; NECs & 186+
69 IMUL reg,imm,mem ; NECs & 186+
6A PUSH imm8 ; NECs & 186+
6B IMUL reg,imm8,mem ; NECs & 186+
OPCODES.LST wrote:
AF IMUL reg,mem ; 386+
Or, if you were really determined, you could dig through the archives of Intel documentation for specific CPU generations and see for yourself which opcodes were introduced at each stage.
Post 14 Nov 2025, 13:28
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8468
Location: Kraków, Poland
Tomasz Grysztar 14 Nov 2025, 13:40
BTW, with fasm2 you're going to get more informative error messages. Try this:
Code:
use i8086
imul dx, cx    
I uploaded a small correction to fasm2 encoder, as I discovered a bug while testing before replying.
Post 14 Nov 2025, 13:40
View user's profile Send private message Visit poster's website Reply with quote
Shia



Joined: 02 Aug 2025
Posts: 2
Shia 14 Nov 2025, 13:54
Thanks
Post 14 Nov 2025, 13:54
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.