Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/stardot/b-em
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Fosdick committed Dec 1, 2024
2 parents 948706c + 3925976 commit f1f3f2b
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 11 deletions.
Binary file modified roms/tube/CiscOS.rom
Binary file not shown.
1 change: 1 addition & 0 deletions src/b-em.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "compat_wrappers.h"

Expand Down
12 changes: 8 additions & 4 deletions src/debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1751,16 +1751,20 @@ static void debug_trace_write(cpu_debug_t *cpu, uint32_t addr, FILE *fp)
*(sym++) = '\0';
}

fputs("\t", fp);
while(strlen(buf) < 52)
strcat(buf, " ");

fputs(buf, fp);
*buf = ' ';

const char **np = cpu->reg_names;
const char *name;
int r = 0;
while ((name = *np++)) {
size_t len = cpu->reg_print(r++, buf + 1, sizeof buf - 1);
fwrite(buf, len + 1, 1, fp);
fputs(" ", fp);
fputs(name, fp);
fputs("=", fp);
size_t len = cpu->reg_print(r++, buf, sizeof buf);
fwrite(buf, len, 1, fp);
}

if (sym)
Expand Down
3 changes: 2 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ static double main_calc_timer(int speed)

static int main_speed_cmp(const void *va, const void *vb)
{
return ((const emu_speed_t *)va)->multiplier - ((const emu_speed_t *)vb)->multiplier;
double res = ((const emu_speed_t *)va)->multiplier - ((const emu_speed_t *)vb)->multiplier;
return (int)round(res);
}

static void main_load_speeds(void)
Expand Down
31 changes: 30 additions & 1 deletion src/mc68000tube.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,38 @@ static void dbg_reg_set(int which, uint32_t value)
return m68k_set_reg(which, value);
}

static size_t dbg_decode_flags(uint32_t flags, char *buf, size_t bufsize)
{
if (bufsize >= 16) {
buf[0] = flags & 0x8000 ? 'T' : '-';
buf[1] = '.';
buf[2] = flags & 0x2000 ? 'S' : '-';
buf[3] = '.';
buf[4] = '.';
buf[5] = flags & 0x400 ? '2' : '-';
buf[6] = flags & 0x200 ? '1' : '-';
buf[7] = flags & 0x100 ? '0' : '-';
buf[8] = '.';
buf[9] = '.';
buf[10] = '.';
buf[11] = flags & 0x10 ? 'X' : '-';
buf[12] = flags & 0x08 ? 'N' : '-';
buf[13] = flags & 0x04 ? 'Z' : '-';
buf[14] = flags & 0x02 ? 'V' : '-';
buf[15] = flags & 0x01 ? 'C' : '-';
return 16;
}
return 0;
}

static size_t dbg_reg_print(int which, char *buf, size_t bufsize)
{
return snprintf(buf, bufsize, "%08X", m68k_get_reg(NULL, which));
uint32_t value = m68k_get_reg(NULL, which);

if (which == 17) // Status register
return dbg_decode_flags(value, buf, bufsize);

return snprintf(buf, bufsize, "%08X", value);
}

static void dbg_reg_parse(int which, const char *strval)
Expand Down
10 changes: 5 additions & 5 deletions src/sprow.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ static uint32_t sprow_dbg_disassemble(cpu_debug_t *cpu, uint32_t addr, char *buf
bufsize -= len;
strncpy(buf, dest, bufsize);

if ((len = strlen(buf)) < 40)
{
memset(buf+len, ' ', 40-len);
buf[40] = 0;
}
//if ((len = strlen(buf)) < 40)
//{
// memset(buf+len, ' ', 40-len);
// buf[40] = 0;
//}
return addr + 4;
};

Expand Down
6 changes: 6 additions & 0 deletions src/tube.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,16 @@ void tube_updateints()
pdp11_interrupt(0x80, 7);
else if (tube_type == TUBESPROW)
sprow_interrupt(2);
else if (tube_type == TUBE68000)
m68k_set_virq(5, 1);
}
}
else if (tube_irq & 2)
{
log_debug("tube: parasite NMI de-asserted");
if (tube_type == TUBE68000)
m68k_set_virq(5, 0);
}

if (new_irq != tube_irq && tube_type == TUBE6809)
tube_6809_int(new_irq);
Expand Down

0 comments on commit f1f3f2b

Please sign in to comment.