What should the OFFSCRIPT variable look like (in hex) if you want it to tell the calc to first unarchive, then run a program named "OFFBY1" on startup, then rearchive it? If you can't un/re archive the program using the appvar, then just to run it.
Something like this?
Code:
I haven't tested this yet, though.
Code:
.org $8001
Start:
ld hl,ProgName
rst 20h
b_call(_ChkFindSym)
jr c,NotFound
push af
ld a,b
or a
jr z,ArchiveVar
ret nz
ArchiveVar:
pop af
b_call(_ArchiveVar) ;archives any variable
ret
NotFound:
;stuff
ret
ProgName:
.db ProgObj,"OFFBY1",0
I haven't tested this yet, though.
Oh, then I think you can replace b_call(_ArchiveVar) with b_call(_ArcUnarc) and load the program name to OP1 again before the bcall.
souvik1997 wrote:
Oh, then I think you can replace b_call(_ArchiveVar) with b_call(_ArcUnarc) and load the program name to OP1 again before the bcall.
Correct, that will work. I notice you push af, then ret nz, which is not a good thing. KermMartian wrote:
souvik1997 wrote:
Oh, then I think you can replace b_call(_ArchiveVar) with b_call(_ArcUnarc) and load the program name to OP1 again before the bcall.
Correct, that will work. I notice you push af, then ret nz, which is not a good thing. Oh yeah, didn't see that. Thanks.
My pleasure. It's a trivial fix, of course, let's leave it as an exercise to the (reader|ACagliano).
Ok, here is what I have:
Code:
The objective is to simply create OFFSCRPT.
Edit: Forgot to copy the actual data TO appvar.
Code:
.nolist
#include "ti83plus.inc"
#include "dcs7.inc"
.list
.org progstart
ld hl, AppVarObj
rst 20h
ld hl,AppVarObj-AppVarCode
bcall(_CreateAppVar)
ld hl, AppVarCode
ld bc,AppVarObj-AppVarCode
ldir
DoneCheck:
ld hl, AppVarObj
rst 20h
bcall(_ChkFindSym)
jr c, notOK
ret
notOK:
ld a, 0
ld (CurCol),a
ld a,0
ld (CurRow),b
ld hl, TextError
bcall(_PutS)
ret
AppVarCode:
.org $8001
bit 4, (iy + 8)
ret nz ;apd
ld hl, progName
rst 20h
bcall(_ChkFindSym)
ld a,b
or a
call nz, UnArchive
bcall(_executePrgm)
call UnArchive
ret
UnArchive:
ld hl, progName
rst 20h
bcall(_ArcUnarc)
ld hl, progName
rst 20h
ret
progName:
.db protProgObj, "OFFBY1", 0
AppVarObj:
.db AppVarObj,"OFFSCRPT"
TextError:
.db "Error!",0
.end
END
The objective is to simply create OFFSCRPT.
Edit: Forgot to copy the actual data TO appvar.
You would want to use .relocate $8001 instead of .org $8001. Also, you may want to look through this thread.
Ok. Using what I read, I made some edits:
Code:
Code:
.nolist
#include "ti83plus.inc"
#include "dcs7.inc"
.list
_ExecutePrgm .equ 4E7Ch
.org progstart
ld hl, AppVar
rst 20h
ld hl,AppVar-AppVarCode
bcall(_CreateAppVar)
ld hl, AppVarCode
ld bc,AppVar-AppVarCode
ldir
DoneCheck:
ld hl, AppVar
rst 20h
bcall(_ChkFindSym)
jr c, notOK
set 1,(iy+33h)
ret
notOK:
ld hl, 0
ld (CurCol),hl
ld hl, TextError
bcall(_PutS)
ret
AppVarCode:
.relocate $8001
bit 4, (iy + 8)
ret nz ;apd
ld hl, progName
rst 20h
bcall(_ChkFindSym)
ld a,b
or a
call nz, UnArchive
bcall(_ExecutePrgm)
call UnArchive
ret
UnArchive:
ld hl, progName
rst 20h
bcall(_Arc_Unarc)
ld hl, progName
rst 20h
ret
progName:
.db protProgObj, "OFFBY1", 0
AppVar:
.db AppVarObj,"OFFSCRPT"
TextError:
.db "Error!",0
.end
END
I'm glad you corrected the entertaininly-incorrect "AppVarObj: / .db AppVarObj,"OFFSCRPT". Comments:
1) You need to ChkFindSym at the very beginning, and not CreateAppvar if it already exists
2) Check the c/nc flag after CreateAppVar! Don't blindly copy if the create failed.
3) There's no point ChkFindSym'ing it after the create and copy, imho, as in the notOK subroutine
1) You need to ChkFindSym at the very beginning, and not CreateAppvar if it already exists
2) Check the c/nc flag after CreateAppVar! Don't blindly copy if the create failed.
3) There's no point ChkFindSym'ing it after the create and copy, imho, as in the notOK subroutine
KermMartian wrote:
I'm glad you corrected the entertaininly-incorrect "AppVarObj: / .db AppVarObj,"OFFSCRPT".
I started swearing at your dcs_sdk compiler at this point, for about five minutes, before realizing what was epically wrong with that.
KermMartian wrote:
1) You need to ChkFindSym at the very beginning, and not CreateAppvar if it already exists
Done!
KermMartian wrote:
2) Check the c/nc flag after CreateAppVar! Don't blindly copy if the create failed.
Done!
KermMartian wrote:
3) There's no point ChkFindSym'ing it after the create and copy, imho, as in the notOK subroutine
I don't do it in that routine, do I?
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
» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Advertisement