News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

ud2 opcode

Started by guga, February 22, 2022, 11:48:27 AM

Previous topic - Next topic

guga

Does masm support ud2 opcode ?

I´m trying to rebuild a Freebasic routine, and it uses this opcode, but when trying to assemble it mas, gives me this error:

FbRtl.asm(5538) : error A2008: syntax error : ud2

The function i´m trying to create is:

fb_DevScrnRead_cold proc near
                mov     eax, large ds:38h
                ud2
fb_DevScrnRead_cold endp


How to use this ud2 opcode ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

hutch--

Guga,

That opcode does not ring a bell, can you find it in an Intel manual ?

jj2007

Just use db 0Fh, 0Bh (you'll see in the debugger what it does):
include \masm32\include\masm32rt.inc
.code
start:
  print "Hello World"
  db 0Fh, 0Bh
  inkey "That was ud2"
  exit
end start

guga

Hi JJ. Tks, but this msg came up

"FbRtl.asm(5537) : error A2206: missing operator in expression"


fb_DevScrnRead_cold proc near
                mov     eax, large ds:38h
;                ud2
db 0Fh, 0Bh
fb_DevScrnRead_cold endp


Btw...the beginniong of the file i´,m using this:

    .686
    .model flat, stdcall
    .xmm
option casemap :none   ; case sensitive


Steve, this opcode is the same as Nop, with the only difference that it raises a opcode exception
https://mudongliang.github.io/x86/html/file_module_x86_id_318.html

I have no idea why Fb (FreeBasic) is using this, but since i´m testing to see if i can build in masm, a Runtime Library of FreeBasic, i chosen to keep the instructions as it is.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

Ok, Worked after i remove the "large" command

fb_DevScrnRead_cold proc near
                mov     eax, ds:38h
db 0Fh, 0Bh
fb_DevScrnRead_cold endp


Tks, Steve and JJ :thumbsup: :thumbsup:
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

hutch--

Yes, that makes sense, LARGE is an old memory model that would not be compatible with FLAT memory model, I think its a left over from the DOS era.

Gunther

Quote from: hutch-- on February 22, 2022, 01:40:31 PM
... LARGE is an old memory model that would not be compatible with FLAT memory model, I think its a left over from the DOS era.

Yes this is an old left over from DOS, just like TINY, SMALL or MEDIUM for example. Under Win32 that's no longer needed.
You have to know the facts before you can distort them.