Author Topic: What happens when a calculator crashes...  (Read 17804 times)

0 Members and 1 Guest are viewing this topic.

SirCmpwn

  • Guest
Re: What happens when a calculator crashes...
« Reply #30 on: March 25, 2011, 03:01:24 pm »
This should stay in this subforum, and I'm still unsure of what actually *happens* when you go past $C000

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: What happens when a calculator crashes...
« Reply #31 on: March 25, 2011, 03:11:45 pm »
This should stay in this subforum, and I'm still unsure of what actually *happens* when you go past $C000
Well, I just tested it, by jumping into C000, and it immediately crashed, without executing anything.  Or so far as I can tell, it did.

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: What happens when a calculator crashes...
« Reply #32 on: March 25, 2011, 05:28:11 pm »
Sir, I would say that it must go to the boot code. My reasoning for this is that if no OS is present, jumping to 0000 will just cause a rst 38h which will loop into oblivion. The way to test would be to write a jump at 0000 and at 0053 and see which one gets on crashing.
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 Compynerd255

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +53/-4
  • Betafreak Games
    • View Profile
    • Betafreak Games
Re: What happens when a calculator crashes...
« Reply #33 on: March 25, 2011, 07:01:24 pm »
How does the calculator even detect that code is running in the "illegal" area? The only explanation that I can think of is that the last two bits on the address bus (the ones that must be on if code above C000 is being executed) are wired into a trigger that causes the processor to jump to the boot code. In other words, the detection is in the hardware itself.
The Slime: On Hold, preparing to add dynamic tiles

Axe Eitrix: DONE

Betafreak Games: Fun filled games for XBox and PC. Check it out at http://www.betafreak.com



Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: What happens when a calculator crashes...
« Reply #34 on: March 25, 2011, 08:13:08 pm »
How does the calculator even detect that code is running in the "illegal" area? The only explanation that I can think of is that the last two bits on the address bus (the ones that must be on if code above C000 is being executed) are wired into a trigger that causes the processor to jump to the boot code. In other words, the detection is in the hardware itself.
Most likely it is.  Remember that we are talking about all of this being in the processor.  So the processor knows immediately if the pc is C000h or above.

Offline Compynerd255

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +53/-4
  • Betafreak Games
    • View Profile
    • Betafreak Games
Re: What happens when a calculator crashes...
« Reply #35 on: March 25, 2011, 08:15:57 pm »
How does the calculator even detect that code is running in the "illegal" area? The only explanation that I can think of is that the last two bits on the address bus (the ones that must be on if code above C000 is being executed) are wired into a trigger that causes the processor to jump to the boot code. In other words, the detection is in the hardware itself.
Most likely it is.  Remember that we are talking about all of this being in the processor.  So the processor knows immediately if the pc is C000h or above.
Which probably explains why the Z80 processor is actually TI's modified version.
The Slime: On Hold, preparing to add dynamic tiles

Axe Eitrix: DONE

Betafreak Games: Fun filled games for XBox and PC. Check it out at http://www.betafreak.com



Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: What happens when a calculator crashes...
« Reply #36 on: March 25, 2011, 08:25:54 pm »
How does the calculator even detect that code is running in the "illegal" area? The only explanation that I can think of is that the last two bits on the address bus (the ones that must be on if code above C000 is being executed) are wired into a trigger that causes the processor to jump to the boot code. In other words, the detection is in the hardware itself.
Most likely it is.  Remember that we are talking about all of this being in the processor.  So the processor knows immediately if the pc is C000h or above.
Which probably explains why the Z80 processor is actually TI's modified version.
Probably.

Offline christop

  • LV3 Member (Next: 100)
  • ***
  • Posts: 87
  • Rating: +20/-0
    • View Profile
