Kenbak-1 JS Help

This emulator is avaliable at:



Kenbak-1 JS is an emulator and simple debugging tool for the Kenbak-1 computer.

This was a holiday weekend project, so the quality of the source code (and this documentation) is disturbingly low. I hope to correct this over time.

While it correctly executes the two programs I found online and all the exercises I tried from the laboratory exercises book there are bound to be a few bugs. If you find one, please send an email to I'll do my best to have the error corrected as quickly as possible.

The Console

The console functions exactly like the Kenbak-1 computer with some differences:

  • The single-step feature is accessed by clicking between the stop and start buttons as only one button may be pushed at a time. (On a proper Kenbak-1 computer, single-stepping is achieved by holding the stop button down while pressing the start button.)
  • While in the Run state, pressing one of the data buttons does not show both the contents of locations 200 and 377 (with 377 predominantly displayed). Instead, only the contents of 377 are shown.
  • When the power switch is set to the "on" position, all memory locations are initialized to zero rather than to random values.
  • Pressing the start and stop buttons after the computer is first switched on (as recommended in the manual) is not necessary.
  • The speed is not very accurate and will vary between computers and browsers. Unexpected changes in speed may also occur. The intended speed (instructions per second) can be adjusted using the Options tool.

  • Memory Viewer

    The Memory Viewer displays the entire contents of the Kenbak-1's memory. Clicking the Memory Viewer link will both display the tool and update its contents. All values are shown in Octal. The memory location specified by the P register (at address 003) is displayed in bold type. Registers are underlined.

    By default, the contents of the Memory Viewer are updated after every instruction. This can be disabled using the Options tool.

    Memory Loader

    The Memory Loader tool loads a program into memory according to the following rules:
    1. All values are assumed to be 3 octal digits in length, separated by spaces, tabs, or newlines
    2. Any value with a colon (:) suffix is assumed to be an address. Values that follow will be stored, in order, starting at that address
    3. The program is loaded "line-by-line". If an invalid token (anything other than a properly formed value or address) is encountered, the rest of the line will be ignored.

    Example 1: Load a program into memory, starting at address 0
    000 000 000 004
    023 000 034 200
    000 003 001 344
    Example 2: Load the same program above, starting at address 3
    003: 004
    023 000 034 200
    000 003 001 344
    Example 3: Load a program that includes comments
    // Lab Exercise 6  // 
    (From the Laboratory Exercises book)
    Add Input to A, display A, then stop
    If bit 7 of input is 1, set A=0
    000: 000 A
         000 B
         000 X
         021 P
    004: 000 Halt (waiting for input)
         272 Skip if Input bit 7 is set
         344 Jump Direct Unconditional
         021    (to [Start])
         004 Add A Memory
         377    (Add Input to A)
    013: 034 Store A Memory 
         200    (Show Result)
         134 Store B Memory 
         377    (Clear Input)
         344 Jump Unconditional
         004     (program stops)
    021: 023 Load A Immediate [Start]
         344 Jump Direct Unconditional
    024: 013 

    Note: The user is not notified that a program has been successfully loaded into memory.

    Break Points

    Break Points are conditions that, when true, halt execution of the program. A total of eight conditions can be set.

    Each condition tests a memory location to determine if it contains a specific value. A maximum of two addresses may be checked per condition. If the value of two locations are tested, the results of each are logically combined using And, Or, or [And] Not. If no logical operator is specified, the second test is ignored.

    To the left of each condition is a check box. If left unchecked, the condition will be ignored.

    Break when the Program Counter reaches address 035
        003  =  035  ---       =      
    Break when the Program Counter reaches 035 and the A register contains a 0
        003  =  035  And  000  =  000 
    Break when either the A or B register contains a 7
        000  =  007  Or  001  =  007 
    Break when the B register contains a 7 and the X register does not
        001  =  007  Not  002  =  007 
    Note: The user is not notified when a break condition is met. The run light even stays on.


    The Options tool allows the user to make changes to different aspects of this program. All options (except "Instructions Per Second") can either be enabled (checked) or disabled (unchecked).

    The Instructions Per Second (ips) option sets the speed at which the program will execute when the run button is next pressed. Changing this value while the program is in the run state will have no effect. The default speed is 18 ips. Internally, this setting sets the delay between instructions in milliseconds (18 ips = 56 ms).