This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 23 Oct 2003 04:50:19 pm    Post subject:

Ok, more help is what I need. This program I am making basically is a launcher for my formula bank programs that are written in BASIC. I have a keyhook routine at the bottom that will return the user to the asm program if they hit 2nd->quit in the BASIC one. It returns to the ASM prog just fine, but when it reaches the "call run" routine, it doesnt execute the parseinp. ???

Here is the code:


Code:
;Standard template for ti83+ asm programs
#include "ti83plus.inc";File needed to access system routines
.org userMem-2   ;Define where to start in memory
.db $BB,$6D   ;AsmPrgm instruction
Prog_executing  equ  1; Equates.

;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;\/\/\/\/\/\/\/\/\/\/\/\;;
;; FORMULA BANK LAUNCHER;;
;;/\/\/\/\/\/\/\/\/\/\/\/;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;


start:
   ld a,0
   ld (progrun),a
   call ADDkey
   call drawint
   jp menu
   ret

drawint:
   set TextEraseBelow,(IY + TextFlags)
   set TextInverse,(IY + TextFlags)
   set fullScrnDraw, (IY + apiFlg4)
   res IndicRun,(IY + IndicFlags)
   bcall(_clrlcdfull)
   bcall(_grbufclr)
   ld H,0
   ld L,0
   ld d,63
   ld e,95
   bcall(_DrawRectBorder)
   ld b,0
   ld c,8
   ld d,95
   ld e,8
   bcall(_DarkLine)
   ld b,87
   ld c,8
   ld d,87
   ld e,0
   bcall(_DarkLine)
   ld b,0
   ld c,56
   ld d,95
   ld e,56
   bcall(_Darkline)

   ld a,1
   ld (pencol),a
   ld a,0
   ld (penrow),a
   ld hl,view
   bcall(_vputs)
   ld a,65
   ld (pencol),a
   ld a,0
   ld (penrow),a
   ld hl,view2
   bcall(_vputs)
   ld a,80
   ld (pencol),a
   ld a,0
   ld (penrow),a
   ld hl,view3
   bcall(_vputs)
   
   res TextInverse,(IY + TextFlags)
   res TextEraseBelow,(IY + TextFlags)

   ld a,2
   ld (pencol),a
   ld a,56
   ld (penrow),a
   ld hl,optstxt
   bcall(_vputs)
   ld a,90
   ld (pencol),a
   ld hl,xtxt
   bcall(_vputs)

   ld a,10
   ld (pencol),a
   ld a,10
   ld (penrow),a
   ld hl,algtxt
   bcall(_vputs)
   ld a,10
   ld (pencol),a
   ld a,20
   ld (penrow),a
   ld hl,geotxt
   bcall(_vputs)
   ld a,10
   ld (pencol),a
   ld a,30
   ld (penrow),a
   ld hl,grftxt
   bcall(_vputs)

   ret

menu:
   bcall(_getkey)
   cp k1
   jp z,algrun
   jp menu

algrun:
   ld a,0
   ld (progrun),a
   ld hl,algebra
   bcall(_Mov9ToOP1)
   call unarc
   ld hl,algebra
   bcall(_Mov9ToOP1)
   call unhide
   ld hl,algprog
   bcall(_Mov9ToOP1)
   call run
   ld a,0
   ld (progrun),a
   bjump(_JforceCmdNoChar)
   ret
   

unarc:
   bcall(_chkFindSym)
   jp c,done
   ld a,b
   cp 0
   jp z,done
   bcall(_arc_unarc)
   ret

unhide:
   bcall(_ChkFindSym)  
   jp c, Done
;HL points to type byte in VAT entry so change it to AppVar.
   ld (hl), ProgObj
   ret   
   
run:
   ld a,1
   ld (progrun),a
;set both of these flags before running the program
   set prog_executing,(iy+newdispf)
   
;next the error handler
   errhandon(basicErrHandler)

;Run it
   bcall(_parseinp)
   
;After execution, reset error handler and accumulator
   errhandoff()
   res prog_executing,(iy+newdispf)
   xor a
   ret

basicErrHandler:
   or a;you must have this
   ret

ADDkey:
   ld hl,keyhook
   ld bc,hook_end-keyhook
   ld de,appbackupscreen
   ldir  ;Copy the code to a safe RAM location
     ;(Not needed if app)

   ld hl,appbackupscreen;
   in a,(6)   ;Get the mem page
   bcall($4F66)   ;Install the key hook
   ret
keyhook:  ;The actual routine
   add a,e  ;This is required for it to work (op-code:83h)
   cp kquit
   jr z,tester
   ret
tester:
   ld a,(progrun)
   cp 1
   jp z,changeatt
   ret  ;Exit
   
hook_end:
   bjump(_JForceCmdNoChar)

changeatt:
   bcall(_cleanall)
   jp start
   
   
   


;=======================================DATA====================================
=======

view:
.db " FormulaBank 2003    ",0
view2:
.db "                     ",0
view3:
.db "                     ",0
optstxt:
.db "To setup hit 'stat'  ",0
xtxt:
.db "x",0
algtxt:
.db "(1) Algebra",0
geotxt:
.db "(2) Geometry",0
grftxt:
.db "(3) Graphing",0
algebra:
.db AppVarObj,"ZFBALG",0
geometry:
.db AppVarObj,"ZFBGEO",0
graphing:
.db AppVarObj,"ZFBGRF",0
algprog:
.db ProgObj,"ZFBALG",0
geoprog:
.db ProgObj,"ZFBGEO",0
grfprog:
.db ProgObj,"ZFBGRF",0

progrun:
.db $12

reter:
.db $12

done:
   ret

 ret    ;Exit program
.end    ;End of code


Please Help!
Back to top
David
The XORcist!


Advanced Member


Joined: 20 May 2003
Posts: 268

Posted: 24 Oct 2003 09:35:29 am    Post subject:

I'd say it's no wonder that you get errors. Despite my quest for a good a way of running BASIC programs from asm programs, I can't get it to work flawlessly Sad What I miss is a way to "shut down" the parser. It's just a theory, but when you quit from a program using the keyhook, the calculator thinks that the program is still running. If one could stop the parser in the keyhook, it would perhaps work better.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 16 Dec 2003 10:40:59 pm    Post subject:

have you tired setting the parser flag to 0?
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 17 Dec 2003 08:28:39 am    Post subject:

David, if you cant do it flawlessly, i dont know who can... *sigh* poor us, we have no basic (yes, this new language wont be defiled by that ugly small slow thing called basic) Razz
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 17 Dec 2003 09:16:09 am    Post subject:

it is possible...
thou who say "it is impossible" shall be skelped
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement