The exit program key, delete key, works immediately however.
I might have to resort to making my own pause and using direct input, if it's not somewhere else in the code.
Does anybody know of any lag problems with _GetKey rom routine on the ti-83+ with mirage OS.
It might be an arrow key lag. Dunno, inlcuded the code in case someone saw something. Most of the code is skeleton, im working on movment first. It works fine, except a lag.
#include "ti83plus.inc";General TI-83 Plus include file
#include "mirage.inc";MirageOS include file
#define pixlen 55;made both divisible by five, evenly
#define pixwidth 90
#define maxinventory 10
#define maxspells 10
#define maxskills 10
#define numweapons 3
#define maxstrlen 10
#define maxobjects 10
#define tilesize 5
#define charwidth 5;the character sprite width when walking;now must match tile size, used a differant method to save mem
#define charhieght 5;the character sprite width when walking;now must match tile size, used a differant method to save mem
.org $9d93;Origin (set back two to account for AsmPrgm)
.db $BB,$6D;Compiled AsmPrgm token
ret;So TIOS wont run the program
.db 1;Identifier as MirageOS program
.db %00000000,%00000000;15x15 button
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db %00000000,%00000000
.db "Nightblade",0;Zero terminated description
;Program code starts here
jp main
Leveldata: .ds ((pixlen/tilesize)*(pixwidth/tilesize));stores leveldata by tile matrix for interaction
;objectdata: .ds (pixlen*pixwidth);stores objectdata by pixel matrix for interaction
inventory: .ds (maxinventory*2);one byte for the item number, one for the amount;inventory list
spelllist: .ds (maxspells*6);an array of 2words and 2 bytes for each spell, location 1.)spellname pointer(word),2.)spellproc pointer(word),3.)spellnum(byte) 4.)spellvl(byte)
skilllist: .ds (maxskills*6);an array of 2words and 2 bytes for each skill, location 1.)skillname pointer(word),2.)skillproc pointe(word)r,3.)skillnum (byte)4.)skilllvl(byte)
charlvl: .db 1;the characters lvl
weapon: .dw 0;pointer to the currently equipped weapon
armor: .dw 0;pointer to the currently equipped armor
acc: .dw 0;pointer to the currently equipped accessory
weaponlist: .ds (numweapons*(6+maxstrlen));weaponlist, position 1.)(byte)weaponnum 2.)(byte)damage 3.)(byte)effect 4.) (maxstrlen bytes+1)nameand null terminator
armorlist: .ds (numweapons*(6+maxstrlen));armorlist, position 1.)(byte)armornum 2.)(byte)save 3.)(byte)effect 4.)(maxstrlen bytes+1)nameand null terminator
cha: .db 2
str: .db 2
dex: .db 2
agi: .db 2
hp: .db 20
mp: .db 5
wis: .db 2
int: .db 2
worldpos: .ds 3;1.)x 2.)y 3.)z
lvly: .db 5;matrix location
lvlx: .db 5;matrix location
lvlnum: .db 0
lvltype: .db 0
dynamicobjectlist: .ds (4*maxobjects);objects that can be taken or destroyed in the levelmap 1.)(byte)upper left corner x value 2.)(byte)upper left corner y value3.)(byte) lvlnum 4.)(byte)objectnum; a 0 in objectnum place indicates empty space
mode: .db 0;0=normal,1=battle,2=message,3=storymode,4=shop;may not need this, let's see
generalbyte: .db 0;for any use
generalbyte2: .db 0;for any use
generalword: .dw 0;for any use
main:
call loadweapons
call loadarmor
ld a,10
ld (lvlx),a
ld (lvly),a
ld a,8
call setupint
loop1:
call localredraw
bcall(_GrBufCpy)
call inputhandler
call randbattle
jr loop1
inputhandler:
push AF
push BC
push DE
push HL
bcall(_RunIndicOff)
bcall(_GetKey)
;call directin
cp kDel
jr Z,quitpo
cp kLeft
jr Z,hitit
cp kUp
jr Z,hitit
cp kRight
jr Z,hitit
cp kDown
jr NZ,notarrow
hitit:
;<-24
;up25
;->26
;down 34
call Movement
jr endit
quitpo:
call quittoshell
notarrow:
;handle other input
endit:
pop HL
pop DE
pop BC
pop AF
RET
Movement:;key in accumilator
;if borders touch non-zero, take appropriate action
LD L,A
LD A,0
LD (generalbyte), A;boolean
LD A,L
cp kLeft
jr Z,moveleft
cp kUp
jp Z,moveup
cp kRight
jp Z,moveright
cp kDown
jr Z,movedown
moveleft:
cont:
LD A,(lvly)
LD H,A
LD E, pixwidth/tilesize
call multhe
LD B, H
LD C, L
LD A,(lvlx)
DEC A
LD E,A
LD D,0
ADD HL,DE
LD D, H
LD E, L
LD HL,leveldata
ADD HL,DE
LD D, H
LD E, L
LD A,(DE)
cp 0
jr NZ,trueval
falseval:
jr mclear1
trueval: LD (generalbyte), A
jp doneit2
mclear1:
LD A,(lvlx)
cp 0
jr Z,sm1
DEC A
LD (lvlx),A
sm1:
jp doneit
movedown:
cont2:
LD A,(lvly)
INC A
LD H,A
LD E, pixwidth/tilesize
call multhe
LD B, H
LD C, L
LD A,(lvlx)
LD E,A
LD D,0
ADD HL,DE
LD D, H
LD E, L
LD HL,leveldata
ADD HL,DE
LD D, H
LD E, L
LD A,(DE)
cp 0
jr NZ,trueval2
falseval2:
jr mclear2
trueval2: LD (generalbyte), A
jp doneit2
mclear2:
LD A,(lvly)
cp pixlen/tilesize
jr Z,sm2
INC A
LD (lvly),A
sm2:
jp doneit
moveright:
cont3:
LD A,(lvly)
LD H,A
LD E, pixwidth/tilesize
call multhe
LD B, H
LD C, L
LD A,(lvlx)
INC A
LD E,A
LD D,0
ADD HL,DE
LD D, H
LD E, L
LD HL,leveldata
ADD HL,DE
LD D, H
LD E, L
LD A,(DE)
cp 0
jr NZ,trueval3
falseval3:
jr mclear3
trueval3: LD (generalbyte), A
jr doneit2
mclear3:
LD A,(lvlx)
cp pixwidth/tilesize
jr Z,sm3
INC A
LD (lvlx),A
sm3:
jr doneit
moveup:
cont4:
LD A,(lvly)
DEC A
LD H,A
LD E, pixwidth/tilesize
call multhe
LD B, H
LD C, L
LD A,(lvlx)
LD E,A
LD D,0
ADD HL,DE
LD D, H
LD E, L
LD HL,leveldata
ADD HL,DE
LD D, H
LD E, L
LD A,(DE)
cp 0
jr NZ,trueval4
falseval4:
jr mclear4
trueval4: LD (generalbyte), A
jr doneit2
mclear4:
LD A,(lvly)
cp 0
jr Z,sm4
DEC A
LD (lvly),A
sm4:
jr doneit
doneit2:
doneit:
ret
redraw
;process object matrix
call drawobject
ret
levelload:
ret
drawobject:;pass obj type and x,y position of upper left corner
;getsize
;drawsizew in leveldata
;drawobj
ret
localredraw:;pass x,y pos
;redraw immediate vicinity
;-----------box char for testing
ld A,(lvlx)
ld h,a
ld e,tilesize
call multhe
ld a,l
ld (generalbyte),a
ld A,(lvly)
ld h,a
ld e,tilesize
call multhe
ld a,l
ld (generalbyte2),a
ld A,(generalbyte)
ld h,a
ld A,(generalbyte2)
ld l,a
ld A,h
Add a,charwidth
ld d,a
ld e,l
call fastlineb
ld A,(generalbyte)
ld h,a
ld A,(generalbyte2)
add a, charhieght
ld l,a
ld A,(generalbyte)
Add a,charwidth
ld d,a
ld e,l
call fastlineb
ld A,(generalbyte)
ld h,a
ld A,(generalbyte2)
ld l,a
ld d,h
ld A,(generalbyte2)
add a, charhieght
ld e,a
call fastlineb
ld A,(generalbyte)
add a,charwidth
ld h,a
ld A,(generalbyte2)
ld l,a
ld d,h
ld A,(generalbyte2)
add a, charhieght
ld e,a
call fastlineb
;-----------box char for testing
ret
msgbox:;pass message
;draw reectangle, fill inside white
;draw inner rectangle 5 pixel smaller
;g1
;display text till box full
;wait keypress
;if more goto g1
ret
loadweapons:
ret
loadarmor:
ret
randbattle
ret
.end

