Author Topic: C to masm  (Read 4630 times)

digelo

  • Regular Member
  • *
  • Posts: 24
  • I HATE C!!!
C to masm
« on: July 22, 2012, 11:27:58 PM »
hi
How can i define this in masm32 ?
Code: [Select]
#define E_HANDLER( number ) \
__declspec( naked ) void interrupt_##number( void ) \
{ \
...
}
 

qWord

  • Member
  • *****
  • Posts: 1475
  • The base type of a type is the type itself
    • SmplMath macros
Re: C to masm
« Reply #1 on: July 22, 2012, 11:41:16 PM »
Code: [Select]
E_HANDLER macro number

OPTION PROLOGUE:none
OPTION EPILOGUE:none

interrupt_&number& proc
;...
interrupt_&number& endp

OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef

; uncomment as needed
; EXITM <OFFSET interrupt_&number&> ; <- function-like macro that return the handler address
; EXITM <> ; <- function-like macro, returns nothing
endm
MREAL macros - when you need floating point arithmetic while assembling!

jj2007

  • Member
  • *****
  • Posts: 13957
  • Assembly is fun ;-)
    • MasmBasic
Re: C to masm
« Reply #2 on: July 23, 2012, 03:13:06 AM »
Will work in most cases but beware of inserting that macro in the middle of nowhere...

Code: [Select]
any MACRO args
   jmp endofany
   anyP proc args
  ..
  ret
  anyP endp
endofany: