## Search found 45 matches

Thu May 31, 2018 5:24 am
Topic: Loop Unrolling - Optimal Unrolling Factor?
Replies: 7
Views: 2747

### 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
Topic: Game loops and Vertical Blank interupts
Replies: 29
Views: 6547

### 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
Topic: Loop Unrolling - Optimal Unrolling Factor?
Replies: 7
Views: 2747

### 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
Topic: Loop Unrolling - Optimal Unrolling Factor?
Replies: 7
Views: 2747

### 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
Topic: Where do I start? I'm seeking technical documents.
Replies: 40
Views: 8587

### Re: Where do I start? I'm seeking technical documents.

Wed Feb 21, 2018 12:24 am
Forum: Blabla
Topic: C++ Libraries for Genesis Programming
Replies: 3
Views: 4416

### 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: 5625

### 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: 4416

### 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
Topic: Sprite Data Mashed Up
Replies: 3
Views: 1158

### 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
Topic: Aggregating Code Snippets
Replies: 6
Views: 1792

### Re: Aggregating Code Snippets

MintyTheCat wrote:This site desperately needs a Wiki.
Good idea. After all, there is an nesdev wiki, so maybe we can call it gendev or mddev (md for Mega Drive).

We could put all our YM2612 knowledge, code snippets, and other Genesis research stuff on there.
Mon Mar 06, 2017 1:28 am
Topic: Aggregating Code Snippets
Replies: 6
Views: 1792

### 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
Topic: Aggregating Code Snippets
Replies: 6
Views: 1792

### 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
Topic: Best tool for password reverse engineering?
Replies: 3
Views: 1474

### 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
Topic: Z80 DAC Sound Problem
Replies: 2
Views: 1576

### 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