[TI ASM] Drawing "G" that movesby movement keys...
Moderator: MaxCoderz Staff
- Shadow Phoenix
- Calc Guru
- Posts: 835
- Joined: Mon 03 Jan, 2005 7:54 pm
- Location: out there. seriosly.
- 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:
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
- Shadow Phoenix
- Calc Guru
- Posts: 835
- Joined: Mon 03 Jan, 2005 7:54 pm
- Location: out there. seriosly.
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
3. Is the easiest: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
Code: Select all
waitEnterKey:
BCALL(_getCSC)
cp skEnter
jr nz, waitEnterKey
http://education.ti.com/downloads/pdf/u ... pguide.pdf
http://education.ti.com/downloads/pdf/u ... utines.pdf
Those files are invaluable!
- Shadow Phoenix
- Calc Guru
- Posts: 835
- Joined: Mon 03 Jan, 2005 7:54 pm
- Location: out there. seriosly.
-
- New Member
- Posts: 65
- Joined: Sun 03 Apr, 2005 7:55 pm
- Location: The seventh circle of Hell.
- Contact:
@ 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.
http://www.xanga.com/jakku_kun, rants by me.
- 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:
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:
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
-
- New Member
- Posts: 65
- Joined: Sun 03 Apr, 2005 7:55 pm
- Location: The seventh circle of Hell.
- Contact:
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.
http://www.xanga.com/jakku_kun, rants by me.
-
- New Member
- Posts: 65
- Joined: Sun 03 Apr, 2005 7:55 pm
- Location: The seventh circle of Hell.
- Contact:
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.
http://www.xanga.com/jakku_kun, rants by me.