List of Changes to the Compiler and Emulator
For more details, see documentation.
IF ANYTHING GOES WRONG:
(when adding new features it is easy to accidentally break
old ones) Remember that you can get around every problem
by including inline assembly code in your C program
(between [[ and ]] symbols). If you think something
isn't working properly, tell me right away and I'll fix
it as soon as I can.
1-12-2004, version 2.198
Added network support to the emulator and library:
- function sys$getip(int *ip) looks up current IP address,
- function sys$netsnd(int *destip, void *data, int len) transmits IP packet,
- function sys$netrcv(int *srcip, void *data, int maxlen) receives IP packet.
Full documentation to appear as soon as possible.
This system emulates IP, so there are no port numbers, just IP addresses.
Every instance of the emulator acts as a separate computer, so even if you
are running the emulator in two login shells on the same real computer, each
run will have a different emulated IP address. To make this possible, emulated
IP addresses are SIX bytes long instead of the traditional four. Programs
can communicate in this way over the real internet when you are two real
computers in exactly the same way as they communicate over the emulated
internet when you are running the emulator twice on the same real computer.
17-3-2004, version 2.178
- Added vprintf to the stdio library
- Created a stdlib library containing only exit
- Created a stdarg library containing numbargs, va_list, va_start, and va_end
- Fixed a parsing error, sometimes it couldn't tell the difference between a type-cast and a function call, due to
dreadful design of C.
- Fixed a type-checking error, sometimes it wouldn't allow NULL to be assigned to a pointer, due again to
the dreadful design of C.
3-12-2003, version 2.173
- Added system call functions that give access to the filesystem.
sys$open,
sys$close,
sys$seek,
sys$read, and
sys$write.
These functions may be used to read or write files in the external host real
unix filesystem or in the user's own emulated filesystem. If sys$open
is given a filename that begins with '@' it treats it as the name
of a real unix file (after removing the @), which it opens, and returns
a large integer as a file reference. If the filename does not begin with '@'
it is simply passed to sys$iopen, which the user is expected to have defined.
sys$iopen should do whatever is needed to open an emulated file, and
return a small positive integer as a reference to it.
Similarly, sys$close and all the others take a file reference integer
as their first parameters; if that integer is large (>=1000) it is assumed to
be a reference to a real unix file, and is handled internally. If it is small,
the parameters are passed untouched to the corresponding sys$i...
system call, which the user is expected to have defined to provide the
appropriate functions for emulated files.
1-12-2003, version 2.172
- Fixed an error: continue inside a for loop
was jumping to the wrong place and not incrementing
the controlling variable.
30-11-2003, version 2.171
- Added functions for finding the time and date,
and for converting dates into convenient formats.
See functions sys$daytim, sys$encday,
and sys$decday int the Library
Documentation.
15-11-2003, version 2.170
- Fixed memory allocation problem: large local objects
weren't getting all their pages allocated, and that caused
access violations in running programs.
- Changed maximum disc size to 3000 blocks, so you
can at least simulate a whole floppy.
4-11-2003, version 2.167
- New system call sys$defsys allows programs to define new
or redefine existing system calls.
- New assembler directive ".define name val" allows
constants to be declared.
3-11-2003, version 2.166
- Added support for dynamic linkage, with the new system function
sys$load and the compiler directive #entry.
3-11-2003, up to version 2.164
- various error fixes as they turned up, including printfs with
mixed chars and ints, initialising a variable with a negative value,
some functions "falling through" to the next function instead of
returning at the end.
- Local variables of array, struct, or union type can now be given
an initial value.
- Added system functions and commands for accessing a global symbol table
18-12-2002, version 1.143
- C++-style for loops now permitted, e.g. for (int i=3;...
The introduced variable is handled correctly, not the microsoft way,
i.e. it is purely local to the loop.
18-12-2002, version 1.142
- Global structs, unions, and arrays of structs and unions may now be initialised, e.g.
struct S { int x; int y; int z; }; S a = { 1, 2, 3 };
S A[] = { {1,2,3}, {4,5,6} };
It is still not possible
to initialise local arrays or structs.
18-12-2002, version 1.141
- Global arrays may now be initialised, e.g. int A[] = {1,2,3};
curly brackets may NOT be elided for multi-dimensional arrays,
they must be supplied in full,
e.g. int A[2][2] = {{1,2},{3,4}}; It is still not possible
to initialise structs or local arrays.
16-12-2002, version 1.140
- Enumerations are now available.
- 'const' works when used gently.
16-12-2002, version 1.139
- The sizeof operator is now available, I had
forgotten all about it.
- Fixed a possible error involving char variables
being passed to printf
- Allowed initialisation to be skipped in a for loop (e.g. for(;1;i+=1) ...)
- Once a struct has been declared, the type can now
be referred to either in the C way: struct <name>,
or in the C++ way: <name>.
14-12-2002, version 1.137
- Making simpler (but less efficient)
use of the stack. Problems caused
by having large local variables/arrays when your
virtual memory system isn't allocating new pages
properly should not occur any more.
13-12-2002, version 1.135
- Making safe: if a C program uses a variable that
is identical to an opcode recognised by the assembler,
a '$' sign is appended to the beginning of its name.
This should be undetectable to users except in error
messages and when looking at the generated .ass file.
12-12-2002, version 1.133
- Repair: strings passed to functions from a struct
inside another struct didn't work properly, they do now.
- Had forgotten the % and %= operators: now added.
11-12-2002 (b), version 1.131
- New way to avoid problems until I can fix them:
option -i to the
cmp command or -ie to the exe
command, tells the compiler to try to ignore fatal
errors. They are still reported, but the system tries
its best to continue.
- Prototypes and later function definitions are now
checked for having the same types.
10-12-2002 (b), version 1.128
- Fixed error that I caused last night. \n in strings
had stopped working.
10-12-2002 (a), version 1.127
- Better handling of automatic type-casts (coercions)
for function arguments.
9-12-2002, version 1.126
- Fixed an error that made the compiler crash on meeting
a declaration of a parameter without a name (which is reasonable
inside a prototype).
8-12-2002, version 1.124
- Compiler now checks that it is the latest version each
time it is run. Added option -v to report current
version number.
7-12-2002
- Improved behaviour of functions with array parameters, empty
bracket [] notation now allowed.
5-12-2002
- Fixed error with in-line assembly-language after a #include
3-12-2002
- All preprocessor directives are now supported.
- Error fixed: if two functions were called in the same expression,
sometimes the second would overwrite the result of the first;
this doesn't happen any more.
1-12-2002
- Printf now works completely.
- typedef is now supported.
- type-casts are now supported.
- functions may now return large structs.
- pre-processor directives #ifdef, #ifndef, #else, #endif are now supported.
25-11-2002
- Typecasts are now fully supported.
- Typedefs are now fully supported.
- Interrupt functions (see note for
21-11-2002) can now be called in the normal way.
23-11-2002
- Repaired a small error which would only
exhibit itself if you used the compiler to copy a string
backwards. See? I do test things after all, who would have
thought of that?
21-11-2002
- Compiler first made available. Forgot to
mention in class special keyword "interrupt" to allow interrupt
handlers to be written in C. (see extras documentation).