--- /dev/null
+# This test verifies the input/output IMP output character.
+
+SSSTSSSSSTN | ST: Push +65 (ASCII A)
+TNSS | IO: Output character
+NNN | FC: Terminate program
if (next_code_byte(code,pc) != '\v') ws_die(pc,"expected vtab, "
"perhaps a whitespace program, rather than vvhitespace?");
/* Jump to next instruction since labels were parsed during startup. */
- parse_label( code, pc);
+ parse_label(code, pc);
break;
case '\t':
/* Call a subroutine. */
/* Output */
{
switch (next_code_byte(code,pc)) {
- case ' ' : /* Output character from TOS */ printf("%c", stack_pop(sp)); break;
- case '\t': /* Output number from TOS */ printf("%d", stack_pop(sp)); break;
+ case ' ' : /* Output char from TOS */ printf("%c", stack_pop(sp)); break;
+ case '\t': /* Output digit from TOS */ printf("%c", stack_pop(sp)+'0'); break;
default : ws_die(pc, "malformed output IMP"); break;
}
fflush(stdout);
['4004_flowcontrol_jump_if_tos_is_negative', 'A'],
['4005_flowcontrol_jump_to_subroutine', 'A'],
['4006_flowcontrol_return_from_subroutine', 'A'],
+ ['5001_io_output_character', 'A'],
+ ['5002_io_output_digit', '2'],
]
for test in tests: