Author Topic: Multi-Page Apps, what's the difference?  (Read 15065 times)

0 Members and 1 Guest are viewing this topic.

Offline Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #30 on: August 23, 2010, 12:29:36 pm »
Just put the label after the .dw statement. That's what labels are for, so you don't have to calculate manual offsets ;)
Ye, but I'm pissing off my assembler with that.
When I put the name of a label there, it gives the "label not found" message.
I HAVE to put the offset there.
But like I said, if there's really no way to check the offstes of my labels, I'll just make a jump table at the top of Page2.
It might even save space, since I don't need the branch table.
« Last Edit: August 23, 2010, 12:29:54 pm by Jerros »


79% of all statistics are made up randomly.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #31 on: August 23, 2010, 01:35:04 pm »
About the branch table thing - I dont put that at the start of my programm, and it still jumps to the right place on page 2.
The branch table is the pairs of .dw's and .db's. Unless you're not using the code you posted, you have a branch table.
Since I dont put it at the start, there's no need for the JP to the ProgStart either. :P
Same as above. Are you using the code you posted?
And appearantly my assembler doesn't want the label name after the .dw, it wants the offset.
As calc84 said, labels pretty much are offsets. The assembler doesn't like it because it's in a different file. You might have to move away from TASM, or at least AsmDev.
Like I said, If my label is the first thing on  Page2 i just put $4000 there, but I don't want to manually count every line to calculate what offset the other labels are at, that's insane!
I think I've already responded to this :P
Of course I could load a number in AppBackupScreen and then make a jump table at the first label of Page 2, which isnt much work or takes much room, but it's still cheating and a way of hiding my incompetence as a programmer, ghehe...
That's slower, not to mention unnecessary.
And I'm not having ANY problems at the moment, everything is working fine.
Well, I still can't jump to anyhing but the first label on page 2, but you now know why that is ;)
Yes we do :P
And don't worry, you aren't sounding rude.
Good :)
I should've made muself much much more clear, you're no psychic.
I'm already overwhelmed by the many people willing to help me, and they're helping me ALOT, so thank you!
We're trying our best :)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #32 on: August 24, 2010, 02:30:46 am »
The branch table is the pairs of .dw's and .db's. Unless you're not using the code you posted, you have a branch table.
My layout:

- Header
- Bunch of .equ's and #define macros
- Program just starts, in my case with:
Code: [Select]
b_call _RunIndicOff
        b_call _GrBufClr
- rest of programm
- somewhere in the middle there's:
Code: [Select]
JumpToPage2 = $ - $4000
  .dw $4000  
  .db 1
- and then rest of programm

So I don't see why the JP as first line of the programm is necessary with this. :P

That's slower, not to mention unnecessary.
The speed difference is neglectable, right?
Besides, there's no need a that point in my program to be fast, so that shouldn't be a problem.
As for the size difference, it might be ~20 more lines, hardly worth noticing.
It absolutely unnecessary, no can argue with that. :)
As calc84 said, labels pretty much are offsets. The assembler doesn't like it because it's in a different file.
I know, but there should be a way to get the actul offset of the labels right?
I'd rather do the nooby jump table at the start of the second page than switching to another assembler...
« Last Edit: August 24, 2010, 02:35:24 am by Jerros »


79% of all statistics are made up randomly.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #33 on: August 24, 2010, 08:44:49 am »
Hm... Looking at it, you don't actually have to have the branch table at the beginning. Good for you, figuring that out :)
Don't you need ($-$4000)/3 rather than $-$4000, though? Anyway, if you edit AsmDev's batch files somewhat (and change your source a bit), you won't have to go away from AsmDev and TASM.
In short, you'll need to change the compilation order to compile the first page last, add export directives to all pages except the first, and add an #include to the file for the first page so it includes the labels exported from the other pages.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #34 on: August 24, 2010, 08:54:10 am »
Don't you need ($-$4000)/3 rather than $-$4000, though?
($-$4000)/3 doesnt work.
$-$4000 does.
I don't know why, I just like it when things do.
Anyway, if you edit AsmDev's batch files somewhat (and change your source a bit), you won't have to go away from AsmDev and TASM.
In short, you'll need to change the compilation order to compile the first page last, add export directives to all pages except the first, and add an #include to the file for the first page so it includes the labels exported from the other pages.
Huh...?
I'm sorry, but I think I'm going with my nooby "jump tree at start of second page" plan.
It's slower, takes more space, but works NOW without me having to learn anything new ^_^
That a completely wrong attitude, and I'm prbably shooting myself in the foot with it, but I just love it when things work.
I don't know why or how, they just do. (which has often resulted in random crashes because I had no idea what the heck I was doing).

You've helped me ALOT though, thanks.
« Last Edit: August 24, 2010, 08:58:35 am by Jerros »


79% of all statistics are made up randomly.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #35 on: August 24, 2010, 10:22:57 am »
Quote
Don't you need ($-$4000)/3 rather than $-$4000, though?

($-$4000)/3 doesnt work.
$-$4000 does.
I don't know why, I just like it when things do.

In some assemblers, / doesn't work for division, and for good reason.  Instead, it's like the TI-Basic colon, allowing one to place more than one ASM instruction on the same line.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Multi-Page Apps, what's the difference?
« Reply #36 on: August 24, 2010, 10:26:31 am »
Quote
Don't you need ($-$4000)/3 rather than $-$4000, though?

