johnny - documentation

Simulation of a von neumann arcitecture

The core of this version is at https://github.com/Laubersheini/johnny to be found. This version contains a lot additional and useful features besides bugfixes.

johnny - modifications

johnny changes

This edited version can be viewed at https://tobisma.github.io/johnny

overview about the numbers used in a *.mc file

Number Corresponding button
0 no instruction
1 db --> ram
2 ram --> db
3 db --> ins
4 ins --> ab
5 ins --> mc
6 none
7 mc:=0
8 pc --> ab
9 pc++
10 =0?pc++
11 ins --> pc
12 acc:=0
13 plus
14 minus
15 acc --> db
16 acc++
17 acc--
18 db --> acc
19 stop

Made by Sagalim and Isabell05

how does single micro code instruction editing work?

To get the menu for editing you need to make a click on the entry in the micro code table. Then, an prompt pops up asking for a number or a button. The numbers are the micro code instrcution numbers listed in the table above. When clicking on the input field a list with possible optinos will show.

The buttons are text input. They are parsed by checking the start of the input and the end. You can either just type out the full button like db --> ram or continue reading to understand how to shorten your buttons. The numbers are the shortest way, but also the most complicated. As always, there are exceptions. Those are listed at the end.

Buttons are built using the following operators and destinations:

Destinations

Destination Component
ram RAM
db Data Bus
mc micro code
ins instruction register
pc program counter
acc accumulator

Operators

Operators are always used after an Destination

Operator Meaning
+ increase the destination by one if such an button exists (e. g. pc+ for pc++)
- same as the +-operator but for decreasing
0 reset the destination to zero (e. g. acc0 means acc:=0)

how to build your buttons

from destination to destination

just type the first destination (the starting point) followed by the second destination. For example, dbram would translate to db --> ram or insab would translate to ins --> ab. As mentioned in the beginning typing db --> ram works fine as well, because it still starts with db and ends with ram.

destination prepended to an operator

Examples: acc-, pc+, mc0
acc- and pc+ just mean acc++ and pc++. It is just an character shorter
mc0 is a bit more complicated but button inputs ending on 0 mean to reset the destination. So, mc0 refers to mc:=0 and acc0 would be acc:=0.

The exceptions

Input Corresponding button Example inputs, which are valid for the button
plus plus
minus minus
^sub minus subtract
stop stop
^=$+ =0?pc++ =0?+, =+, =0?pc+


For example ^'ram' $'db' describes that the input needs to start with ram and needs to end with db. This input corresponds to the button ram --> db


shortcuts

basic shortcuts for menu and RAM

Actions on RAM which are possible from micro code, as well (e. g. save) are with perssing ⇧ Shift additionally.

Key Action Key meaining & Notes
E Reset & Execute Program Execute
R Reset Reset
S Execute one macro step Step
P Pause execution Pause
⇧ Shift S Execute one micro step Step
Move one up in RAM
Move one down in RAM
K Move one up in RAM Vim keybinding
J Move one down in RAM Vim keybinding
U Toggle control unit view Unit
+ Make execution faster
- Make execution slower
Alt C Clear Ram Clear
⌥ Option C Clear RAM Clear
Alt ⇧ Shift C Reset micro code Clear
⌥ Option ⇧ Shift C Reset micro code Clear
: Enter command mode for buttons Vim keybinding
v Enter command mode for buttons Vim
D Focus Data bus input Data Bus
A Focus Address bus input Address Bus
W Focus RAM row input Write (to RAM)
Insert Insert row above current selected row in RAM Insert
⇧ Shift Del Remove current selected row in RAM Delete
⇧ Shift A Focus the address input for custom macro codes Address (and Shift because microcode)
⇧ Shift N Focus the name input for custom micro codes Name (and Shift because microcode)
⇧ Shift Q record a microcode as in vim macros (you are recording a macrocode after all xD)
⇧ Shift Enter record a microcode works only in the input fields for address and name of a custom makrocode. Exists because ⇧ ShiftQ will be disabled
Del Remove current selected row in RAM Delete (disabled per default; change in settings)
⌃ Ctrl O Opening RAM file from disk Open
⌃ Ctrl ⇧ Shift O Opening micro code file from disk Open
⌃ Ctrl S Saving current RAM to file Save
⌃ Ctrl ⇧ Shift S Saving current micro code to file Save

shortcuts for buttons like ram --> db

Those shortcuts are in VIM style meaning you need to enter command mode first by pressing :(VIM keybinding) or V (added by this website). Afterwards you type the commmand from the list below. Then press ⏎ Enter to emulate pressing the button. While in command mode you can press Esc or ^ Ctrl C to leave command mode. While in command mode all basic shortcuts above are disabled. The visual feedback is in command mode in the bottom left corner.

List of commands in command mode

Command Button Meaning & Notes
a ManuellAb
a+ acc++
a++ acc++
a- acc--
a-- acc--
a0 acc:=0
ar acc:=0
i Insert Row Inserts always above selection (like in vim before the cursor)
dr db --> ram
rd ram --> db
d ManuellDb
da db --> acc
p plus plus
s minus subtract
ad acc --> db
di db --> ins

List of commands for the control unit

NOTE: they are also working when the control unit is not visible

Command Button Meaning
im ins --> mc
ip ins --> pc
ia ins --> ab
pa pc --> ab
p+ pc++
p++ pc++
=0 =0?pc++
m0 mc:=0
stop stop
h stop HALT program

List of commands for menu bar

Command Button
lr Load RAM
lm Load microcode
sr Save RAM
sm Save microcode
cr Clear Ram
cm Clear microcode
rec Record micro code
cnf Open settings

How to remember them?

They are made of "operators" (and similar to the buttons read when editing micro instructions):

Operator Meaning(s) Type
a Accumulator, Address Bus Destination
d Data Bus Destination
r Ram Destination
p Program counter Destination
i Instruction Register Destination
m Micro code Location
l Load Action
s Save Action
c Clear Action

By putting them together buttons like ram --> db are represented as rd with the meaning from r(ram) to d(data bus).

Adding + or - causes counting buttons to be triggered. For example p+ means to add to the program counter. An alias would be p++. Just for the case someone types two +. In a context like a+ the a stands for Accumulator instead of Address Bus because there are no counting buttons for the address bus.

browser compatibility

I recommend to use Firefox (continue reading for the reason).
This website works on Firefox and chromium based browsers (Edge, Chrome, ...). Not listed browsers have not been tested which does not mean they are not compatible.

NOTE: If the dataset gets larger the time to update the RAM rows becomes longer. But it has been fixed, so that chromium base browser only need ~500ms instead of 3.5sec

package using electron

  1. Clone the repository locally and move into the folder
  2. Run npm install
  3. Make sure npx is globally accessable, otherwise edit either package.json to match your requirements or install npx
  4. For Windows run npm run package-win and for linux run npm run package-linux. This will create a folder in executables for the windows or linux executable version. Beware, that it overwrites this folder, should this folder already exist and it is always for the x64 arcitecture. To change that behaviour, edit the package.json file
  5. Go into the generated folder and run Johnny.exe to start the app