NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: Prime on February 05, 2013, 12:38:47 PM

Title: Forcing operand word size.
Post by: Prime on February 05, 2013, 12:38:47 PM
Hi All,

I'm trying to reverse engineer some 16 bit ROM code, and am having problems with operand sizes. The disassembled code contains the following :

Code: [Select]
installed_hardware equ 0010h

  or word[installed_hardware],0040h

In the rom code this is represented by the bytes :

81 0E 10 00 40 00

This contains both a 16 bit pointer and a 16 bit value, however when assembled with NASM I get :

83 0E 10 00 40

This has the 16 bit pointer but only an 8 bit value

Changing the code to
Code: [Select]
  or word[installed_hardware], word 0040h

Seems to have no effect on the bytes that are output.

Am I doing something wrong or is this a bug, if it's my error how should I write the instruction so that it assembles to the correct binary form ?

Cheers,

Phill.
Title: Re: Forcing operand word size.
Post by: Prime on February 05, 2013, 01:29:19 PM
Following up my own post, seems to be to do with the optimization, I needed the 'strict' keyword to stop it optimizing th word back down to a byte so :

Code: [Select]
  or word[installed_hardware], strict word 0040h

Cheers.

Phill.