Riding the open bus

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
deadbody
Posts: 37
Joined: Thu Oct 30, 2008 8:11 pm
Location: Nashville, TN
Contact:

Re: Riding the open bus

Post by deadbody »

From IRC:
<pino_p> Anybody with a top-loader (HVC-001, HVC-101, or NES-101) and either an EverDrive or a single-game flash...

I have results from HVC-101 and the "Video Racer Video-Game".
Attachments
Video Racer Video-Game
Video Racer Video-Game
AV Famicom (HVC-101)
AV Famicom (HVC-101)
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Riding the open bus

Post by tepples »

All had the expected values for PPU readback (00 FF) and APU open bus (40 40 3F).

Code: Select all

NES-101
PPU latch: 3F 3F 3F 3F 37
1P:  40 A4 41 A5  ...00.0S
2P:  40 A0 40 A0  ...00000

Video Racer Video-Game
PPU latch: 3F 3F 3F 3F 3F
1P:  40 B8 40 B8  .....000
2P:  40 A0 40 A0  ...00000

HVC-101
PPU latch: 3F 3F 3F 3F 0A
1P:  40 B8 40 B8  .....000
2P:  40 A0 40 A0  ...00000
This is with a controller plugged into the NES-101, but no controller plugged into the others, per confirmation in #nesdev. Thanks for the report.

Does the HVC-001 (RF) behave the same as the HVC-101 (AV)?

Because the standard controller has three different appearances, I'm going to guess that the controller variant is the same as the one that shipped with the console:
  • If open bus on $4016 D2 then turn NES controllers into dogbones
  • If open bus on $4016 D3-D4 and both D0 are NES controllers then turn them into RF Famicom controller I and II
  • If open bus on $4016 D3-D4 otherwise then turn NES controllers into dogbones
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Riding the open bus

Post by tepples »

I added controller detection, which worked for me. But as I expand this into the controller test that it was always intended to be, I'm not sure what all I'll be able to fit in 64 kbit.
Attachments
allpads-r6.zip
(50.65 KiB) Downloaded 881 times
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Riding the open bus

Post by lidnariq »

I don't see any reason to worry about that bridge until you cross it. IMO, really the only reason to support my goofy flashcart is that "I'm usually responsive and it's what I have"—it's not really a good reason to prioritize its functionality.

Rev6 works ok for me.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Riding the open bus

Post by tepples »

Moving right along. After looking through R6 to see what I could cut, I noticed that I had left a duplicate copy of the instructions for interpreting low-level results in lowlevel.s. I cut that out and added input tests for several controllers: NES controller, Famicom controller 2 with microphone, Super NES controller, Power Pad, and Four Score. Tests for the analog controllers will follow in a later version.
Attachments
screenshots.png
screenshots.png (9.36 KiB) Viewed 20808 times
allpads-r7.zip
(56.58 KiB) Downloaded 889 times
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Riding the open bus

Post by tepples »

I just bought a U-Force on eBay to see if IR proximity detection is as dumb as the other I.R.

Image
I.R. Baboon from Cartoon Network's I Am Weasel


While waiting for it to arrive, I added tests for Super NES Mouse, Arkanoid Controller, and Zapper. And the plain version (without AA font, controller pictures, or full low-level instructions) still fits in 7.5K ($FDC4-$FFF9 unused). This includes multiplication and square root so that I can calculate speed and acceleration magnitude, BCD to report the results as 3-digit numbers, and the same peak following that I put in Vaus Test.
Attachments
screenshots2.png
screenshots2.png (5.47 KiB) Viewed 20769 times
allpads-r8.zip
(63.51 KiB) Downloaded 876 times
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Riding the open bus

Post by Pokun »

This is a very cool program, I like it!
OK here are my test results:


Red & White Famicom (HVC-001):
Main board: 1984 HVC-CPU-07
CPU: RP2A03E (Looped noise works)
PPU: RP2C02E-0 ($2004 is write only, Micro Machines has graphical glitches for this reason)

Everdrive N8:
OS 15, BIOS 5, CPLD 1

All Pads R8 Low-level controller port results:

Code: Select all

PPU readback
     00 FF 00 FF 00 FF 00 FF
PPU latch
              3F 3F 3F 3F 3F
APU open bus
                    40 40 3F
Only built-in controllers:

Code: Select all

      4L 3L 4H 3H D76543210
1P:   40 B8 41 B9  .....00S
2P:   40 A0 41 A1  ...0000S
Famicom Dogbone (HVC-102) in exp port (home-made adapter, D1):

Code: Select all

      4L 3L 4H 3H D76543210
1P:   40 B8 43 BB  .....0SS
2P:   40 A0 41 A1  ...0000S
Capcom Power Stick Fighter (CPS-A10CA) in exp port (included adapter):

Code: Select all

      4L 3L 4H 3H D76543210
1P:   40 B8 43 BB  .....0SS
2P:   40 A0 41 A1  ...0000S
Zapper (NES-005) in exp port (home-made adapter, D4 & D3):

Code: Select all

      4L 3L 4H 3H D76543210
