5876 - address -> addr

This commit is contained in:
Kartik Agaram 2020-01-03 01:36:34 -08:00
parent c9bda4d13e
commit 7e7a8a6eae
110 changed files with 716 additions and 716 deletions

View File

@ -34,7 +34,7 @@ Entry: # just exit; can't test _write just yet
# You can convert a ref or handle to an address, but not the other way around.
# You can convert addresses to ints, but not the other way around.
_write: # fd : int, s : (address array byte)
_write: # fd : int, s : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -21,7 +21,7 @@ Entry: # manual test
cd/syscall 0x80/imm8
# print msg to stderr if a != b, otherwise print "."
check-ints-equal: # a : int, b : int, msg : (address array byte)
check-ints-equal: # a : int, b : int, msg : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -30,7 +30,7 @@ Entry: # run all tests
# compare a null-terminated ascii string with a more idiomatic length-prefixed byte array
# reason for the name: the only place we should have null-terminated ascii strings is from commandline args
kernel-string-equal?: # s : (address kernel-string), benchmark : (address array byte) -> eax : boolean
kernel-string-equal?: # s : (addr kernel-string), benchmark : (addr array byte) -> eax : boolean
# pseudocode:
# n = benchmark->length
# s1 = s
@ -61,12 +61,12 @@ kernel-string-equal?: # s : (address kernel-string), benchmark : (address array
53/push-ebx
56/push-esi
57/push-edi
# var s1/edi : (address byte) = s
# var s1/edi : (addr byte) = s
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi
# var n/edx : int = benchmark->length
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx
8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . . # copy *edx to edx
# var s2/esi : (address byte) = benchmark->data
# var s2/esi : (addr byte) = benchmark->data
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 4/imm32 # add to esi
# var i/ecx : int = 0
@ -262,10 +262,10 @@ test-compare-kernel-string-with-longer-array:
== data
Null-kernel-string: # (address kernel-string)
Null-kernel-string: # (addr kernel-string)
00/null
_test-Abc-kernel-string: # (address kernel-string)
_test-Abc-kernel-string: # (addr kernel-string)
41/A 62/b 63/c 00/null
# . . vim:nowrap:textwidth=0

View File

@ -29,7 +29,7 @@ Entry: # manual test
e8/call new-segment/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
# var eax : (address _) = ad->curr
# var eax : (addr _) = ad->curr
8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax
# write to *eax to check that we have access to the newly-allocated segment
c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0x34/imm32 # copy to *eax

View File

