Jump to content
IGNORED

Trs-80 COCO help.....Random Routine help....


GreenDayRlz

Recommended Posts

I`m making a game, and where do I store the #`s to get the random routine to "randomize" them?

 

And wherwe does it put them?

 

I`m doing this for my game, asteroids.

 

 

 

 

After I make this, I`m gona make the tron game...That`ll be kinda boring, but fun.......?(lol)

Edited by GreenDayRlz
Link to comment
Share on other sites

Here's a random routine from when I did a CoCo Infocom Interpreter back in '84. It looks like it returns the random number in X. I probably translated this from Infocom's Z80 random number routine.

 

RNDSEED:FDB	 0,0
. . .
	LDD	 #$FFFF
	STD	 RNDSEED
	STD	 RNDSEED+2
	LDB	 #5
INIT6:  JSR	 RANDOM
	DECB
	BNE	 INIT6
. . .
RANDOM: PSHS	D
	LDB	 #2
RANDOM1:PSHS	B
	LDX	 #RNDSEED
	LDA	 ,X
	SEC
	LDB	 #8
RANDOM2:PSHS	B
	ROLA
	ROLA
	ROLA
	EORA	,X
	ROLA
	ROLA
	LDX	 #RNDSEED
	ROL	 ,X+
	ROL	 ,X+
	ROL	 ,X+
	ROL	 ,X
	PULS	B
	DECB
	BNE	 RANDOM2
	PULS	B
	DECB
	BNE	 RANDOM1
	LDX	 RNDSEED+2
	PULS	D,PC

To randomize, you could just call it at every refresh (especially during title screens), and then user input should give you some randomness.

 

You also might find my debugger useful too. (and here with some comments added to the code)

Link to comment
Share on other sites

I don`t have edtasm...I have something from disk put onto my computer. Special hacked by my dads friend "edition". Custome burned on rom...anyone have non edtasm instructions?

 

 

EDIT:

 

I would like just to use the COCO`s, since it`s pretty random.....I`ve never been able to guess it in basic.....Lol. I`ve spent too much time on basic....I like 6809 beter. It makes it alot easier, except when you put in LBEQ 3200, it says error and you have to just put in beq 3200.....I`ve ruined a couple of re-writes that way...

Edited by GreenDayRlz
Link to comment
Share on other sites

I would like just to use the COCO`s, since it`s pretty random.....I`ve never been able to guess it in basic.....Lol. I`ve spent too much time on basic....I like 6809 beter. MONDEB makes it alot easier, except when you put in LBEQ 3200, it says error and you have to just put in beq 3200.....I`ve ruined a couple of re-writes that way...

Are you talking about calling the BASIC routines from assembly language (it's not quite trivial) or just how to use it in BASIC?

 

If you're just talking about using it from BASIC, I'll have to look up a disassembly to see where the random seed is, but there's nothing like a clock chip that you could use to initialize it.

Link to comment
Share on other sites

We printed off this book called Extended Color Basic Unraveled. I have the code. I could RTS back to basic and do the RND`S there, and jump back into The 6809.....Just a thought.

 

 

I`m doing it in 6809 assembly through mondeb. Lol, so please don`t give me edtasm things.....Edtasm is easier, but I like the from scratch method......But it takes alot of my paper.......

Link to comment
Share on other sites

I`m 99.9% Sure it offers both.

 

 

I`m sorry it took so long for reply, my modem went into retirement.

 

 

I found the RND routine in a book called either Color Basic Unravelled or entended unravveled, same book allmost.

 

The routine starts at B1F1 in a EXTENDED Basic ROM. The seeds are just below it.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...