1P:   40 B8 43 B9  .....00S
2P:   48 A8 49 A9  ...0100S
All Pads R8 normal interface:

Only built-in controllers:
Family Computer detected
1P D0 Famicom Controller
2P D0 Famicom Mic Controller
All buttons on both controllers works including controller II mic.

Famicom Dogbone (HVC-102) in exp port (home-made adapter, D1):
Family Computer detected
1P D0 Famicom Controller
1P D1 NES Controller
2P D0 Famicom Mic Controller
All buttons works.

Capcom Power Stick Fighter (CPS-A10CA) in exp port (included adapter):
Family Computer detected
1P D0 Famicom Controller
1P D1 Super NES Controller
2P D0 Famicom Mic Controller
The CPS-Fighter shows buttons L, R, X and A as always pressed. All the other buttons: Up, down, Left, Right, Select, Start, B (remapped to A on the controller) and Y (remapped to B) works like normal. The CPS-Fighter is a SFC controller that comes both with a SFC cable and a Famicom exp port cable, so it remaps B and Y to A and B when using the Famicom cable.

Zapper (NES-005) in exp port (home-made adapter, D4 & D3):
1P D0 Famicom Controller
2P D0 Famicom Mic Controller
2P D4-3 Zapper
I have no CRT to test the Zapper on at the moment but the trigger works (PullTime changes when holding trigger).


I wanted to try the Dogbone controller in D2 as well but it seems I must have made a mistake when I made the NES to EXP port adapter. It doesn't work in any games either, so it's not All Pad's fault. Also I wanted to try unplugging the built-in controllers to test if it detects that, but it's a pain in the butt to do since you have to unscrew a bunch of screws and the plugs on the PCB are hard to unplug. I might try it later sometime though.

Edit: Fixed typos.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Riding the open bus

Post by tepples »

Except for the CPS Fighter, all results were as expected. Thanks for the confirmation.

I own a Capcom Fighter Power Stick, which I take to be the U.S. version of the CPS Fighter. It doesn't have a DA15 for Famicom or a 7-pin cord for NES, but it does have a 7-pin cord for Super NES. I'm using it on my NES through a Super NES to NES cable provided by Infinite NES Lives, and all buttons work as expected. Try plugging the Super Famicom side of your CPS-Fighter into your Famicom's exp port through a homemade adapter that goes to D1.

A normal Famicom controller's report is as follows:

Code: Select all

AB-+udlr 11111111 11111111...
A normal SFC controller's report is as follows:

Code: Select all

BY-+udlr AXLR0000 11111111...
Based on the evidence you've presented so far, the CPS Fighter appears to be doing this:

Code: Select all

BY-+udlr 11110000 11111111...
The 0000 in the low nibble of the second byte triggers detection as SFC, but AXLR are on so that programs using a certain method of DMC glitch avoidance (rereading only when Right is pressed) know when to stop reading. I could make a second tool that displays each serial line's raw report to absolutely confirm this, but if no "standard" controllers are connected, how will the user choose which line to view?

"D2" won't work. It needs to be $4017 D1 for games to recognize it. Was that your mistake?
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Riding the open bus

Post by Pokun »

I kind of hoped that the CPS-Fighter would show different results. It behaves differently from normal SFC controllers, for example it doesn't work in my SFC multitap (the one that is shaped like Bomberman's face) and I also had problems with it in the past when I tried to use it in my Famicom homebrew I made (I eventually got it to work by improving the controller reading routine, I still have no idea why it didn't work though).

I guess it's time to build a Super Famicom Controller to Famicom Expansion Port Adapter then. I have a spare SNES controller extension cord I can use, but it's missing the Data 3 and 4 pins, they don't seem to be used by the mouse or standard controllers though.
I couldn't find a schematic, but judging from the info from the wiki, I guess it should be wired like this if I want to use two SFC controllers or mouse:

Code: Select all

Controller 1:

 Famicom EXP Plug
      oooo oooo  <-GND
 +5V-> ooooooo|
       ||||   |
       ||\/   |
       ||/\   |
       ||||   |
 +5V->|OOOO|OOO) <-GND

 Super Famicom/NES Controller Port 1 (female)



Controller 2:

 Famicom EXP Plug
   +---+
   |   |
   |  oooo oooo
   |   ooooooo|
   |   |  |  ||
   |   |+-/--+|
   |   ||/    |
   |   |||    |
   |  |OOOO|OOO)
   +------+
 Super Famicom/NES Controller Port 2 (female)
I could make a second tool that displays each serial line's raw report to absolutely confirm this, but if no "standard" controllers are connected, how will the user choose which line to view?
I don't understand the question, but usually when there are multiple possible scenarios, I just add options to manually pick all possible combinations in the interface.
"D2" won't work. It needs to be $4017 D1 for games to recognize it. Was that your mistake?
Ah yes by D2 I really meant D1 of $2017. It's called DATA(2) on this schematic (the EXP pinout is that of the port side) that I followed when I built it years ago. I tested the pin with a multimeter just now and it appears I have accidently wired it to pin 11 of the DB-15 port instead of pin 7 for some reason. The Zapper worked in the second NES port though, so I guess it doesn't use the con 2 data pin.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Riding the open bus

