Skip to content

Commit 037ce44

Browse files
Changed _some_ outc calls to use chars
1 parent ef897db commit 037ce44

File tree

10 files changed

+88
-87
lines changed

10 files changed

+88
-87
lines changed

examples/AdventOfCode2025/d3_batteries.mx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@
119119
%banksSum(strar)
120120
}
121121
%print_endl(
122-
outc 10
123-
outc 83
124-
outc 117
125-
outc 109
126-
outc 32
122+
outc '\n'
123+
outc 'S'
124+
outc 'u'
125+
outc 'm'
126+
outc ' '
127127
%banksSum(outum)
128128
)
129129
}

examples/fibonacci_asm_only.mx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
; input prompt
2-
outc 72
3-
outc 111
4-
outc 119
5-
outc 32
6-
outc 109
7-
outc 97
8-
outc 110
9-
outc 121
10-
outc 63
11-
outc 32
2+
outc 'H'
3+
outc 'o'
4+
outc 'w'
5+
outc ' '
6+
outc 'm'
7+
outc 'a'
8+
outc 'n'
9+
outc 'y'
10+
outc '?'
11+
outc ' '
1212

1313
inu ; input
1414
inl
@@ -30,7 +30,7 @@ strr
3030
; print a
3131
mov 0
3232
outum
33-
outc 10
33+
outc '\n'
3434

3535
; (a, b) = (b, a + b)
3636
ldm

std/debug.mx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
%macro emitMemdumpAddr() {
3232
outc 10
3333
outuh
34-
outc 58
34+
outc ':'
3535
}
3636

