about summary refs log tree commit diff stats
path: root/shell/main.mu
Commit message (Expand)AuthorAgeFilesLines
* .Kartik K. Agaram2021-06-121-1/+1
* eliminate some implicit writes to real screenKartik K. Agaram2021-06-121-1/+1
* shell: larger fake screenKartik K. Agaram2021-06-121-1/+1
* .Kartik K. Agaram2021-06-061-1/+1
* .Kartik K. Agaram2021-06-041-0/+1
* .Kartik K. Agaram2021-06-031-156/+7
* .Kartik K. Agaram2021-05-311-1/+1
* disallow null tracesKartik K. Agaram2021-05-191-5/+14
* .Kartik K. Agaram2021-05-191-1/+1
* some boot-time heartbeat messagesKartik K. Agaram2021-05-071-0/+9
* .Kartik K. Agaram2021-05-011-1/+1
* move color scheme closer to Solarized darkKartik K. Agaram2021-05-011-1/+1
* render definitions in 2 columnsKartik K. Agaram2021-04-291-1/+1
* adjust some colors and paddingKartik K. Agaram2021-04-291-1/+4
* devote 2/3rds of screen to definitionsKartik K. Agaram2021-04-251-2/+2
* add some padding to the sandboxKartik K. Agaram2021-04-251-1/+1
* clear old output when new run is in progressKartik K. Agaram2021-04-211-2/+2
* .Kartik K. Agaram2021-04-211-1/+1
* .Kartik K. Agaram2021-04-211-1/+1
* shell: show screen state during evaluationKartik K. Agaram2021-04-211-1/+1
* shell: ctrl-r runs on real screen without a traceKartik K. Agaram2021-04-171-1/+47
* load sandbox even if there are no globalsKartik K. Agaram2021-04-171-11/+9
* heh, the current state actually overflows 2KBKartik K. Agaram2021-04-171-4/+4
* loosening a few more buffersKartik K. Agaram2021-04-171-4/+4
* data.img now has more than one sector of dataKartik K. Agaram2021-04-161-4/+5
* shell: restore bindings after restartKartik K. Agaram2021-04-151-0/+15
* .Kartik K. Agaram2021-04-151-4/+8
* .Kartik K. Agaram2021-04-151-1/+4
* .Kartik K. Agaram2021-04-151-5/+2
* .Kartik K. Agaram2021-04-151-10/+8
* add some structure to the serialization formatKartik K. Agaram2021-04-151-2/+16
* .Kartik K. Agaram2021-04-151-0/+7
* shell: load data disk as s-expr rather than stringKartik K. Agaram2021-04-141-13/+14
* shell: starting to work on persistent globalsKartik K. Agaram2021-04-141-2/+8
* .Kartik K. Agaram2021-04-141-0/+15
* shell: move fake screen to sandboxKartik K. Agaram2021-04-101-1/+1
* .Kartik K. Agaram2021-04-101-1/+1
* shell: start of 'print' primitiveKartik K. Agaram2021-04-101-1/+1
* .Kartik K. Agaram2021-04-081-2/+2
* shell: create space to display globalsKartik K. Agaram2021-04-081-4/+2
* shell: extensible array of globalsKartik K. Agaram2021-04-051-2/+5
* .Kartik K. Agaram2021-04-051-1/+1
* shell: save repl input to disk before runningKartik K. Agaram2021-04-051-2/+2
* .Kartik K. Agaram2021-03-281-6/+6
* explicitly pass screen and keyboard to mainKartik K. Agaram2021-03-261-4/+4
* .Kartik K. Agaram2021-03-221-1/+1
* shell: read initial expression from secondary diskKartik K. Agaram2021-03-211-0/+20
* 7842 - new directory organizationKartik K. Agaram2021-03-031-0/+22
;id=9d27e966b5e9bf1bd3da48f49d7e133d112a2bbe'>9d27e966 ^
ee9a9237 ^
33352536 ^

