-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (78 loc) · 2.94 KB
/
TestDisassembler.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Test disassembled code produced by the emulator
name: Test Disassembler
on:
push:
workflow_dispatch:
inputs:
message:
description: Message to display in job summary
required: false
type: string
jobs:
test-disassembly:
strategy:
matrix:
include:
- assembler: 'zasm'
exec: 'zasm/zasm'
options: '--ixcbr2'
outputfileoption: '-o '
- assembler: 'z88dk'
exec: 'z88dk/z88dk-z80asm'
options: '-v -b'
outputfileoption: '-o'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup emulator and assembler
run: |
make
cd tools
chmod +x ${{ matrix.exec }}
- name: Round-trip assemble, disassemble, compare
env:
FILES: test_disassembler_1 test_disassembler_2 test_disassembler_3
run: |
cd tools
for f in $FILES; do
echo "file basename: ${f}"
${{ matrix.exec }} ${{ matrix.options }} ${f}.asm ${{ matrix.outputfileoption}}${f}.rom
echo "1" > options.txt
echo "3" >> options.txt
echo "0" >> options.txt
# The following calculates the ROM size by subtracting 1 from the file size
wc -c <${f}.rom | awk '{printf "%x\n", $1 - 1}' >> options.txt
echo "options file:"
cat options.txt
../emulator ${f}.rom > ${f}_disassembled.asm <options.txt
# Strip out the non-assembly top lines of the emulator output
tail -n +14 ${f}_disassembled.asm >${f}_tail.asm
${{ matrix.exec }} ${{matrix.options }} ${f}_tail.asm ${{ matrix.outputfileoption}}${f}_tail.rom
echo "Comparing... ${f}.rom ${f}_tail.rom"
cmp ${f}.rom ${f}_tail.rom
done
- name: Compare other opcodes
env:
FILES: test_disassembler_4
run: |
cd tools
for f in $FILES; do
echo "file basename: ${f}"
${{ matrix.exec }} ${{ matrix.options }} ${f}.asm ${{ matrix.outputfileoption}}${f}.rom
echo "1" > options.txt
echo "2" >> options.txt
echo "0" >> options.txt
# The following calculates the ROM size by subtracting 1 from the file size
wc -c <${f}.rom | awk '{printf "%x\n", $1 - 1}' >> options.txt
echo "options file:"
cat options.txt
../emulator ${f}.rom > ${f}_disassembled.asm <options.txt
# Strip out the non-assembly top lines of the emulator output
tail -n +14 ${f}_disassembled.asm >${f}_tail.asm
echo "Comparing... ${f}_tail.asm ${f}_compare_file.txt"
diff -w --strip-trailing-cr ${f}_tail.asm ${f}_compare_file.txt
done
- name: Print the job summary
if: ${{ inputs.message }}
run: |
echo ${{ inputs.message }} >$GITHUB_STEP_SUMMARY