Changed as7 to allow sys open statements, rewrite write_test.s to

use this syntax, and fixed up a bug in sys_open in a7out.
This commit is contained in:
Warren Toomey
2016-02-26 06:19:27 +10:00
parent ed46793781
commit f9b8c8eeb2
3 changed files with 64 additions and 32 deletions
+9 -8
View File
@@ -7,16 +7,16 @@ main:
lac in
dac out
" The assembler doesn't know sys write, so iot 5 for now
" Write hello to fd1 i.e stdout
lac d1
iot 5; hello; 7
sys write; hello; 7
" open file fred
iot 3; fred; 0; 0
sys open; fred; 0; 0
" read 5 words into the buffer from stdin: type in 10 or more characters!
lac d0
iot 4; buf; 5
sys read; buf; 5
" Stop and dump memory, so you can see five words at location 0400
" Comment out the hlt instruction to test close and exit
@@ -24,10 +24,10 @@ main:
" close stdin
lac d0
iot 9
sys close
" exit
iot 14
sys exit
" We should not get to the halt instruction
hlt
@@ -41,8 +41,6 @@ in: 023
out: 0
" Hello, world\n, two ASCII chars per word
d0: 0
d1: 1
hello: 0110145; 0154154; 0157054; 040; 0167157; 0162154; 0144012
" fred as a string, NUL terminated
@@ -51,3 +49,6 @@ fred: 0146162; 0145144; 0
" Input buffer for read
. = 0400
buf: 0
d0: 0
d1: 1