diff options
| author | s-ol <s+removethis@s-ol.nu> | 2021-07-06 12:38:21 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2021-07-06 12:39:34 +0000 |
| commit | c299060bc82e4e198891f4abeb293619cda75090 (patch) | |
| tree | bd609bc2fb7108e18070db9e79c6f3c2a94dde55 /hello_world.subv | |
| parent | fix hello_world comments (diff) | |
| download | subv-c299060bc82e4e198891f4abeb293619cda75090.tar.gz subv-c299060bc82e4e198891f4abeb293619cda75090.zip | |
reorganize, add ask_name example
Diffstat (limited to 'hello_world.subv')
| -rw-r--r-- | hello_world.subv | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/hello_world.subv b/hello_world.subv deleted file mode 100644 index 579a0e6..0000000 --- a/hello_world.subv +++ /dev/null @@ -1,42 +0,0 @@ -== code 0x80000000 - # trap all but first Hart (a0 = mhartid) - 63/branch 1/subop/!= a/rs/a0 0/rs/x0 0/off13 - -main: - # a0 = &message - # . load high bits - 37/lui a/rd/a0 Message/imm20hi - # . add low bits - 13/opi 0/subop/add a/rd/a0 a/rs/a0 Message/imm12lo - # call print - 6f/jal 1/rd/ra print/off21 -loop: - # infinite loop - 6f/jal 0/rd/x0 loop/off21 - -print: - # load 0x10010000 (UART0) into t0 - 37/lui 5/rd/t0 0x10010/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 - # print char - 23/store 2/width/word 5/rs/t0 6/rs/t1 0/off12 - # increment a0 - 13/opi 0/subop/add a/rd/a0 a/rs/a0 1/imm12 - # jump back up - 6f/jal 0/rd/x0 print:loop/off21 -print:break: - # return - 67/jalr 0/subop 0/rd/x0 1/rs/ra 0/off12 - -== data 0x80500000 -Message: - # "Hello World!\n\0" - 48/8 65/8 6c/8 6c/8 6f/8 20/8 77/8 6f/8 72/8 6c/8 64/8 21/8 0a/8 00/8 |
