Re: A82: Newbie: How do you get a proggie to quit.


[Prev][Next][Index][Thread]

Re: A82: Newbie: How do you get a proggie to quit.



"Cory Crooks" <badman@velocity.net> writes:
>Hi there, a newbie here, learning ASM for tetris, with a couple
>questions... first for a simple proggie to move around some text when 
>you press one key, and exit out when you press another (MODE I think),
why
>doesn't this code work?

Oy...I'll add some comments.

>
>#include "TI82.H"
>
>.org START_ADDR
>.DB "Hello World v0.0003",0
>
>        ROM_CALL(CLEARLCD)
>        GRAPH_START    ; BTW what does this do???

Okay, I haven't dealt with Ash 3.0 yet, but I'm assuming this sets the
ROM to page 4. See, if you are going to use commands such as Point_On and
Point_Off, you must be in this particular ROM page or it won't work.
(Making your own routine is better because these commands are SLOW, but
anyway...)

>        ld B,$0F
>        ld C,$0F
>        jr keydloop

Okay, you don't need a jump here....the code is read from top to bottom
so keydloop would be executed anyway.

>
>keydloop:
>        ROM_CALL(KEY_HAND)  ; Any faster procedures?

Yes, there is  a faster procedure. Try using port 1! =) Ports and ROM
pages are like the same thing, btw. Then just test register A's bits for
the keypresses...this is also very helpful for multiple keys.

>        cp $03
>        JP Z,makeblockgoover

You shouldn't use a jp when you can use a jr. My suggestion is to use jr
every time you code something and then compile....everywhere you get a
"relative branch exceeded" error, change the jr to jp. This is the best
way to optimize the jumps without knowledge of when you use which one. ;)
(I don't use KEY_HAND so I'm not sure if these are the correct hex codes
for your keys, but let's just assume they are...)

>        cp $37
>        jp Z,doending
>        JR keydloop        
>
>makeblockgoover:
>        inc b
>        inc c
>        ld ($8215),BC
>        ld HL,greets

It's better to use variables (from TEXT_MEM) to store the location of
your message. It MAY not be a problem here, but registers can change and
you won't even realize it. So to be on the safe side, you may want to
declare the values in B and C in TEXT_MEM.

So it would be:
	
	ld A, (x_pos)
	ld (CURSOR_X), A
	ld A, (y_pos)
	ld (CURSOR_Y), A
	ld HL, greets
	ROM_CALL(D_ZM_STR)

CURSOR_X and CURSOR_Y are actually the locations $8215 and $8217 as you
put it, but I think this is easier to understand. CURSOR_X and CURSOR_Y
are also predefined in the ti82.h header file, btw.


>        ROM_CALL(D_ZM_STR)
>        jp keydloop

Again, you don't need a jp here, just a jr.

>
>doending:
>        ret
>
>greets: .db "Hi there",0
>
>.end
>
>
>I think somethings wrond with my jp's and ret's. Any help is greatly
>appreciated. Also, anyone know why there isn't a ticalc newsgroup? Or 
>is there one and my news server doesn't carry it. Anyway, thanx for any 
>help you can give me...
>
>-- Badman
>http://badman.home.ml.org
>Home of: Badman's Funhouse and CRC Software
>badman@velocity.net

There's nothing wrong with your jumps or returns. Yes, there is a ticalc
newsgroup. It's:

<HTML>
<A HREF="news:bit.listserv.calc-ti">TI-8x Newsgroup</A>
</HTML>


Hope I helped. Get back to me if you still have problems.

		-Scoobie





References: