I'm still working on this program to check the batteries of my calculator, and I stored the battery level in a variable. I want to make it print out "The battery lvl is " + variable. I've Googled this and looked through z80 heaven and other sources and I still cannot find any information on how to do this.
Sorry if this is a dumb beginner question, but I genuinely cannot figure this out.
Thanks! ^^;

Edit: This is for z80 and not ez80
So is it in z80 then?
TimmyTurner62 wrote:
So is it in z80 then?


Yes, as you would have notice if you had seen the subforum it was posted in Wink
I'm still learning myself, so I may very well be mistaken, but it seems that there isn't any rom call for displaying a decimal number (I'm assuming that's what you want) so I imagine you have to generate a string yourself and _PutS.

Depending on whether or not the variable you have is already binary coded decimal or not, you will have to convert it to such, and then you can probably add whatever the binary value of the character '0' is to each digit. I'm not sure how to do that in assembly yet, but I'll be learning to soon I imagine.
_SetXXOP1
_DispOP1A
It's not a decimal number, it's an integer x-x
how do you make it a string?
I just told you.
Given that the value of a battery level will be between 0-100, something like this might work:


Code:

 ld hl, string
 bcall(_PutS)
 ; Do something to put our variable in hl
 bcall(_DispHL)

string:
 .db "The battery lvl is ", 0


(from http://tutorials.eeems.ca/ASMin28Days/lesson/day11.html#num)
MateoConLechuga wrote:
I just told you.
Sorry, the page must not have refreshed when I responded, I didn't see your reply. My bad ^^;
  
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