MMBC

relocation

Nov 30th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #macro relocate(new_location)
  2.  #ifdef old_location
  3.    .echo "Error: You cannot nest relocate blocks."
  4.  #else
  5.    #define old_location eval($)
  6.    .org new_location
  7.    #define g_location eval(new_location)
  8.  #endif
  9. #endmacro
  10. #define .relocate relocate(
  11.  
  12. #macro endrelocate()
  13.  #ifdef g_location
  14.    .org $-g_location + old_location
  15.    #undefine g_location
  16.    #undefine old_location
  17.  #else
  18.    .echo "Error : No relocate statements corresponds to this endrelocate."
  19.  #endif
  20. #endmacro
  21. #define .endrelocate endrelocate(
Add Comment
Please, Sign In to add comment