This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 11 Nov 2008 10:13:29 am    Post subject:

How do I paste a register or flag value to the Ans variable? I use _StoAns, but you need to convert the reg/flag to Op1. How do you do that?
Back to top
adje


Newbie


Joined: 24 Dec 2007
Posts: 24

Posted: 11 Nov 2008 10:45:58 am    Post subject:

day 18 of asm28days. floating point arithmetic.

b_call(_move9toOP1)
moves 9 bytes to OP1. data starts at (HL)

you could also use RST 20h. but i dont know in which mode you should be or how the different calculators (TI84+ or TI83+) can react. (?)

i take it that you just want Ans to be a Real-variable.
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 11 Nov 2008 10:56:45 am    Post subject:

if i recall correctly, there is a bcall(_SETOPXXXX) that copies HL to OP1

edit: http://www.unitedti.org/index.php?showtopic=8283


Last edited by Guest on 11 Nov 2008 11:04:06 am; edited 1 time in total
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 11 Nov 2008 12:53:33 pm    Post subject:

_mov9ToOP1/rst 20h moves the 9 bytes pointed to by HL to OP1. It doesn't put a floating-point value there unless HL is also pointing to a floating-point value, which it won't be if the value you want to convert is in HL.

So _SetXXXXOP2 and _OP2ToOP1 is what you want for HL, and _SetXXOP1 for A.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 11 Nov 2008 12:55:31 pm    Post subject:

If the value you want is definitely under 100, then put it in A and do bcall _SetXXOP1 followed by bcall _StoAns. If it could be higher (up to 65535), put it in HL and do bcall _SetXXXXOP2, bcall _OP2ToOP1, then bcall _StoAns.

Last edited by Guest on 22 Jul 2010 12:02:52 pm; edited 1 time in total
Back to top
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 12 Nov 2008 12:33:26 pm    Post subject:

And for flags?

ld a,f didn't work with tasm on calc, but I'll try it with the normal tasm.
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 12 Nov 2008 12:37:59 pm    Post subject:

you cant use F for anny inscruction except EX af,af' and some undocumented port command... ( OUT ©,F i think)
Back to top
brandonw


Advanced Member


Joined: 12 Jan 2007
Posts: 455

Posted: 12 Nov 2008 01:39:47 pm    Post subject:

If you want the value of the flags register, you can use the stack, like: push af \ pop hl \ ld a,l
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 12 Nov 2008 07:32:41 pm    Post subject:

There's an undocumented instruction that some people call "IN F,(C​)". This is a rather deceptive name; the instruction doesn't store the input value in F, or anywhere else. Instead it just reads a byte and discards it, but it sets the flags in the same way IN A,(C​) would.

The only way to get the value of F is PUSH AF; the only way to set it directly is POP AF.

Edit: © ? Come on, people. :hmpf:


Last edited by Guest on 12 Nov 2008 07:37:43 pm; edited 1 time in total
Back to top
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 13 Nov 2008 11:58:19 am    Post subject:

thanks!!
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement