Skip to content

Commit 67377bc

Browse files
author
Ian Seyler
committed
Fix newline output
- Acts like *nix now
1 parent 74629e8 commit 67377bc

File tree

1 file changed

+19
-32
lines changed

1 file changed

+19
-32
lines changed

src/monitor.asm

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ bmfs_next:
172172
call [ProgramLocation] ; Execute program
173173

174174
poll:
175+
; TODO - Check if already on column 0.. if so, skip to poll_nonewline
175176
mov rsi, newline
176177
call ui_output
177178
poll_nonewline:
@@ -181,6 +182,8 @@ poll_nonewline:
181182
mov rcx, 100
182183
call ui_input
183184
jrcxz poll ; input stores the number of characters received in RCX
185+
mov rsi, newline
186+
call ui_output
184187
mov rsi, rdi
185188
call string_parse ; Remove extra spaces
186189
jrcxz poll ; string_parse stores the number of words in RCX
@@ -503,10 +506,6 @@ dump:
503506
jmp poll
504507

505508
dump_b:
506-
push rsi
507-
mov rsi, newline
508-
call ui_output
509-
pop rsi
510509
mov rax, rsi
511510
call dump_rax ; Display the memory address
512511
push rsi
@@ -545,10 +544,6 @@ dump_b_newline:
545544
jmp dump_b
546545

547546
dump_w:
548-
push rsi
549-
mov rsi, newline
550-
call ui_output
551-
pop rsi
552547
mov rax, rsi
553548
call dump_rax
554549
push rsi
@@ -573,10 +568,6 @@ dump_w_newline:
573568
jmp dump_w
574569

575570
dump_d:
576-
push rsi
577-
mov rsi, newline
578-
call ui_output
579-
pop rsi
580571
mov rax, rsi
581572
call dump_rax
582573
push rsi
@@ -601,10 +592,6 @@ dump_d_newline:
601592
jmp dump_d
602593

603594
dump_q:
604-
push rsi
605-
mov rsi, newline
606-
call ui_output
607-
pop rsi
608595
mov rax, rsi
609596
call dump_rax
610597
push rsi
@@ -635,10 +622,10 @@ peek:
635622
cmp byte [args], 3
636623
jl insuf
637624
jg toomany
638-
push rsi
639-
mov rsi, newline
640-
call ui_output
641-
pop rsi
625+
; push rsi
626+
; mov rsi, newline
627+
; call ui_output
628+
; pop rsi
642629
mov rsi, temp_string
643630
call string_length
644631
add rsi, 1
@@ -739,7 +726,7 @@ poke_q:
739726
jmp poke_end
740727

741728
poke_end:
742-
jmp poll
729+
jmp poll_nonewline
743730

744731
help:
745732
mov rsi, message_help
@@ -1233,11 +1220,11 @@ hextable: db '0123456789ABCDEF'
12331220
; Strings
12341221

12351222
prompt: db '> ', 0
1236-
message_ver: db 10, '1.0', 0
1237-
message_load: db 10, 'Enter file number: ', 0
1238-
message_unknown: db 10, 'Unknown command', 0
1239-
message_noFS: db 10, 'No filesystem detected', 0
1240-
message_help: db 10, 'Available commands:', 10, 'cls - clear the screen', 10, 'dir - Show programs currently on disk', 10, 'load - Load a program to memory (you will be prompted for the program number)', 10, 'exec - Run the program currently in memory', 10, 'ver - Show the system version', 10, 'peek - hex mem address and bytes (1, 2, 4, or 8) - ex "peek 200000 8" to read 8 bytes', 10, 'poke - hex mem address and hex value (1, 2, 4, or 8 bytes) - ex "poke 200000 00ABCDEF" to write 4 bytes', 10, 'dump - hex mem address, hex amount, bytes (1, 2, 4, or 8) - ex "dump 100000 10 4"', 0
1223+
message_ver: db '1.0', 0
1224+
message_load: db 'Enter file number: ', 0
1225+
message_unknown: db 'Unknown command', 0
1226+
message_noFS: db 'No filesystem detected', 0
1227+
message_help: db 'Available commands:', 10, 'cls - clear the screen', 10, 'dir - Show programs currently on disk', 10, 'load - Load a program to memory (you will be prompted for the program number)', 10, 'exec - Run the program currently in memory', 10, 'ver - Show the system version', 10, 'peek - hex mem address and bytes (1, 2, 4, or 8) - ex "peek 200000 8" to read 8 bytes', 10, 'poke - hex mem address and hex value (1, 2, 4, or 8 bytes) - ex "poke 200000 00ABCDEF" to write 4 bytes', 10, 'dump - hex mem address, hex amount, bytes (1, 2, 4, or 8) - ex "dump 100000 10 4"', 0
12411228
command_exec: db 'exec', 0
12421229
command_cls: db 'cls', 0
12431230
command_dir: db 'dir', 0
@@ -1265,12 +1252,12 @@ macsep: db ':', 0
12651252
dumpsep: db ': ', 0
12661253
newline: db 10, 0
12671254
tab: db 9, 0
1268-
insufargs: db 10, 'Insufficient argument(s)', 0
1269-
toomanyargs: db 10, 'Too many arguments', 0
1270-
invalidargs: db 10, 'Invalid argument(s)', 0
1271-
dirmsg: db 10, '# Name Size', 10, '-----------------------------', 0
1272-
dirmsgbmfs: db 10, 'BMFS', 0
1273-
dirmsgramfs: db 10, 'RAMFS', 0
1255+
insufargs: db 'Insufficient argument(s)', 0
1256+
toomanyargs: db 'Too many arguments', 0
1257+
invalidargs: db 'Invalid argument(s)', 0
1258+
dirmsg: db '# Name Size', 10, '-----------------------------', 0
1259+
dirmsgbmfs: db 'BMFS', 10, 0
1260+
dirmsgramfs: db 'RAMFS', 10, 0
12741261
initapp: db 'init.app', 0
12751262
dump_b_string: db ' | '
12761263
dump_b_chars: db ' ', 0

0 commit comments

Comments
 (0)