BIOS Questions
#1
Hey there, PCSX2 community!

Let me start off by saying, I have read the forum rules and I am NOT asking for a BIOS, where to get one, or anything of that nature, I'm here asking...

What is the use of the BIOS file in emulation?

I know that most, if not all emulators require a BIOS file to function, and in the case of PCSX2, I have found that it doesn't matter which region BIOS you use, it all works identically. From a purely technical view, what is the use of a BIOS in the programming and/or function of an emulator?

Thanks for your time, Internet. I love you <3
Reply

Sponsored links

#2
let's say it's the equivalent of your comp's OS.
Most of the time, it's a copyrighted soft made by the manufacturer.
CPU : AMD Ryzen 7 3800X
Mobo : Asus PRIME B450-PLUS
GPU : NVIDIA GeForce RTX 3070
RAM : 16 Go
Reply
#3
Right... So it's a file with a list of instructions and software that the developers created to add a barrier between hardware and the application? So it's like a file containing instructions for the game so it can interact with the hardware? From what I understand of Emulation.. (I'm a novice programmer, learning as much as I can!) The program is written to SIMULATE the native environment of the PS2, a program that acts like the EE of the PS2, but in actuality is just a program. Does the BIOS instruction set still function in the same way, sort of "translating" the game into EE code, somewhat? ^___^" Just curious, I want to know!

<3
Reply
#4
It is a good question. I do not know what it does. My guess
-> start the console (hence the, probably bad, name bios). With a bootloader I guess
-> in game, I will say interrupt management, RAM management. And stuff like that.
-> extra feature, stuff you use when there is no game.

The bios is a program like any games, so it is executed by the emulator. Except it does the interface between HW and game. Kind of a drivers actually.

PS: pcsx emulator have a free bios implementation of the ps1. Maybe you could read the source.
Reply
#5
Yeah that's what I thought it might be... Kind of like a driver for the game to actually communicate and interact with the hardware the way it should. Whilst that does sound good, gregory, and I have no doubt you're right since it sounds about right, I'd love to hear what some Devs have to say about it, because I'm really getting into C++ and coding, emulation in particular interests me, and I was wondering what it's purpose in the emulation process is. Smile I wonder if there are any devs about... Or anyone with some major experience.

+rep, gregory Laugh
Reply
#6
The way I'd think of it (simplified a bit) is that when you turn the ps2 on, it copies a rom chip into memory, and then executes the code at a specific spot in memory. The bios file is the result of then copying that area of memory back out into a file. (Which is why it's illegal to distribute it)

The program that runs when it executes that is part of that file, but my impression is that it has all the low-level routines programs execute for interacting with the hardware, and probably all the various base libraries they use. (And this is hardly exclusive to the ps2, which is why you see it on other emulators as well. The old 68k macs had pretty much the whole mac api on a rom on the motherboard, and if you ever had a tandy color computer or similar computer, the version of basic it used was on there [and on the color computer 3, a picture of the developers. ^_^]).

You can see why it'd be critical for the emulator, though. Otherwise, you'd have to map all the calls to that area of memory, figure out what the routines being called did, and emulate that. Which would be very difficult to do, especially since it'd have to be a clean reverse engineering of it.

And it's not absolutely identical. As I recall, the bios file for a slim ps2 isn't capable of hard drive emulation, for example.

Anyways, hopefully that gives you a bit of a better idea...
Reply
#7
Ahhhh arcum42, that's EXACTLY what I wanted to hear. That made perfect sense and I can completely understand why that would be an illegal file to distribute, yet incredibly vital.

Sadly no, I wasn't privelaged enough to come into contact with the old 68K Macs, or anything of the sort really. I'm only 19, and whilst i've been interested in coding and the technical side of computing since I was about 6, I haven't had much experience with anything other than home PCs.

Yeah I thought it would be something major in steps up like that, from Phat to Slim, but from what I understand the different revisions of the Phat bios (1.00, 1.60, 2.00) barely differ in any way, if at all, along with their performance and capabilies across regions (EU, USA, and Japan).

You've been a MEGA help, arcum42! :3 one last question I have is, is there anything or anywhere you would recommend I look into for guidance on my path to coding? Smile I have a novice understanding of C++ and am still learning as I have been for a while, but where did you start? :] What would you suggest? ^___^- ;3
Reply
#8
In the case of the PS2, and all other consoles and hand-helds that have been released since, the BIOS does a lot more than just provide an interface between programmer and console hardware. The PS2 BIOS provides a number of high level utility functions, for example:
  • Multi-threading management
  • VIF programming tools (packing and unpacking data for fast SIMD-style processing)
  • Graphic Synthesizer (GS) programming tools, for building and uploading geometry.
  • Networking tools.

Most of these things are fairly complex, and they don't necessarily have any direct interaction with the hardware.

