Jump to content
IGNORED

[SOLVED] MADS Assembler Gives an Error When I Try to Use Data from Previously Created Label


Recommended Posts

Hi there!

I am really unsure what I am doing wrong here, I might just be dumb, so I apologise for asking something I should have known already! Hahaha :D

 

I'm trying to construct a block of data using all sort of parameters, which require a bit of calculations at assembly time.

So far pretty much everything has been working just fine, but I've been stuck at 1 specific spot.

 

No matter how I try to syntax it, MADS would always give me this error:

elen	dta tlen + (ENV_OFFSET * (ENV_LENGTH - 1)) + 1 	; $B9 is expected 
RMT Instrument Deconstruction.txt (58) ERROR: Value out of range (17836 must be between 0 and 255)

 

Here's the part in question where it all happens: 

tlen	dta PAR_NUM + TBL_LENGTH - 1			; $2B is expected 
tgo	dta PAR_NUM + TBL_GOTO 				; $0C is expected 
elen	dta tlen + (ENV_OFFSET * (ENV_LENGTH - 1)) + 1 	; $B9 is expected

 

The numbers in the comments are what I expect to get, and they are all good until the elen line, the moment the error occurs. 

Does anyone know why this happens?

 

---

 

[EDIT] Wait! I think I found what is happening now!

 

Exactly when I finished writing this thread post, I identified the culprit that caused the error: tlen 

That is a bit annoying now, because I specifically need to use tlen in the calculation, due to being a variable, and not a constant! 
To make sure I wasn't just being stupid, I tried to replace tlen directly with $2B on the elen line, and everything worked perfectly this time, so I know the calculation should be correct...

 

Anyway, now that I've written so much more than I intended, I figured I could use some more time to test a few things.

 

When the error occurs, I also seem to get a value of $AC, which is obviously incorrect:

image.thumb.png.d43f19e78cdfd945e03dce04331b4181.png

 

But if I used the value of $2B directly instead, everything is correct this time:

image.thumb.png.5dcafd2e4ecd981583f30e9b5c775dda.png

 

I also need to use that same value on the ego line below, but I commented it out for now since it's pretty much the same error that is occurring.

I'm stuck on this line for like 1 hour now, I've thoroughly read the MADS-ASSEMBLER manual, and I really couldn't find any solution. 😰

 

I have guessed maybe it tried to use the memory address directly, but I could not see why this would happen, since everything else worked just fine.

Still, I couldn't find how to actually type it, I tried stuff like ?tlen #tlen $tlen :tlen, etc, and nothing seems to work, and I'm out of ideas.

It's either a syntax error, or the same out of range error, nothing that would just use the value living at the tlen label.

 

Does anyone know what I am doing wrong?

I'm getting frustrated at this point lol 

Edited by VinsCool
Problem solved, see replies
Link to comment
Share on other sites

2 minutes ago, shanti77 said:

"tlen" is an address in memory, which is 16 bits, unless you put it on side zero.

Try:

 

tlen=PAR_NUM + TBL_LENGTH - 1

 

or

tlen	equ PAR_NUM + TBL_LENGTH - 1

 

Thanks, I also found a solution just a moment ago, great timing!

I really was an idiot after all :D 

 

I simply made sure to get these calculations done elsewhere, the resulting values were then used directly as the data: 

;* Instrument Offsets 

PTR_TLEN	= PAR_NUM + TBL_LENGTH - 1 
PTR_TGO		= PAR_NUM + TBL_GOTO 
PTR_ELEN	= PTR_TLEN + (ENV_OFFSET * (ENV_LENGTH - 1)) + 1 
PTR_EGO		= PTR_TLEN + ENV_GOTO + 1 

;-----------------

 

And that's it!

That's what I should have done in the first place to avoid this problem!

 

Now, it's all good and dandy with the assembled data, so I can continue working on my dumb project :) 

image.thumb.png.208f4a497dc1c6cad06a69d0fd5a6312.png


Thanks for your suggestion anyway!

I am pretty sure it would have worked as well 😅

 

To anyone reading this thread: Problem solved, sorry for the inconvenience!

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...