($-$4000)/3 doesnt work.
$-$4000 does.
I don't know why, I just like it when things do.

In some assemblers, / doesn't work for division, and for good reason.  Instead, it's like the TI-Basic colon, allowing one to place more than one ASM instruction on the same line.
You are thinking of backslash ("\"). "/" is division in every assembler I know of.

And Jerros, how are you specifying the second page of code? I'm only familiar with app building in spasm.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #37 on: August 24, 2010, 10:32:44 am »
Quote
Don't you need ($-$4000)/3 rather than $-$4000, though?

($-$4000)/3 doesnt work.
$-$4000 does.
I don't know why, I just like it when things do.

In some assemblers, / doesn't work for division, and for good reason.  Instead, it's like the TI-Basic colon, allowing one to place more than one ASM instruction on the same line.
You are thinking of backslash ("\"). "/" is division in every assembler I know of.

So then with integer division, is the answer rounded in case of a decimal answer?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #38 on: August 24, 2010, 10:33:47 am »
He's using AppDev
From what I can tell, it uses TASM, and each page is in a different file, which is causing his label problems.
My solution was to edit AppDev's .bat files and use export to allow using the second-page labels on the first.
Edit: Oh, and I forgot to mention this earlier. If your branch table isn't right after the app header, you do need to make sure it is at an address divisible by three after subtracting $4000.
« Last Edit: August 24, 2010, 10:35:15 am by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #39 on: August 25, 2010, 02:32:33 am »
Oh, and I forgot to mention this earlier. If your branch table isn't right after the app header, you do need to make sure it is at an address divisible by three after subtracting $4000.
... Never paid attention to that, but even after editting it still works.
Maybe I'm lucky and it the adress is divisible by 3 each time, though I don't know.


79% of all statistics are made up randomly.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Multi-Page Apps, what's the difference?
« Reply #40 on: August 25, 2010, 08:17:18 am »
Oh, and I forgot to mention this earlier. If your branch table isn't right after the app header, you do need to make sure it is at an address divisible by three after subtracting $4000.
... Never paid attention to that, but even after editting it still works.
Maybe I'm lucky and it the adress is divisible by 3 each time, though I don't know.
I'm about 99% sure that any address within the app should work, and the "multiple of 3" thing is just a result of silly TI documentation. Because the *only* way that the remainder when divided by 3 would matter is if TI actually divided it by 3 in the bcall routine, which I am very sure they don't.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #41 on: August 25, 2010, 10:20:44 am »
Oh, and I forgot to mention this earlier. If your branch table isn't right after the app header, you do need to make sure it is at an address divisible by three after subtracting $4000.
... Never paid attention to that, but even after editting it still works.
Maybe I'm lucky and it the adress is divisible by 3 each time, though I don't know.
I'm about 99% sure that any address within the app should work, and the "multiple of 3" thing is just a result of silly TI documentation. Because the *only* way that the remainder when divided by 3 would matter is if TI actually divided it by 3 in the bcall routine, which I am very sure they don't.

In that case, they said exactly what I would say if I were TI..."We've done it for years this way, and it works perfectly and easily, so you should do it the way that WE do it.  Don't bother us with questions if you have problems simply because you decided to try a different route."
« Last Edit: August 26, 2010, 11:23:27 am by Hot_Dog »

Offline Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #42 on: August 26, 2010, 03:44:17 am »
Don't bother us with questions if you have problems simply because you decided to try a different route."

Q_Q
Sorry, my origional question has been answered.
It's just that someone else said I was doing it wrong when I posted the piece of script.
So I just asked why it was wrong, because it was working fine.
I know I've been a nuisance throughout the last couple of months.
But look at it on the bright side, if a new programmer would read all my questions and all your answers, they can just skip all tutorials and get right at it ;)
« Last Edit: August 26, 2010, 03:44:42 am by Jerros »


79% of all statistics are made up randomly.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Multi-Page Apps, what's the difference?
« Reply #43 on: August 26, 2010, 03:52:43 am »
I don't think Hot Dog meant it the wrong way. I am unsure if it was directed at you. I am confused, though, about what he meant. In any case, don't feel bad if you make mistakes. Everyone gotta start somewhere and with z80 assembly, there is a lot to understand. From what I notice you seems to learn pretty fast. (I myself tried 3 times to learn ASM so far and no luck ;D)

Normally Hot Dog doesn't respond harshly to other members, which tells me that he might have misworded his post or forgot a part. If it was really meant as rude, then he needs to know those responses are not wanted on the forums, because Omnimaga is supposed to be welcoming to new members who want to learn and our motto is that "everyone gotta start somewhere". :)
« Last Edit: August 26, 2010, 03:59:01 am by DJ Omnimaga »
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Multi-Page Apps, what's the difference?
« Reply #44 on: August 26, 2010, 10:14:14 am »
In that case, they said exactly what I would say..."We've done it for years this way, and it works perfectly and easily, so you should do it the way that WE do it.  Don't bother us with questions if you have problems simply because you decided to try a different route."
I believe Hot Dog is saying that if He were TI then...

Does that clear it up? :)

Jerros, sorry if you were offended, but I'm sure Hot Dog didn't mean it badly.  These are good questions, and I'm sure I'll use this thread when I make Multi Page Apps of my own. :)