6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
9d27e966 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
03d50cc8 ^
6030d7e2 ^
03d50cc8 ^
ee9a9237 ^
33352536 ^


7a583220 ^
33352536 ^

6030d7e2 ^
57628c0e ^


e0ffdcd1 ^

f1eade72 ^
71eb22a5 ^
9b16f190 ^
6030d7e2 ^

4224ec81 ^
e0ffdcd1 ^
2a2a5b1e ^
9b16f190 ^
15ae0717 ^
a9d473e2 ^
f1eade72 ^
71eb22a5 ^
a9d473e2 ^




f1eade72 ^
71eb22a5 ^
a9d473e2 ^



ee9a9237 ^
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

                          
       


                                                                                                                                                 
 
                     
                              
                   


                                              
              
                                    
                      
                                                                                                                                                                  
                      
                           
                                
 
                                                    
                                                           
                

                                                                                                                                                                       
                      







                                                                                                                                                                             
                                                    
                             
                   

                           
              
                          
                      
                                                                                                                                                                  
              
                                        
                                   
                       
                             
                   

                                                                                                                                                                             
                           
              
                          
                      
                                                                                                                                                                  
                                 
                   

                           
              
                          
                      
                                                                                                                                                                  
                                 
                                                                                                                                                                                    
                      
                         


                 
                

                                                                                                                                                                       
             


       

                                                         
                        
               
           

              
 
                                            
                         
           
 
                                                       
                      
               




                                                       
                      
               



            
                            
# Rudimentary test harness

== code
#   instruction                     effective address                                                   register    displacement    immediate
# . 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

Entry:  # manual test
    # check-ints-equal(34, 34)
    # . . push args
    68/push  "error in check-ints-equal"/imm32
    68/push  34/imm32
    68/push  34/imm32
    # . . call
    e8/call  check-ints-equal/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
    # syscall(exit, 0)
    bb/copy-to-ebx  0/imm32
    e8/call  syscall_exit/disp32

# print msg to stderr if a != b, otherwise print "."
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
    # . save registers
    50/push-eax
    51/push-ecx
    53/push-ebx
    # load first 2 args into eax and ebx
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   8/disp8         .                 # copy *(ebp+8) to eax
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           3/r32/ebx   0xc/disp8       .                 # copy *(ebp+12) to ebx
    # if (eax == ebx) success
    39/compare                      3/mod/direct    0/rm32/eax    .           .             .           3/r32/ebx   .               .                 # compare eax and ebx
    75/jump-if-unequal  $check-ints-equal:else/disp8
    # . _write(2/stderr, '.')
    # . . push args
    68/push  "."/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . return
    eb/jump  $check-ints-equal:end/disp8
    # otherwise print error message
$check-ints-equal:else:
    # . _write(2/stderr, msg)
    # . . push args
    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   0x10/disp8      .                 # copy *(ebp+16) to ecx
    51/push-ecx
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # . _write(2/stderr, Newline)
    # . . push args
    68/push  Newline/imm32
    68/push  2/imm32/stderr
    # . . call
    e8/call  _write/disp32
    # . . discard args
    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
    # increment Num-test-failures
    ff          0/subop/increment   0/mod/indirect  5/rm32/.disp32            .             .           .           Num-test-failures/disp32          # increment *Num-test-failures
$check-ints-equal:end:
    # . restore registers
    5b/pop-to-ebx
    59/pop-to-ecx
    58/pop-to-eax
    # . epilogue
    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
    5d/pop-to-ebp
    c3/return

== data

# length-prefixed string containing just a single newline
# convenient to have when printing messages and so on
Newline:  # (array byte)
    # size: int
    1/imm32
    # data
    0a/newline

# every test failure increments this counter
Num-test-failures:  # int
    0/imm32

# length-prefixed string containing just a single space
Space:  # (array byte)
    # size: int
    1/imm32
    # data
    20/space

# length-prefixed string containing just a single slash
Slash:  # (array byte)
    # size: int
    1/imm32
    # data
    2f/slash

# . . vim:nowrap:textwidth=0