I have sent over my first version of the CalcRacr for testing to a guy who will use it. I heard back that it clears his other application's variables from memory and (possibly) clears his other applications from the calc. I'll try to dig deeper on my own, but I'm wondering if this scenario is common and its reasons understood.

Any ideas are appreciated.
In your app, are you doing anything that could possibly corrupt the VAT?
Can you tell me what VAT means? As far as my app, I am using about 600 bytes from appBackUpScreen, otherwise, just system calls. Thanks for responding, btw.
The VAT is the Variable Allocation Table, it holds the names, sizes, and pointers to data of all the variables on your calculator. http://wikiti.brandonw.net/index.php?title=83Plus:OS:System_Table

Which system calls are you using?
ahh. Yes, that thing. Good suggestion. I use a variable that changes in size over time. It changes by 255 bytes at a time (I call them blocks). The variable usage should be textbook. Hmm, at this hour, I can't think of anything in theory that should be the problem. I'll have a closer look at my code that does the variable work. Maybe there is a write that I'm doing to that area in memory, somehow.
What method do you use to change the size? Chances are you're not doing that correctly, which is what is making the VAT incorrect or corrupt. If you tell us how you're doing it, we can point out possible errors and fixes for said errors.
What I don't understand is how it could clear other applications from memory. That's some pretty nasty corruption if it's writing to flash.
Qwerty.55 wrote:
What I don't understand is how it could clear other applications from memory. That's some pretty nasty corruption if it's writing to flash.
I'd definitely believe that it's something getting corrupted in RAM that's temporarily fooling the OS into failing. I'd bet a RAM clear would resolve it.
Awesome replies everyone, as usual.

I think I can smell a defect in the calling code, it looks odd and I'm going to look closer at it, however, here is the actual call that does the variable growth.

Note: this part was written when I was a fresh noob at Z80 (now I'm a stale noob Razz )


Code:
InsertMemory:
;=========================================================
; Insert DefaultBlockSize bytes to the end of the variable
;=========================================================


;??????DEBUG THIS THING...WRITES PROBABLY NOT THE WRITE THING TO INCREASE MEMORY
;   .using GlobalVariables

   bcall(_MemChk)
   
      
   ld hl, (App.DefaultBlockSize)
   
   bcall(_EnoughMem)

   jp c, ErrorScreen
   
   call GetTestObj
   
   ;DE points to ti var size bytes
   push de         ; save pointer to start of size bytes of data

   
   
   ;======================================
   ;Set DE to the last memory location of
   ;current variable
   ;======================================
   
   
   ldDEInd()   ;ld de, (de)   

   
   pop hl         ; add to var addy to get insertion point   
   push hl
   
   add hl, de      ; calculate insertion address
   
   
   ld d, h      ; set de to insertion address
   ld e, l
   
   ld hl, (App.DefaultBlockSize)   ; hl to size insert



   bcall(_InsertMem)
      
   pop de      ; size address (start of variable)
   push de   ; save it back again

   ldDEind()
   
   ld hl, (App.DefaultBlockSize)   ; hl to size
   

   add hl, de      ; hl = hl + de
   ;===========================
   ; Write hl to the size bytes
   ;===========================

            
   pop de      ; ld (de), hl
   ld a, l
   ld (de), a
   inc de
   ld a, h
   ld (de), a



   ret
   


Here is the delete code


Code:
DeleteLastBlockMemory:
   
   
   ;hl = address of first byte to delete
   ;de = number of bytes to delete

   call SetDEToBlockSizeValue      ; destroys a lot of registers, do first
   ld (App.BlockSizeTemp), de

   ld hl, (App.EndBlockStartByte)   ; start of delete   
   bcall(_DelMem)   
   call GetTestObj         ;de pointing to size bytes (variable)
   push de

   ldDEind()            ; de = (de)

   xor a      ; clear CA   
   ld bc, (App.BlockSizeTemp)

   ex de, hl
   sbc hl, bc      ; hl is new size of variable
   ;write hl to the size location of the variable
   ex de, hl      ; de is new size of variable
   pop hl         ; pointer to size bytes location   
   ld (hl), e
   inc hl
   ld (hl), d

   ret
So, yeah, it feels like airing dirty laundry at this point. I noticed a routine I call above during the insert. This is it. With this posted I've completed the picture of my variable life-cycle.


Code:
GetTestObj:

   ;check the symbol table for the testPackage variable and unarc if it is arc
   
   
   ld hl, VarName
   bcall(_Mov9ToOP1)   
   bcall(_ChkFindSym)   
   jr nc, VarCreated
   ;CREATE VARIABLE IN RAM
   ;set initial size to 1 block at Me.blockSize amount
   LD hl, 7   

   bcall(_CreateAppVar)      ; create appVar
   
   inc de            ; load identifier
   inc de
   ld hl, Identifier
   ld bc, 4
   ldir
   ;TMKR0 | 20 | 8

      
   inc de            ; set block count to 0 (default)
   ld (de), a

   ;done initializing the count to 0   
   ; walk de back by 7
   ld b, 7   
-:
   dec de
   djnz {-}
   
VarCreated:
   
   ;ADD CODE !!!!
   ;CHECK FOR IDENTIFIER, IF NOT THROW ERROR

   ld a, b
   or a
   jr z, InRam   
   bcall(_Arc_Unarc)   
   jr GetTestObj
InRam:      
   
   ld (App.TIVarAddy), de


   ret

VarName:
   .db AppVarObj, 'TestObj',0
Identifier:
   .db "TMKR",0

   ;--------------------------------get the test object ---- END


  
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
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

 

Advertisement