Author Topic: Normal stack range on the 83+  (Read 3070 times)

0 Members and 1 Guest are viewing this topic.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Normal stack range on the 83+
« on: July 05, 2012, 09:07:09 am »
I'm pretty sure in the normal running of the calculator, you rarely will have more than 50 bytes of data pushed onto the stack. Where exactly does the stack start? I always assumed it started (or rather, ended) at $F000, but that's like 4kb of stack space. Is there any reason you shouldn't touch this area if you know your program won't come close to touching it? And where exactly does the stack... end? I was just looking through the source to a program and i think it uses that area for variables/as a gbuf for its grayscale routines.

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Normal stack range on the 83+
« Reply #1 on: July 05, 2012, 11:31:57 am »
The stack officially gets created with
Code: [Select]
ld sp, $FFF7
so $FFF7-$FFFF are never touched.

The stack has to end when it runs into something, and that something is the symTable which begins at $FE66.


You could use that ram around $FE66 for variable storage, but the trouble is, you don't actually know how much memory you'll actually have. Maybe in the OS you'll have 100 bytes, but there's a chance that from a certain shell, you'll only have 20 bytes due to some epic stack abuse.


I would recommend you use a different ram area, I put together this giant list. If you can't find enough ram on that page, then you are doing something wrong.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Normal stack range on the 83+
« Reply #2 on: July 07, 2012, 06:16:58 am »
Yeah, i've already looked through (and saved an offline copy of) that amazing list. I was just wondering what exactly the other program was doing, though unless i'm missing something it looks like it's using the space from $F000 and below:
Code: [Select]
; FE6Eh fin de la memoire disponible (English: End of available memory)
; VARIABLE

mem .equ 0F000h
dessine_hl .equ mem
dessine_ix .equ mem-2d
ecran_x .equ mem-4d
ecran_y .equ mem-6d
;...removed the rest of equated variables
ecran4 .equ mem-945d
ecran3 .equ mem-1713d
tete_retourne .equ mem-1932d
flag_rafraichi_decor .equ mem-1933d
flag_fondue_noir .equ mem-1934d
fixe_fps .equ mem-1936d

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Normal stack range on the 83+
« Reply #3 on: July 07, 2012, 01:28:14 pm »
Yeah, i've already looked through (and saved an offline copy of) that amazing list. I was just wondering what exactly the other program was doing, though unless i'm missing something it looks like it's using the space from $F000 and below:
Code: [Select]
; FE6Eh fin de la memoire disponible (English: End of available memory)
; VARIABLE

mem .equ 0F000h
dessine_hl .equ mem
dessine_ix .equ mem-2d
ecran_x .equ mem-4d
ecran_y .equ mem-6d
;...removed the rest of equated variables
ecran4 .equ mem-945d
ecran3 .equ mem-1713d
tete_retourne .equ mem-1932d
flag_rafraichi_decor .equ mem-1933d
flag_fondue_noir .equ mem-1934d
fixe_fps .equ mem-1936d

Ok, this is a terrible idea, don't do this. Yes, this will probably work most of the time, but there's a chance it will corrupt the vat. Have a look at page 15 of the ti-83+ developer guide found on this page.

$F000 on some calculators is probably right about the top of "Free Ram". The trouble is if a user has a bunch of programs, $F000 is going to be right in the middle of the VAT. This means after the program runs, there are going to be a few corrupt variables in the vat and a ram clear won't be far away. Alternatively, there could also be a giant program in ram that passes through $F000 and it would also be corrupted.

So, don't try to put anything in that free ram area unless you actually do some calculations to figure out where it is and how big it is.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Normal stack range on the 83+
« Reply #4 on: July 09, 2012, 01:43:05 am »
Ah alright, thanks for the info :) So the stack is 400 bytes? The Symbol table is just another (TI's) name for the VAT? I really have no idea how the actual calculator works.

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Normal stack range on the 83+
« Reply #5 on: July 09, 2012, 02:16:54 pm »
Ah alright, thanks for the info :) So the stack is 400 bytes?

I've never done the math before, but yes, I'm surprised it's such a clean number.

Quote
The Symbol table is just another (TI's) name for the VAT?

I think those two tables together are collectively known as the VAT. (Variable Allocation Table)

Quote
I really have no idea how the actual calculator works.

That comes with time, if you ever want to start learning, start by disassembling the boot code. It's self contained which makes it fairly easy to understand.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112