[TI ASM] Drawing "G" that movesby movement keys...

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

well unless your going to do some clipping. which i guess your gonna go to the end of screen. just do a check to see where it is like
ld a,(xpos)
or a ; checks if its zero
jr z,keyloop ; if it was 0 it goes back to loop and will not decrease

make sense?
User avatar
Shadow Phoenix
Calc Guru
Posts: 835
Joined: Mon 03 Jan, 2005 7:54 pm
Location: out there. seriosly.

Post by Shadow Phoenix »

i wanna get my programm running normally before im gonna start the "off screen checker".
anyway IN MY PROGRAM he doesnt move DOWN ONLY right. WHY?
Life is getting better.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Code: Select all

.nolist 
    #include    "ti83plus.inc" 
.list 
.org    $9D93 
.db    t2ByteTok, tAsmCmp 

Init: 
    b_call(_RunIndicOff) 
    ld a,20 
    ld (x_pos),a 
    ld (y_pos),a 

    jr Display            ; Display first 'v' 

KeyLoop: 
    b_call(_GetCSC) 
    cp skClear             ; If the CLEAR key was pressed. 
    jr Z,CLEAR 
    cp skUp                ; If the up arrow key was pressed. 
    jr z,Decrease 
    cp skDown              ; If the down arrow key was pressed. 
    jr z,Increase 
    cp skLeft 
    jr z,Left 
    cp skRight  
    jr z,Right 
    jr KeyLoop             ; If any other key was pressed, or none, redo _GetCSC. 

Clear: 
    b_call(_ClrLCDFull) 
    ret 

Increase: 
    ld a,(y_pos) 
    cp 58               ; Check if at bottom 
    jr z,KeyLoop            ; If so then dont draw 
    inc a 
    ld (y_pos),a 
    jr Display 

Decrease: 
    ld a,(y_pos) 
    or a               ; Check if at top 
    jp z,KeyLoop            ; If so then dont draw 
    dec a 
    ld (y_pos),a 
    jr Display 

Left: 
    ld a,(x_pos) 
    or a               ; Check if at left 
    jr z,KeyLoop            ; If so then dont draw 
    dec a 
    ld (x_pos),a 
    jr Display 

Right: 
    ld a,(x_pos) 
    cp 91               ; Check if at right 
    jr z,KeyLoop            ; If so then dont draw 
    inc a 
    ld (x_pos),a 
    jr Display 

Display: 
    b_call(_ClrLCDFull) 
    ld a,(x_pos) 
    ld (pencol),a 
    ld a,(y_pos) 
    ld (penrow),a 
    ld a,'v' 
    b_call(_vPutMap) 
    jr KeyLoop 

x_pos: 
   .db 0 
y_pos: 
   .db 0 

.end 
.END
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

thanks pat thats what i was going at i just didnt want to type all that hehe im doing english paper right now anyway :P
User avatar
Shadow Phoenix
Calc Guru
Posts: 835
Joined: Mon 03 Jan, 2005 7:54 pm
Location: out there. seriosly.

Post by Shadow Phoenix »

THANKS!!!!!!
so now i know its cur and not pen :(
now its easier!!! GO ASM!!!
Life is getting better.
Guest

Post by Guest »

ok, now i really understand the program :)
but i still have just 3 more questions:
what is the BCALL for
1. plotting points.
2. drawing picture on the screen.
3. waiting for enter press and then continue(Pause) but not getkey
User avatar
benryves
Maxcoderz Staff
Posts: 3089
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Anonymous wrote:ok, now i really understand the program :)
but i still have just 3 more questions:
what is the BCALL for
1. plotting points.
2. drawing picture on the screen.
3. waiting for enter press and then continue(Pause) but not getkey
3. Is the easiest:

Code: Select all

waitEnterKey:
 BCALL(_getCSC)
 cp skEnter
 jr nz, waitEnterKey
As for the others:
http://education.ti.com/downloads/pdf/u ... pguide.pdf
http://education.ti.com/downloads/pdf/u ... utines.pdf

Those files are invaluable!
User avatar
Shadow Phoenix
Calc Guru
Posts: 835
Joined: Mon 03 Jan, 2005 7:54 pm
Location: out there. seriosly.

Post by Shadow Phoenix »

ooooooooooooh, stupid me!
i tryed to use getkey so it WAITS for a keypress but if i use that instead..it should work.. THANKs!
how come i didnt think of that :)
Life is getting better.
That_One_Guy
New Member
Posts: 65
Joined: Sun 03 Apr, 2005 7:55 pm
Location: The seventh circle of Hell.
Contact:

