Skip to content

Commit 065600f

Browse files
committed
Change puts{,n} s.t. they print trailing newlines.
1 parent 2c6cedb commit 065600f

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

text-io/puts.dasm

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
;; puts (needs base screen routines)
55

66
; writes a null-terminated string to the current
7-
; position.
8-
; NOTE: In the current version it does *not* print
9-
; a trailing newline.
7+
; position. Writes a trailing newline.
108
:puts
119
IFE [A], 0
12-
SET PC, POP
10+
SET PC, newline ;; tail call
1311
SET PUSH, A
1412
SET A, [A]
1513
JSR putc
@@ -22,13 +20,12 @@
2220

2321
;; void putsn(char *src, char len)
2422
; writes a string of length n to the current
25-
; position. It is useful for printing a prefix of
26-
; a string or for pascal strings.
27-
; NOTE: In the current version it does *not* print
28-
; a trailing newline.
23+
; position. Writes a trailing newline. It is
24+
; useful for printing a prefix of a string or for
25+
; pascal strings.
2926
:putsn
3027
IFE B, 0
31-
SET PC, POP
28+
SET PC, newline ;; tail call
3229
SET PUSH, J
3330
SET PUSH, I
3431
SET J, A
@@ -42,4 +39,4 @@
4239
SET PC, putsn_loop
4340
SET I, POP
4441
SET J, POP
45-
SET PC, POP
42+
SET PC, newline ;; tail call

0 commit comments

Comments
 (0)