Help with galaxian memory map for 8bitworkshop IDE

Georgian2

Active member
Feedback
12 (100%)
Credits
1,781CR
Hello,
Anybody has experience with 8bitworksopide??
The example provided for galaxian/scramble hardware dosen't work in mame or i can't get it to work.... I gues the memory map is not right...
https://8bitworkshop.com/v3.12.0/?platform=galaxian-scramble&file=gfxtest.c

Here is the part of the code where help is needed:
C:
#include <string.h>

typedef unsigned char byte;
typedef unsigned short word;
typedef signed char sbyte;

byte __at (0x4800) vram[32][32];


struct {
  byte scroll;
  byte attrib;
} __at (0x5000) vcolumns[32];

struct {
  byte xpos;
  byte code;
  byte color;
  byte ypos;
} __at (0x5040) vsprites[8];

struct {
  byte unused1;
  byte xpos;
  byte unused2;
  byte ypos;
} __at (0x5060) vmissiles[8];

byte __at (0x5080) xram[128];

byte __at (0x6801) enable_irq;
byte __at (0x6804) enable_stars;
byte __at (0x7000) watchdog;
volatile byte __at (0x8100) input0;
volatile byte __at (0x8101) input1;
volatile byte __at (0x8102) input2;

void main();

void start() {
__asm
    LD      SP,#0x4800
        DI
__endasm;
    main();
}

const char __at (0x5000) palette[32] = {/*{pal:332,n:4}*/
  0x00,0x80,0xf0,0xff,0x00,0xf0,0xc0,0x7f,
  0x00,0xc0,0x04,0x1f,0x00,0xd0,0xd0,0x0f,
  0x00,0xc0,0xc0,0x0f,0x00,0x04,0x04,0x0f,
  0x00,0xff,0x0f,0xf0,0x00,0x7f,0x0f,0xdf,
};

const char __at (0x4000) tilerom[0x1000] = {/*{w:16,h:16,remap:[3,0,1,2,4,5,6,7,8,9,10],brev:1,np:2,pofs:2048,count:64}*/
0x00,0xfe,0x82,0x82,0x82,0xfe,0xfe,0x00,0x00,0x00,0xfe,0xfe,0xc0,0x00,0x00,0x00,0x00,0xf2,0xf2,0x92,0x92,0x9e,0x9e,0x00,0x00,0xfe,0xfe,0x92,0x92,0x82,0x00,0x00,0x08,
.
.
.
.
};

Many thanks!
 

Macro

Active member
vacBacker
Feedback
4 (100%)
Credits
1,982CR
Program rom is $0000-$3FFF

Program ram is $4000-$43FF

Video ram is $5000 - $53FF

object ram is $5800 - $58FF (although only $5800-$587F is used, rest is free for you to use!)

Colour Prom and graphic roms are not mapped into CPU memory area and are just used by other parts of the circuit.

so all address ranges given above are basically wrong.
 

Macro

Active member
vacBacker
Feedback
4 (100%)
Credits
1,982CR
Galaxian has less ram (2k instead of scrambles 4k) and the video ram and object ram is definitely out of place.

just grab the complete list from mame galaxian core.

map(0x0000, 0x3fff).rom();
map(0x4000, 0x43ff).mirror(0x0400).ram();
map(0x5000, 0x53ff).mirror(0x0400).ram().w(FUNC(galaxian_state::galaxian_videoram_w)).share("videoram");
map(0x5800, 0x58ff).mirror(0x0700).ram().w(FUNC(galaxian_state::galaxian_objram_w)).share("spriteram");
map(0x6000, 0x6000).mirror(0x07ff).portr("IN0");
map(0x6000, 0x6001).mirror(0x07f8).w(FUNC(galaxian_state::start_lamp_w));
map(0x6002, 0x6002).mirror(0x07f8).w(FUNC(galaxian_state::coin_lock_w));
map(0x6003, 0x6003).mirror(0x07f8).w(FUNC(galaxian_state::coin_count_0_w));
//AM_RANGE(0x6004, 0x6007) AM_MIRROR(0x07f8) AM_DEVWRITE("cust", galaxian_sound_device, lfo_freq_w)
map(0x6800, 0x6800).mirror(0x07ff).portr("IN1");
//AM_RANGE(0x6800, 0x6807) AM_MIRROR(0x07f8) AM_DEVWRITE("cust", galaxian_sound_device, sound_w)
map(0x7000, 0x7000).mirror(0x07ff).portr("IN2");
map(0x7001, 0x7001).mirror(0x07f8).w(FUNC(galaxian_state::irq_enable_w));
map(0x7004, 0x7004).mirror(0x07f8).w(FUNC(galaxian_state::galaxian_stars_enable_w));
map(0x7006, 0x7006).mirror(0x07f8).w(FUNC(galaxian_state::galaxian_flip_screen_x_w));
map(0x7007, 0x7007).mirror(0x07f8).w(FUNC(galaxian_state::galaxian_flip_screen_y_w));
//AM_RANGE(0x7800, 0x7800) AM_MIRROR(0x07ff) AM_DEVWRITE("cust", galaxian_sound_device, pitch_w)
map(0x7800, 0x7800).mirror(0x07ff).r("watchdog", FUNC(watchdog_timer_device::reset_r));

