From 91fdd4d089c0969f3cac710fc320c7892796d66d Mon Sep 17 00:00:00 2001 From: nabijaczleweli Date: Sun, 26 Jan 2020 07:32:17 +0100 Subject: [PATCH] Bump version to 1.0.0. Update (dis)assemblies in top-level doc. Update manpages --- Cargo.toml | 2 +- appveyor.yml | 14 +- man/pir-8-as.md | 16 +- man/pir-8-disasm.md | 247 ++++++++++++------ src/lib.rs | 118 ++++++--- .../copy-any-length-literal-to-port-nolit.p8b | Bin 0 -> 39 bytes 6 files changed, 265 insertions(+), 132 deletions(-) create mode 100644 test-data/copy-any-length-literal-to-port-nolit.p8b diff --git a/Cargo.toml b/Cargo.toml index 64155d01..79c61c38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ keywords = ["isa", "emulation", "cpu"] categories = ["emulators"] license = "MIT" # Remember to also update in appveyor.yml -version = "0.1.1" +version = "1.0.0" # Remember to also update in man/*.md authors = ["nabijaczleweli "] exclude = ["*.enc"] diff --git a/appveyor.yml b/appveyor.yml index 4f20fed0..01763393 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.1.1-{build} +version: 1.0.0-{build} skip_tags: false @@ -30,11 +30,11 @@ build_script: - make - cargo build --verbose --release - - - mkdir pir-8-emu-v0.1.1 - - cp target\release\pir-8-as.exe target\release\pir-8-disasm.exe target\release\pir-8-emu.exe pir-8-emu-v0.1.1\ - - cp C:\BearLibTerminal.dll pir-8-emu-v0.1.1\ - - strip --strip-all --remove-section=.comment --remove-section=.note pir-8-emu-v0.1.1/pir-8-as.exe pir-8-emu-v0.1.1/pir-8-disasm.exe pir-8-emu-v0.1.1/pir-8-emu.exe - - zip -9r pir-8-emu-v0.1.1.zip pir-8-emu-v0.1.1 + - mkdir pir-8-emu-v1.0.0 + - cp target\release\pir-8-as.exe target\release\pir-8-disasm.exe target\release\pir-8-emu.exe pir-8-emu-v1.0.0\ + - cp C:\BearLibTerminal.dll pir-8-emu-v1.0.0\ + - strip --strip-all --remove-section=.comment --remove-section=.note pir-8-emu-v1.0.0/pir-8-as.exe pir-8-emu-v1.0.0/pir-8-disasm.exe pir-8-emu-v1.0.0/pir-8-emu.exe + - zip -9r pir-8-emu-v1.0.0.zip pir-8-emu-v1.0.0 test: off test_script: @@ -42,7 +42,7 @@ test_script: - cargo test --verbose --release || true artifacts: - - path: pir-8-emu-v0.1.1.zip + - path: pir-8-emu-v1.0.0.zip deploy: provider: GitHub diff --git a/man/pir-8-as.md b/man/pir-8-as.md index e5323055..7bc598ea 100644 --- a/man/pir-8-as.md +++ b/man/pir-8-as.md @@ -21,17 +21,17 @@ The assembly format is as follows: And so, all of these are equivalent: - LOAD IND A - 0x0110 + LOAD IMM A + 0x69 - LOAD IND A - 0b0000_0001_0001_0000 + LOAD IMM A + 0b0110_1001 - 0x24 - 0o420 + 0x1C + 0o151 - 36 - 272 + 28 + 105 ## DIRECTIVES diff --git a/man/pir-8-disasm.md b/man/pir-8-disasm.md index 61c2ef83..8ef70ca1 100644 --- a/man/pir-8-disasm.md +++ b/man/pir-8-disasm.md @@ -56,82 +56,177 @@ The output consists of four columns: ## EXAMPLES - `pir-8-disasm test-data/xor-swap-with-loads.p8b` - - 00000000 24 LOAD IND A - 00000002 0110 D 0x0110 - 00000003 1D LOAD IMM B - 00000004 69 D 0x69 - 00000005 62 MOVE A X - 00000006 6B MOVE B Y - 00000007 35 ALU XOR - 00000008 4C MOVE S A - 00000009 63 MOVE A Y - 0000000A 6A MOVE B X - 0000000B 35 ALU XOR - 0000000C 4D MOVE S B - 0000000D 62 MOVE A X - 0000000E 6B MOVE B Y - 0000000F 35 ALU XOR - 00000010 4C MOVE S A - 00000011 FF HALT - - `pir-8-disasm -r 01234567 test-data/xor-swap-with-loads.p8b` - - 00000000 24 LOAD IND 4 - 00000002 0110 D 0x0110 - 00000003 1D LOAD IMM 5 - 00000004 69 D 0x69 - 00000005 62 MOVE 4 2 - 00000006 6B MOVE 5 3 - 00000007 35 ALU XOR - 00000008 4C MOVE 1 4 - 00000009 63 MOVE 4 3 - 0000000A 6A MOVE 5 2 - 0000000B 35 ALU XOR - 0000000C 4D MOVE 1 5 - 0000000D 62 MOVE 4 2 - 0000000E 6B MOVE 5 3 - 0000000F 35 ALU XOR - 00000010 4C MOVE 1 4 - 00000011 FF HALT - - `pir-8-disasm -e 3 test-data/xor-swap-with-loads.p8b` - - 00000000 1D LOAD IMM B - 00000001 69 D 0x69 - 00000002 62 MOVE A X - 00000003 6B MOVE B Y - 00000004 35 ALU XOR - 00000005 4C MOVE S A - 00000006 63 MOVE A Y - 00000007 6A MOVE B X - 00000008 35 ALU XOR - 00000009 4D MOVE S B - 0000000A 62 MOVE A X - 0000000B 6B MOVE B Y - 0000000C 35 ALU XOR - 0000000D 4C MOVE S A - 0000000E FF HALT - - `pir-8-disasm -k 1,7 test-data/xor-swap-with-loads.p8b` - - 00000000 24 LOAD IND A - 00000002 0110 D 0x0110 - 00000003 1D LOAD IMM B - 00000004 69 D 0x69 - 00000005 62 MOVE A X - 00000006 6B MOVE B Y - 00000007 35 ALU XOR - 00000008 S skipping 0x07 bytes - 00000010 4C MOVE S A - 00000011 FF HALT - - `pir-8-disasm -e 3 -k 1,0x0D test-data/xor-swap-with-loads.p8b` - - 00000000 1D LOAD IMM B - 00000001 S skipping 0x0D bytes - 0000000E FF D 0xFF + `pir-8-disasm test-data/copy-any-length-literal-to-port-nolit.p8b` + + 00000000 1E LOAD IMM C + 00000001 00 D 0x00 + 00000002 1A LOAD IMM X + 00000003 27 D 0x27 + 00000004 1B LOAD IMM Y + 00000005 01 D 0x01 + 00000006 31 ALU SUB + 00000007 4A MOVE S X + 00000008 4F MOVE S D + 00000009 7A MOVE D X + 0000000A 1B LOAD IMM Y + 0000000B 01 D 0x01 + 0000000C 30 ALU ADD + 0000000D 4F MOVE S D + 0000000E 72 MOVE C X + 0000000F 1B LOAD IMM Y + 00000010 00 D 0x00 + 00000011 32 ALU ADDC + 00000012 4E MOVE S C + 00000013 0D MADR WRITE C&D + 00000014 1C LOAD IMM A + 00000015 00 D 0x00 + 00000016 25 LOAD IND B + 00000017 E5 PORT OUT B + 00000018 69 MOVE B S + 00000019 F1 COMP S + 0000001A 1C LOAD IMM A + 0000001B 00 D 0x00 + 0000001C 1D LOAD IMM B + 0000001D 26 D 0x26 + 0000001E 0C MADR WRITE A&B + 0000001F 14 JMZG + 00000020 1C LOAD IMM A + 00000021 00 D 0x00 + 00000022 1D LOAD IMM B + 00000023 09 D 0x09 + 00000024 0C MADR WRITE A&B + 00000025 17 JUMP + 00000026 FF HALT + + `pir-8-disasm -r 01234567 test-data/copy-any-length-literal-to-port-nolit.p8b` + + 00000000 1E LOAD IMM 6 + 00000001 00 D 0x00 + 00000002 1A LOAD IMM 2 + 00000003 27 D 0x27 + 00000004 1B LOAD IMM 3 + 00000005 01 D 0x01 + 00000006 31 ALU SUB + 00000007 4A MOVE 1 2 + 00000008 4F MOVE 1 7 + 00000009 7A MOVE 7 2 + 0000000A 1B LOAD IMM 3 + 0000000B 01 D 0x01 + 0000000C 30 ALU ADD + 0000000D 4F MOVE 1 7 + 0000000E 72 MOVE 6 2 + 0000000F 1B LOAD IMM 3 + 00000010 00 D 0x00 + 00000011 32 ALU ADDC + 00000012 4E MOVE 1 6 + 00000013 0D MADR WRITE C&D + 00000014 1C LOAD IMM 4 + 00000015 00 D 0x00 + 00000016 25 LOAD IND 5 + 00000017 E5 PORT OUT 5 + 00000018 69 MOVE 5 1 + 00000019 F1 COMP 1 + 0000001A 1C LOAD IMM 4 + 0000001B 00 D 0x00 + 0000001C 1D LOAD IMM 5 + 0000001D 26 D 0x26 + 0000001E 0C MADR WRITE A&B + 0000001F 14 JMZG + 00000020 1C LOAD IMM 4 + 00000021 00 D 0x00 + 00000022 1D LOAD IMM 5 + 00000023 09 D 0x09 + 00000024 0C MADR WRITE A&B + 00000025 17 JUMP + 00000026 FF HALT + + `pir-8-disasm -e 9 test-data/copy-any-length-literal-to-port-nolit.p8b` + + 00000000 7A MOVE D X + 00000001 1B LOAD IMM Y + 00000002 01 D 0x01 + 00000003 30 ALU ADD + 00000004 4F MOVE S D + 00000005 72 MOVE C X + 00000006 1B LOAD IMM Y + 00000007 00 D 0x00 + 00000008 32 ALU ADDC + 00000009 4E MOVE S C + 0000000A 0D MADR WRITE C&D + 0000000B 1C LOAD IMM A + 0000000C 00 D 0x00 + 0000000D 25 LOAD IND B + 0000000E E5 PORT OUT B + 0000000F 69 MOVE B S + 00000010 F1 COMP S + 00000011 1C LOAD IMM A + 00000012 00 D 0x00 + 00000013 1D LOAD IMM B + 00000014 26 D 0x26 + 00000015 0C MADR WRITE A&B + 00000016 14 JMZG + 00000017 1C LOAD IMM A + 00000018 00 D 0x00 + 00000019 1D LOAD IMM B + 0000001A 09 D 0x09 + 0000001B 0C MADR WRITE A&B + 0000001C 17 JUMP + 0000001D FF HALT + + `pir-8-disasm -k 0x1A,11 test-data/copy-any-length-literal-to-port-nolit.p8b` + + 00000000 1E LOAD IMM C + 00000001 00 D 0x00 + 00000002 1A LOAD IMM X + 00000003 27 D 0x27 + 00000004 1B LOAD IMM Y + 00000005 01 D 0x01 + 00000006 31 ALU SUB + 00000007 4A MOVE S X + 00000008 4F MOVE S D + 00000009 7A MOVE D X + 0000000A 1B LOAD IMM Y + 0000000B 01 D 0x01 + 0000000C 30 ALU ADD + 0000000D 4F MOVE S D + 0000000E 72 MOVE C X + 0000000F 1B LOAD IMM Y + 00000010 00 D 0x00 + 00000011 32 ALU ADDC + 00000012 4E MOVE S C + 00000013 0D MADR WRITE C&D + 00000014 1C LOAD IMM A + 00000015 00 D 0x00 + 00000016 25 LOAD IND B + 00000017 E5 PORT OUT B + 00000018 69 MOVE B S + 00000019 F1 COMP S + 0000001A S skipping 0x0B bytes + 00000025 17 JUMP + 00000026 FF HALT + + `pir-8-disasm -e 3 -k 1,0x0D test-data/copy-any-length-literal-to-port-nolit.p8b` + + 00000000 7A MOVE D X + 00000001 1B LOAD IMM Y + 00000002 01 D 0x01 + 00000003 30 ALU ADD + 00000004 4F MOVE S D + 00000005 72 MOVE C X + 00000006 1B LOAD IMM Y + 00000007 00 D 0x00 + 00000008 32 ALU ADDC + 00000009 4E MOVE S C + 0000000A 0D MADR WRITE C&D + 0000000B 1C LOAD IMM A + 0000000C 00 D 0x00 + 0000000D 25 LOAD IND B + 0000000E E5 PORT OUT B + 0000000F 69 MOVE B S + 00000010 F1 COMP S + 00000011 S skipping 0x0B bytes + 0000001C 17 JUMP + 0000001D FF HALT ## AUTHOR diff --git a/src/lib.rs b/src/lib.rs index 3aee7c44..f6d43fb9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,48 +36,56 @@ //! An assembler with an… idiosyncratic syntax: //! //! ```p8a -//! JUMP -//! :label load text -//! -//! :literal "*pounces on u* OwO what's whis?" -//! 0x00 +//! LOAD IMM C +//! :label load high message +//! LOAD IMM X +//! :label load low message +//! LOAD IMM Y +//! 1 +//! ALU SUB +//! MOVE S X +//! MOVE S D //! -//! :label save text +//! :label save loop +//! MOVE D X //! LOAD IMM Y //! 1 +//! ALU ADD +//! MOVE S D +//! MOVE C X +//! LOAD IMM Y +//! 0 +//! ALU ADDC +//! MOVE S C +//! MADR WRITE C&D //! //! LOAD IMM A -//! 0x00 -//! -//! LOAD IMM X -//! 0x03 +//! 0 ; port number +//! LOAD IND B +//! PORT OUT B //! -//! :label save loop-head -//! SAVE X -//! :label load-offset load-byte 2 -//! -//! JUMP -//! :label load load-byte -//! -//! :label save post-load -//! PORT OUT S +//! MOVE B S //! COMP S -//! JMPZ -//! :label load end //! -//! ALU ADD -//! MOVE S X +//! LOAD IMM A +//! :label load high end +//! LOAD IMM B +//! :label load low end +//! MADR WRITE A&B +//! JMZG +//! LOAD IMM A +//! :label load high loop +//! LOAD IMM B +//! :label load low loop +//! MADR WRITE A&B //! JUMP -//! :label load loop-head //! //! :label save end //! HALT //! -//! :label save load-byte -//! LOAD IND S -//! 0x0000 -//! JUMP -//! :label load post-load +//! +//! :label save message +//! :literal "*pounces on u* OwO what's whis?" //! ``` //! //! If you'd rather use a more normal syntax, [CatPlusPlus](https://github.com/TheCatPlusPlus) has also made @@ -124,17 +132,47 @@ //! A dissassembler with a [`ndisasm`](https://www.nasm.us)-based frontend: //! //! ```plaintext -//! $ pir-8-disasm -k 1,7 test-data/xor-swap-with-loads.p8b -//! 00000000 24 LOAD IND A -//! 00000002 0110 D 0x0110 -//! 00000003 1D LOAD IMM B -//! 00000004 69 D 0x69 -//! 00000005 62 MOVE A X -//! 00000006 6B MOVE B Y -//! 00000007 35 ALU XOR -//! 00000008 S skipping 0x07 bytes -//! 00000010 4C MOVE S A -//! 00000011 FF HALT +//! $ pir-8-disasm -k 0x27,31 test-data/copy-any-length-literal-to-port.p8b +//! 00000000 1E LOAD IMM C +//! 00000001 00 D 0x00 +//! 00000002 1A LOAD IMM X +//! 00000003 27 D 0x27 +//! 00000004 1B LOAD IMM Y +//! 00000005 01 D 0x01 +//! 00000006 31 ALU SUB +//! 00000007 4A MOVE S X +//! 00000008 4F MOVE S D +//! 00000009 7A MOVE D X +//! 0000000A 1B LOAD IMM Y +//! 0000000B 01 D 0x01 +//! 0000000C 30 ALU ADD +//! 0000000D 4F MOVE S D +//! 0000000E 72 MOVE C X +//! 0000000F 1B LOAD IMM Y +//! 00000010 00 D 0x00 +//! 00000011 32 ALU ADDC +//! 00000012 4E MOVE S C +//! 00000013 0D MADR WRITE C&D +//! 00000014 1C LOAD IMM A +//! 00000015 00 D 0x00 +//! 00000016 25 LOAD IND B +//! 00000017 E5 PORT OUT B +//! 00000018 69 MOVE B S +//! 00000019 F1 COMP S +//! 0000001A 1C LOAD IMM A +//! 0000001B 00 D 0x00 +//! 0000001C 1D LOAD IMM B +//! 0000001D 26 D 0x26 +//! 0000001E 0C MADR WRITE A&B +//! 0000001F 14 JMZG +//! 00000020 1C LOAD IMM A +//! 00000021 00 D 0x00 +//! 00000022 1D LOAD IMM B +//! 00000023 09 D 0x09 +//! 00000024 0C MADR WRITE A&B +//! 00000025 17 JUMP +//! 00000026 FF HALT +//! 00000027 S skipping 0x1F bytes //! ``` //! //! ## [`pir-8-emu`](https://rawcdn.githack.com/LoungeCPP/pir-8-emu/man/pir-8-emu.1.html) diff --git a/test-data/copy-any-length-literal-to-port-nolit.p8b b/test-data/copy-any-length-literal-to-port-nolit.p8b new file mode 100644 index 0000000000000000000000000000000000000000..9eb448879e501af3c9e174a7fe19858c4d509b45 GIT binary patch literal 39 tcmb1RkW!asH1zVXl4dmUFOp_3^5d0ZP<@*DQHDWQjYkAXa`K4(2LO=-2iO1r literal 0 HcmV?d00001