Search found 45 matches
- Thu May 31, 2018 5:24 am
- Forum: Megadrive/Genesis
- Topic: Loop Unrolling - Optimal Unrolling Factor?
- Replies: 7
- Views: 6880
Re: Loop Unrolling - Optimal Unrolling Factor?
I'm trying to optimize a trade-off between code size (space) and cycles taken (time). When programming, you often have to make this kind of decision.
- Wed May 30, 2018 11:45 pm
- Forum: Megadrive/Genesis
- Topic: Game loops and Vertical Blank interupts
- Replies: 29
- Views: 20413
Re: Game loops and Vertical Blank interupts
One thing a lot of NES games do is set a variable to $00 until VBlank has fired, and then during VBlank, it gets set to $FF. At the end of VBlank, it returns to $00. This could be easily adapted to the Sega Genesis. This could be checked for at the beginning of the VBlank routine: If the flag is $00...
- Wed May 30, 2018 10:52 pm
- Forum: Megadrive/Genesis
- Topic: Loop Unrolling - Optimal Unrolling Factor?
- Replies: 7
- Views: 6880
Re: Loop Unrolling - Optimal Unrolling Factor?
For those who are interested, let me explain the derivation of the formula. Assume that the instruction(s) take c cycles to execute. The DBRA takes 10 cycles when taken, and 14 cycles when not taken. When the loop is completely rolled, each iteration takes c +10 cycles. The final iteration takes c +...
- Wed May 30, 2018 12:30 am
- Forum: Megadrive/Genesis
- Topic: Loop Unrolling - Optimal Unrolling Factor?
- Replies: 7
- Views: 6880
Loop Unrolling - Optimal Unrolling Factor?
When unrolling loops using the DBRA instruction and a fixed number of iterations, I think I have found the optimal unrolling factor. Multiply the number of iterations by 10, then take the square root. For example, if you have a loop that is executed 200 times, then you would compute: sqrt(200 * 10) ...
- Sun Feb 25, 2018 2:58 am
- Forum: Megadrive/Genesis
- Topic: Where do I start? I'm seeking technical documents.
- Replies: 40
- Views: 29014
- Wed Feb 21, 2018 12:24 am
- Forum: Blabla
- Topic: C++ Libraries for Genesis Programming
- Replies: 3
- Views: 12070
Re: C++ Libraries for Genesis Programming
Here are my routines for Enigma compression: This routine takes a vector of 16-bit values (unsigned short ints), and returns an Enigma-compressed file in a byte-vector. Make sure you have the typedefs mentioned in the first post of this thread. vector<byte> Enigma_Decomp(vector<u16> &f) { // f = map...
- Mon Jan 01, 2018 11:51 pm
- Forum: Blabla
- Topic: Make a wish / What if : Genesis
- Replies: 21
- Views: 27684
Re: Make a wish / What if : Genesis
If there was a Super Sega Genesis, I might add the following: 32-bit addresses (can you imagine a 1-gigabyte Sega Genesis game?) Extra VRAM (maybe 4-8 times as much) Higher CRAM color resolution, and more palettes to choose from More planes (maybe 4) More sprites More sound chips and channels (about...
- Thu Oct 05, 2017 11:57 pm
- Forum: Blabla
- Topic: C++ Libraries for Genesis Programming
- Replies: 3
- Views: 12070
C++ Libraries for Genesis Programming
When programming for the Sega Genesis or any other system, it might be a good idea to write your own libraries to encode the data however you want. You can also write libraries for finding the optimal setting for some things. For example, I recently made my own Nemesis-compressor in C++. You will ne...
- Tue Apr 04, 2017 5:52 am
- Forum: Megadrive/Genesis
- Topic: Sprite Data Mashed Up
- Replies: 3
- Views: 3723
Re: Sprite Data Mashed Up
For 80 sprites, what I usually like to do is number their link fields 1-79 then 0.
- Wed Mar 08, 2017 3:14 pm
- Forum: Megadrive/Genesis
- Topic: Aggregating Code Snippets
- Replies: 6
- Views: 7211
Re: Aggregating Code Snippets
Good idea. After all, there is an nesdev wiki, so maybe we can call it gendev or mddev (md for Mega Drive).MintyTheCat wrote:This site desperately needs a Wiki.
We could put all our YM2612 knowledge, code snippets, and other Genesis research stuff on there.
- Mon Mar 06, 2017 1:28 am
- Forum: Megadrive/Genesis
- Topic: Aggregating Code Snippets
- Replies: 6
- Views: 7211
Re: Aggregating Code Snippets
This piece of code takes the XNZVC bits of the SR and uses them as an index into a jump table. In this jump table, each branch target is a BRA.B instruction. Jump_SR: move.w sr,-(a7) move.l d0,-(a7) move.w 4(a7),d0 andi.w #$1F,d0 ext.l d0 add.w d0,d0 add.l d0,6(a7) addq.l #6,a7 rts If you want to us...
- Sat Mar 04, 2017 4:16 am
- Forum: Megadrive/Genesis
- Topic: Aggregating Code Snippets
- Replies: 6
- Views: 7211
Aggregating Code Snippets
In response to Mask of Destiny's post about aggregating community research, I'd like to aggregate all the interesting code snippets I've posted. The one takes a set of colors (in 9-bit strings, bbbgggrrr format) that are compressed, and decompresses them. Load_CompColors: ;==========================...
- Tue Jul 26, 2016 1:30 am
- Forum: Megadrive/Genesis
- Topic: Best tool for password reverse engineering?
- Replies: 5
- Views: 7826
Re: Best tool for password reverse engineering?
Hi guys, inspired by the cool master system password generators over at smspower, I thought it'd be fun to try to do the same for the megadrive as an intro to reverse engineering/assembly (I appreciate the learning curve for this stuff is huge, so there really is no easy place to start!). I picked ...
- Mon Apr 18, 2016 4:19 am
- Forum: Megadrive/Genesis
- Topic: Z80 DAC Sound Problem
- Replies: 2
- Views: 3547
Re: Z80 DAC Sound Problem
Here's the code I used to initialize the Z80: moveq #$000,d0 ; Load constant $0000 (bit 8 clear). move.w #$100,d7 ; Load constant $0100 (bit 8 set). lea $A11100,a1 ; POINT TO: Z80 Start/Stop Switch. lea $A11200,a2 ; POINT TO: Z80 Reset Switch. lea Z80_Program(pc),a5 ; POINT TO: Z80 Program. lea $A00...
- Mon Apr 18, 2016 2:35 am
- Forum: Megadrive/Genesis
- Topic: Z80 DAC Sound Problem
- Replies: 2
- Views: 3547
Z80 DAC Sound Problem
I wrote a simple piece of Z80 code to play a small DAC sample. I've got it running properly. However, when I play it on various emulators, most of the time I don't hear anything, and I double-checked to make sure that the sound was on. I only hear the sample when I play it on Exodus. What's the prob...