Author Topic: error converting masm 6.x to nasm  (Read 16975 times)

nobody

  • Guest
error converting masm 6.x to nasm
« on: October 30, 2009, 11:42:37 AM »
[BITS 16]
[ORG 07C00h]
jmp start     ;i added these 3 lines

;include Vesa.inc   ; vesa structures & defines
;replaced by
%include "blob.inc"

start:            ;I added this line
;Start proc
cli
xor      ax, ax
mov    ss, ax

=============================


struc VesaInfo
VesaSig:                         resd 1                 ;+0
VesaVersion:          resw 1                 ;+4
VesaVendorOffset:       resw 1                 ;+6

;masm was using '?' eg db ? etc

This was the only data that was initialised ie   ModeReserved:            db 1

& it's giving this error...
'attempt to assemble code in [ABSOLUTE] space'
????
Any help much appreciated

nobody

  • Guest
Re: error converting masm 6.x to nasm
« Reply #1 on: October 30, 2009, 11:56:18 AM »
Sorry for the layout Hope this makes things more clear

the program =====================

[BITS 16]

[ORG 07C00h]

jmp start ;i added these 3 lines

;include Vesa.inc ; vesa structures & defines

;replaced by

%include "blob.inc"

start: ;I added this line ;

cli

etc

=============================

blob.inc =================================
;masm was using eg 'label db ? ' apart from the db 1 allocated below which I left intact. I replaced the others with the approrpriate res instruction followed by 1. I also change the struc commands and used
+ instead of . in the program.

struc VesaInfo

VesaSig: resd 1 ;+0

VesaVersion: resw 1 ;+4

VesaVendorOffset: resw 1 ;+6

This was the only data that was initialised ie

ModeReserved: db 1   ;& it's giving this error...

'attempt to assemble code in [ABSOLUTE] space' ????

Any help much appreciated

nobody

  • Guest
Re: error converting masm 6.x to nasm
« Reply #2 on: October 30, 2009, 12:33:46 PM »
yasm's message is slightly more helpful ie

only RES* allowed within absolute section

I'll have to find out what an absolute section is

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: error converting masm 6.x to nasm
« Reply #3 on: October 30, 2009, 04:33:21 PM »
"ABSOLUTE space" means you're in a structure definition. Nasm's "struc" is just a "typedef" - doesn't emit any code/data. Masm will take "db ?" as "db 0" in initialized data, and equivalent to "resb 1" in uninitialized data. Nasm is fussier... and does structures differently!

The "struc" definition often goes in an ".inc" file. To create an actual instance of the structure, you need the "istruc" macro with its ugly "at" syntax... or you can declare an unititialized instance of the structure like:

my_vesainfo resb VesaInfo_size

Imagine underscores! :(

Okay, I'm outta here! RTFM:

http://www.nasm.us/doc/nasmdoc4.html#section-4.11.10

I've signed up to the "asmcommunity" forum:

http://www.asmcommunity.net/board/

Maybe see you there. (or the "nasm-users@lists.sf.net")

Later,

Frank