Login
Know-How C16
Title:Know-How C16
Category:Educational
Release Date:
Language:English
Size:16K
Device Req.:Disk only (1 side)
Machine:PAL & NTSC
Code Type:Basic
Distribution:Freeware
Code by:Fishhack
Notes:AKA Der WDR Papiercomputer-Emulator, The Know-How Paper Computer. Emulates the WDR Papiercomputer, developed in 1983 for the West German television program "WDR Computerclub".
  Download:
Download from Plus/4 World
Plus/4 World
Download from Rulez.org
Rulez.org
Download from Othersi.de
Othersi.de
  Source code:
Download from Plus/4 World
Plus/4 World
  External links:
    Wikipedia

No votes yet.
Know-How C16 Title Screenshot

Know-How C16 Screenshot


Description

===============================
Der WDR Papiercomputer-Emulator
or
The Know-How Paper Computer
===============================

by Dave Hassler

for Commodore 16 and Plus/4

Released under the MIT License, April 15, 2025

INTRODUCTION:

This program emulates the WDR Papiercomputer, developed by Wolfgang Back
and Ulrich Rohde in 1983 for the West German television program
"WDR Computerclub." Originally, the computer model was drawn on a piece of
paper, with a program "tape" (of sorts) on the left side that held the
ordered program instructions, and on the right side a number of boxes
representing registers "within" the computer. Users could use matches, paper
clips, coins, or whatever small things were handy to represent the numerical
contents of a register.
The Papiercomputer was wildly popular, with over 400,000 copies printed,
and many more thousands were likely drawn on notebook paper. By any account,
it was one of the most widely distributed computing products in Europe in
the 1980s. As late as the mid-2010s, a version of the Know-How computer
was used in Namibia to teach programming concepts to children. Wikipedia
has a nice article on the computer at:
https://en.wikipedia.org/wiki/WDR_paper_computer

This emulator takes a few small liberties with the original concept. The
registers are named A through E, instead of 1 through 8. The emulator
operates on an 8-bit word: the high 3 bits are for the opcode and the bottom
5 bits for either the program counter value or register identification.
Numerical values are from 0-31 (that's a lot of matches!), as are program
line numbers. Other emulators (such as for Windows or Javascript) allow for
much larger programs and value ranges, and sometimes even additional opcodes;
I have stuck with the five original opcodes from the papiercomputer, which
still presents a "Turing complete" computing environment. Program line numbers should start with 0 rather than 1. Other than that, the emulator
behaves as expected.


OPERATION:

The emulator is divided into two main sections: the Editor and the Run
Module. Other things one can do from the Main Menu are: L)OAD a previously
saved tape/program (an SEQ file), S)AVE a tape you made in the editor, get
I)NFO on using the emulator, and E(X)IT the emulator.

The Editor
From the Main Menu, press E for the E)dit option. Now one can enter and
edit program "tapes" -- think old paper tapes containing punched code,
chugging through an ASR-33...

There are five instructions available to the Know-How emulator:

HLT (opcode 000, octal) - Stop execution of a running program
INC (opcode 001) - Increment a register by one (+1)
DEC (opcode 010) - Decrement a register by one (-1)
JMP (opcode 011) - Set the Program Counter to the line referenced
ISZ (opcode 100) - Test for a zero (0) condition in a register
if not zero, +1 the Program Counter;
if zero, +2 the Program Counter.

Code is entered into the editor in the following format:
## mnemonic operand
E.g., 4 ISZ B means line 4 of the program/tape will hold the opcode for the
ISZ mnemonic and test Register B for a zero condition. *The space between
the line number and mnemonic, and between the mnemonic and operand, are
required.*
Enter the lines in sequential order, starting with Line 0. You can enter
lines of code out of sequence, but because the "tape" is initialized with
all zeros (also the opcode for HLT), two lines of 0 will stop a listing. If,
after Line 0, you entered 12 DEC C then Line 12 would be "punched" into the
tape array, but will not list, because it's all 0 between Lines 0 and 12.
Last on listing, the very last instruction listed will be HLT, regardless of
whether you entered it.
The editor has some basic error checking during code entry, but it may not
catch everything. If you make a mistake during entry, do NOT use the C16
screen editor! To edit a tape/program, simply enter new instructions for the
line. E.g., Line 8 is: 8 INC A but you decide that's an error and that line
should jump to Line 11. Enter 8 JMP 11 and the new code will replace the
first Line 8.

The Run Module
When R)UN is selected from the Main Menu, the user is asked to enter
"initial values" for the five registers. This is in keeping with the spirit
of the original papiercomputer, which had users place counters in the
register boxes before "running" their code: there are no load instructions
for the registers anyway. :^)
The user has the option to allow the program to run continuously or via
single-step: one instruction at a time. After an instruction executes, a
green pointer will show which instruction will execute next, allowing one
to follow the flow and logic of a program. Once a program finishes, you can
either go to the Main Menu, or run the program again with the same or
different values in the registers.


SAMPLE TAPES/PROGRAMS:

Here is a sample program that adds two numbers together:

0 JMP 3 <-- jump to line 3 to see if nothing left to add
1 DEC B <-- subtract 1 from Register B
2 INC A <-- add 1 to Register A
3 ISZ B <-- is B empty? If no, +1 the PC; if yes, +2.
4 JMP 1 <-- (no) go do some more starting at line 1
5 HLT <-- (yes) then we're done

The result will be in Register A. The first JMP at line 0 is to see if
the user wanted to do something like 3+0 -- that's just 3, which is already
in Register A.

On the .D64 image included in this archive is an SEQ file called MULT A&B.
It's one solution (mine!) of doing multiplication, as long as the product won't exceed 31 (it still works, just with "rollover"). Initial register
setup should be as follows: A = multiplicand, B = multiplier, and
C-E = 0. The result will be in Register C. The listing is not included
here, because it might be more fun to come up with your own solution.
The same for the tape DIVIDE A BY B on the .D64. If you do run it, put
the dividend in A, divisor in B, C-E = 0. The result can be read as follows:
If, on conclusion of the run, Register B is zero (empty, meaning the dividend
was evenly divisible by the divisor), the answer is in Register C. If
Register B contains anything at run's end, the quotient is in C and the
remainer is in Register D. But again, "rolling your own" will likely be
more fun.


NOTES, CONSIDERATIONS, IDEAS:

If a program crashes during a run, or enters an endless loop, break out
of it with the RUN/STOP key. To resume without loss of tape data (but you
*did* save it before running it, didn't you?), type GOTO 30 instead of RUN.
The emulator runs quite slowly: it's going through code at about 1 second
per instruction -- that's roughly the equivalent of a 4.5 Hertz clock speed!
Yikes! But, considering the thing is written in BASIC and its target
audience (kids, or +50-year-old computer nostalgia nerds!), the speed should
not be an issue. The single-step option is more for when time is needed to
figure out or explain a bit of code to someone else, or when testing.
One option I thought about was adding some bit-shifting opcodes (there's
room for two more codes in my setup), either ROL and ROR or LSR and ASL (but
without a carry bit in play) since I have the emulator set up to have the
registers "roll around," up from 31 to 0, and down from 0 to 31. That would
need a 5-bit display to be added to the end of each register's output.
Another thought is expanding the JMP mnemonic to allow access to more
than 32 lines of code, maybe to a range of 0-63 for a JMP, doubling the
potential size of a program. Or create a new JPX instruction for 0-63, if
you want to leave the JMP alone. I don't think most people will want to
write programs greater than 32 lines of Know-How code, but anyone is more
than welcome to extend this thing in any way she sees fit.
Along those lines, on the .D64 image in this archive (as well as a text
file version) is a "generic version" of the emulator that, with a few tweaks,
should run under almost any early version of BASIC (MITS Altair BASIC 1.1
had some issues, but CBM BASIC 2.0 and TSC BASIC 2 for 6800 had no issues).
Feel free to tinker with it.
I wrote this on a lark, and also to to learn about making custom
characters with CBM BASIC 3.5. As of this writing, I've only had a C16 for
a few months, and I totally dig it -- with the exception of sound, it's a
big improvement over my beloved VIC-20 of youth.

Have fun!
Dave Hassler, 18.Apr.2025
www.vanportmedia.com/PAL-1/cbm
www.vanportmedia.com/hm68


THE LICENSE:

The MIT License (MIT)

Copyright © 2025 David H. Hassler

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © Plus/4 World Team, 2001-2025. Support Plus/4 World on Patreon