Author Topic: What does the TG-16 do?  (Read 736 times)

Kitsunexus

  • Hero Member
  • *****
  • Posts: 3911
What does the TG-16 do?
« on: December 30, 2007, 08:30:40 PM »
Ok, this kinda sounds like a really stupid thread and it probably is, but what does the TG-16 do when the cartridge is inserted and the switch is turned on?

And don't reply "IT PLAYS THE GAME, DUMBASS." I figured THAT much on my own.

What I mean is, when power is applied to the TG-16, what instructions does it execute first? Surely even the TG-16 has a BIOS, so that's loaded first, right? Then would the TG-16 load graphics and shit into it's memory or begin streaming it, or does the game engine code take care of that?

Can somebody give me an event by event list of what the Turbo does when it starts up? This wouldnt be the Turbo cd, just a normal American TG-16.

Does the system do sort of hidden diagnostics? Does it strobe the controller input to see if anything is plugged in? Are there certain varibles that have to come back as 1 or YES or positive or something before the game is played?

It has been boggling me for a week now... :(

Keranu

  • Hero Member
  • *****
  • Posts: 9054
Re: What does the TG-16 do?
« Reply #1 on: December 30, 2007, 09:09:07 PM »
Kitsune, we really need to get you a Turbo system  :mrgreen: .
Quote from: Bonknuts
Adding PCE console specific layer on top of that, makes for an interesting challenge (no, not a reference to Ys II).

Tatsujin

  • Hero Member
  • *****
  • Posts: 12311
Re: What does the TG-16 do?
« Reply #2 on: December 30, 2007, 09:17:31 PM »
00 initialize rom
10 check the slot
20 hucard unreadable
30 promt the user to revers the hucard
40 check the slot again
50 start the game
www.pcedaisakusen.net
the home of your individual PC Engine collection!!
PCE Games coundown: 690/737 (47 to go or 93.6% clear)
PCE Shmups countdown: 111/111 (all clear!!)
Sega does what Nintendon't, but only NEC does better than both together!^^

malducci

  • Guest
Re: What does the TG-16 do?
« Reply #3 on: December 30, 2007, 09:43:20 PM »
Step by step, huh?  :D

 You asked for it...

 The first thing that happens when the CPU is powered on:

 -Map bank $00 to CPU logic address $E000-FFFF, which is MPR 7 (Map register).
 -Since the CPU is in reset state, the CPU jumps to the address in the RESET entry of the interrupt vector table. This is located at $FFFE-FFFF.
 -The most common RESET vector jump address is $E000. In this little scenario, the CPU jumps to $E000.
 -The first instruction is disable interrupts (SEI), usually followed by a NOP (no operation, but wait 2 cycles)
 -Then map in the system work ram bank $F8 to $2000-3FFF, MPR 1. Ram needs to be here since the STACK is hard coded to address $2100-21FF and is needed for interrupt calls and subroutine calling, not to mention indirect addressing via a set of registers located in RAM known as ZeroPage.
 -Once Ram is mapped, you initialize it to all 00's (don't want any left over garbage in there).
 -next to do is initialize the SP register (stack pointer) to #$FF, which is the first entry slot
 -Mapped in the hardware bank $FF to address $0000-1FFFF (MPR 0). This bank, you access the video processor,video encoder, sound registers, interrupt controller, and I/O
 -you probably want to turn off the display now, but you don't have to do this right away.
 -next you start mapping in other banks of program code/data into the rest of the address range (MPR slots).
 -initialize the audio registers from the hardware bank, and then jump into initializing the game/program code

 There is no BIOS on the system or checksum or such. The only difference between the US and JP consoles is that there is a pin that's held high on one system and low on another. US games check this pin (which is part of the I/O port) to test which system the code is booting up on. If the wrong system, then no go. Japanese software doesn't bother to check this pin and is why you can play JP hucards on a US system with a pin converter.

WoodyXP

  • Guest
Re: What does the TG-16 do?
« Reply #4 on: December 30, 2007, 10:31:26 PM »

This stuff is good to know.  When I come home drunk and turn my system on I don't even know this shit is going on.  It's transparent.  That's what makes the Turbo so awesome.  8)

Kitsunexus

  • Hero Member
  • *****
  • Posts: 3911
Re: What does the TG-16 do?
« Reply #5 on: December 31, 2007, 06:38:26 AM »
Step by step, huh?  :D

 You asked for it...

 The first thing that happens when the CPU is powered on:

 -Map bank $00 to CPU logic address $E000-FFFF, which is MPR 7 (Map register).
 -Since the CPU is in reset state, the CPU jumps to the address in the RESET entry of the interrupt vector table. This is located at $FFFE-FFFF.
 -The most common RESET vector jump address is $E000. In this little scenario, the CPU jumps to $E000.
 -The first instruction is disable interrupts (SEI), usually followed by a NOP (no operation, but wait 2 cycles)
 -Then map in the system work ram bank $F8 to $2000-3FFF, MPR 1. Ram needs to be here since the STACK is hard coded to address $2100-21FF and is needed for interrupt calls and subroutine calling, not to mention indirect addressing via a set of registers located in RAM known as ZeroPage.
 -Once Ram is mapped, you initialize it to all 00's (don't want any left over garbage in there).
 -next to do is initialize the SP register (stack pointer) to #$FF, which is the first entry slot
 -Mapped in the hardware bank $FF to address $0000-1FFFF (MPR 0). This bank, you access the video processor,video encoder, sound registers, interrupt controller, and I/O
 -you probably want to turn off the display now, but you don't have to do this right away.
 -next you start mapping in other banks of program code/data into the rest of the address range (MPR slots).
 -initialize the audio registers from the hardware bank, and then jump into initializing the game/program code


