Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > NASM %define %i...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 4640 of 4646
Post > Topic >>

NASM %define %ifdef %include - Converting C to NASM

by "Jim Carlock" <spamtrap@[EMAIL PROTECTED] > May 1, 2008 at 10:26 AM

Hi,

I am looking to combine a bunch of "C standard .h" files
into one "MyInclude.inc" file.

Is there a suggested manner in which to get this done?

In the end, I seek to include ONLY ONE file, by using
the %include directive more than once.

An example...

;
; START MyInclude.inc
;

; prevent multiple inclusions
%ifndef MYINCLUDE_INC
  %define MYINCLUDE_INC
  ;standard inclusions...
%endif

;WHICH SECTION do we include?
;
%ifdef SECTION_INC
  ;
  ;SEEKING a way to jump into and process ONLY the
  ;STDUNI_H section. Do NOT want to use an assembly
  ;jmp instruction. There a NASM directive to do
  ;this? Or can anyone suggest another way to get
  ;this accomplished?
  ;
%endif

;
;NOTE: Do we want an assembler label here? I think
;NOT! But is there a way to jump to a different
;location inside this one file without creating any
;assembly language (using NASM directives)?
;
STD_UNI_H:
%ifdef INCLUDE_STDUNI_H
  ;
  %ifndef STDUNI_H
    ;STDUNI_H is NOT defined, so define it
    ;
    %define STDUNI_H
    ;... all the stuff to get included ...
  %else
    ;STDUNI_H is defined
    ;
    ;seek a way to exit this file...
    ;HOPING for %exit directive or some sort of other
    ;STOP_PROCESSING_THIS_INCLUDE_FILE directive.
  %endif
  ;
  %ifndef STDIO_H
    ;
  %else
    ;seek a way to exit this file...
    ;HOPING for %exit directive or some sort of other
    ;STOP_PROCESSING_THIS_INCLUDE_FILE directive.
  %endif
%endif

;
; END MyInclude.inc
;


;
; START MyMain.asm
;
%include "MyInclude.inc"

%ifdef HAVE_STDUNI_H
  ;
  ;already defined, so process ONLY the HAVE_STDUNI_H
  ;section.
  ;
  %include "MyInclude.inc"
%endif

;
; END MyMain.asm
;

Am I thinking too far outside the box?

For instance,

%define SECTION_INC STDUNI_H

then a way to %exit that section when finished processing,
and a way to enter that section so that ONLY that one
gets processed (perhaps a %jump into it).

I don't see a %exit directive nor a %jump directive.

Is that perhaps something worthwhile to add. Perhaps
a sample way around it using a macro might be helpful.

Thanks.

-- 
Jim Carlock
North Carolina Swimming Pool Contractors
Custom Designed Swimming Pools
Custom Designed Spas
Custom Designed Water Features
http://www.aquaticcreationsnc.com/




 4 Posts in Topic:
NASM %define %ifdef %include - Converting C to NASM
"Jim Carlock"   2008-05-01 10:26:53 
Re: NASM %define %ifdef %include - Converting C to NASM
Henry <spamtrap@[EMAI  2008-05-01 18:13:06 
Re: NASM %define %ifdef %include - Converting C to NASM
Frank Kotler <spamtra  2008-05-03 19:01:36 
Re: NASM %define %ifdef %include - Converting C to NASM
s_dubrovich <spamtrap@  2008-05-03 20:50:56 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 5:33:58 CDT 2008.