Skip to content

WADUZITDO: How to write a language in 256 words (more) or less

License

Notifications You must be signed in to change notification settings

dimitrit/waduzitdo

Repository files navigation

WADUZITDO

An implementation of WADUZITDO for the KIM-1.

Introduction

WADUZITDO is a high level interpreted language that fits in under 256 bytes of memory on a 6502 based system. The language was conceived by Larry Kheriaty to demonstrate 'what a computer can do in a manner simple enough for almost anyone to understand'. 1

WADUZITDO statements

WADUZITDO is derived from the PILOT language 2. For the sake of simplicity WADUZITDO supports only 5 statements:

T:text
The type statement displays a line of text on the terminal.

A:
The accept statement allows the program to receive 1 input character from the terminal keyboard.

M:character
The match statement is used to test the characted entered by the user on a previous accept. The character in the statement is compared to the last character entered by the user. The result of the match is recorded in the match flag: Y if the match is equal, N if it is not equal.

Y<statement>
N<statement>
Statements can be conditionally executed after the match flag is set. This is done by placing either a Y (yes) or N (no) immediately before a statement.

J:<number>
Statements are executed sequentially. The jump statement can be used to alter the normal sequence. The jump statement J is followed by a colon and a number from zero to nine. The J:0 statement causes a branch back to the most recently executed accept statement. Other values, one to nine, cause a branch to the nth program marker * forward from the jump.

S:
The stop statement terminates execution of the program and returns control to the WADUZITDO editor.

Example code

Following is a simple example that demonstrates some of WADUZITDO's capabilities:

    T:WHAT IS 2+3?
    A:
    M:5
    NT:NO, TRY AGAIN:  
    NJ:0
    T:FIVE IS RIGHT!
    S:

Further examples may be found in this repository.

WADUZITDO editor

The WADUZITDO environment includes a simple editor. Because of the editor's significant limitations it is considerably easier to write programs in a more capable editor and then copy and paste them into WADUZITDO. Nevertheless, following are the editor commands for those who relish a 'retro' experience:

$
Start execution.

\
Move edit pointer to the start of the program.

/
Display the next line of the program.

%
Pad remainder of the current line with nulls.

(or Backspace)
Backspace to correct typing error.

(or Enter)
End program line or statement.

All other characters typed are stored in program memory. With each character typed the edit pointer is advanced by one position. This pointer may be reset using the \ command. Existing lines may be listed using the / character, or overtyped and padded using the % character.

Program lines should not exceed 64 characters. The length of user programs is limited 256 bytes3.

Note that because of WADUZITDO's minimal (i.e. non-existent!) error checking and error handling capabilities, it is easy to get into a situation which requires the system to be restarted.

Refer to Kheriaty's BYTE article for further details on WADUZITDO statements and the editor.

Building WADUZITDO

The source code uses vasm '8-bit oldstyle' syntax 4 and can be built using the vasm6502_oldstyle assembler. This assembler, and the sources required to build it, can be downloaded from the vasm website 5. Since the code does not make use of vasm specific features it should be relatively simple to modify it for other 6502 compilers.

A Makefile is provided for environments that support make(1).

Footnotes

  1. Larry Kheriaty, ‘WADUZITDO: How to Write a Language in 256 Words or Less’, in The BYTE Book of Pascal, ed. by Blaise W. Liffick (Peterborough, NH: BYTE Publications, 1979), pp. 97–105.

  2. ‘PILOT’, Wikipedia, 2021 https://en.wikipedia.org/w/index.php?title=PILOT&oldid=1058013823 [accessed 1 January 2023].

  3. An 'extended' version, ewaduzitdo, is included in which user programs can occupy all remaining ram. Note however that this version does not fit in 256 bytes of memory!

  4. Volker Barthelmann and Frank Wille, ‘Vasm Assembler System’ (2022), http://sun.hasenbraten.de/vasm/release/vasm.pdf [accessed 25 November 2022].

  5. Volker Barthelmann and Frank Wille, 'vasm: A portable and retargetable assembler' (2022), http://sun.hasenbraten.de/vasm/index.php?view=binrel [accessed 6 December 2022].

About

WADUZITDO: How to write a language in 256 words (more) or less

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published