diff options
| author | s-ol <s+removethis@s-ol.nu> | 2021-07-06 15:00:17 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2021-07-07 09:05:22 +0000 |
| commit | b4e320be45c3f1afa61d74222000ae22fd00daff (patch) | |
| tree | 871d0d4260292ba48bacbd51fcf9e8b2848cbf4f /examples/hello_world.subv | |
| parent | reorganize, add ask_name example (diff) | |
| download | subv-b4e320be45c3f1afa61d74222000ae22fd00daff.tar.gz subv-b4e320be45c3f1afa61d74222000ae22fd00daff.zip | |
switch to "virt" qemu machine
Diffstat (limited to 'examples/hello_world.subv')
| -rw-r--r-- | examples/hello_world.subv | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/hello_world.subv b/examples/hello_world.subv index 579a0e6..aa044ae 100644 --- a/examples/hello_world.subv +++ b/examples/hello_world.subv @@ -1,6 +1,6 @@ -== code 0x80000000 +== code 0x80400000 # trap all but first Hart (a0 = mhartid) - 63/branch 1/subop/!= a/rs/a0 0/rs/x0 0/off13 + # 63/branch 1/subop/!= a/rs/a0 0/rs/x0 0/off13 main: # a0 = &message @@ -12,20 +12,21 @@ main: 6f/jal 1/rd/ra print/off21 loop: # infinite loop - 6f/jal 0/rd/x0 loop/off21 + 6f/jal 0/rd/x0 main/off21 print: - # load 0x10010000 (UART0) into t0 - 37/lui 5/rd/t0 0x10010/imm20 + # load 0x10000000 (UART0) into t0 + 37/lui 5/rd/t0 0x10000/imm20 print:loop: # load unsigned byte at a0 03/load 4/subop/byte 6/rd/t1 a/rs/a0 0/imm12 # break loop if zero 63/branch 0/subop/== 6/rs/t1 0/rs/x0 print:break/off13 print:spin: - # spin if FIFO is full - 03/load 2/subop/word 7/rd/t2 5/rs/t0 0/imm12 - 63/branch 4/subop/< 7/rs/t2 0/rs/x0 print:spin/off13 + # spin if FIFO is full (thr_emtpy = UART+5 & 0x20) + 03/load 4/subop/byte 7/rd/t2 5/rs/t0 5/imm12 + 13/opi 7/subop/and 7/rd/t2 7/rs/t2 20/imm12 + 63/branch 0/subop/== 7/rs/t2 0/rs/x0 print:spin/off13 # print char 23/store 2/width/word 5/rs/t0 6/rs/t1 0/off12 # increment a0 |
