
Sign up to save your podcasts
Or
In this episode I’m demonstrating how to print numbers in evenly spaced columns in Commodore BASIC.
On the C128 and the Plus/4 we can use a nifty little function called PRINT USING for this, with which we can format the output of any printed text or variable.
On the C64 and VIC-20 that function doesn’t exist, so we’ll have to convert a numeric value into a string (using the STR$ function), and then determine how long our string is. Following that we’ll have to manually pad our string value with as many spaces as are required.
Here’s the full code for the C128 and Plus/4, which is based on my earlier Lottery Number generator listing. PRINT USING appears in line 120:
And here’s the same listing without PRINT USING for the C64 and VIC-20. The string formatting happens in the subroutine in line 300:
Any questions, please let me know. Happy retro hacking!
PS: It got a bit dark there at the end on my webcam. Help me get some lights by supporting me on Patreon
In this episode I’m demonstrating how to print numbers in evenly spaced columns in Commodore BASIC.
On the C128 and the Plus/4 we can use a nifty little function called PRINT USING for this, with which we can format the output of any printed text or variable.
On the C64 and VIC-20 that function doesn’t exist, so we’ll have to convert a numeric value into a string (using the STR$ function), and then determine how long our string is. Following that we’ll have to manually pad our string value with as many spaces as are required.
Here’s the full code for the C128 and Plus/4, which is based on my earlier Lottery Number generator listing. PRINT USING appears in line 120:
And here’s the same listing without PRINT USING for the C64 and VIC-20. The string formatting happens in the subroutine in line 300:
Any questions, please let me know. Happy retro hacking!
PS: It got a bit dark there at the end on my webcam. Help me get some lights by supporting me on Patreon