https://github.com/akkartik/mu/blob/main/400.mu

      1 # screen
      2 sig pixel-on-real-screen x: int, y: int, color: int
      3 sig draw-grapheme-on-real-screen g: grapheme, x: int, y: int, color: int, background-color: int
      4 sig draw-grapheme-on-screen-array screen-data: (addr array byte), g: grapheme, x: int, y: int, color: int, background-color: int, screen-width: int, screen-height: int
      5 sig cursor-position-on-real-screen -> _/eax: int, _/ecx: int
      6 sig set-cursor-position-on-real-screen x: int, y: int
      7 sig draw-cursor-on-real-screen g: grapheme
      8 sig color-rgb color: int -> _/ecx: int, _/edx: int, _/ebx: int
      9
     10 # timer
     11 sig timer-counter -> _/eax: int
     12
     13 # keyboard
     14 sig read-key kbd: (addr keyboard) -> _/eax: byte
     15
     16 # disk
     17 sig load-sectors disk: (addr disk), lba: int, n: int, out: (addr stream byte)
     18 sig store-sectors disk: (addr disk), lba: int, n: int, out: (addr stream byte)
     19
     20 # mouse
     21 sig read-mouse-event -> _/eax: int, _/ecx: int
     22
     23 # tests
     24 sig count-test-failure
     25 sig num-test-failures -> _/eax: int
     26 sig running-tests? -> _/eax: boolean
     27
     28 sig string-equal? s: (addr array byte), benchmark: (addr array byte) -> _/eax: boolean
     29 sig string-starts-with? s: (addr array byte), benchmark: (addr array byte) -> _/eax: boolean
     30 sig check-strings-equal s: (addr array byte), expected: (addr array byte), msg: (addr array byte)
     31
     32 # debugging
     33 sig check-stack
     34 sig show-stack-state
     35 sig debug-print x: (addr array byte), fg: int, bg: int
     36 sig debug-print? -> _/eax: boolean
     37 sig turn-on-debug-print
     38 sig turn-off-debug-print
     39 sig abort e: (addr array byte)
     40 sig dump-call-stack
     41
     42 sig count-event
     43 sig count-of-events -> _/eax: int
     44
     45 # streams
     46 sig clear-stream f: (addr stream _)
     47 sig rewind-stream f: (addr stream _)
     48 sig stream-data-equal? f: (addr stream byte), s: (addr array byte) -> _/eax: boolean
     49 sig streams-data-equal? a: (addr stream byte), b: (addr stream byte) -> _/eax: boolean
     50 sig check-stream-equal f: (addr stream byte), s: (addr array byte), msg: (addr array byte)
     51 sig check-streams-data-equal s: (addr stream _), expected: (addr stream _), msg: (addr array byte)
     52 sig next-stream-line-equal? f: (addr stream byte), s: (addr array byte) -> _/eax: boolean
     53 sig check-next-stream-line-equal f: (addr stream byte), s: (addr array byte), msg: (addr array byte)
     54 sig write f: (addr stream byte), s: (addr array byte)
     55 sig try-write f: (addr stream byte), s: (addr array byte) -> _/eax: boolean
     56 # probably a bad idea; I definitely want to discourage its use for streams of non-bytes
     57 sig stream-size f: (addr stream byte) -> _/eax: int
     58 sig space-remaining-in-stream f: (addr stream byte) -> _/eax: int
     59 sig write-stream f: (addr stream byte), s: (addr stream byte)
     60 sig write-stream-immutable f: (addr stream byte), s: (addr stream byte)
     61 sig read-byte s: (addr stream byte) -> _/eax: byte
     62 sig append-byte f: (addr stream byte), n: int  # really just a byte, but I want to pass in literal numbers
     63 #sig to-hex-char in/eax: int -> out/eax: int
     64 sig append-byte-hex f: (addr stream byte), n: int  # really just a byte, but I want to pass in literal numbers
     65 sig write-int32-hex f: (addr stream byte), n: int
     66 sig write-int32-hex-bits f: (addr stream byte), n: int, bits: int
     67 sig hex-int? in: (addr slice) -> _/eax: boolean
     68 sig parse-hex-int in: (addr array byte) -> _/eax: int
     69 sig parse-hex-int-from-slice in: (addr slice) -> _/eax: int
     70 #sig parse-hex-int-helper start: (addr byte), end: (addr byte) -> _/eax: int
     71 sig hex-digit? c: byte -> _/eax: boolean
     72 #sig from-hex-char in/eax: byte -> out/eax: nibble
     73 sig parse-decimal-int in: (addr array byte) -> _/eax: int
     74 sig parse-decimal-int-from-slice in: (addr slice) -> _/eax: int
     75 sig parse-decimal-int-from-stream in: (addr stream byte) -> _/eax: int
     76 #sig parse-decimal-int-helper start: (addr byte), end: (addr byte) -> _/eax: int
     77 sig decimal-size n: int -> _/eax: int
     78 #sig allocate ad: (addr allocation-descriptor), n: int, out: (addr handle _)
     79 #sig allocate-raw ad: (addr allocation-descriptor), n: int, out: (addr handle _)
     80 sig lookup h: (handle _T) -> _/eax: (addr _T)
     81 sig handle-equal? a: (handle _T), b: (handle _T) -> _/eax: boolean
     82 sig copy-handle src: (handle _T), dest: (addr handle _T)
     83 #sig allocate-region ad: (addr allocation-descriptor), n: int, out: (addr handle allocation-descriptor)
     84 #sig allocate-array ad: (addr allocation-descriptor), n: int, out: (addr handle _)
     85 sig copy-array ad: (addr allocation-descriptor), src: (addr array _T), out: (addr handle array _T)
     86 #sig zero-out start: (addr byte), size: int
     87 sig slice-empty? s: (addr slice) -> _/eax: boolean
     88 sig slice-equal? s: (addr slice), p: (addr array byte) -> _/eax: boolean
     89 sig slice-starts-with? s: (addr slice), head: (addr array byte) -> _/eax: boolean
     90 sig write-slice out: (addr stream byte), s: (addr slice)
     91 # bad name alert
     92 sig slice-to-string ad: (addr allocation-descriptor), in: (addr slice), out: (addr handle array byte)
     93 sig write-int32-decimal out: (addr stream byte), n: int
     94 sig decimal-digit? c: grapheme -> _/eax: boolean
     95 sig to-decimal-digit in: grapheme -> _/eax: int
     96 # bad name alert
     97 # next-word really tokenizes
     98 # next-raw-word really reads whitespace-separated words
     99 sig next-word line: (addr stream byte), out: (addr slice)  # skips '#' comments
    100 sig next-raw-word line: (addr stream byte), out: (addr slice)  # does not skip '#' comments
    101 sig skip-chars-matching in: (addr stream byte), delimiter: byte
    102 sig skip-chars-matching-whitespace in: (addr stream byte)
    103 sig skip-chars-not-matching in: (addr stream byte), delimiter: byte
    104 sig skip-chars-not-matching-whitespace in: (addr stream byte)
    105 sig stream-empty? s: (addr stream _) -> _/eax: boolean
    106 sig stream-full? s: (addr stream _) -> _/eax: boolean
    107 sig stream-to-array in: (addr stream _), out: (addr handle array _)
    108 sig unquote-stream-to-array in: (addr stream _), out: (addr handle array _)
    109 sig stream-first s: (addr stream byte) -> _/eax: byte
    110 sig stream-final s: (addr stream byte) -> _/eax: byte
    111
    112 #sig copy-bytes src: (addr byte), dest: (addr byte), n: int
    113 sig copy-array-object src: (addr array _), dest-ah: (addr handle array _)
    114 sig array-equal? a: (addr array int), b: (addr array int) -> _/eax: boolean
    115 sig parse-array-of-ints s: (addr array byte), out: (addr handle array int)
    116 sig parse-array-of-decimal-ints s: (addr array byte), out: (addr handle array int)
    117 sig check-array-equal a: (addr array int), expected: (addr string), msg: (addr string)
    118
    119 sig integer-divide a: int, b: int -> _/eax: int, _/edx: int