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

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

first running version of mmixvd

parent 004164e0
......@@ -101,9 +101,9 @@ extern int mmix_fputc(int c, FILE *f);
/* MMIXAL has its own notion of file numbers as embedded in the mmo file
we might want to convert this to a global file number */
#define MMIX_FILE_NO(file_no) (file_no)
#define MMIX_FILE_NO(file_no) filename2file(filename[file_no], file_no)
/* define this to record file line and location associations while assembling */
#define MMIXAL_LINE_LOC(file_no,line_no,cur_loc)
#define MMIXAL_LINE_LOC(file_no,line_no,cur_loc) add_line_loc(file_no,line_no,cur_loc)
#endif
......@@ -79,3 +79,4 @@ extern FILE*dump_file;
extern char*usage_help[];
extern char*interactive_help[];
extern jmp_buf mmix_exit;
......@@ -23,7 +23,7 @@
#ifndef LIBMMIXAL_H
#define LIBMMIXAL_H
#include "mmixlib.h"
/* types and definitions from mmixal */
typedef struct sym_tab_struct{
......@@ -51,11 +51,8 @@ short code;
int bits;
}op_spec;
typedef enum{
SET= 0x100,IS,LOC,PREFIX,BSPEC,ESPEC,GREG,LOCAL,
BYTE,WYDE,TETRA,OCTA}pseudo_op;
//extern trie_node *trie_root;
extern trie_node *trie_root;
//extern sym_node*sym_avail;
#define DEFINED (sym_node*)1 /* link value for octabyte equivalents */
#define REGISTER (sym_node*) 2 /* link value for register equivalents */
......
......@@ -9,7 +9,7 @@
#include <setjmp.h>
#include "libname.h"
extern jmp_buf mmix_exit;
/* simple implementation of the identity mapping */
......
......@@ -14,7 +14,8 @@ the subroutine.
@<Preprocessor definitions@>=
@y
@<Sub...@>=
#include "mmixlib.h"
extern void add_line_loc(int file_no, int line_no, octa loc);
@ @<Global...@>=
#include <setjmp.h>
......@@ -307,6 +308,7 @@ int main(argc,argv)
#include <time.h>
#include <setjmp.h>
#include "libconfig.h"
#include "libimport.h"
@#
@h
@<Preprocessor definitions@>@;
......
......@@ -6,6 +6,7 @@ Types and preprocessor macros go into libtype.h
@y
@ @(libtype.h@>=
@h
#define _LIBTYPE_H_
@<Preprocessor macros@>@;
@<Type declarations@>@;
......@@ -2470,6 +2471,18 @@ void catchint(n)
MMIX_GET_INTERRUPT
@z
@x
case '-': k=strlen(p);@+if (p[k-1]=='\n') p[k-1]='\0';
@y
case '-': k=(int)strlen(p);@+if (p[k-1]=='\n') p[k-1]='\0';
@z
@x
default: what_say: k=strlen(command_buf);
@y
default: what_say: k=(int)strlen(command_buf);
@z
@x
@ @d command_buf_size 1024 /* make it plenty long, for floating point tests */
......
/* auxiliar functions provided by the library but without a prototype here*/
#ifndef _MMIXLIB_H_
#define _MMIXLIB_H_
#include <stdio.h>
/* auxiliar functions provided by the library but without a prototype here*/
#if 0
extern void free_tree(trie_node *root);
#endif
#ifndef _MMIXAL_
extern void free_file_info(void);
/* reset the file_info and ybyte2file_no information */
extern mem_tetra* mem_find(octa addr);
extern mem_node* new_mem(void);
#ifndef _LIBTYPE_H_
typedef enum{false,true}bool;
typedef unsigned int tetra;
typedef struct{tetra h,l;} octa;
typedef char Char;
typedef enum{
rB,rD,rE,rH,rJ,rM,rR,rBB,
rC,rN,rO,rS,rI,rT,rTT,rK,rQ,rU,rV,rG,rL,
rA,rF,rP,rW,rX,rY,rZ,rWW,rXX,rYY,rZZ}special_reg;
typedef enum{
TRAP,FCMP,FUN,FEQL,FADD,FIX,FSUB,FIXU,
FLOT,FLOTI,FLOTU,FLOTUI,SFLOT,SFLOTI,SFLOTU,SFLOTUI,
FMUL,FCMPE,FUNE,FEQLE,FDIV,FSQRT,FREM,FINT,
MUL,MULI,MULU,MULUI,DIV,DIVI,DIVU,DIVUI,
ADD,ADDI,ADDU,ADDUI,SUB,SUBI,SUBU,SUBUI,
IIADDU,IIADDUI,IVADDU,IVADDUI,VIIIADDU,VIIIADDUI,XVIADDU,XVIADDUI,
CMP,CMPI,CMPU,CMPUI,NEG,NEGI,NEGU,NEGUI,
SL,SLI,SLU,SLUI,SR,SRI,SRU,S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
#define write_bit (1<<1)
#define exec_bit (1<<0) \
#define RESUME_AGAIN 0
#define RESUME_CONT 1
#define RESUME_SET 2
#define RESUME_TRANS 3
#define P_BIT (1<<0)
#define S_BIT (1<<1)
#define B_BIT (1<<2)
#define K_BIT (1<<3)
#define N_BIT (1<<4)
#define PX_BIT (1<<5)
#define PW_BIT (1<<6)
#define PR_BIT (1<<7)
#define PF_BIT (1<<0)
#define MP_BIT (1<<1)
#define NM_BIT (1<<2)
#define YY_BIT (1<<3)
#define RE_BIT (1<<4)
#define CP_BIT (1<<5)
#define PT_BIT (1<<6)
#define IN_BIT (1<<7)
typedef struct{
#ifndef VMB
tetra tet;
#endif
tetra freq;
unsigned char bkpt;
unsigned char file_no;
unsigned short line_no;
} mem_tetra;
typedef struct mem_node_struct{
octa loc;
tetra stamp;
struct mem_node_struct*left,*right;
mem_tetra dat[512];
} mem_node;
#endif
extern bool show_operating_system;
extern unsigned int tracing_exceptions;
extern int G,L,O;
extern octa g[256];
extern octa*l;
extern int lring_size;
extern int lring_mask;
extern int S;
char*special_name[32];
extern void mmputchars(unsigned char *buf,int size,octa addr);
extern int mmgetchars(unsigned char *buf, int size, octa addr, int stop);
extern void show_line(void);
extern void show_stats(bool verbose);
extern mem_tetra* mem_find(octa addr);
extern mem_node*mem_root;
extern mem_node* new_mem(void);
extern octa incr(octa y,int delta);
extern void free_file_info(void);
extern void scan_option(char *arg, /* command-line argument (without the `\.-') */
bool usage); /* should we exit with usage note if unrecognized? */
extern void print_hex(octa o);
extern void print_int(octa o);
extern void print_string(octa o);
extern void show_line(void);
extern void show_breaks(mem_node *p);
#endif
......@@ -57,6 +176,8 @@ extern void mmix_dynamic_trap(void);
/* check for dynamic traps */
extern void mmix_profile(void);
/* print the profile */
extern void show_stats(bool verbose);
/* show statistics */
extern int mmix_printf(char *format,...);
/* printf replacement */
......@@ -64,11 +185,30 @@ extern int mmix_fputc(int c, FILE *f);
/* fputc replacement */
void mmix_stack_trace(char *format,...);
/* function to do the stack trace */
extern bool halted;
extern bool breakpoint;
extern bool interrupt;
extern bool interacting;
extern octa rOlimit;
extern bool line_listed; /* have we listed the buffer contents? */
extern octa neg_one;
extern bool tracing;
extern bool stack_tracing;
extern octa loc;
extern octa inst_ptr;
extern tetra inst;
extern bool rw_break;
extern bool show_operating_system;
extern bool trace_once;
extern bool resuming;
extern mmix_opcode op;
extern bool profiling;
extern bool showing_stats;
#if 0
extern int cur_file; /* index of the current file in |filename| */
extern int line_no; /* current position in the file */
extern bool line_listed; /* have we listed the buffer contents? */
extern int err_count; /* this many errors were found */
......@@ -120,5 +260,5 @@ extern int expanding; /* are we expanding instructions when base address fail? *
extern int buf_size; /* maximum number of characters per line of input */
extern int mmixal(char *mms_name, char *mmo_name, char *mml_name, int x_option, int b_option);
extern int err_count; /* the error count */
extern bool line_listed;
extern void flush_listing_line(char*line);
\ No newline at end of file
extern void flush_listing_line(char*line);
#endif
\ No newline at end of file
......@@ -666,26 +666,6 @@
RelativePath=".\mmix-io.c"
>
</File>
<File
RelativePath=".\mmix-vmb.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="C:\home\vmb\src\util;C:\home\vmb\src\vmbmmixlib"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="C:\home\vmb\src\util;C:\home\vmb\src\vmbmmixlib"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
......@@ -696,10 +676,22 @@
RelativePath=".\vmb\address.h"
>
</File>
<File
RelativePath=".\libconfig.h"
>
</File>
<File
RelativePath=".\libglobals.h"
>
</File>
<File
RelativePath=".\libimport.h"
>
</File>
<File
RelativePath=".\libtype.h"
>
</File>
<File
RelativePath=".\mmixlib.h"
>
......@@ -727,7 +719,7 @@
<Tool
Name="VCCustomBuildTool"
Description="ctangle mmix-arith with arith-win changefile"
CommandLine="ctangle mmixware\mmix-arith.w arith-win.ch"
CommandLine="ctangle mmixware\mmix-arith.w arith-win.ch&#x0D;&#x0A;"
Outputs="mmix-arith.c"
/>
</FileConfiguration>
......@@ -737,7 +729,7 @@
<Tool
Name="VCCustomBuildTool"
Description="ctangle mmix-arith with arith-win changefile"
CommandLine="ctangle mmixware\mmix-arith.w arith-win.ch"
CommandLine="ctangle mmixware\mmix-arith.w arith-win.ch&#x0D;&#x0A;"
Outputs="mmix-arith.c"
/>
</FileConfiguration>
......@@ -751,7 +743,7 @@
<Tool
Name="VCCustomBuildTool"
Description="ctangle mmix-io with io-win.ch"
CommandLine="ctangle mmixware\mmix-io.w io-win.ch"
CommandLine="ctangle mmixware\mmix-io.w io-win.ch&#x0D;&#x0A;"
Outputs="mmix-io.c"
/>
</FileConfiguration>
......@@ -761,7 +753,7 @@
<Tool
Name="VCCustomBuildTool"
Description="ctangle mmix-io with io-win.ch"
CommandLine="ctangle mmixware\mmix-io.w io-win.ch"
CommandLine="ctangle mmixware\mmix-io.w io-win.ch&#x0D;&#x0A;"
Outputs="mmix-io.c"
/>
</FileConfiguration>
......@@ -822,6 +814,10 @@
RelativePath=".\mmixallib.ch"
>
</File>
<File
RelativePath=".\mmixlib.ch"
>
</File>
</Filter>
</Files>
<Globals>
......
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