It’s finally happening for real this time! Working behind the scenes with some community members, I decided to take an honest swing at an in-house PVB emulator at a full-time capacity. This will be my actual day job. So for the first time in history, I’m going to put my skills to work and produce some actual results. (-:
This community has always been amazing, and I have a good feeling about the emulator initiative going forward. The official project page can be found here:
http://perfectkiosk.net/
__________
So why should you care? Aren’t there Virtual Boy emulators out there already? Let’s see what the project page has to say…
The initiative has four primary objectives:
Nintendo 3DS Emulator
I’m sure most of us thought about Virtual Boy when we first heard about the Nintendo 3DS. A custom emulator specifically designed to run on 3DS can take full advantage of the system’s power and capabilities, giving us true stereo Virtual Boy on the go.Reverse Engineering
Any time we want to learn about how a game works or make changes to it, we need the right tools to dig in and take a look around. A cross-platform desktop application is just the ticket for providing the user with the right kit to expose all the deepest secrets buried within Virtual Boy software.TAS
The tool-assisted speedrun is a cornerstone of video game culture, and like reverse engineering, we need the right tools at our disposal in order to get the job done right. The aforementioned desktop application pulls double duty by bringing TAS-focused utilities to the party.Documentation
Comprehensive documentation of the Virtual Boy’s internals will come from emulator research, and it’s a perfect way for homebrew authors and modders to learn about the system’s features. Those who remember the Sacred Tech Scroll document I wrote can look forward to a brand new version of it.
For further reading of what exactly is planned, refer to the technical document trail on the project page.
__________
How exactly are we gonna pull this off? Glad you asked…
I have enough money in savings to begin work immediately (2018-04-18), but within a few weeks, I’m going to need to rely on financial support from the gaming community. We’ll be reaching out to other sites to gather support, since this undertaking spans a broader scope than what solely applies to Planet Virtual Boy.
A conservative estimate of my monthly expenses comes out to around $500 USD, and with enough interest, I’ll be able to keep this up full-time. By “full-time”, what I mean is 40 productive hours every single week, with status reports and a detailed outline of the development requirements. Planet Virtual Boy has its own developer working for it to make this dream come true. (-:
Donations are managed through a Patreon page:
https://patreon.com/GuyPerfect
__________
For now, this thread will be the place to be notified of progress and for general discussion of the initiative. Thanks again for being such a great community, and for giving me a chance to do what I really love. <3
Special thanks to Fire-WSP, STEREO BOY and KR155E for their assistance in getting the ball rolling.
--Guy Perfect
- This topic was modified 5 years, 7 months ago by Guy Perfect.
Guy Perfect schrieb:
Welcome to Guy Perfect Hour, where Guy Perfect talks to himself!
Great show! :thumpup: π
Sounds like a solid plan. Keep fighting the good fight!
Guy Perfect wrote:
This is a work post.Welcome to Guy Perfect Hour, where Guy Perfect talks to himself! Today on Guy Perfect Hour, we’re going to begin proper development on the emulator’s code base using the document we prepared earlier.
To Do – Week of April 23, 2018
This week’s goal is to start from scratch and produce the program code necessary to get back to where the most recent emulator build is. Why do that? Starting things from scratch multiple times helps me hone in on the best way to do it, and last time I did this I felt pretty good about how it went together.
β’ Establish an infrastructure for the Java emulation core.
Yes, the 3DS thing will be running on the C emulation core, but I’m going to focus on the Java code first. The reason for this is because it’s easier to develop/test and if the module’s structure needs to be changed, it’s easier to do that to only one module than two parallel modules.
Once the emulation implementation is up and running in Java, it will be a rather short task to move it over to C. Then the fun begins.
β’ Implement CPU operations.
All CPU operations except the instruction cache and floating-point instructions are targeted for this week. The instruction cache doesn’t affect a program’s execution, and I’m not aware of any commercial games that use floating-point instructions, so this should be sufficient to get existing software simulated.
The CPU accounts for something like 60%-70% of the entire emulation core.
β’ Implement disassembler, register list and memory controls for the GUI.
The GUI controls are all linked into the same debugger context, even if they’re not presented in the same window. Redoing them from scratch using what I learned before will make better versions of everything.
Splatoon 2 updates are traditionally dropped on Fridays, and the big honkin’ version 3.0.0 was announced for April. Since there was only one Friday left in April (today), I was thinking I could get my emulator stuff done by the end of the week, then do some Splatoon 2 stuff over the weekend.
But then they pushed the update on Tuesday night.
I’m one of the principal content managers at Inkipedia, the resident Splatoon wiki, and I had to shift my priorities a bit during the week to make sure everything got done properly. Website traffic jumped from around 7,000 visitors to 12,000 on Wednesday, and that’s a lot of people wanting to learn about new game features. In particular, I’m the one with all the fancy programs and tools to collect and process game information, so my attention was in high demand. (-:
For more information on the update, check out the Version 3.0.0 page.
Basically what this means is my weekend got pushed up three days. Instead, I’ll work through the weekend on the emulator thing and post my status on Sunday.
This is a work post.
I am having a blast. At first, the plan was to take the existing Java code and move it over into a new project, passing it through a mental filter to make sure everything is looking good. But then I started optimizing and refactoring and improving and… Well, the scope grew a bit larger than what I intended for the week.
Instead, I’m gonna add one more week for the same basic goals from last week. This isn’t the same as a missed deadline: what I’m doing is absolutely productive and under control. It’s just more in-depth than I originally thought I was going to do. But it’s all for the better.
As for what I’ve been up to…
β’ New Java base – I started a brand-new Java project from scratch, with the intention of reviewing the old files as I moved them over. I ended up doing it all again from the ground up. Once the improvements started becoming apparent, it suddenly became a lot of fun and I kept going with it. The new code is as good as it’s ever been.
β’ Emulation core – The Java application communicates with an emulation core context that this time is implemented as an interface rather than an abstract class. There’s a static factory method that will produce a valid emulation state for the application to work with. For now, it’s only backed by the generic Java implementation of the emulation core, but the final product will also have native modules on supported systems.
β’ Bus and CPU access – The emulation context interface supplies methods for accessing data from the simulated Virtual Boy state. You can read and write CPU registers as well as memory from the bus in any applicable format. Internal memory buffers and component functionality are automatically routed trough a simple mapping routine that ties the whole thing together.
β’ Debug accesses – The application is allowed to do things that the emulated program is not, and these are handled through special debug accesses. Any reads or writes that would have no effect on the hardware can have an effect when used in a debugging context. For example: storing new values in ECR, writing to ROM, and reading from the VSU are all possible as debug accesses.
β’ New disassembly – While implementing a new instruction decoder, I took a minimalist approach and used a simple, generic field for instruction operands. This necessitated gutting and rebuilding the disassembler class, which also saw the benefits of knowing what-all needed to get done. The implementations of both classes are far leaner and more concise than ever before, and I’m very pleased with it.
Going forward, I’m going to start up a new GUI project to get the Debugger and Memory windows up and running again. From the user’s perspective, it should look more or less like it did before, but the improvements on the back-end will make it so much more convenient and efficient as additional features are implemented.
Attachments:
Sounds like you’re covering some serious ground. Keep it up, man, it’s awesome!
Backed! Congrats and thanks for taking this project on. I had a lot of hope placed in Red Dragon but that never took off like we all hoped. PVB Emu sounds killer!
SmokeMonster wrote:
Backed! Congrats and thanks for taking this project on.
Awesome! Thanks again for everyone who has pitched in. For the month of April, we raised $137.34. Although I can’t live off of that, it’s still a great start considering all anyone had to go on was me saying “gimme moneys” and they believed in me. So all-in-all, this is a big win!
We should be playing games by the end of May, and hopefully be playing them on 3DS sometime in June. Expect it to get really interesting really quickly.
This is a work post.
Down to the wire! And that’s just how I like it. Normally I try to have my weekly duties done by end of day on Friday, but obviously this is end of day on Sunday, which is not Friday. When I got the GUI stuff caught back up to the point where I had it in the old project, I went on an improvement spree and made everything about a… a jillion times better than it was. I’m happy to report that everything I wasn’t completely happy with in the old code is no longer a problem in the new code.
Attached to this post is the .jar file of the current build (with the source code inside it). As expected, it looks about the same as the original build, but I can assure you that behind the scenes it’s vastly different and vastly superior.
There is also an image attached to this post. I will be referring to it henceforth…
File Menu
When you start the program, you’ll just get a big gray box and a menu bar. There are two options under File: Load ROM and Exit, and they do about what you’d expect. You can select any Virtual Boy ROM file, and it will attempt to detect incorrect files.
Once a ROM is loaded, the meat and potatoes of the user interface are displayed. There are four main panels, described below.
Disassembler – Upper left
The disassembler pane displays the game program from the perspective of the CPU, where each line is one instruction. A translation module in the project converts the machine code to human-readable assembly for your human viewing pleasure. There are literally dozens of configuration options in this module (debugger/Disassembler.java), but for the moment none of them can be configured with the front-end. The settings provided will display instructions using standard V810 conventions.
The hilighted line is the current value of the CPU’s program counter, which represents the instruction that will be executed next.
The Up and Down arrow keys will scroll the contents of the display one line at a time, and Page Up and Page Down will do so one “screen” at a time (the number of fully-visible lines). Additionally, the mouse scroll wheel can be used to navigate in this manner.
In contrast to most debuggers, there is no scroll bar in the disassembler. A scroll bar that covers an entire 32-bit memory range really isn’t usable, since even small movements can skip hundreds of megabytes at a time. I decided to leave it out, since I can’t find a good reason to put one in there.
In order to seek to a particular address, Ctrl+G will bring up a Goto prompt. By typing an address into this box and clicking Ok, the output of the disassembler will be repositioned to include the address you entered.
You can seek to the value of the program counter with Ctrl+P.
The second column of output is the binary data that contains the instructions’ bits, and for most purposes isn’t all that useful. You can toggle whether this bytes column is shown with Ctrl+H.
The F11 key is Single Step, which executes the instruction at PC, the hilighted line. Most CPU instructions are implemented and fully-functional, with the exception of floating-point and bit string instructions, as they require additional research before being implemented.
The F10 key is Step Over, which attempts to execute until the instruction immediately following the current instruction is reached. This is useful for skipping over function calls as well as breaking out of loops like the one very early on in the crt0 routine. In order to prevent endless loops from hanging the application, a limit of 20 megacycles is placed on this command, which will make it stop automatically after executing one second’s worth of CPU cycles.
Hex Editor – Lower left
The Hex Editor pane displays memory values on the bus as the CPU would see them if it were to perform a read operation. This is useful for examining and editing the memory in use by the simulated Virtual Boy software.
By default, no byte is selected for editing. In this state, the Up and Down arrow keys will scroll the contents of the display one line at a time. Page Up and Page Down will always scroll by one “screen” of lines. The mouse scroll wheel can also be used to navigate.
By clicking any byte value with the mouse, it will be selected for editing. In this state, the arrow keys will move the cursor around as expected. At this point, typing any hex digit will begin composing a new byte value at the selected address. After the first digit is typed, the temporary staged value is only that low digit, but by typing a second digit, a full 8-bit value is written into memory and the cursor is advanced to the next byte. In order to commit an edit after only one digit, press the Enter key.
To de-select the selected byte value and return to the default state, press the Escape key.
Ctrl+G will present a Goto prompt where you can type an exact address to seek to. In addition to navigating to that location, the byte at the specified address will be selected for editing.
Registers – Right-hand side
Both of the right-hand panes are for CPU registers. The top pane contains the special “system regsiters”, while the bottom pane contains the usual “program registers”. Any register with a “+” next to its name can be expanded by clicking on it, revealing additional controls.
The value of each register, shown next to its name, is displayed in a flat text box and can be edited directly with the keyboard by clicking it and typing into it. The new value is stored into the register either when the text box loses focus or the Enter key is pressed. Although any value can be entered, certain bits of certain registers cannot be written and this will be reflected in the value that is immediately displayed after editing.
Certain system registers represent multiple values that are packed into a 32-bit unit. By expanding these registers, the individual fields can be inspected and edited. The I field in PSW, and both fields in ECR, are text boxes that can be typed in. The remaining fields are 1-bit flags that are controlled via text boxes.
Although TKCW has bit fields that are displayed in the expanded controls, the register is in fact read-only and the expansion controls cannot be interacted with.
All program registers have options for representing the value in different presentation formats. The available formats are Hex, Signed decimal, Unsigned decimal and Float. When a particular format is active on a program register, the value displayed is in that format and any values entered with the keyboard will be processed as that format.
Debug Writes
Like I mentioned in last week’s report, I set up the new back-end to support “debug” accesses for read and write operations. This is useful for the person doing the debugging, as it allows for test situations that aren’t technically possible within the simulated software.
The debug accesses in use by the debugger are as follows:
β’ ECR is read-only to emulated software, but can be changed in the debugger.
β’ System register 31 provides the absolute value of the most recent value written to it, but the debugger can store any value.
β’ Editing ROM data in the hex editor will update the backing memory, even though the simulated software cannot write to it.
Known Issues
What appears to be a long-standing bug in Java is creating a layout error intermittently with no known cause. If, after you select a ROM to load, the window goes white or otherwise doesn’t display correctly, you’ll need to close the program and try again. Hopefully I can find out how to work around this issue, or maybe someone else can help track it down. Or maybe my RAM is going bad and that has something to do with it…
Wow this is awesome! Thanks for doing this!! Ok random question, but is emulating the virtual boy pushing the 3ds hardware to it’s limits? I’ve heard that the old 3ds can have a hard time emulating the SNES.. And from what I understand the VB is either as powerful or slightly more powerful than the SNES, right?
I know the New 3ds can handle super Nintendo with no problem (I have 2 new 3ds and have done it myself).
So would an emulator such as this have a harder time running on the o3ds?
I haven’t logged onto these forums in a long time, but thank you SOOOOOO much Guy!!! I’ve been DYING for a VB emulator on the 3DS and I’m really surprised there hasn’t been a good one released yet. You are doing the lord’s work.
I registered just to say THANK YOU, I have been thinking about this for years, the 3DS is perfect for VB-titles. I wish they would release a VB-collection. I don’t understand the technical stuff here, but would it be possible to make physical copies or a “everdrive” cartridge of some sort? I would LOVE to have some physical copies of VB games in my collection. Sorry if I sound stupid, I’m just dreaming. π
Reel Big Fish wrote:
Ok random question, but is emulating the virtual boy pushing the 3ds hardware to it’s limits?
It shouldn’t be an issue, but testing will tell for sure. While the vanilla 3DS’s CPU is only around ten times as fast as the Virtual Boy’s, emulated software generally isn’t running full-throttle during the entire frame interval. As long as it gets to its halt point/waiting loop in time on the 3DS, it will function just fine without issue, even if the exact number of simulated CPU cycles was less than the actual amount of time that went by.
As a bonus, there’s another CPU in the system that can be used to off-load certain tasks such as video processing and communications. So the faster processor can be dedicated to the simulation and the slower one can take care of auxiliary tasks.
Worse comes to worse, there’s always the recompiler option: take the Virtual Boy program code and transform it into genuine 3DS machine code that runs directly on the CPU. This vastly improves the performance of the simulated software, as most instructions are processed on a 1:1 basis, but the trade-off is that there’s more sophisticated infrastructure required to pull it off.
Either way it has to be done, it will be done. The 3DS is absolutely powerful enough to do anything the Virtual Boy can do, so it’s more a matter of making sure the simulated software turns into the right commands within the right time frame.
Raverrevolution wrote:
I’ve been DYING for a VB emulator on the 3DS and I’m really surprised there hasn’t been a good one released yet. You are doing the lord’s work.
My pleasure! I’ve been wanting to do this for years and years but never really had the opportunity. But benefiting from the support of people in the community can really make it happen, and I’m glad to be a part of it!
Teknodromen wrote:
I don’t understand the technical stuff here, but would it be possible to make physical copies or a “everdrive” cartridge of some sort?
Someone or other (UncleTusker maybe?) does complete-in-box reproductions of VB software, both commercial and unofficial. Not sure what they’ve got going on at the moment.
As for flash cartridges, you’re looking for MineStorm and his FlashBoy+ wizardry: link
This is a work post.
Right this moment, I’m sitting in front of the most progress I’ve ever made on this project. I can see what the CPU sees, and I can change registers and memory. It’s all fairly simple stuff (heck, it came together in a week), but it’s more than I’ve ever had in the past. At first it was trying to implement the emulation core with no real output for debugging, and then it was trying to figure out the best way to make a cross-platform GUI. But now… all of that’s been solved and new tech has been implemented. We’re about to dive into unswum waters!
What do you say we have us some graphics by the end of the week? That’d be cool, right?
To Do – Week of May 7, 2018
Do it all. All the video things. While the VIP is by a wide margin the most complex auxiliary system component, it’s still far simpler than the CPU, which is already implemented. It has maybe like, I dunno, 20% as much going on as the CPU, so this should come together pretty quickly.
β’ Document VIP operations in the Tech Scroll
The vast majority of the content of the Tech Scroll is the CPU, but in a distant second place is VIP. It has several individual things that need to be researched and documented, but all-in-all it amounts to little more than a bunch of [font=Courier New]struct[/font]s.
Last time I was looking into this, certain behaviors resulting from abnormal configurations of VIP data structures were… perplexing and difficult to describe. For the time being, I won’t be trying to nail down everything in minute detail, so be prepared to see several editor’s notes calling for additional research.
Up until now, revisions of the Tech Scroll have used fairly descriptive names for I/O ports and logical constructs. In particular, I despise the name “world” for describing the windowing functionality, but I think it’s better in the long run to use the official names where available. KR155E rejoices, but let the records show that I decided in this way for reasons not related to his objections!
β’ Implement a VIP debugger window in the emulator
I’m thinking a conventional tabbed dialog like other emulators have should be sufficient. There will be tabs for characters, background segments, objects, worlds, frame buffers, “current” (see below), the column table, palettes, miscellaneous (see below).
The characters tab will display all 2048 character patterns in a scrollable area with a selectable palette. They can be scaled to some degree (up to maybe 4x?), and clicking one will bring up its data in another panel for editing. The index, address and mirrored address of the selected character will be displayed.
The background segments tab will have a spinner for selecting or entering the index of a segment to display. The image itself will be displayed in a scrollable area with custom scaling. By clicking on a cell within the segment, the cell’s properties (character, flipping, palette, etc.) can be edited. The cell’s address will be displayed.
The objects tab will contain a spinner for picking a particular object, which is displayed in its appropriate position in a mock frame image. Its properties (character, flipping, palette, etc.) can be edited and its address will be displayed.
The worlds tab will contain a spinner for selecting a particular world, which is displayed fully-rendered in a mock frame image. Its properties (position, size, mode, etc.) can be edited and its address will be displayed. Additional controls for h-bias and affine worlds will be available where appropriate.
The “current” tab shows in a mock image what the next frame will look like when drawn, with all worlds fully rendered and layered according to their order. Individual worlds can be toggled on and off in the display. Various statistics regarding the scene will be presented, such as the number of worlds, characters and objects that are in use.
The column table tab contains… um… Honestly, I’ll need to think on this before deciding how to design it. For the time being, column table controls might just be relegated to the misc tab and edited per-column.
The misc tab contains all other VIP settings not included in any other tab. These include the version ID, palettes, brightness levels, interrupt status, the frame repeat setting, drawing and display status/control, frame buffer index and object groups.
β’ Create some simple test software
This is a homebrew VB program to run on the hardware for research purposes. It’s not a fully-fledged “VIP Workshop”, but it will allow modification of all element properties to inspect their effects on the VIP.
I haven’t been around at all but wow GuyPerfect, that’s quite a nice initiative to start a Patreon! I’ll try to spread the word around as well. π
Guy Perfect wrote:
This is a work post.Right this moment, I’m sitting in front of the most progress I’ve ever made on this project. I can see what the CPU sees, and I can change registers and memory. It’s all fairly simple stuff (heck, it came together in a week), but it’s more than I’ve ever had in the past. At first it was trying to implement the emulation core with no real output for debugging, and then it was trying to figure out the best way to make a cross-platform GUI. But now… all of that’s been solved and new tech has been implemented. We’re about to dive into unswum waters!
What do you say we have us some graphics by the end of the week? That’d be cool, right?
Oh Guy! How many iterations of the graphics code have you managed in the past? You know it always takes a few whacks at it.
To Do – Week of May 7, 2018
Do it all. All the video things. While the VIP is by a wide margin the most complex auxiliary system component, it’s still far simpler than the CPU, which is already implemented. It has maybe like, I dunno, 20% as much going on as the CPU, so this should come together pretty quickly.
β’ Document VIP operations in the Tech Scroll
The vast majority of the content of the Tech Scroll is the CPU, but in a distant second place is VIP. It has several individual things that need to be researched and documented, but all-in-all it amounts to little more than a bunch of [font=Courier New]struct[/font]s.
Last time I was looking into this, certain behaviors resulting from abnormal configurations of VIP data structures were… perplexing and difficult to describe. For the time being, I won’t be trying to nail down everything in minute detail, so be prepared to see several editor’s notes calling for additional research.
Up until now, revisions of the Tech Scroll have used fairly descriptive names for I/O ports and logical constructs. In particular, I despise the name “world” for describing the windowing functionality, but I think it’s better in the long run to use the official names where available. KR155E rejoices, but let the records show that I decided in this way for reasons not related to his objections!
“Graphical elements are arranged into Windows, known in some circles as “worlds”, which themselves are arranged on the screen and can overlap with one another. The contents of Windows consist of the other types of graphical elements and various effects like clipping regions (analagous to “scrolling” on other systems) and affine transformations are available.” <- This is how the tech scroll reads right now. As you're rewriting the VIP portion of the tech scroll, make sure to switch over to KR155E and community's terminology.
β’ Implement a VIP debugger window in the emulatorI’m thinking a conventional tabbed dialog like other emulators have should be sufficient. There will be tabs for characters, background segments, objects, worlds, frame buffers, “current” (see below), the column table, palettes, miscellaneous (see below).
The characters tab will display all 2048 character patterns in a scrollable area with a selectable palette. They can be scaled to some degree (up to maybe 4x?), and clicking one will bring up its data in another panel for editing. The index, address and mirrored address of the selected character will be displayed.
The background segments tab will have a spinner for selecting or entering the index of a segment to display. The image itself will be displayed in a scrollable area with custom scaling. By clicking on a cell within the segment, the cell’s properties (character, flipping, palette, etc.) can be edited. The cell’s address will be displayed.
The objects tab will contain a spinner for picking a particular object, which is displayed in its appropriate position in a mock frame image. Its properties (character, flipping, palette, etc.) can be edited and its address will be displayed.
The worlds tab will contain a spinner for selecting a particular world, which is displayed fully-rendered in a mock frame image. Its properties (position, size, mode, etc.) can be edited and its address will be displayed. Additional controls for h-bias and affine worlds will be available where appropriate.
The “current” tab shows in a mock image what the next frame will look like whendrawn, with all worlds fully rendered and layered according to their order. Individual worlds can be toggled on and off in the display. Various statistics regarding the scene will be presented, such as the number of worlds, characters and objects that are in use.
Guy, you can do it! This would be a huge boon to VBDE and it’s sprite engine.
The column table tab contains… um… Honestly, I’ll need to think on this before deciding how to design it. For the time being, column table controls might just be relegated to the misc tab and edited per-column.
The misc tab contains all other VIP settings not included in any other tab. These include the version ID, palettes, brightness levels, interrupt status, the frame repeat setting, drawing and display status/control, frame buffer index and object groups.
I know it’s blasphemy, but it wouldn’t even be the end of the world if the column table wasn’t fully emulated. Like, what good is it anyways? There’s a standard column table that seems to do a good job evening out all the pixels out over the fluttering LED mirrors.
β’ Create some simple test software
This is a homebrew VB program to run on the hardware for research purposes. It’s not a fully-fledged “VIP Workshop”, but it will allow modification of all element properties to inspect their effects on the VIP.
Let’s see if you can get graphics emulated within a week AND then a home-brew demo! Next step looks like VSU, and then busses?
What if the PC emulator could make copies of raw rom & ram data: graphics, instructions, registers and interrupt routines? Let the user edit the code or graphics and then save out a usable home-brew resource.
Hey, some actual feedback and discussion… I don’t know what to do! (-:
Before anyone gets disappointed on Friday, it’s looking like this week will only have documentation to serve up. Between researching specs across multiple sources, formatting and rewriting a document and producing testing software, it’s taking longer than I would have liked. But it’s gotta be done, and I need to make sure that everything in the Tech Scroll is 100% accurate.
As of the time of this post, I’ve put all my current additions to the Tech Scroll up on the project page. You can review it here:
http://perfectkiosk.net/stsvb1.html
A fair chunk of the VIP stuff is in there now, so if anyone in the know could take a look at it and let me know what you think, that’d be swell.
DaVince wrote:
I’ll try to spread the word around as well. π
Excellent, and thanks! This is gonna be the key to the project’s ongoing success.
Yeti_dude wrote:
How many iterations of the graphics code have you managed in the past? You know it always takes a few whacks at it.
That’d be approximately zero. However, compared to CPU operations, the VIP is soooooo simple. Just configure some structs in memory and draw a picture with them. It’ll take a fair amount of planning to do it right, but I don’t see spending more than maybe a day on that.
Yeti_dude wrote:
As you’re rewriting the VIP portion of the tech scroll, make sure to switch over to KR155E and community’s terminology.
Once again, I really want to stress that this isn’t “the community’s” terminology, but Nintendo’s, and that’s the only reason I’m using it. I don’t like certain things about it (use of the word “world” makes no sense, something named DPSTTS surely isn’t called “Display Control Read Register”, etc.), but it all needs to be as official as possible to be done correctly.
Yeti_dude wrote:
[Regarding the VIP debugger window] Guy, you can do it! This would be a huge boon to VBDE and it’s sprite engine.
Could you elaborate on why you feel this would be so helpful? I’m interested to know the thought processes of other developers. I’ve generally been able to visualize my graphics when doing my own software, but I’m not the best case study.
Yeti_dude wrote:
I know it’s blasphemy, but it wouldn’t even be the end of the world if the column table wasn’t fully emulated. Like, what good is it anyways?
For the sake of accuracy I’d like to implement it eventually, but it’s a rare case a game system being able to modify not just pixel colors, but pixel dimensions as well. I’m not especially worried about it right now, since I don’t know of any software that ever changes the column widths.
Yeti_dude wrote:
Let’s see if you can get graphics emulated within a week AND then a home-brew demo! Next step looks like VSU, and then busses?
The software I’m using to research the VIP is extremely basic and not worthy of release. It’s literally just this:
Enough to get the information I need, but not fancy by any stretch of the imagination. The only reason VSU Workshop and CPU Workshop came into being was because I needed comprehensive control over those subsystems and it made sense to make them presentable. So I’m sorry to say, no VIP Workshop this time. (-:
The memory bus was the first thing I implemented, since the CPU requires it for fetching instructions and loads/stores. The source file vue/JavaVUE.java contains generic implementations for read and write methods, which the CPU module uses during its internal operations. Those methods are responsible for routing accesses to the appropriate hardware components, and adding, for instance, VIP support is a simple matter of just putting a line in there to tell it where to forward the access request.
Next step is probably going to be the game pad. I’d like to see things operating sooner than later. (-:
Yeti_dude wrote:
What if the PC emulator could make copies of raw rom & ram data: graphics, instructions, registers and interrupt routines? Let the user edit the code or graphics and then save out a usable home-brew resource.
I’ve considered a “Save ROM” command since the debugger window will eventually have assembler functionality, but beyond that it’s a tricky matter to automatically re-pack things like graphics data back into a ROM image. But don’t let the dream die here! Keep the ideas coming, because this is a community effort after all!
Attachments:
This is a work post.
Aaaaand there goes a week, entirely to documentation. The CPU stuff, despite being like two and a half times as long, came together more quickly because the available literature was complete and accurate. The VIP stuff, not so much. I had to do a lot of testing on the hardware, and cross-referenced three different sources through it all, but I made due.
New content has been added to the work-in-progress draft of Sacred Tech Scroll v1.0:
http://perfectkiosk.net/stsvb1.html
New content includes the following:
β’ System memory map with details on various address ranges and the nature of the pseudostatic WRAM
β’ ROM Format, including Nintendo’s game header and V810’s exception handlers.
β’ Game Pak, which is the official name for those cartridges we all know and love.
β’ Updated System Reset section to account for new document content.
β’ Redlinks to ghosts of the sections yet to come!
Did I forget anything? I think that’s it–OH WAIT, there’s this:
β’ The VIP stuff. All the VIP stuff!
I painstakingly tested every scenario I could think of in order to determine the proper format and behavior of every little thing in that video unit. I ran across many inaccuracies in the emulator I was using, which made testing a bit tricky, but there was a will and therefore a way.
At long last, now I can begin work on video stuff in the emulator. This is going to be the part in the project where it all looks like it’s coming together, and I can’t wait.
This is a work post.
Time for some vidja GUI stuff. This week’s task is already outlined in yonder post intended for last week, but the research and documentation effort went all the way up until Friday so I didn’t get a start on it yet. But now I shall.
We’re gonna have graphics this week, bois!
This is a work post.
Here comes Tenerence Love with an R&D break! Progress on the VIP debugger window is going great, but before I go any further on it, I need to get all my ducks in a row or else face the reality of a bogged-down, ham-fisted kludge of an implementation. And no one wants that.
Progress So Far
The interface for the Characters tab is all done and lookin’ snazzy:
On the right is a list of all 2,048 character patterns currently in CHR RAM. They can be displayed at a configurable scale and palette.
One character is always the focus of attention, which is displayed with jumbo proportions in the top-left corner. It has an index and an address, as well as an address mirror that you can read about here. All three of those controls can be edited by the user in order to select the character they’re most interested in. You can also just click on it in the list on the right if you can find it.
The Scale slider affects the size of the list of characters over on the right-hand side. In the image, they’re being displayed with a scale of 3Γ.
One of nine palettes can be selected, which is applied to every character in the window. The four BG palettes, four OBJ palettes and a generic palette can be used. The generic palette is a conventional red gradient that is useful for identifying the exact pixel values as well as previewing patterns while the brightness settings are all black (which is the case in Wario Land’s startup screen). The exact colors being displayed for each pixel value are shown as large squares below the palette combo box.
You’ll notice one of the shades of red is selected and that there is a smiley face inside the “O” of “IMPORTANT”. That’s because this interface allows the user to modify the contents of character memory visually at runtime.
Keen observers will note that the black pixels in the output are not fully black: they are a wee bit translucent to let the background window color show through a little bit. This is because black is a valid color for palette entries, so it’s necessary to be able to distinguish between black pixels and empty pixels. I tried drawing no color at all for empty pixels, but red on light gray looks very very bad.
The Hold-Up
So if things are going so swimmingly, what’s the problem? Well, there’s no problem. Yet. And I would like that there never is one, so I need to do some research to determine a satisfactory solution to the upcoming design challenge…
Java has a feature-rich 2D graphics infrastructure that offers hardware acceleration for things such as drawing and filling paths with textures and gradients, or painting image contents, all of which can be transformed and displayed at arbitrary scales and orientations. However, all that fanciness is not well-suited for the type of graphics work being done here, where volatile pixel patterns are used to construct larger images.
Ideally, when drawing images in Java, the contents of the images need to be static so that the JVM can cache them efficiently in order to make the most effective use of the hardware. If the images keeps changing, which is the case for characters in Virtual Boy video memory, that cached data is quickly invalidated and more time winds up getting spent on the caching process than the drawing process by the time it’s all said and done. That’s the problem: the usual Java approach won’t work here.
Granted, the official JVM is also very smart and should be able to optimize image memory performance based on how it’s being used. I don’t know for sure if that’s the case, but even if it is, there are still challenges going forward with regards to composing larger images with character data. Background maps and worlds (namely affine worlds) need to be able to sample from character memory arbitrarily, putting me in a situation where all of the rendering gets done in software in the end regardless. And while that is an option, I’d like to come up with a way to solve both problems with one… stone.
What I would like to do is fairly simple in OpenGL:
β’ Supply the rendering system with one image containing all character patterns in a 2bpp format
β’ Sample from any location of any character with or without flipping
β’ Apply a 4-color palette to the character samples
β’ Apply transformations to source coordinates in order to sample from normal, H-bias or affine backgrounds
From what I’ve seen so far, this should be doable in Java, although it requires me implementing my own Raster objects among other things. I don’t know how long I’ll spend working on this (shouldn’t be more than a couple days), but I can’t progress with the VIP debugger until I sort it all out.
Stay tuned! This thing keeps on getting better.
Attachments: