Ok, so maybe in a perfect world databases would simply be for storing data. In the real world, however, tons and tons of business logic has been shoehorned into stored procedures, views and functions.
So how should the pragmatic coder approach properly testing these guys?
The right answer lies in basic TDD methodology. Define the functional requirements for the procedure. Write a test for the procedure, then write the procedure itself. Part of the functional requirement should be a listing of all external objects (tables, views, other procedures) that the object uses. If the object suddenly, say, joins to another table which is not in that list - the test should fail, as the code does not meet the functional design any longer.
To enforce this, the best approach is to create a sandbox database, populate it with only the objects the stored procedure depends on - mocking those objects if need be - and running the stored procedure.
To illustrate: let's say we have a stored procedure "sp_GetPhoneNumber". This procedure takes a last and first name as an argument, and returns a phone number. Now let's imagine the database structure has a table called "contact_info", which contains columns with lastname, firstname, and phone number. Lets further imagine this contact_info table has a foreign key constraint on another table, called customers.
We then say the functional design of "sp_GetPhoneNumber" will be something like "selects a record in contact_info by matching on the columns "lastname" and "firstname", and returns the data in the column "phone_number". From this simple design, we see there is only one external reference needed - "contact_info".
Now, if we approach this as testing against a full "live" database, it means we would need to populate "customer". Maybe customer has a foreign key constraint on "account", we need to populate it, and so on, and so on. If the schema of "account" is changed now, the unit test will fail - even though we don't give a flying fig about it. If somebody comes along and dinks with the stored procedure, that references some other table - the test will pass, even though it no longer meets its design requirements.
Now, on top of that, lets imagine this database we're testing against is pre-populated with helper "baseline" data. Now we're really only testing in a perfect world scenario. What if there are no records in the contact_info table? It doesn't get tested. In this scenario, we end up testing the "baseline test data population" scripts, not so much the code itself. So you basically just pat yourself on the back knowing that your code works under ideal, and static, conditions. Hoorah.
A better approach for the above would to be to create a scratch database, create only the object "customer_info", without any foreign constraints. We could create it as a view which just spits out constant values, the stored proc doesn't care - it only wants a recordset returning object with the expected interface (in this case, the interface is the column names, and data types). Changes to unrelated schema don't affect the test, and the introduction of new objects to the stored procedure break the test.
What if this proc inserts into a table with a trigger on it, you ask? Well, the trigger is a separate unit of code, and should be tested separately.
It boils down to a philosophy of a test only being able to access the data and dependencies it needs.
One could take the "mocked objects" approach to the next level, and set up a expected/actual type of situation. The table could be mocked by a view, which upon execution, records in some metadata table somewhere when it was called. If the stored proc calls other functions or stored procs, they could be mocked to maybe return a constant, and log how and when they were called. They could be implemented entirely, with the logging code tacked on. The point is, these call-out stored procs aren't under test.
You don't run the entire application from it's entry point, sending keystrokes and mouse clicks, to unit test a particular function call in a particular assembly - you mock the objects that assembly uses, set up your expectations, and compare them to the results of the call. Why would you treat business logic on the database any differently?
As a side rant, people tend to look at failing unit tests as a bad thing. They're supposed to fail, they should be as fragile as you can possibly make them. If anything changes to affect the functional design of the code under test, it should break. If the metric managers use to gauge unit testing is "number of passing tests written that always pass no matter what happens", they really end up with a bunch of clever permutations of "Assert.IsTrue(MyFartsDontStink)" In a project of any complexity, it should be nigh impossible to hack around shooting from the hip without breaking a bunch of unit tests.
At least that's how I roll.
Nintendo news: I don't really have any, I've been screwing around with the MAME code wrt reading the instruction EPROM on the playchoice 10 board, hopefully I'll be able to program my own instruction screen and game title soon, so it will show up as "NES Cart" or something on the menu. I'm comitted to making it work without any changes to the board roms, or BIOS, if it's fair to call it that (it's not). I haven't abandoned the project, so be patient PC10 fans.
Wednesday, March 26, 2008
Monday, March 3, 2008
eBay is all a bunch of jerks
Rant:
I bought a lot of "untested" neo geo 1 slot boards last year, and finally got around to screwing with them. Now, we all know that untested is code for broken, because how do you prove its untested? Well, let me tell you how. This pinwheel who sold these to me obviously tried to fix them, and is an even worse solderer than I am.
A resistor pack is missing from one board, both main power filtering capacitors are missing, and it's laughably obvious that he tried to desolder the upright cartridge riser on this one and just got sick of it and decided to unload them.
Well guess what, jokes on you buddy. I see how you screwed up a couple traces, trying to add a capacitor to "fix your startup issue", but desoldering the whole thing? Here's a pro tip: check the roms first, the bios was dead - you didn't need to go butcher at all. 15 minutes from someone with a clue and this one works fine.
I think if you sell something as "untested" it should at least imply that it hasn't obviously been screwed around with by an idiot.
End Rant, on to stuff:
First, Neo Geo news.. I got two of these boards working, and one left. I got so excited about Neo Geos that I bought a 6-slot board on eBay, to upgrade from the 2-slot in my cabinet. I got more Neo Geos than any one man could possibly need. I'll unload the single slots, I have no use for them. I don't know if I'll part with my 2-slot.
My PC10 project is on hold while I wait for some components. Everything works, and for the most part a NES cart coexists peacefully with regular games, but not all of them do. I'm going to try and scratch build an adapter, and mess with running certain lines through a switch, and using a solid state relay to power the cart when it's selected. It may never be perfect, NES games were never designed to be sharing a bus with other NES games. Maybe the only really right way would be a whole assload of buffer drivers, or 4066 switches.
I've also been playing with PCB designs for an adaptor I could have made. I still promise to post a pinout once I've figured out the last couple of issues, and if I get to the point I can have some made, I hope to be able to do it for about 50 bucks a unit, though thats more of a target than any sort of promise.
Some games will always look weird, the PC10s PPU handles some color codes a little differently, the emphasis bit, I beleive, the ones programmers weren't really supposed to use but did.
This also lead me to discover that some PC10 graphics have adjusted pallettes, because the intro screen to Mike Tyson Punch Out NES cart looks like a plate of diarreah on the PC10, but the PC10 game pak looks right. It's not a big deal, it's mostly noticable when mega man is a bright baby blue, instead of his usual mega-man blue. Most games look much better with a true RGB pallette.
As for decoding the instruction prom, I've made a little success... I think, I've ordered a couple serial eproms to test a theory.
I figured something out, though. The PC10 single board version I have, has the z80 side outputting inverted RGB natively, the NES outputs RGB natively, and it is inverted on board. The three pot's on board are for the inverter on the NES side, which looks like a typical inverting amplifier op-amp circuit. The signals are switched via 4066's, and I hope to see if I cant strap the z80 side to the inverter, the nes side to output natively, and thus have a RGB native PC10. I'd much rather not have the NES video signal mussed with thus.
I looked into/at the VS sytem a little more. There are two nes-like systems onboard, and it can output to two monitors simultaneosly. The two boards can share a RAM through an interrupt somehow, this feature was used by baseball and tennis, maybe others. Most single-game boards only have one side populated, but one could populate both, and rig a 4066 based board to switch whats on-screen.
My board had a hidden find, a 2A04 CPU is socketed on the empty side, the normal nes CPU being the 2A03. Someone probably switched game chips, and forgot to pull it.
This perhaps solves my Duck Hunt mystery, that is, why Duck Hunt eproms play with screwed up sound. The VS games used some different PPUs, with different color pallettes. This was partially the copy protection, and is well known. I had read the Duck Hunt sound issue as having to do with the custom PPU, but it never made sense. The PPU's don't make sound, the CPU does. I now know there were at least two CPUs used, and I'm guessing Duck Hunt uses this one. I have everything I need to thus test my Super Mario / Duck Hunt board as soon as I burn some eproms for it. I'll steal the PC10's PPU for the test, since it's the same pallette Duck Hunt used, and try it with the 2A04 I have. It'll be Duck Hunt and Super Mario Bros hooked to a pushbutton switch, and if I'm feeling froggy one day maybe I'll bankswitch some other games on there. Ice Climbers can share space with mario, and excitebike (I think) can live with Duck Hunt.
I fiddled with my Donkey Kong board, I put in a new Z80 and at least this one doesn't get hot to the touch, but still no joy. I dumped all the eproms and checked them, except for the two 2532s. I can't read those directly, but I should be able to repin a socket to a 2732, and at least be able to read it, though probably not write them. I should be getting something onscreen, even without them, though. There's a 74193 near the CPU on there that looks munged, it's a good candidate for replacement.
That reminds me, here's a tip for willem design eprom pcb owners: disable windows plug n play while dumping roms. It can poll for printers, and when it does it can set VPP (programming voltage), and you can actually be programming the devices you think your reading, and that could suck. It's also good practice IMO to run the hardware test, since it'll clear the ports, and make sure the VPP led isn't lit up. I don't think you can kill eproms this way, but I'm sure other things you could.
I bought a lot of "untested" neo geo 1 slot boards last year, and finally got around to screwing with them. Now, we all know that untested is code for broken, because how do you prove its untested? Well, let me tell you how. This pinwheel who sold these to me obviously tried to fix them, and is an even worse solderer than I am.
A resistor pack is missing from one board, both main power filtering capacitors are missing, and it's laughably obvious that he tried to desolder the upright cartridge riser on this one and just got sick of it and decided to unload them.
Well guess what, jokes on you buddy. I see how you screwed up a couple traces, trying to add a capacitor to "fix your startup issue", but desoldering the whole thing? Here's a pro tip: check the roms first, the bios was dead - you didn't need to go butcher at all. 15 minutes from someone with a clue and this one works fine.
I think if you sell something as "untested" it should at least imply that it hasn't obviously been screwed around with by an idiot.
End Rant, on to stuff:
First, Neo Geo news.. I got two of these boards working, and one left. I got so excited about Neo Geos that I bought a 6-slot board on eBay, to upgrade from the 2-slot in my cabinet. I got more Neo Geos than any one man could possibly need. I'll unload the single slots, I have no use for them. I don't know if I'll part with my 2-slot.
My PC10 project is on hold while I wait for some components. Everything works, and for the most part a NES cart coexists peacefully with regular games, but not all of them do. I'm going to try and scratch build an adapter, and mess with running certain lines through a switch, and using a solid state relay to power the cart when it's selected. It may never be perfect, NES games were never designed to be sharing a bus with other NES games. Maybe the only really right way would be a whole assload of buffer drivers, or 4066 switches.
I've also been playing with PCB designs for an adaptor I could have made. I still promise to post a pinout once I've figured out the last couple of issues, and if I get to the point I can have some made, I hope to be able to do it for about 50 bucks a unit, though thats more of a target than any sort of promise.
Some games will always look weird, the PC10s PPU handles some color codes a little differently, the emphasis bit, I beleive, the ones programmers weren't really supposed to use but did.
This also lead me to discover that some PC10 graphics have adjusted pallettes, because the intro screen to Mike Tyson Punch Out NES cart looks like a plate of diarreah on the PC10, but the PC10 game pak looks right. It's not a big deal, it's mostly noticable when mega man is a bright baby blue, instead of his usual mega-man blue. Most games look much better with a true RGB pallette.
As for decoding the instruction prom, I've made a little success... I think, I've ordered a couple serial eproms to test a theory.
I figured something out, though. The PC10 single board version I have, has the z80 side outputting inverted RGB natively, the NES outputs RGB natively, and it is inverted on board. The three pot's on board are for the inverter on the NES side, which looks like a typical inverting amplifier op-amp circuit. The signals are switched via 4066's, and I hope to see if I cant strap the z80 side to the inverter, the nes side to output natively, and thus have a RGB native PC10. I'd much rather not have the NES video signal mussed with thus.
I looked into/at the VS sytem a little more. There are two nes-like systems onboard, and it can output to two monitors simultaneosly. The two boards can share a RAM through an interrupt somehow, this feature was used by baseball and tennis, maybe others. Most single-game boards only have one side populated, but one could populate both, and rig a 4066 based board to switch whats on-screen.
My board had a hidden find, a 2A04 CPU is socketed on the empty side, the normal nes CPU being the 2A03. Someone probably switched game chips, and forgot to pull it.
This perhaps solves my Duck Hunt mystery, that is, why Duck Hunt eproms play with screwed up sound. The VS games used some different PPUs, with different color pallettes. This was partially the copy protection, and is well known. I had read the Duck Hunt sound issue as having to do with the custom PPU, but it never made sense. The PPU's don't make sound, the CPU does. I now know there were at least two CPUs used, and I'm guessing Duck Hunt uses this one. I have everything I need to thus test my Super Mario / Duck Hunt board as soon as I burn some eproms for it. I'll steal the PC10's PPU for the test, since it's the same pallette Duck Hunt used, and try it with the 2A04 I have. It'll be Duck Hunt and Super Mario Bros hooked to a pushbutton switch, and if I'm feeling froggy one day maybe I'll bankswitch some other games on there. Ice Climbers can share space with mario, and excitebike (I think) can live with Duck Hunt.
I fiddled with my Donkey Kong board, I put in a new Z80 and at least this one doesn't get hot to the touch, but still no joy. I dumped all the eproms and checked them, except for the two 2532s. I can't read those directly, but I should be able to repin a socket to a 2732, and at least be able to read it, though probably not write them. I should be getting something onscreen, even without them, though. There's a 74193 near the CPU on there that looks munged, it's a good candidate for replacement.
That reminds me, here's a tip for willem design eprom pcb owners: disable windows plug n play while dumping roms. It can poll for printers, and when it does it can set VPP (programming voltage), and you can actually be programming the devices you think your reading, and that could suck. It's also good practice IMO to run the hardware test, since it'll clear the ports, and make sure the VPP led isn't lit up. I don't think you can kill eproms this way, but I'm sure other things you could.
Tuesday, February 26, 2008
PC10 misc
The PC10 apparently uses a standard edge connector, in particular a 3x32 male eurocard connector. This means I don't need to murder any more game paks to make a batch of adapters, and as a bonus, a footprint pattern already exists for it in pcb123, 41612 din eurocard. For some reason it calls it a 98 pin connector, but it's not. I guess the artist couldn't count right - or maybe counted the screw holes?
Sourcing NES connectors isn't quite so easy. The pads on a aren't *quite* .100 on center, but I think I'll order a couple of those and see how they fly. Murdering game genies and famicom adapters isn't that odious a concept, though. The wraparound crazy units that the consoles used, and the modern chinese knockoffs aren't really a good idea, they're expensive, and bulky. I think soldered on connectors would just let 10 nes carts squeeze onto one of those boards, but I'll have too measure. If not, maybe I'll design it as a left/right type deal, so the carts themselves would be staggered. Maybe famicom connectors are easier to source.
As for my 'prototype', I'm still having the following problems: I can't run other PC10 boards with my adapter in place, I'll try and address that this weekend. A few games are giving strange glitches, I believe this has more to do with my hacktastic wiring, and games with some very demanding timing, or maybe a lot of DMA transfers from CHR to PRG. I'll try and clean that up a bit when I get a chance and see if it helps.
I'd also really like to crack the nut of the instruction rom and security chip, being able to customize that would be excellent. The chip itself is documented somewhat, and from the schematics it appears to screw around with a couple of the data lines from the eprom. I think it performs a simple on-the-fly decryption of the instruction rom, and maybe sniffing the bus could net me an unencrypted rom, which I could try to burn back (sans chip). This is maybe biting off a little more than I have time to chew, though. Maybe not, we'll see.
I'll try to post something by way of pics / schematic this weekend for anybody who wants one.
Sourcing NES connectors isn't quite so easy. The pads on a aren't *quite* .100 on center, but I think I'll order a couple of those and see how they fly. Murdering game genies and famicom adapters isn't that odious a concept, though. The wraparound crazy units that the consoles used, and the modern chinese knockoffs aren't really a good idea, they're expensive, and bulky. I think soldered on connectors would just let 10 nes carts squeeze onto one of those boards, but I'll have too measure. If not, maybe I'll design it as a left/right type deal, so the carts themselves would be staggered. Maybe famicom connectors are easier to source.
As for my 'prototype', I'm still having the following problems: I can't run other PC10 boards with my adapter in place, I'll try and address that this weekend. A few games are giving strange glitches, I believe this has more to do with my hacktastic wiring, and games with some very demanding timing, or maybe a lot of DMA transfers from CHR to PRG. I'll try and clean that up a bit when I get a chance and see if it helps.
I'd also really like to crack the nut of the instruction rom and security chip, being able to customize that would be excellent. The chip itself is documented somewhat, and from the schematics it appears to screw around with a couple of the data lines from the eprom. I think it performs a simple on-the-fly decryption of the instruction rom, and maybe sniffing the bus could net me an unencrypted rom, which I could try to burn back (sans chip). This is maybe biting off a little more than I have time to chew, though. Maybe not, we'll see.
I'll try to post something by way of pics / schematic this weekend for anybody who wants one.
Non-inverted video from the PC10
The PC10s PPU, the 2C03B, outputs regular RGB. It is inverted on-board en-route to the monitor.
Since my monitor is on it's last legs, and old Nintendo monitors are selling for as much as a new one from Happ, I'd really like to get regular non-inverted video straight from the board. Inverting it twice is hardly ideal, and surely some signal is lost.
I'm eyeballing the PCH1-CPU Schematic sheet 4 and there's some crazy crap going on, like everything Nintendo did back then this looks a little bit over engineered.
I get out of my depth pretty quick when it comes to looking at a drawing of some op-amps, capacitors, and transistors, and figuring out "what it does", but I think I can tap one of the legs of each 'gain' pot with a small resistor 50-100 ohms and have a usable signal. If all else fails, I can tap the unamplified RGB signals, and build my own amp, following the instructions of folks who've mounted the PPU into a regular old NES.
Also, I think I need to tap the NES's reset line on the PC10 board, to get some games to work properly. I'm thinking that the bus is not initialized the same way it is on a real NES, and on-cart RAM's suffer as a result. Being able to "start" the NES, then reset it, may be the key to all that.
I have a little perfboard leftover, so tonight I'll figure out how I'll mount it, and which signals I want to bring off of the PC10's board. I'll have two NES controller ports, non-inverted RGB video, and reset line. That's 15 pins so far, sounds like a mess in the making.
Since my monitor is on it's last legs, and old Nintendo monitors are selling for as much as a new one from Happ, I'd really like to get regular non-inverted video straight from the board. Inverting it twice is hardly ideal, and surely some signal is lost.
I'm eyeballing the PCH1-CPU Schematic sheet 4 and there's some crazy crap going on, like everything Nintendo did back then this looks a little bit over engineered.
I get out of my depth pretty quick when it comes to looking at a drawing of some op-amps, capacitors, and transistors, and figuring out "what it does", but I think I can tap one of the legs of each 'gain' pot with a small resistor 50-100 ohms and have a usable signal. If all else fails, I can tap the unamplified RGB signals, and build my own amp, following the instructions of folks who've mounted the PPU into a regular old NES.
Also, I think I need to tap the NES's reset line on the PC10 board, to get some games to work properly. I'm thinking that the bus is not initialized the same way it is on a real NES, and on-cart RAM's suffer as a result. Being able to "start" the NES, then reset it, may be the key to all that.
I have a little perfboard leftover, so tonight I'll figure out how I'll mount it, and which signals I want to bring off of the PC10's board. I'll have two NES controller ports, non-inverted RGB video, and reset line. That's 15 pins so far, sounds like a mess in the making.
Monday, February 25, 2008
PC10 NES adapter update
After a nights sleep and fresh attention, the rule of elimination told me which pin was wrong. Castlevania III was working perfectly, and as an MMC5 game it makes good use of CIRAM /CE and CIRAM /A10, so I knew it couldn't be them. Likewise, MMC3 games (SMB3) were working fine, as were most others.
The games not working were all old(er) UNROM games, that use on-cart WRAM, disabling the NES's WRAM. They were all drawing squigglies where the tiles should be, and Duck Tales was actually drawing sprites properly. Suddenly it dawned on me, it can read WRAM, but not write the proper graphics to it, thereby displaying whatever random electrons happened to be stuck in there. Sure enough, CHR /WR wasn't hooked up.
Now everything is working great, for the most part. I'm seeing the odd bit of static, or a line here or there on certain games, but at this point I know it's simply dirty cartridges. All of MY games (the ones I've had since I was a kid) play great, because if I take care of nothing else, I take care of my games.
As a matter of fact, get this, my Adventures of Link cart still has my save game on it! Those batteries have a 5-10 year lifetime, and this sucker is 20+ and goin' strong! I was so clever at 12, to name my character "FARTSO".
Now, if I could only crack that security/instruction EPROM, so the game didn't have to display as Pro Wrestling, with Pro Wrestling instructions. Having it display as "Nintendo", with some sort of Nintendo instruction screen would be cool.
I need some sort of data analyser, I think, even if it's homebrewed. If I could just sniff the "unencrypted" data coming out of it, program that onto a new eprom, and remove the security chip altogether.. it's just crazy enough to work.
It's also probably time to start drawing up some prototypes and see if I can get some pro quality boards fabbed. I'm also thinking a dedicated 60 pin slot for famicom games is in order, so I'm not running some crazy daisy-chain of adapters.
I also ran pin 54 from the expansion port to the PC10s audio line, hoping maybe Castlevania III had buried within it the extra sound hardware the japanese version carries.. It doesn't seem to. Oh well, would have been a neat 20 year old easter egg if I'd found it. It has a pin there, and its wired up internally.. Maybe the PC10 doesn't work right, I should try wiring that up in one of my real NES's.
I got lazy working out the bugs, and wired PRG /CE, CHR /A13 and VRAM /CE straight to the connector, not to the bus driver. Right now it wont work with other game paks on the board (since it's always active on the bus, wackiness ensues when you try to play two games at once). I'll try and fix that tomorrow. Then I can write up a proper howto for other budding hackers, once I'm sure that works.
The games not working were all old(er) UNROM games, that use on-cart WRAM, disabling the NES's WRAM. They were all drawing squigglies where the tiles should be, and Duck Tales was actually drawing sprites properly. Suddenly it dawned on me, it can read WRAM, but not write the proper graphics to it, thereby displaying whatever random electrons happened to be stuck in there. Sure enough, CHR /WR wasn't hooked up.
Now everything is working great, for the most part. I'm seeing the odd bit of static, or a line here or there on certain games, but at this point I know it's simply dirty cartridges. All of MY games (the ones I've had since I was a kid) play great, because if I take care of nothing else, I take care of my games.
As a matter of fact, get this, my Adventures of Link cart still has my save game on it! Those batteries have a 5-10 year lifetime, and this sucker is 20+ and goin' strong! I was so clever at 12, to name my character "FARTSO".
Now, if I could only crack that security/instruction EPROM, so the game didn't have to display as Pro Wrestling, with Pro Wrestling instructions. Having it display as "Nintendo", with some sort of Nintendo instruction screen would be cool.
I need some sort of data analyser, I think, even if it's homebrewed. If I could just sniff the "unencrypted" data coming out of it, program that onto a new eprom, and remove the security chip altogether.. it's just crazy enough to work.
It's also probably time to start drawing up some prototypes and see if I can get some pro quality boards fabbed. I'm also thinking a dedicated 60 pin slot for famicom games is in order, so I'm not running some crazy daisy-chain of adapters.
I also ran pin 54 from the expansion port to the PC10s audio line, hoping maybe Castlevania III had buried within it the extra sound hardware the japanese version carries.. It doesn't seem to. Oh well, would have been a neat 20 year old easter egg if I'd found it. It has a pin there, and its wired up internally.. Maybe the PC10 doesn't work right, I should try wiring that up in one of my real NES's.
I got lazy working out the bugs, and wired PRG /CE, CHR /A13 and VRAM /CE straight to the connector, not to the bus driver. Right now it wont work with other game paks on the board (since it's always active on the bus, wackiness ensues when you try to play two games at once). I'll try and fix that tomorrow. Then I can write up a proper howto for other budding hackers, once I'm sure that works.
Sunday, February 24, 2008
NES on Playchoice 10 Update
It works! (mostly)
After much trial and error I believe I've found that CHR A13 and CHR /A13 are marked backwards on the Playchoice schematic I have.
So far I've been able to play Super Mario Bros, SMB 3, Castlevania 3, Blaster Master, and others. However, Cobra Triangle, Duck Tales, TMNT and Gauntlet display some graphical hoo-haw. I believe the common denominator is that these carts use their own onboard VRAM, and disable the system's VRAM, which would tell me there's a problem with the VRAM /CE line, or perhaps VRAM A10. They both seem to be wired "correct", but they may not be right on the schematic.
I won't rule out that these cartridges are simply filthy and not making a proper connection, I'll stop at harbor freight tomorrow and see if I can't find a set of bottlecap bits to open them up for a good and proper cleaning.
I'm pretty jazzed with the results so far, and even wired in a power switch to the adapter. If I select another channel on the PC10, I can safely switch carts, reselect the channel and be off to the races.
After much trial and error I believe I've found that CHR A13 and CHR /A13 are marked backwards on the Playchoice schematic I have.
So far I've been able to play Super Mario Bros, SMB 3, Castlevania 3, Blaster Master, and others. However, Cobra Triangle, Duck Tales, TMNT and Gauntlet display some graphical hoo-haw. I believe the common denominator is that these carts use their own onboard VRAM, and disable the system's VRAM, which would tell me there's a problem with the VRAM /CE line, or perhaps VRAM A10. They both seem to be wired "correct", but they may not be right on the schematic.
I won't rule out that these cartridges are simply filthy and not making a proper connection, I'll stop at harbor freight tomorrow and see if I can't find a set of bottlecap bits to open them up for a good and proper cleaning.
I'm pretty jazzed with the results so far, and even wired in a power switch to the adapter. If I select another channel on the PC10, I can safely switch carts, reselect the channel and be off to the races.
ITS ALIVEEEEE!!!!
A weeks worth of late night soldering and puzzling and puzzling until my puzzler was sore has finally come to fruition!
Can you hear it? It is the sound of the Pro Wrestling NES title screen music, playing through my PC10! My kooky scheme worked! Well, at least the PRG rom bus is working, as its running the code correctly. The graphics are all wonky, but I'm sure I have something backwards on the CHR bus, that wont be too tough to track down. Probably A10/A11, since Nintendo backwardseded them up from the famicom pinout, you know, for region protection.
I'll post details, pictures, and schematics later.. Until then, here's a teaser of how a PC10 cart is "activated" when /CS is enabled by pulling it low. Basically, it enables a ls367, dual hex bus driver, which routes chip enable signals to the "cartridge", as well as enabling the instruction rom.
This is a true hack, as in, I hacked up a game genie with a box cutter to make this happen.
Here's what I discovered after much desoldering and tracing PCB lines..
I still think I'm going to need to pull PRG /CE, CHR /A13 (CHR /CE for all intents) and VRAM /CE high with some 5k resistors, to make sure they are disabled when the game pak is not selected.
I'm jazzed and am ready for my next 'tendo hack project. PC10 game paks are just begging to be modified into reprogrammable carts, since they have solder pads for various rom types, etc. What I'm getting at, is my SMB3 PC10 board is much more generic than an SMB3 cart. If I hacked a Game Pak of each type (MMC1, MMC2, MMC3, UNROM, etc) in this matter, my PC10 could be the ultimate programmable uber-nintendo from hell. Though I think I'm going to work on the VS a bit first, and see if I cant make a bankswitching VS Super Mario Bros / VS Duck Hunt.
Can you hear it? It is the sound of the Pro Wrestling NES title screen music, playing through my PC10! My kooky scheme worked! Well, at least the PRG rom bus is working, as its running the code correctly. The graphics are all wonky, but I'm sure I have something backwards on the CHR bus, that wont be too tough to track down. Probably A10/A11, since Nintendo backwardseded them up from the famicom pinout, you know, for region protection.
I'll post details, pictures, and schematics later.. Until then, here's a teaser of how a PC10 cart is "activated" when /CS is enabled by pulling it low. Basically, it enables a ls367, dual hex bus driver, which routes chip enable signals to the "cartridge", as well as enabling the instruction rom.
This is a true hack, as in, I hacked up a game genie with a box cutter to make this happen.
Here's what I discovered after much desoldering and tracing PCB lines..
I still think I'm going to need to pull PRG /CE, CHR /A13 (CHR /CE for all intents) and VRAM /CE high with some 5k resistors, to make sure they are disabled when the game pak is not selected.
I'm jazzed and am ready for my next 'tendo hack project. PC10 game paks are just begging to be modified into reprogrammable carts, since they have solder pads for various rom types, etc. What I'm getting at, is my SMB3 PC10 board is much more generic than an SMB3 cart. If I hacked a Game Pak of each type (MMC1, MMC2, MMC3, UNROM, etc) in this matter, my PC10 could be the ultimate programmable uber-nintendo from hell. Though I think I'm going to work on the VS a bit first, and see if I cant make a bankswitching VS Super Mario Bros / VS Duck Hunt.
Wiring of 74ls367 on PC10 pro wrestling cart
/chsel |1 /G1 Vcc 16|
(Conn) Chr A13 |2 1A1 /G2 15| /chsel
+5 pullup |3 1y1 2A1 14| CHR /A13 (PC10 Connector)
(Conn) PRG /CE |4 1A2 2Y1 13| CIRAM /CE (PC10 Connector)
+5 pullup |5 1Y2 2A2 12| /CSel INST ROM (PC10 Conn)
(Brd) CIRAM A10 |6 1A3 2Y2 11| Pin 20 U4
(Conn)CIRAM A10 |7 1Y3 2A3 10| N/C
GND |8 GND 2Y3 9| N/C
^^Crap this wont display right
rewiring:
lift pin 2, connect pcb hole to Chr A13 on nes connector
lift pin 3
lift pin 5, connect pin to PRG /CE on nes connector
lift pin 6, connect pin 7to CIRAM A10 on nes connector
lift pin 13, wire pcb hole 13 to pin 10,
connect pin 13 to CHR /A13 on nes connector (with 5k pullup (!?))
lift pin 9, connect to CIRAM /CE on NES connector (with 5k pullup (!?))
unwired pins on connector = chr a10, m2, /irq, prg r/w
Wednesday, February 20, 2008
Blech
The NES I picked up as a donor for parts is a bit of a donkey, it's cart connector has been replaced with a cheap chinese knock-off of the original, it grabs cartridges with this grip of death, and basically breaks itself when you force them back out (the contacts bend and slide out).
Blech, there's not much I can do with it, but I've decided to take the connector off an old game genie instead, it's absolutely perfect for the task, it's already got eyelets to solder to and everything.
I mentioned before I hope to pull this off without BIOS modification of the PC10, since I want this thing to still behave like an arcade machine, and the hacked BIOS' out there disable this functionality. If I can't I'll have to work on my own BIOS, and Z80 assembler isn't something I've had experience with, though I guess it's about time I tried.
Also, despite an overwhelming abundance of 27C64 EPROMS, I presently have no way to erase them. I guess I should be googling around for some source of UVB light. The avon toothbrush-sanitizer hack works decently with little EPROMS like the 2764, but didn't seem to be able to clear the bigger 16 bit 27C1024, so I guess I need a real one. I have a Neo Geo and Taito f3 to be modifying (to cheat on the former, and to play in english on the latter).
I think when I get my EPROM eraser I'll throw Ice Climber onto my VS board, since it uses the same PPU as Super Mario Bros. My kid knows Ice Climber only as a character in Smash Bros, so it could be a little history lesson right there.
And that's the news. It's time to crack out the soldering iron and start doin', I suppose.
Blech, there's not much I can do with it, but I've decided to take the connector off an old game genie instead, it's absolutely perfect for the task, it's already got eyelets to solder to and everything.
I mentioned before I hope to pull this off without BIOS modification of the PC10, since I want this thing to still behave like an arcade machine, and the hacked BIOS' out there disable this functionality. If I can't I'll have to work on my own BIOS, and Z80 assembler isn't something I've had experience with, though I guess it's about time I tried.
Also, despite an overwhelming abundance of 27C64 EPROMS, I presently have no way to erase them. I guess I should be googling around for some source of UVB light. The avon toothbrush-sanitizer hack works decently with little EPROMS like the 2764, but didn't seem to be able to clear the bigger 16 bit 27C1024, so I guess I need a real one. I have a Neo Geo and Taito f3 to be modifying (to cheat on the former, and to play in english on the latter).
I think when I get my EPROM eraser I'll throw Ice Climber onto my VS board, since it uses the same PPU as Super Mario Bros. My kid knows Ice Climber only as a character in Smash Bros, so it could be a little history lesson right there.
And that's the news. It's time to crack out the soldering iron and start doin', I suppose.
Monday, February 18, 2008
Also
Until further notice, this blog is about 8 bit Nintendo hacks. Whining about .net is tedious and boring.
Here's news: I picked up an old PSOne screen for 20 bucks, since it's well published how easy it is to tap on it RGBS internally, so eventually I'll be able to build myself a proper test rig for fixing my PCBs.
First up will be Donkey Kong, and I've made a decision that once I get it working, I'm going to sell it and the whole kit (PCB, marquee, screen bezel, and NOS bezel stickers) and use the cabinet to house my VS Super Mario / Duck Hunt project.
Yeah, Donkey Kong is more "classic", but I'm not running a museum here, and I don't wax nostalgic for games that suck. I'd even prefer Popeye to Kong, that's just how I am. It'll fetch me mighty bucks on eBay, bucks I can use for more important things.
Here's news: I picked up an old PSOne screen for 20 bucks, since it's well published how easy it is to tap on it RGBS internally, so eventually I'll be able to build myself a proper test rig for fixing my PCBs.
First up will be Donkey Kong, and I've made a decision that once I get it working, I'm going to sell it and the whole kit (PCB, marquee, screen bezel, and NOS bezel stickers) and use the cabinet to house my VS Super Mario / Duck Hunt project.
Yeah, Donkey Kong is more "classic", but I'm not running a museum here, and I don't wax nostalgic for games that suck. I'd even prefer Popeye to Kong, that's just how I am. It'll fetch me mighty bucks on eBay, bucks I can use for more important things.
Playchoice 10 and NES Cartridge Musings
So I'm well on my way to building my NES adaptor for PC10. I've bought a sacrificial NES for the cart connector, and I'll chop up the original motherboard for something to solder to.
I plan to likewise sacrifice a PC10 cart (Pro Wrestling, I suppose) since I have no idea where in the world one would get those connectors. I'll leave the security chip on the cart and wired, and cut the remainder of the traces - it should work without BIOS modification.
One weird thing I ran into mapping it out, is the presence of a 21.47727mhz clock signal on the 72 pin NES connector, which doesn't exist on the 60 pin famicom, nor on the PC10. This is strange, and I've been puzzling over what it could possibly be for.
My theories boil down to this: it's likely used by the CIC lockout chip, which is only present in NES. I thought maybe for expansion, but then why isn't it present on the expansion port?
Another hurdle in NES->PC10 will be the lack of player 2 start/select buttons. I've solved this, I plan to attach a fully intact NES control port assembly to the board, I've located where to solder it in, I'll draw up a schematic one day maybe. The only game I can think of that requires player 2 to be able to hit start is Battletoads, but that's surely a game worth playing on a real arcade machine.
My plan is to build a new control panel with two brand new NES Advantage sticks. I bought them years ago, and have never used them. They still have protective plastic film and everything.
I still haven't thought what I want to do for light gun games. I could always plug in a zapper, but I want to hardwire a holstered PC10/VS lightgun, probably with a switch next to the cartridge slot.
Also, the countdown timer is installed. It took me forever to crimp on all those tiny pins and get the ring working, but there it is. This is another motivation for not wanting to use a hacked BIOS, I don't want it forced into free play mode - I like the idea of timed NES challenges.
I also found this site, which has some cool NES hacks, most notably his VS-in-a-NES box. His code to remap the color pallette for VS Super Mario is exactly what I was looking to do to remap VS Duck Hunt's pallete to work with VS Super Mario. My dream of a arcade version of a VS Super Mario Bros / Duck Hunt is that much closer. (for those who dont know, arcade Super Mario is much harder with different levels, and in arcade Duck Hunt, YOU CAN SHOOT THAT SMUG DOG!)
But I'm way too tired to do anything about it now.
I plan to likewise sacrifice a PC10 cart (Pro Wrestling, I suppose) since I have no idea where in the world one would get those connectors. I'll leave the security chip on the cart and wired, and cut the remainder of the traces - it should work without BIOS modification.
One weird thing I ran into mapping it out, is the presence of a 21.47727mhz clock signal on the 72 pin NES connector, which doesn't exist on the 60 pin famicom, nor on the PC10. This is strange, and I've been puzzling over what it could possibly be for.
My theories boil down to this: it's likely used by the CIC lockout chip, which is only present in NES. I thought maybe for expansion, but then why isn't it present on the expansion port?
Another hurdle in NES->PC10 will be the lack of player 2 start/select buttons. I've solved this, I plan to attach a fully intact NES control port assembly to the board, I've located where to solder it in, I'll draw up a schematic one day maybe. The only game I can think of that requires player 2 to be able to hit start is Battletoads, but that's surely a game worth playing on a real arcade machine.
My plan is to build a new control panel with two brand new NES Advantage sticks. I bought them years ago, and have never used them. They still have protective plastic film and everything.
I still haven't thought what I want to do for light gun games. I could always plug in a zapper, but I want to hardwire a holstered PC10/VS lightgun, probably with a switch next to the cartridge slot.
Also, the countdown timer is installed. It took me forever to crimp on all those tiny pins and get the ring working, but there it is. This is another motivation for not wanting to use a hacked BIOS, I don't want it forced into free play mode - I like the idea of timed NES challenges.
I also found this site, which has some cool NES hacks, most notably his VS-in-a-NES box. His code to remap the color pallette for VS Super Mario is exactly what I was looking to do to remap VS Duck Hunt's pallete to work with VS Super Mario. My dream of a arcade version of a VS Super Mario Bros / Duck Hunt is that much closer. (for those who dont know, arcade Super Mario is much harder with different levels, and in arcade Duck Hunt, YOU CAN SHOOT THAT SMUG DOG!)
But I'm way too tired to do anything about it now.
Friday, January 25, 2008
Debugging Reporting Services install scripts (.rss files)
So I was making some changes to a deploy script, and brought up the .rss file in sharpdevelop, simply for the fun of intellisense.
I got bored, and decided to reference rs.exe ans see if it would decorate all my code for me.
I eventually realized the following:
All rs does is take the -v paramaters, make them into variables, through your .rss file in (its already a sub main), compile and execute it.
So, to step through your .rss scripts on-the-fly, or to completely replace them with a custom assembly, do this:
1) Create a new console application
2) Reference rs.exe in your project (in $SQLSRVR\blah\blah\binn)
3) Reference System.Web.Services
4) Imports Microsoft.SqlServer.ReportingServices
5) Declare your parameters as module level variables
6) Public Sub main() is the same code you'd put in the .rss file.
Hooray, no more stumbling in the dark, and your installer can be unit tested, refactored, resharped, signed, encrypted and converted to unmanaged C++, inlined assembly, or whatever your black heart desires.
NOTE:, rs.LogOnUser throws an error that it's not supported in RS for Sql Server 2000. I guess you can only run with the credentials of the launching user, or find some other way to impersonate.
Obligatory rant: why did have they give these files .rss extensions? Can they not spend a half a minute on google to see if rss already means something?
Oops, I forgot the important part, add this global instance of variable rs:
Public rs As ReportingService = New Microsoft.SqlServer.ReportingServices.ReportingService()
I got bored, and decided to reference rs.exe ans see if it would decorate all my code for me.
I eventually realized the following:
All rs does is take the -v paramaters, make them into variables, through your .rss file in (its already a sub main), compile and execute it.
So, to step through your .rss scripts on-the-fly, or to completely replace them with a custom assembly, do this:
1) Create a new console application
2) Reference rs.exe in your project (in $SQLSRVR\blah\blah\binn)
3) Reference System.Web.Services
4) Imports Microsoft.SqlServer.ReportingServices
5) Declare your parameters as module level variables
6) Public Sub main() is the same code you'd put in the .rss file.
Hooray, no more stumbling in the dark, and your installer can be unit tested, refactored, resharped, signed, encrypted and converted to unmanaged C++, inlined assembly, or whatever your black heart desires.
NOTE:, rs.LogOnUser throws an error that it's not supported in RS for Sql Server 2000. I guess you can only run with the credentials of the launching user, or find some other way to impersonate.
Obligatory rant: why did have they give these files .rss extensions? Can they not spend a half a minute on google to see if rss already means something?
Oops, I forgot the important part, add this global instance of variable rs:
Public rs As ReportingService = New Microsoft.SqlServer.ReportingServices.ReportingService()
Wednesday, January 23, 2008
Free XBLA Game to Make up for Worst Xmas Ever
I suppose it's better than nothing, though I think they would have done better to just throw everyone a few xbox points, and let them choose their own download. This game was widely panned by critics and gamers, but hey, free is free.
Link to story here.
You only have until Sunday, and I suppose if you snooze you lose.
Link to story here.
You only have until Sunday, and I suppose if you snooze you lose.
Tuesday, January 22, 2008
Apple
This was an interesting read. Apple "tweaks" their port of DTrace to prevent people from debugging iTunes, and the ilk.
I can only imagine it's to prevent people from grabbing unencrypted data from DRM'd music from memory? What's even the point of that, practically, Fair Play is long since broken. It's not like everyday Joe's are tracing through running code so they can make an illicit copy of some iTunes song, and it's not like developers wouldn't know a better way. At the end of the day, the tool doesn't work. Go Team Venture.
I think Apple just really hates programmers.
I can only imagine it's to prevent people from grabbing unencrypted data from DRM'd music from memory? What's even the point of that, practically, Fair Play is long since broken. It's not like everyday Joe's are tracing through running code so they can make an illicit copy of some iTunes song, and it's not like developers wouldn't know a better way. At the end of the day, the tool doesn't work. Go Team Venture.
I think Apple just really hates programmers.
Hooray!! I Have a Playchoice 10 Countdown Timer
It's actually out of a countertop, but I shouldn't have a problem fabricating a bracket to mount it in my single monitor cabinet.
I'm going to have to make a cable, but I'm not sure if I want to find the proper connectors to do it. I'm leaning towards soldering on a 12 pin molex, there's nothing remotely OEM about my Playchoice/VS hybrid anyways. I should post a photo of the ridiculous perfboard monstrosity that I created to do the switching, I should probably sketch up a schematic for it too, before I forget what I did and it breaks.
I have PCB layouts I sketched to make a few more of them a little more professionally, and a little more advanced, but haven't really set up to do any sort of etching or drilling I'd need. I should look into some of the web-based pcb prototyping services again. I could get a dozen boards, sell 10 on eBay to break even. I know that multijamma guy has a patent, but my approach and design is wholly different from his. I ain't 'fraid of no ghost.
I really need to get back to my cabinets, parts are cheap on eBay this time of year.
Why not list things to do?
Bad Dudes' monitor is fritzing, it's the flyback transformer. I have a parts chassis and a cap kit for it, I need to get around to rebuilding it. I also need to look up the dip switch settings and put it on easy. I am not a bad enough dude to rescue the president.
Puck Man and Playchoice 10 both have at least one gun on the CRT flaking in and out. The PC10 is beyond repair, but I'm loath to put a regular monitor with an inverter in there. I may swap with the Donkey Kong's monitor, it's in great shape and I'm unlikely to be jumping over barrels any time soon - I'm going to need to spend lots of hours trying to get anything out of that board (or lots of money replacing it).
Puckman is probably fixable, but I haven't been able to ID the monitor. It's no doubt a cheap chinese knock-off, but it's incredibly well built and has a really stable and sharp image. They really don't build them like they used to. I've never seen a TV set or PC monitor that came near the build quality of those things. On the bright side, it looks like a good tube swap candidate, and I have a TV tube with matching pins and impedances, so I'll keep my fingers crossed.
Both my tables could use new joysticks, I need to really start watching eBay again. Regular sticks don't fit. I'm likely to find original replacements for the Time Pilots, since there were plenty of those old Centuri/Konami/Sega cabinets out there.
Puckman is a chinese bootleg circa 1979, though. It's buttons and sticks are downright weird. From what I can tell scouring catalogs, never at any time did any manufacturer sell pushbuttons of that weirdo diameter.
I need to build/buy a new eprom eraser, so I can go ahead and patch Puzzle Bobble 3x into english, and put the unibios on the Neo Geo. I'm not ashamed to cheat to see all the endings to Samurai Shodown.
THEN, I can get to work on my NES cartridge adaptor for the Playchoice 10.
It strikes me that a Neo Geo rom emulator is a cost effective proposal at this point, flash is cheap now, and it's effectively the same setup as a genesis cart. I should put that on my todo list. If I can pull it off, a CPS2 rom emulator would absolutely rock. I should check into the timings, I'm sure it would work for both.
On that front, I lost the code for superufo ultimate mega SNES rom tool 2000 that I wrote. Now I need to rewrite it, I can't use my UFO now without it. I wrote it years ago to split up SNES roms, format floppies to 1.68 megs as it wrote it out - for use in my floppy based SNES cartridge copier. I wonder if that code I found to format the floppy would even work under XP? I guess a 4 line shell script in linux could do everything it did - I stole the muscle out of ucon anyways.
So that's my story, I can read this later when I'm bored and maybe be inspired to do something. I feel lazy now.
I'm going to have to make a cable, but I'm not sure if I want to find the proper connectors to do it. I'm leaning towards soldering on a 12 pin molex, there's nothing remotely OEM about my Playchoice/VS hybrid anyways. I should post a photo of the ridiculous perfboard monstrosity that I created to do the switching, I should probably sketch up a schematic for it too, before I forget what I did and it breaks.
I have PCB layouts I sketched to make a few more of them a little more professionally, and a little more advanced, but haven't really set up to do any sort of etching or drilling I'd need. I should look into some of the web-based pcb prototyping services again. I could get a dozen boards, sell 10 on eBay to break even. I know that multijamma guy has a patent, but my approach and design is wholly different from his. I ain't 'fraid of no ghost.
I really need to get back to my cabinets, parts are cheap on eBay this time of year.
Why not list things to do?
Bad Dudes' monitor is fritzing, it's the flyback transformer. I have a parts chassis and a cap kit for it, I need to get around to rebuilding it. I also need to look up the dip switch settings and put it on easy. I am not a bad enough dude to rescue the president.
Puck Man and Playchoice 10 both have at least one gun on the CRT flaking in and out. The PC10 is beyond repair, but I'm loath to put a regular monitor with an inverter in there. I may swap with the Donkey Kong's monitor, it's in great shape and I'm unlikely to be jumping over barrels any time soon - I'm going to need to spend lots of hours trying to get anything out of that board (or lots of money replacing it).
Puckman is probably fixable, but I haven't been able to ID the monitor. It's no doubt a cheap chinese knock-off, but it's incredibly well built and has a really stable and sharp image. They really don't build them like they used to. I've never seen a TV set or PC monitor that came near the build quality of those things. On the bright side, it looks like a good tube swap candidate, and I have a TV tube with matching pins and impedances, so I'll keep my fingers crossed.
Both my tables could use new joysticks, I need to really start watching eBay again. Regular sticks don't fit. I'm likely to find original replacements for the Time Pilots, since there were plenty of those old Centuri/Konami/Sega cabinets out there.
Puckman is a chinese bootleg circa 1979, though. It's buttons and sticks are downright weird. From what I can tell scouring catalogs, never at any time did any manufacturer sell pushbuttons of that weirdo diameter.
I need to build/buy a new eprom eraser, so I can go ahead and patch Puzzle Bobble 3x into english, and put the unibios on the Neo Geo. I'm not ashamed to cheat to see all the endings to Samurai Shodown.
THEN, I can get to work on my NES cartridge adaptor for the Playchoice 10.
It strikes me that a Neo Geo rom emulator is a cost effective proposal at this point, flash is cheap now, and it's effectively the same setup as a genesis cart. I should put that on my todo list. If I can pull it off, a CPS2 rom emulator would absolutely rock. I should check into the timings, I'm sure it would work for both.
On that front, I lost the code for superufo ultimate mega SNES rom tool 2000 that I wrote. Now I need to rewrite it, I can't use my UFO now without it. I wrote it years ago to split up SNES roms, format floppies to 1.68 megs as it wrote it out - for use in my floppy based SNES cartridge copier. I wonder if that code I found to format the floppy would even work under XP? I guess a 4 line shell script in linux could do everything it did - I stole the muscle out of ucon anyways.
So that's my story, I can read this later when I'm bored and maybe be inspired to do something. I feel lazy now.
CTRL-F Yourself
How come Visual Studio's find function can't search in classes, methods or namespaces? The closest you get is "current block".
For that matter, how come MS guys don't use class explorer. Isn't the logical structure of the application more important than the physical layout of the source files?
For that matter, how come MS guys don't use class explorer. Isn't the logical structure of the application more important than the physical layout of the source files?
db4o and Transparent Persistence
So db4o supports transparent activation now, not actually instancing an object until it is first called. They claim the goal of completely transparent persistence has now been achieved. I worked with this a little before, about a year ago, and found it to be somewhat superior to the other ORM type sytems around. I'll have to play a little with the new transparency features, and see just how invisible it actually is.
db4o product announcement
db4o product announcement
Monday, January 21, 2008
MTU Issues
I have a linux based firewall (Gentoo w/ Shorewall) which keeps resetting the MTU on the internet interface to 576, seemingly randomly.
I put a directive in conf.d/net to force MTU to 1500, and manually typing "ifconfig eth0 mtu 1500" will work fine, but eventually it will reset back to 576. I'll generally notice either signing in to XBox live (which requires the big packets), or my wife will complain about her yahoo webmail (which seems to drop connections when it cant send the big packets).
The yahoo thing bothers me. I expect this behavior from XBox Live, since it's by definition a broadband only service. But how to dial up users manage yahoo these days? It doesn't really bother me, that was just a figure of speech. Dial up users can jump in a lake, but so can sites and services that require MTU's of 1500 - let the packets fragment you big babies.
Anyhow, if anyone knows what could be causing this issue, where to even look in the logs - I plead ignorance here, I don't even know which daemon is in charge of changing the MTU (dhcpcd alone?) I tried disabling traffic shaping to eliminate it as a cause, to no good effect, and I've swapped the net card and cables out to eliminate any hardware issues. If it's the cablemodem itself, I'm sure I'll be in for tons of fun trying to convince Comcast of that, though that wouldn't make sense - the issue is on eth0 of the router.
The problems seemed to start when the Vista laptop showed up on the network, but can Vista really be so bad that it can screw up linux' net code by osmosis?
(I fully realize nobody reads my day old blog no matter how awesome it is. Stay tuned for some world class animated gifs and midi backgrounds, I'm bringing back Geocities as web 3.0)
I put a directive in conf.d/net to force MTU to 1500, and manually typing "ifconfig eth0 mtu 1500" will work fine, but eventually it will reset back to 576. I'll generally notice either signing in to XBox live (which requires the big packets), or my wife will complain about her yahoo webmail (which seems to drop connections when it cant send the big packets).
The yahoo thing bothers me. I expect this behavior from XBox Live, since it's by definition a broadband only service. But how to dial up users manage yahoo these days? It doesn't really bother me, that was just a figure of speech. Dial up users can jump in a lake, but so can sites and services that require MTU's of 1500 - let the packets fragment you big babies.
Anyhow, if anyone knows what could be causing this issue, where to even look in the logs - I plead ignorance here, I don't even know which daemon is in charge of changing the MTU (dhcpcd alone?) I tried disabling traffic shaping to eliminate it as a cause, to no good effect, and I've swapped the net card and cables out to eliminate any hardware issues. If it's the cablemodem itself, I'm sure I'll be in for tons of fun trying to convince Comcast of that, though that wouldn't make sense - the issue is on eth0 of the router.
The problems seemed to start when the Vista laptop showed up on the network, but can Vista really be so bad that it can screw up linux' net code by osmosis?
(I fully realize nobody reads my day old blog no matter how awesome it is. Stay tuned for some world class animated gifs and midi backgrounds, I'm bringing back Geocities as web 3.0)
Stupid Preprocessor Tricks in C#
Did you know that this compiles:
#region methods
private
#endregion
void SomeMethod()
{
}
Neat, huh? You can just jam #region and #endregion directives everywhere, to make your code SUPER DUPER UNREADABLE. How about right in the middle of a statement? NO PROBLEM.
#region INSANITY
private void SomeMethod()
{
string x = "I like " +
#endregion INSANTIY
"bees";
}
Neat, huh? So, my question is simple... Is there any reason you'd want to put region directives right in the middle of a routine, let alone a statement?
Edit: it makes sense that it would be so, since region directives are essentially whitespace to the compiler. I just found it amusing (as in I screwed around for a half hour trying to figure out why I was getting a 'more than one protection modifier' error, a collapsed region was hiding an extra "public" keyword.)
#region methods
private
#endregion
void SomeMethod()
{
}
Neat, huh? You can just jam #region and #endregion directives everywhere, to make your code SUPER DUPER UNREADABLE. How about right in the middle of a statement? NO PROBLEM.
#region INSANITY
private void SomeMethod()
{
string x = "I like " +
#endregion INSANTIY
"bees";
}
Neat, huh? So, my question is simple... Is there any reason you'd want to put region directives right in the middle of a routine, let alone a statement?
Edit: it makes sense that it would be so, since region directives are essentially whitespace to the compiler. I just found it amusing (as in I screwed around for a half hour trying to figure out why I was getting a 'more than one protection modifier' error, a collapsed region was hiding an extra "public" keyword.)
Call of Duty 4
If I walk into one more invisible barrier, or empty another clip into another bulletproof office cubicle wall, I just may have to smash the disk with a hammer and jam the polycarbonate shards into the next jerk to tell me what a fantastic game Call of Duty 4 is. I cant stand when some items in the environment are "cover", and some are just for show. Basically, the task is to memorize each firefight, over and over and over, until you come out on top. There's no reacting on the fly, scraping through by the seat of your pants... there's no fun. This game is pretty much just wanking material for war nerd spec ops wannabees.
I can never "get in" to this sort of "delta tango unsub rainbow six tango mango" war sim stuff anyways. Maybe I grew up around too many part-time army guys who figured they were Rambo every tuesday from 6-8PM. The jargon annoys me, and I hate having to carry a "squad" of AI dipsh*ts. Also, they could have rendered some new environments to be "middle east", instead of reusing the "war torn germany" maps from the earlier COD games. I could forgive all this if the game itself was fun.
Between this and BioShock, 360 owners are really showing themselves to be a bunch of low IQ drunks, easily impressed by flashing colors. They should just a random fight sequence from one of the Blade movies on a video loop, and release it as a 360 title. Throw in some quotes about how many pixels it is, and how much resolution it has. This impresses morons, even if they don't really understand it. It would make GOTY.
I hear BioShock is nominated for umpteen zillion awards. Sheesh, what a self masturbatory waste of time video game awards are. Hooray, shooting the same enemy in the same rooms over, and over, and over. Please keep innovating, XBox developers.
For the record, I liked Halo 3 a whole lot. No invisible walls, and plenty of in game variety. I'm pretty sure all the people out there calling it overhyped are the same type of folk for whom anything sufficiently popular must be uncool, the type who constantly need to remind you that they're "totally different" - just like everyone else. Apparently it sucks because they sacrificed about a hundred lines of vertical resolution, in favor of a second framebuffer. I doubt the average gamer knows what double buffering is, let alone the lighting effects it makes possible, but if Halo 3 is running in a slightly lower resolution, surely it is teh suck.
I can never "get in" to this sort of "delta tango unsub rainbow six tango mango" war sim stuff anyways. Maybe I grew up around too many part-time army guys who figured they were Rambo every tuesday from 6-8PM. The jargon annoys me, and I hate having to carry a "squad" of AI dipsh*ts. Also, they could have rendered some new environments to be "middle east", instead of reusing the "war torn germany" maps from the earlier COD games. I could forgive all this if the game itself was fun.
Between this and BioShock, 360 owners are really showing themselves to be a bunch of low IQ drunks, easily impressed by flashing colors. They should just a random fight sequence from one of the Blade movies on a video loop, and release it as a 360 title. Throw in some quotes about how many pixels it is, and how much resolution it has. This impresses morons, even if they don't really understand it. It would make GOTY.
I hear BioShock is nominated for umpteen zillion awards. Sheesh, what a self masturbatory waste of time video game awards are. Hooray, shooting the same enemy in the same rooms over, and over, and over. Please keep innovating, XBox developers.
For the record, I liked Halo 3 a whole lot. No invisible walls, and plenty of in game variety. I'm pretty sure all the people out there calling it overhyped are the same type of folk for whom anything sufficiently popular must be uncool, the type who constantly need to remind you that they're "totally different" - just like everyone else. Apparently it sucks because they sacrificed about a hundred lines of vertical resolution, in favor of a second framebuffer. I doubt the average gamer knows what double buffering is, let alone the lighting effects it makes possible, but if Halo 3 is running in a slightly lower resolution, surely it is teh suck.
Unit Tests for Old Code and Crazy Dog Ladies
So my brother knows this crazy dog lady, who lives in a 100+ year old farm house, and has decided to augment her dog collection with 8 or so teenagers. Of course she needs more space to make this happen, so she brought a contractor out to ask about putting a bathroom into the shed, to make it living space - because when I say crazy, I mean crazy.
She brought out a contractor, who no doubt looked to her with that mix of bemusement and confusion one gets when one wastes half a day to scope a monumentally stupid task, and asked her, "where do you think it's going to drain to?". She answered, "I don't care, a pipe out the back or something."
So here I am sitting at my gig in front of a mountain of code, some good, though a lot of it is that overbuilt sort of "there's lots of words, it's extra double good" type of code all developers write out of ego.
But the problem, as it were, is a big push from management towards unit testing, and the old "code coverage" buzzword is getting tossed around. Once we have 80% or higher code coverage, we will have crossed the "bug count" singularity, and our codebase will implode upon it's own awesomeness and form a new supermassive black hole, I don't know.
I'm long familiar with unit testing from a functional design, creating the tests first and building the code around that.
But I'm sitting in front of code with epic method calls, you know the type - "private void DoAllTheTasksInOneCall(string[] EveryParameterPossible, out int ReturnValueBecauseImAMoMo)". Of course, the definitions of the parameters, the return value, and what "AllTheTasks" means are nowhere to be found.
I need to pass or fail this thing, but I have no idea what it does. Like any public school teacher, though, it would behoove me to pass everyone, because a failure would make me look bad, not so much the original coder.
So, my question is, Where do you expect me to put the drain? Yeah, I could stick a pipe out the back but that just makes for a yard full of poop.
To the C# MSDN globetrotter all-star geeks: how do you approach unit testing legacy crap? In particular, how do you deal with private methods? I can think of a few approaches, each with pros and cons. We're on VStudio 2005, TFS, and my coworkers have downed the KoolAid double fisted and it is the most amazing IDE money can buy.
1) Run the built in Unit Test wizard, and let it codegen a private accessor. Pros: I get a private accessor, and I'm always thrilled to have MSDN put sourcecode in my projects with a dire warning that I never, ever, ever, ever, ever dare touch the code.
Cons: Well, if I refactor my project, my accessor is junk now. Why can't VStudio rebuild this accessor as a prebuild step in the unit test? Who knows. All my objects will be wrapped in these accessors, so I'm testing them - and not the code itself. If I want to mock objects with RhinoMocks, or it's ilk, I have to mock the wrapper. Why should I be unit testing autogenned dog crap? Ultimately, I'm indirectly testing private methods, and that's never preferable.
2) The [assembly: System.Runtime.CompilerServices.InternalsVisibleTo] attribute, which allows me to simply call my class directly in the test project. Cons: well, intellisense doesn't seem to work in the test project but intellisense is pretty much a crutch for babies anyways - at least I'm creating and calling the classes directly. There's a few more mouseclicks and copy/pastes to sign the test projects binary, and embed it's PublicKey in the attribute, or else any joker could be instancing internal classes, and that will not do.
The problem with these approaches is they don't really seek to solve the real problem. Both assume I know what this object does in the first place.
My preferred option, the Holmes on Code approach:
3) Refactor, redesign and rewrite the code. Tear this all out, it simply has to go. We're going to knock down all these classes, come in here with a new MVP model, and simply will not quit until everything is encased in 8 inches or more of spray foam. We'll bring in the experts to properly size and install a new septic system. It will be expensive, it will take a lot of time, but it will be done right the first time.
This takes time. I'm talking about going back to the functional design (creating it if it never existed), and in many cases starting over. But how else do you do it? Just throwing an accessor onto some void method, calling it, and assume that if I didn't trap an exception everything is hunkydory?
Of course, refactoring and rewriting carries the largest risk of introducing new bugs, but, it leaves the project with better, and more testable code which can then truly become more robust. But it's a hard sell when QA finds issues with code that worked before, and you try to tell them with a straight face that it "works better now" despite all the crippling new bugs. So I'm either explaining my 20% code coverage, or why my new "100%" tested code, doesn't work as well.
I miss the days when unit testing was something only real developers knew about, back before Microsoft decided to borf up a sloppy knock off of NUnit and hotglue it to their "one size fits all" development environment.
Now "unit testing" is a buzzword in the "agile XTREMe 2 tha max" canon, and in danger of becoming a massive timesink. Good code is testable, but simply making bad code testable doesn't make it good. Folks sure seem to think so.
She brought out a contractor, who no doubt looked to her with that mix of bemusement and confusion one gets when one wastes half a day to scope a monumentally stupid task, and asked her, "where do you think it's going to drain to?". She answered, "I don't care, a pipe out the back or something."
So here I am sitting at my gig in front of a mountain of code, some good, though a lot of it is that overbuilt sort of "there's lots of words, it's extra double good" type of code all developers write out of ego.
But the problem, as it were, is a big push from management towards unit testing, and the old "code coverage" buzzword is getting tossed around. Once we have 80% or higher code coverage, we will have crossed the "bug count" singularity, and our codebase will implode upon it's own awesomeness and form a new supermassive black hole, I don't know.
I'm long familiar with unit testing from a functional design, creating the tests first and building the code around that.
But I'm sitting in front of code with epic method calls, you know the type - "private void DoAllTheTasksInOneCall(string[] EveryParameterPossible, out int ReturnValueBecauseImAMoMo)". Of course, the definitions of the parameters, the return value, and what "AllTheTasks" means are nowhere to be found.
I need to pass or fail this thing, but I have no idea what it does. Like any public school teacher, though, it would behoove me to pass everyone, because a failure would make me look bad, not so much the original coder.
So, my question is, Where do you expect me to put the drain? Yeah, I could stick a pipe out the back but that just makes for a yard full of poop.
To the C# MSDN globetrotter all-star geeks: how do you approach unit testing legacy crap? In particular, how do you deal with private methods? I can think of a few approaches, each with pros and cons. We're on VStudio 2005, TFS, and my coworkers have downed the KoolAid double fisted and it is the most amazing IDE money can buy.
1) Run the built in Unit Test wizard, and let it codegen a private accessor. Pros: I get a private accessor, and I'm always thrilled to have MSDN put sourcecode in my projects with a dire warning that I never, ever, ever, ever, ever dare touch the code.
Cons: Well, if I refactor my project, my accessor is junk now. Why can't VStudio rebuild this accessor as a prebuild step in the unit test? Who knows. All my objects will be wrapped in these accessors, so I'm testing them - and not the code itself. If I want to mock objects with RhinoMocks, or it's ilk, I have to mock the wrapper. Why should I be unit testing autogenned dog crap? Ultimately, I'm indirectly testing private methods, and that's never preferable.
2) The [assembly: System.Runtime.CompilerServices.InternalsVisibleTo] attribute, which allows me to simply call my class directly in the test project. Cons: well, intellisense doesn't seem to work in the test project but intellisense is pretty much a crutch for babies anyways - at least I'm creating and calling the classes directly. There's a few more mouseclicks and copy/pastes to sign the test projects binary, and embed it's PublicKey in the attribute, or else any joker could be instancing internal classes, and that will not do.
The problem with these approaches is they don't really seek to solve the real problem. Both assume I know what this object does in the first place.
My preferred option, the Holmes on Code approach:
3) Refactor, redesign and rewrite the code. Tear this all out, it simply has to go. We're going to knock down all these classes, come in here with a new MVP model, and simply will not quit until everything is encased in 8 inches or more of spray foam. We'll bring in the experts to properly size and install a new septic system. It will be expensive, it will take a lot of time, but it will be done right the first time.
This takes time. I'm talking about going back to the functional design (creating it if it never existed), and in many cases starting over. But how else do you do it? Just throwing an accessor onto some void method, calling it, and assume that if I didn't trap an exception everything is hunkydory?
Of course, refactoring and rewriting carries the largest risk of introducing new bugs, but, it leaves the project with better, and more testable code which can then truly become more robust. But it's a hard sell when QA finds issues with code that worked before, and you try to tell them with a straight face that it "works better now" despite all the crippling new bugs. So I'm either explaining my 20% code coverage, or why my new "100%" tested code, doesn't work as well.
I miss the days when unit testing was something only real developers knew about, back before Microsoft decided to borf up a sloppy knock off of NUnit and hotglue it to their "one size fits all" development environment.
Now "unit testing" is a buzzword in the "agile XTREMe 2 tha max" canon, and in danger of becoming a massive timesink. Good code is testable, but simply making bad code testable doesn't make it good. Folks sure seem to think so.
Subscribe to:
Comments (Atom)