When you get to PS3/Wii generation of consoles, the BIOS is replaced by "firmware", which is the same basic thing except renamed to help clarify that its scope of influence/use far exceeds just hardware interfacing and input/output systems. As a general rule of thumb, firmware is also housed on flashable rom, which means that it can be easily upgraded over time.

(10-05-2010, 01:03 PM)thomasudesu Wrote: Yeah I thought it would be something major in steps up like that, from Phat to Slim, but from what I understand the different revisions of the Phat bios (1.00, 1.60, 2.00) barely differ in any way, if at all, along with their performance and capabilies across regions (EU, USA, and Japan).

Yeah, in any of the older generation consoles, the BIOS underwent few changes between revisions. The reason is that games would all still want to be able to run on old hardware anyway, and since the ROMs on PS2's isn't flashable, old hardware can't upgrade itself to new firmwares like the new consoles can. Therefore, there wasn't much point to adding anything to the BIOS in later-built PS2s anyway; no one would want to use that stuff even if they did add new features.

So the only differences between BIOS revisions is typically either minor bugfixes/optimizations, or maybe some differences in how the BIOS interfaces with the PS2 hardware and/or synchronizes activity between its dual-CPU design (EmotionEngine and IOP CPUs run in parallel and must talk to each other to trade data back and forth as needed).


Quote:one last question I have is, is there anything or anywhere you would recommend I look into for guidance on my path to coding? Smile I have a novice understanding of C++ and am still learning as I have been for a while, but where did you start? :] What would you suggest? ^___^- ;3

Someone else should answer that question. I've been coding too long to remember where I started anymore. All I remember for sure is that I was a terrible coder for the first 6-8 years of my coding 'career' (which started when I was 13), and I was a sub-par coder for the next 8 years after that. I didn't get to the point where I could write code that actually works on machines other than my own until I was like 27. Glare
Jake Stine (Air) - Programmer - PCSX2 Dev Team
Reply
#9
No problem. I started programming on a Color Computer 2, and did have 2 68k Macs. One of which is still in my closet, actually. I read a lot of Mac programming books a long time ago, too, which covered the rom on a 68k mac. (Besides having used an emulator named Basilisk II before...).

As far as rom revisions, figure most of them were probably to account for hardware changes, and fix bugs. At a guess, the routines to detect a hard drive probably just were removed on the slim, since they weren't being used. (Couldn't say for sure, though. My ps2 is a fat ps2.)

As far as your path for coding, depends whether you are looking more at coding in general, or emulator coding.

For the latter, you might read this thread. (There's a rather interesting pdf that I linked to on the first page):
http://forums.pcsx2.net/Thread-How-to-write-an-emulator

As far as coding in general, first thing is that the best way to learn coding is by doing it. Books help, but practical experience can't really be beat. I'd say to come up with a few ideas for small programming projects to code. Generally, simple and expandable would be a good way to go. If you start with something really complex, you'll likely end up either abandoning it, or having to rewrite it from the ground up several times as your code improves. (Though that's likely to happen anyways, to some extent, as you get more familiar with your project.)

For example, you could write a program that plays an mp3, then add in a playlist you can play files from and a simple interface, and keep adding features until you get tired of it and/or have a full-featured mp3 player. There are a lot of things you can write. The key is just to do it in small, approachable steps.

Also, find open source programs that interest you, and look at the source code to see how they are written. Tinker with the code, and see if you can improve them or add features. (Though keep in mind that they won't always be good examples of how to code. ^_^). If you are interested in roguelike games at all, Angband's code has been hacked by a million people...

Once you get down one programming language, you may want to learn others. Each programming language has it's own way of approaching things, and that will carry over, to some degree, to the other languages you already know. (The flip side, of course, is that you may end up knowing a bunch of languages, but not being that experienced at any of them. I'm good at that, unfortunately...). Picking up new languages actually gets easier after a few languages, because there are a lot of similarities between them. [I personally like the programming language Ruby, but your mileage may vary.]

There have been a few threads about programming in the Developer and Chatterbox forums, too. Like this one:
http://forums.pcsx2.net/Thread-Envisioning-in-C

You might want to have a few projects going, too, so that if you get burnt out on one, you can switch gears and work on another. That way you don't get rusty. (Though the pitfall there is that you can end up with a dozen unfinished projects sitting on your hard drive.)

I'm sure I'm missing things, but that's what comes to mind at the moment...
Reply
#10
Thank you both so much ^_____^ I've been wanting to know where to start coding for years, I remember back in Year 7 (First year of high school, not sure what you Americans call it ;D) I picked up a book on how to program a Linux kernel, and was fascinated by just how deviously complex, yet simultaneously simple everything was. I think tomorrow I'm going to have to majorly scour those two links, and start work on some simple programs like you suggested.

Really thank you so much for your extensive replies and the depth to which you've answered my questions, you've both given me a major boost on my way to being a programmer. <3 ;D
Reply




Users browsing this thread: 1 Guest(s)