List of Changes to the Emulator

For complete up-to-date details, see documentation. Updates to the compiler are recorded in a different file


16-12-2002 (version 1.138) Fixed careless error in disc editor: previously it wouldn't let you look at block 0 of any disc.

8-12-2002 (version 1.125) Added output redirection and capture. "-o" option to emulator (e.g. sys prog.exe -o out.txt) redirects all output from the running program to the named file. Also commands ROUT and COUT have the same effect but interactively (HELP ROUT for help). "exe" command also takes -q option to prevent printing progress reports and -o option that is passed directly to emulator.

8-12-2002 (version 1.124) Emulator now checks that it is the latest version each time it is run. VERSION command added to report current version number.

5-12-2002 New option when running emulator: "sys -v" makes sure paging (i.e. virtual memory) is turned on right from the start. Also "exe -v" passes that flag on to sys correctly.

4-12-2002 Added new instruction BREAK #n. Stops an executing program after printing the message BREAK #n, and enters the debugging system ready for single stepping, examining memory, etc. A debugging aid only.

3-12-2002 Added new instructions PSHRM and POPRM for saving a load of registers all at once. Also noew command "exe" to automate compiling, assembling, linking, and running; (see compiler docs for details).

27-11-2002 Fixed foolish error in interactions between assembler and linker: if an assembly language file imported a symbol but never used it, the object file produced would have been wrong.

25-11-2002 New instruction ICALL, allows interrupt functions to be called directly from within a program. (interrupt functions expect a different stack context, the normal CALL and CALLB instructions wouldn't work).

23-11-2002 Emulator now has DISCED command. An interactive subsystem that allows you to inspect and modify the contents of a disc byte-by-byte. It is capable of quite a lot, so read the online help (type DISCED to enter it, then HELP).

21-11-2002 New instructions for transferring large amounts of data, converting from small ints to larger ints, and for calculating remainders. New system functions for accessing discs (SYS$DSCNBL, SYS$DSCRBL, SYS$DSCWBL). New commands for handling discs (MAKEDISC, SHOW DISCS, SHOW BLOCK). Compiler made available (command is "cmp", "cmp -h" for help). Updates to the compiler are recorded in a different file

21-10-2002 Corrected a careless error: SYS$PUTCH didn't work, but it does now. Added verbose option to LOAD command (LOAD -v exefilename) gives information on what is being loaded.

17-10-2002 New system function SYS$PUTCH: one parameter pushed onto stack, ascii code of character. That character is printed on controlling terminal screen.

16-10-2002 Two new instructions, SYS and RETI as described in class. Operand prefixes 1: and 2: for byte and word access as described in class. Two user-accessible interrupts, IV$TIMER and IV$CHARIN as described in class. Three system functions: SYS$SETTI and SYS$SETIV as described in class, plus SYS$SMLSLP (SML=small SLP=sleep) no arguments, causes a small (tenth of a second) sleep. Use in a loop when program is idle waiting for an interrupt. New flag called INT to indictae interrupt processing is in progress. New emulator instructions: "ASSERT iname value" used to simulate interrupts when single stepping; iname is anme of interrupt (without IV$), and value is its information detail (example ASSERT CHARIN 'X' generates the interrupt that signals the letter 'X' has been typed). When running normally (not single stepping), just typing a key causes the interrupt immediately.

4-10-2002 The function GeneralCommand should be defined in one of your .cpp files, probably memory.cpp. For a complete decription look here. It allows you to define new user commands in the system, and should remove the need for any future changes to your systems caused by modifications made by me.

2-10-2002 Added SET command to system. Only one option so far: SET VMHWSZ n calls SetTranslatorSize(n) to allow user to change number of units in the hardware address translator. Files Modified: system.cpp

1-10-2002 Added directive .BLOCK n to assembler. Leaves a block of n bytes of memory, suitable for creating large uninitialised arrays, etc. Files modified: assembler.cpp

26-9-2002 Added function int CreateNewException(char *description); Allows a new error code to be created. Files modified: system.cpp, system.h


































GeneralCommand function

This function was added at about noon on 4th October 2002. If you download the files after that time, you will need to add a definition of a function called GeneralCommand to one of your .cpp files (probably memory.cpp). Without this function definition, you will get a compilation (linker) error when you try to recompile sys.

The following skeletal version of GeneralCommand may be copied and pasted directly from your web-browser into a .cpp program being edited with pico or vi:

int GeneralCommand(char *command, char *arg1, char *arg2, char *arg3)
 { if (strcmp(command, "ECHO")==0)
    { printf("command='%s'\n", command);
      if (arg1!=NULL) printf("arg1='%s'\n", arg1);
      if (arg2!=NULL) printf("arg2='%s'\n", arg2);
      if (arg3!=NULL) printf("arg3='%s'\n", arg3);
      return 1; }
   return 0; }
You do not need to do anything with that function if you don't want to. Adding it should mean that you never have to add anything else to your .cpp files because of any future changes.

Explanation: The function is called whenever the system does not understand a command typed by the user. This effectively allows you to define commands that the system will understand, without modifying system.cpp. The typed command and up to three arguments are passed as parameters. The command will always have been converted to all capitals, but the arguments are left as the user typed them.

Before defining your own command, make sure it is one that the system does not already understand, otherwise it will not work. There are two exceptions. if the SET or SHOW commands are typed with options or parameters that the system does not understand, they too will be passed on to GeneralCommand.

If this function recognises and processes the command it should return 1. If this function can not understand the command, return 0, and the system will do whatever it can with it, probably printing an error message.

The "echo" command is added in the sample below, just so that you see that there is nothing tricky to it.

This function is called for all unrecognised commands, and also if the main option to SET or SHOW is not recognised. So for example if the user types the command "set bedtime=7pm tomorrow", this function will be called with command="SET", arg1="bedtime=7pm", arg3="tomorrow", and arg3="".

If you need to convert any of the arguments from strings to integers, you can #include . That makes available a function called strtoint, (prototype: int strtoint(char *str, int &value);) The value returned is 1 is the string could successfully be converted to an integer value, and 0 if it had the wrong format. The actual integer value is stored in the second parameter. Note that it is a reference parameter, not a pointer. This function understands hexadecimal numbers (examples: "0x1FD2" or "x7FF"), binary numbers (example: "0b11101101"), octal numbers (anything else with a leading zero. Stupid scheme, I agree, but its the one C/C++ use) (example: "0177"), and plain old decimal numbers (which must not have leading zeros) (example: "1234").

Example of its use:

{ int ok, value;
  char *str="0x100";
  ok=strtoint(str, value);
  if (!ok)
    printf("'%s' is not a valid number\n", str);
  else
    printf("'%s' = %d as a decimal int\n", str, value); }
That program would print 0x100 = 256 as a decimal int.