Skip to content

Commit 9845a38

Browse files
committed
Update README.md
Explain ascii codes
1 parent 7cd6dd0 commit 9845a38

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Chapter-5/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@ void Io::putc(char c){
2020
kattr = 0x07;
2121
unsigned char *video;
2222
video = (unsigned char *) (real_screen+ 2 * x + 160 * y);
23-
if (c == 10) {
23+
// newline
24+
if (c == '\n') {
2425
x = 0;
2526
y++;
26-
} else if (c == 8) {
27+
// back space
28+
} else if (c == '\b') {
2729
if (x) {
2830
*(video + 1) = 0x0;
2931
x--;
3032
}
31-
} else if (c == 9) {
33+
// horizontal tab
34+
} else if (c == '\t') {
3235
x = x + 8 - (x % 8);
33-
} else if (c == 13) {
36+
// carriage return
37+
} else if (c == '\r') {
3438
x = 0;
3539
} else {
3640
*video = c;

0 commit comments

Comments
 (0)