Skip to content

Commit

Permalink
2.3.3: several minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
acaldero committed Oct 6, 2024
2 parents 2203138 + b62fa24 commit e053987
Show file tree
Hide file tree
Showing 451 changed files with 557 additions and 484 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![codebeat badge](https://codebeat.co/badges/66773495-9967-4514-8c2c-916293f584b5)](https://codebeat.co/projects/github-com-acaldero-wepsim-master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/579e744cedde4dc78f8084d9db7abd32)](https://app.codacy.com/gh/acaldero/wepsim/dashboard)
[![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)
[![Release](https://img.shields.io/badge/Stable-2.3.2-green.svg)](https://github.com/acaldero/wepsim/releases/tag/v2.3.2)
[![Release](https://img.shields.io/badge/Stable-2.3.3-green.svg)](https://github.com/acaldero/wepsim/releases/tag/v2.3.3)


## Table of contents
Expand Down Expand Up @@ -43,9 +43,9 @@
```
* Get WepSIM by executing:
```bash
wget https://github.com/acaldero/wepsim/releases/download/v2.3.2/wepsim-2.3.2.zip
unzip wepsim-2.3.2.zip
cd wepsim-2.3.2
wget https://github.com/acaldero/wepsim/releases/download/v2.3.3/wepsim-2.3.3.zip
unzip wepsim-2.3.3.zip
cd wepsim-2.3.3
npm install terser jq jshint yargs clear inquirer fuzzy inquirer-command-prompt inquirer-autocomplete-prompt
```
* Execute wepsim.sh with the help flag in order to show the available command switches:
Expand Down Expand Up @@ -310,12 +310,12 @@ Micropc at 0x1. Activated signals are: TA R BW M1 C1. Associated actions are: Co
!echo "(1/4) Installing pre-requisites..."
!npm install terser jq jshint yargs clear inquirer >& /dev/null
!echo "(2/4) Downloading WepSIM..."
!wget https://github.com/acaldero/wepsim/releases/download/v2.3.2/wepsim-2.3.2.zip >& /dev/null
!unzip -o wepsim-2.3.2.zip >& /dev/null
!rm -fr wepsim-2.3.2.zip
!wget https://github.com/acaldero/wepsim/releases/download/v2.3.3/wepsim-2.3.3.zip >& /dev/null
!unzip -o wepsim-2.3.3.zip >& /dev/null
!rm -fr wepsim-2.3.3.zip
!echo "(3/4) Executing WepSIM..."
!./wepsim-2.3.2/wepsim.sh -a stepbystep -m ep -f ./wepsim-2.3.2/repo/microcode/mips/ep_base.mc -s ./wepsim-2.3.2/repo/assembly/mips/s1e1.asm > ./result.csv
!rm -fr wepsim-2.3.2
!./wepsim-2.3.3/wepsim.sh -a stepbystep -m ep -f ./wepsim-2.3.3/repo/microcode/mips/ep_base.mc -s ./wepsim-2.3.3/repo/assembly/mips/s1e1.asm > ./result.csv
!rm -fr wepsim-2.3.3
!echo "(4/4) Showing execution trace as table..."
import pandas as pd
Expand Down Expand Up @@ -544,3 +544,4 @@ cordova run android
adb -d install -r ./platforms/android/app/build/outputs/apk/debug/app-debug.apk
```


2 changes: 1 addition & 1 deletion devel/mk_cordova.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


#*
#* Copyright 2015-2024 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#* Copyright 2015-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#*
#* This file is part of WepSIM.
#*
Expand Down
2 changes: 1 addition & 1 deletion devel/mk_dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


#*
#* Copyright 2015-2024 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#* Copyright 2015-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#*
#* This file is part of WepSIM.
#*
Expand Down
4 changes: 2 additions & 2 deletions devel/mk_i18nlang.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


#*
#* Copyright 2015-2024 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#* Copyright 2015-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#*
#* This file is part of WepSIM.
#*
Expand Down Expand Up @@ -620,7 +620,7 @@ def print_content(L_D, C_N):

# + print header
f.write("/*\n") ;
f.write(" * Copyright 2015-2024 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve\n") ;
f.write(" * Copyright 2015-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve\n") ;
f.write(" *\n") ;
f.write(" * This file is part of WepSIM.\n") ;
f.write(" *\n") ;
Expand Down
2 changes: 1 addition & 1 deletion devel/mk_zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


#*
#* Copyright 2015-2024 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#* Copyright 2015-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#*
#* This file is part of WepSIM.
#*
Expand Down
Binary file modified devel/output/0.txt.gz
Binary file not shown.
Binary file modified devel/output/1.txt.gz
Binary file not shown.
Binary file modified devel/output/10.txt.gz
Binary file not shown.
Binary file modified devel/output/100.txt.gz
Binary file not shown.
Binary file modified devel/output/101.txt.gz
Binary file not shown.
Binary file modified devel/output/102.txt.gz
Binary file not shown.
Binary file modified devel/output/103.txt.gz
Binary file not shown.
Binary file modified devel/output/104.txt.gz
Binary file not shown.
Binary file modified devel/output/105.txt.gz
Binary file not shown.
Binary file modified devel/output/106.txt.gz
Binary file not shown.
Binary file modified devel/output/107.txt.gz
Binary file not shown.
Binary file modified devel/output/108.txt.gz
Binary file not shown.
Binary file modified devel/output/109.txt.gz
Binary file not shown.
Binary file modified devel/output/11.txt.gz
Binary file not shown.
Binary file modified devel/output/110.txt.gz
Binary file not shown.
Binary file modified devel/output/111.txt.gz
Binary file not shown.
Binary file modified devel/output/12.txt.gz
Binary file not shown.
Binary file modified devel/output/13.txt.gz
Binary file not shown.
Binary file modified devel/output/14.txt.gz
Binary file not shown.
Binary file modified devel/output/15.txt.gz
Binary file not shown.
Binary file modified devel/output/16.txt.gz
Binary file not shown.
Binary file modified devel/output/17.txt.gz
Binary file not shown.
Binary file modified devel/output/18.txt.gz
Binary file not shown.
Binary file modified devel/output/19.txt.gz
Binary file not shown.
Binary file modified devel/output/2.txt.gz
Binary file not shown.
Binary file modified devel/output/20.txt.gz
Binary file not shown.
Binary file modified devel/output/21.txt.gz
Binary file not shown.
Binary file modified devel/output/22.txt.gz
Binary file not shown.
Binary file modified devel/output/23.txt.gz
Binary file not shown.
Binary file modified devel/output/24.txt.gz
Binary file not shown.
Binary file modified devel/output/25.txt.gz
Binary file not shown.
Binary file modified devel/output/26.txt.gz
Binary file not shown.
Binary file modified devel/output/27.txt.gz
Binary file not shown.
Binary file modified devel/output/28.txt.gz
Binary file not shown.
Binary file modified devel/output/29.txt.gz
Binary file not shown.
Binary file modified devel/output/3.txt.gz
Binary file not shown.
Binary file modified devel/output/30.txt.gz
Binary file not shown.
Binary file modified devel/output/31.txt.gz
Binary file not shown.
Binary file modified devel/output/32.txt.gz
Binary file not shown.
Binary file modified devel/output/33.txt.gz
Binary file not shown.
Binary file modified devel/output/34.txt.gz
Binary file not shown.
Binary file modified devel/output/35.txt.gz
Binary file not shown.
Binary file modified devel/output/36.txt.gz
Binary file not shown.
Binary file modified devel/output/37.txt.gz
Binary file not shown.
Binary file modified devel/output/38.txt.gz
Binary file not shown.
Binary file modified devel/output/39.txt.gz
Binary file not shown.
Binary file modified devel/output/4.txt.gz
Binary file not shown.
Binary file modified devel/output/40.txt.gz
Binary file not shown.
Binary file modified devel/output/41.txt.gz
Binary file not shown.
Binary file modified devel/output/42.txt.gz
Binary file not shown.
Binary file modified devel/output/43.txt.gz
Binary file not shown.
Binary file modified devel/output/44.txt.gz
Binary file not shown.
Binary file modified devel/output/45.txt.gz
Binary file not shown.
Binary file modified devel/output/46.txt.gz
Binary file not shown.
Binary file modified devel/output/47.txt.gz
Binary file not shown.
Binary file modified devel/output/48.txt.gz
Binary file not shown.
Binary file modified devel/output/49.txt.gz
Binary file not shown.
Binary file modified devel/output/5.txt.gz
Binary file not shown.
Binary file modified devel/output/50.txt.gz
Binary file not shown.
Binary file modified devel/output/51.txt.gz
Binary file not shown.
Binary file modified devel/output/52.txt.gz
Binary file not shown.
Binary file modified devel/output/53.txt.gz
Binary file not shown.
Binary file modified devel/output/54.txt.gz
Binary file not shown.
Binary file modified devel/output/55.txt.gz
Binary file not shown.
Binary file modified devel/output/56.txt.gz
Binary file not shown.
Binary file modified devel/output/57.txt.gz
Binary file not shown.
Binary file modified devel/output/58.txt.gz
Binary file not shown.
Binary file modified devel/output/59.txt.gz
Binary file not shown.
Binary file modified devel/output/6.txt.gz
Binary file not shown.
Binary file modified devel/output/60.txt.gz
Binary file not shown.
Binary file modified devel/output/61.txt.gz
Binary file not shown.
Binary file modified devel/output/62.txt.gz
Binary file not shown.
Binary file modified devel/output/63.txt.gz
Binary file not shown.
Binary file modified devel/output/64.txt.gz
Binary file not shown.
Binary file modified devel/output/65.txt.gz
Binary file not shown.
Binary file modified devel/output/66.txt.gz
Binary file not shown.
Binary file modified devel/output/67.txt.gz
Binary file not shown.
Binary file modified devel/output/68.txt.gz
Binary file not shown.
Binary file modified devel/output/69.txt.gz
Binary file not shown.
Binary file modified devel/output/7.txt.gz
Binary file not shown.
Binary file modified devel/output/70.txt.gz
Binary file not shown.
Binary file modified devel/output/71.txt.gz
Binary file not shown.
Binary file modified devel/output/72.txt.gz
Binary file not shown.
Binary file modified devel/output/73.txt.gz
Binary file not shown.
Binary file modified devel/output/74.txt.gz
Binary file not shown.
Binary file modified devel/output/75.txt.gz
Binary file not shown.
Binary file modified devel/output/76.txt.gz
Binary file not shown.
Binary file modified devel/output/77.txt.gz
Binary file not shown.
Binary file modified devel/output/78.txt.gz
Binary file not shown.
Binary file modified devel/output/79.txt.gz
Binary file not shown.
Binary file modified devel/output/8.txt.gz
Binary file not shown.
Binary file modified devel/output/80.txt.gz
Binary file not shown.
Binary file modified devel/output/81.txt.gz
Binary file not shown.
Binary file modified devel/output/82.txt.gz
Binary file not shown.
Binary file modified devel/output/83.txt.gz
Binary file not shown.
Binary file modified devel/output/84.txt.gz
Binary file not shown.
Binary file modified devel/output/85.txt.gz
Binary file not shown.
Binary file modified devel/output/86.txt.gz
Binary file not shown.
Binary file modified devel/output/87.txt.gz
Binary file not shown.
Binary file modified devel/output/88.txt.gz
Binary file not shown.
Binary file modified devel/output/89.txt.gz
Binary file not shown.
Binary file modified devel/output/9.txt.gz
Binary file not shown.
Binary file modified devel/output/90.txt.gz
Binary file not shown.
Binary file modified devel/output/91.txt.gz
Binary file not shown.
Binary file modified devel/output/92.txt.gz
Binary file not shown.
Binary file modified devel/output/93.txt.gz
Binary file not shown.
Binary file modified devel/output/94.txt.gz
Binary file not shown.
Binary file modified devel/output/95.txt.gz
Binary file not shown.
Binary file modified devel/output/96.txt.gz
Binary file not shown.
Binary file modified devel/output/97.txt.gz
Binary file not shown.
Binary file modified devel/output/98.txt.gz
Binary file not shown.
Binary file modified devel/output/99.txt.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion devel/test_jshint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -x


#*
#* Copyright 2015-2024 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#* Copyright 2015-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#*
#* This file is part of WepSIM.
#*
Expand Down
2 changes: 1 addition & 1 deletion devel/test_wepsim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


#*
#* Copyright 2015-2024 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#* Copyright 2015-2025 Felix Garcia Carballeira, Alejandro Calderon Mateos, Javier Prieto Cepeda, Saul Alonso Monsalve
#*
#* This file is part of WepSIM.
#*
Expand Down
16 changes: 14 additions & 2 deletions docs/WS_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@

# Changelog

## 2.3.2 -> 2.3.3:
* Main improvements:
* Several minor improvements:
* More flexible assembler error dialog box
* Faster loading in microcode editor

## 2.3.1 -> 2.3.2:
* Main improvements:
* Several minor improvements in the new default assembler:
* Relative branches offset can be now in bytes, words (MIPS), and half-words (RV)
* Support for alternative definitions of pseudo-instructions, ordered from most restrictive to least restrictive
* Support for binary segment
* Support for binary segment:
<code>
.binary
main:
0x000x8000 0x69400003
...
</code>
* Several minor updates to the firmware syntax v2:
* saveFirmware(...) now support v2
* Save Firmware from control memory now supports firmware version 2
* Firmware metadata updated:
<html>
<table>
Expand Down
Binary file modified images/author_jprieto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"inquirer-command-prompt": "^0.1.0",
"optionator": "^0.9.1",
"readline-sync": "^1.4.10",
"rollup": "^3.25.1",
"rollup": "^3.29.5",
"vue": "^2.6.12",
"vuex": "^3.6.0",
"winston": "^2.4.7",
Expand Down
6 changes: 3 additions & 3 deletions repo/assembly/mips/s6e5.asm
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,

0,1,1,1,0,1,1,1, 0,1,1,1,0,1,0,1, 0,0,1,0,0,0,0,0,
0,0,0,1,0,1,0,1, 0,0,0,1,0,1,0,1, 0,0,1,0,0,0,0,0,
0,1,1,1,0,1,1,1, 0,1,1,1,0,1,1,1, 0,0,1,0,0,0,0,0,
0,0,0,1,0,1,0,1, 0,0,0,1,0,1,0,0, 0,0,1,0,0,0,0,0,
0,1,1,1,0,1,0,1, 0,1,1,1,0,1,1,1, 0,0,1,0,0,0,0,0,
0,1,0,0,0,1,0,1, 0,1,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,
0,1,1,1,0,1,1,1, 0,1,1,1,0,0,0,1, 0,0,1,0,0,0,0,0,
0,1,1,1,0,1,1,1, 0,1,1,1,0,1,1,1, 0,0,1,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
Expand Down
6 changes: 3 additions & 3 deletions repo/assembly/mips/s6e5_help.asm
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,

0,1,1,1,0,1,1,1, 0,1,1,1,0,1,0,1, 0,0,1,0,0,0,0,0,
0,0,0,1,0,1,0,1, 0,0,0,1,0,1,0,1, 0,0,1,0,0,0,0,0,
0,1,1,1,0,1,1,1, 0,1,1,1,0,1,1,1, 0,0,1,0,0,0,0,0,
0,0,0,1,0,1,0,1, 0,0,0,1,0,1,0,0, 0,0,1,0,0,0,0,0,
0,1,1,1,0,1,0,1, 0,1,1,1,0,1,1,1, 0,0,1,0,0,0,0,0,
0,1,0,0,0,1,0,1, 0,1,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,
0,1,1,1,0,1,1,1, 0,1,1,1,0,0,0,1, 0,0,1,0,0,0,0,0,
0,1,1,1,0,1,1,1, 0,1,1,1,0,1,1,1, 0,0,1,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
Expand Down
6 changes: 3 additions & 3 deletions repo/assembly/mips/s6e6.asm
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,

0,1,1,1,0,1,1,1, 0,1,1,1,0,1,0,1, 0,0,1,0,0,0,0,0,
0,0,0,1,0,1,0,1, 0,0,0,1,0,1,0,1, 0,0,1,0,0,0,0,0,
0,1,1,1,0,1,1,1, 0,1,1,1,0,1,1,1, 0,0,1,0,0,0,0,0,
0,0,0,1,0,1,0,1, 0,0,0,1,0,1,0,0, 0,0,1,0,0,0,0,0,
0,1,1,1,0,1,0,1, 0,1,1,1,0,1,1,1, 0,0,1,0,0,0,0,0,
0,1,0,0,0,1,0,1, 0,1,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,
0,1,1,1,0,1,1,1, 0,1,1,1,0,0,0,1, 0,0,1,0,0,0,0,0,
0,1,1,1,0,1,1,1, 0,1,1,1,0,1,1,1, 0,0,1,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
Expand Down
7 changes: 4 additions & 3 deletions repo/assembly/rv32/s2e5_help.asm
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
.word rt_sys

.ktext
sys_prt_str: li x1 1
li x0 0
sys_prt_str: li x0 0
li x1 1
add x26 a0 x0
beq x26 x0 end1
b5: lb x27 0(x26)
beq x27 x0 end1
Expand All @@ -20,6 +21,7 @@ sys_prt_str: li x1 1
end1: sret

sys_prt_int: li x1 1
add x26 a0 x0
# push_byte('\0')
sb x0 0(sp)
sub sp sp x1
Expand Down Expand Up @@ -48,7 +50,6 @@ sys_prt_int: li x1 1
f2: sret

rt_sys: # 1.- syscall
add x26 a0 x0
li x27 4
beq a7 x27 sys_prt_str
li x27 1
Expand Down
7 changes: 4 additions & 3 deletions repo/assembly/rv32/s2e6.asm
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
.word rt_sys

.ktext
sys_prt_str: li x1 1
li x0 0
sys_prt_str: li x0 0
li x1 1
add x26 a0 x0
beq x26 x0 end1
b5: lb x27 0(x26)
beq x27 x0 end1
Expand All @@ -20,6 +21,7 @@ sys_prt_str: li x1 1
end1: sret

sys_prt_int: li x1 1
add x26 a0 x0
# push_byte('\0')
sb x0 0(sp)
sub sp sp x1
Expand Down Expand Up @@ -48,7 +50,6 @@ sys_prt_int: li x1 1
f2: sret

rt_sys: # 1.- syscall
add x26 a0 x0
li x27 4
beq a7 x27 sys_prt_str
li x27 1
Expand Down
7 changes: 4 additions & 3 deletions repo/assembly/rv32/s2e6_help.asm
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
.word rt_sys

.ktext
sys_prt_str: li x1 1
li x0 0
sys_prt_str: li x0 0
li x1 1
add x26 a0 x0
beq x26 x0 end1
b5: lb x27 0(x26)
beq x27 x0 end1
Expand All @@ -20,6 +21,7 @@ sys_prt_str: li x1 1
end1: sret

sys_prt_int: li x1 1
add x26 a0 x0
# push_byte('\0')
sb x0 0(sp)
sub sp sp x1
Expand Down Expand Up @@ -48,7 +50,6 @@ sys_prt_int: li x1 1
f2: sret

rt_sys: # 1.- syscall
add x26 a0 x0
li x27 4
beq a7 x27 sys_prt_str
li x27 1
Expand Down
17 changes: 9 additions & 8 deletions repo/assembly/rv32/s4e2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

.ktext
sys_prt_str: li zero 0
beq t3 zero end1
beq a0 zero end1
mv t3 a0
b5: lb t4 0(t3)
beq t4 zero end1
out t4 0x1000
Expand All @@ -22,6 +23,7 @@ sys_prt_str: li zero 0
end1: sret

sys_prt_int: li t1 1
mv t3 a0
# push_byte('\0')
sb zero 0(sp)
sub sp sp t1
Expand Down Expand Up @@ -74,7 +76,7 @@ sys_rd_str: li zero 0
sret

sys_rd_int: li zero 0
li a7 0
li a0 0
notready2: # ch = get_char()
in t4 0x0104
beq t4 zero notready2
Expand All @@ -85,24 +87,23 @@ sys_rd_int: li zero 0
bgt t4 t1 eos2
li t1 48
blt t4 t1 eos2
# a7 = a7*10 + (ch-48)
# a0 = a0*10 + (ch-48)
sub t4 t4 t1
li t1 10
mul a7 a7 t1
add a7 a7 t4
mul a0 a0 t1
add a0 a0 t4
beq zero zero notready2
eos2: sret

sys_rd_ch: li zero 0
notready3: # ch=get_char()
in t4 0x0104
beq t4 zero notready3
in a7 0x0100
out a7 0x1000 # echo
in a0 0x0100
out a0 0x1000 # echo
sret

rt_sys: # 1.- ecall
mv t3 a0
li t4 4
beq a7 t4 sys_prt_str
li t4 1
Expand Down
Loading

0 comments on commit e053987

Please sign in to comment.