I wanted to use keep using the 'drawSprite' routine, and call it 20 times. I am sure i can learn something from yoir code though
Oh Sorry, I thought you were looking for a faster way
In your version , you can replace "ld d,h / ld e,l" with ex de,hl
Code:
In your version , you can replace "ld d,h / ld e,l" with ex de,hl
Code:
renderBkgd:
ld b,20 ;render 20 times
ld de,vRam
renderBkgdLoop:
push bc
ld hl,titleReapeat_sprite ; The sprite
push de
call drawSprite
pop de
ld hl,16
add hl,de
ex de,hl ; ld d,h
;ld e,l ;de = de+16
pop bc
djnz renderBkgdLoop
How can i read (but not write) the data located in an archive program, without copying it to ram? I know i can do this in axe on the Ti84+.
I only know the program's name.
I only know the program's name.
-
MateoConLechuga
- Official Cemetech Lettuce Manager (Posts: 3953)
- 30 Mar 2016 04:06:19 pm
- Last edited by MateoConLechuga on 30 Mar 2016 04:46:17 pm; edited 3 times in total
Archived things store the VAT entry at the start of the archived data. It's a simple matter to get around it though with a small bit of code. If HL points to the name of your program (including the object type at the start of the name, ie, 'db progobj,"TEST",0', then you can use the following code to ensure that 1) The variable is placed in the archive, and 2) that it exists, otherwise it returns the data pointer as 0. This routine will make hl->start of program data. Hope this helps!
Code:
Code:
_finddata:
call _mov9toop1
call _chkfindsym
jp c,__notfound ; routine to run if not found
call _chkinram
ex de,hl
jp nz,__inarc
jr __skipsize
__notfound:
or a,a
sbc hl,hl
ret
__inarc:
ld de,9
add hl,de
ld e,(hl)
add hl,de
inc hl
__skipsize:
inc hl ; bypass size bytes
inc hl
So, to make sure, after this code is ran hl will point to data that is the same as in prgm test, regardless if prgm test is in ram or archive?
c4ooo wrote:
So, to make sure, after this code is ran hl will point to data that is the same as in prgm test, regardless if prgm test is in ram or archive?
Yeah, it will archive program test to just make sures
EDIT: Changed the above code so that HL points to either the data in ram or the data in the archive.
I have this piece of code:
Code:
If i *dont* comment out "call _CreateProtProg", the Y= vars will be corrupted.
I have confirmed that (inputLength) is a normal value and is not at fault. Even if i do 'ld hl,5' right before the call, the Y= vars still get corrupted.
Code:
ld hl,folderName
call _mov9toop1
ld hl,0
ld a,(inputLength)
inc a
ld l,a
call _CreateProtProg
If i *dont* comment out "call _CreateProtProg", the Y= vars will be corrupted.
I have confirmed that (inputLength) is a normal value and is not at fault. Even if i do 'ld hl,5' right before the call, the Y= vars still get corrupted.
-
MateoConLechuga
- Official Cemetech Lettuce Manager (Posts: 3953)
- Re: CreateProtProgram corrupts Y= vars
- 19 May 2016 07:27:27 pm
c4ooo wrote:
I have this piece of code:
Code:
If i *dont* comment out "call _CreateProtProg", the Y= vars will be corrupted.
I have confirmed that (inputLength) is a normal value and is not at fault. Even if i do 'ld hl,5' right before the call, the Y= vars still get corrupted.
Code:
ld hl,folderName
call _mov9toop1
ld hl,0
ld a,(inputLength)
inc a
ld l,a
call _CreateProtProg
If i *dont* comment out "call _CreateProtProg", the Y= vars will be corrupted.
I have confirmed that (inputLength) is a normal value and is not at fault. Even if i do 'ld hl,5' right before the call, the Y= vars still get corrupted.
Are you in an edit buffer context? If so, you need to switch out of it.
Yes i am. I am trying to switch contexts with:
Code:
However it gives me "ERROR: VALIDATION".
Geekboy said to use some other context, but as i said it wasn't in the include file. A very similar named context *was* in the include file, but it was set EQU to kExtApps
Code:
ld a,kExtApps
call _NewContext
However it gives me "ERROR: VALIDATION".
Geekboy said to use some other context, but as i said it wasn't in the include file. A very similar named context *was* in the include file, but it was set EQU to kExtApps
I am trying to set up a parser hook.
This is my basic test program:
Code:
This is prgmINSTLAPI, which sets up the hook.
Code:
And lastly this is the hook itself:
Code:
@mateo: The reason i replaced 0C2C2h with $00BBC2 is becouse the include file lists t2ByteTok as $BB and tSin as C2.
This is my basic test program:
Code:
Asm(prgmINSTLAPI)
For(X,1,10
X:Disp sin(X
End
This is prgmINSTLAPI, which sets up the hook.
Code:
ld hl,HookAppvar
call _mov9toop1
call _chkfindsym
ex de,hl
ld bc,0
ld c,(hl)
inc hl
ld b,(hl)
inc hl
ld de,pixelShadow2
ldir
ld hl,pixelShadow2
call _SetParserHook
ret
And lastly this is the hook itself:
Code:
.nolist
#include "ti84pce.inc"
.list
.org pixelShadow2
.db $83
or a ; Which condition?
ret z
push hl
ld hl,0C2C2h ; Is it the 'sin(' token?
;ld hl,$00BBC2 ;t2ByteTok and tSin
sbc hl,bc
pop hl
jr nz,ReturnZ
dec hl
call _DeallocFPS ; free unused parameters
call _RclAns
or 1 ; set NZ
ret
ReturnZ:
cp a
ret
@mateo: The reason i replaced 0C2C2h with $00BBC2 is becouse the include file lists t2ByteTok as $BB and tSin as C2.
So since this will mainly be for testing, it is generally easier to just use pixelshadow2 for this. There's no real point in trying to make it into an appvar unless that appvar is in ROM, where it can't be moved around as easily. Anywho, I don't see any reference to the hook appvar itself, so I have no way to use that code. But based on WikiTI, you are running a class 1 token. Here's some working example code that may be of some use to you, just to get an idea
Code:
Code:
#include "ti84pce.inc"
.db tExtTok,tAsm84CECmp
.org usermem
ld hl,hook_start
ld bc,hook_end-hook_start
ld de,pixelshadow2
push de
ldir
pop hl
jp _SetParserHook ; set the parser hook
hook_start:
.db $83
or a,a ; which condition?
ret z
call _SetBCUTo0
push hl
ld hl,$C2C2 ; sin( token?
sbc hl,bc
pop hl
jr nz,+_
dec hl
call _DeallocFPS ; free unused parameters
call _RclAns
or a,1 ; set NZ
ret
_:
cp a,a
ret
hook_end:
I have trouble getting the amount of arguments passed to the parser hook. For a function like "Sin()", the amount of arguments i give it is correctly expressed by HL. However for a function like "Line()" (And [some(?)/all(?)] other drawing) commands, HL holds the value 032DBC and (numArguments)=1.
(This seems to be true for all drawing commands)
My hook code:
http://pastebin.com/4zdM5jTf
(This seems to be true for all drawing commands)
My hook code:
http://pastebin.com/4zdM5jTf
Did you read about the different classes of functions? http://wikiti.brandonw.net/index.php?title=83Plus:Hooks:9BAC
Indead
"Line()" isnt class 2 becouse arguments *are* passed. It can't be class one because HL does not contain the # of args. According to wikiti, for class 3 functions, " the number of arguments is stored at 9661[numArguments]". However, the address $0D02320 (numArguments as defined in the latest CE include file) always holds the number one, instead of the correct amount of args.
"Line()" isnt class 2 becouse arguments *are* passed. It can't be class one because HL does not contain the # of args. According to wikiti, for class 3 functions, " the number of arguments is stored at 9661[numArguments]". However, the address $0D02320 (numArguments as defined in the latest CE include file) always holds the number one, instead of the correct amount of args.
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
» Goto page Previous 1, 2
» View previous topic :: View next topic
» View previous topic :: View next topic
Page 2 of 2
» 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