about summary refs log tree commit diff stats
path: root/mu-init-test.subx
blob: 1b2d16832b1c896501affafb9ec1c24bead67407 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Just a test stub for mu-init.subx
#
# Try it out like this:
#   $ ./translate_subx init.linux [0-9]*.subx mu-init.subx mu-init-test.subx
#   $ ./a.elf  # should run all tests

main:  # args: (addr array (addr array byte)) -> result/ebx: int
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    56/push-esi
    # esi = args
    8b/-> *(ebp+8) 6/r32/esi
    {
      # if (argc <= 1) break
      81 7/subop/compare *esi 4/imm32
      7e/jump-if-<= break/disp8
      # if (argv[1] != "test") break
      (string-equal? *(esi+8) "test")  # => eax
      3d/compare-eax-and 0/imm32
      74/jump-if-= break/disp8
      #
      (run-tests)
      # return *Num-test-failures
      8b/-> *Num-test-failures 3/r32/ebx
      eb/jump $main:end/disp8
    }
$main:end:
    # . restore registers
    5e/pop-to-esi
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return
ar.away=green titlebar.chat=green titlebar.dnd=red titlebar.xa=green statusbar=red statusbar.text=yellow statusbar.brackets=green statusbar.active=white statusbar.new=green main.text=white main.text.me=white main.text.them=white main.splash=red main.time=red input.text=green subscribed=green unsubscribed=red otr.started.trusted=green otr.started.untrusted=red otr.ended=yellow otr.trusted=green otr.untrusted=red online=green away=yellow chat=green dnd=green xa=yellow offline=bold_black incoming=yellow mention=red trigger=red typing=green gone=red error=red roominfo=green roommention=red roommention.term=red roomtrigger=red roomtrigger.term=red me=green them=yellow roster.header=white roster.chat=green roster.online=green roster.away=yellow roster.xa=yellow roster.dnd=green roster.offline=bold_black roster.chat.active=green roster.online.active=green roster.away.active=yellow roster.xa.active=yellow roster.dnd.active=green roster.offline.active=bold_black roster.chat.unread=green roster.online.unread=green roster.away.unread=yellow roster.xa.unread=yellow roster.dnd.unread=green roster.offline.unread=bold_black roster.room=green roster.room.unread=green roster.room.mention=green roster.room.trigger=green occupants.header=white receipt.sent=red