3737
; from, count -> void (stdout)
@@ -88,7 +88,7 @@
8888
%macro dumpStackOverrun(overrun) {
8989
%_dumpStack2Top()
9090
; show overrun
91-
outc 124 ; separator
91+
outc '|' ; separator
9292
%load(%SEG_DEBUG_GLOBALS)
9393
lda 1
9494
%stack:pushr() ; from original SP
@@ -101,9 +101,9 @@
101101
%macro seeFuncFrame() {
102102
; TODO factor to function
103103
%toggleDebugMode()
104-
outc 10
105-
outc 70
106-
outc 58
104+
outc '\n'
105+
outc 'F'
106+
outc ':'
107107

108108
%load(!op(a, %SEG_DEBUG_GLOBALS, %G_ARGS_PTR)) ; memdump normal args
109109
%stack:pushr()
@@ -114,7 +114,7 @@
114114
%stack:pushr()
115115
%if_else { ldm ,
116116
%call(memdump)
117-
outc 124
117+
outc '|'
118118
,
119119
%stack:dropN(2)
120120
}

std/ds/array.mx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@
244244
%void_method{ array_print, 1, 1,
245245
; locals: first | for_stop, for_idx
246246
%seg:local(0, str 1)
247-
outc 91
247+
outc '['
248248
%foreach {
249249
%if_else { %seg:local(0, lmeq 0),
250-
outc 44
251-
outc 32
250+
outc ','
251+
outc ' '
252252
,
253253
str 0
254254
}
@@ -258,8 +258,8 @@
258258
outum
259259
)
260260
}
261-
outc 93
262-
outc 10
261+
outc ']'
262+
outc '\n'
263263
}
264264

265265

std/exceptions.mx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
%define ERR_ASSERT 0
44

55
%macro error(code) {
6-
outc 10
7-
outc 69
8-
outc 82
9-
outc 82
10-
outc 79
11-
outc 82
12-
outc 58
13-
outc 32
6+
outc '\n'
7+
outc 'E'
8+
outc 'R'
9+
outc 'R'
10+
outc 'O'
11+
outc 'R'
12+
outc ':'
13+
outc ' '
1414
outu %code
15-
outc 10
15+
outc '\n'
1616
jmp end
1717
}
1818

std/io.mx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44
%macro print_spaced(instr) {
55
%instr
6-
outc 32
6+
outc ' '
77
}
88
%macro print_endl(instr) {
99
%instr
10-
outc 10
10+
outc '\n'
1111
}
1212
%macro print_separator() {
13-
outc 44
14-
outc 32
13+
outc ','
14+
outc ' '
1515
}
1616
%macro print_key_val(keyChar, val) {
1717
outc %keyChar
18-
outc 61
18+
outc '='
1919
outu(%val)
2020
%print_separator()
2121
}
@@ -26,7 +26,7 @@
2626
%if {
2727
ld> 15 ; negative?
2828
,
29-
outc 45
29+
outc '-'
3030
ld 0
3131
ldsm
3232
strr
@@ -56,18 +56,19 @@
5656

5757
; VM / runtime delim
5858
%macro print_delim(vm) {
59-
outc 45
60-
outc 32
59+
outc '-'
60+
outc ' '
6161
%if_else(ld %vm,
62-
outc 86
63-
outc 77,
64-
outc 82
65-
outc 85
66-
outc 78
62+
outc 'V'
63+
outc 'M'
64+
,
65+
outc 'R'
66+
outc 'U'
67+
outc 'N'
6768
)
68-
outc 32
69-
outc 45
70-
outc 10
69+
outc ' '
70+
outc '-'
71+
outc '\n'
7172
}
7273
%macro vm_runtime_delim() {
7374
ld !print_delim(1)

tests/jmp-test.mx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
:top
44
jmpar
55

6-
outc 65 ; ABCDEFGH\n
7-
outc 66
8-
outc 67
9-
outc 68
10-
outc 69
11-
outc 70
12-
outc 71
13-
outc 72
6+
outc 'A' ; ABCDEFGH\n
7+
outc 'B'
8+
outc 'C'
9+
outc 'D'
10+
outc 'E'
11+
outc 'F'
12+
outc 'G'
13+
outc 'H'
1414

1515
outc 10
1616

tests/std-array.mx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
%func { int_lt_with_emit, 2, 0,
1616
%seg:push(%arg, 0)
1717
outur
18-
outc 60 ; '<'
18+
outc '<'
1919
%seg:push(%arg, 1)
2020
%print_spaced(outur)
2121
%call(uint_lt)
@@ -175,7 +175,7 @@
175175
)
176176

177177
; test empty[0]
178-
outc 69
178+
outc 'E'
179179
%seg:push_addr(%local, %array:sizeof)
180180
%stack:push(0)
181181
%call(index)

tests/std-control.mx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66

77
; false while cond
88
%while {ld 0,
9-
outc 65
9+
outc 'E'
1010
}
1111
%do_while {ld 0,
12-
outc 66
12+
outc 'B'
1313
}
14-
outc 10
14+
outc '\n'
1515

1616
; generalized for
1717
ld 107
1818
%for_full(7, 10,
1919
%stack:top()
2020
outum
21-
outc 32
21+
outc ' '
2222
)
23-
outc 10
23+
outc '\n'
2424

2525
%store(%MEMORY_LAYOUT:SEG_TEMP, 7)
2626
%do_while {
@@ -35,7 +35,7 @@ outc 10
3535
:no_continue
3636
outum
3737
}
38-
outc 10
38+
outc '\n'
3939

4040
; for loop
4141
ld 10
@@ -44,5 +44,5 @@ ld 10
4444
outum
4545
ld< 3 ; should be irrelevant
4646
}
47-
outc 10
47+
outc '\n'
4848
%dumpStackOverrun(7)

tests/std-div_pwr.mx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
outu %numerator
1919
outc %char_u
2020
outu %denominator
21-
outc 61
21+
outc '='
2222
%callOp(%op, %numerator, %denominator)
2323
outur
2424
}
2525
%macro testDivRem(numerator, denominator) {
2626
%testOp(divide, 47, %numerator, %denominator)
27-
outc 37
27+
outc '%'
2828
mov %MEMORY_LAYOUT:SEG_TEMP
2929
ldt %denominator
3030
str %numerator
@@ -76,14 +76,14 @@ outc 10
7676
; which power to break -> status
7777
%func {test2Powers, 1, 2,
7878
; locals: maxPwr, currPwr
79-
%print_spaced(outc 105) ; collumn headers
79+
%print_spaced(outc 'i') ; collumn headers
8080
%print_spaced(
8181
outu 2
82-
outc 94
83-
outc 105
82+
outc '^'
83+
outc 'i'
8484
)
85-
outc 47
86-
outc 10
85+
outc '/'
86+
outc '\n'
8787

8888
ld 14
8989
%callPwrStrLocal(2, 0) ; maxPwr = 2 ** 14
@@ -119,18 +119,18 @@ outc 10
119119
%stack:drop()
120120
lnem ; maxPwr >> idx != divide(maxPwr, currPwr)
121121
,
122-
outc 32
123-
outc 69 ; emit error
124-
outc 64
122+
outc ' '
123+
outc 'E' ; emit error
124+
outc '@'
125125
%stack:top()
126126
%print_endl(outum) ; idx
127127
%return_imm(test2Powers, 69) ; return when values mismatch
128128
}
129-
outc 10
129+
outc '\n'
130130
}
131131
%print_spaced(
132-
outc 79 ; OK
133-
outc 75
132+
outc 'O'
133+
outc 'K'
134134
)
135135
%stack:reserve(5) ; test correct stack alignment on function exit
136136
ld 0 ; retval
@@ -152,7 +152,7 @@ outc 10
152152
; ld %label
153153
; lds test_start
154154
; outur
155-
outc 45
155+
outc '-'
156156
mov %retaddrLocation
157157
strs test_start
158158
str 1234 ; --
@@ -178,8 +178,8 @@ outc 10
178178
outc 10
179179

180180
%print_endl(
181-
outc 76
182-
outc 115
181+
outc 'L'
182+
outc 's'
183183
)
184184
%showLabelOffset(module_end, 17)
185185
%showLabelOffset(test_return, 23)
@@ -193,8 +193,8 @@ outc 10
193193
%stack:push(%value)
194194
%print_spaced( outum )
195195
%print_spaced(
196-
outc 45
197-
outc 62
196+
outc '-'
197+
outc '>'
198198
)
199199
%call(round_up_to_2_power)
200200
%print_endl(

0 commit comments

Comments
 (0)