Cool, that is EXACTLY  what I wanted to know! Thank you! ^____^

I'm pretty sure the SNES and Genesis don't exactly follow this, but they're similar right?
« Last Edit: December 31, 2007, 06:47:24 AM by Kitsunexus »

OldTurboBastard

  • Jr. Member
  • **
  • Posts: 99
Re: What does the TG-16 do?
« Reply #6 on: December 31, 2007, 08:21:49 AM »
So while we're at it, why does a PC generally take a few seconds to boot up (even just the basic I/O stuff from BIOS, never mind a bloated OS) while most game systems instantaneously boot up?

I always assumed it had to do with the fact that a game system is made for one purpose and does not have to check 16 different card slots, IDE, ram, etc...

what's going on there?
« Last Edit: December 31, 2007, 08:23:58 AM by OldTurboBastard »
"I saw this wino, he was eating grapes. I was like, "Dude, you have to wait." - hedberg

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21366
Re: What does the TG-16 do?
« Reply #7 on: December 31, 2007, 08:56:04 AM »
This likely isn't a complete reason, but a PC's BIOS has more ports to check (internal and external), more controllers to initialize, and has to assign resources to each component.  In short, it takes longer on a PC because it has more complicated hardware, which is why newer systems all take time to boot up.
U.S. Collection: 97% complete    155/159 titles

nodtveidt

  • Guest
Re: What does the TG-16 do?
« Reply #8 on: December 31, 2007, 03:18:51 PM »
OldTurboBastard, that is one of the reasons. The PC also does a number of self-diagnostics on power-on, this is called POST. If you ever hear of anyone saying that their "computer failed post", that's what they're referring to. Old consoles don't have a POST step, nor do they have to spend time probing hardware, so they can start up immediately.

Kitsu: The SNES and Genesis have similar startup procedures, yes. The hardware goes through a few initialization steps and then jumps to the start of the program code in ROM. mal probably knows the exact procedures involved. :D

MissaFX

  • Hero Member
  • *****
  • Posts: 1031
Re: What does the TG-16 do?
« Reply #9 on: December 31, 2007, 08:36:51 PM »
Are the system cards like a BIOS for the CD unit?  Or are they just some kind of higher level software that can be used to control it?
Good Traders: nat+, The Old Rover+, bust3dstr8+, nectarsis, geepee+, Mithos, zeon, sensei+, Windancer, OldSchoolGamer
35/62 FX games owned - 56.4%
05/62 FX games reviewed - 8.0%
Latest: Pachio-kun FX review - 4/9/08

Kitsunexus

  • Hero Member
  • *****
  • Posts: 3911
Re: What does the TG-16 do?
« Reply #10 on: January 01, 2008, 07:44:02 PM »
Are the system cards like a BIOS for the CD unit?  Or are they just some kind of higher level software that can be used to control it?


According to this thread, they are both.

OldTurboBastard

  • Jr. Member
  • **
  • Posts: 99
Re: What does the TG-16 do?
« Reply #11 on: January 02, 2008, 05:31:41 AM »
Old Rover thanks for the info. I looked up POST that explains a few things
"I saw this wino, he was eating grapes. I was like, "Dude, you have to wait." - hedberg

Odonadon

  • Sr. Member
  • ****
  • Posts: 436
Re: What does the TG-16 do?
« Reply #12 on: January 02, 2008, 06:52:25 AM »
OldTurboBastard, that is one of the reasons. The PC also does a number of self-diagnostics on power-on, this is called POST. If you ever hear of anyone saying that their "computer failed post", that's what they're referring to. Old consoles don't have a POST step, nor do they have to spend time probing hardware, so they can start up immediately.

In addition, hardware such as hard drives need time to "spin up" to become ready to read, and this often takes a few seconds.  If your machine zipped through POST the Hard Drive wouldn't be ready to boot from.

Basically, the PC is a far more complicated piece of machinery than any console.  All XBox 360's are the same (more or less, depending on revision and model) whereas there's an unlimited number of software/hardware combinations for your PC to deal with.

OD
http://www.turbo2k.net - the truly Turboist of all Turbo sites.

ceti alpha

  • Hero Member
  • *****
  • Posts: 3835
Re: What does the TG-16 do?
« Reply #13 on: January 02, 2008, 07:51:39 AM »
What doesn't the TG-16 do?  8)



"Let the CAW and Mystery of a Journey Unlike Any Other Begin"

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21366
Re: What does the TG-16 do?
« Reply #14 on: January 02, 2008, 08:15:23 AM »
What doesn't the TG-16 do?  8)

Blast ProcessingTM
U.S. Collection: 97% complete    155/159 titles