of course, if you want your program to work on real hardware, you'll need to worry about the watchdog and interrupt enable etc.
 

Georgian2

Active member
Feedback
12 (100%)
Credits
1,781CR
Thanks for taking yor time.
I still don't understand what to put in the code....
This part should be corect:
C:
byte __at (0x7001) enable_irq;
byte __at (0x7004) enable_stars;
byte __at (0x7800) watchdog;
volatile byte __at (0x6000) input0;
volatile byte __at (0x6800) input1;
volatile byte __at (0x7000) input2;
here I have no ideea what to put:
C:
byte __at (0x5000) vram[32][32];


struct {
  byte scroll;
  byte attrib;
} __at (0x5800) vcolumns[32];

struct {
  byte xpos;
  byte code;
  byte color;
  byte ypos;
} __at (0x5840) vsprites[8];

struct {
  byte unused1;
  byte xpos;
  byte unused2;
  byte ypos;
} __at (0x5060) vmissiles[8];

byte __at (0x5080) xram[128];
Also here....
C:
void start() {
__asm
    LD      SP,#0x4800
        DI
__endasm;
    main();
}
 

Macro

Active member
vacBacker
Feedback
4 (100%)
Credits
1,982CR
ld sp,$4400 (since only 1k ram)

apart from that it looks fine!

$7800 is also the address of the tune chip, write $ff to disable it. (but there is also missile noise, shot noise and rack noise registers, so it could be noisy on a real PCB ...)
 

Georgian2

Active member
Feedback
12 (100%)
Credits
1,781CR
Still doesn't work in mame. The tone is there but it's resets. Must be someting with that NMI thing on Z80.
C:
#include <string.h>

typedef unsigned char byte;
typedef unsigned short word;
typedef signed char sbyte;

byte __at (0x5000) vram[32][32];


struct {
  byte scroll;
  byte attrib;
} __at (0x5800) vcolumns[32];

struct {
  byte xpos;
  byte code;
  byte color;
  byte ypos;
} __at (0x5840) vsprites[8];

struct {
  byte unused1;
  byte xpos;
  byte unused2;
  byte ypos;
} __at (0x5860) vmissiles[8];

//byte __at (0x5080) xram[128];

byte __at (0x7001) enable_irq;
byte __at (0x7004) enable_stars;
byte __at (0x7800) watchdog;
volatile byte __at (0x6000) input0;
volatile byte __at (0x6800) input1;
volatile byte __at (0x7000) input2;

void main();

void start() {
__asm
    LD      SP,#0x4400
        DI
__endasm;
    main();
}
 

Attachments

  • galmidw.zip
    845 bytes · Views: 0

Macro

Active member
vacBacker
Feedback
4 (100%)
Credits
1,982CR
code has

watchdog++;

which should read the watchdog add 1 and then write it. (write goes to sound register), read should sort the watchdog though.

however, no NMI routine so you need to disable the NMI, so add something like

enable_irq = 0;
 

Macro

Active member
vacBacker
Feedback
4 (100%)
Credits
1,982CR
NMI = Non-maskable interrupt, which means that the Z80 cannot disable it (with DI)

but on galaxian hardware it is controlled by memory address $7001 so set that to zero should stop it from happening!
 

Georgian2

Active member
Feedback
12 (100%)
Credits
1,781CR
I tried with enable_irq = 0; in teh main and in the loop and no change...
This is a little too complicated for me.
The author and the maker of this IDE should exclude the word galaxian since it's not working. Might be working on scramble...
 

Macro

Active member
vacBacker
Feedback
4 (100%)
Credits
1,982CR
The problem is that it takes so long to set the screen up that the watchdog fires before it completes!

If you run mame with -log as a parameter, error.log then shows it ...

Soft reset
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FE2 = 1E & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FC2 = 1F & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FE3 = 3E & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FC3 = 3F & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FE4 = 5E & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FC4 = 5F & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FE5 = 7E & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FC5 = 7F & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FE6 = 9E & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FC6 = 9F & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FE7 = BE & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FC7 = BF & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FE8 = DE & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FC8 = DF & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FE9 = FE & FF
[:maincpu] ':maincpu' (00EE): unmapped program memory write to 4FC9 = FF & FF
[:watchdog] Reset caused by the watchdog!!!


stick an extra

watchdog++;

after every drawsprite command
 

Macro

Active member
vacBacker
Feedback
4 (100%)
Credits
1,982CR
watchdog = 0xff;

you may be able to signal the watchdog without writing to the sound register by doing something else such as

byte x = watchdog;

(where you are never going to use x, but hopefully it does not optimise it out in the compiler!)
 
Top