mirror of
https://github.com/moshix/mvs.git
synced 2026-05-02 06:35:33 +00:00
Update assembler.bash
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
# this is the basic structure for an S/370 assembler in bash
|
# this is the basic structure for an S/370 assembler in bash
|
||||||
# (c) 2024 by moshix
|
# (c) 2024 by moshix
|
||||||
# can be easily extended
|
# can be easily extended
|
||||||
@@ -5,7 +6,7 @@
|
|||||||
# v 0.1 humble beginnings
|
# v 0.1 humble beginnings
|
||||||
# v 0.2 first few instructions
|
# v 0.2 first few instructions
|
||||||
# v 0.3 CSECT and DSECT
|
# v 0.3 CSECT and DSECT
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Instruction set (extendable)
|
# Instruction set (extendable)
|
||||||
declare -A INSTRUCTIONS=(
|
declare -A INSTRUCTIONS=(
|
||||||
@@ -26,7 +27,7 @@ declare -A INSTRUCTIONS=(
|
|||||||
assemble_line() {
|
assemble_line() {
|
||||||
local line="$1"
|
local line="$1"
|
||||||
local instruction=$(echo "$line" | awk '{print $1}')
|
local instruction=$(echo "$line" | awk '{print $1}')
|
||||||
local operands=$(echo "$line" | awk '{print $2}')
|
local operands=$(echo "$line" | awk '{print $2, $3}')
|
||||||
|
|
||||||
# Handle special directives
|
# Handle special directives
|
||||||
case "$instruction" in
|
case "$instruction" in
|
||||||
@@ -72,3 +73,4 @@ if [[ $# -ne 1 ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
assemble_file "$1"
|
assemble_file "$1"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user