mirror of
https://github.com/hazemKrimi/hack-assembler.git
synced 2026-05-01 18:20:28 +00:00
Trim instruction subset
This commit is contained in:
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug executable 'hack-assembler'",
|
||||
"cargo": {
|
||||
"args": [
|
||||
"build",
|
||||
"--bin=hack-assembler",
|
||||
"--package=hack-assembler"
|
||||
],
|
||||
"filter": {
|
||||
"name": "hack-assembler",
|
||||
"kind": "bin"
|
||||
}
|
||||
},
|
||||
"args": ["../rect/RectL.asm"],
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Debug unit tests in executable 'hack-assembler'",
|
||||
"cargo": {
|
||||
"args": [
|
||||
"test",
|
||||
"--no-run",
|
||||
"--bin=hack-assembler",
|
||||
"--package=hack-assembler"
|
||||
],
|
||||
"filter": {
|
||||
"name": "hack-assembler",
|
||||
"kind": "bin"
|
||||
}
|
||||
},
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
||||
+3
-3
@@ -5,7 +5,7 @@ pub fn decimal_to_fifteen_bits_binary(decimal: &i32) -> String {
|
||||
pub fn translate_dest(dest: &String) -> String {
|
||||
let cloned = dest.clone();
|
||||
|
||||
match cloned.as_str() {
|
||||
match cloned.as_str().trim() {
|
||||
"M" => "001",
|
||||
"D" => "010",
|
||||
"MD" => "011",
|
||||
@@ -21,7 +21,7 @@ pub fn translate_dest(dest: &String) -> String {
|
||||
pub fn translate_jump(jump: &String) -> String {
|
||||
let cloned = jump.clone();
|
||||
|
||||
match cloned.as_str() {
|
||||
match cloned.as_str().trim() {
|
||||
"JGT" => "001",
|
||||
"JEQ" => "010",
|
||||
"JGE" => "011",
|
||||
@@ -37,7 +37,7 @@ pub fn translate_jump(jump: &String) -> String {
|
||||
pub fn translate_comp(comp: &String) -> String {
|
||||
let cloned = comp.clone();
|
||||
|
||||
match cloned.as_str() {
|
||||
match cloned.as_str().trim() {
|
||||
"0" => "0101010",
|
||||
"1" => "0111111",
|
||||
"-1" => "0111010",
|
||||
|
||||
Reference in New Issue
Block a user