Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on:
pull_request:
push:
branches: [master]

permissions:
contents: read

jobs:
smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
- run: npm ci
- name: Smoke test bundles
run: scripts/smoke.sh
- name: Check package contents
run: npm pack --dry-run
10 changes: 10 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Smoke test bundles
run: scripts/smoke.sh

- name: Build binaries
run: |
mkdir -p dist
Expand All @@ -38,6 +41,9 @@ jobs:
- name: List dist/
run: ls -la dist/

- name: Smoke test Linux binaries
run: scripts/smoke.sh dist

- name: Create GitHub Release and upload binaries
uses: softprops/action-gh-release@v2
with:
Expand All @@ -64,4 +70,8 @@ jobs:
registry-url: 'https://registry.npmjs.org'

- run: npm ci
- name: Smoke test bundles
run: scripts/smoke.sh
- name: Check package contents
run: npm pack --dry-run
- run: npm publish --provenance
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# @asm80/cli

Příkazové nástroje ASM80 – assembler, linker, archivátor knihoven a emulátor pro 8bitové procesory.

| Příkaz | Popis |
| --- | --- |
| `asm80` | přeloží zdrojový soubor (`.z80`, `.a80`, `.a65`, …) na `.hex`/`.srec` (+ listing), nebo s `--module` na relokovatelný objekt |
| `asm80-link` | slinkuje moduly podle receptu `.lnk` |
| `asm80-ar` | sestaví knihovnu podle receptu `.lbr` |
| `asm80-run` | přeloží/načte program a spustí ho v emulátoru |

## Instalace

```sh
npm i -g @asm80/cli
```

Vyžaduje Node.js 18 nebo novější. Samostatné binárky (bez nutnosti instalovat Node.js) pro Windows, Linux a macOS jsou přiložené ke [GitHub Releases](https://github.com/asm80/asm80-cli/releases).

## Použití

```sh
asm80 program.z80 # vytvoří program.hex a program.lst
asm80 --module lib.z80 # relokovatelný objekt
asm80-link app.lnk
asm80-ar mylib.lbr
asm80-run program.z80
```

Všechny příkazy vypíšou nápovědu přes `--help`.

## O tomto repozitáři

Soubory `asm80.js`, `asm80-link.js`, `asm80-ar.js` a `asm80-run.js` jsou **obfuskované bundly** vygenerované z projektu ASM80 (sestavení probíhá v [asm80/IDEv2](https://github.com/asm80/IDEv2) z [asm80/asm80-core](https://github.com/asm80/asm80-core) a [asm80/emu](https://github.com/asm80/emu)); zdrojový kód zde proto není čitelný. Repozitář slouží k publikaci na npm a ke sestavení samostatných binárek (`@yao-pkg/pkg`) při vydání (tag `v*`).

Před každým vydáním (a v CI) běží smoke test `scripts/smoke.sh`: přeloží ukázkový zdroj a ověří, že všechny čtyři nástroje jdou spustit; po sestavení se stejným způsobem otestuje linuxová binárka. Lokálně: `npm test`.
6 changes: 0 additions & 6 deletions asm80-ar.mjs

This file was deleted.

2 changes: 0 additions & 2 deletions asm80-link.mjs

This file was deleted.

6 changes: 0 additions & 6 deletions asm80-run.mjs

This file was deleted.

2 changes: 0 additions & 2 deletions asm80.mjs

This file was deleted.

14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
"asm80-ar.js",
"asm80-run.js"
],
"scripts": {
"test": "sh scripts/smoke.sh"
},
"engines": {
"node": ">=18"
},
"keywords": [
"assembler",
"emulator",
Expand All @@ -34,10 +40,10 @@
},
"pkg": {
"targets": [
"node18-win-x64",
"node18-linux-x64",
"node18-macos-x64",
"node18-macos-arm64"
"node20-win-x64",
"node20-linux-x64",
"node20-macos-x64",
"node20-macos-arm64"
],
"outputPath": "dist"
},
Expand Down
38 changes: 38 additions & 0 deletions scripts/smoke.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
# Smoke test sestavených balíčků / binárek.
# scripts/smoke.sh – testuje commitnuté bundly (node asm80.js …)
# scripts/smoke.sh <dir> – testuje pkg binárky pro Linux v adresáři <dir> (např. dist)
set -eu

work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT
printf '\tORG 0\n\tNOP\n\tHLT\n' > "$work/smoke.a80"

if [ $# -eq 0 ]; then
cd "$(dirname "$0")/.."
node asm80.js "$work/smoke.a80"
test -s "$work/smoke.hex"
test -s "$work/smoke.lst"
for util in asm80-link asm80-ar asm80-run; do
node "$util.js" --help >/dev/null
done
echo "Smoke test bundlů: OK"
else
dist="$1"
for util in asm80 asm80-link asm80-ar asm80-run; do
# pkg pojmenuje binárky např. asm80-linux-x64 nebo asm80-linux
bin="$(ls "$dist/$util"-linux* 2>/dev/null | head -n 1)"
if [ -z "$bin" ]; then
echo "Chybí linuxová binárka pro $util v $dist" >&2
exit 1
fi
chmod +x "$bin"
if [ "$util" = asm80 ]; then
"$bin" "$work/smoke.a80"
test -s "$work/smoke.hex"
else
"$bin" --help >/dev/null
fi
done
echo "Smoke test binárek: OK"
fi
Loading