Re: What happens when a calculator crashes...
« Reply #37 on: March 25, 2011, 08:31:51 pm »
How does the calculator even detect that code is running in the "illegal" area? The only explanation that I can think of is that the last two bits on the address bus (the ones that must be on if code above C000 is being executed) are wired into a trigger that causes the processor to jump to the boot code. In other words, the detection is in the hardware itself.
Most likely it is.  Remember that we are talking about all of this being in the processor.  So the processor knows immediately if the pc is C000h or above.
Which probably explains why the Z80 processor is actually TI's modified version.
The detection may actually be done outside of the Z80. The memory controller could detect multiple consecutive accesses (which indicates instruction fetches) to a particular memory range and do almost anything it wants at that point.
Christopher Williams

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: What happens when a calculator crashes...
« Reply #38 on: March 25, 2011, 08:34:59 pm »
If I had to make a guess, I say it deals with a specific peripheral (meaning a port) that is connected to the hardware and reads PC. That is why there are two memory mapping modes (one allowing execution beyond BFFF).

Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: What happens when a calculator crashes...
« Reply #39 on: March 26, 2011, 12:28:43 am »
The protection is associated with "physical" memory locations, not with Z80 addresses; it works the same way regardless of the memory mapping ports.  If you try (say, on an 83+ SE) writing 80h to port 6 and then jumping to 4000h, that will crash; conversely, writing 1 to port 5 and then jumping to C000h will not crash (assuming there's some valid code there. :P)

As for how it's implemented, it's presumably part of the "glue" circuit that connects the CPU to the memory and other hardware devices; this circuit is part of the ASIC used in newer calculators, but in older calculators, it's a separate gate-array chip.  This chip can be thought of as the equivalent of the northbridge and southbridge chips on a PC motherboard.

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: What happens when a calculator crashes...
« Reply #40 on: March 26, 2011, 11:19:52 am »
So basically, it's the page, and not where it's mapped to, right?

Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: What happens when a calculator crashes...
« Reply #41 on: March 26, 2011, 10:28:35 pm »
Right.  (Technically speaking, in some weird modes, it does depend on the mapping, but you don't need to worry about that, because nobody will ever use those modes.)

Offline Compynerd255

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +53/-4
  • Betafreak Games
    • View Profile
    • Betafreak Games
Re: What happens when a calculator crashes...
« Reply #42 on: March 28, 2011, 10:27:17 am »
The idea of checking outside the CPU is actually not a bad guess. I do know that the Apple //e from 1980 used memory locations to reference hardware processes (e.g. you would preform "LoaD Accumulator $C030" to tweak the internal speaker). So, $C000 and beyond could be linked to a reset loop.
The Slime: On Hold, preparing to add dynamic tiles

Axe Eitrix: DONE

Betafreak Games: Fun filled games for XBox and PC. Check it out at http://www.betafreak.com



Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: What happens when a calculator crashes...
« Reply #43 on: March 28, 2011, 05:45:45 pm »
The >0C000h protection was to prevent people from stealing applications, a point which became void after TI released the freeware keys, and doubly void after Flop did that thing he no longer talks about. Sometimes, crashes don't make their way into the protected zone, and you have to pull a battery.

I'm not sure about how the calculator implements the protection. I tried the following program with Mimas:
Code: [Select]
BCALL NewLine
LD HL, sStart
BCALL PutS
DI
LD A, $C9 ; ret
LD ($FF80), A
LD ($8000), SP
LD SP,$8080
LD HL,retPoint
PUSH HL
JP $FF80
retPoint:
LD SP,($8000)
LD HL,sEnd
BCALL PutS
EI
RET
sStart:
DB "Start!",0
sEnd:
DB " ... End!",0
This should only fetch a single byte from the forbidden zone, but it crashes anyway. So I guess it's not the multiple-access thing.
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: What happens when a calculator crashes...
« Reply #44 on: March 28, 2011, 05:47:14 pm »
and it's obviously not the pc being in $C000.  Maybe it just checks if that higher nibble is C, and crashes if it is.