RPGHacker / asar

(Now) official repository of the SNES assembler Asar, originally created by Alcaro
Other
204 stars 44 forks source link

Declaring Namespaces or Structs without declare a Freecode, org, freespace ,etc before. #181

Closed weierstrass1 closed 3 years ago

weierstrass1 commented 4 years ago

Hey i have the following issue, i declare this:

namespace nested on
base $7F0B44
namespace IAMANameSpace
  label1:
  namespace IAMAnotherNameSpace
    label2:
  namespace off
namespace off

If i dont declare a org or freecode before, it doesn't work properly because for some reason all Addresses change. If i do the following:

pushpc : freecode
namespace nested on
base $7F0B44
namespace IAMANameSpace
  label1:
  namespace IAMAnotherNameSpace
    label2:
  namespace off
namespace off
pullpc

It works but sends a leak warning that doesn't exist because i am patching nothing. This also happends with structs.

mod edit: fixed formatting, please use triple backticks for code blocks

randomdude999 commented 4 years ago

can you please at least try to minify test cases instead of giving me 200 lines of code which uses undefined defines

weierstrass1 commented 4 years ago

can you please at least try to minify test cases instead of giving me 200 lines of code which uses undefined defines

sorry, i fixed it.

Alcaro commented 4 years ago

you fixed it too well, it no longer reproduces any issues. first one assembles to a blank rom without warnings, and second one correctly returns a leak warning

randomdude999 commented 4 years ago

now it's not giving any warnings because you deleted all of the labels i see what you're referring to, there technically isn't any org so the first label sets org and base to $8000. one fix is to use org $7F0B44 instead of base - which will do pretty much exactly what you want here, as trying to write any opcodes there will still be an error.

weierstrass1 commented 4 years ago

~now it's not giving any warnings because you deleted all of the labels~

LMAO, i'll add a label.

i see what you're referring to, there technically isn't any org so the first label sets org and base to $8000. one fix is to use org $7F0B44 instead of base - which will do pretty much exactly what you want here, as trying to write any opcodes there will still be an error.

oh okay, i'll try with that.

randomdude999 commented 3 years ago

i assume using org instead of base is a good enough fix so i'll close this for now