[z80 ASM]Building a mutlipage APP 2 to 3 pages

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

[z80 ASM]Building a mutlipage APP 2 to 3 pages

Post by Halifax »

Ok I have like a little bit of knowledge about building a multipage APP. One question though

if page 1 = $4000, page 2 = $8000, then does page 3 = $C000 and page 4 = $FFFF?????So is it possible to build a 5 page app?

Also I know about the dummy compiling. Like by compiling the second page and adding $4000 to it. But how would I set the part of the program on the second page. Just make a second source file with .org $8000 in it?? Same question for page 3. I am in need of help!
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

page 4 would be $10000 wouldn't it?
anyway: no.
new pages start at $4000 afaik

you've seen this haven't you?
User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

Post by Halifax »

no I don't think so cause I did all the math and $FFFF = 65535

and that link seems easy enough but I don't really like yo use Brass. And I don't get it. How do both pages go no $4000
Last edited by Halifax on Sat 10 Mar, 2007 7:21 pm, edited 1 time in total.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

with all the F's it would be 1 less than 16k added to the last one, it would be the last byte of the page before..

anyway, use that link and knowledge will come to you
User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

Post by Halifax »

ok even reading that page doesn't show how to store it all on $4000

and so all the data needs to be one the same page as the routine that uses it??
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

What do you mean?

just define 2 pages instead of 1, and put ".page 1" on your second page.
Then add branchrules and you're ready to bcall your other page.
Alternatively you could swap your other page through port 7(right?) so it will be at $8000 (in which case you use define the second page as starting at $8000)
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Post by Dwedit »

Each page actually has an origin address of $4000.
You know your hexadecimal output routine is broken when it displays the character 'G'.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

That's what I said, except you could theoretically swap in a page at $8000 if you really wanted to (disable interrupts and don't use any system routines!), you would swap away your saferam, but it might be useful for something (like storing something huge and need your other page accessible at the same time)

Far better just to use the normal way and start every page at $4000..


Every page starts at $4000 because it will be in that place, as controlled by port 6 (and 5). If you don't use Brass then give up, it will be too hard to make multypage apps anyway.

It's best to have data which is used by a routine on the same page as the routine but you could either load it in saferam or, DI and swap in the other page at $8000 (don't forget to relocate and don't use any bcalls, and like I said it would be kinda crazy)

why don't you use Brass anyway?
User avatar
driesguldolf
Extreme Poster
Posts: 395
Joined: Thu 17 May, 2007 4:49 pm
Location: $4080
Contact:

Post by driesguldolf »

Another attempt to explain how the hardware works:
the calc refers to ti83p/84p (SE)

As you know the calc has 64kb addressable memory (?), wich start at $0000, $4000, $8000, $C000 respectively, note that they're all 16kb in size
the first 2 pages are used with the flash, the last two are ram

The calc has lots (not!...) of flash memory, they don't fit in those 64kb! so only a part (flash page) is shown, the part that is shown can be controlled using ports (see above)
That part is then drawn to the 2nd page (and only the second page!), if you're making multipage apps, each flash page is stored sequentionelly in flash memory, to access the other flash pages you can use B_CALLs or do things manually, but only one flash page is shown at the same time. So if currently page 2 of you're app is loaded, it is loaded to $4000 and the other page (ie page1) is gone!
visual:

Code: Select all

+--------------+ $0000
|    PAGE 1    |       Fixed page, cannot be changed
+--------------+ $4000
|    PAGE 2    |       only ONE page of your app is loaded here
+--------------+ $8000
|    PAGE 3    |       Start of the ram, from here you can directly edit its contents
+--------------+ $C000
|    PAGE 4    |       more ram
+--------------+ $FFFF
This has far reaching implications:
- You cannot jump directly to another app page, because that page isn't loaded and you will jump to that address in the wrong page! (your calc will most likely crash)
- Don't change the page with code that is located on that page! You have to copy a routine to ram to do the trick
- ... there are probabely more things

I hope I made some stuff clear here
note that I tried to keep things simple and only write relevant stuff to not make things too complicated (because stuff above is correct but maybe too much irrelevant things)
(?) I'm not sure if this name is correct
Last edited by driesguldolf on Fri 18 May, 2007 8:24 am, edited 2 times in total.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Note that they are 16KB in size, $4000 = 16384.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
driesguldolf
Extreme Poster
Posts: 395
Joined: Thu 17 May, 2007 4:49 pm
Location: $4080
Contact:

Post by driesguldolf »

hmmm... I shouldn't write stuff so late... Thanx anyway
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

you can also map RAM pages to page 2 can you not? but not flash pages to page 3?
User avatar
driesguldolf
Extreme Poster
Posts: 395
Joined: Thu 17 May, 2007 4:49 pm
Location: $4080
Contact:

Post by driesguldolf »

King Harold wrote:you can also map RAM pages to page 2 can you not? but not flash pages to page 3?
That's correct, but I tried to keep things simple and _closely_ relevant.

Altough I'm not sure how you map the RAM pages, are that flash pages that are mapped? Or is it other RAM?
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

well, RAM pages have high numbers (80h and up), you can map them in the same way as flash pages
the first 2 pages are used with the flash, the last two are ram
so that is not correct, only close.
port 6 can map RAM pages (and ROM as usual), and port 7 can map ROM pages (and RAM as usual), port 5 (SE/84 only) can only map RAM though.
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

The portions of addressable memory that are switched in and out are more often referred to as Banks, a page is generally a section of memory on a particular chip.


Ram pages are can be mapped like flash, simply by setting a higher bit. However it should be avoided, since TI doesn't have as much concern reworking how ram pages work. If you wrote a program on the 83+ to map the ram at $4000 it would fail on the 84+. Further TI's paged memory routines don't like working with the ram as much. I know there's more than a few that would probably throw back an error if you tried to read through them.
Image
Post Reply