Search found 81 matches

by Graz
Sat Mar 26, 2011 2:56 pm
Forum: Blabla
Topic: GCC question
Replies: 3
Views: 1813

Strike that. Not enough coffee. Your (smth - 1) is executed using integers in C. -1 % 32 = -1, which when re-read as unsigned char is 255. The compiler is correct. You could try (unsigned int)(smth - 1) % 32. However, the solution using & 31 is probably what you mean anyway (as in, you want the low ...
by Graz
Sat Mar 26, 2011 2:25 pm
Forum: Blabla
Topic: GCC question
Replies: 3
Views: 1813

From only this information, it looks like a compiler bug. Nothing %32 should be >= 32 by definition. 68K gcc I assume? What version of the compiler are you using? Can you post the disassembly (use -fsave-temps or objdump -S).

As a workaround, you could do smth=(smth-1)&31. It's more efficient anyway.
by Graz
Sat Mar 26, 2011 2:20 pm
Forum: Megadrive/Genesis
Topic: Super Magic Drive research thread
Replies: 133
Views: 63561

Binutils actually supports Z80 since version 2.19 or so. That includes the linker, disassembler and everything. If you're using GNU based tools for 68K + SH2, it's really convenient to have the exact same toolchain for Z80 too.
by Graz
Fri Nov 19, 2010 1:19 am
Forum: Blabla
Topic: Devcart wishlist?
Replies: 42
Views: 11212

I'm pretty interested in hardware development and I have a bunch of ideas of things I want to do with FPGAs connected to the MD. However, I don't want to go to the trouble and expense of building a full featured flash/RAM cart like the ones in this thread. For me, my ideal devcart would have a passt...
by Graz
Sat Sep 11, 2010 9:08 pm
Forum: Megadrive/Genesis
Topic: Wierd Interrupt Issue
Replies: 12
Views: 3058

Oh yeah. Hadn't noticed that. Here's a larger chunk of disassembled code: // asm volatile ("move.w #0x2000, %sr"); do { // Apparently, stop #0x2000 doesn't seem to work when the Z80 is banging the bus! asm volatile ("stop #0x2000"); 2c0410: 4e72 2000 stop #8192 } while (frame == frame_counter); 2c04...
by Graz
Sat Sep 11, 2010 7:39 pm
Forum: Megadrive/Genesis
Topic: Wierd Interrupt Issue
Replies: 12
Views: 3058

I've never had a problem with GCC's code generator. It's C code generation is pretty decent, and the inline assembler surpasses any other compiler I've used in the past. If you've had problems with GCC nuking your assembly code or hoisting it out of loops, it could be because you haven't properly de...
by Graz
Wed Sep 08, 2010 11:58 pm
Forum: Megadrive/Genesis
Topic: Wierd Interrupt Issue
Replies: 12
Views: 3058

Yes, I meant stop, not halt. asm volatile ("move.w #0x2000, %sr"); do { // Apparently, stop #0x2000 doesn't seem to work when the Z80 is banging the bus! // asm volatile ("stop #0x2000"); } while (frame == frame_counter); 'frame' is a non-volatile local variable, and frame_counter is a volatile glob...
by Graz
Mon Sep 06, 2010 1:24 am
Forum: Megadrive/Genesis
Topic: Wierd Interrupt Issue
Replies: 12
Views: 3058

Well, I think I've solved the problem - or at least worked around it. I'm not sure what the problem was, exactly. I was running the 68K with interrupts off most of the time and using halt 0x2000 to wait for an interrupt to occur, and that was working just fine until the Z80 started pulling data out ...
by Graz
Sat Sep 04, 2010 8:30 pm
Forum: Megadrive/Genesis
Topic: Wierd Interrupt Issue
Replies: 12
Views: 3058

Sorry, yes, that was a bit vague now that I re-read it. It's the 68k VINT that seems to stop. Here's some pseudo-code: 68K: volatile int frame_count; void vint(void) { frame_count++; } void fill_z80_ring() { while (space_in_ring()) { append_command_to_ring(); } } void working() { while (1) { fill_z8...
by Graz
Fri Sep 03, 2010 5:35 pm
Forum: Megadrive/Genesis
Topic: Wierd Interrupt Issue
Replies: 12
Views: 3058

Wierd Interrupt Issue

I have an app that has a 68k component and a z80 component. The two components communicate with a ring buffer at the end of the z80's ram. The z80 spins waiting on the ring buffer to be filled by the 68k. This all seems to work fine, except that once I send a command to the z80 and it starts pulling...
by Graz
Thu Jul 15, 2010 12:16 pm
Forum: Megadrive/Genesis
Topic: Strange cart on eBay
Replies: 23
Views: 8062

ElBarto wrote:I wouldn't buy it cause the eprom are not UV protected :)
If the cart's been sealed the whole time, then it should be fine. The poster says that it has a game on it, so there's probably not too much data loss.
by Graz
Thu Jul 08, 2010 11:39 am
Forum: Hardware
Topic: Making Light gun for LCD TV
Replies: 35
Views: 23174

Maybe you could intercept the video signal and use a sync separator to extract hsync and vsync. If you synchronize an internal counter to the TV's beam, you would know where the HV counter was. Then, when you get the trigger signal from the light gun, you would wait until the HV counter reaches the ...
by Graz
Wed Jun 16, 2010 12:43 am
Forum: Hardware
Topic: SEGA Genesis/Megadrive clone in a FPGA
Replies: 30
Views: 19320

Yeah, I guess. I just get a warm fuzzy feeling from coding on real hardware - even if it is an FPGA board! Dunno if anyone looked at http://www.experiment-s.de/en/ . These guys don't just 'emulate', they're pin-compatible with the ST. http://www.experiment-s.de/en/pictures/english/atari-custom-chips...
by Graz
Wed Jun 16, 2010 12:26 am
Forum: Hardware
Topic: SEGA Genesis/Megadrive clone in a FPGA
Replies: 30
Views: 19320

This is pretty cool. I'd be interested in 'enhancing' the capabilities of the Genesis. For example, what could you do if the DACs were really 4-bits per channel instead of 3? The bits are there, the RAM is there, just the LSB in the DAC is missing. Then we'd have 4 palettes of 16 (or 15) out of 4096...
by Graz
Wed Jun 16, 2010 12:19 am
Forum: Tools
Topic: bss section in asmx
Replies: 2
Views: 1912

I've been using GNU binutils (as), built from scratch. It works very well for me. I use custom linker scripts to get the sections in the right place, can use gcc for pre-processed source and the assembler support AT&T and Motorola syntax. I've had no problems with .rodata, .bss or even initialized ....