Close

Sample Program

A project log for A 16-bit CPU in Logisim

A custom 16-bit CPU created in Logisim

MartianMartian 05/13/2020 at 13:120 Comments

I use the following program to print the text from Edgar Allan Poe's The Raven from RAM to the TTY output, it loops until system reset.

$0000 loads the hex number #1000 into register R0
$0002 loads the hex number #0001 into register R1
$0004 load value of register R0 into register R3
$0005 output R3 to I/O channel 0 (TTY)
$0006 into R0 add R1
$0007 jump back to address $0004

 Assembled program:

0000     1400 1000      LDW R0, #1000   
0002     1410 0001      LDW R1, #0001   
0004     1230 ----      LDW R3, $R0   
0005     4230 ----      PUT R3, @0   
0006     8001 ----      ADD R0, R1   
0007     7000 0004      JMP $0004   
0009     0000 ----      HLT 

 'The Raven' text encoded from address $1000 onwards (below is an example):

1000      0045  0064  0067  0061  0072  0020  0041  006C 
1008      006C  0061  006E  0020  0050  006F  0065  000D 

...etc...

Discussions