X-Git-Url: http://git.subgeniuskitty.com/vvhitespace/.git/blobdiff_plain/3625ff3a8ea0b61d744da30237e6ffc993a585fb..45abb94e7cc7357b082f9ffda11077e2c606645e:/stdlib/stdio.pvvs diff --git a/stdlib/stdio.pvvs b/stdlib/stdio.pvvs index e0ff711..f18d97c 100644 --- a/stdlib/stdio.pvvs +++ b/stdlib/stdio.pvvs @@ -2,8 +2,10 @@ #define VVS_STDLIB_STDIO @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Name: +@ printstackstring (1000100) @ Description: -@ This function prints a null-terminated string from the stack. +@ Prints a null-terminated string from the stack. @ Call Stack: @ null-terminator (ASCII '\0') @ char n @@ -13,86 +15,95 @@ @ Return Stack: @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -NSSVTSSSN | Mark: 1000 (print string from stack) +NSSVTSSSTSSN | Mark: 1000100 (print string from stack) SNS | DUP -NTSSSSSTSSSSSSSSSSTN | BRZ > 00001000 00000001 +NTSSTSSSTSSSSSSSSSTN | BRZ > 01000100 00000001 TNSS | Print character -NSNTSSSN | JMP > 1000 -NSSVSSSSTSSSSSSSSSSTN | Mark: 00001000 00000001 +NSNTSSSTSSN | JMP > 1000100 +NSSVSTSSSTSSSSSSSSSTN | Mark: 01000100 00000001 SNN | DROP NTN | RTS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Name: +@ printheapstring (1000101) @ Description: -@ This function prints a null-terminated string from the heap. +@ Prints a null-terminated string from the heap. @ Call Stack: @ pointer to first character <-- TOS @ Return Stack: @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -NSSVTSSTN | Mark: 1001 (print string from heap) +NSSVTSSSTSTN | Mark: 1000101 (print string from heap) SNS | DUP TTT | LOAD SNS | DUP -NTSSSSSTSSTSSSSSSSTN | BRZ > 00001001 00000001 +NTSSTSSSTSTSSSSSSSTN | BRZ > 01000101 00000001 TNSS | Print character SSSTN | Push +1 TSSS | ADD -NSNTSSTN | JMP > 1001 -NSSVSSSSTSSTSSSSSSSTN | Mark: 00001001 00000001 +NSNTSSSTSTN | JMP > 1000101 +NSSVSTSSSTSTSSSSSSSTN | Mark: 01000101 00000001 SNN | DROP SNN | DROP NTN | RTS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Name: +@ printstacknumber (1010) @ Description: -@ This functions prints a number from the stack in sign-magnitude format. +@ Prints 'number' from the stack in sign-magnitude format. @ Leading zeros are suppressed. @ Call Stack: -@ number to print <-- TOS +@ number <-- TOS @ Return Stack: @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ NSSVTSTSN | Mark: 1010 (print number from stack) SNS | DUP -NSTTSSSSSSN | JSR > 1000000 -NSTTSSSSSTN | JSR > 1000001 +NSTTSSSSTSN | JSR > 1000010 +NSTTSSSSTTN | JSR > 1000011 NTN | RTS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Name: +@ printstacknumbersign (1000010) @ Description: -@ This functions prints the sign of a number from the stack. +@ Prints the sign of 'number' from the stack. @ Call Stack: -@ number to print <-- TOS +@ number <-- TOS @ Return Stack: @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -NSSVTSSSSSSN | Mark: 1000000 (print sign of number from stack) -NTTSTSSSSSSSSSSSSSTN | BMI > 010000000 00000001 +NSSVTSSSSTSN | Mark: 1000010 (print sign of number from stack) +NTTSTSSSSTSSSSSSSSTN | BMI > 01000010 00000001 SSSTSTSTTN | PUSH ASCII '+' -NSNSTSSSSSSSSSSSSTSN | JMP > 010000000 00000010 -NSSVSTSSSSSSSSSSSSSTN | Mark: 010000000 00000001 +NSNSTSSSSTSSSSSSSTSN | JMP > 01000010 00000010 +NSSVSTSSSSTSSSSSSSSTN | Mark: 01000010 00000001 SSSTSTTSTN | PUSH ASCII '-' -NSSVSTSSSSSSSSSSSSTSN | Mark: 010000000 00000010 +NSSVSTSSSSTSSSSSSSTSN | Mark: 01000010 00000010 TNSS | PUTC NTN | RTS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Name: +@ printstacknumbermagnitude (1000011) @ Description: -@ This functions prints the magnitude of a number from the stack. +@ Prints the magnitude of 'number' from the stack. @ Call Stack: -@ number to print <-- TOS +@ number <-- TOS @ Return Stack: @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -NSSVTSSSSSTN | Mark: 1000001 (print magnitude of number from stack) +#include +NSSVTSSSSTTN | Mark: 1000011 (print magnitude of number from stack) NSTTSSSTN | JSR > 10001 (absolute value) SSSSN | PUSH ASCII '\0' SNT | SWAP @ Pick off one digit on each pass through this loop. -NSSVSTSSSSSTSSSSSSSSN | Mark: 01000001 00000000 +NSSVSTSSSSTTSSSSSSSSN | Mark: 01000011 00000000 SNS | DUP @ Mod-off a digit, convert to ASCII, store on stack as part of the string. @@ -106,15 +117,13 @@ SNT | SWAP SSSTSTSN | PUSH +10 TSTS | DIVIDE SNS | DUP -NTSSTSSSSSTSSSSSSSTN | BRZ > 01000001 00000001 -NSNSTSSSSSTSSSSSSSSN | JMP > 01000001 00000000 +NTSSTSSSSTTSSSSSSSTN | BRZ > 01000011 00000001 +NSNSTSSSSTTSSSSSSSSN | JMP > 01000011 00000000 @ Print the string we have built on the stack. -NSSVSTSSSSSTSSSSSSSTN | Mark: 01000001 00000001 +NSSVSTSSSSTTSSSSSSSTN | Mark: 01000011 00000001 SNN | DROP -NSTTSSSN | JSR > 1000 (print string from stack) +NSTTSSSTSSN | JSR > 1000100 (print string from stack) NTN | RTS -#include - #endif