Post by tepples »

Pokun wrote:
tepples wrote:I could make a second tool that displays each serial line's raw report to absolutely confirm this, but if no "standard" controllers are connected, how will the user choose which line to view?
I don't understand the question, but usually when there are multiple possible scenarios, I just add options to manually pick all possible combinations in the interface.
But what would the user press to select from among these "options to manually pick all possible combinations in the interface"? If you have "funny" controllers plugged into both ports of an NES Control Deck, where by "funny" I mean not a superset of the NES-004 controller, controller 1 isn't necessarily readable.
Pokun wrote:The Zapper worked in the second NES port though, so I guess it doesn't use the con 2 data pin.
Zapper uses D4 (trigger) and D3 (light).
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Riding the open bus

Post by Pokun »

If anyone can confirm that my above-posted schematic of SFC Controller -> FC EXP Port Adapter is correct, I'd be very greatful.
tepples wrote:
Pokun wrote:
tepples wrote:I could make a second tool that displays each serial line's raw report to absolutely confirm this, but if no "standard" controllers are connected, how will the user choose which line to view?
I don't understand the question, but usually when there are multiple possible scenarios, I just add options to manually pick all possible combinations in the interface.
But what would the user press to select from among these "options to manually pick all possible combinations in the interface"? If you have "funny" controllers plugged into both ports of an NES Control Deck, where by "funny" I mean not a superset of the NES-004 controller, controller 1 isn't necessarily readable.
Oh I see, if the user has an unreadable controller the only way of input is the reset button I guess. You are already using that for that purpose, couldn't you just display all raw data on that low-level screen thingy?
tepples wrote:
Pokun wrote:The Zapper worked in the second NES port though, so I guess it doesn't use the con 2 data pin.
Zapper uses D4 (trigger) and D3 (light).
Yeah no wonder. Gotta rip the adapter appart and start all over again when I have time.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Riding the open bus

Post by tepples »

Pokun wrote:if the user has an unreadable controller the only way of input is the reset button I guess. You are already using that for that purpose, couldn't you just display all raw data on that low-level screen thingy?
I'd be interested to see how you would recommend to do that. At the font size I'm using, the title safe area can fit 28x12 characters. Here's the current layout of lowlevel:

Code: Select all

Low-level controller port
probing results
Reset: return; Start: help

PPU readback
     00 FF 00 FF 00 FF 00 FF
PPU latch     3F 3F 3F 3F 3F
APU open bus        40 40 3F

       4L 3L 4H 3H D76543210
1P:    40 A0 41 A1  ...0000S
2P:    40 A0 41 A1  ...0000S
In theory, there could be up to seven serial (S) lines on an AV Famicom: devices in controller ports 1 and 2 (D0 of each), and the five input lines on the expansion port (1P D1, 2P D4-D1). The serial devices I currently support are anywhere from 4-bit (Power Pad part 2) to 32-bit (Super NES Mouse). So in addition to what I already display, I'd need to display 32 bits of data for up to seven lines. What would be a good way to go about that?

(The U-Force is 48-bit, but I'll cross that bridge once it gets to me.)
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Riding the open bus

Post by Pokun »

In that case I'd probably go with automatic page turning, or just slowly scroll the screen left or down until all data has been displayed, then let it wrap around to the first page again and do it all over again. It must be slow enough for one to be able to copy all bits to a paper, and the bits must probably be numbered. It's a bit annoying to read but if you have no way of input that's the only way I can think of.

Also I don't really get why you bother with a large font like that for a tool like this. I always use a normal 8x8 font I stiched together from various fonts on this forum. I stole the capital letters from Super Mario Bros because it has nice and thick characters that are easy to read on any backdrop color on a CRT using RF even (besides the nostalgia factor of fonts like this), numbers from IBM PC BIOS since they not only goes well with SMB letters, but also have a zero that is easy to distinguish from the O. I based my lower case letters on the IBM PC font but I edited them so they became sans serif for maximum readability (although I usually leave the lower case out of NES programs since they take lots of CHR ROM space and aren't really needed for displaying information). I originally stole katakana from Family BASIC since it has separate dakuten and handakuten characters (as opposed to combining kana with the diacritcial marks as separate characters), but I have since created a new Japanese font based on another kana font, including separate dakuten/handakuten characters that I drew myself.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Riding the open bus

Post by tepples »

But then I realized that I know of only two controllers that plug into both ports at once, namely NES Advantage and NES Four Score. Both are NES-004 supersets. The rest can be tested in port 2, with a standard controller in port 1 controlling the test.

Code: Select all

Serial port watcher
Control Pad: Port/bit
A: Poll rate
Reset: Exit

1P D0 Slow
 1-16: 1000 0000 1111 1111
17-32: 1111 1111 1111 1111
User avatar
Myask
Posts: 965
Joined: Sat Jul 12, 2014 3:04 pm

Re: Riding the open bus

Post by Myask »

Doesn't the NES Satellite plug in both, too?
Post Reply