Add check for `fasm` installation in `compile.sh` script with optional prompt to...
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 16 Feb 2026 23:38:23 +0000 (01:38 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 16 Feb 2026 23:38:23 +0000 (01:38 +0200)
emulator/compile.sh
emulator/emulator.asm

index 1e132a3..bf32a8d 100755 (executable)
@@ -1,4 +1,18 @@
 #!/bin/bash
 
-fasm emulator.asm
+if ! command -v fasm &> /dev/null; then
+    echo "fasm (flat assembler) is not installed."
+    read -p "Would you like to install it? (y/n): " choice
+    if [[ "$choice" =~ ^[Yy]$ ]]; then
+        sudo apt-get update && sudo apt-get install -y fasm
+        if [ $? -ne 0 ]; then
+            echo "Failed to install fasm."
+            exit 1
+        fi
+    else
+        echo "fasm is required to continue. Exiting."
+        exit 1
+    fi
+fi
 
+fasm emulator.asm
\ No newline at end of file
index 4c8839e..8ad524c 100644 (file)
@@ -70,7 +70,7 @@ shl   bx, 1
 add    bx, table\r
 jmp    word [cs:bx]\r
 \r
-table\r
+table:\r
     dw emu             ; 0\r
        dw quit\r
        dw xkbd@\r