VinsCool Posted October 17, 2022 Share Posted October 17, 2022 (edited) 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 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: But if I used the value of $2B directly instead, everything is correct this time: 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 October 17, 2022 by VinsCool Problem solved, see replies Quote Link to comment Share on other sites More sharing options...
shanti77 Posted October 17, 2022 Share Posted October 17, 2022 "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 1 Quote Link to comment Share on other sites More sharing options...
VinsCool Posted October 17, 2022 Author Share Posted October 17, 2022 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 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 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! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.