@ -13,7 +13,7 @@ Entry: # run all tests
b8/copy-to-eax 1/imm32/exit
cd/syscall 0x80/imm8
string-equal?: # s : (address array byte), benchmark : (address array byte) -> eax : boolean
string-equal?: # s : (addr array byte), benchmark : (addr array byte) -> eax : boolean
# pseudocode:
# if (s->length != benchmark->length) return false
# currs = s->data
@ -51,11 +51,11 @@ $string-equal?:lengths:
# if (ecx != benchmark->length) return false
39/compare 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . . # compare *edi and ecx
75/jump-if-not-equal $string-equal?:false/disp8
# var currs/esi : (address byte) = s->data
# var currs/esi : (addr byte) = s->data
81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 4/imm32 # add to esi
# var maxs/ecx : (address byte) = &s->data[s->length]
# var maxs/ecx : (addr byte) = &s->data[s->length]
01/add 3/mod/direct 1/rm32/ecx . . . 6/r32/esi . . # add esi to ecx
# var currb/edi : (address byte) = benchmark->data
# var currb/edi : (addr byte) = benchmark->data
81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 4/imm32 # add to edi
# var c1/eax : byte = 0
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -176,7 +176,7 @@ test-compare-inequal-strings-equal-lengths:
c3/return
# helper for later tests
check-strings-equal: # s : (address array byte), expected : (address array byte), msg : (address array byte)
check-strings-equal: # s : (addr array byte), expected : (addr array byte), msg : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -14,7 +14,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
clear-stream: # f : (address stream byte)
clear-stream: # f : (addr stream byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -25,13 +25,13 @@ clear-stream: # f : (address stream byte)
8b/copy 1/mod/*+disp8 5/rm32/ebp . . 0/r32/eax 8/disp8 . # copy *(ebp+8) to eax
# var count/ecx : int = f->length
8b/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 8/disp8 . # copy *(eax+8) to ecx
# var max/ecx : (address byte) = &f->data[f->length]
# var max/ecx : (addr byte) = &f->data[f->length]
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 0xc/disp8 . # copy eax+ecx+12 to ecx
# f->write = 0
c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32 # copy to *eax
# f->read = 0
c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 0/imm32 # copy to *(eax+4)
# var curr/eax : (address byte) = f->data
# var curr/eax : (addr byte) = f->data
81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 0xc/imm32 # add to eax
$clear-stream:loop:
# if (curr >= max) break
@ -51,7 +51,7 @@ $clear-stream:end:
5d/pop-to-ebp
c3/return
rewind-stream: # f : (address stream byte)
rewind-stream: # f : (addr stream byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -79,7 +79,7 @@ $initialize-trace-stream:end:
# Append a string to the given trace stream.
# Silently give up if it's already full. Or truncate the string if there isn't enough room.
trace: # line : (address array byte)
trace: # line : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -90,7 +90,7 @@ trace: # line : (address array byte)
53/push-ebx
56/push-esi
57/push-edi
# var edi : (address stream byte) = *Trace-stream
# var edi : (addr stream byte) = *Trace-stream
8b/copy 0/mod/indirect 5/rm32/.disp32 . . 7/r32/edi Trace-stream/disp32 # copy *Trace-stream to edi
# esi = line
8b/copy 1/mod/*+disp8 5/rm32/ebp . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
@ -246,7 +246,7 @@ test-trace-empty-line:
# end
c3/return
check-trace-contains: # line : (address string), msg : (address string)
check-trace-contains: # line : (addr string), msg : (addr string)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -271,7 +271,7 @@ $check-trace-contains:end:
5d/pop-to-ebp
c3/return
check-trace-scans-to: # line : (address string), msg : (address string)
check-trace-scans-to: # line : (addr string), msg : (addr string)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -302,7 +302,7 @@ $check-trace-scans-to:end:
c3/return
# Start scanning from Trace-stream->read for 'line'. If found, update Trace-stream->read and return true.
trace-scan: # line : (address array byte) -> result/eax : boolean
trace-scan: # line : (addr array byte) -> result/eax : boolean
# pseudocode:
# push Trace-stream->read
# while true:
@ -554,7 +554,7 @@ test-trace-scan-failure-leaves-read-index-untouched:
# . end
c3/return
next-line-matches?: # t : (address stream byte), line : (address array byte) -> result/eax : boolean
next-line-matches?: # t : (addr stream byte), line : (addr array byte) -> result/eax : boolean
# pseudocode:
# while true:
# if (currl >= maxl) break
@ -575,24 +575,24 @@ next-line-matches?: # t : (address stream byte), line : (address array byte) ->
57/push-edi
# edx = line
8b/copy 1/mod/*+disp8 5/rm32/ebp . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx
# var currl/esi : (address byte) = line->data
# var currl/esi : (addr byte) = line->data
# . esi = line/edx->data
8d/copy-address 1/mod/*+disp8 2/rm32/edx . . . 6/r32/esi 4/disp8 . # copy edx+4 to esi
# var maxl/ecx : (address byte) = &line->data[line->size]
# var maxl/ecx : (addr byte) = &line->data[line->size]
# . eax = line/edx->size
8b/copy 0/mod/indirect 2/rm32/edx . . 0/r32/eax . . # copy *edx to eax
# . maxl = &line->data[line->size]
8d/copy-address 0/mod/indirect 4/rm32/sib 6/base/esi 0/index/eax . 1/r32/ecx . . # copy edx+eax to ecx
# edi = t
8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi
# var ebx : (address byte) = t->data
# var ebx : (addr byte) = t->data
8d/copy-address 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 0xc/disp8 . # copy edi+12 to ebx
# var maxt/edx : (address byte) = &t->data[t->write]
# var maxt/edx : (addr byte) = &t->data[t->write]
# . eax = t->write
8b/copy 0/mod/indirect 7/rm32/edi . . 0/r32/eax . . # copy *edi to eax
# . maxt = &t->data[t->write]
8d/copy-address 0/mod/indirect 4/rm32/sib 3/base/ebx 0/index/eax . 2/r32/edx . . # copy ebx+eax to edx
# var currt/edi : (address byte) = &t->data[t->read]
# var currt/edi : (addr byte) = &t->data[t->read]
# . eax = t/edi->read
8b/copy 1/mod/*+disp8 7/rm32/edi . . 0/r32/eax 4/disp8 . # copy *(edi+4) to eax
# . currt = &t->data[t->read]
@ -730,7 +730,7 @@ test-next-line-matches?-match:
c3/return
# move t->read to _after_ next newline
skip-next-line: # t : (address stream byte)
skip-next-line: # t : (addr stream byte)
# pseudocode:
# max = &t->data[t->write]
# i = t->read
@ -756,11 +756,11 @@ skip-next-line: # t : (address stream byte)
8d/copy-address 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 0xc/disp8 . # copy ecx+12 to edx
# eax = t->write
8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax
# var max/ebx : (address byte) = &t->data[t->write]
# var max/ebx : (addr byte) = &t->data[t->write]
8d/copy-address 0/mod/indirect 4/rm32/sib 2/base/edx 0/index/eax . 3/r32/ebx . . # copy edx+eax to ebx
# eax = t->read
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 . # copy *(ecx+4) to edx
# var curr/ecx : (address byte) = &t->data[t->read]
# var curr/ecx : (addr byte) = &t->data[t->read]
8d/copy-address 0/mod/indirect 4/rm32/sib 2/base/edx 0/index/eax . 1/r32/ecx . . # copy edx+eax to ecx
# var i/edx : int = t->read
89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . . # copy eax to edx
@ -858,7 +858,7 @@ $clear-trace-stream:end:
# - helpers
# 3-argument variant of _append
_append-3: # out : (address byte), outend : (address byte), s : (address array byte) -> num_bytes_appended/eax
_append-3: # out : (addr byte), outend : (addr byte), s : (addr array byte) -> num_bytes_appended/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -890,7 +890,7 @@ $_append-3:end:
c3/return
# 4-argument variant of _append
_append-4: # out : (address byte), outend : (address byte), in : (address byte), inend : (address byte) -> num_bytes_appended/eax : int
_append-4: # out : (addr byte), outend : (addr byte), in : (addr byte), inend : (addr byte) -> num_bytes_appended/eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -21,7 +21,7 @@
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# TODO: come up with a way to signal when a write to disk fails
write: # f : fd or (address stream byte), s : (address array byte)
write: # f : fd or (addr stream byte), s : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -6,7 +6,7 @@
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# compare all the data in a stream (ignoring the read pointer)
stream-data-equal?: # f : (address stream byte), s : (address array byte) -> eax : boolean
stream-data-equal?: # f : (addr stream byte), s : (addr array byte) -> eax : boolean
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -19,9 +19,9 @@ stream-data-equal?: # f : (address stream byte), s : (address array byte) -> ea
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# eax = f->write
8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax
# var maxf/edx : (address byte) = &f->data[f->write]
# var maxf/edx : (addr byte) = &f->data[f->write]
8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 2/r32/edx 0xc/disp8 . # copy esi+eax+12 to edx
# var currf/esi : (address byte) = f->data
# var currf/esi : (addr byte) = f->data
81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 0xc/imm32 # add to esi
# edi = s
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 . # copy *(ebp+12) to edi
@ -29,7 +29,7 @@ $stream-data-equal?:compare-lengths:
# if (f->write != s->length) return false
39/compare 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . . # compare *edi and eax
75/jump-if-not-equal $stream-data-equal?:false/disp8
# var currs/edi : (address byte) = s->data
# var currs/edi : (addr byte) = s->data
81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 4/imm32 # add to edi
# var eax : byte = 0
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -191,7 +191,7 @@ test-stream-data-equal-length-check:
c3/return
# helper for later tests
check-stream-equal: # f : (address stream byte), s : (address array byte), msg : (address array byte)
check-stream-equal: # f : (addr stream byte), s : (addr array byte), msg : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -227,7 +227,7 @@ $check-stream-equal:end:
# on success, set f->read to after the next newline
# on failure, leave f->read unmodified
# this function is usually used only in tests, so we repeatedly write f->read
next-stream-line-equal?: # f : (address stream byte), s : (address array byte) -> eax : boolean
next-stream-line-equal?: # f : (addr stream byte), s : (addr array byte) -> eax : boolean
# pseudocode:
# currf = f->read # bound: f->write
# currs = 0 # bound : s->length

View File

@ -41,7 +41,7 @@
# the stack.
# Ugly that we need to know the size of args. Don't allocate variables between
# tailor-exit-descriptor and the call it's for.
tailor-exit-descriptor: # ed : (address exit-descriptor), nbytes : int
tailor-exit-descriptor: # ed : (addr exit-descriptor), nbytes : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -89,7 +89,7 @@ $tailor-exit-descriptor:end:
5d/pop-to-ebp
c3/return
stop: # ed : (address exit-descriptor), value : int
stop: # ed : (addr exit-descriptor), value : int
# no prologue; one way or another, we're going to clobber registers
# eax = ed
8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none . 0/r32/eax 4/disp8 . # copy *(esp+4) to eax
@ -161,7 +161,7 @@ test-stop-skips-returns-on-exit:
5d/pop-to-ebp
c3/return
_test-stop-1: # ed : (address exit-descriptor)
_test-stop-1: # ed : (addr exit-descriptor)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -188,7 +188,7 @@ $_test-stop-1:dead-end:
5d/pop-to-ebp
c3/return
_test-stop-2: # ed : (address exit-descriptor)
_test-stop-2: # ed : (addr exit-descriptor)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -45,7 +45,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
read: # f : fd or (address stream byte), s : (address stream byte) -> num-bytes-read/eax : int
read: # f : fd or (addr stream byte), s : (addr stream byte) -> num-bytes-read/eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -195,7 +195,7 @@ $_buffer-4:end:
# Unclear how I'd use it, though. Callers seem to need the check anyway.
# Maybe a better helper would be 'empty-stream?'
_read: # fd : int, s : (address stream byte) -> num-bytes-read/eax : int
_read: # fd : int, s : (addr stream byte) -> num-bytes-read/eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -12,7 +12,7 @@
# The buffered file for standard input. Also illustrates the layout for
# buffered-file: a pointer to the backing store, followed by a 'buffer' stream
Stdin: # (ref buffered-file)
# file descriptor or (address stream byte)
# file descriptor or (addr stream byte)
0/imm32 # standard input
$Stdin->buffer:
# inlined fields for a stream
@ -35,7 +35,7 @@ $Stdin->buffer:
# return next byte value in eax, with top 3 bytes cleared.
# On reaching end of file, return 0xffffffff (Eof).
read-byte-buffered: # f : (address buffered-file) -> byte-or-Eof/eax
read-byte-buffered: # f : (addr buffered-file) -> byte-or-Eof/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -272,7 +272,7 @@ test-read-byte-buffered-refills-buffer:
# a test buffered file for _test-stream
_test-buffered-file: # (ref buffered-file)
# file descriptor or (address stream byte)
# file descriptor or (addr stream byte)
_test-stream/imm32
$_test-buffered-file->buffer:
# current write index
@ -311,7 +311,7 @@ _test-input-stream: # (ref stream byte)
# a test buffered file for _test-input-stream
_test-input-buffered-file: # (ref buffered-file)
# file descriptor or (address stream byte)
# file descriptor or (addr stream byte)
_test-input-stream/imm32
$_test-input-buffered-file->buffer:
# current write index

View File

@ -15,7 +15,7 @@
#? b8/copy-to-eax 1/imm32/exit
#? cd/syscall 0x80/imm8
write-stream: # f : fd or (address stream byte), s : (address stream byte)
write-stream: # f : fd or (addr stream byte), s : (addr stream byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -75,7 +75,7 @@ $write-stream:end:
5d/pop-to-ebp
c3/return
_write-stream: # fd : int, s : (address stream byte)
_write-stream: # fd : int, s : (addr stream byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -6,7 +6,7 @@
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# write(out, "Error: "+msg+"\n") then stop(ed, 1)
error: # ed : (address exit-descriptor), out : fd or (address stream byte), msg : (address array byte)
error: # ed : (addr exit-descriptor), out : fd or (addr stream byte), msg : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -8,7 +8,7 @@
# The buffered file for standard output.
Stdout: # (ref buffered-file)
# file descriptor or (address stream byte)
# file descriptor or (addr stream byte)
1/imm32 # standard output
$Stdout->buffer:
# inlined fields for a stream
@ -30,7 +30,7 @@ $Stdout->buffer:
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# Write lower byte of 'n' to 'f'.
write-byte-buffered: # f : (address buffered-file), n : int
write-byte-buffered: # f : (addr buffered-file), n : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -78,7 +78,7 @@ $write-byte-buffered:end:
5d/pop-to-ebp
c3/return
flush: # f : (address buffered-file)
flush: # f : (addr buffered-file)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -205,7 +205,7 @@ test-write-byte-buffered-multiple-flushes:
# - variant without buffering
# Write lower byte of 'n' to 'f'.
append-byte: # f : (address stream byte), n : int
append-byte: # f : (addr stream byte), n : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -326,7 +326,7 @@ _test-output-stream: # (ref stream byte)
# a test buffered file for _test-output-stream
_test-output-buffered-file: # (ref buffered-file)
# file descriptor or (address stream byte)
# file descriptor or (addr stream byte)
_test-output-stream/imm32
$_test-output-buffered-file->buffer:
# current write index
@ -357,7 +357,7 @@ _test-error-stream: # (ref stream byte)
# a test buffered file for _test-error-stream
_test-error-buffered-file: # (ref buffered-file)
# file descriptor or (address stream byte)
# file descriptor or (addr stream byte)
_test-error-stream/imm32
$_test-error-buffered-file->buffer:
# current write index

View File

@ -5,7 +5,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
write-buffered: # f : (address buffered-file), msg : (address array byte)
write-buffered: # f : (addr buffered-file), msg : (addr array byte)
# pseudocode:
# in = msg->data
# inend = &msg->data[msg->length]
@ -38,9 +38,9 @@ write-buffered: # f : (address buffered-file), msg : (address array byte)
57/push-edi
# eax = msg
8b/copy 1/mod/*+disp8 5/rm32/ebp . . 0/r32/eax 0xc/disp8 . # copy *(ebp+12) to eax
# var in/esi : (address byte) = msg->data
# var in/esi : (addr byte) = msg->data
8d/copy-address 1/mod/*+disp8 0/rm32/eax . . . 6/r32/esi 4/disp8 . # copy eax+4 to esi
# var inend/ecx : (address byte) = &msg->data[msg->length]
# var inend/ecx : (addr byte) = &msg->data[msg->length]
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
8d/copy-address 0/mod/indirect 4/rm32/sib 6/base/esi 1/index/ecx . 1/r32/ecx . . # copy esi+ecx to ecx
# edi = f
@ -207,7 +207,7 @@ test-write-buffered-with-intermediate-flush:
# The buffered file for standard error.
Stderr: # (ref buffered-file)
# file descriptor or (address stream byte)
# file descriptor or (addr stream byte)
2/imm32 # standard error
$Stderr->buffer:
# inlined fields for a stream

View File

@ -18,7 +18,7 @@ $to-hex-char:else:
05/add-to-eax 0x57/imm32/a-10
c3/return
append-byte-hex: # f : (address stream byte), n : int
append-byte-hex: # f : (addr stream byte), n : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -90,7 +90,7 @@ test-append-byte-hex:
c3/return
# print the hex representation for the lowest byte of a number
print-byte-buffered: # f : (address buffered-file), n : int
print-byte-buffered: # f : (addr buffered-file), n : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -175,7 +175,7 @@ test-print-byte-buffered:
# . end
c3/return
print-int32: # f : (address stream byte), n : int
print-int32: # f : (addr stream byte), n : int
# pseudocode:
# write(f, "0x")
# ecx = 28
@ -263,7 +263,7 @@ test-print-int32:
# . end
c3/return
print-int32-buffered: # f : (address buffered-file), n : int
print-int32-buffered: # f : (addr buffered-file), n : int
# pseudocode:
# write-buffered(f, "0x")
# ecx = 28

View File

@ -6,7 +6,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
is-hex-int?: # in : (address slice) -> eax : boolean
is-hex-int?: # in : (addr slice) -> eax : boolean
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -18,7 +18,7 @@ is-hex-int?: # in : (address slice) -> eax : boolean
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 . # copy *(ebp+8) to ecx
# edx = s->end
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 . # copy *(ecx+4) to edx
# var curr/ecx : (address byte) = s->start
# var curr/ecx : (addr byte) = s->start
8b/copy 0/mod/indirect 1/rm32/ecx . . . 1/r32/ecx . . # copy *ecx to ecx
# if s is empty return false
b8/copy-to-eax 0/imm32/false
@ -351,7 +351,7 @@ test-is-hex-int-handles-negative-0x-prefix:
5d/pop-to-ebp
c3/return
parse-hex-int: # in : (address slice) -> result/eax : int
parse-hex-int: # in : (addr slice) -> result/eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -366,7 +366,7 @@ parse-hex-int: # in : (address slice) -> result/eax : int
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 . # copy *(ebp+8) to ecx
# edx = in->end
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 . # copy *(ecx+4) to edx
# var curr/ecx : (address byte) = in->start
# var curr/ecx : (addr byte) = in->start
8b/copy 0/mod/indirect 1/rm32/ecx . . . 1/r32/ecx . . # copy *ecx to ecx
# var negate?/esi : boolean = false
31/xor 3/mod/direct 6/rm32/esi . . . 6/r32/esi . . # clear esi

View File

@ -24,7 +24,7 @@
#? cd/syscall 0x80/imm8
# write(out, "Error: "+msg+": "+byte) then stop(ed, 1)
error-byte: # ed : (address exit-descriptor), out : (address buffered-file), msg : (address array byte), n : byte
error-byte: # ed : (addr exit-descriptor), out : (addr buffered-file), msg : (addr array byte), n : byte
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -56,7 +56,7 @@ $array-equal-main:end:
# Claim the next 'n' bytes of memory starting at ad->curr and update ad->curr.
# Abort if there isn't enough memory in 'ad'.
allocate: # ad : (address allocation-descriptor), n : int -> address-or-null/eax : (address _)
allocate: # ad : (addr allocation-descriptor), n : int -> address-or-null/eax : (addr _)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -180,7 +180,7 @@ _pending-test-allocate-failure:
c3/return
# helper: create a nested allocation descriptor (useful for tests)
allocate-region: # ad : (address allocation-descriptor), n : int -> new-ad : (handle allocation-descriptor)
allocate-region: # ad : (addr allocation-descriptor), n : int -> new-ad : (handle allocation-descriptor)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -5,7 +5,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
new-stream: # ad : (address allocation-descriptor), length : int, elemsize : int -> address/eax : (handle stream _)
new-stream: # ad : (addr allocation-descriptor), length : int, elemsize : int -> address/eax : (handle stream _)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -6,7 +6,7 @@
# read bytes from 'f' until (and including) a newline and store them into 's'
# 's' fails to grow if and only if no data found
# just abort if 's' is too small
read-line-buffered: # f : (address buffered-file), s : (address stream byte)
read-line-buffered: # f : (addr buffered-file), s : (addr stream byte)
# pseudocode:
# while true
# if (s->write >= s->length) abort
@ -216,7 +216,7 @@ test-read-line-buffered-reads-final-line-until-Eof:
# read bytes from 'f' until (and including) a newline and store them into 's'
# 's' fails to grow if and only if no data found
# just abort if 's' is too small
read-line: # f : (address stream byte), s : (address stream byte)
read-line: # f : (addr stream byte), s : (addr stream byte)
# pseudocode:
# while true
# if (s->write >= s->length) abort

View File

@ -6,7 +6,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
slice-empty?: # s : (address slice) -> eax : boolean
slice-empty?: # s : (addr slice) -> eax : boolean
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -88,7 +88,7 @@ test-slice-empty-false:
5d/pop-to-ebp
c3/return
slice-equal?: # s : (address slice), p : (address array byte) -> eax : boolean
slice-equal?: # s : (addr slice), p : (addr array byte) -> eax : boolean
# pseudocode:
# if (p == 0) return (s == 0)
# currs = s->start
@ -118,9 +118,9 @@ slice-equal?: # s : (address slice), p : (address array byte) -> eax : boolean
56/push-esi
# esi = s
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var currs/edx : (address byte) = s->start
# var currs/edx : (addr byte) = s->start
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
# var maxs/esi : (address byte) = s->end
# var maxs/esi : (addr byte) = s->end
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 . # copy *(esi+4) to esi
# var slen/eax : int = maxs - currs
89/copy 3/mod/direct 0/rm32/eax . . . 6/r32/esi . . # copy esi to eax
@ -139,7 +139,7 @@ $slice-equal?:nonnull-string:
# if (slen != p->length) return false
39/compare 0/mod/indirect 3/rm32/ebx . . . 0/r32/eax . . # compare *ebx and eax
75/jump-if-not-equal $slice-equal?:false/disp8
# var currp/ebx : (address byte) = p->data
# var currp/ebx : (addr byte) = p->data
81 0/subop/add 3/mod/direct 3/rm32/ebx . . . . . 4/imm32 # add to ebx
# var c1/eax : byte = 0
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -455,7 +455,7 @@ test-slice-equal-with-null:
5d/pop-to-ebp
c3/return
slice-starts-with?: # s : (address slice), head : (address array byte) -> eax : boolean
slice-starts-with?: # s : (addr slice), head : (addr array byte) -> eax : boolean
# pseudocode
# lenh = head->length
# if (lenh > s->end - s->start) return false
@ -498,9 +498,9 @@ slice-starts-with?: # s : (address slice), head : (address array byte) -> eax :
# if (lenh > lens) return false
39/compare 3/mod/direct 2/rm32/edx . . . 1/r32/ecx . . # compare edx with ecx
7f/jump-if-greater $slice-starts-with?:false/disp8
# var currs/esi : (address byte) = s->start
# var currs/esi : (addr byte) = s->start
8b/subtract 0/mod/indirect 6/rm32/esi . . . 6/r32/esi . . # copy *esi to esi
# var currh/edi : (address byte) = head->data
# var currh/edi : (addr byte) = head->data
81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 4/imm32 # add to edi
# var i/ecx : int = 0
31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . . # clear ecx
@ -761,7 +761,7 @@ test-slice-starts-with-fails-2:
# write a slice to a stream
# abort if the stream doesn't have enough space
write-slice: # out : (address stream byte), s : (address slice)
write-slice: # out : (addr stream byte), s : (addr slice)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -774,9 +774,9 @@ write-slice: # out : (address stream byte), s : (address slice)
57/push-edi
# esi = s
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
# var curr/ecx : (address byte) = s->start
# var curr/ecx : (addr byte) = s->start
8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # copy *esi to ecx
# var max/esi : (address byte) = s->end
# var max/esi : (addr byte) = s->end
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 . # copy *(esi+4) to esi
# edi = out
8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi
@ -877,7 +877,7 @@ test-write-slice:
c3/return
# write a slice to a buffered-file
write-slice-buffered: # out : (address buffered-file), s : (address slice)
write-slice-buffered: # out : (addr buffered-file), s : (addr slice)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -890,9 +890,9 @@ write-slice-buffered: # out : (address buffered-file), s : (address slice)
57/push-edi
# esi = s
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
# var curr/ecx : (address byte) = s->start
# var curr/ecx : (addr byte) = s->start
8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # copy *esi to ecx
# var max/esi : (address byte) = s->end
# var max/esi : (addr byte) = s->end
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 . # copy *(esi+4) to esi
# edi = out
8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi
@ -1012,7 +1012,7 @@ test-write-slice-buffered:
c3/return
# copy a slice into a new (dynamically allocated) string
slice-to-string: # ad : (address allocation-descriptor), in : (address slice) -> out/eax : (address array byte)
slice-to-string: # ad : (addr allocation-descriptor), in : (addr slice) -> out/eax : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -1023,9 +1023,9 @@ slice-to-string: # ad : (address allocation-descriptor), in : (address slice) -
56/push-esi
# esi = in
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
# var curr/edx : (address byte) = in->start
# var curr/edx : (addr byte) = in->start
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
# var max/ebx : (address byte) = in->end
# var max/ebx : (addr byte) = in->end
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 4/disp8 . # copy *(esi+4) to ebx
# var size/ecx : int = max - curr + 4 # total size of output string (including the initial length)
89/copy 3/mod/direct 1/rm32/ecx . . . 3/r32/ebx . . # copy ebx to ecx

View File

@ -7,7 +7,7 @@
# extract the next run of characters that are different from a given 'delimiter' (skipping multiple delimiters if necessary)
# on reaching end of file, return an empty interval
next-token: # in : (address stream byte), delimiter : byte, out : (address slice)
next-token: # in : (addr stream byte), delimiter : byte, out : (addr slice)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -160,7 +160,7 @@ test-next-token-Eof:
# extract the next run of characters that are different from a given 'delimiter' (skipping multiple delimiters if necessary)
# on reaching end of file, return an empty interval
next-token-from-slice: # start : (address byte), end : (address byte), delimiter : byte, out : (address slice)
next-token-from-slice: # start : (addr byte), end : (addr byte), delimiter : byte, out : (addr slice)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -338,7 +338,7 @@ test-next-token-from-slice-nothing:
5d/pop-to-ebp
c3/return
skip-chars-matching: # in : (address stream byte), delimiter : byte
skip-chars-matching: # in : (addr stream byte), delimiter : byte
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -461,7 +461,7 @@ test-skip-chars-matching-none:
# end
c3/return
skip-chars-matching-whitespace: # in : (address stream byte)
skip-chars-matching-whitespace: # in : (addr stream byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -551,7 +551,7 @@ test-skip-chars-matching-whitespace:
c3/return
# minor fork of 'skip-chars-matching'
skip-chars-not-matching: # in : (address stream byte), delimiter : byte
skip-chars-not-matching: # in : (addr stream byte), delimiter : byte
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -713,7 +713,7 @@ test-skip-chars-not-matching-all:
# end
c3/return
skip-chars-not-matching-whitespace: # in : (address stream byte)
skip-chars-not-matching-whitespace: # in : (addr stream byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -801,7 +801,7 @@ test-skip-chars-not-matching-whitespace:
# end
c3/return
skip-chars-matching-in-slice: # curr : (address byte), end : (address byte), delimiter : byte -> curr/eax
skip-chars-matching-in-slice: # curr : (addr byte), end : (addr byte), delimiter : byte -> curr/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -897,7 +897,7 @@ test-skip-chars-matching-in-slice-none:
# end
c3/return
skip-chars-matching-whitespace-in-slice: # curr : (address byte), end : (address byte) -> curr/eax
skip-chars-matching-whitespace-in-slice: # curr : (addr byte), end : (addr byte) -> curr/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -970,7 +970,7 @@ test-skip-chars-matching-whitespace-in-slice:
c3/return
# minor fork of 'skip-chars-matching-in-slice'
skip-chars-not-matching-in-slice: # curr : (address byte), end : (address byte), delimiter : byte -> curr/eax
skip-chars-not-matching-in-slice: # curr : (addr byte), end : (addr byte), delimiter : byte -> curr/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -1095,7 +1095,7 @@ test-skip-chars-not-matching-in-slice-all:
# end
c3/return
skip-chars-not-matching-whitespace-in-slice: # curr : (address byte), end : (address byte) -> curr/eax
skip-chars-not-matching-whitespace-in-slice: # curr : (addr byte), end : (addr byte) -> curr/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -1168,7 +1168,7 @@ test-skip-chars-not-matching-whitespace-in-slice:
# update line->read to end of string literal surrounded by double quotes
# line->read must start out at a double-quote
skip-string: # line : (address stream byte)
skip-string: # line : (addr stream byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -1410,7 +1410,7 @@ test-skip-string-works-from-mid-stream:
5d/pop-to-ebp
c3/return
skip-string-in-slice: # curr : (address byte), end : (address byte) -> new_curr/eax
skip-string-in-slice: # curr : (addr byte), end : (addr byte) -> new_curr/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -1596,7 +1596,7 @@ test-skip-string-in-slice-stops-at-end:
# update line->read to ')'
# line->read ends at ')'
skip-until-close-paren: # line : (address stream byte)
skip-until-close-paren: # line : (addr stream byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -1783,7 +1783,7 @@ test-skip-until-close-paren-works-from-mid-stream:
5d/pop-to-ebp
c3/return
skip-until-close-paren-in-slice: # curr : (address byte), end : (address byte) -> new_curr/eax : (address byte)
skip-until-close-paren-in-slice: # curr : (addr byte), end : (addr byte) -> new_curr/eax : (addr byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -8,7 +8,7 @@
# - construct a 'maximal slice' and pass it to write-slice-buffered
# - flush the buffered-file and pass the stream directly to its fd (disabling buffering)
# we'll go with the first way for now
write-stream-data: # f : (address buffered-file), s : (address stream byte)
write-stream-data: # f : (addr buffered-file), s : (addr stream byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -5,7 +5,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
print-int32-decimal: # out : (address stream byte), n : int32
print-int32-decimal: # out : (addr stream byte), n : int32
# works by generating characters from lowest to highest and pushing them
# to the stack, before popping them one by one into the stream
#
@ -76,9 +76,9 @@ $print-int32-decimal:write:
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi
# var w/edx : int = out->write
8b/copy 0/mod/indirect 7/rm32/edi . . . 2/r32/edx . . # copy *edi to edx
# var curr/ecx : (address byte) = &out->data[out->write]
# var curr/ecx : (addr byte) = &out->data[out->write]
8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 2/index/edx . 1/r32/ecx 0xc/disp8 . # copy ebx+edx+12 to ecx
# var max/ebx : (address byte) = &out->data[out->length]
# var max/ebx : (addr byte) = &out->data[out->length]
8b/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 . # copy *(edi+8) to ebx
8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx . 3/r32/ebx 0xc/disp8 . # copy edi+ebx+12 to ebx
$print-int32-decimal:write-loop:

View File

@ -7,7 +7,7 @@
# (re)compute the bounds of the next word in the line
# return empty string on reaching end of file
next-word: # line : (address stream byte), out : (address slice)
next-word: # line : (addr stream byte), out : (addr slice)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -5,7 +5,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
has-metadata?: # word : (address slice), s : (address string) -> eax : boolean
has-metadata?: # word : (addr slice), s : (addr string) -> eax : boolean
# pseudocode:
# var twig : &slice = next-token-from-slice(word->start, word->end, '/') # skip name
# curr = twig->end
@ -25,7 +25,7 @@ has-metadata?: # word : (address slice), s : (address string) -> eax : boolean
57/push-edi
# esi = word
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var edx : (address byte) = word->end
# var edx : (addr byte) = word->end
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 4/disp8 . # copy *(esi+4) to edx
# var twig/edi : (ref slice)
68/push 0/imm32/end
@ -275,7 +275,7 @@ test-has-metadata-multiple-false:
#: - if it starts with '0x' it's treated as a number. (redundant)
#: - if it's two characters long, it can't be a name. Either it's a hex
#: byte, or it raises an error.
is-valid-name?: # in : (address slice) -> eax : boolean
is-valid-name?: # in : (addr slice) -> eax : boolean
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -284,7 +284,7 @@ is-valid-name?: # in : (address slice) -> eax : boolean
56/push-esi
# esi = in
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var start/ecx : (address byte) = in->start
# var start/ecx : (addr byte) = in->start
8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # copy *esi to ecx
$is-valid-name?:check0:
# if (start >= in->end) return false
@ -298,7 +298,7 @@ $is-valid-name?:check1:
3d/compare-eax-and 2/imm32
74/jump-if-equal $is-valid-name?:false/disp8
$is-valid-name?:check2:
# var c/eax : (address byte) = *start
# var c/eax : (addr byte) = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . . # copy byte at *ecx to AL
# if (c == "-") return false
@ -532,7 +532,7 @@ test-is-valid-name-starts-with-digit:
5d/pop-to-ebp
c3/return
is-label?: # word : (address slice) -> eax : boolean
is-label?: # word : (addr slice) -> eax : boolean
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -540,7 +540,7 @@ is-label?: # word : (address slice) -> eax : boolean
51/push-ecx
# ecx = word
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 . # copy *(ebp+8) to ecx
# var end/ecx : (address byte) = word->end
# var end/ecx : (addr byte) = word->end
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 1/r32/ecx 4/disp8 . # copy *(ecx+4) to ecx
# return *(end - 1) == ':'
# . eax = *(end-1)

View File

@ -4,7 +4,7 @@
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# print 'n' in hex in 'width' bytes in lower-endian order, with a space after every byte
emit-hex: # out : (address buffered-file), n : int, width : int
emit-hex: # out : (addr buffered-file), n : int, width : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -7,7 +7,7 @@
# it in 'width' bytes of hex, least significant first.
# Otherwise just print the entire word including metadata.
# Always print a trailing space.
emit: # out : (address buffered-file), word : (address slice), width : int
emit: # out : (addr buffered-file), word : (addr slice), width : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -5,7 +5,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
zero-out: # start : (address byte), len : int
zero-out: # start : (addr byte), len : int
# pseudocode:
# curr/esi = start
# i/ecx = 0

View File

@ -1,6 +1,6 @@
# A table is a stream of (key, value) rows.
#
# Each row consists of a 4-byte key -- a 'string_key' which is (address array
# Each row consists of a 4-byte key -- a 'string_key' which is (addr array
# byte) -- and a variable-size value.
#
# Accessing the table performs a linear scan for a key string, and always
@ -23,8 +23,8 @@
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# if no row is found, abort
# type string_key = (address array byte)
get: # table : (address stream {string_key, T}), key : string_key, row-size : int, abort-message-prefix : (address array byte) -> eax : (address T)
# type string_key = (addr array byte)
get: # table : (addr stream {string_key, T}), key : string_key, row-size : int, abort-message-prefix : (addr array byte) -> eax : (addr T)
# pseudocode:
# curr = table->data
# max = &table->data[table->write]
@ -43,9 +43,9 @@ get: # table : (address stream {string_key, T}), key : string_key, row-size : i
56/push-esi
# esi = table
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var curr/ecx : (address string_key) = table->data
# var curr/ecx : (addr string_key) = table->data
8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 0xc/disp8 . # copy esi+12 to ecx
# var max/edx : (address byte) = &table->data[table->write]
# var max/edx : (addr byte) = &table->data[table->write]
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx . . # copy ecx+edx to edx
$get:search-loop:
@ -198,7 +198,7 @@ $test-get:end:
c3/return
# if no row is found, abort
get-slice: # table : (address stream {string_key, T}), key : (address slice), row-size : int, abort-message-prefix : (address array byte) -> eax : (address T)
get-slice: # table : (addr stream {string_key, T}), key : (addr slice), row-size : int, abort-message-prefix : (addr array byte) -> eax : (addr T)
# pseudocode:
# curr = table->data
# max = &table->data[table->write]
@ -217,9 +217,9 @@ get-slice: # table : (address stream {string_key, T}), key : (address slice), r
56/push-esi
# esi = table
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var curr/ecx : (address string_key) = table->data
# var curr/ecx : (addr string_key) = table->data
8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 0xc/disp8 . # copy esi+12 to ecx
# var max/edx : (address byte) = &table->data[table->write]
# var max/edx : (addr byte) = &table->data[table->write]
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx . . # copy ecx+edx to edx
$get-slice:search-loop:
@ -401,7 +401,7 @@ $test-get-slice:end:
# return the address of the value
# Beware: assume keys are immutable; they're inserted by reference
# TODO: pass in an allocation descriptor
get-or-insert: # table : (address stream {string_key, T}), key : string_key, row-size : int -> eax : (address T)
get-or-insert: # table : (addr stream {string_key, T}), key : string_key, row-size : int -> eax : (addr T)
# pseudocode:
# curr = table->data
# max = &table->data[table->write]
@ -425,9 +425,9 @@ get-or-insert: # table : (address stream {string_key, T}), key : string_key, ro
56/push-esi
# esi = table
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var curr/ecx : (address string_key) = table->data
# var curr/ecx : (addr string_key) = table->data
8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 0xc/disp8 . # copy esi+12 to ecx
# var max/edx : (address string_key) = &table->data[table->write]
# var max/edx : (addr string_key) = &table->data[table->write]
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx . . # copy ecx+edx to edx
$get-or-insert:search-loop:
@ -652,7 +652,7 @@ $test-get-or-insert:end:
# if there are no rows free, abort
# WARNING: leaks memory
# TODO: pass in an allocation descriptor
leaky-get-or-insert-slice: # table : (address stream {string_key, T}), key : (address slice), row-size : int -> eax : (address T)
leaky-get-or-insert-slice: # table : (addr stream {string_key, T}), key : (addr slice), row-size : int -> eax : (addr T)
# pseudocode:
# curr = table->data
# max = &table->data[table->write]
@ -676,9 +676,9 @@ leaky-get-or-insert-slice: # table : (address stream {string_key, T}), key : (a
56/push-esi
# esi = table
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var curr/ecx : (address string_key) = table->data
# var curr/ecx : (addr string_key) = table->data
8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 0xc/disp8 . # copy esi+12 to ecx
# var max/edx : (address string_key) = &table->data[table->write]
# var max/edx : (addr string_key) = &table->data[table->write]
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx . . # copy ecx+edx to edx
$leaky-get-or-insert-slice:search-loop:
@ -924,9 +924,9 @@ $test-leaky-get-or-insert-slice:end:
c3/return
# if no row is found, stop(ed)
get-or-stop: # table : (address stream {string_key, T}), key : string_key, row-size : int,
# abort-message-prefix : (address array byte), err : (address buffered-file), ed : (address exit-descriptor)
# -> eax : (address T)
get-or-stop: # table : (addr stream {string_key, T}), key : string_key, row-size : int,
# abort-message-prefix : (addr array byte), err : (addr buffered-file), ed : (addr exit-descriptor)
# -> eax : (addr T)
# pseudocode:
# curr = table->data
# max = &table->data[table->write]
@ -946,9 +946,9 @@ get-or-stop: # table : (address stream {string_key, T}), key : string_key, row-
56/push-esi
# esi = table
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var curr/ecx : (address string_key) = table->data
# var curr/ecx : (addr string_key) = table->data
8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 0xc/disp8 . # copy esi+12 to ecx
# var max/edx : (address byte) = &table->data[table->write]
# var max/edx : (addr byte) = &table->data[table->write]
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx . . # copy ecx+edx to edx
$get-or-stop:search-loop:
@ -1140,9 +1140,9 @@ $test-get-or-stop:end:
c3/return
# if no row is found, stop(ed)
get-slice-or-stop: # table : (address stream {string_key, _}), key : (address slice), row-size : int,
# abort-message-prefix : (address string), err : (address buffered-file), ed : (address exit-descriptor)
# -> eax : (address _)
get-slice-or-stop: # table : (addr stream {string_key, _}), key : (addr slice), row-size : int,
# abort-message-prefix : (addr string), err : (addr buffered-file), ed : (addr exit-descriptor)
# -> eax : (addr _)
# pseudocode:
# curr = table->data
# max = &table->data[table->write]
@ -1162,9 +1162,9 @@ get-slice-or-stop: # table : (address stream {string_key, _}), key : (address s
56/push-esi
# esi = table
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var curr/ecx : (address string_key) = table->data
# var curr/ecx : (addr string_key) = table->data
8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 0xc/disp8 . # copy esi+12 to ecx
# var max/edx : (address byte) = &table->data[table->write]
# var max/edx : (addr byte) = &table->data[table->write]
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx . . # copy ecx+edx to edx
$get-slice-or-stop:search-loop:
@ -1379,7 +1379,7 @@ $test-get-slice-or-stop:end:
c3/return
# if no row is found, return null (0)
maybe-get: # table : (address stream {string_key, T}), key : string_key, row-size : int -> eax : (address T)
maybe-get: # table : (addr stream {string_key, T}), key : string_key, row-size : int -> eax : (addr T)
# pseudocode:
# curr = table->data
# max = &table->data[table->write]
@ -1398,9 +1398,9 @@ maybe-get: # table : (address stream {string_key, T}), key : string_key, row-si
56/push-esi
# esi = table
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var curr/ecx : (address string_key) = table->data
# var curr/ecx : (addr string_key) = table->data
8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 0xc/disp8 . # copy esi+12 to ecx
# var max/edx : (address byte) = &table->data[table->write]
# var max/edx : (addr byte) = &table->data[table->write]
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx . . # copy ecx+edx to edx
$maybe-get:search-loop:
@ -1526,7 +1526,7 @@ $test-maybe-get:end:
c3/return
# if no row is found, return null (0)
maybe-get-slice: # table : (address stream {string_key, T}), key : (address slice), row-size : int -> eax : (address T)
maybe-get-slice: # table : (addr stream {string_key, T}), key : (addr slice), row-size : int -> eax : (addr T)
# pseudocode:
# curr = table->data
# max = &table->data[table->write]
@ -1545,9 +1545,9 @@ maybe-get-slice: # table : (address stream {string_key, T}), key : (address sli
56/push-esi
# esi = table
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi
# var curr/ecx : (address string_key) = table->data
# var curr/ecx : (addr string_key) = table->data
8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 0xc/disp8 . # copy esi+12 to ecx
# var max/edx : (address byte) = &table->data[table->write]
# var max/edx : (addr byte) = &table->data[table->write]
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx . . # copy ecx+edx to edx
$maybe-get-slice:search-loop:

View File

@ -5,7 +5,7 @@
# read all bytes from 'f' and store them into 's'
# abort if 's' is too small
slurp: # f : (address buffered-file), s : (address stream byte)
slurp: # f : (addr buffered-file), s : (addr stream byte)
# pseudocode:
# while true
# if (s->write >= s->length) abort

View File

@ -8,7 +8,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
compute-width: # word : (address array byte) -> eax : int
compute-width: # word : (addr array byte) -> eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -16,7 +16,7 @@ compute-width: # word : (address array byte) -> eax : int
51/push-ecx
# eax = word
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 . # copy *(ebp+8) to ecx
# var ecx : (address byte) = &word[word->length]
# var ecx : (addr byte) = &word[word->length]
8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx
# eax = word->data
@ -42,7 +42,7 @@ $compute-width:end:
5d/pop-to-ebp
c3/return
compute-width-of-slice: # s : (address slice) -> eax : int
compute-width-of-slice: # s : (addr slice) -> eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -4,7 +4,7 @@
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
# print 'arr' in hex with a space after every byte
emit-hex-array: # out : (address buffered-file), arr : (address array byte)
emit-hex-array: # out : (addr buffered-file), arr : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -17,9 +17,9 @@ emit-hex-array: # out : (address buffered-file), arr : (address array byte)
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi
# edx = arr
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx
# var curr/ecx : (address byte) = arr->data
# var curr/ecx : (addr byte) = arr->data
8d/copy-address 1/mod/*+disp8 2/rm32/edx . . . 1/r32/ecx 4/disp8 . # copy edx+4 to ecx
# var max/edx : (address byte) = &arr->data[arr->length]
# var max/edx : (addr byte) = &arr->data[arr->length]
8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . . # copy *edx to edx
01/add 3/mod/direct 2/rm32/edx . . . 1/r32/ecx . . # add ecx to edx
# var c/eax : byte = 0

View File

@ -5,7 +5,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
write-int: # out : (address stream byte), n : int
write-int: # out : (addr stream byte), n : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -5,7 +5,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
array-equal?: # a : (address array int), b : (address array int) -> eax : boolean
array-equal?: # a : (addr array int), b : (addr array int) -> eax : boolean
# pseudocode:
# lena = a->length
# if (lena != b->length) return false
@ -46,9 +46,9 @@ $array-equal?:lengths:
# if (lena != b->length) return false
39/compare 0/mod/indirect 7/rm32/edi . . . 2/r32/edx . . # compare *edi and edx
75/jump-if-not-equal $array-equal?:false/disp8
# var curra/esi : (address byte) = a->data
# var curra/esi : (addr byte) = a->data
81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 4/imm32 # add to esi
# var currb/edi : (address byte) = b->data
# var currb/edi : (addr byte) = b->data
81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 4/imm32 # add to edi
# var i/ecx : int = 0
31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . . # clear ecx
@ -230,7 +230,7 @@ test-compare-inequal-arrays-equal-lengths:
5d/pop-to-ebp
c3/return
parse-array-of-ints: # ad : (address allocation-descriptor), s : (address string) -> result/eax : (handle array int)
parse-array-of-ints: # ad : (addr allocation-descriptor), s : (addr string) -> result/eax : (handle array int)
# pseudocode
# end = &s->data[s->length]
# curr = s->data
@ -266,9 +266,9 @@ parse-array-of-ints: # ad : (address allocation-descriptor), s : (address strin
57/push-edi
# esi = s
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
# var curr/ecx : (address byte) = s->data
# var curr/ecx : (addr byte) = s->data
8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 4/disp8 . # copy esi+4 to ecx
# var end/edx : (address byte) = &s->data[s->length]
# var end/edx : (addr byte) = &s->data[s->length]
# . edx = s->length
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
# . edx += curr
@ -334,7 +334,7 @@ $parse-array-of-ints:pass2:
51/push-ecx
# . bookmark
89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx
# var out/ebx : (address byte) = result->data
# var out/ebx : (addr byte) = result->data
8d/copy-address 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 4/disp8 . # copy eax+4 to ebx
$parse-array-of-ints:loop2:
# if (slice->start >= end) break
@ -536,7 +536,7 @@ test-parse-array-of-ints-extra-whitespace:
# helper for later tests
# compare an array with a string representation of an array literal
check-array-equal: # a : (address array int), expected : (address string), msg : (address string)
check-array-equal: # a : (addr array int), expected : (addr string), msg : (addr string)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -5,7 +5,7 @@
# (re)compute the bounds of the next word or string literal in the line
# return empty string on reaching end of file
next-word-or-string: # line : (address stream byte), out : (address slice)
next-word-or-string: # line : (addr stream byte), out : (addr slice)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -7,7 +7,7 @@
# . op subop mod rm32 base index scale r32
# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes
clear-stack: # s : (address stack)
clear-stack: # s : (addr stack)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -16,12 +16,12 @@ clear-stack: # s : (address stack)
51/push-ecx
# eax = s
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 . # copy *(ebp+8) to eax
# var max/ecx : (address byte) = &s->data[s->length]
# var max/ecx : (addr byte) = &s->data[s->length]
8b/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 4/disp8 . # copy *(eax+4) to eax
8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 8/disp8 . # copy eax+ecx+8 to ecx
# s->top = 0
c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32 # copy to *eax
# var curr/eax : (address byte) = s->data
# var curr/eax : (addr byte) = s->data
81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 8/imm32 # add to eax
$clear-stack:loop:
# if (curr >= max) break
@ -107,7 +107,7 @@ test-clear-stack:
5d/pop-to-ebp
c3/return
push: # s : (address stack), n : int
push: # s : (addr stack), n : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -227,7 +227,7 @@ test-push:
5d/pop-to-ebp
c3/return
pop: # s : (address stack) -> n/eax : int
pop: # s : (addr stack) -> n/eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -331,7 +331,7 @@ test-pop:
5d/pop-to-ebp
c3/return
top: # s : (address stack) -> n/eax : int
top: # s : (addr stack) -> n/eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -83,12 +83,12 @@ $subx-assort-main:end:
cd/syscall 0x80/imm8
# data structure:
# table: (address stream {string, (address stream byte)}) (8 bytes per row)
# table: (addr stream {string, (addr stream byte)}) (8 bytes per row)
# inefficient; uses sequential search for looking up segments by name
subx-assort: # in : (address buffered-file), out : (address buffered-file)
subx-assort: # in : (addr buffered-file), out : (addr buffered-file)
# pseudocode:
# var table : (address stream {string, (address stream byte)} 10/rows)
# var table : (addr stream {string, (addr stream byte)} 10/rows)
# read-segments(in, table)
# write-segments(out, table)
#
@ -97,7 +97,7 @@ subx-assort: # in : (address buffered-file), out : (address buffered-file)
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
# . save registers
51/push-ecx
# var table/ecx : (ref stream {string, (address stream byte)} 80) # 10 rows * 8 bytes/row
# var table/ecx : (ref stream {string, (addr stream byte)} 80) # 10 rows * 8 bytes/row
81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x50/imm32 # subtract from esp
68/push 0x50/imm32/length
68/push 0/imm32/read
@ -450,10 +450,10 @@ test-subx-assort:
5d/pop-to-ebp
c3/return
# type string_key = (address array byte)
# type string_key = (addr array byte)
# beware: leaks memory (one name per segment read)
read-segments: # in : (address buffered-file), table : (address stream {string_key, (handle stream byte)})
read-segments: # in : (addr buffered-file), table : (addr stream {string_key, (handle stream byte)})
# pseudocode:
# var curr-segment : (handle stream byte) = 0
# var line : (stream byte 512)
@ -599,7 +599,7 @@ $read-segments:check-for-comment:
#? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
#? # }}}
# if (slice-starts-with?(word-slice, "#")) continue
# . var start/esi : (address byte) = word-slice->start
# . var start/esi : (addr byte) = word-slice->start
8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . . # copy *ecx to esi
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -717,7 +717,7 @@ $read-segments:check-for-segment-header:
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
#? # }}}
# var segment-slot/eax : (address handle stream byte) = leaky-get-or-insert-slice(table, segment-name, row-size=8)
# var segment-slot/eax : (addr handle stream byte) = leaky-get-or-insert-slice(table, segment-name, row-size=8)
# . . push args
68/push 8/imm32/row-size
52/push-edx
@ -843,7 +843,7 @@ $read-segments:end:
5d/pop-to-ebp
c3/return
write-segments: # out : (address buffered-file), table : (address stream {string_key, (handle stream byte)})
write-segments: # out : (addr buffered-file), table : (addr stream {string_key, (handle stream byte)})
# pseudocode:
# var curr = table->data
# var max = &table->data[table->write]
@ -864,15 +864,15 @@ write-segments: # out : (address buffered-file), table : (address stream {strin
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
# var write/edx : int = table->write
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
# var curr/esi : (address byte) = table->data
# var curr/esi : (addr byte) = table->data
81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 0xc/imm32 # add to eax
# var max/edx : (address byte) = curr + write
# var max/edx : (addr byte) = curr + write
01/add 3/mod/direct 2/rm32/edx . . . 6/r32/esi . . # add esi to edx
$write-segments:loop:
# if (curr >= max) break
39/compare 3/mod/direct 6/rm32/esi . . . 2/r32/edx . . # compare esi with edx
73/jump-if-greater-or-equal-unsigned $write-segments:break/disp8
# var stream/eax : (address stream byte) = table[i].stream
# var stream/eax : (addr stream byte) = table[i].stream
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 . # copy *(esi+4) to eax
# write-stream-data(out, stream)
# . . push args

View File

@ -75,7 +75,7 @@ $subx-braces-main:end:
b8/copy-to-eax 1/imm32/exit
cd/syscall 0x80/imm8
subx-braces: # in : (address buffered-file), out : (address buffered-file)
subx-braces: # in : (addr buffered-file), out : (addr buffered-file)
# pseudocode:
# var line : (ref stream byte 512)
# var label-stack : (stack int 32) # at most 32 levels of nesting
@ -95,7 +95,7 @@ subx-braces: # in : (address buffered-file), out : (address buffered-file)
# print(out, "_break" top ":\n")
# continue
# while true
# var word-slice : (address slice) = next-word-or-string(line)
# var word-slice : (addr slice) = next-word-or-string(line)
# if slice-empty?(word-slice) # end of line
# break
# if slice-starts-with?(word-slice, "#") # comment

View File

@ -75,7 +75,7 @@ $subx-calls-main:end:
b8/copy-to-eax 1/imm32/exit
cd/syscall 0x80/imm8
subx-calls: # in : (address buffered-file), out : (address buffered-file)
subx-calls: # in : (addr buffered-file), out : (addr buffered-file)
# pseudocode:
# var line : (ref stream byte 512)
# var words : (ref stream slice 16) # at most function name and 15 args
@ -231,7 +231,7 @@ $subx-calls:end:
5d/pop-to-ebp
c3/return
parse-line: # line : (address stream byte), words : (address stream slice)
parse-line: # line : (addr stream byte), words : (addr stream slice)
# pseudocode:
# var word-slice : (ref slice)
# while true
@ -340,7 +340,7 @@ $parse-line:end:
5d/pop-to-ebp
c3/return
emit-call: # out : (address buffered-file), words : (address stream slice)
emit-call: # out : (addr buffered-file), words : (addr stream slice)
# pseudocode:
# if (words->write < 8) abort
# curr = &words->data[words->write-8]
@ -381,9 +381,9 @@ emit-call: # out : (address buffered-file), words : (address stream slice)
8b/-> *esi 1/r32/ecx
81 5/subop/subtract %ecx 8/imm32
0f 8c/jump-if-lesser $emit-call:error1/disp32
# var curr/ecx : (address slice) = &words->data[words->write-8]
# var curr/ecx : (addr slice) = &words->data[words->write-8]
8d/copy-address *(esi+ecx+0xc) 1/r32/ecx
# var min/edx : (address byte) = words->data
# var min/edx : (addr byte) = words->data
8d/copy-address *(esi+0xc) 2/r32/edx
# - emit pushes
$emit-call:push-loop:
@ -391,7 +391,7 @@ $emit-call:push-loop:
39/compare %ecx 2/r32/edx
0f 8e/jump-if-lesser-or-equal $emit-call:call-instruction/disp32
# if (*curr->start in '%' '*') goto push-rm32
# . var start/eax : (address byte) = curr->start
# . var start/eax : (addr byte) = curr->start
8b/-> *ecx 0/r32/eax
# . var c/eax : byte = *eax
8b/-> *eax 0/r32/eax
@ -741,7 +741,7 @@ test-subx-calls-processes-calls:
5d/pop-to-ebp
c3/return
next-word-string-or-expression-without-metadata: # line : (address stream byte), out : (address slice)
next-word-string-or-expression-without-metadata: # line : (addr stream byte), out : (addr slice)
# pseudocode:
# skip-chars-matching(line, ' ')
# if line->read >= line->write # end of line

View File

@ -90,7 +90,7 @@ $main:end:
cd/syscall 0x80/imm8
# the main entry point
compile: # in : (address buffered-file), out : fd or (address stream byte), err : fd or (address stream byte), ed : (address exit-descriptor)
compile: # in : (addr buffered-file), out : fd or (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -191,7 +191,7 @@ $compile:end:
# space in 'out'.
# Input comes from the global variable 'Look' (first byte) and the argument
# 'in' (rest). We leave the next byte from 'in' into 'Look' on exit.
get-num: # in : (address buffered-file), out : (address stream byte), err : fd or (address stream byte), ed : (address exit-descriptor)
get-num: # in : (addr buffered-file), out : (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor)
# pseudocode:
# if (!is-digit?(Look)) expected(ed, err, "integer")
# if out->write >= out->length
@ -470,7 +470,7 @@ test-get-num-aborts-on-non-digit-in-Look:
## helpers
# write(f, "Error: "+s+" expected\n") then stop(ed, 1)
expected: # ed : (address exit-descriptor), f : fd or (address stream byte), s : (address array byte)
expected: # ed : (addr exit-descriptor), f : fd or (addr stream byte), s : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -512,7 +512,7 @@ $expected:dead-end:
c3/return
# read a byte from 'f', and save it in 'Look'
get-char: # f : (address buffered-file)
get-char: # f : (addr buffered-file)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -90,7 +90,7 @@ $main:end:
cd/syscall 0x80/imm8
# the main entry point
compile: # in : (address buffered-file), out : fd or (address stream byte), err : fd or (address stream byte), ed : (address exit-descriptor)
compile: # in : (addr buffered-file), out : fd or (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -191,7 +191,7 @@ $compile:end:
# no space in 'out'.
# Input comes from the global variable 'Look' (first byte) and the argument
# 'in' (rest). We leave the next byte from 'in' into 'Look' on exit.
get-num: # in : (address buffered-file), out : (address stream byte), err : fd or (address stream byte), ed : (address exit-descriptor)
get-num: # in : (addr buffered-file), out : (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor)
# pseudocode:
# if (!is-digit?(Look)) expected(ed, err, "integer")
# do
@ -664,7 +664,7 @@ test-get-num-reads-multiple-digits-followed-by-nondigit:
## helpers
# write(f, "Error: "+s+" expected\n") then stop(ed, 1)
expected: # ed : (address exit-descriptor), f : fd or (address stream byte), s : (address array byte)
expected: # ed : (addr exit-descriptor), f : fd or (addr stream byte), s : (addr array byte)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -706,7 +706,7 @@ $expected:dead-end:
c3/return
# read a byte from 'f', and save it in 'Look'
get-char: # f : (address buffered-file)
get-char: # f : (addr buffered-file)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -82,7 +82,7 @@ $subx-dquotes-main:end:
# line = words separated by ' ', maybe followed by comment starting with '#'
# word = datum until '/', then 0 or more metadata separated by '/'
subx-dquotes: # in : (address buffered-file), out : (address buffered-file)
subx-dquotes: # in : (addr buffered-file), out : (addr buffered-file)
# pseudocode:
# var line : (ref stream byte 512)
# var new-data-segment : (handle stream byte) = new-stream(Heap, Segment-size, 1)
@ -198,7 +198,7 @@ $subx-dquotes:check1:
0f 85/jump-if-not-equal $subx-dquotes:next-line/disp32
$subx-dquotes:check-for-comment:
# if (slice-starts-with?(word-slice, "#")) continue
# . var start/esi : (address byte) = word-slice->start
# . var start/esi : (addr byte) = word-slice->start
8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . . # copy *edx to esi
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -287,7 +287,7 @@ $subx-dquotes:end:
# Write out 'string-literal' in a new format to 'out-segment', assign it a new
# label, and write the new label out to 'out'.
process-string-literal: # string-literal : (address slice), out : (address buffered-file), out-segment : (address stream byte)
process-string-literal: # string-literal : (addr slice), out : (addr buffered-file), out-segment : (addr stream byte)
# pseudocode:
# print(out-segment, "_string#{Next-string-literal}:\n")
# emit-string-literal-data(out-segment, string-literal)
@ -846,7 +846,7 @@ test-subx-dquotes-processes-string-literals:
c3/return
# generate the data segment contents byte by byte for a given slice
emit-string-literal-data: # out : (address stream byte), word : (address slice)
emit-string-literal-data: # out : (addr stream byte), word : (addr slice)
# pseudocode
# len = string-length-at-start-of-slice(word->start, word->end)
# print(out, "#{len}/imm32 ")
@ -887,9 +887,9 @@ emit-string-literal-data: # out : (address stream byte), word : (address slice)
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
# var idx/ebx : int = 0
31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . . # clear ebx
# var curr/edx : (address byte) = word->start
# var curr/edx : (addr byte) = word->start
8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx
# var max/esi : (address byte) = word->end
# var max/esi : (addr byte) = word->end
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 . # copy *(esi+4) to esi
$emit-string-literal-data:emit-length:
# var len/eax : int = string-length-at-start-of-slice(word->start, word->end)
@ -1379,7 +1379,7 @@ test-emit-string-literal-data-handles-newline-escape:
c3/return
# emit everything from a word except the initial datum
emit-metadata: # out : (address buffered-file), word : (address slice)
emit-metadata: # out : (addr buffered-file), word : (addr slice)
# pseudocode
# var slice : (ref slice) = {0, word->end}
# curr = word->start
@ -1406,9 +1406,9 @@ emit-metadata: # out : (address buffered-file), word : (address slice)
56/push-esi
# esi = word
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi
# var curr/ecx : (address byte) = word->start
# var curr/ecx : (addr byte) = word->start
8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # copy *esi to ecx
# var end/edx : (address byte) = word->end
# var end/edx : (addr byte) = word->end
8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 4/disp8 . # copy *(esi+4) to edx
# var slice/ebx : (ref slice) = {0, end}
52/push-edx
@ -1778,7 +1778,7 @@ test-emit-metadata-in-string-literal:
5d/pop-to-ebp
c3/return
string-length-at-start-of-slice: # curr : (address byte), end : (address byte) -> length/eax
string-length-at-start-of-slice: # curr : (addr byte), end : (addr byte) -> length/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -258,7 +258,7 @@ test-compare-kernel-string-with-longer-array:
# - helpers
# print msg to stderr if a != b, otherwise print "."
check-ints-equal: # (a : int, b : int, msg : (address array byte)) -> boolean
check-ints-equal: # (a : int, b : int, msg : (addr array byte)) -> boolean
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -307,7 +307,7 @@ $check-ints-equal:end:
5d/pop-to-ebp
c3/return
write-stderr: # s : (address array byte) -> <void>
write-stderr: # s : (addr array byte) -> <void>
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -34,7 +34,7 @@ Entry:
89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . . # copy eax to ebx
e8/call syscall_exit/disp32
ascii-length: # s : (address array byte) -> n/eax
ascii-length: # s : (addr array byte) -> n/eax
# edx = s
8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none . 2/r32/edx 4/disp8 . # copy *(esp+4) to edx
# var result/eax = 0

View File

@ -44,7 +44,7 @@ $handle-main:end:
b8/copy-to-eax 1/imm32/exit
cd/syscall 0x80/imm8
new: # ad : (address allocation-descriptor), n : int, out : (handle _)
new: # ad : (addr allocation-descriptor), n : int, out : (handle _)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -221,7 +221,7 @@ _pending-test-new-failure:
5d/pop-to-ebp
c3/return
lookup: # h : (handle T) -> eax : (address T)
lookup: # h : (handle T) -> eax : (addr T)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -77,7 +77,7 @@ $subx-hex-main:end:
cd/syscall 0x80/imm8
# the main entry point
subx-hex: # in : (address buffered-file), out : (address buffered-file), err : (address buffered-file), ed : (address exit-descriptor)
subx-hex: # in : (addr buffered-file), out : (addr buffered-file), err : (addr buffered-file), ed : (addr exit-descriptor)
# pseudocode:
# while true
# eax = convert-next-octet(in, err, ed)
@ -135,7 +135,7 @@ $subx-hex:end:
# raise an error and abort on all other unexpected bytes
# return in eax an _octet_ containing the binary value of the two hex characters
# return Eof on reaching end of file
convert-next-octet: # in : (address buffered-file), err : (address buffered-file), ed : (address exit-descriptor) -> byte-or-Eof/eax
convert-next-octet: # in : (addr buffered-file), err : (addr buffered-file), ed : (addr exit-descriptor) -> byte-or-Eof/eax
# pseudocode:
# eax = scan-next-byte(in, err, ed)
# if (eax == Eof) return
@ -481,7 +481,7 @@ $test-convert-next-octet-aborts-on-single-hex-byte:end:
# return Eof if file ends without finding a hex byte
# on '#' skip all bytes until newline
# abort on any other byte
scan-next-byte: # in : (address buffered-file), err : (address buffered-file), ed : (address exit-descriptor) -> byte-or-Eof/eax
scan-next-byte: # in : (addr buffered-file), err : (addr buffered-file), ed : (addr exit-descriptor) -> byte-or-Eof/eax
# pseudocode:
# while true
# eax = read-byte-buffered(in)
@ -1350,7 +1350,7 @@ $test-scan-next-byte-aborts-on-invalid-byte:end:
5d/pop-to-ebp
c3/return
skip-until-newline: # in : (address buffered-file)
skip-until-newline: # in : (addr buffered-file)
# pseudocode:
# push eax
# while true

View File

@ -246,7 +246,7 @@
== data
Program: # (address (handle function))
Program: # (addr (handle function))
0/imm32
Function-name:
@ -378,7 +378,7 @@ $mu-main:end:
b8/copy-to-eax 1/imm32/exit
cd/syscall 0x80/imm8
convert-mu: # in : (address buffered-file), out : (address buffered-file)
convert-mu: # in : (addr buffered-file), out : (addr buffered-file)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -952,9 +952,9 @@ test-convert-function-call-with-literal-arg:
# Parsing
#######################################################
parse-mu: # in : (address buffered-file)
parse-mu: # in : (addr buffered-file)
# pseudocode
# var curr-function : (address (handle function)) = Program
# var curr-function : (addr (handle function)) = Program
# var line : (ref stream byte 512)
# var word-slice : (ref slice)
# while true # line loop
@ -968,7 +968,7 @@ parse-mu: # in : (address buffered-file)
# continue # end of line
# else if slice-equal(word-slice, "fn")
# var new-function : (handle function) = allocate(function)
# var vars : (ref stack (address var) 256)
# var vars : (ref stack (addr var) 256)
# populate-mu-function-header(in, new-function, vars)
# populate-mu-function-body(in, new-function, vars)
# assert(vars->top == 0)
@ -996,9 +996,9 @@ parse-mu: # in : (address buffered-file)
68/push 0/imm32/end
68/push 0/imm32/start
89/<- %edx 4/r32/esp
# var curr-function/edi : (address (handle function)) = Program
# var curr-function/edi : (addr (handle function)) = Program
bf/copy-to-edi Program/imm32
# var vars/ebx : (ref stack (address var) 256)
# var vars/ebx : (ref stack (addr var) 256)
81 5/subop/subtract %esp 0x400/imm32
68/push 0x400/imm32/length
68/push 0/imm32/top
@ -1100,7 +1100,7 @@ $parse-mu:error2:
# ✓ fn foo x : int {
# ✓ fn foo x: int {
# ✓ fn foo x: int -> y/eax: int {
populate-mu-function-header: # first-line : (address stream byte), out : (handle function), vars : (address stack (handle var))
populate-mu-function-header: # first-line : (addr stream byte), out : (handle function), vars : (addr stack (handle var))
# pseudocode:
# var name : (ref slice)
# next-word(first-line, name)
@ -1297,7 +1297,7 @@ test-function-header-with-arg:
2b/subtract-> *Function-size 4/r32/esp
89/<- %ecx 4/r32/esp
(zero-out %ecx *Function-size)
# var vars/ebx : (ref stack (address var) 16)
# var vars/ebx : (ref stack (addr var) 16)
81 5/subop/subtract %esp 0x10/imm32
68/push 0x10/imm32/length
68/push 0/imm32/top
@ -1329,7 +1329,7 @@ test-function-header-with-multiple-args:
2b/subtract-> *Function-size 4/r32/esp
89/<- %ecx 4/r32/esp
(zero-out %ecx *Function-size)
# var vars/ebx : (ref stack (address var) 16)
# var vars/ebx : (ref stack (addr var) 16)
81 5/subop/subtract %esp 0x10/imm32
68/push 0x10/imm32/length
68/push 0/imm32/top
@ -1376,7 +1376,7 @@ test-function-with-multiple-args-and-outputs:
2b/subtract-> *Function-size 4/r32/esp
89/<- %ecx 4/r32/esp
(zero-out %ecx *Function-size)
# var vars/ebx : (ref stack (address var) 16)
# var vars/ebx : (ref stack (addr var) 16)
81 5/subop/subtract %esp 0x10/imm32
68/push 0x10/imm32/length
68/push 0/imm32/top
@ -1427,12 +1427,12 @@ test-function-with-multiple-args-and-outputs:
# x: int
# x: int,
# ignores at most one trailing colon or comma
parse-var-with-type: # name: (address slice), first-line: (address stream byte) -> result/eax: (handle var)
parse-var-with-type: # name: (addr slice), first-line: (addr stream byte) -> result/eax: (handle var)
# pseudocode:
# var v : (handle var) = allocate(Heap, Var-size)
# var s : (ref slice)
# next-token-from-slice(name->start, name->end, '/', s)
# var end : (address byte) = s->end
# var end : (addr byte) = s->end
# if (slice-ends-with(s, ":"))
# decrement s->end
# if (slice-ends-with(s, ","))
@ -1603,7 +1603,7 @@ $parse-var-with-type:abort:
cd/syscall 0x80/imm8
# never gets here
next-mu-token: # in: (address stream byte), out: (address slice)
next-mu-token: # in: (addr stream byte), out: (addr slice)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -1644,7 +1644,7 @@ $next-mu-token:end:
5d/pop-to-ebp
c3/return
type-for: # name: (address slice) -> result/eax: (handle s-expression type-id)
type-for: # name: (addr slice) -> result/eax: (handle s-expression type-id)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -1778,7 +1778,7 @@ test-parse-var-with-register-and-trailing-characters:
# identifier starts with a letter or '$' or '_'
# no constraints at the moment on later letters
# all we really want to do so far is exclude '{', '}' and '->'
is-identifier?: # in : (address slice) -> result/eax : boolean
is-identifier?: # in : (addr slice) -> result/eax : boolean
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2074,7 +2074,7 @@ test-is-identifier-hyphen:
5d/pop-to-ebp
c3/return
populate-mu-function-body: # in : (address buffered-file), out : (handle function), vars : (address stack (handle var))
populate-mu-function-body: # in : (addr buffered-file), out : (handle function), vars : (addr stack (handle var))
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2101,7 +2101,7 @@ $populate-mu-function-body:end:
c3/return
# parses a block, assuming that the leading '{' has already been read by the caller
parse-mu-block: # in : (address buffered-file), vars : (address stack (handle var)), fn : (handle function) -> result/eax : (handle block)
parse-mu-block: # in : (addr buffered-file), vars : (addr stack (handle var)), fn : (handle function) -> result/eax : (handle block)
# pseudocode:
# var line : (ref stream byte 512)
# var word-slice : (ref slice)
@ -2262,7 +2262,7 @@ $parse-mu-block:abort:
cd/syscall 0x80/imm8
# never gets here
check-no-tokens-left: # line : (address stream byte)
check-no-tokens-left: # line : (addr stream byte)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2309,7 +2309,7 @@ $check-no-tokens-left:end:
5d/pop-to-ebp
c3/return
parse-mu-named-block: # name : (address slice), first-line : (address stream byte), in : (address buffered-file), vars : (address stack (handle var)) -> result/eax : (handle stmt)
parse-mu-named-block: # name : (addr slice), first-line : (addr stream byte), in : (addr buffered-file), vars : (addr stack (handle var)) -> result/eax : (handle stmt)
# pseudocode:
# var line : (ref stream byte 512)
# var word-slice : (ref slice)
@ -2353,7 +2353,7 @@ $parse-mu-named-block:end:
5d/pop-to-ebp
c3/return
parse-mu-var-def: # line : (address stream byte), vars : (address stack (handle var)) -> result/eax : (handle stmt)
parse-mu-var-def: # line : (addr stream byte), vars : (addr stack (handle var)) -> result/eax : (handle stmt)
# pseudocode:
#
# . prologue
@ -2368,7 +2368,7 @@ $parse-mu-var-def:end:
5d/pop-to-ebp
c3/return
parse-mu-stmt: # line : (address stream byte), vars : (address stack (handle var)), fn : (handle function) -> result/eax : (handle stmt)
parse-mu-stmt: # line : (addr stream byte), vars : (addr stack (handle var)), fn : (handle function) -> result/eax : (handle stmt)
# pseudocode:
# var name : (ref slice)
# result = allocate(Heap, Stmt-size)
@ -2488,7 +2488,7 @@ $parse-mu-stmt:abort2:
cd/syscall 0x80/imm8
# never gets here
stmt-has-outputs?: # line : (address stream byte) -> result/eax : boolean
stmt-has-outputs?: # line : (addr stream byte) -> result/eax : boolean
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2536,7 +2536,7 @@ $stmt-has-outputs:end:
# if 'name' starts with a digit, create a new literal var for it
# otherwise return first 'name' from the top (back) of 'vars' and abort if not found
lookup-var-or-literal: # name: (address slice), vars : (address stack (handle var)) -> result/eax: (handle var)
lookup-var-or-literal: # name: (addr slice), vars : (addr stack (handle var)) -> result/eax: (handle var)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2584,7 +2584,7 @@ $lookup-var-or-literal:abort:
# never gets here
# return first 'name' from the top (back) of 'vars' and abort if not found
lookup-var: # name: (address slice), vars : (address stack (handle var)) -> result/eax: (handle var)
lookup-var: # name: (addr slice), vars : (addr stack (handle var)) -> result/eax: (handle var)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2613,9 +2613,9 @@ $lookup-var:abort:
# never gets here
# return first 'name' from the top (back) of 'vars', and 0/null if not found
lookup-var-helper: # name: (address array byte), vars : (address stack (handle var)) -> result/eax: (handle var)
lookup-var-helper: # name: (addr array byte), vars : (addr stack (handle var)) -> result/eax: (handle var)
# pseudocode:
# var curr : (address handle var) = &vars->data[vars->top - 4]
# var curr : (addr handle var) = &vars->data[vars->top - 4]
# var min = vars->data
# while curr >= min
# var v : (handle var) = *curr
@ -2637,9 +2637,9 @@ lookup-var-helper: # name: (address array byte), vars : (address stack (handle
# if (vars->top > vars->length) abort
3b/compare 0/r32/eax *(esi+4)
0f 8f/jump-if-greater $lookup-var-helper:error1/disp32
# var min/edx : (address handle var) = vars->data
# var min/edx : (addr handle var) = vars->data
8d/copy-address *(esi+8) 2/r32/edx
# var curr/ebx : (address handle var) = &vars->data[vars->top - 4]
# var curr/ebx : (addr handle var) = &vars->data[vars->top - 4]
81 5/subop/subtract %ebx 4/imm32
8d/copy-address *(esi+ebx+8) 3/r32/ebx
{
@ -2680,7 +2680,7 @@ $lookup-var-helper:error1:
# never gets here
# return first 'name' from the top (back) of 'vars' and create a new var for a fn output if not found
lookup-or-define-var: # name: (address slice), vars : (address stack (handle var)), fn : (handle function) -> result/eax: (handle var)
lookup-or-define-var: # name: (addr slice), vars : (addr stack (handle var)), fn : (handle function) -> result/eax: (handle var)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2753,7 +2753,7 @@ test-parse-mu-stmt:
# setup
(clear-stream _test-input-stream)
(write _test-input-stream "increment n\n")
# var vars/ecx : (ref stack (address var) 4)
# var vars/ecx : (ref stack (addr var) 4)
81 5/subop/subtract %esp 0x10/imm32
68/push 0x10/imm32/length
68/push 0/imm32/top
@ -2781,7 +2781,7 @@ test-parse-mu-stmt:
5d/pop-to-ebp
c3/return
new-function: # ad: (address allocation-descriptor), name: (address array byte), subx-name: (address array byte), inouts: (handle list var), outputs: (handle list var), body: (handle block), next: (handle function) -> result/eax: (handle function)
new-function: # ad: (addr allocation-descriptor), name: (addr array byte), subx-name: (addr array byte), inouts: (handle list var), outputs: (handle list var), body: (handle block), next: (handle function) -> result/eax: (handle function)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2809,7 +2809,7 @@ $new-function:end:
5d/pop-to-ebp
c3/return
new-var: # ad: (address allocation-descriptor), name: (address array byte), type: int, block: int, stack-offset: int, register: (address array byte) -> result/eax: (handle var)
new-var: # ad: (addr allocation-descriptor), name: (addr array byte), type: int, block: int, stack-offset: int, register: (addr array byte) -> result/eax: (handle var)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2835,7 +2835,7 @@ $new-var:end:
5d/pop-to-ebp
c3/return
new-literal-integer: # ad: (address allocation-descriptor), name: (address slice) -> result/eax: (handle var)
new-literal-integer: # ad: (addr allocation-descriptor), name: (addr slice) -> result/eax: (handle var)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2845,7 +2845,7 @@ new-literal-integer: # ad: (address allocation-descriptor), name: (address slic
(is-hex-int? *(ebp+0xc)) # => eax
3d/compare-eax-and 0/imm32
0f 84/jump-if-equal $new-literal-integer:abort/disp32
# var s/ecx : (address array byte)
# var s/ecx : (addr array byte)
(slice-to-string Heap *(ebp+0xc)) # => eax
89/<- %ecx 0/r32/eax
#
@ -2874,7 +2874,7 @@ $new-literal-integer:abort:
cd/syscall 0x80/imm8
# never gets here
new-block: # ad: (address allocation-descriptor), data: (handle list statement) -> result/eax: (handle statement)
new-block: # ad: (addr allocation-descriptor), data: (handle list statement) -> result/eax: (handle statement)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2894,7 +2894,7 @@ $new-block:end:
5d/pop-to-ebp
c3/return
new-stmt: # ad: (address allocation-descriptor), operation: (address array byte), inouts: (handle list var), outputs: (handle list var) -> result/eax: (handle statement)
new-stmt: # ad: (addr allocation-descriptor), operation: (addr array byte), inouts: (handle list var), outputs: (handle list var) -> result/eax: (handle statement)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2918,7 +2918,7 @@ $new-stmt:end:
5d/pop-to-ebp
c3/return
new-vardef: # ad: (address allocation-descriptor), name: (address array byte), type: int -> result/eax: (handle statement)
new-vardef: # ad: (addr allocation-descriptor), name: (addr array byte), type: int -> result/eax: (handle statement)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2940,7 +2940,7 @@ $new-vardef:end:
5d/pop-to-ebp
c3/return
new-regvardef: # ad: (address allocation-descriptor), name: (address array byte), type: int, register: (address array byte) -> result/eax: (handle statement)
new-regvardef: # ad: (addr allocation-descriptor), name: (addr array byte), type: int, register: (addr array byte) -> result/eax: (handle statement)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2964,7 +2964,7 @@ $new-regvardef:end:
5d/pop-to-ebp
c3/return
new-named-block: # ad: (address allocation-descriptor), name: (address array byte), data: (handle list statement) -> result/eax: (handle statement)
new-named-block: # ad: (addr allocation-descriptor), name: (addr array byte), data: (handle list statement) -> result/eax: (handle statement)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -2986,7 +2986,7 @@ $new-named-block:end:
5d/pop-to-ebp
c3/return
new-list: # ad: (address allocation-descriptor), value: _type, next: (handle list _type) -> result/eax : (handle list _type)
new-list: # ad: (addr allocation-descriptor), value: _type, next: (handle list _type) -> result/eax : (handle list _type)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -3006,7 +3006,7 @@ $new-list:end:
5d/pop-to-ebp
c3/return
append-list: # ad: (address allocation-descriptor), value: _type, list: (handle list _type) -> result/eax : (handle list _type)
append-list: # ad: (addr allocation-descriptor), value: _type, list: (handle list _type) -> result/eax : (handle list _type)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -3042,7 +3042,7 @@ $append-list:end:
5d/pop-to-ebp
c3/return
append-to-block: # ad: (address allocation-descriptor), block: (handle block), x: (handle stmt)
append-to-block: # ad: (addr allocation-descriptor), block: (handle block), x: (handle stmt)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -3075,7 +3075,7 @@ $check-mu-types:end:
5d/pop-to-ebp
c3/return
size-of: # n : (address var)
size-of: # n : (addr var)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -3091,7 +3091,7 @@ $size-of:end:
# Code-generation
#######################################################
emit-subx: # out : (address buffered-file)
emit-subx: # out : (addr buffered-file)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -3122,7 +3122,7 @@ $emit-subx:end:
5d/pop-to-ebp
c3/return
emit-subx-function: # out : (address buffered-file), f : (handle function)
emit-subx-function: # out : (addr buffered-file), f : (handle function)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -3150,7 +3150,7 @@ $emit-subx-function:end:
5d/pop-to-ebp
c3/return
emit-subx-block: # out : (address buffered-file), block : (handle block)
emit-subx-block: # out : (addr buffered-file), block : (handle block)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -3180,7 +3180,7 @@ $emit-subx-block:end:
5d/pop-to-ebp
c3/return
emit-subx-statement: # out : (address buffered-file), stmt : (handle statement), primitives : (handle primitive), functions : (handle function)
emit-subx-statement: # out : (addr buffered-file), stmt : (handle statement), primitives : (handle primitive), functions : (handle function)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -3975,7 +3975,7 @@ Lit-var:
0/imm32/no-register
== code
emit-subx-primitive: # out : (address buffered-file), stmt : (handle statement), primitive : (handle function)
emit-subx-primitive: # out : (addr buffered-file), stmt : (handle statement), primitive : (handle function)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -4001,7 +4001,7 @@ $emit-subx-primitive:end:
5d/pop-to-ebp
c3/return
emit-subx-rm32: # out : (address buffered-file), l : arg-location, stmt : (handle statement)
emit-subx-rm32: # out : (addr buffered-file), l : arg-location, stmt : (handle statement)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -4081,7 +4081,7 @@ $get-stmt-operand-from-arg-location:abort:
cd/syscall 0x80/imm8
# never gets here
emit-subx-r32: # out : (address buffered-file), l : arg-location, stmt : (handle statement)
emit-subx-r32: # out : (addr buffered-file), l : arg-location, stmt : (handle statement)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -4093,7 +4093,7 @@ emit-subx-r32: # out : (address buffered-file), l : arg-location, stmt : (handl
0f 84/jump-if-equal $emit-subx-r32:end/disp32
#
(get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # stmt, l => var/eax
(maybe-get Registers *(eax+0x10) 8) # Var-register => eax : (address register-index)
(maybe-get Registers *(eax+0x10) 8) # Var-register => eax : (addr register-index)
(write-buffered *(ebp+8) Space)
(print-int32-buffered *(ebp+8) *eax)
(write-buffered *(ebp+8) "/r32")
@ -4106,7 +4106,7 @@ $emit-subx-r32:end:
5d/pop-to-ebp
c3/return
emit-subx-imm32: # out : (address buffered-file), l : arg-location, stmt : (handle statement)
emit-subx-imm32: # out : (addr buffered-file), l : arg-location, stmt : (handle statement)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -4130,7 +4130,7 @@ $emit-subx-imm32:end:
5d/pop-to-ebp
c3/return
emit-subx-call: # out : (address buffered-file), stmt : (handle statement), callee : (handle function)
emit-subx-call: # out : (addr buffered-file), stmt : (handle statement), callee : (handle function)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -4167,7 +4167,7 @@ $emit-subx-call:end:
5d/pop-to-ebp
c3/return
emit-subx-call-operand: # out : (address buffered-file), operand : (handle variable)
emit-subx-call-operand: # out : (addr buffered-file), operand : (handle variable)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -4193,7 +4193,7 @@ $emit-subx-call-operand:end:
5d/pop-to-ebp
c3/return
emit-subx-var-as-rm32: # out : (address buffered-file), operand : (handle variable)
emit-subx-var-as-rm32: # out : (addr buffered-file), operand : (handle variable)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -4228,7 +4228,7 @@ $emit-subx-var-as-rm32:end:
5d/pop-to-ebp
c3/return
find-matching-function: # functions : (address function), stmt : (handle statement) -> result/eax : (handle function)
find-matching-function: # functions : (addr function), stmt : (handle statement) -> result/eax : (handle function)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -5402,7 +5402,7 @@ test-emit-subx-statement-function-call-with-literal-arg:
5d/pop-to-ebp
c3/return
emit-subx-prologue: # out : (address buffered-file)
emit-subx-prologue: # out : (addr buffered-file)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -5416,7 +5416,7 @@ $emit-subx-prologue:end:
5d/pop-to-ebp
c3/return
emit-subx-epilogue: # out : (address buffered-file)
emit-subx-epilogue: # out : (addr buffered-file)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp

View File

@ -49,7 +49,7 @@ $main:end:
# NIL NUM CHAR STRING SYMBOL PAIR ARRAY
# memory type: a type specifying memory layout at the SubX level. Starts
# with a '$'.
# $int $array $(address _)
# $int $array $(addr _)
#
# Lisp values are represented in memory by the _cell_ data structure. A cell
# is 12 bytes long:
@ -63,18 +63,18 @@ $main:end:
# - char: cell{ tag: 2/CHAR, data: $int 0 }
# data contains the utf-8 code of the character (no compound glyphs, no
# modifiers, etc., etc.)
# - string: cell{ tag: 3/STRING, data: $(address stream byte)
# data contains an (address array byte) containing the string in utf-8
# - symbol: cell{ tag: 4/SYMBOL, data: $(address array byte) 0 }
# data contains an (address array byte) containing the name of the symbol in utf-8
# - string: cell{ tag: 3/STRING, data: $(addr stream byte)
# data contains an (addr array byte) containing the string in utf-8
# - symbol: cell{ tag: 4/SYMBOL, data: $(addr array byte) 0 }
# data contains an (addr array byte) containing the name of the symbol in utf-8
# alternatively, data could contain an index into the table of interned symbols
# - pair: cell{ tag: 5/PAIR, data: $(address cell) $(address cell) }
# - pair: cell{ tag: 5/PAIR, data: $(addr cell) $(addr cell) }
# data contains pointers to car and cdr
# - array: cell{ tag: 6/ARRAY, data: $tag $(address stream data)
# - array: cell{ tag: 6/ARRAY, data: $tag $(addr stream data)
# data contains a pointer to an array of 8-byte data fields and the common
# tag for them all
repl: # in : (address buffered-file), out : (address buffered-file)
repl: # in : (addr buffered-file), out : (addr buffered-file)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -104,7 +104,7 @@ $repl:end:
# arrays start with '['
# symbols start with anything else but quote, backquote, unquote or splice
# only one s-expression per line
lisp-read: # in : (address buffered-file) -> eax : (handle cell)
lisp-read: # in : (addr buffered-file) -> eax : (handle cell)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -142,14 +142,14 @@ $lisp-read:end:
5d/pop-to-ebp
c3/return
# lisp-read: in : (address buffered-file) -> (handle cell)
# lisp-read: in : (addr buffered-file) -> (handle cell)
# token tmp = next-mulisp-token(in)
# if is-int(tmp) return cell(tmp)
# if is-string(tmp) return cell(tmp)
# if is-pair(tmp) ...
# if is-array(tmp) ...
next-mulisp-token: # in : (address buffered-file), line : (address stream byte), result : (address slice)
next-mulisp-token: # in : (addr buffered-file), line : (addr stream byte), result : (addr slice)
# pseudocode:
# if (line->read >= line->write)
# read-line-buffered(in, line)
@ -194,11 +194,11 @@ $next-mulisp-token:end:
5d/pop-to-ebp
c3/return
new-int-cell: # in : (address slice) -> eax : (handle cell)
new-int-cell: # in : (addr slice) -> eax : (handle cell)
new-string-cell: # in : (address slice) -> eax : (handle cell)
new-string-cell: # in : (addr slice) -> eax : (handle cell)
lisp-eval: # in : (address cell) -> eax : (handle cell)
lisp-eval: # in : (addr cell) -> eax : (handle cell)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -211,7 +211,7 @@ $lisp-eval:end:
5d/pop-to-ebp
c3/return
lisp-print: # out : (address buffered-file), x : (address cell)
lisp-print: # out : (addr buffered-file), x : (addr cell)
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp

View File

@ -97,7 +97,7 @@ $subx-pack-main:end:
# next-token-from-slice(start, end, delim char) -> slice
# slice-equal?(slice, string)
subx-pack: # in : (address buffered-file), out : (address buffered-file)
subx-pack: # in : (addr buffered-file), out : (addr buffered-file)
# pseudocode:
# var line : (ref stream byte 512)
# var in-code? = false
@ -909,7 +909,7 @@ test-subx-pack-code-and-data-segments:
5d/pop-to-ebp
c3/return
convert-data: # line : (address stream byte), out : (address buffered-file)
convert-data: # line : (addr stream byte), out : (addr buffered-file)
# pseudocode:
# var word-slice : (ref slice)
# while true
@ -1029,7 +1029,7 @@ $convert-data:check0:
0f 85/jump-if-not-equal $convert-data:break/disp32
$convert-data:check-for-comment:
# if (slice-starts-with?(word-slice, "#"))
# . var start/edx : (address byte) = word-slice->start
# . var start/edx : (addr byte) = word-slice->start
8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -1050,7 +1050,7 @@ $convert-data:comment:
0f 85/jump-if-not-equal $convert-data:end/disp32
$convert-data:check-for-label:
# if (slice-ends-with?(word-slice, ":"))
# . var end/edx : (address byte) = word-slice->end
# . var end/edx : (addr byte) = word-slice->end
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 . # copy *(ecx+4) to edx
# . var c/eax : byte = *(end-1)
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -1809,7 +1809,7 @@ test-convert-data-trailing-comment:
# unceremoniously abort on non-numeric operands except disp or imm
# opcodes must be lowercase and zero padded
# opcodes with misleading operand metadata may get duplicated as operands as well. don't rely on this.
convert-instruction: # line : (address stream byte), out : (address buffered-file)
convert-instruction: # line : (addr stream byte), out : (addr buffered-file)
# pseudocode:
# # some early exits
# var word-slice = next-word(line)
@ -1863,7 +1863,7 @@ $convert-instruction:check0:
75/jump-if-not-equal $convert-instruction:pass-through/disp8
$convert-instruction:check1:
# if (slice-starts-with?(word-slice, "#")) write-stream-data(out, line)
# . var start/edx : (address byte) = word-slice->start
# . var start/edx : (addr byte) = word-slice->start
8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -1873,7 +1873,7 @@ $convert-instruction:check1:
74/jump-if-equal $convert-instruction:pass-through/disp8
$convert-instruction:check2:
# if (slice-ends-with?(word-slice, ":")) write-stream-data(out, line)
# . var end/edx : (address byte) = word-slice->end
# . var end/edx : (addr byte) = word-slice->end
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 . # copy *(ecx+4) to edx
# . var c/eax : byte = *(end-1)
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -1953,7 +1953,7 @@ $convert-instruction:end:
5d/pop-to-ebp
c3/return
emit-opcodes: # line : (address stream byte), out : (address buffered-file)
emit-opcodes: # line : (addr stream byte), out : (addr buffered-file)
# opcodes occupy 1-3 bytes:
# xx
# 0f xx
@ -2030,7 +2030,7 @@ $emit-opcodes:op1:
3d/compare-eax-and 0/imm32/false
0f 85/jump-if-not-equal $emit-opcodes:end/disp32
# if (slice-starts-with?(op1, "#")) return
# . var start/ebx : (address byte) = op1->start
# . var start/ebx : (addr byte) = op1->start
8b/copy 0/mod/indirect 1/rm32/ecx . . . 3/r32/ebx . . # copy *ecx to ebx
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -2123,7 +2123,7 @@ $emit-opcodes:op2:
3d/compare-eax-and 0/imm32/false
0f 85/jump-if-not-equal $emit-opcodes:end/disp32
# if (slice-starts-with?(op2, "#")) return
# . var start/ebx : (address byte) = op2->start
# . var start/ebx : (addr byte) = op2->start
8b/copy 0/mod/indirect 2/rm32/edx . . . 3/r32/ebx . . # copy *edx to ebx
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -2202,7 +2202,7 @@ $emit-opcodes:op3:
3d/compare-eax-and 0/imm32/false
0f 85/jump-if-not-equal $emit-opcodes:end/disp32
# if (slice-starts-with?(op3, "#")) return
# . var start/ebx : (address byte) = op2->start
# . var start/ebx : (addr byte) = op2->start
8b/copy 0/mod/indirect 2/rm32/edx . . . 3/r32/ebx . . # copy *edx to ebx
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -2249,7 +2249,7 @@ $emit-opcodes:end:
5d/pop-to-ebp
c3/return
emit-modrm: # line : (address stream byte), out : (address buffered-file)
emit-modrm: # line : (addr stream byte), out : (addr buffered-file)
# pseudocode:
# rewind-stream(line)
# var has-modrm? = false, mod = 0, rm32 = 0, r32 = 0
@ -2402,7 +2402,7 @@ $emit-modrm:check1:
# if (slice-starts-with?(word-slice, "#")) break
# . spill edx
52/push-edx
# . var start/edx : (address byte) = word-slice->start
# . var start/edx : (addr byte) = word-slice->start
8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -2566,7 +2566,7 @@ $emit-modrm:end:
5d/pop-to-ebp
c3/return
emit-sib: # line : (address stream byte), out : (address buffered-file)
emit-sib: # line : (addr stream byte), out : (addr buffered-file)
# pseudocode:
# var has-sib? = false, base = 0, index = 0, scale = 0
# var word-slice : (ref slice)
@ -2711,7 +2711,7 @@ $emit-sib:check1:
# if (slice-starts-with?(word-slice, "#")) break
# . spill edx
52/push-edx
# . var start/edx : (address byte) = word-slice->start
# . var start/edx : (addr byte) = word-slice->start
8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -2847,7 +2847,7 @@ $emit-sib:end:
5d/pop-to-ebp
c3/return
emit-disp: # line : (address stream byte), out : (address buffered-file)
emit-disp: # line : (addr stream byte), out : (addr buffered-file)
# pseudocode:
# rewind-stream(line)
# var word-slice : (ref slice)
@ -2972,7 +2972,7 @@ $emit-disp:check0:
0f 85/jump-if-not-equal $emit-disp:break/disp32
$emit-disp:check1:
# if (slice-starts-with?(word-slice, "#")) break
# . var start/edx : (address byte) = word-slice->start
# . var start/edx : (addr byte) = word-slice->start
8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -3066,7 +3066,7 @@ $emit-disp:break:
5d/pop-to-ebp
c3/return
emit-imm: # line : (address stream byte), out : (address buffered-file)
emit-imm: # line : (addr stream byte), out : (addr buffered-file)
# pseudocode:
# rewind-stream(line)
# var word-slice : (ref slice)
@ -3191,7 +3191,7 @@ $emit-imm:check0:
0f 85/jump-if-not-equal $emit-imm:break/disp32
$emit-imm:check1:
# if (slice-starts-with?(word-slice, "#")) break
# . var start/edx : (address byte) = slice->start
# . var start/edx : (addr byte) = slice->start
8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx
# . var c/eax : byte = *start
31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax
@ -3285,7 +3285,7 @@ $emit-imm:break:
5d/pop-to-ebp
c3/return
emit-line-in-comment: # line : (address stream byte), out : (address buffered-file)
emit-line-in-comment: # line : (addr stream byte), out : (addr buffered-file)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -5837,7 +5837,7 @@ test-convert-instruction-handles-imm8-operand:
c3/return
# shortcut for parse-hex-int(next-token-from-slice(word->start, word->end, '/'))
parse-datum-of-word: # word : (address slice) -> value/eax : int
parse-datum-of-word: # word : (addr slice) -> value/eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -104,7 +104,7 @@ $subx-sigils-main:end:
# error messages considered:
# *x + 34 -> error: base+disp addressing must be within '()'
subx-sigils: # in : (address buffered-file), out : (address buffered-file)
subx-sigils: # in : (addr buffered-file), out : (addr buffered-file)
# pseudocode:
# var line : (stream byte 512)
# while true
@ -1359,7 +1359,7 @@ test-subx-sigils-indirect-mode-without-register:
5d/pop-to-ebp
c3/return
emit-direct-mode: # out : (address buffered-file), word-slice : (address slice)
emit-direct-mode: # out : (addr buffered-file), word-slice : (addr slice)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -1599,7 +1599,7 @@ test-emit-direct-mode-2:
# error messages considered:
# * ... -> error: no space after '*'
# *(... -> error: *(...) expression must be all on a single line
next-word-or-expression: # line : (address stream byte), out : (address slice)
next-word-or-expression: # line : (addr stream byte), out : (addr slice)
# pseudocode:
# skip-chars-matching(line, ' ')
# if line->read >= line->write # end of line
@ -2207,7 +2207,7 @@ test-next-word-or-expression-returns-whole-expression:
# *(reg1+reg2<<s+disp) -> 2/mod 4/rm32 reg1/base reg2/index s/scale disp/disp32
# Intermediate structure: base, index, scale, disp
# Default values: base: 0, index: 4 (none), scale: 0, disp: 0
parse-effective-address: # word-slice : (address slice) -> base/eax, index/ecx, scale/edx, disp/ebx
parse-effective-address: # word-slice : (addr slice) -> base/eax, index/ecx, scale/edx, disp/ebx
# pseudocode:
# var local-slice = {word-slice->start, word-slice->end}
# ++local-slice->start to skip '*'
@ -2670,7 +2670,7 @@ $parse-effective-address:error4:
# assumes 'in' starts with a register name, and returns pointer to its code
# side-effect: modifies 'in' to scan past the initial register name
next-register: # in : (address slice) -> reg/eax : int
next-register: # in : (addr slice) -> reg/eax : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -3149,7 +3149,7 @@ test-parse-effective-address-base-index-scale-displacement:
# if index is none, then mod = 2 and rm32 = base and disp32 = disp
# emit-sib:
# if index is not none, then mod = 2 and rm32 = 4 and base = base and index = index and disp32 = disp
emit-indirect-mode: # out : (address buffered-file), base : int, index : int, scale : int, disp : int
emit-indirect-mode: # out : (addr buffered-file), base : int, index : int, scale : int, disp : int
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -3858,7 +3858,7 @@ test-emit-indirect-mode-esp:
5d/pop-to-ebp
c3/return
disp32-mode?: # in : (address slice) -> reg/eax : boolean
disp32-mode?: # in : (addr slice) -> reg/eax : boolean
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -3917,7 +3917,7 @@ $disp32-mode?:end:
5d/pop-to-ebp
c3/return
emit-indirect-disp32: # out : (address buffered-file), word-slice : (address slice)
emit-indirect-disp32: # out : (addr buffered-file), word-slice : (addr slice)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -3967,7 +3967,7 @@ $emit-indirect-disp32:end:
# assumes 'in' starts with optional '+' or '-', optional whitespace, and an unsigned integer
# returns the value of the integer
# side-effect: modifies 'in' to skip past the integer
next-hex-int: # in : (address slice) -> result/eax
next-hex-int: # in : (addr slice) -> result/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -4382,7 +4382,7 @@ test-next-hex-int-negative-with-space:
# assumes 'in' starts a positive unsigned integer
# returns the value of the integer
# side-effect: modifies 'in' to skip past the integer
next-positive-hex-int: # in : (address slice) -> result/eax
next-positive-hex-int: # in : (addr slice) -> result/eax
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp

View File

@ -107,13 +107,13 @@ $subx-survey-main:end:
cd/syscall 0x80/imm8
# data structures:
# segment-info: {address, file-offset, size} (12 bytes)
# segments: (address stream {string, segment-info}) (16 bytes per row)
# label-info: {segment-name, segment-offset, address} (12 bytes)
# labels: (address stream {string, label-info}) (16 bytes per row)
# segment-info: {addr, file-offset, size} (12 bytes)
# segments: (addr stream {string, segment-info}) (16 bytes per row)
# label-info: {segment-name, segment-offset, addr} (12 bytes)
# labels: (addr stream {string, label-info}) (16 bytes per row)
# these are all inefficient; use sequential scans for lookups
subx-survey: # infile : (address buffered-file), out : (address buffered-file)
subx-survey: # infile : (addr buffered-file), out : (addr buffered-file)
# pseudocode
# var in : (ref stream byte 4096)
# slurp(infile, in)
@ -618,7 +618,7 @@ compute-offsets:segment-tmp: # slice
== code
compute-offsets: # in : (address stream byte), segments : (address stream {string, segment-info}), labels : (address stream {string, label-info})
compute-offsets: # in : (addr stream byte), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info})
# skeleton:
# for lines in 'in'
# for words in line
@ -629,7 +629,7 @@ compute-offsets: # in : (address stream byte), segments : (address stream {stri
# default
#
# pseudocode:
# curr-segment-name : (address string) = 0
# curr-segment-name : (addr string) = 0
# var line : (stream byte 512)
# while true # line loop
# clear-stream(line)
@ -661,7 +661,7 @@ compute-offsets: # in : (address stream byte), segments : (address stream {stri
# break (next line)
# else if is-label?(word-slice)
# strip trailing ':' from word-slice
# x : (address label-info) = get-or-insert(labels, name)
# x : (addr label-info) = get-or-insert(labels, name)
# x->segment-name = curr-segment-name
# trace("label '", word-slice, "' is in segment '", curr-segment-name, "'.")
# x->segment-offset = segment-offset
@ -1378,9 +1378,9 @@ test-compute-offsets:
5d/pop-to-ebp
c3/return
compute-addresses: # segments : (address stream {string, segment-info}), labels : (address stream {string, label-info})
compute-addresses: # segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info})
# pseudocode:
# srow : (address segment-info) = segments->data
# srow : (addr segment-info) = segments->data
# max = &segments->data[segments->write]
# num-segments = segments->write / 16
# starting-offset = 0x34 + (num-segments * 0x20)
@ -1391,12 +1391,12 @@ compute-addresses: # segments : (address stream {string, segment-info}), labels
# s->address += (s->file-offset & 0x00000fff)
# trace-sssns("segment " s->key " starts at address " s->address)
# srow += 16 # row-size
# lrow : (address label-info) = labels->data
# lrow : (addr label-info) = labels->data
# max = &labels->data[labels->write]
# while true
# if (lrow >= max) break
# seg-name : (address string) = lrow->segment-name
# label-seg : (address segment-info) = get(segments, seg-name)
# seg-name : (addr string) = lrow->segment-name
# label-seg : (addr segment-info) = get(segments, seg-name)
# lrow->address = label-seg->address + lrow->segment-offset
# trace-sssns("label " lrow->key " is at address " lrow->address)
# lrow += 16 # row-size
@ -1550,7 +1550,7 @@ $compute-addresses:label-loop:
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
#? # }}}
# label-seg/edx : (address segment-info) = get(segments, seg-name, row-size=16, "segment table")
# label-seg/edx : (addr segment-info) = get(segments, seg-name, row-size=16, "segment table")
# . save eax
50/push-eax
# . eax = get(segments, seg-name, row-size=16)
@ -1871,7 +1871,7 @@ test-compute-addresses-large-segments:
5d/pop-to-ebp
c3/return
emit-output: # in : (address stream byte), out : (address buffered-file), segments : (address stream {string, segment-info}), labels : (address stream {string, label-info})
emit-output: # in : (addr stream byte), out : (addr buffered-file), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info})
# pseudocode:
# emit-headers(out, segments, labels)
# emit-segments(in, out, segments, labels)
@ -1922,7 +1922,7 @@ $emit-output:end:
5d/pop-to-ebp
c3/return
emit-segments: # in : (address stream byte), out : (address buffered-file), segments : (address stream {string, segment-info}), labels : (address stream {string, label-info})
emit-segments: # in : (addr stream byte), out : (addr buffered-file), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info})
# pseudocode:
# var offset-of-next-instruction = 0
# var line : (stream byte 512)
@ -3173,7 +3173,7 @@ test-emit-segments-code-label-absolute:
5d/pop-to-ebp
c3/return
emit-headers: # out : (address buffered-file), segments : (address stream {string, segment-info}), labels : (address stream {string, label-info})
emit-headers: # out : (addr buffered-file), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info})
# pseudocode:
# emit-elf-header(out, segments, labels)
# curr-segment = segments->data
@ -3311,7 +3311,7 @@ $emit-headers:end:
5d/pop-to-ebp
c3/return
emit-elf-header: # out : (address buffered-file), segments : (address stream {string, segment-info}), labels : (address stream {string, label-info})
emit-elf-header: # out : (addr buffered-file), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info})
# pseudocode
# *$Elf_e_entry = get(labels, "Entry")->address
# *$Elf_e_phnum = segments->write / 16 # size of a row
@ -3379,7 +3379,7 @@ $emit-elf-header:end:
5d/pop-to-ebp
c3/return
emit-elf-program-header-entry: # out : (address buffered-file), curr-segment : (address {string, segment-info})
emit-elf-program-header-entry: # out : (addr buffered-file), curr-segment : (addr {string, segment-info})
# pseudocode:
# *$Elf_p_offset = curr-segment->file-offset
# *$Elf_p_vaddr = curr-segment->address
@ -3468,7 +3468,7 @@ $emit-elf-program-header-entry:end:
# - some helpers for tests
stream-add4: # in : (address stream byte), key : address, val1 : address, val2 : address, val3 : address
stream-add4: # in : (addr stream byte), key : addr, val1 : addr, val2 : addr, val3 : addr
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -3550,11 +3550,11 @@ $stream-add4:abort:
# some variants of 'trace' that take multiple arguments in different combinations of types:
# n: int
# c: character [4-bytes, will eventually be UTF-8]
# s: (address string)
# l: (address slice)
# s: (addr string)
# l: (addr slice)
# one gotcha: 's5' must not be empty
trace-sssns: # s1 : (address string), s2 : (address string), s3 : (address string), n4 : int, s5 : (address string)
trace-sssns: # s1 : (addr string), s2 : (addr string), s3 : (addr string), n4 : int, s5 : (addr string)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -3661,7 +3661,7 @@ test-trace-sssns:
5d/pop-to-ebp
c3/return
trace-snsns: # s1 : (address string), n2 : int, s3 : (address string), n4 : int, s5 : (address string)
trace-snsns: # s1 : (addr string), n2 : int, s3 : (addr string), n4 : int, s5 : (addr string)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -3768,7 +3768,7 @@ test-trace-snsns:
5d/pop-to-ebp
c3/return
trace-slsls: # s1 : (address string), l2 : (address slice), s3 : (address string), l4 : (address slice), s5 : (address string)
trace-slsls: # s1 : (addr string), l2 : (addr slice), s3 : (addr string), l4 : (addr slice), s5 : (addr string)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -3893,7 +3893,7 @@ test-trace-slsls:
5d/pop-to-ebp
c3/return
trace-slsns: # s1 : (address string), l2 : (address slice), s3 : (address string), n4 : int, s5 : (address string)
trace-slsns: # s1 : (addr string), l2 : (addr slice), s3 : (addr string), n4 : int, s5 : (addr string)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -4009,7 +4009,7 @@ test-trace-slsns:
5d/pop-to-ebp
c3/return
trace-slsss: # s1 : (address string), l2 : (address slice), s3 : (address string), s4 : (address string), s5 : (address string)
trace-slsss: # s1 : (addr string), l2 : (addr slice), s3 : (addr string), s4 : (addr string), s5 : (addr string)
# . prologue
55/push-ebp
89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp
@ -4125,7 +4125,7 @@ test-trace-slsss:
5d/pop-to-ebp
c3/return
num-bytes: # line : (address stream byte) -> eax : int
num-bytes: # line : (addr stream byte) -> eax : int
# pseudocode:
# result = 0
# while true

View File

@ -67,7 +67,7 @@ $subx-tests-main:end:
b8/copy-to-eax 1/imm32/exit
cd/syscall 0x80/imm8
subx-gen-run-tests: # in : (address buffered-file), out : (address buffered-file)
subx-gen-run-tests: # in : (addr buffered-file), out : (addr buffered-file)
# pseudocode
# bool tests-found = false
# var line : (stream byte 512)

View File

@ -93,7 +93,7 @@ if ('onhashchange' in window) {
<span id="L34" class="LineNr">34 </span><span class="subxComment"># You can convert a ref or handle to an address, but not the other way around.</span>
<span id="L35" class="LineNr">35 </span><span class="subxComment"># You can convert addresses to ints, but not the other way around.</span>
<span id="L36" class="LineNr">36 </span>
<span id="L37" class="LineNr">37 </span><span class="subxMinorFunction">_write</span>: <span class="subxComment"># fd : int, s : (address array byte)</span>
<span id="L37" class="LineNr">37 </span><span class="subxMinorFunction">_write</span>: <span class="subxComment"># fd : int, s : (addr array byte)</span>
<span id="L38" class="LineNr">38 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L39" class="LineNr">39 </span> 55/push-ebp
<span id="L40" class="LineNr">40 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -80,7 +80,7 @@ if ('onhashchange' in window) {
<span id="L21" class="LineNr"> 21 </span> cd/syscall 0x80/imm8
<span id="L22" class="LineNr"> 22 </span>
<span id="L23" class="LineNr"> 23 </span><span class="subxComment"># print msg to stderr if a != b, otherwise print &quot;.&quot;</span>
<span id="L24" class="LineNr"> 24 </span><span class="subxFunction">check-ints-equal</span>: <span class="subxComment"># a : int, b : int, msg : (address array byte)</span>
<span id="L24" class="LineNr"> 24 </span><span class="subxFunction">check-ints-equal</span>: <span class="subxComment"># a : int, b : int, msg : (addr array byte)</span>
<span id="L25" class="LineNr"> 25 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L26" class="LineNr"> 26 </span> 55/push-ebp
<span id="L27" class="LineNr"> 27 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -92,7 +92,7 @@ if ('onhashchange' in window) {
<span id="L30" class="LineNr"> 30 </span>
<span id="L31" class="LineNr"> 31 </span><span class="subxComment"># compare a null-terminated ascii string with a more idiomatic length-prefixed byte array</span>
<span id="L32" class="LineNr"> 32 </span><span class="subxComment"># reason for the name: the only place we should have null-terminated ascii strings is from commandline args</span>
<span id="L33" class="LineNr"> 33 </span><span class="subxFunction">kernel-string-equal?</span>: <span class="subxComment"># s : (address kernel-string), benchmark : (address array byte) -&gt; eax : boolean</span>
<span id="L33" class="LineNr"> 33 </span><span class="subxFunction">kernel-string-equal?</span>: <span class="subxComment"># s : (addr kernel-string), benchmark : (addr array byte) -&gt; eax : boolean</span>
<span id="L34" class="LineNr"> 34 </span> <span class="subxComment"># pseudocode:</span>
<span id="L35" class="LineNr"> 35 </span> <span class="subxComment"># n = benchmark-&gt;length</span>
<span id="L36" class="LineNr"> 36 </span> <span class="subxComment"># s1 = s</span>
@ -123,12 +123,12 @@ if ('onhashchange' in window) {
<span id="L61" class="LineNr"> 61 </span> 53/push-ebx
<span id="L62" class="LineNr"> 62 </span> 56/push-esi
<span id="L63" class="LineNr"> 63 </span> 57/push-edi
<span id="L64" class="LineNr"> 64 </span> <span class="subxComment"># var s1/edi : (address byte) = s</span>
<span id="L64" class="LineNr"> 64 </span> <span class="subxComment"># var s1/edi : (addr byte) = s</span>
<span id="L65" class="LineNr"> 65 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to edi</span>
<span id="L66" class="LineNr"> 66 </span> <span class="subxComment"># var n/edx : int = benchmark-&gt;length</span>
<span id="L67" class="LineNr"> 67 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to edx</span>
<span id="L68" class="LineNr"> 68 </span> 8b/copy 0/mod/indirect 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *edx to edx</span>
<span id="L69" class="LineNr"> 69 </span> <span class="subxComment"># var s2/esi : (address byte) = benchmark-&gt;data</span>
<span id="L69" class="LineNr"> 69 </span> <span class="subxComment"># var s2/esi : (addr byte) = benchmark-&gt;data</span>
<span id="L70" class="LineNr"> 70 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to esi</span>
<span id="L71" class="LineNr"> 71 </span> 81 0/subop/add 3/mod/direct 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esi</span>
<span id="L72" class="LineNr"> 72 </span> <span class="subxComment"># var i/ecx : int = 0</span>
@ -324,10 +324,10 @@ if ('onhashchange' in window) {
<span id="L262" class="LineNr">262 </span>
<span id="L263" class="LineNr">263 </span>== data
<span id="L264" class="LineNr">264 </span>
<span id="L265" class="LineNr">265 </span><span class="SpecialChar">Null-kernel-string</span>: <span class="subxComment"># (address kernel-string)</span>
<span id="L265" class="LineNr">265 </span><span class="SpecialChar">Null-kernel-string</span>: <span class="subxComment"># (addr kernel-string)</span>
<span id="L266" class="LineNr">266 </span> 00/null
<span id="L267" class="LineNr">267 </span>
<span id="L268" class="LineNr">268 </span><span class="subxMinorFunction">_test-Abc-kernel-string</span>: <span class="subxComment"># (address kernel-string)</span>
<span id="L268" class="LineNr">268 </span><span class="subxMinorFunction">_test-Abc-kernel-string</span>: <span class="subxComment"># (addr kernel-string)</span>
<span id="L269" class="LineNr">269 </span> 41/A 62/b 63/c 00/null
<span id="L270" class="LineNr">270 </span>
<span id="L271" class="LineNr">271 </span><span class="subxS2Comment"># . . vim&#0058;nowrap:textwidth=0</span>

View File

@ -89,7 +89,7 @@ if ('onhashchange' in window) {
<span id="L29" class="LineNr">29 </span> e8/call <a href='053new-segment.subx.html#L41'>new-segment</a>/disp32
<span id="L30" class="LineNr">30 </span> <span class="subxS2Comment"># . . discard args</span>
<span id="L31" class="LineNr">31 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span>
<span id="L32" class="LineNr">32 </span> <span class="subxComment"># var eax : (address _) = ad-&gt;curr</span>
<span id="L32" class="LineNr">32 </span> <span class="subxComment"># var eax : (addr _) = ad-&gt;curr</span>
<span id="L33" class="LineNr">33 </span> 8b/copy 0/mod/indirect 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *ecx to eax</span>
<span id="L34" class="LineNr">34 </span> <span class="subxComment"># write to *eax to check that we have access to the newly-allocated segment</span>
<span id="L35" class="LineNr">35 </span> c7 0/subop/copy 0/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0x34/imm32 <span class="subxComment"># copy to *eax</span>

View File

@ -75,7 +75,7 @@ if ('onhashchange' in window) {
<span id="L13" class="LineNr"> 13 </span> b8/copy-to-eax 1/imm32/exit
<span id="L14" class="LineNr"> 14 </span> cd/syscall 0x80/imm8
<span id="L15" class="LineNr"> 15 </span>
<span id="L16" class="LineNr"> 16 </span><span class="subxFunction">string-equal?</span>: <span class="subxComment"># s : (address array byte), benchmark : (address array byte) -&gt; eax : boolean</span>
<span id="L16" class="LineNr"> 16 </span><span class="subxFunction">string-equal?</span>: <span class="subxComment"># s : (addr array byte), benchmark : (addr array byte) -&gt; eax : boolean</span>
<span id="L17" class="LineNr"> 17 </span> <span class="subxComment"># pseudocode:</span>
<span id="L18" class="LineNr"> 18 </span> <span class="subxComment"># if (s-&gt;length != benchmark-&gt;length) return false</span>
<span id="L19" class="LineNr"> 19 </span> <span class="subxComment"># currs = s-&gt;data</span>
@ -113,11 +113,11 @@ if ('onhashchange' in window) {
<span id="L51" class="LineNr"> 51 </span> <span class="subxComment"># if (ecx != benchmark-&gt;length) return false</span>
<span id="L52" class="LineNr"> 52 </span> 39/compare 0/mod/indirect 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare *edi and ecx</span>
<span id="L53" class="LineNr"> 53 </span> 75/jump-if-not-equal $string-equal?:false/disp8
<span id="L54" class="LineNr"> 54 </span> <span class="subxComment"># var currs/esi : (address byte) = s-&gt;data</span>
<span id="L54" class="LineNr"> 54 </span> <span class="subxComment"># var currs/esi : (addr byte) = s-&gt;data</span>
<span id="L55" class="LineNr"> 55 </span> 81 0/subop/add 3/mod/direct 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esi</span>
<span id="L56" class="LineNr"> 56 </span> <span class="subxComment"># var maxs/ecx : (address byte) = &amp;s-&gt;data[s-&gt;length]</span>
<span id="L56" class="LineNr"> 56 </span> <span class="subxComment"># var maxs/ecx : (addr byte) = &amp;s-&gt;data[s-&gt;length]</span>
<span id="L57" class="LineNr"> 57 </span> 01/add 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># add esi to ecx</span>
<span id="L58" class="LineNr"> 58 </span> <span class="subxComment"># var currb/edi : (address byte) = benchmark-&gt;data</span>
<span id="L58" class="LineNr"> 58 </span> <span class="subxComment"># var currb/edi : (addr byte) = benchmark-&gt;data</span>
<span id="L59" class="LineNr"> 59 </span> 81 0/subop/add 3/mod/direct 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to edi</span>
<span id="L60" class="LineNr"> 60 </span> <span class="subxComment"># var c1/eax : byte = 0</span>
<span id="L61" class="LineNr"> 61 </span> 31/xor 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear eax</span>
@ -238,7 +238,7 @@ if ('onhashchange' in window) {
<span id="L176" class="LineNr">176 </span> c3/return
<span id="L177" class="LineNr">177 </span>
<span id="L178" class="LineNr">178 </span><span class="subxComment"># helper for later tests</span>
<span id="L179" class="LineNr">179 </span><span class="subxFunction">check-strings-equal</span>: <span class="subxComment"># s : (address array byte), expected : (address array byte), msg : (address array byte)</span>
<span id="L179" class="LineNr">179 </span><span class="subxFunction">check-strings-equal</span>: <span class="subxComment"># s : (addr array byte), expected : (addr array byte), msg : (addr array byte)</span>
<span id="L180" class="LineNr">180 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L181" class="LineNr">181 </span> 55/push-ebp
<span id="L182" class="LineNr">182 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -72,7 +72,7 @@ if ('onhashchange' in window) {
<span id="L14" class="LineNr">14 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L15" class="LineNr">15 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L16" class="LineNr">16 </span>
<span id="L17" class="LineNr">17 </span><span class="subxFunction">clear-stream</span>: <span class="subxComment"># f : (address stream byte)</span>
<span id="L17" class="LineNr">17 </span><span class="subxFunction">clear-stream</span>: <span class="subxComment"># f : (addr stream byte)</span>
<span id="L18" class="LineNr">18 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L19" class="LineNr">19 </span> 55/push-ebp
<span id="L20" class="LineNr">20 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -83,13 +83,13 @@ if ('onhashchange' in window) {
<span id="L25" class="LineNr">25 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to eax</span>
<span id="L26" class="LineNr">26 </span> <span class="subxComment"># var count/ecx : int = f-&gt;length</span>
<span id="L27" class="LineNr">27 </span> 8b/copy 1/mod/*+disp8 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(eax+8) to ecx</span>
<span id="L28" class="LineNr">28 </span> <span class="subxComment"># var max/ecx : (address byte) = &amp;f-&gt;data[f-&gt;length]</span>
<span id="L28" class="LineNr">28 </span> <span class="subxComment"># var max/ecx : (addr byte) = &amp;f-&gt;data[f-&gt;length]</span>
<span id="L29" class="LineNr">29 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy eax+ecx+12 to ecx</span>
<span id="L30" class="LineNr">30 </span> <span class="subxComment"># f-&gt;write = 0</span>
<span id="L31" class="LineNr">31 </span> c7 0/subop/copy 0/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/imm32 <span class="subxComment"># copy to *eax</span>
<span id="L32" class="LineNr">32 </span> <span class="subxComment"># f-&gt;read = 0</span>
<span id="L33" class="LineNr">33 </span> c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/disp8 0/imm32 <span class="subxComment"># copy to *(eax+4)</span>
<span id="L34" class="LineNr">34 </span> <span class="subxComment"># var curr/eax : (address byte) = f-&gt;data</span>
<span id="L34" class="LineNr">34 </span> <span class="subxComment"># var curr/eax : (addr byte) = f-&gt;data</span>
<span id="L35" class="LineNr">35 </span> 81 0/subop/add 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to eax</span>
<span id="L36" class="LineNr">36 </span><span class="Constant">$clear-stream:loop</span>:
<span id="L37" class="LineNr">37 </span> <span class="subxComment"># if (curr &gt;= max) break</span>
@ -109,7 +109,7 @@ if ('onhashchange' in window) {
<span id="L51" class="LineNr">51 </span> 5d/pop-to-ebp
<span id="L52" class="LineNr">52 </span> c3/return
<span id="L53" class="LineNr">53 </span>
<span id="L54" class="LineNr">54 </span><span class="subxFunction">rewind-stream</span>: <span class="subxComment"># f : (address stream byte)</span>
<span id="L54" class="LineNr">54 </span><span class="subxFunction">rewind-stream</span>: <span class="subxComment"># f : (addr stream byte)</span>
<span id="L55" class="LineNr">55 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L56" class="LineNr">56 </span> 55/push-ebp
<span id="L57" class="LineNr">57 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -142,7 +142,7 @@ if ('onhashchange' in window) {
<span id="L79" class="LineNr"> 79 </span>
<span id="L80" class="LineNr"> 80 </span><span class="subxComment"># Append a string to the given trace stream.</span>
<span id="L81" class="LineNr"> 81 </span><span class="subxComment"># Silently give up if it's already full. Or truncate the string if there isn't enough room.</span>
<span id="L82" class="LineNr"> 82 </span><span class="subxFunction">trace</span>: <span class="subxComment"># line : (address array byte)</span>
<span id="L82" class="LineNr"> 82 </span><span class="subxFunction">trace</span>: <span class="subxComment"># line : (addr array byte)</span>
<span id="L83" class="LineNr"> 83 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L84" class="LineNr"> 84 </span> 55/push-ebp
<span id="L85" class="LineNr"> 85 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -153,7 +153,7 @@ if ('onhashchange' in window) {
<span id="L90" class="LineNr"> 90 </span> 53/push-ebx
<span id="L91" class="LineNr"> 91 </span> 56/push-esi
<span id="L92" class="LineNr"> 92 </span> 57/push-edi
<span id="L93" class="LineNr"> 93 </span> <span class="subxComment"># var edi : (address stream byte) = *Trace-stream</span>
<span id="L93" class="LineNr"> 93 </span> <span class="subxComment"># var edi : (addr stream byte) = *Trace-stream</span>
<span id="L94" class="LineNr"> 94 </span> 8b/copy 0/mod/indirect 5/rm32/.disp32 <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi <span class="SpecialChar"><a href='056trace.subx.html#L17'>Trace-stream</a></span>/disp32 <span class="subxComment"># copy *Trace-stream to edi</span>
<span id="L95" class="LineNr"> 95 </span> <span class="subxComment"># esi = line</span>
<span id="L96" class="LineNr"> 96 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
@ -309,7 +309,7 @@ if ('onhashchange' in window) {
<span id="L246" class="LineNr">246 </span> <span class="subxComment"># end</span>
<span id="L247" class="LineNr">247 </span> c3/return
<span id="L248" class="LineNr">248 </span>
<span id="L249" class="LineNr">249 </span><span class="subxFunction">check-trace-contains</span>: <span class="subxComment"># line : (address string), msg : (address string)</span>
<span id="L249" class="LineNr">249 </span><span class="subxFunction">check-trace-contains</span>: <span class="subxComment"># line : (addr string), msg : (addr string)</span>
<span id="L250" class="LineNr">250 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L251" class="LineNr">251 </span> 55/push-ebp
<span id="L252" class="LineNr">252 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -334,7 +334,7 @@ if ('onhashchange' in window) {
<span id="L271" class="LineNr">271 </span> 5d/pop-to-ebp
<span id="L272" class="LineNr">272 </span> c3/return
<span id="L273" class="LineNr">273 </span>
<span id="L274" class="LineNr">274 </span><span class="subxFunction">check-trace-scans-to</span>: <span class="subxComment"># line : (address string), msg : (address string)</span>
<span id="L274" class="LineNr">274 </span><span class="subxFunction">check-trace-scans-to</span>: <span class="subxComment"># line : (addr string), msg : (addr string)</span>
<span id="L275" class="LineNr">275 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L276" class="LineNr">276 </span> 55/push-ebp
<span id="L277" class="LineNr">277 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -365,7 +365,7 @@ if ('onhashchange' in window) {
<span id="L302" class="LineNr">302 </span> c3/return
<span id="L303" class="LineNr">303 </span>
<span id="L304" class="LineNr">304 </span><span class="subxComment"># Start scanning from Trace-stream-&gt;read for 'line'. If found, update Trace-stream-&gt;read and return true.</span>
<span id="L305" class="LineNr">305 </span><span class="subxFunction">trace-scan</span>: <span class="subxComment"># line : (address array byte) -&gt; result/eax : boolean</span>
<span id="L305" class="LineNr">305 </span><span class="subxFunction">trace-scan</span>: <span class="subxComment"># line : (addr array byte) -&gt; result/eax : boolean</span>
<span id="L306" class="LineNr">306 </span> <span class="subxComment"># pseudocode:</span>
<span id="L307" class="LineNr">307 </span> <span class="subxComment"># push Trace-stream-&gt;read</span>
<span id="L308" class="LineNr">308 </span> <span class="subxComment"># while true:</span>
@ -617,7 +617,7 @@ if ('onhashchange' in window) {
<span id="L554" class="LineNr">554 </span> <span class="subxS1Comment"># . end</span>
<span id="L555" class="LineNr">555 </span> c3/return
<span id="L556" class="LineNr">556 </span>
<span id="L557" class="LineNr">557 </span><span class="subxFunction">next-line-matches?</span>: <span class="subxComment"># t : (address stream byte), line : (address array byte) -&gt; result/eax : boolean</span>
<span id="L557" class="LineNr">557 </span><span class="subxFunction">next-line-matches?</span>: <span class="subxComment"># t : (addr stream byte), line : (addr array byte) -&gt; result/eax : boolean</span>
<span id="L558" class="LineNr">558 </span> <span class="subxComment"># pseudocode:</span>
<span id="L559" class="LineNr">559 </span> <span class="subxComment"># while true:</span>
<span id="L560" class="LineNr">560 </span> <span class="subxComment"># if (currl &gt;= maxl) break</span>
@ -638,24 +638,24 @@ if ('onhashchange' in window) {
<span id="L575" class="LineNr">575 </span> 57/push-edi
<span id="L576" class="LineNr">576 </span> <span class="subxComment"># edx = line</span>
<span id="L577" class="LineNr">577 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to edx</span>
<span id="L578" class="LineNr">578 </span> <span class="subxComment"># var currl/esi : (address byte) = line-&gt;data</span>
<span id="L578" class="LineNr">578 </span> <span class="subxComment"># var currl/esi : (addr byte) = line-&gt;data</span>
<span id="L579" class="LineNr">579 </span> <span class="subxS1Comment"># . esi = line/edx-&gt;data</span>
<span id="L580" class="LineNr">580 </span> 8d/copy-address 1/mod/*+disp8 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy edx+4 to esi</span>
<span id="L581" class="LineNr">581 </span> <span class="subxComment"># var maxl/ecx : (address byte) = &amp;line-&gt;data[line-&gt;size]</span>
<span id="L581" class="LineNr">581 </span> <span class="subxComment"># var maxl/ecx : (addr byte) = &amp;line-&gt;data[line-&gt;size]</span>
<span id="L582" class="LineNr">582 </span> <span class="subxS1Comment"># . eax = line/edx-&gt;size</span>
<span id="L583" class="LineNr">583 </span> 8b/copy 0/mod/indirect 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *edx to eax</span>
<span id="L584" class="LineNr">584 </span> <span class="subxS1Comment"># . maxl = &amp;line-&gt;data[line-&gt;size]</span>
<span id="L585" class="LineNr">585 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 6/base/esi 0/index/eax <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy edx+eax to ecx</span>
<span id="L586" class="LineNr">586 </span> <span class="subxComment"># edi = t</span>
<span id="L587" class="LineNr">587 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to edi</span>
<span id="L588" class="LineNr">588 </span> <span class="subxComment"># var ebx : (address byte) = t-&gt;data</span>
<span id="L588" class="LineNr">588 </span> <span class="subxComment"># var ebx : (addr byte) = t-&gt;data</span>
<span id="L589" class="LineNr">589 </span> 8d/copy-address 1/mod/*+disp8 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 3/r32/ebx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy edi+12 to ebx</span>
<span id="L590" class="LineNr">590 </span> <span class="subxComment"># var maxt/edx : (address byte) = &amp;t-&gt;data[t-&gt;write]</span>
<span id="L590" class="LineNr">590 </span> <span class="subxComment"># var maxt/edx : (addr byte) = &amp;t-&gt;data[t-&gt;write]</span>
<span id="L591" class="LineNr">591 </span> <span class="subxS1Comment"># . eax = t-&gt;write</span>
<span id="L592" class="LineNr">592 </span> 8b/copy 0/mod/indirect 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *edi to eax</span>
<span id="L593" class="LineNr">593 </span> <span class="subxS1Comment"># . maxt = &amp;t-&gt;data[t-&gt;write]</span>
<span id="L594" class="LineNr">594 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 3/base/ebx 0/index/eax <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ebx+eax to edx</span>
<span id="L595" class="LineNr">595 </span> <span class="subxComment"># var currt/edi : (address byte) = &amp;t-&gt;data[t-&gt;read]</span>
<span id="L595" class="LineNr">595 </span> <span class="subxComment"># var currt/edi : (addr byte) = &amp;t-&gt;data[t-&gt;read]</span>
<span id="L596" class="LineNr">596 </span> <span class="subxS1Comment"># . eax = t/edi-&gt;read</span>
<span id="L597" class="LineNr">597 </span> 8b/copy 1/mod/*+disp8 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(edi+4) to eax</span>
<span id="L598" class="LineNr">598 </span> <span class="subxS1Comment"># . currt = &amp;t-&gt;data[t-&gt;read]</span>
@ -793,7 +793,7 @@ if ('onhashchange' in window) {
<span id="L730" class="LineNr">730 </span> c3/return
<span id="L731" class="LineNr">731 </span>
<span id="L732" class="LineNr">732 </span><span class="subxComment"># move t-&gt;read to _after_ next newline</span>
<span id="L733" class="LineNr">733 </span><span class="subxFunction">skip-next-line</span>: <span class="subxComment"># t : (address stream byte)</span>
<span id="L733" class="LineNr">733 </span><span class="subxFunction">skip-next-line</span>: <span class="subxComment"># t : (addr stream byte)</span>
<span id="L734" class="LineNr">734 </span> <span class="subxComment"># pseudocode:</span>
<span id="L735" class="LineNr">735 </span> <span class="subxComment"># max = &amp;t-&gt;data[t-&gt;write]</span>
<span id="L736" class="LineNr">736 </span> <span class="subxComment"># i = t-&gt;read</span>
@ -819,11 +819,11 @@ if ('onhashchange' in window) {
<span id="L756" class="LineNr">756 </span> 8d/copy-address 1/mod/*+disp8 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy ecx+12 to edx</span>
<span id="L757" class="LineNr">757 </span> <span class="subxComment"># eax = t-&gt;write</span>
<span id="L758" class="LineNr">758 </span> 8b/copy 0/mod/indirect 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *ecx to eax</span>
<span id="L759" class="LineNr">759 </span> <span class="subxComment"># var max/ebx : (address byte) = &amp;t-&gt;data[t-&gt;write]</span>
<span id="L759" class="LineNr">759 </span> <span class="subxComment"># var max/ebx : (addr byte) = &amp;t-&gt;data[t-&gt;write]</span>
<span id="L760" class="LineNr">760 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 2/base/edx 0/index/eax <span class="Normal"> . </span> 3/r32/ebx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy edx+eax to ebx</span>
<span id="L761" class="LineNr">761 </span> <span class="subxComment"># eax = t-&gt;read</span>
<span id="L762" class="LineNr">762 </span> 8b/copy 1/mod/*+disp8 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ecx+4) to edx</span>
<span id="L763" class="LineNr">763 </span> <span class="subxComment"># var curr/ecx : (address byte) = &amp;t-&gt;data[t-&gt;read]</span>
<span id="L763" class="LineNr">763 </span> <span class="subxComment"># var curr/ecx : (addr byte) = &amp;t-&gt;data[t-&gt;read]</span>
<span id="L764" class="LineNr">764 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 2/base/edx 0/index/eax <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy edx+eax to ecx</span>
<span id="L765" class="LineNr">765 </span> <span class="subxComment"># var i/edx : int = t-&gt;read</span>
<span id="L766" class="LineNr">766 </span> 89/copy 3/mod/direct 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy eax to edx</span>
@ -921,7 +921,7 @@ if ('onhashchange' in window) {
<span id="L858" class="LineNr">858 </span><span class="subxH1Comment"># - helpers</span>
<span id="L859" class="LineNr">859 </span>
<span id="L860" class="LineNr">860 </span><span class="subxComment"># 3-argument variant of _append</span>
<span id="L861" class="LineNr">861 </span><span class="subxMinorFunction">_append-3</span>: <span class="subxComment"># out : (address byte), outend : (address byte), s : (address array byte) -&gt; num_bytes_appended/eax</span>
<span id="L861" class="LineNr">861 </span><span class="subxMinorFunction">_append-3</span>: <span class="subxComment"># out : (addr byte), outend : (addr byte), s : (addr array byte) -&gt; num_bytes_appended/eax</span>
<span id="L862" class="LineNr">862 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L863" class="LineNr">863 </span> 55/push-ebp
<span id="L864" class="LineNr">864 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -953,7 +953,7 @@ if ('onhashchange' in window) {
<span id="L890" class="LineNr">890 </span> c3/return
<span id="L891" class="LineNr">891 </span>
<span id="L892" class="LineNr">892 </span><span class="subxComment"># 4-argument variant of _append</span>
<span id="L893" class="LineNr">893 </span><span class="subxMinorFunction">_append-4</span>: <span class="subxComment"># out : (address byte), outend : (address byte), in : (address byte), inend : (address byte) -&gt; num_bytes_appended/eax : int</span>
<span id="L893" class="LineNr">893 </span><span class="subxMinorFunction">_append-4</span>: <span class="subxComment"># out : (addr byte), outend : (addr byte), in : (addr byte), inend : (addr byte) -&gt; num_bytes_appended/eax : int</span>
<span id="L894" class="LineNr">894 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L895" class="LineNr">895 </span> 55/push-ebp
<span id="L896" class="LineNr">896 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -81,7 +81,7 @@ if ('onhashchange' in window) {
<span id="L21" class="LineNr"> 21 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L22" class="LineNr"> 22 </span>
<span id="L23" class="LineNr"> 23 </span><span class="subxComment"># TODO: come up with a way to signal when a write to disk fails</span>
<span id="L24" class="LineNr"> 24 </span><span class="subxFunction">write</span>: <span class="subxComment"># f : fd or (address stream byte), s : (address array byte)</span>
<span id="L24" class="LineNr"> 24 </span><span class="subxFunction">write</span>: <span class="subxComment"># f : fd or (addr stream byte), s : (addr array byte)</span>
<span id="L25" class="LineNr"> 25 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L26" class="LineNr"> 26 </span> 55/push-ebp
<span id="L27" class="LineNr"> 27 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -65,7 +65,7 @@ if ('onhashchange' in window) {
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># compare all the data in a stream (ignoring the read pointer)</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">stream-data-equal?</span>: <span class="subxComment"># f : (address stream byte), s : (address array byte) -&gt; eax : boolean</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">stream-data-equal?</span>: <span class="subxComment"># f : (addr stream byte), s : (addr array byte) -&gt; eax : boolean</span>
<span id="L10" class="LineNr"> 10 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L11" class="LineNr"> 11 </span> 55/push-ebp
<span id="L12" class="LineNr"> 12 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -78,9 +78,9 @@ if ('onhashchange' in window) {
<span id="L19" class="LineNr"> 19 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L20" class="LineNr"> 20 </span> <span class="subxComment"># eax = f-&gt;write</span>
<span id="L21" class="LineNr"> 21 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to eax</span>
<span id="L22" class="LineNr"> 22 </span> <span class="subxComment"># var maxf/edx : (address byte) = &amp;f-&gt;data[f-&gt;write]</span>
<span id="L22" class="LineNr"> 22 </span> <span class="subxComment"># var maxf/edx : (addr byte) = &amp;f-&gt;data[f-&gt;write]</span>
<span id="L23" class="LineNr"> 23 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax <span class="Normal"> . </span> 2/r32/edx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+eax+12 to edx</span>
<span id="L24" class="LineNr"> 24 </span> <span class="subxComment"># var currf/esi : (address byte) = f-&gt;data</span>
<span id="L24" class="LineNr"> 24 </span> <span class="subxComment"># var currf/esi : (addr byte) = f-&gt;data</span>
<span id="L25" class="LineNr"> 25 </span> 81 0/subop/add 3/mod/direct 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to esi</span>
<span id="L26" class="LineNr"> 26 </span> <span class="subxComment"># edi = s</span>
<span id="L27" class="LineNr"> 27 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to edi</span>
@ -88,7 +88,7 @@ if ('onhashchange' in window) {
<span id="L29" class="LineNr"> 29 </span> <span class="subxComment"># if (f-&gt;write != s-&gt;length) return false</span>
<span id="L30" class="LineNr"> 30 </span> 39/compare 0/mod/indirect 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare *edi and eax</span>
<span id="L31" class="LineNr"> 31 </span> 75/jump-if-not-equal $stream-data-equal?:false/disp8
<span id="L32" class="LineNr"> 32 </span> <span class="subxComment"># var currs/edi : (address byte) = s-&gt;data</span>
<span id="L32" class="LineNr"> 32 </span> <span class="subxComment"># var currs/edi : (addr byte) = s-&gt;data</span>
<span id="L33" class="LineNr"> 33 </span> 81 0/subop/add 3/mod/direct 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to edi</span>
<span id="L34" class="LineNr"> 34 </span> <span class="subxComment"># var eax : byte = 0</span>
<span id="L35" class="LineNr"> 35 </span> 31/xor 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear eax</span>
@ -250,7 +250,7 @@ if ('onhashchange' in window) {
<span id="L191" class="LineNr">191 </span> c3/return
<span id="L192" class="LineNr">192 </span>
<span id="L193" class="LineNr">193 </span><span class="subxComment"># helper for later tests</span>
<span id="L194" class="LineNr">194 </span><span class="subxFunction">check-stream-equal</span>: <span class="subxComment"># f : (address stream byte), s : (address array byte), msg : (address array byte)</span>
<span id="L194" class="LineNr">194 </span><span class="subxFunction">check-stream-equal</span>: <span class="subxComment"># f : (addr stream byte), s : (addr array byte), msg : (addr array byte)</span>
<span id="L195" class="LineNr">195 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L196" class="LineNr">196 </span> 55/push-ebp
<span id="L197" class="LineNr">197 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -286,7 +286,7 @@ if ('onhashchange' in window) {
<span id="L227" class="LineNr">227 </span><span class="subxComment"># on success, set f-&gt;read to after the next newline</span>
<span id="L228" class="LineNr">228 </span><span class="subxComment"># on failure, leave f-&gt;read unmodified</span>
<span id="L229" class="LineNr">229 </span><span class="subxComment"># this function is usually used only in tests, so we repeatedly write f-&gt;read</span>
<span id="L230" class="LineNr">230 </span><span class="subxFunction">next-stream-line-equal?</span>: <span class="subxComment"># f : (address stream byte), s : (address array byte) -&gt; eax : boolean</span>
<span id="L230" class="LineNr">230 </span><span class="subxFunction">next-stream-line-equal?</span>: <span class="subxComment"># f : (addr stream byte), s : (addr array byte) -&gt; eax : boolean</span>
<span id="L231" class="LineNr">231 </span> <span class="subxComment"># pseudocode:</span>
<span id="L232" class="LineNr">232 </span> <span class="subxComment"># currf = f-&gt;read # bound: f-&gt;write</span>
<span id="L233" class="LineNr">233 </span> <span class="subxComment"># currs = 0 # bound : s-&gt;length</span>

View File

@ -102,7 +102,7 @@ if ('onhashchange' in window) {
<span id="L41" class="LineNr"> 41 </span><span class="subxComment"># the stack.</span>
<span id="L42" class="LineNr"> 42 </span><span class="subxComment"># Ugly that we need to know the size of args. Don't allocate variables between</span>
<span id="L43" class="LineNr"> 43 </span><span class="subxComment"># tailor-exit-descriptor and the call it's for.</span>
<span id="L44" class="LineNr"> 44 </span><span class="subxFunction">tailor-exit-descriptor</span>: <span class="subxComment"># ed : (address exit-descriptor), nbytes : int</span>
<span id="L44" class="LineNr"> 44 </span><span class="subxFunction">tailor-exit-descriptor</span>: <span class="subxComment"># ed : (addr exit-descriptor), nbytes : int</span>
<span id="L45" class="LineNr"> 45 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L46" class="LineNr"> 46 </span> 55/push-ebp
<span id="L47" class="LineNr"> 47 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -150,7 +150,7 @@ if ('onhashchange' in window) {
<span id="L89" class="LineNr"> 89 </span> 5d/pop-to-ebp
<span id="L90" class="LineNr"> 90 </span> c3/return
<span id="L91" class="LineNr"> 91 </span>
<span id="L92" class="LineNr"> 92 </span><span class="subxFunction">stop</span>: <span class="subxComment"># ed : (address exit-descriptor), value : int</span>
<span id="L92" class="LineNr"> 92 </span><span class="subxFunction">stop</span>: <span class="subxComment"># ed : (addr exit-descriptor), value : int</span>
<span id="L93" class="LineNr"> 93 </span> <span class="subxComment"># no prologue; one way or another, we're going to clobber registers</span>
<span id="L94" class="LineNr"> 94 </span> <span class="subxComment"># eax = ed</span>
<span id="L95" class="LineNr"> 95 </span> 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none <span class="Normal"> . </span> 0/r32/eax 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esp+4) to eax</span>
@ -222,7 +222,7 @@ if ('onhashchange' in window) {
<span id="L161" class="LineNr">161 </span> 5d/pop-to-ebp
<span id="L162" class="LineNr">162 </span> c3/return
<span id="L163" class="LineNr">163 </span>
<span id="L164" class="LineNr">164 </span><span class="subxMinorFunction">_test-stop-1</span>: <span class="subxComment"># ed : (address exit-descriptor)</span>
<span id="L164" class="LineNr">164 </span><span class="subxMinorFunction">_test-stop-1</span>: <span class="subxComment"># ed : (addr exit-descriptor)</span>
<span id="L165" class="LineNr">165 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L166" class="LineNr">166 </span> 55/push-ebp
<span id="L167" class="LineNr">167 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -249,7 +249,7 @@ if ('onhashchange' in window) {
<span id="L188" class="LineNr">188 </span> 5d/pop-to-ebp
<span id="L189" class="LineNr">189 </span> c3/return
<span id="L190" class="LineNr">190 </span>
<span id="L191" class="LineNr">191 </span><span class="subxMinorFunction">_test-stop-2</span>: <span class="subxComment"># ed : (address exit-descriptor)</span>
<span id="L191" class="LineNr">191 </span><span class="subxMinorFunction">_test-stop-2</span>: <span class="subxComment"># ed : (addr exit-descriptor)</span>
<span id="L192" class="LineNr">192 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L193" class="LineNr">193 </span> 55/push-ebp
<span id="L194" class="LineNr">194 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -106,7 +106,7 @@ if ('onhashchange' in window) {
<span id="L45" class="LineNr"> 45 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L46" class="LineNr"> 46 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L47" class="LineNr"> 47 </span>
<span id="L48" class="LineNr"> 48 </span><span class="subxFunction">read</span>: <span class="subxComment"># f : fd or (address stream byte), s : (address stream byte) -&gt; num-bytes-read/eax : int</span>
<span id="L48" class="LineNr"> 48 </span><span class="subxFunction">read</span>: <span class="subxComment"># f : fd or (addr stream byte), s : (addr stream byte) -&gt; num-bytes-read/eax : int</span>
<span id="L49" class="LineNr"> 49 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L50" class="LineNr"> 50 </span> 55/push-ebp
<span id="L51" class="LineNr"> 51 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -256,7 +256,7 @@ if ('onhashchange' in window) {
<span id="L195" class="LineNr">195 </span><span class="subxComment"># Unclear how I'd use it, though. Callers seem to need the check anyway.</span>
<span id="L196" class="LineNr">196 </span><span class="subxComment"># Maybe a better helper would be 'empty-stream?'</span>
<span id="L197" class="LineNr">197 </span>
<span id="L198" class="LineNr">198 </span><span class="subxMinorFunction">_read</span>: <span class="subxComment"># fd : int, s : (address stream byte) -&gt; num-bytes-read/eax : int</span>
<span id="L198" class="LineNr">198 </span><span class="subxMinorFunction">_read</span>: <span class="subxComment"># fd : int, s : (addr stream byte) -&gt; num-bytes-read/eax : int</span>
<span id="L199" class="LineNr">199 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L200" class="LineNr">200 </span> 55/push-ebp
<span id="L201" class="LineNr">201 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -74,7 +74,7 @@ if ('onhashchange' in window) {
<span id="L12" class="LineNr"> 12 </span><span class="subxComment"># The buffered file for standard input. Also illustrates the layout for</span>
<span id="L13" class="LineNr"> 13 </span><span class="subxComment"># buffered-file: a pointer to the backing store, followed by a 'buffer' stream</span>
<span id="L14" class="LineNr"> 14 </span><span class="SpecialChar">Stdin</span>: <span class="subxComment"># (ref buffered-file)</span>
<span id="L15" class="LineNr"> 15 </span> <span class="subxComment"># file descriptor or (address stream byte)</span>
<span id="L15" class="LineNr"> 15 </span> <span class="subxComment"># file descriptor or (addr stream byte)</span>
<span id="L16" class="LineNr"> 16 </span> 0/imm32 <span class="subxComment"># standard input</span>
<span id="L17" class="LineNr"> 17 </span><span class="Constant">$Stdin-&gt;buffer</span>:
<span id="L18" class="LineNr"> 18 </span> <span class="subxComment"># inlined fields for a stream</span>
@ -97,7 +97,7 @@ if ('onhashchange' in window) {
<span id="L35" class="LineNr"> 35 </span>
<span id="L36" class="LineNr"> 36 </span><span class="subxComment"># return next byte value in eax, with top 3 bytes cleared.</span>
<span id="L37" class="LineNr"> 37 </span><span class="subxComment"># On reaching end of file, return 0xffffffff (Eof).</span>
<span id="L38" class="LineNr"> 38 </span><span class="subxFunction">read-byte-buffered</span>: <span class="subxComment"># f : (address buffered-file) -&gt; byte-or-Eof/eax</span>
<span id="L38" class="LineNr"> 38 </span><span class="subxFunction">read-byte-buffered</span>: <span class="subxComment"># f : (addr buffered-file) -&gt; byte-or-Eof/eax</span>
<span id="L39" class="LineNr"> 39 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L40" class="LineNr"> 40 </span> 55/push-ebp
<span id="L41" class="LineNr"> 41 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -334,7 +334,7 @@ if ('onhashchange' in window) {
<span id="L272" class="LineNr">272 </span>
<span id="L273" class="LineNr">273 </span><span class="subxComment"># a test buffered file for _test-stream</span>
<span id="L274" class="LineNr">274 </span><span class="subxMinorFunction">_test-buffered-file</span>: <span class="subxComment"># (ref buffered-file)</span>
<span id="L275" class="LineNr">275 </span> <span class="subxComment"># file descriptor or (address stream byte)</span>
<span id="L275" class="LineNr">275 </span> <span class="subxComment"># file descriptor or (addr stream byte)</span>
<span id="L276" class="LineNr">276 </span> <a href='057write.subx.html#L148'>_test-stream</a>/imm32
<span id="L277" class="LineNr">277 </span><span class="Constant">$_test-buffered-file-&gt;buffer</span>:
<span id="L278" class="LineNr">278 </span> <span class="subxComment"># current write index</span>
@ -373,7 +373,7 @@ if ('onhashchange' in window) {
<span id="L311" class="LineNr">311 </span>
<span id="L312" class="LineNr">312 </span><span class="subxComment"># a test buffered file for _test-input-stream</span>
<span id="L313" class="LineNr">313 </span><span class="subxMinorFunction">_test-input-buffered-file</span>: <span class="subxComment"># (ref buffered-file)</span>
<span id="L314" class="LineNr">314 </span> <span class="subxComment"># file descriptor or (address stream byte)</span>
<span id="L314" class="LineNr">314 </span> <span class="subxComment"># file descriptor or (addr stream byte)</span>
<span id="L315" class="LineNr">315 </span> <a href='061read-byte.subx.html#L287'>_test-input-stream</a>/imm32
<span id="L316" class="LineNr">316 </span><span class="Constant">$_test-input-buffered-file-&gt;buffer</span>:
<span id="L317" class="LineNr">317 </span> <span class="subxComment"># current write index</span>

View File

@ -76,7 +76,7 @@ if ('onhashchange' in window) {
<span id="L15" class="LineNr"> 15 </span><span class="CommentedCode">#? b8/copy-to-eax 1/imm32/exit</span>
<span id="L16" class="LineNr"> 16 </span><span class="CommentedCode">#? cd/syscall 0x80/imm8</span>
<span id="L17" class="LineNr"> 17 </span>
<span id="L18" class="LineNr"> 18 </span><span class="subxFunction">write-stream</span>: <span class="subxComment"># f : fd or (address stream byte), s : (address stream byte)</span>
<span id="L18" class="LineNr"> 18 </span><span class="subxFunction">write-stream</span>: <span class="subxComment"># f : fd or (addr stream byte), s : (addr stream byte)</span>
<span id="L19" class="LineNr"> 19 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L20" class="LineNr"> 20 </span> 55/push-ebp
<span id="L21" class="LineNr"> 21 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -136,7 +136,7 @@ if ('onhashchange' in window) {
<span id="L75" class="LineNr"> 75 </span> 5d/pop-to-ebp
<span id="L76" class="LineNr"> 76 </span> c3/return
<span id="L77" class="LineNr"> 77 </span>
<span id="L78" class="LineNr"> 78 </span><span class="subxMinorFunction">_write-stream</span>: <span class="subxComment"># fd : int, s : (address stream byte)</span>
<span id="L78" class="LineNr"> 78 </span><span class="subxMinorFunction">_write-stream</span>: <span class="subxComment"># fd : int, s : (addr stream byte)</span>
<span id="L79" class="LineNr"> 79 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L80" class="LineNr"> 80 </span> 55/push-ebp
<span id="L81" class="LineNr"> 81 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -65,7 +65,7 @@ if ('onhashchange' in window) {
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># write(out, &quot;Error: &quot;+msg+&quot;\n&quot;) then stop(ed, 1)</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">error</span>: <span class="subxComment"># ed : (address exit-descriptor), out : fd or (address stream byte), msg : (address array byte)</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">error</span>: <span class="subxComment"># ed : (addr exit-descriptor), out : fd or (addr stream byte), msg : (addr array byte)</span>
<span id="L10" class="LineNr">10 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L11" class="LineNr">11 </span> 55/push-ebp
<span id="L12" class="LineNr">12 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -70,7 +70,7 @@ if ('onhashchange' in window) {
<span id="L8" class="LineNr"> 8 </span>
<span id="L9" class="LineNr"> 9 </span><span class="subxComment"># The buffered file for standard output.</span>
<span id="L10" class="LineNr"> 10 </span><span class="SpecialChar">Stdout</span>: <span class="subxComment"># (ref buffered-file)</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxComment"># file descriptor or (address stream byte)</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxComment"># file descriptor or (addr stream byte)</span>
<span id="L12" class="LineNr"> 12 </span> 1/imm32 <span class="subxComment"># standard output</span>
<span id="L13" class="LineNr"> 13 </span><span class="Constant">$Stdout-&gt;buffer</span>:
<span id="L14" class="LineNr"> 14 </span> <span class="subxComment"># inlined fields for a stream</span>
@ -92,7 +92,7 @@ if ('onhashchange' in window) {
<span id="L30" class="LineNr"> 30 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L31" class="LineNr"> 31 </span>
<span id="L32" class="LineNr"> 32 </span><span class="subxComment"># Write lower byte of 'n' to 'f'.</span>
<span id="L33" class="LineNr"> 33 </span><span class="subxFunction">write-byte-buffered</span>: <span class="subxComment"># f : (address buffered-file), n : int</span>
<span id="L33" class="LineNr"> 33 </span><span class="subxFunction">write-byte-buffered</span>: <span class="subxComment"># f : (addr buffered-file), n : int</span>
<span id="L34" class="LineNr"> 34 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L35" class="LineNr"> 35 </span> 55/push-ebp
<span id="L36" class="LineNr"> 36 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -140,7 +140,7 @@ if ('onhashchange' in window) {
<span id="L78" class="LineNr"> 78 </span> 5d/pop-to-ebp
<span id="L79" class="LineNr"> 79 </span> c3/return
<span id="L80" class="LineNr"> 80 </span>
<span id="L81" class="LineNr"> 81 </span><span class="subxFunction">flush</span>: <span class="subxComment"># f : (address buffered-file)</span>
<span id="L81" class="LineNr"> 81 </span><span class="subxFunction">flush</span>: <span class="subxComment"># f : (addr buffered-file)</span>
<span id="L82" class="LineNr"> 82 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L83" class="LineNr"> 83 </span> 55/push-ebp
<span id="L84" class="LineNr"> 84 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -267,7 +267,7 @@ if ('onhashchange' in window) {
<span id="L205" class="LineNr">205 </span><span class="subxH1Comment"># - variant without buffering</span>
<span id="L206" class="LineNr">206 </span>
<span id="L207" class="LineNr">207 </span><span class="subxComment"># Write lower byte of 'n' to 'f'.</span>
<span id="L208" class="LineNr">208 </span><span class="subxFunction">append-byte</span>: <span class="subxComment"># f : (address stream byte), n : int</span>
<span id="L208" class="LineNr">208 </span><span class="subxFunction">append-byte</span>: <span class="subxComment"># f : (addr stream byte), n : int</span>
<span id="L209" class="LineNr">209 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L210" class="LineNr">210 </span> 55/push-ebp
<span id="L211" class="LineNr">211 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -388,7 +388,7 @@ if ('onhashchange' in window) {
<span id="L326" class="LineNr">326 </span>
<span id="L327" class="LineNr">327 </span><span class="subxComment"># a test buffered file for _test-output-stream</span>
<span id="L328" class="LineNr">328 </span><span class="subxMinorFunction">_test-output-buffered-file</span>: <span class="subxComment"># (ref buffered-file)</span>
<span id="L329" class="LineNr">329 </span> <span class="subxComment"># file descriptor or (address stream byte)</span>
<span id="L329" class="LineNr">329 </span> <span class="subxComment"># file descriptor or (addr stream byte)</span>
<span id="L330" class="LineNr">330 </span> <a href='064write-byte.subx.html#L286'>_test-output-stream</a>/imm32
<span id="L331" class="LineNr">331 </span><span class="Constant">$_test-output-buffered-file-&gt;buffer</span>:
<span id="L332" class="LineNr">332 </span> <span class="subxComment"># current write index</span>
@ -419,7 +419,7 @@ if ('onhashchange' in window) {
<span id="L357" class="LineNr">357 </span>
<span id="L358" class="LineNr">358 </span><span class="subxComment"># a test buffered file for _test-error-stream</span>
<span id="L359" class="LineNr">359 </span><span class="subxMinorFunction">_test-error-buffered-file</span>: <span class="subxComment"># (ref buffered-file)</span>
<span id="L360" class="LineNr">360 </span> <span class="subxComment"># file descriptor or (address stream byte)</span>
<span id="L360" class="LineNr">360 </span> <span class="subxComment"># file descriptor or (addr stream byte)</span>
<span id="L361" class="LineNr">361 </span> <a href='064write-byte.subx.html#L341'>_test-error-stream</a>/imm32
<span id="L362" class="LineNr">362 </span><span class="Constant">$_test-error-buffered-file-&gt;buffer</span>:
<span id="L363" class="LineNr">363 </span> <span class="subxComment"># current write index</span>

View File

@ -66,7 +66,7 @@ if ('onhashchange' in window) {
<span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">write-buffered</span>: <span class="subxComment"># f : (address buffered-file), msg : (address array byte)</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">write-buffered</span>: <span class="subxComment"># f : (addr buffered-file), msg : (addr array byte)</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxComment"># pseudocode:</span>
<span id="L10" class="LineNr"> 10 </span> <span class="subxComment"># in = msg-&gt;data</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxComment"># inend = &amp;msg-&gt;data[msg-&gt;length]</span>
@ -99,9 +99,9 @@ if ('onhashchange' in window) {
<span id="L38" class="LineNr"> 38 </span> 57/push-edi
<span id="L39" class="LineNr"> 39 </span> <span class="subxComment"># eax = msg</span>
<span id="L40" class="LineNr"> 40 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to eax</span>
<span id="L41" class="LineNr"> 41 </span> <span class="subxComment"># var in/esi : (address byte) = msg-&gt;data</span>
<span id="L41" class="LineNr"> 41 </span> <span class="subxComment"># var in/esi : (addr byte) = msg-&gt;data</span>
<span id="L42" class="LineNr"> 42 </span> 8d/copy-address 1/mod/*+disp8 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy eax+4 to esi</span>
<span id="L43" class="LineNr"> 43 </span> <span class="subxComment"># var inend/ecx : (address byte) = &amp;msg-&gt;data[msg-&gt;length]</span>
<span id="L43" class="LineNr"> 43 </span> <span class="subxComment"># var inend/ecx : (addr byte) = &amp;msg-&gt;data[msg-&gt;length]</span>
<span id="L44" class="LineNr"> 44 </span> 8b/copy 0/mod/indirect 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *eax to ecx</span>
<span id="L45" class="LineNr"> 45 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 6/base/esi 1/index/ecx <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esi+ecx to ecx</span>
<span id="L46" class="LineNr"> 46 </span> <span class="subxComment"># edi = f</span>
@ -268,7 +268,7 @@ if ('onhashchange' in window) {
<span id="L207" class="LineNr">207 </span>
<span id="L208" class="LineNr">208 </span><span class="subxComment"># The buffered file for standard error.</span>
<span id="L209" class="LineNr">209 </span><span class="SpecialChar">Stderr</span>: <span class="subxComment"># (ref buffered-file)</span>
<span id="L210" class="LineNr">210 </span> <span class="subxComment"># file descriptor or (address stream byte)</span>
<span id="L210" class="LineNr">210 </span> <span class="subxComment"># file descriptor or (addr stream byte)</span>
<span id="L211" class="LineNr">211 </span> 2/imm32 <span class="subxComment"># standard error</span>
<span id="L212" class="LineNr">212 </span><span class="Constant">$Stderr-&gt;buffer</span>:
<span id="L213" class="LineNr">213 </span> <span class="subxComment"># inlined fields for a stream</span>

View File

@ -79,7 +79,7 @@ if ('onhashchange' in window) {
<span id="L18" class="LineNr"> 18 </span> 05/add-to-eax 0x57/imm32/a-10
<span id="L19" class="LineNr"> 19 </span> c3/return
<span id="L20" class="LineNr"> 20 </span>
<span id="L21" class="LineNr"> 21 </span><span class="subxFunction">append-byte-hex</span>: <span class="subxComment"># f : (address stream byte), n : int</span>
<span id="L21" class="LineNr"> 21 </span><span class="subxFunction">append-byte-hex</span>: <span class="subxComment"># f : (addr stream byte), n : int</span>
<span id="L22" class="LineNr"> 22 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L23" class="LineNr"> 23 </span> 55/push-ebp
<span id="L24" class="LineNr"> 24 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -151,7 +151,7 @@ if ('onhashchange' in window) {
<span id="L90" class="LineNr"> 90 </span> c3/return
<span id="L91" class="LineNr"> 91 </span>
<span id="L92" class="LineNr"> 92 </span><span class="subxComment"># print the hex representation for the lowest byte of a number</span>
<span id="L93" class="LineNr"> 93 </span><span class="subxFunction">print-byte-buffered</span>: <span class="subxComment"># f : (address buffered-file), n : int</span>
<span id="L93" class="LineNr"> 93 </span><span class="subxFunction">print-byte-buffered</span>: <span class="subxComment"># f : (addr buffered-file), n : int</span>
<span id="L94" class="LineNr"> 94 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L95" class="LineNr"> 95 </span> 55/push-ebp
<span id="L96" class="LineNr"> 96 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -236,7 +236,7 @@ if ('onhashchange' in window) {
<span id="L175" class="LineNr">175 </span> <span class="subxS1Comment"># . end</span>
<span id="L176" class="LineNr">176 </span> c3/return
<span id="L177" class="LineNr">177 </span>
<span id="L178" class="LineNr">178 </span><span class="subxFunction">print-int32</span>: <span class="subxComment"># f : (address stream byte), n : int</span>
<span id="L178" class="LineNr">178 </span><span class="subxFunction">print-int32</span>: <span class="subxComment"># f : (addr stream byte), n : int</span>
<span id="L179" class="LineNr">179 </span> <span class="subxComment"># pseudocode:</span>
<span id="L180" class="LineNr">180 </span> <span class="subxComment"># write(f, &quot;0x&quot;)</span>
<span id="L181" class="LineNr">181 </span> <span class="subxComment"># ecx = 28</span>
@ -324,7 +324,7 @@ if ('onhashchange' in window) {
<span id="L263" class="LineNr">263 </span> <span class="subxS1Comment"># . end</span>
<span id="L264" class="LineNr">264 </span> c3/return
<span id="L265" class="LineNr">265 </span>
<span id="L266" class="LineNr">266 </span><span class="subxFunction">print-int32-buffered</span>: <span class="subxComment"># f : (address buffered-file), n : int</span>
<span id="L266" class="LineNr">266 </span><span class="subxFunction">print-int32-buffered</span>: <span class="subxComment"># f : (addr buffered-file), n : int</span>
<span id="L267" class="LineNr">267 </span> <span class="subxComment"># pseudocode:</span>
<span id="L268" class="LineNr">268 </span> <span class="subxComment"># write-buffered(f, &quot;0x&quot;)</span>
<span id="L269" class="LineNr">269 </span> <span class="subxComment"># ecx = 28</span>

View File

@ -66,7 +66,7 @@ if ('onhashchange' in window) {
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L8" class="LineNr"> 8 </span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">is-hex-int?</span>: <span class="subxComment"># in : (address slice) -&gt; eax : boolean</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">is-hex-int?</span>: <span class="subxComment"># in : (addr slice) -&gt; eax : boolean</span>
<span id="L10" class="LineNr"> 10 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L11" class="LineNr"> 11 </span> 55/push-ebp
<span id="L12" class="LineNr"> 12 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -78,7 +78,7 @@ if ('onhashchange' in window) {
<span id="L18" class="LineNr"> 18 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to ecx</span>
<span id="L19" class="LineNr"> 19 </span> <span class="subxComment"># edx = s-&gt;end</span>
<span id="L20" class="LineNr"> 20 </span> 8b/copy 1/mod/*+disp8 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ecx+4) to edx</span>
<span id="L21" class="LineNr"> 21 </span> <span class="subxComment"># var curr/ecx : (address byte) = s-&gt;start</span>
<span id="L21" class="LineNr"> 21 </span> <span class="subxComment"># var curr/ecx : (addr byte) = s-&gt;start</span>
<span id="L22" class="LineNr"> 22 </span> 8b/copy 0/mod/indirect 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *ecx to ecx</span>
<span id="L23" class="LineNr"> 23 </span> <span class="subxComment"># if s is empty return false</span>
<span id="L24" class="LineNr"> 24 </span> b8/copy-to-eax 0/imm32/false
@ -411,7 +411,7 @@ if ('onhashchange' in window) {
<span id="L351" class="LineNr">351 </span> 5d/pop-to-ebp
<span id="L352" class="LineNr">352 </span> c3/return
<span id="L353" class="LineNr">353 </span>
<span id="L354" class="LineNr">354 </span><span class="subxFunction">parse-hex-int</span>: <span class="subxComment"># in : (address slice) -&gt; result/eax : int</span>
<span id="L354" class="LineNr">354 </span><span class="subxFunction">parse-hex-int</span>: <span class="subxComment"># in : (addr slice) -&gt; result/eax : int</span>
<span id="L355" class="LineNr">355 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L356" class="LineNr">356 </span> 55/push-ebp
<span id="L357" class="LineNr">357 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -426,7 +426,7 @@ if ('onhashchange' in window) {
<span id="L366" class="LineNr">366 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to ecx</span>
<span id="L367" class="LineNr">367 </span> <span class="subxComment"># edx = in-&gt;end</span>
<span id="L368" class="LineNr">368 </span> 8b/copy 1/mod/*+disp8 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ecx+4) to edx</span>
<span id="L369" class="LineNr">369 </span> <span class="subxComment"># var curr/ecx : (address byte) = in-&gt;start</span>
<span id="L369" class="LineNr">369 </span> <span class="subxComment"># var curr/ecx : (addr byte) = in-&gt;start</span>
<span id="L370" class="LineNr">370 </span> 8b/copy 0/mod/indirect 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *ecx to ecx</span>
<span id="L371" class="LineNr">371 </span> <span class="subxComment"># var negate?/esi : boolean = false</span>
<span id="L372" class="LineNr">372 </span> 31/xor 3/mod/direct 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear esi</span>

View File

@ -84,7 +84,7 @@ if ('onhashchange' in window) {
<span id="L24" class="LineNr">24 </span><span class="CommentedCode">#? cd/syscall 0x80/imm8</span>
<span id="L25" class="LineNr">25 </span>
<span id="L26" class="LineNr">26 </span><span class="subxComment"># write(out, &quot;Error: &quot;+msg+&quot;: &quot;+byte) then stop(ed, 1)</span>
<span id="L27" class="LineNr">27 </span><span class="subxFunction">error-byte</span>: <span class="subxComment"># ed : (address exit-descriptor), out : (address buffered-file), msg : (address array byte), n : byte</span>
<span id="L27" class="LineNr">27 </span><span class="subxFunction">error-byte</span>: <span class="subxComment"># ed : (addr exit-descriptor), out : (addr buffered-file), msg : (addr array byte), n : byte</span>
<span id="L28" class="LineNr">28 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L29" class="LineNr">29 </span> 55/push-ebp
<span id="L30" class="LineNr">30 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -117,7 +117,7 @@ if ('onhashchange' in window) {
<span id="L56" class="LineNr"> 56 </span>
<span id="L57" class="LineNr"> 57 </span><span class="subxComment"># Claim the next 'n' bytes of memory starting at ad-&gt;curr and update ad-&gt;curr.</span>
<span id="L58" class="LineNr"> 58 </span><span class="subxComment"># Abort if there isn't enough memory in 'ad'.</span>
<span id="L59" class="LineNr"> 59 </span><span class="subxFunction">allocate</span>: <span class="subxComment"># ad : (address allocation-descriptor), n : int -&gt; address-or-null/eax : (address _)</span>
<span id="L59" class="LineNr"> 59 </span><span class="subxFunction">allocate</span>: <span class="subxComment"># ad : (addr allocation-descriptor), n : int -&gt; address-or-null/eax : (addr _)</span>
<span id="L60" class="LineNr"> 60 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L61" class="LineNr"> 61 </span> 55/push-ebp
<span id="L62" class="LineNr"> 62 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -241,7 +241,7 @@ if ('onhashchange' in window) {
<span id="L180" class="LineNr">180 </span> c3/return
<span id="L181" class="LineNr">181 </span>
<span id="L182" class="LineNr">182 </span><span class="subxComment"># helper: create a nested allocation descriptor (useful for tests)</span>
<span id="L183" class="LineNr">183 </span><span class="subxFunction">allocate-region</span>: <span class="subxComment"># ad : (address allocation-descriptor), n : int -&gt; new-ad : (handle allocation-descriptor)</span>
<span id="L183" class="LineNr">183 </span><span class="subxFunction">allocate-region</span>: <span class="subxComment"># ad : (addr allocation-descriptor), n : int -&gt; new-ad : (handle allocation-descriptor)</span>
<span id="L184" class="LineNr">184 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L185" class="LineNr">185 </span> 55/push-ebp
<span id="L186" class="LineNr">186 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">new-stream</span>: <span class="subxComment"># ad : (address allocation-descriptor), length : int, elemsize : int -&gt; address/eax : (handle stream _)</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">new-stream</span>: <span class="subxComment"># ad : (addr allocation-descriptor), length : int, elemsize : int -&gt; address/eax : (handle stream _)</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L10" class="LineNr"> 10 </span> 55/push-ebp
<span id="L11" class="LineNr"> 11 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -66,7 +66,7 @@ if ('onhashchange' in window) {
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># read bytes from 'f' until (and including) a newline and store them into 's'</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># 's' fails to grow if and only if no data found</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># just abort if 's' is too small</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">read-line-buffered</span>: <span class="subxComment"># f : (address buffered-file), s : (address stream byte)</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">read-line-buffered</span>: <span class="subxComment"># f : (addr buffered-file), s : (addr stream byte)</span>
<span id="L10" class="LineNr"> 10 </span> <span class="subxComment"># pseudocode:</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxComment"># while true</span>
<span id="L12" class="LineNr"> 12 </span> <span class="subxComment"># if (s-&gt;write &gt;= s-&gt;length) abort</span>
@ -276,7 +276,7 @@ if ('onhashchange' in window) {
<span id="L216" class="LineNr">216 </span><span class="subxComment"># read bytes from 'f' until (and including) a newline and store them into 's'</span>
<span id="L217" class="LineNr">217 </span><span class="subxComment"># 's' fails to grow if and only if no data found</span>
<span id="L218" class="LineNr">218 </span><span class="subxComment"># just abort if 's' is too small</span>
<span id="L219" class="LineNr">219 </span><span class="subxFunction">read-line</span>: <span class="subxComment"># f : (address stream byte), s : (address stream byte)</span>
<span id="L219" class="LineNr">219 </span><span class="subxFunction">read-line</span>: <span class="subxComment"># f : (addr stream byte), s : (addr stream byte)</span>
<span id="L220" class="LineNr">220 </span> <span class="subxComment"># pseudocode:</span>
<span id="L221" class="LineNr">221 </span> <span class="subxComment"># while true</span>
<span id="L222" class="LineNr">222 </span> <span class="subxComment"># if (s-&gt;write &gt;= s-&gt;length) abort</span>

View File

@ -67,7 +67,7 @@ if ('onhashchange' in window) {
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L8" class="LineNr"> 8 </span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">slice-empty?</span>: <span class="subxComment"># s : (address slice) -&gt; eax : boolean</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">slice-empty?</span>: <span class="subxComment"># s : (addr slice) -&gt; eax : boolean</span>
<span id="L10" class="LineNr"> 10 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L11" class="LineNr"> 11 </span> 55/push-ebp
<span id="L12" class="LineNr"> 12 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -149,7 +149,7 @@ if ('onhashchange' in window) {
<span id="L88" class="LineNr"> 88 </span> 5d/pop-to-ebp
<span id="L89" class="LineNr"> 89 </span> c3/return
<span id="L90" class="LineNr"> 90 </span>
<span id="L91" class="LineNr"> 91 </span><span class="subxFunction">slice-equal?</span>: <span class="subxComment"># s : (address slice), p : (address array byte) -&gt; eax : boolean</span>
<span id="L91" class="LineNr"> 91 </span><span class="subxFunction">slice-equal?</span>: <span class="subxComment"># s : (addr slice), p : (addr array byte) -&gt; eax : boolean</span>
<span id="L92" class="LineNr"> 92 </span> <span class="subxComment"># pseudocode:</span>
<span id="L93" class="LineNr"> 93 </span> <span class="subxComment"># if (p == 0) return (s == 0)</span>
<span id="L94" class="LineNr"> 94 </span> <span class="subxComment"># currs = s-&gt;start</span>
@ -179,9 +179,9 @@ if ('onhashchange' in window) {
<span id="L118" class="LineNr"> 118 </span> 56/push-esi
<span id="L119" class="LineNr"> 119 </span> <span class="subxComment"># esi = s</span>
<span id="L120" class="LineNr"> 120 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L121" class="LineNr"> 121 </span> <span class="subxComment"># var currs/edx : (address byte) = s-&gt;start</span>
<span id="L121" class="LineNr"> 121 </span> <span class="subxComment"># var currs/edx : (addr byte) = s-&gt;start</span>
<span id="L122" class="LineNr"> 122 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L123" class="LineNr"> 123 </span> <span class="subxComment"># var maxs/esi : (address byte) = s-&gt;end</span>
<span id="L123" class="LineNr"> 123 </span> <span class="subxComment"># var maxs/esi : (addr byte) = s-&gt;end</span>
<span id="L124" class="LineNr"> 124 </span> 8b/copy 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esi+4) to esi</span>
<span id="L125" class="LineNr"> 125 </span> <span class="subxComment"># var slen/eax : int = maxs - currs</span>
<span id="L126" class="LineNr"> 126 </span> 89/copy 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esi to eax</span>
@ -200,7 +200,7 @@ if ('onhashchange' in window) {
<span id="L139" class="LineNr"> 139 </span> <span class="subxComment"># if (slen != p-&gt;length) return false</span>
<span id="L140" class="LineNr"> 140 </span> 39/compare 0/mod/indirect 3/rm32/ebx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare *ebx and eax</span>
<span id="L141" class="LineNr"> 141 </span> 75/jump-if-not-equal $slice-equal?:false/disp8
<span id="L142" class="LineNr"> 142 </span> <span class="subxComment"># var currp/ebx : (address byte) = p-&gt;data</span>
<span id="L142" class="LineNr"> 142 </span> <span class="subxComment"># var currp/ebx : (addr byte) = p-&gt;data</span>
<span id="L143" class="LineNr"> 143 </span> 81 0/subop/add 3/mod/direct 3/rm32/ebx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to ebx</span>
<span id="L144" class="LineNr"> 144 </span> <span class="subxComment"># var c1/eax : byte = 0</span>
<span id="L145" class="LineNr"> 145 </span> 31/xor 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear eax</span>
@ -516,7 +516,7 @@ if ('onhashchange' in window) {
<span id="L455" class="LineNr"> 455 </span> 5d/pop-to-ebp
<span id="L456" class="LineNr"> 456 </span> c3/return
<span id="L457" class="LineNr"> 457 </span>
<span id="L458" class="LineNr"> 458 </span><span class="subxFunction">slice-starts-with?</span>: <span class="subxComment"># s : (address slice), head : (address array byte) -&gt; eax : boolean</span>
<span id="L458" class="LineNr"> 458 </span><span class="subxFunction">slice-starts-with?</span>: <span class="subxComment"># s : (addr slice), head : (addr array byte) -&gt; eax : boolean</span>
<span id="L459" class="LineNr"> 459 </span> <span class="subxComment"># pseudocode</span>
<span id="L460" class="LineNr"> 460 </span> <span class="subxComment"># lenh = head-&gt;length</span>
<span id="L461" class="LineNr"> 461 </span> <span class="subxComment"># if (lenh &gt; s-&gt;end - s-&gt;start) return false</span>
@ -559,9 +559,9 @@ if ('onhashchange' in window) {
<span id="L498" class="LineNr"> 498 </span> <span class="subxComment"># if (lenh &gt; lens) return false</span>
<span id="L499" class="LineNr"> 499 </span> 39/compare 3/mod/direct 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare edx with ecx</span>
<span id="L500" class="LineNr"> 500 </span> 7f/jump-if-greater $slice-starts-with?:false/disp8
<span id="L501" class="LineNr"> 501 </span> <span class="subxComment"># var currs/esi : (address byte) = s-&gt;start</span>
<span id="L501" class="LineNr"> 501 </span> <span class="subxComment"># var currs/esi : (addr byte) = s-&gt;start</span>
<span id="L502" class="LineNr"> 502 </span> 8b/subtract 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to esi</span>
<span id="L503" class="LineNr"> 503 </span> <span class="subxComment"># var currh/edi : (address byte) = head-&gt;data</span>
<span id="L503" class="LineNr"> 503 </span> <span class="subxComment"># var currh/edi : (addr byte) = head-&gt;data</span>
<span id="L504" class="LineNr"> 504 </span> 81 0/subop/add 3/mod/direct 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to edi</span>
<span id="L505" class="LineNr"> 505 </span> <span class="subxComment"># var i/ecx : int = 0</span>
<span id="L506" class="LineNr"> 506 </span> 31/xor 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear ecx</span>
@ -822,7 +822,7 @@ if ('onhashchange' in window) {
<span id="L761" class="LineNr"> 761 </span>
<span id="L762" class="LineNr"> 762 </span><span class="subxComment"># write a slice to a stream</span>
<span id="L763" class="LineNr"> 763 </span><span class="subxComment"># abort if the stream doesn't have enough space</span>
<span id="L764" class="LineNr"> 764 </span><span class="subxFunction">write-slice</span>: <span class="subxComment"># out : (address stream byte), s : (address slice)</span>
<span id="L764" class="LineNr"> 764 </span><span class="subxFunction">write-slice</span>: <span class="subxComment"># out : (addr stream byte), s : (addr slice)</span>
<span id="L765" class="LineNr"> 765 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L766" class="LineNr"> 766 </span> 55/push-ebp
<span id="L767" class="LineNr"> 767 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -835,9 +835,9 @@ if ('onhashchange' in window) {
<span id="L774" class="LineNr"> 774 </span> 57/push-edi
<span id="L775" class="LineNr"> 775 </span> <span class="subxComment"># esi = s</span>
<span id="L776" class="LineNr"> 776 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to esi</span>
<span id="L777" class="LineNr"> 777 </span> <span class="subxComment"># var curr/ecx : (address byte) = s-&gt;start</span>
<span id="L777" class="LineNr"> 777 </span> <span class="subxComment"># var curr/ecx : (addr byte) = s-&gt;start</span>
<span id="L778" class="LineNr"> 778 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to ecx</span>
<span id="L779" class="LineNr"> 779 </span> <span class="subxComment"># var max/esi : (address byte) = s-&gt;end</span>
<span id="L779" class="LineNr"> 779 </span> <span class="subxComment"># var max/esi : (addr byte) = s-&gt;end</span>
<span id="L780" class="LineNr"> 780 </span> 8b/copy 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esi+4) to esi</span>
<span id="L781" class="LineNr"> 781 </span> <span class="subxComment"># edi = out</span>
<span id="L782" class="LineNr"> 782 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to edi</span>
@ -938,7 +938,7 @@ if ('onhashchange' in window) {
<span id="L877" class="LineNr"> 877 </span> c3/return
<span id="L878" class="LineNr"> 878 </span>
<span id="L879" class="LineNr"> 879 </span><span class="subxComment"># write a slice to a buffered-file</span>
<span id="L880" class="LineNr"> 880 </span><span class="subxFunction">write-slice-buffered</span>: <span class="subxComment"># out : (address buffered-file), s : (address slice)</span>
<span id="L880" class="LineNr"> 880 </span><span class="subxFunction">write-slice-buffered</span>: <span class="subxComment"># out : (addr buffered-file), s : (addr slice)</span>
<span id="L881" class="LineNr"> 881 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L882" class="LineNr"> 882 </span> 55/push-ebp
<span id="L883" class="LineNr"> 883 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -951,9 +951,9 @@ if ('onhashchange' in window) {
<span id="L890" class="LineNr"> 890 </span> 57/push-edi
<span id="L891" class="LineNr"> 891 </span> <span class="subxComment"># esi = s</span>
<span id="L892" class="LineNr"> 892 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to esi</span>
<span id="L893" class="LineNr"> 893 </span> <span class="subxComment"># var curr/ecx : (address byte) = s-&gt;start</span>
<span id="L893" class="LineNr"> 893 </span> <span class="subxComment"># var curr/ecx : (addr byte) = s-&gt;start</span>
<span id="L894" class="LineNr"> 894 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to ecx</span>
<span id="L895" class="LineNr"> 895 </span> <span class="subxComment"># var max/esi : (address byte) = s-&gt;end</span>
<span id="L895" class="LineNr"> 895 </span> <span class="subxComment"># var max/esi : (addr byte) = s-&gt;end</span>
<span id="L896" class="LineNr"> 896 </span> 8b/copy 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esi+4) to esi</span>
<span id="L897" class="LineNr"> 897 </span> <span class="subxComment"># edi = out</span>
<span id="L898" class="LineNr"> 898 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to edi</span>
@ -1073,7 +1073,7 @@ if ('onhashchange' in window) {
<span id="L1012" class="LineNr">1012 </span> c3/return
<span id="L1013" class="LineNr">1013 </span>
<span id="L1014" class="LineNr">1014 </span><span class="subxComment"># copy a slice into a new (dynamically allocated) string</span>
<span id="L1015" class="LineNr">1015 </span><span class="subxFunction">slice-to-string</span>: <span class="subxComment"># ad : (address allocation-descriptor), in : (address slice) -&gt; out/eax : (address array byte)</span>
<span id="L1015" class="LineNr">1015 </span><span class="subxFunction">slice-to-string</span>: <span class="subxComment"># ad : (addr allocation-descriptor), in : (addr slice) -&gt; out/eax : (addr array byte)</span>
<span id="L1016" class="LineNr">1016 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L1017" class="LineNr">1017 </span> 55/push-ebp
<span id="L1018" class="LineNr">1018 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -1084,9 +1084,9 @@ if ('onhashchange' in window) {
<span id="L1023" class="LineNr">1023 </span> 56/push-esi
<span id="L1024" class="LineNr">1024 </span> <span class="subxComment"># esi = in</span>
<span id="L1025" class="LineNr">1025 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to esi</span>
<span id="L1026" class="LineNr">1026 </span> <span class="subxComment"># var curr/edx : (address byte) = in-&gt;start</span>
<span id="L1026" class="LineNr">1026 </span> <span class="subxComment"># var curr/edx : (addr byte) = in-&gt;start</span>
<span id="L1027" class="LineNr">1027 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L1028" class="LineNr">1028 </span> <span class="subxComment"># var max/ebx : (address byte) = in-&gt;end</span>
<span id="L1028" class="LineNr">1028 </span> <span class="subxComment"># var max/ebx : (addr byte) = in-&gt;end</span>
<span id="L1029" class="LineNr">1029 </span> 8b/copy 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 3/r32/ebx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esi+4) to ebx</span>
<span id="L1030" class="LineNr">1030 </span> <span class="subxComment"># var size/ecx : int = max - curr + 4 # total size of output string (including the initial length)</span>
<span id="L1031" class="LineNr">1031 </span> 89/copy 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 3/r32/ebx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ebx to ecx</span>

View File

@ -66,7 +66,7 @@ if ('onhashchange' in window) {
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># extract the next run of characters that are different from a given 'delimiter' (skipping multiple delimiters if necessary)</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxComment"># on reaching end of file, return an empty interval</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxFunction">next-token</span>: <span class="subxComment"># in : (address stream byte), delimiter : byte, out : (address slice)</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxFunction">next-token</span>: <span class="subxComment"># in : (addr stream byte), delimiter : byte, out : (addr slice)</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L12" class="LineNr"> 12 </span> 55/push-ebp
<span id="L13" class="LineNr"> 13 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -219,7 +219,7 @@ if ('onhashchange' in window) {
<span id="L160" class="LineNr"> 160 </span>
<span id="L161" class="LineNr"> 161 </span><span class="subxComment"># extract the next run of characters that are different from a given 'delimiter' (skipping multiple delimiters if necessary)</span>
<span id="L162" class="LineNr"> 162 </span><span class="subxComment"># on reaching end of file, return an empty interval</span>
<span id="L163" class="LineNr"> 163 </span><span class="subxFunction">next-token-from-slice</span>: <span class="subxComment"># start : (address byte), end : (address byte), delimiter : byte, out : (address slice)</span>
<span id="L163" class="LineNr"> 163 </span><span class="subxFunction">next-token-from-slice</span>: <span class="subxComment"># start : (addr byte), end : (addr byte), delimiter : byte, out : (addr slice)</span>
<span id="L164" class="LineNr"> 164 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L165" class="LineNr"> 165 </span> 55/push-ebp
<span id="L166" class="LineNr"> 166 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -397,7 +397,7 @@ if ('onhashchange' in window) {
<span id="L338" class="LineNr"> 338 </span> 5d/pop-to-ebp
<span id="L339" class="LineNr"> 339 </span> c3/return
<span id="L340" class="LineNr"> 340 </span>
<span id="L341" class="LineNr"> 341 </span><span class="subxFunction">skip-chars-matching</span>: <span class="subxComment"># in : (address stream byte), delimiter : byte</span>
<span id="L341" class="LineNr"> 341 </span><span class="subxFunction">skip-chars-matching</span>: <span class="subxComment"># in : (addr stream byte), delimiter : byte</span>
<span id="L342" class="LineNr"> 342 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L343" class="LineNr"> 343 </span> 55/push-ebp
<span id="L344" class="LineNr"> 344 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -520,7 +520,7 @@ if ('onhashchange' in window) {
<span id="L461" class="LineNr"> 461 </span> <span class="subxComment"># end</span>
<span id="L462" class="LineNr"> 462 </span> c3/return
<span id="L463" class="LineNr"> 463 </span>
<span id="L464" class="LineNr"> 464 </span><span class="subxFunction">skip-chars-matching-whitespace</span>: <span class="subxComment"># in : (address stream byte)</span>
<span id="L464" class="LineNr"> 464 </span><span class="subxFunction">skip-chars-matching-whitespace</span>: <span class="subxComment"># in : (addr stream byte)</span>
<span id="L465" class="LineNr"> 465 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L466" class="LineNr"> 466 </span> 55/push-ebp
<span id="L467" class="LineNr"> 467 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -610,7 +610,7 @@ if ('onhashchange' in window) {
<span id="L551" class="LineNr"> 551 </span> c3/return
<span id="L552" class="LineNr"> 552 </span>
<span id="L553" class="LineNr"> 553 </span><span class="subxComment"># minor fork of 'skip-chars-matching'</span>
<span id="L554" class="LineNr"> 554 </span><span class="subxFunction">skip-chars-not-matching</span>: <span class="subxComment"># in : (address stream byte), delimiter : byte</span>
<span id="L554" class="LineNr"> 554 </span><span class="subxFunction">skip-chars-not-matching</span>: <span class="subxComment"># in : (addr stream byte), delimiter : byte</span>
<span id="L555" class="LineNr"> 555 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L556" class="LineNr"> 556 </span> 55/push-ebp
<span id="L557" class="LineNr"> 557 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -772,7 +772,7 @@ if ('onhashchange' in window) {
<span id="L713" class="LineNr"> 713 </span> <span class="subxComment"># end</span>
<span id="L714" class="LineNr"> 714 </span> c3/return
<span id="L715" class="LineNr"> 715 </span>
<span id="L716" class="LineNr"> 716 </span><span class="subxFunction">skip-chars-not-matching-whitespace</span>: <span class="subxComment"># in : (address stream byte)</span>
<span id="L716" class="LineNr"> 716 </span><span class="subxFunction">skip-chars-not-matching-whitespace</span>: <span class="subxComment"># in : (addr stream byte)</span>
<span id="L717" class="LineNr"> 717 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L718" class="LineNr"> 718 </span> 55/push-ebp
<span id="L719" class="LineNr"> 719 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -860,7 +860,7 @@ if ('onhashchange' in window) {
<span id="L801" class="LineNr"> 801 </span> <span class="subxComment"># end</span>
<span id="L802" class="LineNr"> 802 </span> c3/return
<span id="L803" class="LineNr"> 803 </span>
<span id="L804" class="LineNr"> 804 </span><span class="subxFunction">skip-chars-matching-in-slice</span>: <span class="subxComment"># curr : (address byte), end : (address byte), delimiter : byte -&gt; curr/eax</span>
<span id="L804" class="LineNr"> 804 </span><span class="subxFunction">skip-chars-matching-in-slice</span>: <span class="subxComment"># curr : (addr byte), end : (addr byte), delimiter : byte -&gt; curr/eax</span>
<span id="L805" class="LineNr"> 805 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L806" class="LineNr"> 806 </span> 55/push-ebp
<span id="L807" class="LineNr"> 807 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -956,7 +956,7 @@ if ('onhashchange' in window) {
<span id="L897" class="LineNr"> 897 </span> <span class="subxComment"># end</span>
<span id="L898" class="LineNr"> 898 </span> c3/return
<span id="L899" class="LineNr"> 899 </span>
<span id="L900" class="LineNr"> 900 </span><span class="subxFunction">skip-chars-matching-whitespace-in-slice</span>: <span class="subxComment"># curr : (address byte), end : (address byte) -&gt; curr/eax</span>
<span id="L900" class="LineNr"> 900 </span><span class="subxFunction">skip-chars-matching-whitespace-in-slice</span>: <span class="subxComment"># curr : (addr byte), end : (addr byte) -&gt; curr/eax</span>
<span id="L901" class="LineNr"> 901 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L902" class="LineNr"> 902 </span> 55/push-ebp
<span id="L903" class="LineNr"> 903 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -1029,7 +1029,7 @@ if ('onhashchange' in window) {
<span id="L970" class="LineNr"> 970 </span> c3/return
<span id="L971" class="LineNr"> 971 </span>
<span id="L972" class="LineNr"> 972 </span><span class="subxComment"># minor fork of 'skip-chars-matching-in-slice'</span>
<span id="L973" class="LineNr"> 973 </span><span class="subxFunction">skip-chars-not-matching-in-slice</span>: <span class="subxComment"># curr : (address byte), end : (address byte), delimiter : byte -&gt; curr/eax</span>
<span id="L973" class="LineNr"> 973 </span><span class="subxFunction">skip-chars-not-matching-in-slice</span>: <span class="subxComment"># curr : (addr byte), end : (addr byte), delimiter : byte -&gt; curr/eax</span>
<span id="L974" class="LineNr"> 974 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L975" class="LineNr"> 975 </span> 55/push-ebp
<span id="L976" class="LineNr"> 976 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -1154,7 +1154,7 @@ if ('onhashchange' in window) {
<span id="L1095" class="LineNr">1095 </span> <span class="subxComment"># end</span>
<span id="L1096" class="LineNr">1096 </span> c3/return
<span id="L1097" class="LineNr">1097 </span>
<span id="L1098" class="LineNr">1098 </span><span class="subxFunction">skip-chars-not-matching-whitespace-in-slice</span>: <span class="subxComment"># curr : (address byte), end : (address byte) -&gt; curr/eax</span>
<span id="L1098" class="LineNr">1098 </span><span class="subxFunction">skip-chars-not-matching-whitespace-in-slice</span>: <span class="subxComment"># curr : (addr byte), end : (addr byte) -&gt; curr/eax</span>
<span id="L1099" class="LineNr">1099 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L1100" class="LineNr">1100 </span> 55/push-ebp
<span id="L1101" class="LineNr">1101 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -1227,7 +1227,7 @@ if ('onhashchange' in window) {
<span id="L1168" class="LineNr">1168 </span>
<span id="L1169" class="LineNr">1169 </span><span class="subxComment"># update line-&gt;read to end of string literal surrounded by double quotes</span>
<span id="L1170" class="LineNr">1170 </span><span class="subxComment"># line-&gt;read must start out at a double-quote</span>
<span id="L1171" class="LineNr">1171 </span><span class="subxFunction">skip-string</span>: <span class="subxComment"># line : (address stream byte)</span>
<span id="L1171" class="LineNr">1171 </span><span class="subxFunction">skip-string</span>: <span class="subxComment"># line : (addr stream byte)</span>
<span id="L1172" class="LineNr">1172 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L1173" class="LineNr">1173 </span> 55/push-ebp
<span id="L1174" class="LineNr">1174 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -1469,7 +1469,7 @@ if ('onhashchange' in window) {
<span id="L1410" class="LineNr">1410 </span> 5d/pop-to-ebp
<span id="L1411" class="LineNr">1411 </span> c3/return
<span id="L1412" class="LineNr">1412 </span>
<span id="L1413" class="LineNr">1413 </span><span class="subxFunction">skip-string-in-slice</span>: <span class="subxComment"># curr : (address byte), end : (address byte) -&gt; new_curr/eax</span>
<span id="L1413" class="LineNr">1413 </span><span class="subxFunction">skip-string-in-slice</span>: <span class="subxComment"># curr : (addr byte), end : (addr byte) -&gt; new_curr/eax</span>
<span id="L1414" class="LineNr">1414 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L1415" class="LineNr">1415 </span> 55/push-ebp
<span id="L1416" class="LineNr">1416 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -1655,7 +1655,7 @@ if ('onhashchange' in window) {
<span id="L1596" class="LineNr">1596 </span>
<span id="L1597" class="LineNr">1597 </span><span class="subxComment"># update line-&gt;read to ')'</span>
<span id="L1598" class="LineNr">1598 </span><span class="subxComment"># line-&gt;read ends at ')'</span>
<span id="L1599" class="LineNr">1599 </span><span class="subxFunction">skip-until-close-paren</span>: <span class="subxComment"># line : (address stream byte)</span>
<span id="L1599" class="LineNr">1599 </span><span class="subxFunction">skip-until-close-paren</span>: <span class="subxComment"># line : (addr stream byte)</span>
<span id="L1600" class="LineNr">1600 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L1601" class="LineNr">1601 </span> 55/push-ebp
<span id="L1602" class="LineNr">1602 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -1842,7 +1842,7 @@ if ('onhashchange' in window) {
<span id="L1783" class="LineNr">1783 </span> 5d/pop-to-ebp
<span id="L1784" class="LineNr">1784 </span> c3/return
<span id="L1785" class="LineNr">1785 </span>
<span id="L1786" class="LineNr">1786 </span><span class="subxFunction">skip-until-close-paren-in-slice</span>: <span class="subxComment"># curr : (address byte), end : (address byte) -&gt; new_curr/eax : (address byte)</span>
<span id="L1786" class="LineNr">1786 </span><span class="subxFunction">skip-until-close-paren-in-slice</span>: <span class="subxComment"># curr : (addr byte), end : (addr byte) -&gt; new_curr/eax : (addr byte)</span>
<span id="L1787" class="LineNr">1787 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L1788" class="LineNr">1788 </span> 55/push-ebp
<span id="L1789" class="LineNr">1789 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -67,7 +67,7 @@ if ('onhashchange' in window) {
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># - construct a 'maximal slice' and pass it to write-slice-buffered</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxComment"># - flush the buffered-file and pass the stream directly to its fd (disabling buffering)</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxComment"># we'll go with the first way for now</span>
<span id="L11" class="LineNr"> 11 </span><span class="subxFunction">write-stream-data</span>: <span class="subxComment"># f : (address buffered-file), s : (address stream byte)</span>
<span id="L11" class="LineNr"> 11 </span><span class="subxFunction">write-stream-data</span>: <span class="subxComment"># f : (addr buffered-file), s : (addr stream byte)</span>
<span id="L12" class="LineNr"> 12 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L13" class="LineNr"> 13 </span> 55/push-ebp
<span id="L14" class="LineNr"> 14 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -66,7 +66,7 @@ if ('onhashchange' in window) {
<span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">print-int32-decimal</span>: <span class="subxComment"># out : (address stream byte), n : int32</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">print-int32-decimal</span>: <span class="subxComment"># out : (addr stream byte), n : int32</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxComment"># works by generating characters from lowest to highest and pushing them</span>
<span id="L10" class="LineNr"> 10 </span> <span class="subxComment"># to the stack, before popping them one by one into the stream</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxComment">#</span>
@ -137,9 +137,9 @@ if ('onhashchange' in window) {
<span id="L76" class="LineNr"> 76 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to edi</span>
<span id="L77" class="LineNr"> 77 </span> <span class="subxComment"># var w/edx : int = out-&gt;write</span>
<span id="L78" class="LineNr"> 78 </span> 8b/copy 0/mod/indirect 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *edi to edx</span>
<span id="L79" class="LineNr"> 79 </span> <span class="subxComment"># var curr/ecx : (address byte) = &amp;out-&gt;data[out-&gt;write]</span>
<span id="L79" class="LineNr"> 79 </span> <span class="subxComment"># var curr/ecx : (addr byte) = &amp;out-&gt;data[out-&gt;write]</span>
<span id="L80" class="LineNr"> 80 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 2/index/edx <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy ebx+edx+12 to ecx</span>
<span id="L81" class="LineNr"> 81 </span> <span class="subxComment"># var max/ebx : (address byte) = &amp;out-&gt;data[out-&gt;length]</span>
<span id="L81" class="LineNr"> 81 </span> <span class="subxComment"># var max/ebx : (addr byte) = &amp;out-&gt;data[out-&gt;length]</span>
<span id="L82" class="LineNr"> 82 </span> 8b/copy 1/mod/*+disp8 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 3/r32/ebx 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(edi+8) to ebx</span>
<span id="L83" class="LineNr"> 83 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx <span class="Normal"> . </span> 3/r32/ebx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy edi+ebx+12 to ebx</span>
<span id="L84" class="LineNr"> 84 </span><span class="Constant">$print-int32-decimal:write-loop</span>:

View File

@ -66,7 +66,7 @@ if ('onhashchange' in window) {
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># (re)compute the bounds of the next word in the line</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxComment"># return empty string on reaching end of file</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxFunction">next-word</span>: <span class="subxComment"># line : (address stream byte), out : (address slice)</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxFunction">next-word</span>: <span class="subxComment"># line : (addr stream byte), out : (addr slice)</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L12" class="LineNr"> 12 </span> 55/push-ebp
<span id="L13" class="LineNr"> 13 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">has-metadata?</span>: <span class="subxComment"># word : (address slice), s : (address string) -&gt; eax : boolean</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">has-metadata?</span>: <span class="subxComment"># word : (addr slice), s : (addr string) -&gt; eax : boolean</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxComment"># pseudocode:</span>
<span id="L10" class="LineNr"> 10 </span> <span class="subxComment"># var twig : &amp;slice = next-token-from-slice(word-&gt;start, word-&gt;end, '/') # skip name</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxComment"># curr = twig-&gt;end</span>
@ -84,7 +84,7 @@ if ('onhashchange' in window) {
<span id="L25" class="LineNr"> 25 </span> 57/push-edi
<span id="L26" class="LineNr"> 26 </span> <span class="subxComment"># esi = word</span>
<span id="L27" class="LineNr"> 27 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L28" class="LineNr"> 28 </span> <span class="subxComment"># var edx : (address byte) = word-&gt;end</span>
<span id="L28" class="LineNr"> 28 </span> <span class="subxComment"># var edx : (addr byte) = word-&gt;end</span>
<span id="L29" class="LineNr"> 29 </span> 8b/copy 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esi+4) to edx</span>
<span id="L30" class="LineNr"> 30 </span> <span class="subxComment"># var twig/edi : (ref slice)</span>
<span id="L31" class="LineNr"> 31 </span> 68/push 0/imm32/end
@ -334,7 +334,7 @@ if ('onhashchange' in window) {
<span id="L275" class="LineNr">275 </span><span class="subxComment">#: - if it starts with '0x' it's treated as a number. (redundant)</span>
<span id="L276" class="LineNr">276 </span><span class="subxComment">#: - if it's two characters long, it can't be a name. Either it's a hex</span>
<span id="L277" class="LineNr">277 </span><span class="subxComment">#: byte, or it raises an error.</span>
<span id="L278" class="LineNr">278 </span><span class="subxFunction">is-valid-name?</span>: <span class="subxComment"># in : (address slice) -&gt; eax : boolean</span>
<span id="L278" class="LineNr">278 </span><span class="subxFunction">is-valid-name?</span>: <span class="subxComment"># in : (addr slice) -&gt; eax : boolean</span>
<span id="L279" class="LineNr">279 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L280" class="LineNr">280 </span> 55/push-ebp
<span id="L281" class="LineNr">281 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -343,7 +343,7 @@ if ('onhashchange' in window) {
<span id="L284" class="LineNr">284 </span> 56/push-esi
<span id="L285" class="LineNr">285 </span> <span class="subxComment"># esi = in</span>
<span id="L286" class="LineNr">286 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L287" class="LineNr">287 </span> <span class="subxComment"># var start/ecx : (address byte) = in-&gt;start</span>
<span id="L287" class="LineNr">287 </span> <span class="subxComment"># var start/ecx : (addr byte) = in-&gt;start</span>
<span id="L288" class="LineNr">288 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to ecx</span>
<span id="L289" class="LineNr">289 </span><span class="Constant">$is-valid-name?:check0</span>:
<span id="L290" class="LineNr">290 </span> <span class="subxComment"># if (start &gt;= in-&gt;end) return false</span>
@ -357,7 +357,7 @@ if ('onhashchange' in window) {
<span id="L298" class="LineNr">298 </span> 3d/compare-eax-and 2/imm32
<span id="L299" class="LineNr">299 </span> 74/jump-if-equal $is-valid-name?:false/disp8
<span id="L300" class="LineNr">300 </span><span class="Constant">$is-valid-name?:check2</span>:
<span id="L301" class="LineNr">301 </span> <span class="subxComment"># var c/eax : (address byte) = *start</span>
<span id="L301" class="LineNr">301 </span> <span class="subxComment"># var c/eax : (addr byte) = *start</span>
<span id="L302" class="LineNr">302 </span> 31/xor 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear eax</span>
<span id="L303" class="LineNr">303 </span> 8a/copy-byte 0/mod/indirect 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/AL <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy byte at *ecx to AL</span>
<span id="L304" class="LineNr">304 </span> <span class="subxComment"># if (c == &quot;-&quot;) return false</span>
@ -591,7 +591,7 @@ if ('onhashchange' in window) {
<span id="L532" class="LineNr">532 </span> 5d/pop-to-ebp
<span id="L533" class="LineNr">533 </span> c3/return
<span id="L534" class="LineNr">534 </span>
<span id="L535" class="LineNr">535 </span><span class="subxFunction">is-label?</span>: <span class="subxComment"># word : (address slice) -&gt; eax : boolean</span>
<span id="L535" class="LineNr">535 </span><span class="subxFunction">is-label?</span>: <span class="subxComment"># word : (addr slice) -&gt; eax : boolean</span>
<span id="L536" class="LineNr">536 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L537" class="LineNr">537 </span> 55/push-ebp
<span id="L538" class="LineNr">538 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -599,7 +599,7 @@ if ('onhashchange' in window) {
<span id="L540" class="LineNr">540 </span> 51/push-ecx
<span id="L541" class="LineNr">541 </span> <span class="subxComment"># ecx = word</span>
<span id="L542" class="LineNr">542 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to ecx</span>
<span id="L543" class="LineNr">543 </span> <span class="subxComment"># var end/ecx : (address byte) = word-&gt;end</span>
<span id="L543" class="LineNr">543 </span> <span class="subxComment"># var end/ecx : (addr byte) = word-&gt;end</span>
<span id="L544" class="LineNr">544 </span> 8b/copy 1/mod/*+disp8 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ecx+4) to ecx</span>
<span id="L545" class="LineNr">545 </span> <span class="subxComment"># return *(end - 1) == ':'</span>
<span id="L546" class="LineNr">546 </span> <span class="subxS1Comment"># . eax = *(end-1)</span>

View File

@ -63,7 +63,7 @@ if ('onhashchange' in window) {
<span id="L4" class="LineNr"> 4 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L5" class="LineNr"> 5 </span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># print 'n' in hex in 'width' bytes in lower-endian order, with a space after every byte</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxFunction">emit-hex</span>: <span class="subxComment"># out : (address buffered-file), n : int, width : int</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxFunction">emit-hex</span>: <span class="subxComment"># out : (addr buffered-file), n : int, width : int</span>
<span id="L8" class="LineNr"> 8 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L9" class="LineNr"> 9 </span> 55/push-ebp
<span id="L10" class="LineNr"> 10 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -68,7 +68,7 @@ if ('onhashchange' in window) {
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># it in 'width' bytes of hex, least significant first.</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># Otherwise just print the entire word including metadata.</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxComment"># Always print a trailing space.</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxFunction">emit</span>: <span class="subxComment"># out : (address buffered-file), word : (address slice), width : int</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxFunction">emit</span>: <span class="subxComment"># out : (addr buffered-file), word : (addr slice), width : int</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L12" class="LineNr"> 12 </span> 55/push-ebp
<span id="L13" class="LineNr"> 13 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">zero-out</span>: <span class="subxComment"># start : (address byte), len : int</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">zero-out</span>: <span class="subxComment"># start : (addr byte), len : int</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxComment"># pseudocode:</span>
<span id="L10" class="LineNr">10 </span> <span class="subxComment"># curr/esi = start</span>
<span id="L11" class="LineNr">11 </span> <span class="subxComment"># i/ecx = 0</span>

View File

@ -61,7 +61,7 @@ if ('onhashchange' in window) {
<pre id='vimCodeElement'>
<span id="L1" class="LineNr"> 1 </span><span class="subxComment"># A table is a stream of (key, value) rows.</span>
<span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment"># Each row consists of a 4-byte key -- a 'string_key' which is (address array</span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment"># Each row consists of a 4-byte key -- a 'string_key' which is (addr array</span>
<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># byte) -- and a variable-size value.</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment">#</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># Accessing the table performs a linear scan for a key string, and always</span>
@ -84,8 +84,8 @@ if ('onhashchange' in window) {
<span id="L23" class="LineNr"> 23 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L24" class="LineNr"> 24 </span>
<span id="L25" class="LineNr"> 25 </span><span class="subxComment"># if no row is found, abort</span>
<span id="L26" class="LineNr"> 26 </span><span class="subxComment"># type string_key = (address array byte)</span>
<span id="L27" class="LineNr"> 27 </span><span class="subxFunction">get</span>: <span class="subxComment"># table : (address stream {string_key, T}), key : string_key, row-size : int, abort-message-prefix : (address array byte) -&gt; eax : (address T)</span>
<span id="L26" class="LineNr"> 26 </span><span class="subxComment"># type string_key = (addr array byte)</span>
<span id="L27" class="LineNr"> 27 </span><span class="subxFunction">get</span>: <span class="subxComment"># table : (addr stream {string_key, T}), key : string_key, row-size : int, abort-message-prefix : (addr array byte) -&gt; eax : (addr T)</span>
<span id="L28" class="LineNr"> 28 </span> <span class="subxComment"># pseudocode:</span>
<span id="L29" class="LineNr"> 29 </span> <span class="subxComment"># curr = table-&gt;data</span>
<span id="L30" class="LineNr"> 30 </span> <span class="subxComment"># max = &amp;table-&gt;data[table-&gt;write]</span>
@ -104,9 +104,9 @@ if ('onhashchange' in window) {
<span id="L43" class="LineNr"> 43 </span> 56/push-esi
<span id="L44" class="LineNr"> 44 </span> <span class="subxComment"># esi = table</span>
<span id="L45" class="LineNr"> 45 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L46" class="LineNr"> 46 </span> <span class="subxComment"># var curr/ecx : (address string_key) = table-&gt;data</span>
<span id="L46" class="LineNr"> 46 </span> <span class="subxComment"># var curr/ecx : (addr string_key) = table-&gt;data</span>
<span id="L47" class="LineNr"> 47 </span> 8d/copy-address 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+12 to ecx</span>
<span id="L48" class="LineNr"> 48 </span> <span class="subxComment"># var max/edx : (address byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L48" class="LineNr"> 48 </span> <span class="subxComment"># var max/edx : (addr byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L49" class="LineNr"> 49 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L50" class="LineNr"> 50 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ecx+edx to edx</span>
<span id="L51" class="LineNr"> 51 </span><span class="Constant">$get:search-loop</span>:
@ -259,7 +259,7 @@ if ('onhashchange' in window) {
<span id="L198" class="LineNr"> 198 </span> c3/return
<span id="L199" class="LineNr"> 199 </span>
<span id="L200" class="LineNr"> 200 </span><span class="subxComment"># if no row is found, abort</span>
<span id="L201" class="LineNr"> 201 </span><span class="subxFunction">get-slice</span>: <span class="subxComment"># table : (address stream {string_key, T}), key : (address slice), row-size : int, abort-message-prefix : (address array byte) -&gt; eax : (address T)</span>
<span id="L201" class="LineNr"> 201 </span><span class="subxFunction">get-slice</span>: <span class="subxComment"># table : (addr stream {string_key, T}), key : (addr slice), row-size : int, abort-message-prefix : (addr array byte) -&gt; eax : (addr T)</span>
<span id="L202" class="LineNr"> 202 </span> <span class="subxComment"># pseudocode:</span>
<span id="L203" class="LineNr"> 203 </span> <span class="subxComment"># curr = table-&gt;data</span>
<span id="L204" class="LineNr"> 204 </span> <span class="subxComment"># max = &amp;table-&gt;data[table-&gt;write]</span>
@ -278,9 +278,9 @@ if ('onhashchange' in window) {
<span id="L217" class="LineNr"> 217 </span> 56/push-esi
<span id="L218" class="LineNr"> 218 </span> <span class="subxComment"># esi = table</span>
<span id="L219" class="LineNr"> 219 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L220" class="LineNr"> 220 </span> <span class="subxComment"># var curr/ecx : (address string_key) = table-&gt;data</span>
<span id="L220" class="LineNr"> 220 </span> <span class="subxComment"># var curr/ecx : (addr string_key) = table-&gt;data</span>
<span id="L221" class="LineNr"> 221 </span> 8d/copy-address 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+12 to ecx</span>
<span id="L222" class="LineNr"> 222 </span> <span class="subxComment"># var max/edx : (address byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L222" class="LineNr"> 222 </span> <span class="subxComment"># var max/edx : (addr byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L223" class="LineNr"> 223 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L224" class="LineNr"> 224 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ecx+edx to edx</span>
<span id="L225" class="LineNr"> 225 </span><span class="Constant">$get-slice:search-loop</span>:
@ -462,7 +462,7 @@ if ('onhashchange' in window) {
<span id="L401" class="LineNr"> 401 </span><span class="subxComment"># return the address of the value</span>
<span id="L402" class="LineNr"> 402 </span><span class="subxComment"># Beware: assume keys are immutable; they're inserted by reference</span>
<span id="L403" class="LineNr"> 403 </span><span class="subxComment"># TODO: pass in an allocation descriptor</span>
<span id="L404" class="LineNr"> 404 </span><span class="subxFunction">get-or-insert</span>: <span class="subxComment"># table : (address stream {string_key, T}), key : string_key, row-size : int -&gt; eax : (address T)</span>
<span id="L404" class="LineNr"> 404 </span><span class="subxFunction">get-or-insert</span>: <span class="subxComment"># table : (addr stream {string_key, T}), key : string_key, row-size : int -&gt; eax : (addr T)</span>
<span id="L405" class="LineNr"> 405 </span> <span class="subxComment"># pseudocode:</span>
<span id="L406" class="LineNr"> 406 </span> <span class="subxComment"># curr = table-&gt;data</span>
<span id="L407" class="LineNr"> 407 </span> <span class="subxComment"># max = &amp;table-&gt;data[table-&gt;write]</span>
@ -486,9 +486,9 @@ if ('onhashchange' in window) {
<span id="L425" class="LineNr"> 425 </span> 56/push-esi
<span id="L426" class="LineNr"> 426 </span> <span class="subxComment"># esi = table</span>
<span id="L427" class="LineNr"> 427 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L428" class="LineNr"> 428 </span> <span class="subxComment"># var curr/ecx : (address string_key) = table-&gt;data</span>
<span id="L428" class="LineNr"> 428 </span> <span class="subxComment"># var curr/ecx : (addr string_key) = table-&gt;data</span>
<span id="L429" class="LineNr"> 429 </span> 8d/copy-address 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+12 to ecx</span>
<span id="L430" class="LineNr"> 430 </span> <span class="subxComment"># var max/edx : (address string_key) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L430" class="LineNr"> 430 </span> <span class="subxComment"># var max/edx : (addr string_key) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L431" class="LineNr"> 431 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L432" class="LineNr"> 432 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ecx+edx to edx</span>
<span id="L433" class="LineNr"> 433 </span><span class="Constant">$get-or-insert:search-loop</span>:
@ -713,7 +713,7 @@ if ('onhashchange' in window) {
<span id="L652" class="LineNr"> 652 </span><span class="subxComment"># if there are no rows free, abort</span>
<span id="L653" class="LineNr"> 653 </span><span class="subxComment"># WARNING: leaks memory</span>
<span id="L654" class="LineNr"> 654 </span><span class="subxComment"># TODO: pass in an allocation descriptor</span>
<span id="L655" class="LineNr"> 655 </span><span class="subxFunction">leaky-get-or-insert-slice</span>: <span class="subxComment"># table : (address stream {string_key, T}), key : (address slice), row-size : int -&gt; eax : (address T)</span>
<span id="L655" class="LineNr"> 655 </span><span class="subxFunction">leaky-get-or-insert-slice</span>: <span class="subxComment"># table : (addr stream {string_key, T}), key : (addr slice), row-size : int -&gt; eax : (addr T)</span>
<span id="L656" class="LineNr"> 656 </span> <span class="subxComment"># pseudocode:</span>
<span id="L657" class="LineNr"> 657 </span> <span class="subxComment"># curr = table-&gt;data</span>
<span id="L658" class="LineNr"> 658 </span> <span class="subxComment"># max = &amp;table-&gt;data[table-&gt;write]</span>
@ -737,9 +737,9 @@ if ('onhashchange' in window) {
<span id="L676" class="LineNr"> 676 </span> 56/push-esi
<span id="L677" class="LineNr"> 677 </span> <span class="subxComment"># esi = table</span>
<span id="L678" class="LineNr"> 678 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L679" class="LineNr"> 679 </span> <span class="subxComment"># var curr/ecx : (address string_key) = table-&gt;data</span>
<span id="L679" class="LineNr"> 679 </span> <span class="subxComment"># var curr/ecx : (addr string_key) = table-&gt;data</span>
<span id="L680" class="LineNr"> 680 </span> 8d/copy-address 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+12 to ecx</span>
<span id="L681" class="LineNr"> 681 </span> <span class="subxComment"># var max/edx : (address string_key) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L681" class="LineNr"> 681 </span> <span class="subxComment"># var max/edx : (addr string_key) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L682" class="LineNr"> 682 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L683" class="LineNr"> 683 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ecx+edx to edx</span>
<span id="L684" class="LineNr"> 684 </span><span class="Constant">$leaky-get-or-insert-slice:search-loop</span>:
@ -985,9 +985,9 @@ if ('onhashchange' in window) {
<span id="L924" class="LineNr"> 924 </span> c3/return
<span id="L925" class="LineNr"> 925 </span>
<span id="L926" class="LineNr"> 926 </span><span class="subxComment"># if no row is found, stop(ed)</span>
<span id="L927" class="LineNr"> 927 </span><span class="subxFunction">get-or-stop</span>: <span class="subxComment"># table : (address stream {string_key, T}), key : string_key, row-size : int,</span>
<span id="L928" class="LineNr"> 928 </span> <span class="subxComment"># abort-message-prefix : (address array byte), err : (address buffered-file), ed : (address exit-descriptor)</span>
<span id="L929" class="LineNr"> 929 </span> <span class="subxComment"># -&gt; eax : (address T)</span>
<span id="L927" class="LineNr"> 927 </span><span class="subxFunction">get-or-stop</span>: <span class="subxComment"># table : (addr stream {string_key, T}), key : string_key, row-size : int,</span>
<span id="L928" class="LineNr"> 928 </span> <span class="subxComment"># abort-message-prefix : (addr array byte), err : (addr buffered-file), ed : (addr exit-descriptor)</span>
<span id="L929" class="LineNr"> 929 </span> <span class="subxComment"># -&gt; eax : (addr T)</span>
<span id="L930" class="LineNr"> 930 </span> <span class="subxComment"># pseudocode:</span>
<span id="L931" class="LineNr"> 931 </span> <span class="subxComment"># curr = table-&gt;data</span>
<span id="L932" class="LineNr"> 932 </span> <span class="subxComment"># max = &amp;table-&gt;data[table-&gt;write]</span>
@ -1007,9 +1007,9 @@ if ('onhashchange' in window) {
<span id="L946" class="LineNr"> 946 </span> 56/push-esi
<span id="L947" class="LineNr"> 947 </span> <span class="subxComment"># esi = table</span>
<span id="L948" class="LineNr"> 948 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L949" class="LineNr"> 949 </span> <span class="subxComment"># var curr/ecx : (address string_key) = table-&gt;data</span>
<span id="L949" class="LineNr"> 949 </span> <span class="subxComment"># var curr/ecx : (addr string_key) = table-&gt;data</span>
<span id="L950" class="LineNr"> 950 </span> 8d/copy-address 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+12 to ecx</span>
<span id="L951" class="LineNr"> 951 </span> <span class="subxComment"># var max/edx : (address byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L951" class="LineNr"> 951 </span> <span class="subxComment"># var max/edx : (addr byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L952" class="LineNr"> 952 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L953" class="LineNr"> 953 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ecx+edx to edx</span>
<span id="L954" class="LineNr"> 954 </span><span class="Constant">$get-or-stop:search-loop</span>:
@ -1201,9 +1201,9 @@ if ('onhashchange' in window) {
<span id="L1140" class="LineNr">1140 </span> c3/return
<span id="L1141" class="LineNr">1141 </span>
<span id="L1142" class="LineNr">1142 </span><span class="subxComment"># if no row is found, stop(ed)</span>
<span id="L1143" class="LineNr">1143 </span><span class="subxFunction">get-slice-or-stop</span>: <span class="subxComment"># table : (address stream {string_key, _}), key : (address slice), row-size : int,</span>
<span id="L1144" class="LineNr">1144 </span> <span class="subxComment"># abort-message-prefix : (address string), err : (address buffered-file), ed : (address exit-descriptor)</span>
<span id="L1145" class="LineNr">1145 </span> <span class="subxComment"># -&gt; eax : (address _)</span>
<span id="L1143" class="LineNr">1143 </span><span class="subxFunction">get-slice-or-stop</span>: <span class="subxComment"># table : (addr stream {string_key, _}), key : (addr slice), row-size : int,</span>
<span id="L1144" class="LineNr">1144 </span> <span class="subxComment"># abort-message-prefix : (addr string), err : (addr buffered-file), ed : (addr exit-descriptor)</span>
<span id="L1145" class="LineNr">1145 </span> <span class="subxComment"># -&gt; eax : (addr _)</span>
<span id="L1146" class="LineNr">1146 </span> <span class="subxComment"># pseudocode:</span>
<span id="L1147" class="LineNr">1147 </span> <span class="subxComment"># curr = table-&gt;data</span>
<span id="L1148" class="LineNr">1148 </span> <span class="subxComment"># max = &amp;table-&gt;data[table-&gt;write]</span>
@ -1223,9 +1223,9 @@ if ('onhashchange' in window) {
<span id="L1162" class="LineNr">1162 </span> 56/push-esi
<span id="L1163" class="LineNr">1163 </span> <span class="subxComment"># esi = table</span>
<span id="L1164" class="LineNr">1164 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L1165" class="LineNr">1165 </span> <span class="subxComment"># var curr/ecx : (address string_key) = table-&gt;data</span>
<span id="L1165" class="LineNr">1165 </span> <span class="subxComment"># var curr/ecx : (addr string_key) = table-&gt;data</span>
<span id="L1166" class="LineNr">1166 </span> 8d/copy-address 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+12 to ecx</span>
<span id="L1167" class="LineNr">1167 </span> <span class="subxComment"># var max/edx : (address byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L1167" class="LineNr">1167 </span> <span class="subxComment"># var max/edx : (addr byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L1168" class="LineNr">1168 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L1169" class="LineNr">1169 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ecx+edx to edx</span>
<span id="L1170" class="LineNr">1170 </span><span class="Constant">$get-slice-or-stop:search-loop</span>:
@ -1440,7 +1440,7 @@ if ('onhashchange' in window) {
<span id="L1379" class="LineNr">1379 </span> c3/return
<span id="L1380" class="LineNr">1380 </span>
<span id="L1381" class="LineNr">1381 </span><span class="subxComment"># if no row is found, return null (0)</span>
<span id="L1382" class="LineNr">1382 </span><span class="subxFunction">maybe-get</span>: <span class="subxComment"># table : (address stream {string_key, T}), key : string_key, row-size : int -&gt; eax : (address T)</span>
<span id="L1382" class="LineNr">1382 </span><span class="subxFunction">maybe-get</span>: <span class="subxComment"># table : (addr stream {string_key, T}), key : string_key, row-size : int -&gt; eax : (addr T)</span>
<span id="L1383" class="LineNr">1383 </span> <span class="subxComment"># pseudocode:</span>
<span id="L1384" class="LineNr">1384 </span> <span class="subxComment"># curr = table-&gt;data</span>
<span id="L1385" class="LineNr">1385 </span> <span class="subxComment"># max = &amp;table-&gt;data[table-&gt;write]</span>
@ -1459,9 +1459,9 @@ if ('onhashchange' in window) {
<span id="L1398" class="LineNr">1398 </span> 56/push-esi
<span id="L1399" class="LineNr">1399 </span> <span class="subxComment"># esi = table</span>
<span id="L1400" class="LineNr">1400 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L1401" class="LineNr">1401 </span> <span class="subxComment"># var curr/ecx : (address string_key) = table-&gt;data</span>
<span id="L1401" class="LineNr">1401 </span> <span class="subxComment"># var curr/ecx : (addr string_key) = table-&gt;data</span>
<span id="L1402" class="LineNr">1402 </span> 8d/copy-address 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+12 to ecx</span>
<span id="L1403" class="LineNr">1403 </span> <span class="subxComment"># var max/edx : (address byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L1403" class="LineNr">1403 </span> <span class="subxComment"># var max/edx : (addr byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L1404" class="LineNr">1404 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L1405" class="LineNr">1405 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ecx+edx to edx</span>
<span id="L1406" class="LineNr">1406 </span><span class="Constant">$maybe-get:search-loop</span>:
@ -1587,7 +1587,7 @@ if ('onhashchange' in window) {
<span id="L1526" class="LineNr">1526 </span> c3/return
<span id="L1527" class="LineNr">1527 </span>
<span id="L1528" class="LineNr">1528 </span><span class="subxComment"># if no row is found, return null (0)</span>
<span id="L1529" class="LineNr">1529 </span><span class="subxFunction">maybe-get-slice</span>: <span class="subxComment"># table : (address stream {string_key, T}), key : (address slice), row-size : int -&gt; eax : (address T)</span>
<span id="L1529" class="LineNr">1529 </span><span class="subxFunction">maybe-get-slice</span>: <span class="subxComment"># table : (addr stream {string_key, T}), key : (addr slice), row-size : int -&gt; eax : (addr T)</span>
<span id="L1530" class="LineNr">1530 </span> <span class="subxComment"># pseudocode:</span>
<span id="L1531" class="LineNr">1531 </span> <span class="subxComment"># curr = table-&gt;data</span>
<span id="L1532" class="LineNr">1532 </span> <span class="subxComment"># max = &amp;table-&gt;data[table-&gt;write]</span>
@ -1606,9 +1606,9 @@ if ('onhashchange' in window) {
<span id="L1545" class="LineNr">1545 </span> 56/push-esi
<span id="L1546" class="LineNr">1546 </span> <span class="subxComment"># esi = table</span>
<span id="L1547" class="LineNr">1547 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L1548" class="LineNr">1548 </span> <span class="subxComment"># var curr/ecx : (address string_key) = table-&gt;data</span>
<span id="L1548" class="LineNr">1548 </span> <span class="subxComment"># var curr/ecx : (addr string_key) = table-&gt;data</span>
<span id="L1549" class="LineNr">1549 </span> 8d/copy-address 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+12 to ecx</span>
<span id="L1550" class="LineNr">1550 </span> <span class="subxComment"># var max/edx : (address byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L1550" class="LineNr">1550 </span> <span class="subxComment"># var max/edx : (addr byte) = &amp;table-&gt;data[table-&gt;write]</span>
<span id="L1551" class="LineNr">1551 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L1552" class="LineNr">1552 </span> 8d/copy-address 0/mod/indirect 4/rm32/sib 1/base/ecx 2/index/edx <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ecx+edx to edx</span>
<span id="L1553" class="LineNr">1553 </span><span class="Constant">$maybe-get-slice:search-loop</span>:

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L5" class="LineNr"> 5 </span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># read all bytes from 'f' and store them into 's'</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># abort if 's' is too small</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">slurp</span>: <span class="subxComment"># f : (address buffered-file), s : (address stream byte)</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">slurp</span>: <span class="subxComment"># f : (addr buffered-file), s : (addr stream byte)</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxComment"># pseudocode:</span>
<span id="L10" class="LineNr"> 10 </span> <span class="subxComment"># while true</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxComment"># if (s-&gt;write &gt;= s-&gt;length) abort</span>

View File

@ -67,7 +67,7 @@ if ('onhashchange' in window) {
<span id="L8" class="LineNr"> 8 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L10" class="LineNr"> 10 </span>
<span id="L11" class="LineNr"> 11 </span><span class="subxFunction">compute-width</span>: <span class="subxComment"># word : (address array byte) -&gt; eax : int</span>
<span id="L11" class="LineNr"> 11 </span><span class="subxFunction">compute-width</span>: <span class="subxComment"># word : (addr array byte) -&gt; eax : int</span>
<span id="L12" class="LineNr"> 12 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L13" class="LineNr"> 13 </span> 55/push-ebp
<span id="L14" class="LineNr"> 14 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -75,7 +75,7 @@ if ('onhashchange' in window) {
<span id="L16" class="LineNr"> 16 </span> 51/push-ecx
<span id="L17" class="LineNr"> 17 </span> <span class="subxComment"># eax = word</span>
<span id="L18" class="LineNr"> 18 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to ecx</span>
<span id="L19" class="LineNr"> 19 </span> <span class="subxComment"># var ecx : (address byte) = &amp;word[word-&gt;length]</span>
<span id="L19" class="LineNr"> 19 </span> <span class="subxComment"># var ecx : (addr byte) = &amp;word[word-&gt;length]</span>
<span id="L20" class="LineNr"> 20 </span> 8b/copy 0/mod/indirect 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *eax to ecx</span>
<span id="L21" class="LineNr"> 21 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx <span class="Normal"> . </span> 1/r32/ecx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy eax+ecx+4 to ecx</span>
<span id="L22" class="LineNr"> 22 </span> <span class="subxComment"># eax = word-&gt;data</span>
@ -101,7 +101,7 @@ if ('onhashchange' in window) {
<span id="L42" class="LineNr"> 42 </span> 5d/pop-to-ebp
<span id="L43" class="LineNr"> 43 </span> c3/return
<span id="L44" class="LineNr"> 44 </span>
<span id="L45" class="LineNr"> 45 </span><span class="subxFunction">compute-width-of-slice</span>: <span class="subxComment"># s : (address slice) -&gt; eax : int</span>
<span id="L45" class="LineNr"> 45 </span><span class="subxFunction">compute-width-of-slice</span>: <span class="subxComment"># s : (addr slice) -&gt; eax : int</span>
<span id="L46" class="LineNr"> 46 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L47" class="LineNr"> 47 </span> 55/push-ebp
<span id="L48" class="LineNr"> 48 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L4" class="LineNr"> 4 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L5" class="LineNr"> 5 </span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># print 'arr' in hex with a space after every byte</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxFunction">emit-hex-array</span>: <span class="subxComment"># out : (address buffered-file), arr : (address array byte)</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxFunction">emit-hex-array</span>: <span class="subxComment"># out : (addr buffered-file), arr : (addr array byte)</span>
<span id="L8" class="LineNr"> 8 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L9" class="LineNr"> 9 </span> 55/push-ebp
<span id="L10" class="LineNr"> 10 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -77,9 +77,9 @@ if ('onhashchange' in window) {
<span id="L17" class="LineNr"> 17 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 7/r32/edi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to edi</span>
<span id="L18" class="LineNr"> 18 </span> <span class="subxComment"># edx = arr</span>
<span id="L19" class="LineNr"> 19 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to edx</span>
<span id="L20" class="LineNr"> 20 </span> <span class="subxComment"># var curr/ecx : (address byte) = arr-&gt;data</span>
<span id="L20" class="LineNr"> 20 </span> <span class="subxComment"># var curr/ecx : (addr byte) = arr-&gt;data</span>
<span id="L21" class="LineNr"> 21 </span> 8d/copy-address 1/mod/*+disp8 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy edx+4 to ecx</span>
<span id="L22" class="LineNr"> 22 </span> <span class="subxComment"># var max/edx : (address byte) = &amp;arr-&gt;data[arr-&gt;length]</span>
<span id="L22" class="LineNr"> 22 </span> <span class="subxComment"># var max/edx : (addr byte) = &amp;arr-&gt;data[arr-&gt;length]</span>
<span id="L23" class="LineNr"> 23 </span> 8b/copy 0/mod/indirect 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *edx to edx</span>
<span id="L24" class="LineNr"> 24 </span> 01/add 3/mod/direct 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># add ecx to edx</span>
<span id="L25" class="LineNr"> 25 </span> <span class="subxComment"># var c/eax : byte = 0</span>

View File

@ -65,7 +65,7 @@ if ('onhashchange' in window) {
<span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">write-int</span>: <span class="subxComment"># out : (address stream byte), n : int</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">write-int</span>: <span class="subxComment"># out : (addr stream byte), n : int</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L10" class="LineNr"> 10 </span> 55/push-ebp
<span id="L11" class="LineNr"> 11 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -66,7 +66,7 @@ if ('onhashchange' in window) {
<span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">array-equal?</span>: <span class="subxComment"># a : (address array int), b : (address array int) -&gt; eax : boolean</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">array-equal?</span>: <span class="subxComment"># a : (addr array int), b : (addr array int) -&gt; eax : boolean</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxComment"># pseudocode:</span>
<span id="L10" class="LineNr"> 10 </span> <span class="subxComment"># lena = a-&gt;length</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxComment"># if (lena != b-&gt;length) return false</span>
@ -107,9 +107,9 @@ if ('onhashchange' in window) {
<span id="L46" class="LineNr"> 46 </span> <span class="subxComment"># if (lena != b-&gt;length) return false</span>
<span id="L47" class="LineNr"> 47 </span> 39/compare 0/mod/indirect 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare *edi and edx</span>
<span id="L48" class="LineNr"> 48 </span> 75/jump-if-not-equal $array-equal?:false/disp8
<span id="L49" class="LineNr"> 49 </span> <span class="subxComment"># var curra/esi : (address byte) = a-&gt;data</span>
<span id="L49" class="LineNr"> 49 </span> <span class="subxComment"># var curra/esi : (addr byte) = a-&gt;data</span>
<span id="L50" class="LineNr"> 50 </span> 81 0/subop/add 3/mod/direct 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to esi</span>
<span id="L51" class="LineNr"> 51 </span> <span class="subxComment"># var currb/edi : (address byte) = b-&gt;data</span>
<span id="L51" class="LineNr"> 51 </span> <span class="subxComment"># var currb/edi : (addr byte) = b-&gt;data</span>
<span id="L52" class="LineNr"> 52 </span> 81 0/subop/add 3/mod/direct 7/rm32/edi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/imm32 <span class="subxComment"># add to edi</span>
<span id="L53" class="LineNr"> 53 </span> <span class="subxComment"># var i/ecx : int = 0</span>
<span id="L54" class="LineNr"> 54 </span> 31/xor 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear ecx</span>
@ -291,7 +291,7 @@ if ('onhashchange' in window) {
<span id="L230" class="LineNr">230 </span> 5d/pop-to-ebp
<span id="L231" class="LineNr">231 </span> c3/return
<span id="L232" class="LineNr">232 </span>
<span id="L233" class="LineNr">233 </span><span class="subxFunction">parse-array-of-ints</span>: <span class="subxComment"># ad : (address allocation-descriptor), s : (address string) -&gt; result/eax : (handle array int)</span>
<span id="L233" class="LineNr">233 </span><span class="subxFunction">parse-array-of-ints</span>: <span class="subxComment"># ad : (addr allocation-descriptor), s : (addr string) -&gt; result/eax : (handle array int)</span>
<span id="L234" class="LineNr">234 </span> <span class="subxComment"># pseudocode</span>
<span id="L235" class="LineNr">235 </span> <span class="subxComment"># end = &amp;s-&gt;data[s-&gt;length]</span>
<span id="L236" class="LineNr">236 </span> <span class="subxComment"># curr = s-&gt;data</span>
@ -327,9 +327,9 @@ if ('onhashchange' in window) {
<span id="L266" class="LineNr">266 </span> 57/push-edi
<span id="L267" class="LineNr">267 </span> <span class="subxComment"># esi = s</span>
<span id="L268" class="LineNr">268 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to esi</span>
<span id="L269" class="LineNr">269 </span> <span class="subxComment"># var curr/ecx : (address byte) = s-&gt;data</span>
<span id="L269" class="LineNr">269 </span> <span class="subxComment"># var curr/ecx : (addr byte) = s-&gt;data</span>
<span id="L270" class="LineNr">270 </span> 8d/copy-address 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy esi+4 to ecx</span>
<span id="L271" class="LineNr">271 </span> <span class="subxComment"># var end/edx : (address byte) = &amp;s-&gt;data[s-&gt;length]</span>
<span id="L271" class="LineNr">271 </span> <span class="subxComment"># var end/edx : (addr byte) = &amp;s-&gt;data[s-&gt;length]</span>
<span id="L272" class="LineNr">272 </span> <span class="subxS1Comment"># . edx = s-&gt;length</span>
<span id="L273" class="LineNr">273 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L274" class="LineNr">274 </span> <span class="subxS1Comment"># . edx += curr</span>
@ -395,7 +395,7 @@ if ('onhashchange' in window) {
<span id="L334" class="LineNr">334 </span> 51/push-ecx
<span id="L335" class="LineNr">335 </span> <span class="subxS1Comment"># . bookmark</span>
<span id="L336" class="LineNr">336 </span> 89/copy 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ecx</span>
<span id="L337" class="LineNr">337 </span> <span class="subxComment"># var out/ebx : (address byte) = result-&gt;data</span>
<span id="L337" class="LineNr">337 </span> <span class="subxComment"># var out/ebx : (addr byte) = result-&gt;data</span>
<span id="L338" class="LineNr">338 </span> 8d/copy-address 1/mod/*+disp8 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 3/r32/ebx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy eax+4 to ebx</span>
<span id="L339" class="LineNr">339 </span><span class="Constant">$parse-array-of-ints:loop2</span>:
<span id="L340" class="LineNr">340 </span> <span class="subxComment"># if (slice-&gt;start &gt;= end) break</span>
@ -597,7 +597,7 @@ if ('onhashchange' in window) {
<span id="L536" class="LineNr">536 </span>
<span id="L537" class="LineNr">537 </span><span class="subxComment"># helper for later tests</span>
<span id="L538" class="LineNr">538 </span><span class="subxComment"># compare an array with a string representation of an array literal</span>
<span id="L539" class="LineNr">539 </span><span class="subxFunction">check-array-equal</span>: <span class="subxComment"># a : (address array int), expected : (address string), msg : (address string)</span>
<span id="L539" class="LineNr">539 </span><span class="subxFunction">check-array-equal</span>: <span class="subxComment"># a : (addr array int), expected : (addr string), msg : (addr string)</span>
<span id="L540" class="LineNr">540 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L541" class="LineNr">541 </span> 55/push-ebp
<span id="L542" class="LineNr">542 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L5" class="LineNr"> 5 </span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># (re)compute the bounds of the next word or string literal in the line</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># return empty string on reaching end of file</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">next-word-or-string</span>: <span class="subxComment"># line : (address stream byte), out : (address slice)</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">next-word-or-string</span>: <span class="subxComment"># line : (addr stream byte), out : (addr slice)</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L10" class="LineNr"> 10 </span> 55/push-ebp
<span id="L11" class="LineNr"> 11 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -67,7 +67,7 @@ if ('onhashchange' in window) {
<span id="L7" class="LineNr"> 7 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L9" class="LineNr"> 9 </span>
<span id="L10" class="LineNr"> 10 </span><span class="subxFunction">clear-stack</span>: <span class="subxComment"># s : (address stack)</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxFunction">clear-stack</span>: <span class="subxComment"># s : (addr stack)</span>
<span id="L11" class="LineNr"> 11 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L12" class="LineNr"> 12 </span> 55/push-ebp
<span id="L13" class="LineNr"> 13 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -76,12 +76,12 @@ if ('onhashchange' in window) {
<span id="L16" class="LineNr"> 16 </span> 51/push-ecx
<span id="L17" class="LineNr"> 17 </span> <span class="subxComment"># eax = s</span>
<span id="L18" class="LineNr"> 18 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to eax</span>
<span id="L19" class="LineNr"> 19 </span> <span class="subxComment"># var max/ecx : (address byte) = &amp;s-&gt;data[s-&gt;length]</span>
<span id="L19" class="LineNr"> 19 </span> <span class="subxComment"># var max/ecx : (addr byte) = &amp;s-&gt;data[s-&gt;length]</span>
<span id="L20" class="LineNr"> 20 </span> 8b/copy 1/mod/*+disp8 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(eax+4) to eax</span>
<span id="L21" class="LineNr"> 21 </span> 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx <span class="Normal"> . </span> 1/r32/ecx 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy eax+ecx+8 to ecx</span>
<span id="L22" class="LineNr"> 22 </span> <span class="subxComment"># s-&gt;top = 0</span>
<span id="L23" class="LineNr"> 23 </span> c7 0/subop/copy 0/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/imm32 <span class="subxComment"># copy to *eax</span>
<span id="L24" class="LineNr"> 24 </span> <span class="subxComment"># var curr/eax : (address byte) = s-&gt;data</span>
<span id="L24" class="LineNr"> 24 </span> <span class="subxComment"># var curr/eax : (addr byte) = s-&gt;data</span>
<span id="L25" class="LineNr"> 25 </span> 81 0/subop/add 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to eax</span>
<span id="L26" class="LineNr"> 26 </span><span class="Constant">$clear-stack:loop</span>:
<span id="L27" class="LineNr"> 27 </span> <span class="subxComment"># if (curr &gt;= max) break</span>
@ -167,7 +167,7 @@ if ('onhashchange' in window) {
<span id="L107" class="LineNr">107 </span> 5d/pop-to-ebp
<span id="L108" class="LineNr">108 </span> c3/return
<span id="L109" class="LineNr">109 </span>
<span id="L110" class="LineNr">110 </span><span class="subxFunction">push</span>: <span class="subxComment"># s : (address stack), n : int</span>
<span id="L110" class="LineNr">110 </span><span class="subxFunction">push</span>: <span class="subxComment"># s : (addr stack), n : int</span>
<span id="L111" class="LineNr">111 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L112" class="LineNr">112 </span> 55/push-ebp
<span id="L113" class="LineNr">113 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -287,7 +287,7 @@ if ('onhashchange' in window) {
<span id="L227" class="LineNr">227 </span> 5d/pop-to-ebp
<span id="L228" class="LineNr">228 </span> c3/return
<span id="L229" class="LineNr">229 </span>
<span id="L230" class="LineNr">230 </span><span class="subxFunction">pop</span>: <span class="subxComment"># s : (address stack) -&gt; n/eax : int</span>
<span id="L230" class="LineNr">230 </span><span class="subxFunction">pop</span>: <span class="subxComment"># s : (addr stack) -&gt; n/eax : int</span>
<span id="L231" class="LineNr">231 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L232" class="LineNr">232 </span> 55/push-ebp
<span id="L233" class="LineNr">233 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -391,7 +391,7 @@ if ('onhashchange' in window) {
<span id="L331" class="LineNr">331 </span> 5d/pop-to-ebp
<span id="L332" class="LineNr">332 </span> c3/return
<span id="L333" class="LineNr">333 </span>
<span id="L334" class="LineNr">334 </span><span class="subxFunction">top</span>: <span class="subxComment"># s : (address stack) -&gt; n/eax : int</span>
<span id="L334" class="LineNr">334 </span><span class="subxFunction">top</span>: <span class="subxComment"># s : (addr stack) -&gt; n/eax : int</span>
<span id="L335" class="LineNr">335 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L336" class="LineNr">336 </span> 55/push-ebp
<span id="L337" class="LineNr">337 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -145,12 +145,12 @@ if ('onhashchange' in window) {
<span id="L83" class="LineNr"> 83 </span> cd/syscall 0x80/imm8
<span id="L84" class="LineNr"> 84 </span>
<span id="L85" class="LineNr"> 85 </span><span class="subxComment"># data structure:</span>
<span id="L86" class="LineNr"> 86 </span><span class="subxComment"># table: (address stream {string, (address stream byte)}) (8 bytes per row)</span>
<span id="L86" class="LineNr"> 86 </span><span class="subxComment"># table: (addr stream {string, (addr stream byte)}) (8 bytes per row)</span>
<span id="L87" class="LineNr"> 87 </span><span class="subxComment"># inefficient; uses sequential search for looking up segments by name</span>
<span id="L88" class="LineNr"> 88 </span>
<span id="L89" class="LineNr"> 89 </span><span class="subxFunction">subx-assort</span>: <span class="subxComment"># in : (address buffered-file), out : (address buffered-file)</span>
<span id="L89" class="LineNr"> 89 </span><span class="subxFunction">subx-assort</span>: <span class="subxComment"># in : (addr buffered-file), out : (addr buffered-file)</span>
<span id="L90" class="LineNr"> 90 </span> <span class="subxComment"># pseudocode:</span>
<span id="L91" class="LineNr"> 91 </span> <span class="subxComment"># var table : (address stream {string, (address stream byte)} 10/rows)</span>
<span id="L91" class="LineNr"> 91 </span> <span class="subxComment"># var table : (addr stream {string, (addr stream byte)} 10/rows)</span>
<span id="L92" class="LineNr"> 92 </span> <span class="subxComment"># read-segments(in, table)</span>
<span id="L93" class="LineNr"> 93 </span> <span class="subxComment"># write-segments(out, table)</span>
<span id="L94" class="LineNr"> 94 </span> <span class="subxComment">#</span>
@ -159,7 +159,7 @@ if ('onhashchange' in window) {
<span id="L97" class="LineNr"> 97 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
<span id="L98" class="LineNr"> 98 </span> <span class="subxS1Comment"># . save registers</span>
<span id="L99" class="LineNr"> 99 </span> 51/push-ecx
<span id="L100" class="LineNr">100 </span> <span class="subxComment"># var table/ecx : (ref stream {string, (address stream byte)} 80) # 10 rows * 8 bytes/row</span>
<span id="L100" class="LineNr">100 </span> <span class="subxComment"># var table/ecx : (ref stream {string, (addr stream byte)} 80) # 10 rows * 8 bytes/row</span>
<span id="L101" class="LineNr">101 </span> 81 5/subop/subtract 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0x50/imm32 <span class="subxComment"># subtract from esp</span>
<span id="L102" class="LineNr">102 </span> 68/push 0x50/imm32/length
<span id="L103" class="LineNr">103 </span> 68/push 0/imm32/read
@ -464,10 +464,10 @@ if ('onhashchange' in window) {
<span id="L450" class="LineNr">450 </span> 5d/pop-to-ebp
<span id="L451" class="LineNr">451 </span> c3/return
<span id="L452" class="LineNr">452 </span>
<span id="L453" class="LineNr">453 </span><span class="subxComment"># type string_key = (address array byte)</span>
<span id="L453" class="LineNr">453 </span><span class="subxComment"># type string_key = (addr array byte)</span>
<span id="L454" class="LineNr">454 </span>
<span id="L455" class="LineNr">455 </span><span class="subxComment"># beware: leaks memory (one name per segment read)</span>
<span id="L456" class="LineNr">456 </span><span class="subxFunction">read-segments</span>: <span class="subxComment"># in : (address buffered-file), table : (address stream {string_key, (handle stream byte)})</span>
<span id="L456" class="LineNr">456 </span><span class="subxFunction">read-segments</span>: <span class="subxComment"># in : (addr buffered-file), table : (addr stream {string_key, (handle stream byte)})</span>
<span id="L457" class="LineNr">457 </span> <span class="subxComment"># pseudocode:</span>
<span id="L458" class="LineNr">458 </span> <span class="subxComment"># var curr-segment : (handle stream byte) = 0</span>
<span id="L459" class="LineNr">459 </span> <span class="subxComment"># var line : (stream byte 512)</span>
@ -565,7 +565,7 @@ if ('onhashchange' in window) {
<span id="L591" class="LineNr">591 </span><span class="Constant">$read-segments:check-for-comment</span>:
<span id="L592" class="Folded">592 </span><span class="Folded">+-- 9 lines: #? # print(&quot;check for comment\n&quot;) ----------------------------------------------------------------------------------------------------------</span>
<span id="L601" class="LineNr">601 </span> <span class="subxComment"># if (slice-starts-with?(word-slice, &quot;#&quot;)) continue</span>
<span id="L602" class="LineNr">602 </span> <span class="subxS1Comment"># . var start/esi : (address byte) = word-slice-&gt;start</span>
<span id="L602" class="LineNr">602 </span> <span class="subxS1Comment"># . var start/esi : (addr byte) = word-slice-&gt;start</span>
<span id="L603" class="LineNr">603 </span> 8b/copy 0/mod/indirect 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *ecx to esi</span>
<span id="L604" class="LineNr">604 </span> <span class="subxS1Comment"># . var c/eax : byte = *start</span>
<span id="L605" class="LineNr">605 </span> 31/xor 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear eax</span>
@ -597,7 +597,7 @@ if ('onhashchange' in window) {
<span id="L678" class="LineNr">678 </span> <span class="subxS2Comment"># . . discard args</span>
<span id="L679" class="LineNr">679 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span>
<span id="L680" class="Folded">680 </span><span class="Folded">+-- 40 lines: #? # dump segment name ---------------------------------------------------------------------------------------------------------------------</span>
<span id="L720" class="LineNr">720 </span> <span class="subxComment"># var segment-slot/eax : (address handle stream byte) = leaky-get-or-insert-slice(table, segment-name, row-size=8)</span>
<span id="L720" class="LineNr">720 </span> <span class="subxComment"># var segment-slot/eax : (addr handle stream byte) = leaky-get-or-insert-slice(table, segment-name, row-size=8)</span>
<span id="L721" class="LineNr">721 </span> <span class="subxS2Comment"># . . push args</span>
<span id="L722" class="LineNr">722 </span> 68/push 8/imm32/row-size
<span id="L723" class="LineNr">723 </span> 52/push-edx
@ -667,7 +667,7 @@ if ('onhashchange' in window) {
<span id="L843" class="LineNr">843 </span> 5d/pop-to-ebp
<span id="L844" class="LineNr">844 </span> c3/return
<span id="L845" class="LineNr">845 </span>
<span id="L846" class="LineNr">846 </span><span class="subxFunction">write-segments</span>: <span class="subxComment"># out : (address buffered-file), table : (address stream {string_key, (handle stream byte)})</span>
<span id="L846" class="LineNr">846 </span><span class="subxFunction">write-segments</span>: <span class="subxComment"># out : (addr buffered-file), table : (addr stream {string_key, (handle stream byte)})</span>
<span id="L847" class="LineNr">847 </span> <span class="subxComment"># pseudocode:</span>
<span id="L848" class="LineNr">848 </span> <span class="subxComment"># var curr = table-&gt;data</span>
<span id="L849" class="LineNr">849 </span> <span class="subxComment"># var max = &amp;table-&gt;data[table-&gt;write]</span>
@ -688,15 +688,15 @@ if ('onhashchange' in window) {
<span id="L864" class="LineNr">864 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to esi</span>
<span id="L865" class="LineNr">865 </span> <span class="subxComment"># var write/edx : int = table-&gt;write</span>
<span id="L866" class="LineNr">866 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L867" class="LineNr">867 </span> <span class="subxComment"># var curr/esi : (address byte) = table-&gt;data</span>
<span id="L867" class="LineNr">867 </span> <span class="subxComment"># var curr/esi : (addr byte) = table-&gt;data</span>
<span id="L868" class="LineNr">868 </span> 81 0/subop/add 3/mod/direct 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to eax</span>
<span id="L869" class="LineNr">869 </span> <span class="subxComment"># var max/edx : (address byte) = curr + write</span>
<span id="L869" class="LineNr">869 </span> <span class="subxComment"># var max/edx : (addr byte) = curr + write</span>
<span id="L870" class="LineNr">870 </span> 01/add 3/mod/direct 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># add esi to edx</span>
<span id="L871" class="LineNr">871 </span><span class="Constant">$write-segments:loop</span>:
<span id="L872" class="LineNr">872 </span> <span class="subxComment"># if (curr &gt;= max) break</span>
<span id="L873" class="LineNr">873 </span> 39/compare 3/mod/direct 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare esi with edx</span>
<span id="L874" class="LineNr">874 </span> 73/jump-if-greater-or-equal-unsigned $write-segments:<span class="Constant">break</span>/disp8
<span id="L875" class="LineNr">875 </span> <span class="subxComment"># var stream/eax : (address stream byte) = table[i].stream</span>
<span id="L875" class="LineNr">875 </span> <span class="subxComment"># var stream/eax : (addr stream byte) = table[i].stream</span>
<span id="L876" class="LineNr">876 </span> 8b/copy 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esi+4) to eax</span>
<span id="L877" class="LineNr">877 </span> <span class="subxComment"># write-stream-data(out, stream)</span>
<span id="L878" class="LineNr">878 </span> <span class="subxS2Comment"># . . push args</span>

View File

@ -134,7 +134,7 @@ if ('onhashchange' in window) {
<span id="L75" class="LineNr"> 75 </span> b8/copy-to-eax 1/imm32/exit
<span id="L76" class="LineNr"> 76 </span> cd/syscall 0x80/imm8
<span id="L77" class="LineNr"> 77 </span>
<span id="L78" class="LineNr"> 78 </span><span class="subxFunction">subx-braces</span>: <span class="subxComment"># in : (address buffered-file), out : (address buffered-file)</span>
<span id="L78" class="LineNr"> 78 </span><span class="subxFunction">subx-braces</span>: <span class="subxComment"># in : (addr buffered-file), out : (addr buffered-file)</span>
<span id="L79" class="LineNr"> 79 </span> <span class="subxComment"># pseudocode:</span>
<span id="L80" class="LineNr"> 80 </span> <span class="subxComment"># var line : (ref stream byte 512)</span>
<span id="L81" class="LineNr"> 81 </span> <span class="subxComment"># var label-stack : (stack int 32) # at most 32 levels of nesting</span>
@ -154,7 +154,7 @@ if ('onhashchange' in window) {
<span id="L95" class="LineNr"> 95 </span> <span class="subxComment"># print(out, &quot;_break&quot; top &quot;:\n&quot;)</span>
<span id="L96" class="LineNr"> 96 </span> <span class="subxComment"># continue</span>
<span id="L97" class="LineNr"> 97 </span> <span class="subxComment"># while true</span>
<span id="L98" class="LineNr"> 98 </span> <span class="subxComment"># var word-slice : (address slice) = next-word-or-string(line)</span>
<span id="L98" class="LineNr"> 98 </span> <span class="subxComment"># var word-slice : (addr slice) = next-word-or-string(line)</span>
<span id="L99" class="LineNr"> 99 </span> <span class="subxComment"># if slice-empty?(word-slice) # end of line</span>
<span id="L100" class="LineNr">100 </span> <span class="subxComment"># break</span>
<span id="L101" class="LineNr">101 </span> <span class="subxComment"># if slice-starts-with?(word-slice, &quot;#&quot;) # comment</span>

View File

@ -136,7 +136,7 @@ if ('onhashchange' in window) {
<span id="L75" class="LineNr"> 75 </span> b8/copy-to-eax 1/imm32/exit
<span id="L76" class="LineNr"> 76 </span> cd/syscall 0x80/imm8
<span id="L77" class="LineNr"> 77 </span>
<span id="L78" class="LineNr"> 78 </span><span class="subxFunction">subx-calls</span>: <span class="subxComment"># in : (address buffered-file), out : (address buffered-file)</span>
<span id="L78" class="LineNr"> 78 </span><span class="subxFunction">subx-calls</span>: <span class="subxComment"># in : (addr buffered-file), out : (addr buffered-file)</span>
<span id="L79" class="LineNr"> 79 </span> <span class="subxComment"># pseudocode:</span>
<span id="L80" class="LineNr"> 80 </span> <span class="subxComment"># var line : (ref stream byte 512)</span>
<span id="L81" class="LineNr"> 81 </span> <span class="subxComment"># var words : (ref stream slice 16) # at most function name and 15 args</span>
@ -292,7 +292,7 @@ if ('onhashchange' in window) {
<span id="L231" class="LineNr"> 231 </span> 5d/pop-to-ebp
<span id="L232" class="LineNr"> 232 </span> c3/return
<span id="L233" class="LineNr"> 233 </span>
<span id="L234" class="LineNr"> 234 </span><span class="subxFunction">parse-line</span>: <span class="subxComment"># line : (address stream byte), words : (address stream slice)</span>
<span id="L234" class="LineNr"> 234 </span><span class="subxFunction">parse-line</span>: <span class="subxComment"># line : (addr stream byte), words : (addr stream slice)</span>
<span id="L235" class="LineNr"> 235 </span> <span class="subxComment"># pseudocode:</span>
<span id="L236" class="LineNr"> 236 </span> <span class="subxComment"># var word-slice : (ref slice)</span>
<span id="L237" class="LineNr"> 237 </span> <span class="subxComment"># while true</span>
@ -362,7 +362,7 @@ if ('onhashchange' in window) {
<span id="L340" class="LineNr"> 340 </span> 5d/pop-to-ebp
<span id="L341" class="LineNr"> 341 </span> c3/return
<span id="L342" class="LineNr"> 342 </span>
<span id="L343" class="LineNr"> 343 </span><span class="subxFunction">emit-call</span>: <span class="subxComment"># out : (address buffered-file), words : (address stream slice)</span>
<span id="L343" class="LineNr"> 343 </span><span class="subxFunction">emit-call</span>: <span class="subxComment"># out : (addr buffered-file), words : (addr stream slice)</span>
<span id="L344" class="LineNr"> 344 </span> <span class="subxComment"># pseudocode:</span>
<span id="L345" class="LineNr"> 345 </span> <span class="subxComment"># if (words-&gt;write &lt; 8) abort</span>
<span id="L346" class="LineNr"> 346 </span> <span class="subxComment"># curr = &amp;words-&gt;data[words-&gt;write-8]</span>
@ -403,9 +403,9 @@ if ('onhashchange' in window) {
<span id="L381" class="LineNr"> 381 </span> 8b/-&gt; *esi 1/r32/ecx
<span id="L382" class="LineNr"> 382 </span> 81 5/subop/subtract %ecx 8/imm32
<span id="L383" class="LineNr"> 383 </span> 0f 8c/jump-if-lesser $emit-call:error1/disp32
<span id="L384" class="LineNr"> 384 </span> <span class="subxComment"># var curr/ecx : (address slice) = &amp;words-&gt;data[words-&gt;write-8]</span>
<span id="L384" class="LineNr"> 384 </span> <span class="subxComment"># var curr/ecx : (addr slice) = &amp;words-&gt;data[words-&gt;write-8]</span>
<span id="L385" class="LineNr"> 385 </span> 8d/copy-address *(esi+ecx+0xc) 1/r32/ecx
<span id="L386" class="LineNr"> 386 </span> <span class="subxComment"># var min/edx : (address byte) = words-&gt;data</span>
<span id="L386" class="LineNr"> 386 </span> <span class="subxComment"># var min/edx : (addr byte) = words-&gt;data</span>
<span id="L387" class="LineNr"> 387 </span> 8d/copy-address *(esi+0xc) 2/r32/edx
<span id="L388" class="LineNr"> 388 </span> <span class="subxH1Comment"># - emit pushes</span>
<span id="L389" class="LineNr"> 389 </span><span class="Constant">$emit-call:push-loop</span>:
@ -413,7 +413,7 @@ if ('onhashchange' in window) {
<span id="L391" class="LineNr"> 391 </span> 39/compare %ecx 2/r32/edx
<span id="L392" class="LineNr"> 392 </span> 0f 8e/jump-if-lesser-or-equal $emit-call:call-instruction/disp32
<span id="L393" class="LineNr"> 393 </span> <span class="subxComment"># if (*curr-&gt;start in '%' '*') goto push-rm32</span>
<span id="L394" class="LineNr"> 394 </span> <span class="subxS1Comment"># . var start/eax : (address byte) = curr-&gt;start</span>
<span id="L394" class="LineNr"> 394 </span> <span class="subxS1Comment"># . var start/eax : (addr byte) = curr-&gt;start</span>
<span id="L395" class="LineNr"> 395 </span> 8b/-&gt; *ecx 0/r32/eax
<span id="L396" class="LineNr"> 396 </span> <span class="subxS1Comment"># . var c/eax : byte = *eax</span>
<span id="L397" class="LineNr"> 397 </span> 8b/-&gt; *eax 0/r32/eax
@ -731,7 +731,7 @@ if ('onhashchange' in window) {
<span id="L741" class="LineNr"> 741 </span> 5d/pop-to-ebp
<span id="L742" class="LineNr"> 742 </span> c3/return
<span id="L743" class="LineNr"> 743 </span>
<span id="L744" class="LineNr"> 744 </span><span class="subxFunction">next-word-string-or-expression-without-metadata</span>: <span class="subxComment"># line : (address stream byte), out : (address slice)</span>
<span id="L744" class="LineNr"> 744 </span><span class="subxFunction">next-word-string-or-expression-without-metadata</span>: <span class="subxComment"># line : (addr stream byte), out : (addr slice)</span>
<span id="L745" class="LineNr"> 745 </span> <span class="subxComment"># pseudocode:</span>
<span id="L746" class="LineNr"> 746 </span> <span class="subxComment"># skip-chars-matching(line, ' ')</span>
<span id="L747" class="LineNr"> 747 </span> <span class="subxComment"># if line-&gt;read &gt;= line-&gt;write # end of line</span>

View File

@ -151,7 +151,7 @@ if ('onhashchange' in window) {
<span id="L90" class="LineNr"> 90 </span> cd/syscall 0x80/imm8
<span id="L91" class="LineNr"> 91 </span>
<span id="L92" class="LineNr"> 92 </span><span class="subxComment"># the main entry point</span>
<span id="L93" class="LineNr"> 93 </span><span class="subxFunction">compile</span>: <span class="subxComment"># in : (address buffered-file), out : fd or (address stream byte), err : fd or (address stream byte), ed : (address exit-descriptor)</span>
<span id="L93" class="LineNr"> 93 </span><span class="subxFunction">compile</span>: <span class="subxComment"># in : (addr buffered-file), out : fd or (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor)</span>
<span id="L94" class="LineNr"> 94 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L95" class="LineNr"> 95 </span> 55/push-ebp
<span id="L96" class="LineNr"> 96 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -252,7 +252,7 @@ if ('onhashchange' in window) {
<span id="L191" class="LineNr">191 </span><span class="subxComment"># space in 'out'.</span>
<span id="L192" class="LineNr">192 </span><span class="subxComment"># Input comes from the global variable 'Look' (first byte) and the argument</span>
<span id="L193" class="LineNr">193 </span><span class="subxComment"># 'in' (rest). We leave the next byte from 'in' into 'Look' on exit.</span>
<span id="L194" class="LineNr">194 </span><span class="subxFunction">get-num</span>: <span class="subxComment"># in : (address buffered-file), out : (address stream byte), err : fd or (address stream byte), ed : (address exit-descriptor)</span>
<span id="L194" class="LineNr">194 </span><span class="subxFunction">get-num</span>: <span class="subxComment"># in : (addr buffered-file), out : (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor)</span>
<span id="L195" class="LineNr">195 </span> <span class="subxComment"># pseudocode:</span>
<span id="L196" class="LineNr">196 </span> <span class="subxComment"># if (!is-digit?(Look)) expected(ed, err, &quot;integer&quot;)</span>
<span id="L197" class="LineNr">197 </span> <span class="subxComment"># if out-&gt;write &gt;= out-&gt;length</span>
@ -531,7 +531,7 @@ if ('onhashchange' in window) {
<span id="L470" class="LineNr">470 </span><span class="subxComment">## helpers</span>
<span id="L471" class="LineNr">471 </span>
<span id="L472" class="LineNr">472 </span><span class="subxComment"># write(f, &quot;Error: &quot;+s+&quot; expected\n&quot;) then stop(ed, 1)</span>
<span id="L473" class="LineNr">473 </span><span class="subxFunction">expected</span>: <span class="subxComment"># ed : (address exit-descriptor), f : fd or (address stream byte), s : (address array byte)</span>
<span id="L473" class="LineNr">473 </span><span class="subxFunction">expected</span>: <span class="subxComment"># ed : (addr exit-descriptor), f : fd or (addr stream byte), s : (addr array byte)</span>
<span id="L474" class="LineNr">474 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L475" class="LineNr">475 </span> 55/push-ebp
<span id="L476" class="LineNr">476 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -573,7 +573,7 @@ if ('onhashchange' in window) {
<span id="L512" class="LineNr">512 </span> c3/return
<span id="L513" class="LineNr">513 </span>
<span id="L514" class="LineNr">514 </span><span class="subxComment"># read a byte from 'f', and save it in 'Look'</span>
<span id="L515" class="LineNr">515 </span><span class="subxFunction">get-char</span>: <span class="subxComment"># f : (address buffered-file)</span>
<span id="L515" class="LineNr">515 </span><span class="subxFunction">get-char</span>: <span class="subxComment"># f : (addr buffered-file)</span>
<span id="L516" class="LineNr">516 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L517" class="LineNr">517 </span> 55/push-ebp
<span id="L518" class="LineNr">518 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -151,7 +151,7 @@ if ('onhashchange' in window) {
<span id="L90" class="LineNr"> 90 </span> cd/syscall 0x80/imm8
<span id="L91" class="LineNr"> 91 </span>
<span id="L92" class="LineNr"> 92 </span><span class="subxComment"># the main entry point</span>
<span id="L93" class="LineNr"> 93 </span><span class="subxFunction">compile</span>: <span class="subxComment"># in : (address buffered-file), out : fd or (address stream byte), err : fd or (address stream byte), ed : (address exit-descriptor)</span>
<span id="L93" class="LineNr"> 93 </span><span class="subxFunction">compile</span>: <span class="subxComment"># in : (addr buffered-file), out : fd or (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor)</span>
<span id="L94" class="LineNr"> 94 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L95" class="LineNr"> 95 </span> 55/push-ebp
<span id="L96" class="LineNr"> 96 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -252,7 +252,7 @@ if ('onhashchange' in window) {
<span id="L191" class="LineNr">191 </span><span class="subxComment"># no space in 'out'.</span>
<span id="L192" class="LineNr">192 </span><span class="subxComment"># Input comes from the global variable 'Look' (first byte) and the argument</span>
<span id="L193" class="LineNr">193 </span><span class="subxComment"># 'in' (rest). We leave the next byte from 'in' into 'Look' on exit.</span>
<span id="L194" class="LineNr">194 </span><span class="subxFunction">get-num</span>: <span class="subxComment"># in : (address buffered-file), out : (address stream byte), err : fd or (address stream byte), ed : (address exit-descriptor)</span>
<span id="L194" class="LineNr">194 </span><span class="subxFunction">get-num</span>: <span class="subxComment"># in : (addr buffered-file), out : (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor)</span>
<span id="L195" class="LineNr">195 </span> <span class="subxComment"># pseudocode:</span>
<span id="L196" class="LineNr">196 </span> <span class="subxComment"># if (!is-digit?(Look)) expected(ed, err, &quot;integer&quot;)</span>
<span id="L197" class="LineNr">197 </span> <span class="subxComment"># do</span>
@ -725,7 +725,7 @@ if ('onhashchange' in window) {
<span id="L664" class="LineNr">664 </span><span class="subxComment">## helpers</span>
<span id="L665" class="LineNr">665 </span>
<span id="L666" class="LineNr">666 </span><span class="subxComment"># write(f, &quot;Error: &quot;+s+&quot; expected\n&quot;) then stop(ed, 1)</span>
<span id="L667" class="LineNr">667 </span><span class="subxFunction">expected</span>: <span class="subxComment"># ed : (address exit-descriptor), f : fd or (address stream byte), s : (address array byte)</span>
<span id="L667" class="LineNr">667 </span><span class="subxFunction">expected</span>: <span class="subxComment"># ed : (addr exit-descriptor), f : fd or (addr stream byte), s : (addr array byte)</span>
<span id="L668" class="LineNr">668 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L669" class="LineNr">669 </span> 55/push-ebp
<span id="L670" class="LineNr">670 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
@ -767,7 +767,7 @@ if ('onhashchange' in window) {
<span id="L706" class="LineNr">706 </span> c3/return
<span id="L707" class="LineNr">707 </span>
<span id="L708" class="LineNr">708 </span><span class="subxComment"># read a byte from 'f', and save it in 'Look'</span>
<span id="L709" class="LineNr">709 </span><span class="subxFunction">get-char</span>: <span class="subxComment"># f : (address buffered-file)</span>
<span id="L709" class="LineNr">709 </span><span class="subxFunction">get-char</span>: <span class="subxComment"># f : (addr buffered-file)</span>
<span id="L710" class="LineNr">710 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L711" class="LineNr">711 </span> 55/push-ebp
<span id="L712" class="LineNr">712 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

View File

@ -145,7 +145,7 @@ if ('onhashchange' in window) {
<span id="L82" class="LineNr"> 82 </span><span class="subxComment"># line = words separated by ' ', maybe followed by comment starting with '#'</span>
<span id="L83" class="LineNr"> 83 </span><span class="subxComment"># word = datum until '/', then 0 or more metadata separated by '/'</span>
<span id="L84" class="LineNr"> 84 </span>
<span id="L85" class="LineNr"> 85 </span><span class="subxFunction">subx-dquotes</span>: <span class="subxComment"># in : (address buffered-file), out : (address buffered-file)</span>
<span id="L85" class="LineNr"> 85 </span><span class="subxFunction">subx-dquotes</span>: <span class="subxComment"># in : (addr buffered-file), out : (addr buffered-file)</span>
<span id="L86" class="LineNr"> 86 </span> <span class="subxComment"># pseudocode:</span>
<span id="L87" class="LineNr"> 87 </span> <span class="subxComment"># var line : (ref stream byte 512)</span>
<span id="L88" class="LineNr"> 88 </span> <span class="subxComment"># var new-data-segment : (handle stream byte) = new-stream(Heap, Segment-size, 1)</span>
@ -261,7 +261,7 @@ if ('onhashchange' in window) {
<span id="L198" class="LineNr"> 198 </span> 0f 85/jump-if-not-equal $subx-dquotes:next-line/disp32
<span id="L199" class="LineNr"> 199 </span><span class="Constant">$subx-dquotes:check-for-comment</span>:
<span id="L200" class="LineNr"> 200 </span> <span class="subxComment"># if (slice-starts-with?(word-slice, &quot;#&quot;)) continue</span>
<span id="L201" class="LineNr"> 201 </span> <span class="subxS1Comment"># . var start/esi : (address byte) = word-slice-&gt;start</span>
<span id="L201" class="LineNr"> 201 </span> <span class="subxS1Comment"># . var start/esi : (addr byte) = word-slice-&gt;start</span>
<span id="L202" class="LineNr"> 202 </span> 8b/copy 0/mod/indirect 2/rm32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *edx to esi</span>
<span id="L203" class="LineNr"> 203 </span> <span class="subxS1Comment"># . var c/eax : byte = *start</span>
<span id="L204" class="LineNr"> 204 </span> 31/xor 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear eax</span>
@ -350,7 +350,7 @@ if ('onhashchange' in window) {
<span id="L287" class="LineNr"> 287 </span>
<span id="L288" class="LineNr"> 288 </span><span class="subxComment"># Write out 'string-literal' in a new format to 'out-segment', assign it a new</span>
<span id="L289" class="LineNr"> 289 </span><span class="subxComment"># label, and write the new label out to 'out'.</span>
<span id="L290" class="LineNr"> 290 </span><span class="subxFunction">process-string-literal</span>: <span class="subxComment"># string-literal : (address slice), out : (address buffered-file), out-segment : (address stream byte)</span>
<span id="L290" class="LineNr"> 290 </span><span class="subxFunction">process-string-literal</span>: <span class="subxComment"># string-literal : (addr slice), out : (addr buffered-file), out-segment : (addr stream byte)</span>
<span id="L291" class="LineNr"> 291 </span> <span class="subxComment"># pseudocode:</span>
<span id="L292" class="LineNr"> 292 </span> <span class="subxComment"># print(out-segment, &quot;_string#{Next-string-literal}:\n&quot;)</span>
<span id="L293" class="LineNr"> 293 </span> <span class="subxComment"># emit-string-literal-data(out-segment, string-literal)</span>
@ -852,7 +852,7 @@ if ('onhashchange' in window) {
<span id="L846" class="LineNr"> 846 </span> c3/return
<span id="L847" class="LineNr"> 847 </span>
<span id="L848" class="LineNr"> 848 </span><span class="subxComment"># generate the data segment contents byte by byte for a given slice</span>
<span id="L849" class="LineNr"> 849 </span><span class="subxFunction">emit-string-literal-data</span>: <span class="subxComment"># out : (address stream byte), word : (address slice)</span>
<span id="L849" class="LineNr"> 849 </span><span class="subxFunction">emit-string-literal-data</span>: <span class="subxComment"># out : (addr stream byte), word : (addr slice)</span>
<span id="L850" class="LineNr"> 850 </span> <span class="subxComment"># pseudocode</span>
<span id="L851" class="LineNr"> 851 </span> <span class="subxComment"># len = string-length-at-start-of-slice(word-&gt;start, word-&gt;end)</span>
<span id="L852" class="LineNr"> 852 </span> <span class="subxComment"># print(out, &quot;#{len}/imm32 &quot;)</span>
@ -893,9 +893,9 @@ if ('onhashchange' in window) {
<span id="L887" class="LineNr"> 887 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to esi</span>
<span id="L888" class="LineNr"> 888 </span> <span class="subxComment"># var idx/ebx : int = 0</span>
<span id="L889" class="LineNr"> 889 </span> 31/xor 3/mod/direct 3/rm32/ebx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 3/r32/ebx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear ebx</span>
<span id="L890" class="LineNr"> 890 </span> <span class="subxComment"># var curr/edx : (address byte) = word-&gt;start</span>
<span id="L890" class="LineNr"> 890 </span> <span class="subxComment"># var curr/edx : (addr byte) = word-&gt;start</span>
<span id="L891" class="LineNr"> 891 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to edx</span>
<span id="L892" class="LineNr"> 892 </span> <span class="subxComment"># var max/esi : (address byte) = word-&gt;end</span>
<span id="L892" class="LineNr"> 892 </span> <span class="subxComment"># var max/esi : (addr byte) = word-&gt;end</span>
<span id="L893" class="LineNr"> 893 </span> 8b/copy 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esi+4) to esi</span>
<span id="L894" class="LineNr"> 894 </span><span class="Constant">$emit-string-literal-data:emit-length</span>:
<span id="L895" class="LineNr"> 895 </span> <span class="subxComment"># var len/eax : int = string-length-at-start-of-slice(word-&gt;start, word-&gt;end)</span>
@ -1260,7 +1260,7 @@ if ('onhashchange' in window) {
<span id="L1379" class="LineNr">1379 </span> c3/return
<span id="L1380" class="LineNr">1380 </span>
<span id="L1381" class="LineNr">1381 </span><span class="subxComment"># emit everything from a word except the initial datum</span>
<span id="L1382" class="LineNr">1382 </span><span class="subxFunction">emit-metadata</span>: <span class="subxComment"># out : (address buffered-file), word : (address slice)</span>
<span id="L1382" class="LineNr">1382 </span><span class="subxFunction">emit-metadata</span>: <span class="subxComment"># out : (addr buffered-file), word : (addr slice)</span>
<span id="L1383" class="LineNr">1383 </span> <span class="subxComment"># pseudocode</span>
<span id="L1384" class="LineNr">1384 </span> <span class="subxComment"># var slice : (ref slice) = {0, word-&gt;end}</span>
<span id="L1385" class="LineNr">1385 </span> <span class="subxComment"># curr = word-&gt;start</span>
@ -1287,9 +1287,9 @@ if ('onhashchange' in window) {
<span id="L1406" class="LineNr">1406 </span> 56/push-esi
<span id="L1407" class="LineNr">1407 </span> <span class="subxComment"># esi = word</span>
<span id="L1408" class="LineNr">1408 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to esi</span>
<span id="L1409" class="LineNr">1409 </span> <span class="subxComment"># var curr/ecx : (address byte) = word-&gt;start</span>
<span id="L1409" class="LineNr">1409 </span> <span class="subxComment"># var curr/ecx : (addr byte) = word-&gt;start</span>
<span id="L1410" class="LineNr">1410 </span> 8b/copy 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *esi to ecx</span>
<span id="L1411" class="LineNr">1411 </span> <span class="subxComment"># var end/edx : (address byte) = word-&gt;end</span>
<span id="L1411" class="LineNr">1411 </span> <span class="subxComment"># var end/edx : (addr byte) = word-&gt;end</span>
<span id="L1412" class="LineNr">1412 </span> 8b/copy 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esi+4) to edx</span>
<span id="L1413" class="LineNr">1413 </span> <span class="subxComment"># var slice/ebx : (ref slice) = {0, end}</span>
<span id="L1414" class="LineNr">1414 </span> 52/push-edx
@ -1634,7 +1634,7 @@ if ('onhashchange' in window) {
<span id="L1778" class="LineNr">1778 </span> 5d/pop-to-ebp
<span id="L1779" class="LineNr">1779 </span> c3/return
<span id="L1780" class="LineNr">1780 </span>
<span id="L1781" class="LineNr">1781 </span><span class="subxFunction">string-length-at-start-of-slice</span>: <span class="subxComment"># curr : (address byte), end : (address byte) -&gt; length/eax</span>
<span id="L1781" class="LineNr">1781 </span><span class="subxFunction">string-length-at-start-of-slice</span>: <span class="subxComment"># curr : (addr byte), end : (addr byte) -&gt; length/eax</span>
<span id="L1782" class="LineNr">1782 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L1783" class="LineNr">1783 </span> 55/push-ebp
<span id="L1784" class="LineNr">1784 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>

Some files were not shown because too many files have changed in this diff Show More