Good morning and [hopefully!] quick question,

I have been working on making some routines in hexadecimal assembly on-calc to speed up some BASIC programs, thus far been executing the ASM programs as is typical. My question is, is there any way to exchange actual information? Do the variables A through Z (and θ) all have memory addresses which an assembly program could possibly access?

I would imagine they would need to have a fixed address, if so, what would that address be?

a simplistic pseudo-code; 1 is passed into variable A, where the assembly program loads it into HL, increments HL, and puts HL back into A. A is then displayed (hopefully a two) from the basic program


Code:

PROGRAM A
1 -> A
EXEC asmPrgm(B
Disp A

PROGRAM B
AsmPrgm
2A [MEMORY ADDRESS OF VARIABLE A]
34
22 [MEMORY ADDRESS OF VARIABLE A]
(Maybe a C9 here??)


Is such a thing possible? If so how is this done?

Thanks,
Blackhawk
Quote:
My question is, is there any way to exchange actual information? Do the variables A through Z (and θ) all have memory addresses which an assembly program could possibly access?
Yes.
Quote:
I would imagine they would need to have a fixed address, if so, what would that address be?
No.

I'm not going to indulge the "hexadecimal" thing, because I've written many a rant against directly coding in hexadecimal instead of just writing assembly programs that are more readable and easier to maintain, so I'll show you how to do this in proper assembly:

Code:
   ld hl,VarX
   rst 20h
   rst 10h
   ret c
   ex de,hl
   rst 20h
   bcall(_ConvOp1)
   // do something with register de
   ret
VarX:
   .db RealObj,'X',$00,$00
So, let's go through this:
1) ld hl,VarX \ rst 20h copies up to 9 bytes to Op1. Those 9 bytes are the identifier for variable X.
2) rst 10h is equivalent to calling FindSym, which looks for that variable in the calculator's memory. ret c returns if the carry flag is set, which indicates that the variable wasn't found. If it existed, then the carry flag is reset (ie, nc).
3) ex de,hl \ rst 20h copies the 9 bytes of the variable's value from its memory location into Op1
4) bcall(_ConvOp1) converts the 9-byte floating-point number in Op1 into a 16-bit value in de. This is much easier to manipulate in your ASM programs.
Nevermind, I figured it out through Ans

Code:

PROGRAM A
1 -> A
Asm(PrgmB
Disp Ans



Code:
PROGRAM B
AsmPrgm
EFD74A     //RclAns
EFEF4A     //ConvOp1
EB23        //Ex DE,HL    Inc Hl
EF9247    //SetXXXXOp2
EF5641    //Op2ToOp1
EFBF4A    //StoAns
C9


These together output "2"
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement