Author Topic: [SOLVED] Label & Preprocessor  (Read 6541 times)

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
[SOLVED] Label & Preprocessor
« on: February 16, 2015, 01:47:09 PM »
Hello, I have a problem, I would like to put a label and directive in same line, but nasm give me an error:

Code: [Select]
rhino_3D: %include "1.ASM\HackEngine\WinAPI\data\world\Rhino.3D"

give me:
Quote
error: parser: instruction expected
« Last Edit: March 14, 2015, 03:47:45 AM by shaynox »

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Label & Preprocessor
« Reply #1 on: February 16, 2015, 03:23:04 PM »
Hi shaynox.

Apparently Nasm doesn't care what you'd like, but expects an instruction or nothing after a label. Putting the "%include" directive on the line after the label should solve this problem, but unless "Rhino.3D" is in Nasm syntax it isn't going to work anyway. You might possibly have better results with "incbin", but I doubt that'll work either. What kind of file is "Rhino.3D"?

Best,
Frank


Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: Label & Preprocessor
« Reply #2 on: February 16, 2015, 04:15:40 PM »
^^ apparently yes, the .3D file is just my own file format of 3D object.

And about incbin, it work when I putting it next to my label, but it doesn't work functional side, nothing happen.
I mean when I try to show the rhino, I didn't see anything compare when I wrote %include.
And i verified around the size of executable and found a lesser weight than %include.
« Last Edit: February 16, 2015, 04:43:33 PM by shaynox »

Offline shaynox

  • Full Member
  • **
  • Posts: 118
  • Country: gr
Re: Label & Preprocessor
« Reply #3 on: March 14, 2015, 03:47:28 AM »
Good new, I have found how to do this.

It just needed to use this macro, and call it before the include.

Macro:
Code: [Select]
;===============================================================================.
; _  (multi line)                                                              |
; Purpose : Give the possibility to write multiple instructions in single line.|
;===============================================================================.
; %0 = number of parameters received
; %1 = 1st parameter received
%macro _ 1-*

%rep (%0) ; Reapet %0 times
%1
%rotate  1 ; Rotate element right to left for scanning all element parsing in macro.
%endrep

%endmacro
;===============================================================================.
; / _ (multi line)                                                            |
;===============================================================================.

Example:
Code: [Select]
rhino_3D:        _%include "1.ASM\HackEngine\Resource\obj3D\Rhino.3D"


Enjoy !
« Last Edit: March 20, 2015, 09:52:21 PM by shaynox »