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: 30 Oct 2003 07:04:22 pm    Post subject:

I am making a program that will automatically delete the Mirage password appvar when the memory key is pressed. I have made a test program that should do this when the "2" key is pressed. It always errors up and says MEMORY error when I run it.

The bold section can run by itself and works fine, but when inserted into the program, it screws up. The underlined "_arc_unarc" is the problem, I believe.


#include "ti83plus.inc";File needed to access system routines
.org userMem-2 ;Define where to start in memory
.db $BB,$6D ;AsmPrgm instruction
_setrawkeyhook   .equ 4f66h
_clearrawkeyhook .equ 4f6fh

#define hooksize end_of_hook-the_hook
#define offset 523h-endmain+usermem


ld hl, appbackupscreen
ld de, the_hook
in a,(6)
bcall(_setrawkeyhook)
ex de,hl
ld bc, hooksize
ldir
jp quit


the_hook:
.db 83h;Required byte
cp k2
jp z,implement
ret

implement:

ld hl,miragevar
rst20h
bcall(_ChkFindSym)
ld a,b
cp 0
jp z,goahead
ld hl,miragevar
rst 20h
errhandon(basicErrHandler)
bcall(_cleanall)
bcall(_arc_unarc)
goahead:
ld hl,miragevar
rst 20h
bcall(_ChkFindSym)
jp c,gone
bcall(_delvar)
errhandoff()
ret

end_of_hook

basicErrHandler:
or a;you must have this
ret

miragevar:
.db AppVarObj,"MirageOS",0

quit:
bjump(_JForceCmdNoChar)
ret


gone:
 
ret    ;Exit program
.end    ;End of code


Any ideas?


Last edited by Guest on 30 Oct 2003 07:05:08 pm; edited 1 time in total
Back to top
David
The XORcist!


Advanced Member


Joined: 20 May 2003
Posts: 268

Posted: 31 Oct 2003 05:04:01 am    Post subject:

Yes, I have some suggestions for you. Your problem is that you're loading the appvar name into OP1 from the wrong location. Since you have an .org UserMem, MirageAppvar will point to usermem, but it should point to appbackupscreen instead as the hook code resides there. Solution is to use the syntax ld hl,mirageappvar-offset, where offset simply is the distance in memory between usermem and appbackupscreen. This offset is defined in the source code, but I don't know if it's being calculated since there's no endmain label.
One more thing, bjump(_jforcecmdnochar) is for APPS only. TI clearly discourages asm programs from using it to exit. Use ret instead. I haven't tested this version, but I hope it will work :)


Code:
#include "ti83plus.inc";File needed to access system routines
.org userMem-2;Define where to start in memory
.db $BB,$6D;AsmPrgm instruction
_setrawkeyhook   .equ 4f66h
_clearrawkeyhook .equ 4f6fh

#define hooksize end_of_hook-the_hook
#define offset 523h-the_hook+usermem


ld hl, appbackupscreen
ld de, the_hook
in a,(6)
bcall(_setrawkeyhook)
ex de,hl
ld bc, hooksize
ldir
ret

the_hook:
.db 83h;Required byte
 cp k2
 ret nz;take no action if not k2
         ;Else, try to delete the appvar
 ld hl,mirageAppvar-offset;Get the correct address
 rst 20h
 bcall(_chkfindsym)          ;does it exist?
 jr c,exit                          ;don't delete in that case
 bcall(_delvararc)

exit
 xor a;Tell TI-OS no key was pressed,
 ret
mirageAppvar
.db appvarobj, "MirageOS";No zero terminator required if 8 chars

end_of_hook
.end
Back to top
JoeImp
Enlightened


Active Member


Joined: 24 May 2003
Posts: 747

Posted: 31 Oct 2003 12:08:34 pm    Post subject:

hehe I made a program that deleted the mirageOS appvar a while ago. You just ran it with asm(prgmKillMir or whatever, no pressing a button. I dont know if I still have it tho

Imp
Back to top
Jeffrey


Member


Joined: 12 Jun 2003
Posts: 212

Posted: 31 Oct 2003 04:47:36 pm    Post subject:

I have already done one like that, where you dont need to press a button, but this one is designed for classroom use, where the program that deletes the appvar only needs to be sent once, and automatically deletes the password, no need to manually do it.
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