2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 43897533 authored by Martin Ruckert's avatar Martin Ruckert
Browse files

mmixvd with memory registers, inspector and input form the trace window

parent 1ae8d6ca
...@@ -5,13 +5,26 @@ ...@@ -5,13 +5,26 @@
@y @y
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "libconfig.h"
#include "libimport.h"
#pragma warning(disable : 4996 4267) #pragma warning(disable : 4996 4267)
@z
@x
if (fwrite(buf,1,n,sfile[handle].fp)!=n) return ominus(zero_octa,size);
fflush(sfile[handle].fp);
@y
#ifdef MMIX_PRINT #ifdef MMIX_PRINT
extern int mmix_printf(char *format,...); if (sfile[handle].fp==stdout || sfile[handle].fp==stderr)
#define printf(...) mmix_printf(__VA_ARGS__) win32_log(buf);
else
{ if (fwrite(buf,1,n,sfile[handle].fp)!=n) return ominus(zero_octa,size);
fflush(sfile[handle].fp);
}
#else
if (fwrite(buf,1,n,sfile[handle].fp)!=n) return ominus(zero_octa,size);
fflush(sfile[handle].fp);
#endif #endif
@z @z
#ifndef LIBCONFIG_H
#define LIBCONFIG_H
#ifdef WIN32
#pragma warning(disable : 4996)
#endif
/* define this if you need a local copy of mem_tetra ll */
#define MMIX_LOCAL_LL mem_tetra *ll; /* current place in the simulated memory */
#define MMIX_STO(val,addr) (ll=mem_find(addr),ll->tet=(val).h,(ll+1)->tet=(val).l,true)
#define MMIX_STT(val,addr) (ll=mem_find(addr),ll->tet=(val).l,true)
#define MMIX_STW(val,addr) (ll=mem_find(addr),ll->tet=(ll->tet&(~(0xFFFF<<((1-((addr).l&0x1))<<4))))|(((val).l&0xFFFF)<<((1-((addr).l&0x1))<<4)),true)
#define MMIX_STB(val,addr) (ll=mem_find(addr),ll->tet=(ll->tet&(~(0xFF<<((3-((addr).l&0x3))<<3))))|(((val).l&0xFF)<<((3-((addr).l&0x3))<<3)),true)
#define MMIX_LDO(val,addr) (ll=mem_find(addr),(val).h=ll->tet,(val).l=(ll+1)->tet,true)
#define MMIX_LDT(val,addr) (ll=mem_find(addr),(val).h=0,(val).l=ll->tet,true)
#define MMIX_LDW(val,addr) (ll=mem_find(addr),(val).h=0,(val).l=(ll->tet>>(16*(1-((addr).l&1))))&0xFFFF,true)
#define MMIX_LDB(val,addr) (ll=mem_find(addr),(val).h=0,(val).l=(ll->tet>>(8*(3-((addr).l&3))))&0xFF,true)
#define MMIX_STO_UNCACHED(val,addr) MMIX_STO(val,addr)
#define MMIX_LDO_UNCACHED(val,addr) MMIX_LDO(val,addr)
#define MMIX_FETCH(inst,loc) (ll=mem_find(loc),inst=ll->tet,true)
#define MMIX_STORE_IVTC(virt,phys)
#define MMIX_STORE_DVTC(virt,phys)
#ifdef WIN32
#define MMIX_DELAY(ms,d) (Sleep(ms), d=(ms))
#else
#define MMIX_DELAY(ms,d) (usleep(1000*(ms)), d=(ms))
#endif
/* define this to check for external asynchronous interrupts*/
#define MMIX_GET_INTERRUPT
/* this code is executed when MMIX enters the handler for Ctrl-C */
#define MMIX_CTRL_HANDLER
/* this code defines additional command line options */
#define MMIX_OPTIONS
/* if MMIX_BOOT is defined, mmis-sim will boot from addres #8000...0000
otherwise it will resume at Main */
#undef MMIX_BOOT
#ifdef _MMIXAL_
#undef MMIX_PRINT
#else
#define MMIX_PRINT
#endif
#ifdef MMIX_PRINT
extern int mmix_printf(FILE *f,char *format,...);
extern int mmix_fputc(int c, FILE *f);
#define printf(...) mmix_printf(stdout,__VA_ARGS__)
#define fprintf(file,...) mmix_printf(file,__VA_ARGS__)
#define fputc(c,f) mmix_fputc(c,f)
#endif
/* this action is executed when there is no mmo file on the command line */
#define MMIX_NO_FILE
/* define this to get the real TRAP implementation not the MMIXWARE fake TRAPS */
#undef MMIX_TRAP
/* this is the error display function */
#define MMIX_ERROR(f,m) fprintf(stderr,f,m)
/* define this if you need the tetra inside the mem_node */
#define MMIX_MEM_TET tetra tet; /* the tetrabyte of simulated memory */
/* these are the functions for the instructions not implemented in the basic mmix simulator */
#define MMIX_WRITE_DCACHE()
#define MMIX_CLEAR_ICACHE()
#define MMIX_CLEAR_DCACHE()
#define MMIX_UPDATE_VTC(w) zero_octa
#define MMIX_CLEAR_DVTC()
#define MMIX_CLEAR_IVTC()
#define MMIX_PRELOAD_DCACHE(w,xx)
#define MMIX_PRELOAD_ICACHE(w,xx)
#define MMIX_STORE_DCACHE(w,xx)
#define MMIX_DELETE_DCACHE(w,xx)
#define MMIX_DELETE_ICACHE(w,xx)
#define MMXIAL_LINE_TRUNCATED fprintf(stderr,"(say `-b <number>' to increase the length of my input buffer)\n");
/* define this to record file line and location associations while assembling */
#define MMIXAL_LINE_LOC(file_no,line_no,cur_loc) add_line_loc(file_no,line_no,cur_loc)
#endif
extern void win32_log(char *msg);
...@@ -669,7 +669,7 @@ if (!l) panic("No room for the local registers"); ...@@ -669,7 +669,7 @@ if (!l) panic("No room for the local registers");
sclock.l=sclock.h=0; sclock.l=sclock.h=0;
profile_started=false; profile_started=false;
halted=false; halted=false;
stdin_buf_start=stdin_buf_end=NULL; stdin_buf_start=stdin_buf_end=stdin_buf;
good_guesses=bad_guesses=0; good_guesses=bad_guesses=0;
profiling=false; profiling=false;
interrupt=false; interrupt=false;
...@@ -901,8 +901,7 @@ case STB: case STBI: case STBU: case STBUI:@/ ...@@ -901,8 +901,7 @@ case STB: case STBI: case STBU: case STBUI:@/
} }
if ((w.h&sign_bit) && !(loc.h&sign_bit)) goto translation_bypassed_inst; if ((w.h&sign_bit) && !(loc.h&sign_bit)) goto translation_bypassed_inst;
if (!MMIX_STB(b,w)) goto page_fault; if (!MMIX_STB(b,w)) goto page_fault;
ll=mem_find(w); test_store_bkpt(ll); goto fin_st;
break;
@z @z
@x @x
...@@ -916,8 +915,7 @@ case STW: case STWI: case STWU: case STWUI:@/ ...@@ -916,8 +915,7 @@ case STW: case STWI: case STWU: case STWUI:@/
} }
if ((w.h&sign_bit) && !(loc.h&sign_bit)) goto translation_bypassed_inst; if ((w.h&sign_bit) && !(loc.h&sign_bit)) goto translation_bypassed_inst;
if (!MMIX_STW(b,w)) goto page_fault; if (!MMIX_STW(b,w)) goto page_fault;
ll=mem_find(w); test_store_bkpt(ll); goto fin_st;
break;
@z @z
@x @x
...@@ -939,7 +937,10 @@ case STT: case STTI: case STTU: case STTUI:@/ ...@@ -939,7 +937,10 @@ case STT: case STTI: case STTU: case STTUI:@/
fin_pst: fin_pst:
if ((w.h&sign_bit) && !(loc.h&sign_bit)) goto translation_bypassed_inst; if ((w.h&sign_bit) && !(loc.h&sign_bit)) goto translation_bypassed_inst;
if (!MMIX_STT(b,w)) goto page_fault; if (!MMIX_STT(b,w)) goto page_fault;
fin_st:
ll=mem_find(w); test_store_bkpt(ll); ll=mem_find(w); test_store_bkpt(ll);
w.l&=-8;@+ll=mem_find(w);
a.h=ll->tet;@+ a.l=(ll+1)->tet; /* for trace output */
break; break;
@z @z
...@@ -1619,8 +1620,6 @@ char stdin_chr @,@,@[ARGS((void))@];@+@t}\6{@> ...@@ -1619,8 +1620,6 @@ char stdin_chr @,@,@[ARGS((void))@];@+@t}\6{@>
@z @z
@x @x
@ We are finally ready for the last case. @ We are finally ready for the last case.
@y @y
......
...@@ -714,6 +714,10 @@ ...@@ -714,6 +714,10 @@
RelativePath=".\arith-win.ch" RelativePath=".\arith-win.ch"
> >
</File> </File>
<File
RelativePath=".\io-win.ch"
>
</File>
<File <File
RelativePath=".\mmixware\mmix-arith.w" RelativePath=".\mmixware\mmix-arith.w"
> >
...@@ -747,8 +751,9 @@ ...@@ -747,8 +751,9 @@
> >
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
Description="ctangle mmix-io with io-win.ch" Description="ctangle mmix-io with libio.ch"
CommandLine="ctangle mmixware\mmix-io.w io-win.ch&#x0D;&#x0A;" CommandLine="ctangle mmixware\mmix-io.w libio.ch"
AdditionalDependencies="libio.ch"
Outputs="mmix-io.c" Outputs="mmix-io.c"
/> />
</FileConfiguration> </FileConfiguration>
...@@ -757,8 +762,9 @@ ...@@ -757,8 +762,9 @@
> >
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
Description="ctangle mmix-io with io-win.ch" Description="ctangle mmix-io with libio.ch"
CommandLine="ctangle mmixware\mmix-io.w io-win.ch&#x0D;&#x0A;" CommandLine="ctangle mmixware\mmix-io.w libio.ch"
AdditionalDependencies="libio.ch"
Outputs="mmix-io.c" Outputs="mmix-io.c"
/> />
</FileConfiguration> </FileConfiguration>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment