Search found 30 matches
- Sat Jul 26, 2008 7:59 pm
- Forum: Megadrive/Genesis
- Topic: Bug in genesis.c?
- Replies: 16
- Views: 13498
- Sat Jul 26, 2008 2:32 pm
- Forum: Megadrive/Genesis
- Topic: Bug in genesis.c?
- Replies: 16
- Views: 13498
You need to have code in RAM only if you're DMAing from outside the ROM area (i.e from MD RAM to VRAM). But that's not what the official documentation says: Source address are $000000-$3FFFFF(ROM) and $FF0000--$FFFFFF(RAM) for memory to VRAM transfers. In the case of ROM to VRAM transfers, a hardwa...
- Sat Jul 26, 2008 9:37 am
- Forum: Megadrive/Genesis
- Topic: Bug in genesis.c?
- Replies: 16
- Views: 13498
Bug in genesis.c?
I'm converting dma_vram_copy from genesis.c into ASM and I think I found a bug in it, at least the version I have. (I got it from one of his examples, so maybe he's updated it since then...) void dma_vram_copy(uint source,ushort dest,ushort len) { register volatile ushort *pw; register uint *pl; /* ...
- Thu Jul 24, 2008 8:17 pm
- Forum: Megadrive/Genesis
- Topic: To NOP or not to NOP
- Replies: 16
- Views: 14125
For any more serious MD dev, you need a flashcart or something else to run your code on the real deal... there's a lot of stuff you can do in emulators and not on real HW. Try using BTST on VDP ;) Well, sure, but I think the point still stands -- especially if the required delay might be slightly d...
- Thu Jul 24, 2008 7:52 pm
- Forum: Megadrive/Genesis
- Topic: To NOP or not to NOP
- Replies: 16
- Views: 14125
but you should check the output if you want to be sure. I don't like the idea of relying on examining the compiler output for a decision like that. That gratuitously ties your code down to that particular version of that particular compiler... if you switch to a compiler that produces different cod...
- Thu Jul 24, 2008 4:31 am
- Forum: Megadrive/Genesis
- Topic: To NOP or not to NOP
- Replies: 16
- Views: 14125
I have to admit it took me a second to figure out what you meant. So basically you're saying the fetch/decode part of the CPU's fetch/decode/execute sequence for the move instruction should cover it, right? Got it. :) Or actually... could NOPs actually take 8 cycles rather than 4, hence two NOPs = 1...
- Wed Jul 23, 2008 6:40 pm
- Forum: Megadrive/Genesis
- Topic: To NOP or not to NOP
- Replies: 16
- Views: 14125
I found one doc that says you need 16 cycles. Two NOPs is eight cycles. I'm not sure whether or not the doc means you need 16 cycles before the next move instruction that accesses the register, or 16 cycles including the next move instruction. If it includes it, then it should work out to at least 1...
- Tue Jul 22, 2008 9:14 pm
- Forum: Megadrive/Genesis
- Topic: Learning ASM
- Replies: 13
- Views: 12835
Pascal's code can be improved by using segments to declare variables. It's easier to read and it won't give you a chance to make a mistake and screw up your variables by declaring them wrong. (This code is for asmx. It's probably very similar or even identical in other assemblers, but not having use...
- Tue Jul 22, 2008 8:43 am
- Forum: Megadrive/Genesis
- Topic: ASM register management
- Replies: 32
- Views: 24846
- Tue Jul 22, 2008 8:22 am
- Forum: Megadrive/Genesis
- Topic: ASM register management
- Replies: 32
- Views: 24846
OK, I can see my line of thinking is not popular and it's not the "ASM way", so I will probably abandon this line of thinking. But for the sake of argument, I'll defend it anyway. NEVER put anything on the stack if you have a free register. The more you keep stuff in registers, the faster it will be...
- Tue Jul 22, 2008 12:38 am
- Forum: Megadrive/Genesis
- Topic: To NOP or not to NOP
- Replies: 16
- Views: 14125
you have to put them after every TH line modification. So it's something specific to that particular register, then? Any other places where I might need to use NOP where it isn't obvious from the documentation? I'd say, question is 'how long this delay must be'? Because different C compilers with d...
- Mon Jul 21, 2008 9:49 pm
- Forum: Megadrive/Genesis
- Topic: To NOP or not to NOP
- Replies: 16
- Views: 14125
- Mon Jul 21, 2008 9:45 pm
- Forum: Megadrive/Genesis
- Topic: ASM register management
- Replies: 32
- Views: 24846
the registers you pass get trashed (read: clobbered) anyway Eh? Not if you don't change 'em, or if you preserve 'em. Keeping track of 8/16/32 bit things shouldn't be a problem... you have B/W/L to tell you what are you dealing with. I was thinking more along the lines of remembering whether you sho...
- Mon Jul 21, 2008 8:46 pm
- Forum: Megadrive/Genesis
- Topic: To NOP or not to NOP
- Replies: 16
- Views: 14125
To NOP or not to NOP
I'm wondering when exactly you should use NOP. For instance, here's the read_joypad1 routine from genesis.c: ushort read_joypad1() { register volatile uchar *pb; ushort i, j; pb = (uchar *) 0xa10003; *pb = 0x40; /* check joypad */ asm("nop"); asm("nop"); i = *pb & 0x3f; *pb = 0; /* check buttons */ ...
- Mon Jul 21, 2008 8:37 pm
- Forum: Megadrive/Genesis
- Topic: ASM register management
- Replies: 32
- Views: 24846
ASM register management
This is more of a general M68000 question than a Genesis question, but I figured I might as well post it here. :) I decided to start coding a game entirely in ASM as a programming exercise of sorts. I've been well-acquainted with the general principles of ASM for probably over 10 years now, but I've...