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
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 07 Jun 2003 11:20:54 am    Post subject:

Hi !
(That's a good forum, but the other wasn't bad).
But let's talk about random numbers : Here is the code code that I use to generate a random entire number between 1 and 30 :


Code:
   B_CALL(_OP1set0)  ; all set to 0
   B_CALL(_OP2set0)  ;
   B_CALL(_Random)     ; OP1 is between 0 and 1
   ld   hl, 29     ; I want sth between 0 and 29 first
   B_CALL(_setxxxxop2)  ; and I put 29 in OP2
   B_CALL(_fpmult)     ; then OP1 = OP1 * OP2
   ld   d, 0     ; I want 0 decimals
   B_CALL(_round)     ; 0 <= OP1 <= 29
   B_CALL(_convOP1)  ; I put OP1 into A
   inc   a     ; and then, 1 <= A <= 30


Wasn't it the right way to generate my random number ? It does not seem because every time I launch my program, the numbers are the same. I also used _RandomInit but it didn't seem to do something better...

Do you know how to generate a integer random number between 1 and 30 for exemple ? Without using your long own routines, if possible !
Thx
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 07 Jun 2003 12:57:19 pm    Post subject:

if i were u, id go to education.ti.com and find the ti83plus rom call guide... it might help with the inputs and outputs of _randomint and _random
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 07 Jun 2003 01:53:34 pm    Post subject:

I didn't find it (how bad is this site !!!!!!!!!!!!!!!!!)
nevermind
Back to top
Job the GameQuitter


Member


Joined: 04 Jun 2003
Posts: 102

Posted: 07 Jun 2003 06:42:02 pm    Post subject:

Yeah, education.ti really has a terrible structure Laughing. The first time I went there I spent hours trying to find the SDK. And if you send them an email with a question about the hardware (the ports, to be exact), they reply with "sorry, we don't have any documentation on this subject" (actual quote). What? Neutral You designed the friggin' calculator, you !$% Mad .

Anyway, I guess your "nevermind" implies that you've already found what you were looking form
Back to top
62 52 53 53
Formerly known as 62 52 53 53


Active Member


Joined: 30 May 2003
Posts: 607

Posted: 07 Jun 2003 08:20:27 pm    Post subject:

What can you expect form TI-doesen't care? Something usefull. Come on, it's in the name: they don't care.
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 07 Jun 2003 08:23:00 pm    Post subject:

"TI-cares", really, if they cared, then u wouldn't get an automated response to e-mails 1 week after requesting, then a real response 2 weeks after! u'd get a real response the next day (or before!), and it would answer ur question! they don't even do that!
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 08 Jun 2003 02:49:30 am    Post subject:

TI really does care, but they only care about making money.

In other words, why answer your questions when you have already bought the calculator.

Finally, why not use the r register to generate a psudo random int.

Your method may not be much faster than the basic method.
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 08 Jun 2003 10:29:30 am    Post subject:

That was also me. I didn't log in Razz And now, I've got my Dilbert avatar again Wink
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 08 Jun 2003 02:56:02 pm    Post subject:

The method is simple sort of.

ld a,r ;r is the refresh register and we do not know what its value is

A contains a random number between 0 and 255
Back to top
John Barrus


Member


Joined: 25 May 2003
Posts: 131

Posted: 09 Jun 2003 12:14:18 am    Post subject:

I would just use the Ion routine that's already provided (Assuming you are programming for Ion). It's really easy to use and the output isn't tough to work with. If you aren't programming for Ion... wow, that's too hard for my brain to comprehend.
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 09 Jun 2003 01:04:53 am    Post subject:

If you're not programming in Ion you can get the routine from someone and paste it into your code. You will have to add this into the variable data of your program though.

Randdata:
.db $00,$00
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 09 Jun 2003 01:06:11 pm    Post subject:

ya, download the ion source, open ionlibs.asm or something like that, and copy the ionrandom routine! (adding the data var of course!)
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 09 Jun 2003 02:03:24 pm    Post subject:

OK, I will download it, thank you.
And if I use the method with the R register, I have to use a mask with bit operators (or, and etc.) to select the bounds of my random number, haven't I ?
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 10 Jun 2003 09:00:34 am    Post subject:

Thank you very much guys, it works perfectly, without having to install ION shell !
You're the bests !
thx Cool
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 10 Jun 2003 01:50:11 pm    Post subject:

No problem; we are here to help.
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