diff options
-rw-r--r-- | 020syscalls.cc | 3 | ||||
-rwxr-xr-x | apps/assort | bin | 44404 -> 44412 bytes | |||
-rwxr-xr-x | apps/braces | bin | 46267 -> 46275 bytes | |||
-rwxr-xr-x | apps/calls | bin | 50914 -> 50922 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1 | bin | 43745 -> 43753 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1b | bin | 44292 -> 44300 bytes | |||
-rwxr-xr-x | apps/dquotes | bin | 48026 -> 48034 bytes | |||
-rwxr-xr-x | apps/ex1 | bin | 205 -> 213 bytes | |||
-rwxr-xr-x | apps/ex10 | bin | 272 -> 280 bytes | |||
-rwxr-xr-x | apps/ex11 | bin | 1186 -> 1194 bytes | |||
-rwxr-xr-x | apps/ex12 | bin | 242 -> 250 bytes | |||
-rwxr-xr-x | apps/ex13 | bin | 219 -> 227 bytes | |||
-rwxr-xr-x | apps/ex2 | bin | 206 -> 214 bytes | |||
-rwxr-xr-x | apps/ex3 | bin | 223 -> 231 bytes | |||
-rwxr-xr-x | apps/ex4 | bin | 244 -> 252 bytes | |||
-rwxr-xr-x | apps/ex5 | bin | 244 -> 252 bytes | |||
-rwxr-xr-x | apps/ex6 | bin | 240 -> 248 bytes | |||
-rwxr-xr-x | apps/ex7 | bin | 374 -> 382 bytes | |||
-rwxr-xr-x | apps/ex8 | bin | 242 -> 250 bytes | |||
-rwxr-xr-x | apps/ex9 | bin | 236 -> 244 bytes | |||
-rwxr-xr-x | apps/factorial | bin | 42848 -> 42856 bytes | |||
-rwxr-xr-x | apps/hex | bin | 46584 -> 46592 bytes | |||
-rwxr-xr-x | apps/mu | bin | 341146 -> 341155 bytes | |||
-rw-r--r-- | apps/mu.subx | 2 | ||||
-rwxr-xr-x | apps/pack | bin | 56983 -> 56991 bytes | |||
-rwxr-xr-x | apps/sigils | bin | 58636 -> 58644 bytes | |||
-rwxr-xr-x | apps/survey | bin | 54336 -> 54344 bytes | |||
-rwxr-xr-x | apps/tests | bin | 43176 -> 43184 bytes | |||
-rw-r--r-- | apps/tile.mu | 60 | ||||
-rw-r--r-- | init.linux | 5 |
30 files changed, 69 insertions, 1 deletions
diff --git a/020syscalls.cc b/020syscalls.cc index be075426..84a6af34 100644 --- a/020syscalls.cc +++ b/020syscalls.cc @@ -79,6 +79,9 @@ void process_int80() { Reg[EAX].u = new_segment(/*length*/read_mem_u32(Reg[EBX].u+0x4)); trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].u << end(); break; + case 0xa2: // nanosleep + cerr << "not sleeping\n"; + break; default: raise << HEXWORD << EIP << ": unimplemented syscall " << Reg[EAX].u << '\n' << end(); } diff --git a/apps/assort b/apps/assort index e86d5472..f61cb556 100755 --- a/apps/assort +++ b/apps/assort Binary files differdiff --git a/apps/braces b/apps/braces index e208f3de..1adc5fe4 100755 --- a/apps/braces +++ b/apps/braces Binary files differdiff --git a/apps/calls b/apps/calls index 63624be8..e86af3dc 100755 --- a/apps/calls +++ b/apps/calls Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1 index b79a6253..513e5525 100755 --- a/apps/crenshaw2-1 +++ b/apps/crenshaw2-1 Binary files differdiff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b index d0e31bf7..9e0fcc06 100755 --- a/apps/crenshaw2-1b +++ b/apps/crenshaw2-1b Binary files differdiff --git a/apps/dquotes b/apps/dquotes index c0b11177..32c7604d 100755 --- a/apps/dquotes +++ b/apps/dquotes Binary files differdiff --git a/apps/ex1 b/apps/ex1 index 16371a7b..aec15656 100755 --- a/apps/ex1 +++ b/apps/ex1 Binary files differdiff --git a/apps/ex10 b/apps/ex10 index 9529b921..4e3a163d 100755 --- a/apps/ex10 +++ b/apps/ex10 Binary files differdiff --git a/apps/ex11 b/apps/ex11 index ffc1b034..bd1b754d 100755 --- a/apps/ex11 +++ b/apps/ex11 Binary files differdiff --git a/apps/ex12 b/apps/ex12 index 40ba51f5..d50e6db9 100755 --- a/apps/ex12 +++ b/apps/ex12 Binary files differdiff --git a/apps/ex13 b/apps/ex13 index 46652134..2f77063a 100755 --- a/apps/ex13 +++ b/apps/ex13 Binary files differdiff --git a/apps/ex2 b/apps/ex2 index 2e1e0de8..e18440e1 100755 --- a/apps/ex2 +++ b/apps/ex2 Binary files differdiff --git a/apps/ex3 b/apps/ex3 index e554f535..b594a24b 100755 --- a/apps/ex3 +++ b/apps/ex3 Binary files differdiff --git a/apps/ex4 b/apps/ex4 index b8f93eb9..25789096 100755 --- a/apps/ex4 +++ b/apps/ex4 Binary files differdiff --git a/apps/ex5 b/apps/ex5 index 90ad3a52..d2874012 100755 --- a/apps/ex5 +++ b/apps/ex5 Binary files differdiff --git a/apps/ex6 b/apps/ex6 index 2fcd0897..c9e34a6d 100755 --- a/apps/ex6 +++ b/apps/ex6 Binary files differdiff --git a/apps/ex7 b/apps/ex7 index 731f4c21..d6d12ab8 100755 --- a/apps/ex7 +++ b/apps/ex7 Binary files differdiff --git a/apps/ex8 b/apps/ex8 index 6cb660fb..dc45c8eb 100755 --- a/apps/ex8 +++ b/apps/ex8 Binary files differdiff --git a/apps/ex9 b/apps/ex9 index e067b833..7d2d495e 100755 --- a/apps/ex9 +++ b/apps/ex9 Binary files differdiff --git a/apps/factorial b/apps/factorial index 3c35ab6a..46909f1c 100755 --- a/apps/factorial +++ b/apps/factorial Binary files differdiff --git a/apps/hex b/apps/hex index e59ab578..6a470eb3 100755 --- a/apps/hex +++ b/apps/hex Binary files differdiff --git a/apps/mu b/apps/mu index 4fe31095..34350d0d 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index ef830b10..627a9436 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -16782,7 +16782,7 @@ _string_ff_subop_decrement: # (payload array byte) 0x11/imm32/alloc-id:fake:payload # "ff 1/subop/decrement" 0x14/imm32/size - 0x66/f 0x66/f 0x31/1 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t + 0x66/f 0x66/f 0x20/space 0x31/1 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t Single-int-var-in-mem: # (payload list var) 0x11/imm32/alloc-id:fake:payload diff --git a/apps/pack b/apps/pack index e5abcd4e..3b72f273 100755 --- a/apps/pack +++ b/apps/pack Binary files differdiff --git a/apps/sigils b/apps/sigils index 46c21b5a..d1bc0e91 100755 --- a/apps/sigils +++ b/apps/sigils Binary files differdiff --git a/apps/survey b/apps/survey index ed2dcf08..ad4630c9 100755 --- a/apps/survey +++ b/apps/survey Binary files differdiff --git a/apps/tests b/apps/tests index 581e5135..4410fd93 100755 --- a/apps/tests +++ b/apps/tests Binary files differdiff --git a/apps/tile.mu b/apps/tile.mu new file mode 100644 index 00000000..44451aa1 --- /dev/null +++ b/apps/tile.mu @@ -0,0 +1,60 @@ +# little example program: animate a line in text-mode + +fn main -> exit-status/ebx: int { + clear-screen + move-cursor-on-screen 5, 5 + print-string-to-screen "_________" + enable-keyboard-immediate-mode + var dummy/eax: byte <- read-key + var row/eax: int <- copy 5 + { + compare row, 0xe # 15 + break-if-= + animate row + row <- increment + sleep 0 0x5f5e100 # 100ms + loop + } + var dummy/eax: byte <- read-key + enable-keyboard-type-mode + clear-screen + exit-status <- copy 0 +} + +fn animate row: int { + var col/eax: int <- copy 5 + { + compare col, 0xe + break-if-= + move-cursor-on-screen row, col + print-string-to-screen " " + increment row + move-cursor-on-screen row, col + print-string-to-screen "_" + decrement row + col <- increment + loop + } +} + +type timespec { + tv_sec: int + tv_nsec: int +} + +# prototype wrapper around syscall_nanosleep +# nsecs must be less than 999999999 or 0x3b9ac9ff nanoseconds +fn sleep secs: int, nsecs: int { + var t: timespec + # initialize t + var tmp/eax: (addr int) <- get t, tv_sec + var tmp2/ecx: int <- copy secs + copy-to *tmp, tmp2 + tmp <- get t, tv_nsec + tmp2 <- copy nsecs + copy-to *tmp, tmp2 + # perform the syscall + var t-addr/ebx: (addr timespec) <- address t + var rem-addr/ecx: (addr timespec) <- copy 0 + syscall_nanosleep +} diff --git a/init.linux b/init.linux index 497b1ea1..9893f856 100644 --- a/init.linux +++ b/init.linux @@ -72,3 +72,8 @@ syscall_ioctl: # fd/ebx: int, cmd/ecx: int, arg/edx: (addr _) b8/copy-to-eax 0x36/imm32 cd/syscall 0x80/imm8 c3/return + +syscall_nanosleep: + b8/copy-to-eax 0xa2/imm32 # 162 + cd/syscall 0x80/imm8 + c3/return |