I think I posted them here a long time ago… and they should be in some of the libraries with various demos I’ve posted, but here they are as well. I grabbed these from one of my libraries, though I don’t remember if this was the latest one (I’ve probably got 100 different libraries :P).
I think it works, but IIRC I improved these functions a few years ago… I don’t know if these are them or not. They’re simple enough though… you could probably rewrite them with little effort.
Heh, from a quick glance, a better way than decrementing num to 0 would be to precompute the final pointer and compare current to final… that’d remove a cycle per word 🙂 . If you know the src/dest address ahead of time (basically inlining this code rather than calling the function), you could use the same incrementer to save a cycle as well. And of course if you knew you had a long copy, you could unroll it a little bit and require quad-word alignment or something to save some cycles.
But as usual… there’s usually a “good enough” point 😉 .
void copymem (BYTE* dest, BYTE* src, unsigned int num) { asm(" jr end%= loop%=: ld.b 0[%1],r10 /* load source byte */ st.b r10,0[%0] /* store dest byte */ add 1,%0 /* increment dest pointer */ add 1,%1 /* increment src pointer */ add -1,%2 /* decrement bytes remaining to 0 */ end%=: cmp 0,%2 /* compare num with 0 to tell when done */ bgt loop%= /* loop if bytes remaining is greater than 0 */ " : /* No Output */ : "r" (dest), "r" (src), "r" (num) /* Input */ : "r10" /* regs used */ ); } void copyhword (HWORD* dest, HWORD* src, unsigned int num) { asm(" jr end%= loop%=: ld.h 0[%1],r10 /* load source hword */ st.h r10,0[%0] /* store dest hword */ add 2,%0 /* increment dest pointer */ add 2,%1 /* increment src pointer */ add -1,%2 /* decrement hwords remaining to 0 */ end%=: cmp 0,%2 /* compare num with 0 to tell when done */ bgt loop%= /* loop if hwords remaining is greater than 0 */ " : /* No Output */ : "r" (dest), "r" (src), "r" (num) /* Input */ : "r10" /* regs used */ ); } void copyword (WORD* dest, WORD* src, unsigned int num) { asm(" jr end%= loop%=: ld.w 0[%1],r10 /* load source word */ st.w r10,0[%0] /* store dest word */ add 4,%0 /* increment dest pointer */ add 4,%1 /* increment src pointer */ add -1,%2 /* decrement words remaining to 0 */ end%=: cmp 0,%2 /* compare num with 0 to tell when done */ bgt loop%= /* loop if words remaining is greater than 0 */ " : /* No Output */ : "r" (dest), "r" (src), "r" (num) /* Input */ : "r10" /* regs used */ ); } void setmem (BYTE* dest, BYTE src, unsigned int num) { asm(" jr end%= loop%=: st.b %1,0[%0] /* store dest byte */ add 1,%0 /* increment dest pointer */ add -1,%2 /* decrement bytes remaining to 0 */ end%=: cmp 0,%2 /* compare num with 0 to tell when done */ bgt loop%= /* loop if bytes remaining is greater than 0 */ " : /* No Output */ : "r" (dest), "r" (src), "r" (num) /* Input */ /* no regs used */ ); } void sethword (HWORD* dest, HWORD src, unsigned int num) { asm(" jr end%= loop%=: st.h %1,0[%0] /* store dest byte */ add 2,%0 /* increment dest pointer */ add -1,%2 /* decrement bytes remaining to 0 */ end%=: cmp 0,%2 /* compare num with 0 to tell when done */ bgt loop%= /* loop if bytes remaining is greater than 0 */ " : /* No Output */ : "r" (dest), "r" (src), "r" (num) /* Input */ /* no regs used */ ); } void setword (WORD* dest, WORD src, unsigned int num) { asm(" jr end%= loop%=: st.w %1,0[%0] /* store dest byte */ add 4,%0 /* increment dest pointer */ add -1,%2 /* decrement bytes remaining to 0 */ end%=: cmp 0,%2 /* compare num with 0 to tell when done */ bgt loop%= /* loop if bytes remaining is greater than 0 */ " : /* No Output */ : "r" (dest), "r" (src), "r" (num) /* Input */ /* no regs used */ ); }
DogP
Have you tested them versus my ASM versions? The C versions are really slow… just rewriting them in ASM (and of course copying words vs. bytes where possible) made them much faster.
IIRC, the bitstring functions aren’t very efficient for just plain copying memory… where it becomes nice is for doing operations (XOR, AND, etc) on strings of bits that aren’t necessarily byte/hword/word aligned. Even those I don’t think are much more efficient than doing them manually in ASM, but much nicer for sure.
DogP
I personally think all black would be best… even in the headphone example, the connector on the headphone is black. It seems like everything that connects to the bottom of the VB is black (controller, headphones, stand)… I think the link cable should be as well.
Anyway, I’m still waiting to hear back on a price for the completed assembly… hopefully it’ll be reasonable enough that I can make this happen. I’ll keep you guys updated.
DogP
mbuchman wrote:
Am I correct to assume that the actual cable assembly part is insignificant as far as cost goes?The nice thing about just buying the plugs and making our own cables is that it would be easy to make a cable to connect to computer then.
Yes, the cable is very cheap (probably <10 cents/ft), unless I can find some really nice cable. I'd really like something like the cable used on the VB controllers, but so far I haven't found anything like that for a reasonable price.
The expensive part is the custom molded plastic pieces. The price on them does come down with a lot of quantity, but for ~100 connectors, it's just really tough to make them cheap (unless anyone owns a plastic molding shop 😉 ).
DogP
Thanks for the input… glad to see there’s interest! Hedgetrimmer sent me a new model this morning with the full connector and shell, which we’ve gotta verify will won’t interfere with any other part of the VB, and possibly make some minor modifications.
I assume a black connector and cable is preferred? I think that’d match the rest of the system the best (and look OEM), though I can have the plastic molded in several different colors, as well as getting the cable in various colors. Red would probably be the only other reasonable option, but I don’t think it’d look as good as black.
I planned on 6′ cables, unless there’s a special request.
And yes, link cable GDB would be amazing… unfortunately, I still haven’t had time to learn enough about GDB to make it happen. Hopefully one of these days 🙂 .
I’ll keep you all updated on progress.
DogP
Thanks for the input… wouldn’t a rail shooter be kinda difficult with D-Pads though? I think that’d be shooting mechanics similar to Insmouse. An analog pad, or light gun (heh, VB light gun) would be much better for those games IMO.
DogP
Am I the only one who finds this thread funny? There’s someone out there making a zip for a “complete set” of homebrew so your GoodRoms will say LOLZ CONGRATZ 4 COLECTIN TEH COMPLEET SET!!!!!111. And I thought “collecting” all commercial ROMs was pointless 😛 .
Does anyone actually use GoodRoms anymore?
DogP
Okay… I’m compiling a list of game types with some examples… if anyone has any new ideas, try to get them in ASAP. I’d like to get comments, and put up a survey for vote soon.
Here’s what I’ve gathered so far (in no particular order):
Action Adventure (Legend of Zelda)
Platformer (Super Mario Bros, Mega Man, Castlevania)
FPS (Doom, Descent, Wolfenstein 3D)
RPG (Dragon Warrior, Final Fantasy)
Fighter (Street Fighter II, Mortal Kombat)
Run and shoot (Bangai-O, Robotron, Smash TV)
Beat ’em up (Battletoads, Double Dragon)
Action Strategy (Horde, Rampart)
Puzzle (Tetris, Bust a Move)
Inventory Adventure (Kings Quest)
Rail Shooter (Space Harrier, 3D Worldrunner)
Simulation (Racing, Flight)
Destruction (Rampage)
Survival Horror (Silent Hill, Resident Evil)
Sports (Mainstream, Track & Field, Olympics)
Ball and Paddle (Breakout, Virtual Block)
Feel free to comment on these, particularly on suitability for the VB (3D, controls, etc) and fun factor. Combinations are cool too… these categories are really more of a description of types than limiting a game to a specific genre.
For merging several types together… that sounds good, but I think we’d need to make sure we keep a common “feel”. We don’t want the first 1/4 of the game to be Zelda, then switch to Mario, then Bangai-O, then Doom. We also don’t want it to feel like a bunch of demos stuck together with duct tape 😉 .
Wario Land did a good job IMO… they made a common control for the game, even though throughout the stages you got upgrades, which changed gameplay a lot (flying, flames, etc), as well as swimming stages. Then the bosses had slightly different controls, and they threw in a few mini games between stages. This all really merged together nicely.
DogP
Yeah, I don’t think I’ve ever seen the plastic countertop one go for nearly that much. I would personally expect ~$150-$200, though they seem to vary quite a bit. I got mine for $50, and I can’t remember seeing one sell for more than $250.
IMO ebay has really lost auction traffic… it seems like everyone does BIN anymore, so it may be a good idea to put a BIN w/ Best Offer option. Otherwise it may go really cheap, or just get no bids if you start the price too high.
DogP
Yeah, if you’ve got an idea for a game… definitely draw it out (or at least try to describe it). I agree about having no direction… that’s why I think we need to decide on a game style ASAP, so we can focus our actions toward one idea.
DogP
One other game style I was just thinking about that I think is a lot of fun is the action/strategy/puzzle games, like The Horde ( http://en.wikipedia.org/wiki/The_Horde_%28video_game%29 ) and Rampart ( http://en.wikipedia.org/wiki/Rampart_%28arcade_game%29 ).
Beat ’em ups are also pretty fun IMO… games like the late 80’s/early 90’s Konami arcades (TMNT, Simpsons, etc), Battletoads, Streets of Rage, etc.
I wonder how a game like Rampage would hold up these days? I really liked that game as a kid, but I haven’t played it in many years. I don’t remember it really having a point except to keep pumping in quarters and smash stuff 😉 . It probably wouldn’t be that much fun in 1P mode.
VBSAM: A VB themed game could be cool… but that’s not really a game style… I mean we could make just about any game with a VB as the main character. Any specific style that you’re thinking of?
Does anyone else have any game ideas? I’d like to compile a list in the next couple days for comment.
DogP
Isn’t that the way Lameboy used to do his drawing? I remember him making a raycaster which was ridiculously slow, and I think he used BGMaps, rather than drawing directly to the framebuffers. I don’t think the BGMaps were the reason it was slow though 😉 .
DogP
Alright, great to hear more comments and still no naysayers 🙂 . I guess first steps would include deciding on a game, and getting the collaborative environment set up.
For deciding on a game, a vote would be nice, though we have to be realistic, as well as decide on something that would keep the interest of the people working on the game. Maybe we could take requests for game ideas from everyone, and then narrow that list down to games we could realistically make and that we’d be interested in making… then put that list out for vote.
For the collaborative environment… I like the idea of Google Code or Sourceforge… unfortunately, I haven’t hosted a project of my own on either one, though I don’t see any real downsides to either. From an interface point of view, I’d personally pick Google Code, but if anyone has any preferences/objections to one or the other, speak up… otherwise I’ll probably start setting up a project soon.
We’ll also need to work on creating a common set of libraries. Honestly, if nothing else comes from this project, completing this would be a truly great thing 🙂 .
I agree about not using copyrighted stuff, though of course our gameplay can be heavily based on ideas from existing games. I’ve personally been making “fan games” because I suck at graphics and sound, so at least by ripping off existing game GFX I can work on what I’m good at. Hopefully with this project we’ll have enough talent to do the full game without needing to rip that stuff off.
I don’t think we should count out a linked game yet… though I agree that a game should probably focus on 1P mode. In general handheld/portables are played 1P, since even with a cable, 2P requires two systems, a cable, two carts, etc… compared to something like NES/SNES which just requires a friend (though for some that may be the hardest part 😉 ). Don’t get your hopes up yet, but I am looking into getting link cables made 🙂 .
And yeah, I’m not expecting this to necessarily take priority over other projects (VB or otherwise), but sometimes one of us gets stuck, or lacks the skills to properly make certain parts on our own… but maybe someone else has a great idea how to do it, or has already done something similar and could make short work of that part.
I think we’ll need to start with baseline code, but not necessarily an engine. Hopefully, whatever game we choose will have enough elements that parts of the engine will be written by several people. But yes, there should be plenty for everyone to do at just about every stage of development.
About graphics and sound… we can come up with best practices for this. VIDE does have some annoyances, though we do have grit (slightly less user friendly, but more powerful). We don’t really have any good automatic sound converter, though we could probably come up with a document explaining possibilities… and maybe we could come up with a good format that’s both easy to create and play.
My personal preference on games… I really like platformers, like Megaman, Mario, etc… but we do have some of them already. I REALLY like Zelda style games, and I think this leaves a LOT to the imagination and definitely plenty for everyone to do (and who can say this doesn’t look beautiful: http://www.planetvb.com/modules/newbb/viewtopic.php?topic_id=3200 ). It is a really big project though… certainly more difficult than many other types of games. I’m not really a fighting game fan, though I think coding one would be fun. I’ve never played Bangai-O, but it looks pretty cool. It looks to me like a quick grab and play for a few minutes kinda game though… doesn’t look to me like something I’d get sucked into. I’m not sure about the inventory adventure games… I used to play Kings Quest when I was younger, but I think I’d prefer something with a little more action. That would certainly be a project for the artists and game designers though 😉 .
Anyway, there’s my long post for the night. 🙂
DogP
Any old-timers want to chime in? 😉 RunnerPack, DanB, KR155E… any of you guys willing to help if we get this going? Did I lose you guys in the long boring post? How’s this: How about we all work together on a game! 🙂
Of course this is a long term project idea, so I’m not looking for commitments for help on it this weekend or anything… but selecting a game and getting a project plan together would certainly go a long way. And I know it’s one of these “if you build it, they will come” sorta things, so I’m willing to set up the logistics and take the first steps to show that this is a feasable project, but if it’s gonna get done, we’re gonna need as much help as possible. 🙂
But if some of you guys are keeping quiet because you don’t like the idea, but don’t want to be the “wet blanket”, that’d be nice to hear 😉 . If you just don’t think this project will ever get anywhere… don’t worry, this project is in such an early stage that I think the same thing. But I’d like to give it wings, or at least legs 😉 . If this can get some momentum, I think it really could be great.
DogP
rubengar wrote:
It’s a fantastic idea, if my capitan sevilla leave me some time, I can help with the graphics!
Yeah, I was really impressed with the graphics in your game… did you actually make them all yourself?
Fwirt wrote:
Also, one of the big non-coding jobs you forgot: level design. You can have the best engine in the world, but crappy level design will kill your game.
Heh, yep… on the way to work I was giving this some thought and realized that I forgot level design. Definitely an important one.
I’m glad to hear that (at least everyone who has commented) is supportive of the idea… anyone else have any comments? I’d like to get some more input and see how we can get this started.
DogP
Yeah, Ground Kontrol looks great… if I’m ever up that way I’ll definitely make a stop there.
I’ll start a thread in the dev forum about the community game… it’ll probably die off like most, but if we can get something off the ground, it should be great.
DogP
RunnerPack wrote:
I love the “little touches” like the moon and its rippling reflection in the water
Yeah, I thought that was really cool as well, except I wondered if the full moon rises and sets… where’s the sun?
DogP
Fwirt wrote:
Pretty impressive for a few hours of work. I think the main problem with it right now is collision detection, I can’t tell you how many times I’ve gotten near the top and randomly phased through one of the platforms.You know, maybe we actually _should_ have a 48 hour VB coding comp sometime. A “Ludum Dare Puero Fere” if you will. 😀 (Just make sure it’s during the summer.)
…..And what is this about a basement arcade?
Yeah… sorry about the collision detection 😛 . I agree that a 48 hr coding comp would be pretty fun… we had talked about a game in a day thing previously, and I think that’d be pretty cool to see what people come up with in such a short timeframe.
I also think a community game would be really fun… if we could break down a game into perfectly manageable parts, rather than everyone writing a short simple game, everyone writes/designs/creates small simple chunks… which get merged into a cool large project that people would actually want to play. Imaging an RPG where someone writes an overworld engine, someone writes a fight engine, someone writes the item, character, etc backend, someone makes the main menu stuff, someone designs characters, someone designs the overworld, someone makes music/sound effects… and so on. I think the most difficult part would be managing the whole thing, delegating responsibilities.
My arcade: http://www.planetvb.com/modules/newbb/viewtopic.php?topic_id=4049&forum=4 .
DogP
Heh, thanks for the comments. I actually like the perfectly elastic collisions, but I did want to implement horizontal drag… but didn’t get there. I also planned for better collision detection… right now the detection is for straight up bounces. I wanted to add pong paddle-like collision with the platforms when you landed on the edges. But, the time wasn’t there for much of what I wanted.
I also planned on having a foreground and background to jump between, but that would have required some smart level design for making that useful, as well as making the graphics so you could actually see blocks in the foreground and background at the same time.
Had I planned to do the game in a day, I would have adjusted my sleep schedule… though I guess had a I PLANNED on making this, I wouldn’t have waited until the last day 😉 .
DogP