Post by That_One_Guy »

@ tr1p: Hey, i used your code there, and its just what i've been needing. I think you saw my post? "moving a bit of text around on screen"? One question though: How do you do sprites?
Truly great madness cannot be achieved without significant intelligence.

http://www.xanga.com/jakku_kun, rants by me.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Well i just fixed up Shadow Phoenix's code. I wouldnt recommend jumping around all over the place ... Rather call Display in a main loop then check for key presses etc.

For a sprite i recommend making your program ion compatible and using the shell routine ionputsprite like this:

Code: Select all

.nolist			
#include "ion.inc"
#include "keys.inc"
.list

#ifdef TI83P
        .org    progstart-2
        .db     $BB,$6D
#else
        .org    progstart
#endif
        ret				
        jr      nc,begin

        .db     "Basic Sprite Movement",0	
begin:
	ld a,44
	ld (SprX),a
	ld a,28
	ld (SprY),a					; Start sprite at centre-screen
Main:
	bcall(_GrBufClr)				; Clear the Graph-Buffer
	call DrawSprite				; Draw the sprite at the current position
	call IonFastCopy				; Copy Graph-Buffer to the screen
KeyLoop:
	ld a,Group2					; Direct Input ... Group 2 has 'Clear' key in it
	out (1), a
	in a,(1)
	cp KClear
	jr z,Quit
	ld a,Group1					; Direct Input ... Group 1 has the 'Arrow' keys in it
	out (1), a
	in a,(1)
	cp KUp
	jr z,Up
	cp KDown
	jr z,Down
	cp KLeft
	jr z,Left
	cp KRight
	jr z,Right
	jr KeyLoop					; Loop back if no key is pressed

Up:
	ld a,(SprY)
	or a						; Check if sprite is at top
	jr z,Main
	dec a						; If it isnt at the top then decrease Y
	ld (SprY),a
	jr Main					; Jump back to Main so we can redraw
Down:
	ld a,(SprY)
	cp 56						; Check if sprite is at bottom
	jr z,Main
	inc a						; If it isnt at the bottom then increase Y
	ld (SprY),a
	jr Main					; Jump back to Main so we can redraw
Left:
	ld a,(SprX)
	or a						; Check if sprite is at left edge
	jr z,Main
	dec a						; If it isnt at the left edge then decrease X
	ld (SprX),a
	jr Main					; Jump back to Main so we can redraw
Right:
	ld a,(SprX)
	cp 88						; Check if sprite is at right edge
	jr z,Main
	inc a						; If it isnt at the right edge then increase X
	ld (SprX),a
	jr Main					; Jump back to Main so we can redraw

DrawSprite:
	ld a,(SprY)
	ld l,a
	ld a,(SprX)
	ld ix,Sprite
	ld b,8
	call ionPutSprite				; Draw the sprite
	ret

Quit:
	bcall(_GrBufClr)
	call ionFastCopy
	ret

SprX:
	.db 0
SprY:
	.db 0

Sprite:
	.db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF

.end
END
 
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
That_One_Guy
New Member
Posts: 65
Joined: Sun 03 Apr, 2005 7:55 pm
Location: The seventh circle of Hell.
Contact:

Post by That_One_Guy »

Thats all well and good for Ion, but how about a NOSTUB program?
Truly great madness cannot be achieved without significant intelligence.

http://www.xanga.com/jakku_kun, rants by me.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Well all you do is change the header and include the ion sprite routine in your source (as well as crediting Joe Wingbermuehle :))
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Spencer
Extreme Poster
Posts: 346
Joined: Mon 17 Jan, 2005 8:56 am
Location: Indiana

Post by Spencer »

Nonsense, write your own sprite- and background-layer masked 16xH clipping sprite routine. Make sure to use EVERY register. Shadows and indexers included. :wink:

Edit: Speaking of which, anyone feel like trying to optimize such a routine?
That_One_Guy
New Member
Posts: 65
Joined: Sun 03 Apr, 2005 7:55 pm
Location: The seventh circle of Hell.
Contact:

Post by That_One_Guy »

Emm...sure...one could do that, but emm...what if one doesnt now dick-all about assembly? It'd be a bit of a problem, eh?
Truly great madness cannot be achieved without significant intelligence.

http://www.xanga.com/jakku_kun, rants by me.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Im not sure if spencer was joking, being sarcastic or serious.

I certainly dont expect you to be able to write a sprite routine when you dont know anything about ASM or the internals of the calcs memory layout etc.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
Post Reply