├── .github └── workflows │ └── main.yml ├── .gitignore ├── ChangeLog ├── LICENSE ├── Makefile ├── NEWS ├── README ├── docker ├── Dockerfile ├── README └── make_dasm_all_platforms.sh ├── docs ├── dasm.1 ├── dasm.pdf ├── dasm.txt ├── ftohex.txt └── sources │ ├── 6502.tex │ ├── 6803.tex │ ├── 68705.tex │ ├── 68HC11.tex │ ├── 68hc705_opcode_summary.tex │ ├── 68hc908_opcode_summary.tex │ ├── 68hc908_special_addressing_modes.tex │ ├── 68hc908_standard_addressing_modes.tex │ ├── ChannelF.tex │ ├── F8.tex │ ├── HD6303.tex │ ├── Makefile │ ├── changelog.tex │ ├── dasm-logo.png │ ├── dasm.pdf │ ├── dasm.sty │ ├── dasm.tex │ ├── extraTableFmtDefs.tex │ ├── extraTableFmtPkgs.tex │ ├── images │ └── illegal.png │ ├── important.png │ ├── introduction.tex │ ├── legal.tex │ ├── machines.tex │ ├── manual.tex │ ├── mc68hc908.tex │ ├── preface.tex │ ├── processor6502.tex │ ├── psboxit.sty │ └── titlepage.tex ├── machines ├── 68hc11 │ ├── 68hc11a1.asm │ ├── 68hc11e1.asm │ ├── 68hc811e2.asm │ └── register.asm ├── 68hc908 │ ├── .mc68hc908jb8.mk │ ├── .mc68hc908jk1.mk │ ├── .mc68hc908jk3.mk │ ├── .mc68hc908mr32.mk │ ├── bits68hc908.asm │ ├── macros.asm │ ├── mc68hc908jb8.asm │ ├── mc68hc908jk1.asm │ ├── mc68hc908jk3.asm │ ├── mc68hc908mr32.asm │ ├── reg68hc908jb8.asm │ ├── reg68hc908jk3.asm │ └── reg68hc908mr32.asm ├── atari2600 │ ├── macro.h │ └── vcs.h ├── atari7800 │ ├── 7800.h │ └── macro.h └── channel-f │ ├── README │ ├── macro.h │ └── ves.h ├── research ├── Makefile ├── README ├── all_mnemonics.txt ├── bitsets.c ├── compare_hashes.py ├── compare_mod_and.c ├── fsize.c ├── get_set_progname.c ├── hash_compare.c ├── loweror.c ├── minunit.h ├── minunit_example.c └── sizeof.c ├── src ├── BUGS ├── HEADER ├── Makefile ├── PATCHES ├── TODO ├── asm.h ├── errors.c ├── errors.h ├── exp.c ├── ftobin.c ├── ftohex.c ├── globals.c ├── main.c ├── mne6303.c ├── mne6502.c ├── mne65c02.c ├── mne6811.c ├── mne68705.c ├── mne68908.c ├── mnef8.c ├── ops.c ├── symbols.c ├── symbols.h ├── test_errors.c ├── test_util.c ├── util.c ├── util.h └── version.h └── test ├── 11include.inc ├── 6502_16b.asm ├── 6502_16b.fail ├── 6502_16h.asm ├── 6502_16h.bin.ref ├── 6502_16h.hex.ref ├── 6502_16l.asm ├── 6502_16l.bin.ref ├── 6502_16l.hex.ref ├── 6502_16w.asm ├── 6502_16w.fail ├── 6502_DCswap.asm ├── 6502_DCswap.bin.ref ├── 6502_DCswap.hex.ref ├── 6502_X16b.asm ├── 6502_X16b.fail ├── 6811_X16.asm ├── 6811_X16.fail ├── 6811_Y16.asm ├── 6811_Y16.fail ├── 68908_DCswap.asm ├── 68908_DCswap.bin.ref ├── 68908_DCswap.hex.ref ├── 68908_SP16b.asm ├── 68908_SP16b.fail ├── 68908_cbeq_SP16.asm ├── 68908_cbeq_SP16.fail ├── 68908_dbnz_SP16.asm ├── 68908_dbnz_SP16.fail ├── Makefile ├── addressexpression.asm ├── addressexpression.bin.ref ├── addressexpression.hex.ref ├── align_mod_mac.asm ├── align_mod_mac.bin.ref ├── align_mod_mac.hex.ref ├── atari2600 ├── Makefile ├── README ├── boing26.args ├── boing26.asm └── boing26.bin.ref ├── atari7800 ├── Makefile ├── README ├── spritesample.args ├── spritesample.asm └── spritesample.bin.ref ├── badopcode1.asm ├── badopcode1.fail ├── badopcode2.asm ├── badopcode2.fail ├── broken6303hack.asm ├── broken6303hack.bin.ref ├── broken6303hack.hex.ref ├── channel-f ├── Makefile ├── README ├── lights.args ├── lights.asm ├── lights.bin.ref ├── tetris.args ├── tetris.asm └── tetris.bin.ref ├── cmdline_defs ├── Makefile ├── declare_var_mac.args ├── declare_var_mac.asm ├── declare_var_mac.bin.ref ├── declare_var_mac.hex.ref ├── ramstart.args ├── ramstart.asm ├── ramstart.bin.ref └── ramstart.hex.ref ├── concat_str.asm ├── concat_str.fail ├── declare_var_mac.asm ├── declare_var_mac.bin.ref ├── declare_var_mac.hex.ref ├── define_echo.asm ├── delete_empty_binary.args ├── delete_empty_binary.asm ├── delete_empty_binary.fail ├── demo.asm ├── doublemacro.asm ├── doublemacro.bin.ref ├── doublemacro.fail ├── doublemacro.hex.ref ├── empty.asm ├── example.asm ├── example.bin.ref ├── example.hex.ref ├── file-with-dash.asm ├── fill.asm ├── fill.bin.ref ├── fill.hex.ref ├── forced_addrmode.asm ├── forced_addrmode.bin.ref ├── forced_addrmode.hex.ref ├── improper_equ.asm ├── improper_equ.fail ├── incbin.asm ├── incbin.bin.ref ├── incbin.hex.ref ├── incbinexample1.txt ├── include-a.inc ├── include.asm ├── include.bin.ref ├── include.hex.ref ├── jentzsch1.asm ├── jentzsch2.asm ├── jentzsch2.fail ├── jmpiw.asm ├── jmpiw.bin.ref ├── jmpiw.hex.ref ├── labelchanges.asm ├── labelchanges.bin.ref ├── labelchanges.hex.ref ├── locals.asm ├── locals.bin.ref ├── locals.hex.ref ├── lockup_macro.asm ├── lockup_macro.bin.ref ├── lockup_macro.hex.ref ├── longstring.asm ├── longstring.bin.ref ├── longstring.hex.ref ├── m_switch_0.asm ├── m_switch_0.fail ├── m_switch_1.asm ├── m_switch_1.bin.ref ├── m_switch_1.hex.ref ├── m_switch_2.args ├── m_switch_2.asm ├── m_switch_2.fail ├── m_switch_3.args ├── m_switch_3.asm ├── m_switch_3.fail ├── macro_included.asm ├── macro_included.fail ├── macro_ipart0.asm ├── macro_ipart1.asm ├── macro_same_as_include.asm ├── macro_same_as_include.bin.ref ├── macro_same_as_include.hex.ref ├── missing_endm.asm ├── missing_endm.fail ├── multiline_comment.asm ├── multiline_comment.bin.ref ├── multiline_comment.hex.ref ├── negative.asm ├── negative1024.asm ├── negative1024.fail ├── negative1024_2.asm ├── negative1024_2.fail ├── negative256.asm ├── negative256.fail ├── negative256_2.asm ├── negative256_2.fail ├── recursive_eqm.asm ├── recursive_eqm.fail ├── recursive_equ.asm ├── recursive_equ.fail ├── recursive_macro0.asm ├── recursive_macro0.bin.ref ├── recursive_macro0.hex.ref ├── recursive_macro1.asm ├── recursive_macro1.fail ├── recursive_macro2.asm ├── recursive_macro2.fail ├── recursive_set.asm ├── recursive_set.fail ├── reverse_segfault.asm ├── reverse_segfault.fail ├── run_tests.sh ├── run_valgrind.sh ├── same_as_macro ├── same_names.asm ├── same_names.bin.ref ├── same_names.hex.ref ├── sample.asm ├── sample.bin.ref ├── sample.hex.ref ├── segfault.asm ├── segfault.fail ├── selftest ├── 0_no_assembly.asm ├── 0_no_assembly.bin.ref ├── 1_no_binary.asm ├── 1_no_binary.bin.ref ├── 2_hexref_missing.asm ├── 2_hexref_missing.bin.ref ├── 3_binary_different.asm ├── 3_binary_different.bin.ref ├── 3_binary_different.hex.ref ├── 4_finally_OK.asm ├── 4_finally_OK.bin.ref ├── 4_finally_OK.hex.ref ├── 5_must_fail.asm ├── 5_must_fail.fail ├── 6_false_positive_fail.args ├── 6_false_positive_fail.asm ├── 6_false_positive_fail.fail ├── 7_false_positive_fail.asm ├── 7_false_positive_fail.fail ├── 8_false_positive_OK.asm ├── 8_false_positive_OK.fail └── Makefile ├── setstr.asm ├── setstr.bin.ref ├── setstr.hex.ref ├── setsym.asm ├── setsym.bin.ref ├── setsym.hex.ref ├── stabx.asm ├── stabx.fail ├── staby.asm ├── staby.fail ├── staby2.asm ├── staby2.fail ├── staby3.asm ├── staby3.fail ├── staby4.asm ├── staby4.fail ├── stawx.asm ├── stawx.bin.ref ├── stawx.hex.ref ├── stawy.asm ├── stawy.fail ├── stawy2.asm ├── stawy2.fail ├── stawy3.asm ├── stawy3.fail ├── string_conversion.asm ├── string_conversion.bin.ref ├── string_conversion.hex.ref ├── string_table.asm ├── string_table.bin.ref ├── string_table.hex.ref ├── stringify.asm ├── stringify.bin.ref ├── stringify.hex.ref ├── suite6303.asm ├── suite6303.bin.ref ├── suite6303.hex.ref ├── suite6502.asm ├── suite6502.bin.ref ├── suite6502.hex.ref ├── suite65c02.asm ├── suite65c02.bin.ref ├── suite65c02.hex.ref ├── suite68705.asm ├── suite68705.bin.ref ├── suite68705.hex.ref ├── suite68hc11.asm ├── suite68hc11.bin.ref ├── suite68hc11.hex.ref ├── suite68hc908.asm ├── suite68hc908.bin.ref ├── suite68hc908.hex.ref ├── suitef8.asm ├── suitef8.bin.ref ├── suitef8.hex.ref ├── supercat.asm ├── supercat.fail ├── test-report.txt ├── toobigbyte.asm ├── toobigbyte.fail ├── toobigword.asm ├── toobigword.bin.ref ├── toobigword.fail ├── toobigword.hex.ref ├── ucasm_compat.asm ├── ucasm_compat.bin.ref └── ucasm_compat.hex.ref /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build, Test and Package Snapshots 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'src/**' 7 | - 'test/**' 8 | - '.github/workflows/main.yml' 9 | 10 | jobs: 11 | build_for_windows: 12 | runs-on: windows-latest 13 | name: Build for Windows 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: Make 17 | run: make test # build + test 18 | env: 19 | CC: gcc 20 | - run: | 21 | mkdir -p artifacts/windows 22 | cp bin/dasm.exe artifacts/windows/dasm.exe 23 | - uses: actions/upload-artifact@v3 24 | with : 25 | name: dasm snapshot builds 26 | path: artifacts 27 | 28 | build_for_mac: 29 | runs-on: macos-latest 30 | name: Build for Mac 31 | steps: 32 | - uses: actions/checkout@v3 33 | - name: Make 34 | run: make test # build + test 35 | env: 36 | CC: gcc 37 | - run: | 38 | mkdir -p artifacts/macos 39 | cp bin/dasm artifacts/macos/dasm 40 | - uses: actions/upload-artifact@v3 41 | with : 42 | name: dasm snapshot builds 43 | path: artifacts 44 | 45 | build_for_linux: 46 | runs-on: ubuntu-latest 47 | name: Build for Linux 48 | steps: 49 | - uses: actions/checkout@v3 50 | - name: Make 51 | run: make test # build + test 52 | env: 53 | CC: gcc 54 | - run: | 55 | mkdir -p artifacts/linux 56 | cp bin/dasm artifacts/linux/dasm 57 | - uses: actions/upload-artifact@v3 58 | with : 59 | name: dasm snapshot builds 60 | path: artifacts 61 | 62 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | test/**/*.bin 3 | test/**/*.hex 4 | test/**/*.list.txt 5 | bin 6 | dasm 7 | ftohex -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | # Install packages 4 | RUN apt update && apt upgrade -y &&\ 5 | apt install -y curl &&\ 6 | apt install -y make &&\ 7 | apt install -y unzip &&\ 8 | apt install -y git &&\ 9 | apt install -y gcc &&\ 10 | apt install -y gcc-multilib &&\ 11 | apt install -y mingw-w64 12 | 13 | #download darwin build packages 14 | RUN curl -O http://security.ubuntu.com/ubuntu/pool/universe/o/openssl098/libssl0.9.8_0.9.8o-7ubuntu3.2.14.04.1_amd64.deb &&\ 15 | curl -O http://www.tarnyko.net/repo/apple-x86-gcc-DEBIAN-AMD64.zip &&\ 16 | unzip apple-x86-gcc-DEBIAN-AMD64.zip &&\ 17 | export DEBIAN_FRONTEND=noninteractive &&\ 18 | dpkg -i libssl0.9.8_0.9.8o-7ubuntu3.2.14.04.1_amd64.deb &&\ 19 | dpkg -i apple-uni-sdk-10.5_20110407-0.flosoft1_amd64.deb &&\ 20 | dpkg -i apple-x86-odcctools_758.159-0flosoft11_amd64.deb &&\ 21 | dpkg -i apple-x86-gcc_4.2.1~5646.1flosoft2_amd64.deb &&\ 22 | rm *.zip &&\ 23 | rm *.deb 24 | 25 | CMD /bin/bash -------------------------------------------------------------------------------- /docker/README: -------------------------------------------------------------------------------- 1 | 2 | This directory contains files & instructions to create a 'dasm build machine' 3 | Docker image that can build platform-specific dasm binaries for all three 4 | supported OSs (Linux, Windows and macOS) in a single go! 5 | 6 | Steps to create the Docker image: 7 | 8 | 0. Make sure you have Docker Desktop installed on your machine 9 | 1. Open a command prompt (Windows) or a bash shell (Linux/macOS) into this 10 | folder (i.e. containing the Dockerfile) 11 | 2. Run the command: `docker build -t dasm:build .` 12 | Note: this will download/install all build tools so takes a while. 13 | 14 | Steps to run the Docker container and build dasm for all 3 platforms: 15 | 16 | 1. Now run the container: `docker run -it --rm dasm:build`, which opens a shell 17 | to the container. 18 | Note: unless you want fetch a clone the dasm git repo and build that, it is 19 | probably easier to mount a shared drive in your docker container. 20 | On Windows, you can mount your c: drive on /mnt/c by running 21 | `docker run -it --rm -v c:\:/mnt/c dasm:build` (*) 22 | (*) This requires drive-sharing enabled in Docker Desktop, and sometimes 23 | needs this powershell command to allow that: 24 | `Set-NetConnectionProfile -interfacealias "vEthernet (DockerNAT)" -NetworkCategory Private` 25 | 2. From the container shell, cd into a shared drive that contains a local git 26 | clone of the dasm repo. Or do a 'git clone' on the container itself, e.g. 27 | `git clone --single-branch --branch master https://github.com/dasm-assembler/dasm.git` 28 | 3. cd into the dasm/docker folder from within the container shell 29 | 4. Run: `./make_dasm_all_platforms.sh` 30 | 5. This will sequentally call 'make' for all target platforms and copies the 31 | different dasm binaries into the /bin directory. 32 | -------------------------------------------------------------------------------- /docker/make_dasm_all_platforms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # this script builds platform-specific dasm binaries for all three supported OSs (Linux, Windows and macOS) 3 | 4 | cd .. 5 | mkdir -p bin/32bit 6 | mkdir -p bin/64bit 7 | cd src 8 | 9 | #step 1: build dasm for Linux 32-bit and 64-bit 10 | make 11 | cp dasm ../bin/64bit/dasm.Linux 12 | make clean 13 | export CFLAGS=' -m32' 14 | export LDFLAGS=' -m32 -L/usr/lib32' 15 | make 16 | cp dasm ../bin/32bit/dasm.Linux 17 | make clean 18 | unset CFLAGS 19 | unset LDFLAGS 20 | 21 | #step 2: build dasm for Windows 32-bit and 64-bit 22 | export CC=x86_64-w64-mingw32-gcc 23 | #TODO: fix warnings when compiling for win64 using x86_64-w64-mingw32-gcc 24 | # the compiler warnings have to do with default size of 'long' on windows 25 | make 26 | cp dasm ../bin/64bit/dasm.exe 27 | make clean 28 | export CC=i686-w64-mingw32-gcc 29 | export CFLAGS=' -m32' 30 | export LDFLAGS=' -m32 -L/usr/lib32' 31 | make 32 | cp dasm ../bin/32bit/dasm.exe 33 | make clean 34 | unset CC 35 | unset CFLAGS 36 | unset LDFLAGS 37 | 38 | #step 3: build dasm for macOS 32-bit and 64-bit 39 | export LD=$CC 40 | export CC=i686-apple-darwin10-gcc 41 | make 42 | cp dasm ../bin/64bit/dasm.macOS 43 | make clean 44 | export CFLAGS=' -m32 -arch i386 ' 45 | export LDFLAGS=' -m32 -L/usr/i686-apple-darwin10/lib -arch i386' 46 | make 47 | cp dasm ../bin/32bit/dasm.macOS 48 | make clean 49 | unset LD 50 | unset CC 51 | unset CFLAGS 52 | unset LDFLAGS 53 | -------------------------------------------------------------------------------- /docs/dasm.1: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .\" (C) Copyright 2020 the DASM team and its contributors 3 | .\" 4 | .TH DASM 1 "October 11 2020" 5 | .\" Please adjust this date whenever revising the manpage. 6 | .SH NAME 7 | dasm \- 8\-bit macro assembler 8 | .SH SYNOPSIS 9 | .B dasm 10 | .IR sourcefile " [" options ] 11 | .SH DESCRIPTION 12 | This manual page documents briefly the 13 | .B dasm 14 | command. 15 | .PP 16 | \fBdasm\fP is a versatile macro assembler with support for several 17 | 8\-bit microprocessors including MOS 6502 & 6507; Motorola 6803, 68705, 18 | and 68HC11; Hitachi HD6303 (extended Motorola 6801) and Fairchild F8. 19 | .SH OPTIONS 20 | \fBdasm\fP supports the following options, briefly described below. 21 | For more information see the \fBdasm\fP \fITechnical Reference Manual\fP. 22 | .TP 23 | .BI \-f # 24 | output format 1\-3 [default: \fI1\fP] 25 | .TP 26 | .BI \-o name 27 | output file name [default: \fIa.out\fP] 28 | .TP 29 | .BI \-l name 30 | list file name [default: \fInone generated\fP] 31 | .TP 32 | .BI \-L name 33 | list file, containing all passes 34 | .TP 35 | .BI \-v # 36 | verboseness 0\-4 [default: \fI0\fP] 37 | .TP 38 | .B \-d 39 | debug mode (for developers) 40 | .TP 41 | .BI \-D symbol 42 | define symbol, set to \fI0\fP 43 | .TP 44 | .BI \-D symbol = expression 45 | define symbol, set to \fIexpression\fP 46 | .TP 47 | .BI \-M symbol = expression 48 | define symbol using \fIEQM\fP (same as \fB-D\fP) 49 | .TP 50 | .BI \-p # 51 | maximum number of passes 52 | .TP 53 | .BI \-P # 54 | maximum number of passes, with fewer checks 55 | .TP 56 | .BI \-T # 57 | symbol table sorting [default: \fI0\fP] 58 | .RS 59 | .IR 0 " = \fBalphabetical\fP" 60 | .IR 1 " = \fBaddress/value\fP" 61 | .RE 62 | .TP 63 | .BI \-E # 64 | error format [default: \fI0\fP] 65 | .RS 66 | .IR 0 " = \fBMS\fP" 67 | .IR 1 " = \fBDillon\fP" 68 | .IR 2 " = \fBGNU\fP" 69 | .RE 70 | .TP 71 | .B \-S 72 | strict syntax checking 73 | .TP 74 | .B \-R 75 | remove binary \fIoutput\fP file in case of errors 76 | .TP 77 | .BI \-m # 78 | maximum allowed file-size in kB 79 | .SH SEE ALSO 80 | .TP 81 | .IR /usr/share/doc/dasm/dasm.pdf : 82 | .B dasm Technical Reference Manual 83 | .SH AUTHOR 84 | Written and maintained by the DASM team and its contributors. 85 | -------------------------------------------------------------------------------- /docs/dasm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/docs/dasm.pdf -------------------------------------------------------------------------------- /docs/ftohex.txt: -------------------------------------------------------------------------------- 1 | 2 | FTOHEX Convert assembly output file to INTEL-HEX format suitable for, say, 3 | a GTEK prom programmer. 4 | 5 | ftohex format infile outfile 6 | 7 | Example: 8 | dasm -f2 example.asm -oexample.out 9 | ftohex 2 example.out example.hex 10 | 11 | This program converts and output file generated by DASM to the Intel 12 | hex-ascii format. You must specify the format you used when you 13 | assembled the source for FTOHEX to properly read the out file. 14 | Generally format 2 is used for assembly (see dasm.txt) as this 15 | generates the smallest hex file. 16 | 17 | -------------------------------------------------------------------------------- /docs/sources/6803.tex: -------------------------------------------------------------------------------- 1 | \chapter{6803 Processor} 2 | \label{processor:6803} 3 | \index{Processor!6803} 4 | 5 | \section{Endianness} 6 | 7 | The \mono{6803} is a big-endian machine. Byte ordering in words is high, then low. 8 | 9 | \emph{No content yet} -------------------------------------------------------------------------------- /docs/sources/68705.tex: -------------------------------------------------------------------------------- 1 | \chapter{68705 Processor} 2 | \label{processor:68705} 3 | \index{Processor!68705} 4 | 5 | \section{Endianness} 6 | 7 | The \mono{68705} is a big-endian machine. Byte ordering in words is high, then low. 8 | 9 | 10 | \section{Adressing modes} 11 | 12 | The \mono{68705} processor has a subset of the \mono{68hc908}\footnote{see chapter \ref{processor:MC68HC908}} instruction set. 13 | For addressing modes please refer to table \ref{special_address_modes_68hc908}. As a quick 14 | rule of thumb for comparison one can state the \mono{68705} processor is lacking all stack-pointer related 15 | and some few special instructions from the \mono{mc68hc908} processor. 16 | 17 | \section{Opcode Map} 18 | 19 | \newgeometry{top=30mm, bottom=30mm, left=25mm, right=15mm}% 20 | \begin{landscape}% 21 | {% 22 | \input{68hc705_opcode_summary.tex}% 23 | }% 24 | \end{landscape}% 25 | \restoregeometry %so it does not affect the rest of the pages. 26 | 27 | % \emph{No further content yet} -------------------------------------------------------------------------------- /docs/sources/68HC11.tex: -------------------------------------------------------------------------------- 1 | \chapter{68HC11 Processor} 2 | \label{processor:68HC11} 3 | \index{Processor!68HC11} 4 | 5 | \section{Endianness} 6 | 7 | The \mono{68HC11} is a big-endian machine. Byte ordering in words is high, then low. 8 | 9 | \emph{No content yet} -------------------------------------------------------------------------------- /docs/sources/68hc908_special_addressing_modes.tex: -------------------------------------------------------------------------------- 1 | 2 | 3 | \providecommand{\smTablePB}[1]% 4 | {\let\smTableTemp=\\#1\let\\=\smTableTemp\hspace{0pt}} 5 | \ifundefined{smTableWidthDefined} 6 | \newlength{\smTableWidth} 7 | \newlength{\smTableWidthComplete} 8 | \global\def\smTableWidthDefined{} 9 | \fi 10 | 11 | %% The following setting protects this code from babel shorthands. %% 12 | %% \ifthenelse{\isundefined{\languageshorthands}}{}{\languageshorthands{english}} 13 | 14 | %% to adjust positions in multirow situations %% 15 | %%\setlength{\bigstrutjot}{\jot} 16 | %%\setlength{\extrarowheight}{\doublerulesep} 17 | 18 | %% The \setlongtables command keeps column widths the same across %% 19 | %% pages. Simply comment out next line for varying column widths. %% 20 | %%\setlongtables 21 | 22 | \def\smTableColAWidth{23pt} 23 | \def\smTableColBWidth{173pt} 24 | 25 | \setlength\smTableWidth{% 26 | \smTableColAWidth+% 27 | \smTableColBWidth+% 28 | 0pt} 29 | 30 | 31 | \def\smTableNumCols{2} 32 | \setlength\smTableWidthComplete{\smTableWidth+% 33 | \tabcolsep*\smTableNumCols*2+\arrayrulewidth*\smTableNumCols} 34 | \ifthenelse{\lengthtest{\smTableWidthComplete > \linewidth}}% 35 | {\def\smTableScale{\ratio{\linewidth-% 36 | \tabcolsep*\smTableNumCols*2-% 37 | \arrayrulewidth*\smTableNumCols}% 38 | {\smTableWidth}}}% 39 | {\def\smTableScale{1}} 40 | 41 | \ifthenelse{\isundefined{\smTableColB}}{\newlength{\smTableColB}}{}\settowidth{\smTableColB}{\begin{tabular}{@{}p{\smTableColAWidth*\smTableScale}@{}}x\end{tabular}} 42 | \ifthenelse{\isundefined{\smTableColC}}{\newlength{\smTableColC}}{}\settowidth{\smTableColC}{\begin{tabular}{@{}p{\smTableColBWidth*\smTableScale}@{}}x\end{tabular}} 43 | 44 | \def\specialAddressModesTable{ 45 | \begin{longtable}{|p{\smTableColAWidth}|p{\smTableColBWidth}|} 46 | \hhline{|-|-|} 47 | \smTablePB{\centering}\gnumboxY{}\ninerm{dd} 48 | &\smTablePB{\raggedright}\gnumbox{}\ninerm{direct to direct} 49 | \\ 50 | \smTablePB{\centering}\gnumboxO{}\ninerm{dix+} 51 | &\smTablePB{\raggedright}\gnumbox{}\ninerm{direct to X-indexed and post-increment X} 52 | \\ 53 | \smTablePB{\centering}\gnumboxP{}\ninermb{imd} 54 | &\smTablePB{\raggedright}\gnumbox{}\ninerm{immediate to direct} 55 | \\ 56 | \smTablePB{\centering}\gnumboxDG{}\ninermb{ix+d} 57 | &\smTablePB{\raggedright}\gnumbox{}\ninerm{X-indexed to direct and post-increment X} 58 | \\ 59 | \hhline{|-|-|} 60 | \smTablePB{\centering}\gnumboxLR{}\ninermb{ix+} 61 | &\smTablePB{\raggedright}\gnumbox{}\ninerm{X-indexed and post-increment X} 62 | \\ 63 | \smTablePB{\centering}\gnumboxG{}\ninerm{ix8+} 64 | &\smTablePB{\raggedright}\gnumbox{}\ninerm{X-indexed + byte-offset and post-increment X} 65 | \\ 66 | \hhline{--} 67 | \caption[\specialAddressingModesCaption68hc908]{\label{special_address_modes_68hc908}\specialAddressingModesCaption68hc908}% 68 | \end{longtable} 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /docs/sources/68hc908_standard_addressing_modes.tex: -------------------------------------------------------------------------------- 1 | 2 | 3 | \providecommand{\samTablePB}[1]% 4 | {\let\samTableTemp=\\#1\let\\=\samTableTemp\hspace{0pt}} 5 | \ifundefined{samTableWidthDefined} 6 | \newlength{\samTableWidth} 7 | \newlength{\samTableWidthComplete} 8 | \global\def\samTableWidthDefined{} 9 | \fi 10 | 11 | \def\samTableColAWidth{28pt} 12 | \def\samTableColBWidth{135pt} 13 | 14 | \setlength\samTableWidth{% 15 | \samTableColAWidth+% 16 | \samTableColBWidth+% 17 | 0pt} 18 | 19 | \def\samTableNumCols{2} 20 | 21 | \setlength\samTableWidthComplete{\samTableWidth+% 22 | \tabcolsep*\samTableNumCols*2+\arrayrulewidth*\samTableNumCols} 23 | 24 | \ifthenelse{\lengthtest{\samTableWidthComplete > \linewidth}}% 25 | {\def\samTableScale{\ratio{\linewidth-% 26 | \tabcolsep*\samTableNumCols*2-% 27 | \arrayrulewidth*\samTableNumCols}% 28 | {\samTableWidth}}}% 29 | {\def\samTableScale{1}} 30 | 31 | \ifthenelse{\isundefined{\samTableColB}}{\newlength{\samTableColB}}{}\settowidth{\samTableColB}{\begin{tabular}{@{}p{\samTableColAWidth*\samTableScale}@{}}x\end{tabular}} 32 | \ifthenelse{\isundefined{\samTableColC}}{\newlength{\samTableColC}}{}\settowidth{\samTableColC}{\begin{tabular}{@{}p{\samTableColBWidth*\samTableScale}@{}}x\end{tabular}} 33 | 34 | \def\standardAddressModesTable{ 35 | \begin{longtable}{|p{\samTableColAWidth}|p{\samTableColBWidth}|} 36 | \hhline{|-|-|} 37 | \samTablePB{\centering}\gnumbox{}\ninerm{inh}% 38 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{inherent}% 39 | \\ 40 | \hhline{|-|~|} 41 | \samTablePB{\centering}\gnumboxLG{}\ninerm{imm8}% 42 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{immediate byte}% 43 | \\ 44 | \hhline{|-|~|} 45 | \samTablePB{\centering}\gnumboxGN{}\ninerm{imm16}% 46 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{immediate word}% 47 | \\ 48 | \hhline{|-|~|} 49 | \samTablePB{\centering}\gnumboxLB{}\ninerm{rel}% 50 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{relative}% 51 | \\ 52 | \hhline{|-|~|} 53 | \samTablePB{\centering}\gnumboxLO{}\ninerm{dir}% 54 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{direct (zero page/8bit address)}% 55 | \\ 56 | \hhline{|-|~|} 57 | \samTablePB{\centering}\gnumbox{}\ninerm{ext}% 58 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{16bit address (absolute)}% 59 | \\ 60 | \hhline{|-|~|} 61 | \samTablePB{\centering}\gnumbox{}\ninerm{x16}% 62 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{X-indexed + word-offset}% 63 | \\ 64 | \hhline{|-|~|} 65 | \samTablePB{\centering}\gnumbox{}\ninerm{sp16}% 66 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{SP-indexed + word-offset}% 67 | \\ 68 | \hhline{|-|~|} 69 | \samTablePB{\centering}\gnumboxLP{}\ninerm{x8}% 70 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{X-indexed + byte-offset}% 71 | \\ 72 | \hhline{|-|~|} 73 | \samTablePB{\centering}\gnumboxSB{}\ninerm{sp8}% 74 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{SP-indexed + byte-offset}% 75 | \\ 76 | \hhline{|-|~|} 77 | \samTablePB{\centering}\gnumboxLY{}\ninerm{x}% 78 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{X-indexed}% 79 | \\ 80 | \hhline{|-|~|} 81 | \samTablePB{\centering}\gnumbox{}\ninerm{-}% 82 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{illegal opcode}% 83 | \\ 84 | \hhline{|-|~|} 85 | \samTablePB{\centering}\gnumboxb{}\ninerm{*}% 86 | &\samTablePB{\raggedright}\gnumbox{}\ninerm{prefix for SP-indexed address mode}% 87 | \\ 88 | \hhline{--} 89 | \caption[\standardAddressingModesCaption68hc908]{\label{standard_address_modes_68hc908}\standardAddressingModesCaption68hc908}% 90 | \end{longtable} 91 | } 92 | 93 | 94 | -------------------------------------------------------------------------------- /docs/sources/HD6303.tex: -------------------------------------------------------------------------------- 1 | \chapter{HD6303 Processor} 2 | \label{processor:6303} 3 | \index{Processor!HD6303} 4 | 5 | \section{Endianness} 6 | 7 | The \mono{HD6303} is a big-endian machine. Byte ordering in words is high, then low. 8 | 9 | \section{Broken Opcodes Bug} 10 | \label{changelog:20200903bug} 11 | The \mono{AIM}, \mono{OIM}, \mono{EIM}, and \mono{TIM} opcodes are broken. These instructions are \textbf{three} bytes long according to the data sheets, yet in \dasm they are 12 | treated as \textbf{two} byte instructions. 13 | 14 | These instructions are supposed 15 | to work as follows: 16 | 17 | \begin{code} 18 | tim #$10,$C2 19 | tim #$80,$00,x 20 | \end{code} 21 | 22 | So there's an immediate value \textbf{and} a zero-page address 23 | for these instructions! \dasm, however, only accepts these: 24 | 25 | \begin{code} 26 | tim $10 27 | tim $10,x 28 | \end{code} 29 | 30 | These opcodes simply don't fit into the "regular pattern" of 8-bit CPUs 31 | we deal with in \dasm. Fixing this will require changes to 32 | \dasm beyond just fixing the instruction table, and the parser code is not even remotely ready for this. 33 | 34 | The "workaround" for now is to use macros instead of the 35 | actual instructions, see \mono{../test/broken6303hack.asm} for macro templates. 36 | 37 | -------------------------------------------------------------------------------- /docs/sources/Makefile: -------------------------------------------------------------------------------- 1 | 2 | SOURCES = $(wildcard *.tex) 3 | 4 | dasm.pdf: $(SOURCES) 5 | latex dasm.tex 6 | 7 | 8 | clean: 9 | rm -f *.aux dasm.log dasm.toc dasm.pdf dasm.out dasm.lof dasm.idx 10 | -------------------------------------------------------------------------------- /docs/sources/dasm-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/docs/sources/dasm-logo.png -------------------------------------------------------------------------------- /docs/sources/dasm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/docs/sources/dasm.pdf -------------------------------------------------------------------------------- /docs/sources/dasm.sty: -------------------------------------------------------------------------------- 1 | 2 | \ProvidesPackage{dasm}[2020/09/20 v1.0 dasm Style] 3 | \RequirePackage{amsmath} 4 | \RequirePackage[avantgarde]{quotchap} 5 | \renewcommand\chapterheadstartvskip{\vspace*{-5\baselineskip}} 6 | %% end 7 | -------------------------------------------------------------------------------- /docs/sources/extraTableFmtDefs.tex: -------------------------------------------------------------------------------- 1 | 2 | \def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax} 3 | 4 | %% The following setting protects this code from babel shorthands. 5 | \ifthenelse{\isundefined{\languageshorthands}}{}{\languageshorthands{english}} 6 | 7 | %% background colors for selected fields of the big table 8 | \definecolor{lightorange}{rgb}{1.00,0.80,0.60} 9 | \definecolor{lightblue}{rgb}{0.00,1.00,1.00} 10 | \definecolor{lightpink}{rgb}{1.00,0.65,0.90} 11 | \definecolor{skyblue}{rgb}{0.60,0.80,1.00} 12 | \definecolor{lightgreen}{rgb}{0.80,1.00,0.80} 13 | \definecolor{lightyellow}{rgb}{1.00,1.00,0.60} 14 | \definecolor{darkgray}{rgb}{0.50,0.50,0.50} 15 | \definecolor{lightgray}{rgb}{0.85,0.85,0.85} 16 | \definecolor{lightred}{rgb}{1.00,0.30,0.00} 17 | \definecolor{yellow}{rgb}{1.00,1.00,0.00} 18 | \definecolor{pink}{rgb}{1.00,0.00,0.90} 19 | \definecolor{orange}{rgb}{0.90,0.90,0.00} 20 | \definecolor{green}{rgb}{0.60,1.00,0.60} 21 | 22 | %% some tiny fonts to fit into the fields of the big table 23 | \newfont{\ninerm}{cmr8 scaled 1000} 24 | \newfont{\ninermb}{cmbx8 scaled 1000} 25 | \newfont{\eightrm}{cmr7 scaled 1000} 26 | \newfont{\sevenrm}{cmr6 scaled 1000} 27 | \newfont{\sixrm}{cmr5 scaled 1000} 28 | 29 | %% macros for boxes/fields in the big table 30 | \providecommand\gnumbox{\makebox[2pt]}% 31 | \providecommand\gnumboxLO{\cellcolor{lightorange}\makebox[2pt]}% 32 | \providecommand\gnumboxLB{\cellcolor{lightblue}\makebox[2pt]}% 33 | \providecommand\gnumboxLP{\cellcolor{lightpink}\makebox[2pt]}% 34 | \providecommand\gnumboxSB{\cellcolor{skyblue}\makebox[2pt]}% 35 | \providecommand\gnumboxLY{\cellcolor{lightyellow}\makebox[2pt]}% 36 | \providecommand\gnumboxLG{\cellcolor{lightgreen}\makebox[2pt]}% 37 | \providecommand\gnumboxDG{\cellcolor{darkgray}\color[rgb]{1.00,1.00,1.00}\makebox[2pt]}% 38 | \providecommand\gnumboxLR{\cellcolor{lightred}\color[rgb]{1.00,1.00,1.00}\makebox[2pt]}% 39 | \providecommand\gnumboxG{\cellcolor{lightgray}\makebox[2pt]}% 40 | \providecommand\gnumboxY{\cellcolor{yellow}\makebox[2pt]}% 41 | \providecommand\gnumboxP{\cellcolor{pink}\color[rgb]{1.00,1.00,1.00}\makebox[2pt]}% 42 | \providecommand\gnumboxO{\cellcolor{orange}\makebox[2pt]}% 43 | \providecommand\gnumboxGN{\cellcolor{green}\makebox[2pt]}% 44 | 45 | %% to adjust positions in multirow situations 46 | \setlength{\bigstrutjot}{\jot} 47 | \setlength{\extrarowheight}{\doublerulesep} 48 | 49 | %% The \setlongtables command keeps column widths the same across 50 | %% pages. Simply comment out next line for varying column widths. 51 | %\setlongtables 52 | 53 | -------------------------------------------------------------------------------- /docs/sources/extraTableFmtPkgs.tex: -------------------------------------------------------------------------------- 1 | \usepackage{pdflscape} 2 | \usepackage{array} 3 | \usepackage{calc} 4 | \usepackage{multirow} 5 | \usepackage{hhline} 6 | \usepackage{ifthen} 7 | \usepackage{diagbox} 8 | \usepackage{geometry} 9 | %% \usepackage{subfig} 10 | 11 | -------------------------------------------------------------------------------- /docs/sources/images/illegal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/docs/sources/images/illegal.png -------------------------------------------------------------------------------- /docs/sources/important.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/docs/sources/important.png -------------------------------------------------------------------------------- /docs/sources/legal.tex: -------------------------------------------------------------------------------- 1 | 2 | \chapter{Legal} 3 | 4 | 5 | \section{Authorship} 6 | \subsection{dasm} 7 | 8 | The \dasm Macro Assembler is... 9 | 10 | \begin{itemize} 11 | \item Copyright \textcopyright 1988-2002 by Matthew Dillon. 12 | \item Copyright \textcopyright 1995 by Olaf "Rhialto" Seibert. 13 | \item Copyright \textcopyright 2003-2008 by Andrew Davie. 14 | \item Copyright \textcopyright 2008 by Peter H. Froehlich. 15 | \item Copyright \textcopyright 2019-2020 by the DASM team. 16 | \end{itemize} 17 | 18 | \subsection{Manual} 19 | This manual is authored by Andrew Davie and is... 20 | 21 | \begin{itemize} 22 | \item Copyright \textcopyright 2020 by the DASM team. 23 | \end{itemize} 24 | 25 | \pagebreak 26 | \label{changelog:20200824license} 27 | \section{License} 28 | 29 | This program is free software: you can redistribute it and/or modify 30 | it under the terms of the GNU General Public License as published by 31 | the Free Software Foundation, either version 2 of the License, or 32 | (at your option) any later version. 33 | 34 | This program is distributed in the hope that it will be useful, 35 | but WITHOUT ANY WARRANTY; without even the implied warranty of 36 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 37 | GNU General Public License for more details. 38 | 39 | You should have received a copy of the GNU General Public License 40 | along with this program. If not, see \url{https://www.gnu.org/licenses/} 41 | 42 | -------------------------------------------------------------------------------- /docs/sources/machines.tex: -------------------------------------------------------------------------------- 1 | \chapter{Machines} 2 | \label{Machine} 3 | 4 | \dasm supports specific machines and processors through the provision of companion source-code files that can assist with programming each platform. These files are located in the \mono{machines} subdirectory. Machine-specific support is provided for... 5 | 6 | \begin{itemize} 7 | \item \nameref{Machine:atari2600} 8 | \item \nameref{machine:atari7800} 9 | \item \nameref{machine:channelF} 10 | \item 68hc11 11 | \item 68hc908 12 | \end{itemize} 13 | 14 | 15 | \section{Atari 2600} 16 | \index{Machine:Atari 2600} 17 | \label{Machine:atari2600} 18 | \label{changelog:20200908atari} 19 | 20 | The \mono{Atari 2600} is a game console from \mono{1977} that uses a \mono{6507} processor. This processor is similar to the \mono{6502} processor (supported by \dasm). The difference in the processors is the number of hardware address lines on the chips; these being \mono{16} on the \mono{6502}, and \mono{13} on the \mono{6507}. Thus, the \mono{6502} can directly address \mono{64 KiB} of memory and the \mono{6507} only \mono{8 KiB} of memory. From the point of view of \dasm, the machines are identical, as the \mono{6502} and \mono{6507} share a common instruction set. 21 | 22 | \subsection{Processor selection} 23 | 24 | The target CPU is selected with \nameref{pseudoop:processor} 25 | as the first directive inside the source file that should be assembled. 26 | 27 | \begin{usage} 28 | processor 6502 29 | \end{usage} 30 | 31 | 32 | \subsection{Support Files} 33 | 34 | The \mono{Atari 2600} is explicitly supported with two files generally included in most programs for that machine. 35 | 36 | \subsubsection{\mono{vcs.h}} 37 | 38 | Contains the standardised register definitions for the \mono{RIOT} and \mono{TIA} chips, defined with uninitialised segments. The implementation allows relocation of the \mono{TIA} base address to a shadow register address. 39 | 40 | \subsubsection{\mono{macro.h}} 41 | \label{support6502} 42 | 43 | Contains some useful macros. 44 | 45 | \section{Atari 7800} 46 | \index{machine!Atari 7800} 47 | \label{machine:atari7800} 48 | 49 | The \mono{Atari 7800 ProSystem}, or simply the \mono{Atari 7800}, is a home video game console officially released by the Atari Corporation in \mono{1986}. It is almost fully backward-compatible with the \nameref{Machine:Atari 2600}. It uses a variant of the \mono{6502} processor. 50 | 51 | \subsection{Processor selection} 52 | 53 | The target CPU is selected with \nameref{pseudoop:processor} 54 | as the first directive inside the source file that should be assembled. 55 | 56 | \begin{usage} 57 | processor 6502 58 | \end{usage} 59 | 60 | \subsection{Support Files} 61 | 62 | The \mono{Atari 7800} is explicitly supported with two files generally included in most programs for that machine. 63 | 64 | \subsubsection{\mono{vcs.h}} 65 | 66 | Contains the standardised register definitions. 67 | 68 | \subsubsection{\mono{macro.h}} 69 | 70 | Contains some useful macros. 71 | 72 | 73 | \section{Channel F} 74 | \label{machine:channelF} 75 | 76 | \label{changelog:20200906f8} 77 | \index{Machine!Channel F} 78 | 79 | \emph{No content yet} 80 | 81 | See \nameref{processor:f8} 82 | -------------------------------------------------------------------------------- /docs/sources/mc68hc908.tex: -------------------------------------------------------------------------------- 1 | \chapter{MC68HC908 Processor} 2 | \label{processor:MC68HC908} 3 | \index{Processor!68908} 4 | \index{Processor!MC68HC908} 5 | 6 | %% Variants of the \mono{MC68HC908} CPU are widely used in DIN-rail mountable Micro-SPS from french manufacturer Crouzet. 7 | %% Variant mr32 used in Crouzet XT20 Millenium 8 | %% Variant jb8 used in USB08 Welcome Kit (Evaluation Board) 9 | The \mono{MC68HC908} CPU is manufactured by Motorola/Freescale/NXP. There is a wide spectrum of CPU variants available. 10 | \dasm has include-file support for the variants {\it{jk1}}, {\it{jk3}}, {\it{jb8}} and {\it{mr32}} in its machines/68hc908 subdirectory. 11 | Some CPU variants can be clocked by a PLL and support advanced PWM generation for motor applications where others feature a USB 1.0 interface 12 | or special keyboard GPIO. Various numbers of 8- and 16bit timers for input capture / output compare operations are available as well as 10bit 13 | ADC converters, SPI (sometimes also UART) communication interface and brown-out reset. Onchip flash memory ranges from 2 to 32kByte, RAM ranges 14 | from 128 to 768 bytes and clocking speeds ranges from 1 to 8MHz. 15 | 16 | \section{Endianness} 17 | 18 | The \mono{MC68HC908} is a big-endian machine. Byte ordering in words is high, then low. 19 | 20 | \section{Adressing modes} 21 | 22 | Beside the "standard" addressing modes (listed in table \ref{standard_address_modes_68hc908}) there are 6 special addressing modes that 23 | apply to 6 distinct opcodes (table \ref{special_address_modes_68hc908}). These addressing modes include inherent given source- \emph{and} destination- 24 | address mode and optionally an increment operation for the index register. The modes dd, dix+, imd and ix+d apply to move-data mnemonics. 25 | The modes ix+ an ix8+ apply to compare-and-branch-if-equal mnemonic. 26 | 27 | 28 | %% The \setlongtables command keeps column widths the same across 29 | %% pages. Simply comment out next line for varying column widths. 30 | %\setlongtables 31 | 32 | 33 | \def\standardAddressingModesCaption68hc908{Abbreviations for standard addressing modes} 34 | \def\specialAddressingModesCaption68hc908{Abbreviations for special addressing modes} 35 | 36 | \input{68hc908_standard_addressing_modes.tex} 37 | \input{68hc908_special_addressing_modes.tex} 38 | 39 | \begin{table}[hbp] 40 | \parbox[t]{.48\linewidth}{ 41 | \standardAddressModesTable 42 | } 43 | \hfill 44 | \parbox[t]{.48\linewidth}{ 45 | \specialAddressModesTable 46 | } 47 | \end{table} 48 | 49 | \newpage 50 | \section{Opcode Summary} 51 | 52 | Although dasm mnemonics are case-insensitive they are written in camel-case in table \ref{OpcodeSummary68hc908}. 53 | This is to indicate the inherent given register(s) for the first\footnote{and second operand if given} operand: 54 | 55 | \begin{itemize} 56 | \item 8bit-register A 57 | \item 8bit-register X 58 | \item 8bit-register H 59 | \item 16bit-register HX (combined of 8bit-register H and X) 60 | \item 8bit-register P (stack-pointer low byte) 61 | \item 16bit-register S (stack-pointer) 62 | \end{itemize} 63 | 64 | There are two opcodes that need operand arguments which don't fit into any scheme 65 | implemented in \dasm. However they can be generated by using 66 | forced\footnote{see \ref{pseudoop:force}} addressing mode. 67 | Extension {\it{.ix}} (implied, X-indexed) has to be used in this case. 68 | 69 | \begin{table} 70 | \begin{tabular}{ccp{0.5\linewidth}} 71 | Opcode & Mnemonic & Description 72 | \\ 73 | \hhline{---} 74 | {\mono{\$71}} & {\mono{cbeq{\it{.ix}}}} & \makebox[2pt]{}{compare register A with value indexed by X, branch relative if not equal and post-increment\footnote{note that also opcode {\mono{\$61}} does post-increment X} X} 75 | \\ 76 | {\mono{\$7B}} & {\mono{dbnz{\it{.ix}}}} & \makebox[2pt]{}{decrement value indexed by X and branch relative if not zero.} 77 | \end{tabular} 78 | \caption{} 79 | \end{table} 80 | 81 | \newgeometry{top=30mm, bottom=30mm, left=25mm, right=15mm}% 82 | \begin{landscape}% 83 | {% 84 | \input{68hc908_opcode_summary.tex}% 85 | }% 86 | \end{landscape}% 87 | \restoregeometry %so it does not affect the rest of the pages. 88 | 89 | \ifthenelse{\isundefined{\languageshorthands}}{}{\languageshorthands{\languagename}} 90 | 91 | -------------------------------------------------------------------------------- /docs/sources/preface.tex: -------------------------------------------------------------------------------- 1 | \index{Change Log} 2 | \section*{Change Log} 3 | \label{section:changelog} 4 | 5 | This section lists recent changes to the document, with most recent entries first. Each item line hyperlink to the relevant place in the document. 6 | 7 | \subsection*{Changes} 8 | 9 | \begin{itemize} 10 | 11 | \item[]\mono{2020.08.24} 12 | \item \hyperref[changelog:20200824const]{Removed 0x for hexadecimal. Apparently recently removed from the code?} 13 | \item \hyperref[changelog:20200824license]{Upgraded license to GPL v3 to be compatible with .STY files used for generation of this manual} 14 | \item \hyperref[changelog:20200824processor]{Fixed table of processor types to explicitly list PROCESSOR values} 15 | \item \hyperref[changelog:20200824rangebug]{Documented dasm bug in constants signed range checking for 8-bit operands} 16 | \item \hyperref[changelog:20200824const]{Constants and Numbers duplicate sections merged.} 17 | \item \hyperref[changelog:20200824arithmetic]{Corrected error in table - || is logical-OR and \&\& is logical-AND when used in expressions. They will return 0 or 1 results.} 18 | \item \hyperref[changelog:20200824org]{Clarified the ORG/RORG usage in the \nameref{flag:outputformat} table, in regards to the requirement that data must be in order in initialised segments} 19 | \item \hyperref[changelog:20200824error]{Revamped the comment about error types} 20 | \item \hyperref[changelog:20200824passes]{Mentioned default number of passes} 21 | \item \hyperref[changelog:20200824developers]{Clarified the -d option} 22 | \item \hyperref[changelog:20200824sourcefile]{Clarified command-line format} 23 | \item \hyperref[changelog:specialcase]{Added note about special-casing of negative operands} 24 | \item \hyperref[changelog:alternateunary]{Added alternates to unary operator table} 25 | \item \hyperref[section:numberformat]{Added section describing \nameref{section:numberformat}} 26 | 27 | \item[]\mono{2020.08.23} 28 | \item \hyperref[changelog:20200823colon]{Added some usage notes about colon in label names and why it can be advantageous. I still hate it.} 29 | \item \hyperref[section:changelog]{Added this change log section.} 30 | \end{itemize} 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/sources/titlepage.tex: -------------------------------------------------------------------------------- 1 | \begin{titlepage} 2 | 3 | \begin{center} 4 | 5 | 6 | % Upper part of the page 7 | \includegraphics[width=1\textwidth]{dasm-logo.png}\\[6cm] 8 | %\textsc{\huge\bf A Small Systems {Cross-Assembler}}\\[5cm] 9 | \textsc{\huge \bf Technical Reference Manual}\\[0.25cm] 10 | \huge{\mono{2.20.16}}\\[7cm] 11 | 12 | %\textsc{\large Supporting the following Microprocessors\mono{\linebreak\linebreak{6502\linebreak %6507\linebreak 68705\linebreak 6803\linebreak% 13 | % HD6303\linebreak68HC11}}}\\[3cm] 14 | \textsc{\large \today} 15 | 16 | 17 | %\textsc{\Large Thesis}\\ 18 | %[0.5cm] 19 | 20 | %\HRule \\[0.4cm] 21 | %{ \huge \bfseries Your Thesis Title\\Goes Here}\\[0.4cm]\mono 22 | %\HRule \\[0.5cm] 23 | %\textsc{\Large Submission for the Award\\Doctor of Computer Science}\\[1cm] 24 | 25 | % Author and supervisor 26 | 27 | 28 | 29 | %\begin{minipage}{0.4\textwidth} 30 | % \begin{flushleft} \large 31 | % \emph{Manual Author:} Andrew %\textsc{Davie} 32 | 33 | %\end{flushleft} 34 | %\end{minipage} 35 | 36 | %\begin{minipage}{0.4\textwidth} 37 | %\begin{flushright} \large 38 | %\emph{Supervisors:} \\ 39 | %Prof.~Paulo \textsc{de Souza}\\ 40 | %Prof.~Neil \textsc{Bose}\\ 41 | %Dr.~Robert \textsc{Ollington} 42 | 43 | %\end{flushright} 44 | %\end{minipage} 45 | 46 | \vfill 47 | 48 | % Bottom of the page 49 | %{\large \today} 50 | 51 | \end{center} 52 | \end{titlepage} 53 | -------------------------------------------------------------------------------- /machines/68hc11/68hc11a1.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 68HC11 3 | 4 | FLASH_START .EQU $B600 5 | FLASH_SIZE .EQU 512 6 | BOOTROM_START .EQU $BF40 7 | DOWNLOAD_SIZE .EQU 256 8 | 9 | .INCLUDE "register.asm" -------------------------------------------------------------------------------- /machines/68hc11/68hc11e1.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 68HC11 3 | 4 | FLASH_START .EQU $B600 5 | FLASH_SIZE .EQU 512 6 | BOOTROM_START .EQU $BF00 7 | DOWNLOAD_SIZE .EQU 512 8 | 9 | 10 | #include "register.asm" 11 | -------------------------------------------------------------------------------- /machines/68hc11/68hc811e2.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 68HC11 3 | 4 | FLASH_START .EQU $F800 5 | FLASH_SIZE .EQU 2048 6 | BOOTROM_START .EQU $BF40 7 | DOWNLOAD_SIZE .EQU 256 8 | 9 | 10 | #include "register.asm" 11 | 12 | 13 | -------------------------------------------------------------------------------- /machines/68hc11/register.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | RAM_END .EQU (DOWNLOAD_SIZE-1) 4 | FLASH_END .EQU<-->(FLASH_START + FLASH_SIZE) 5 | 6 | 7 | ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~; 8 | ; Registernames ; 9 | ;__________________________________; 10 | ; 11 | ; with this architecture you can shift the IO register base-address by programming the config register 12 | ; within 64 cycles after reboot. 13 | ; if you don't, you loose some bytes of RAM since the IO registers and RAM share the zero page 14 | ; if you do, you consume some more bytes of FLASH_ROM since you will need extended addressing mode 15 | ; a good compromise is to shift base register address to 0x1000, load 0x1000 to X register and use 16 | ; X-indexed addressing mode. Using Y-indexed addressing for register-IO is no advantage at all, 17 | ; it has both more opcodes and longer execution time addressing mode for register IO 18 | ; 19 | .IFNCONST REGBASE 20 | REGBASE .EQU 0 21 | .ENDIF 22 | 23 | 24 | PA0 .EQU $01 25 | PA1 .EQU $02 26 | PA2 .EQU $04 27 | PA3 .EQU $08 28 | PA4 .EQU $10 29 | PA5 .EQU $20 30 | PA6 .EQU $40 31 | PA7 .EQU $80 32 | PA3_4 .EQU $18 33 | PA7_5 .EQU $a0 34 | 35 | 36 | CSSTRH .EQU REGBASE+$5c 37 | HPRIO .EQU REGBASE+$3c 38 | 39 | 40 | INIT .EQU $103d 41 | PORTA .EQU REGBASE+$00 42 | PORTB .EQU REGBASE+$04 43 | PORTC .EQU REGBASE+$03 44 | PORTD .EQU REGBASE+$08 45 | PORTE .EQU REGBASE+$0a 46 | DDRC .EQU REGBASE+$07 47 | DDRD .EQU REGBASE+$09 48 | CFORC .EQU REGBASE+$0b 49 | OC1M .EQU REGBASE+$0c 50 | OC1D .EQU REGBASE+$0d 51 | TCNT .EQU REGBASE+$0e 52 | 53 | TIC1 .EQU REGBASE+$10 54 | TIC2 .EQU REGBASE+$12 55 | TIC3 .EQU REGBASE+$14 56 | 57 | TOC1 .EQU REGBASE+$16 58 | TOC2 .EQU REGBASE+$18 59 | TOC3 .EQU REGBASE+$1a 60 | TOC4 .EQU REGBASE+$1c 61 | TOC5 .EQU REGBASE+$1e 62 | 63 | TCTL1 .EQU REGBASE+$20 64 | TCTL2 .EQU REGBASE+$21 65 | TFLG1 .EQU REGBASE+$23 66 | TMSK1 .EQU REGBASE+$22 67 | TMSK2 .EQU REGBASE+$24 68 | TFLG2 .EQU REGBASE+$25 69 | PACTL .EQU REGBASE+$26 70 | PACNT .EQU REGBASE+$27 71 | 72 | SPCR .EQU REGBASE+$28 73 | BAUD .EQU REGBASE+$2b 74 | SCCR1 .EQU REGBASE+$2c 75 | SCCR2 .EQU REGBASE+$2d 76 | SCSR .EQU REGBASE+$2e 77 | SCDR .EQU REGBASE+$2f 78 | 79 | 80 | ADCTL .EQU REGBASE+$30 81 | ADR1 .EQU ADCTL+1 82 | ADR2 .EQU ADCTL+2 83 | ADR3 .EQU ADCTL+3 84 | ADR4 .EQU ADCTL+4 85 | 86 | BPROT .EQU REGBASE+$35 87 | OPTION .EQU REGBASE+$39 88 | EEPCTL .EQU REGBASE+$3b 89 | CONFIG .EQU REGBASE+$3f 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /machines/68hc908/.mc68hc908jb8.mk: -------------------------------------------------------------------------------- 1 | # 2 | # include for Makefile 3 | # 4 | CPU_VARIANT = hc908jb8 5 | 6 | # true size 7 | NATIVE_RAM_START = 0x40 8 | NATIVE_RAM_SIZE = 256 9 | 10 | # with bootloader 11 | RAM_START = 0x48 12 | RAM_SIZE = 248 13 | 14 | STACK_LOC = 0x013F 15 | # NATIVE_RAM_SIZE + NATIVE_RAM_START -1 16 | 17 | FLASH_START = 0xDC00 18 | NATIVE_FLASH_SIZE = 8192 19 | FLASH_SIZE = 7808 20 | 21 | BOOT_LOADER_SIZE = 384 22 | 23 | MONI_START = 0xFC00 24 | # MONI_2_START = 0xFE10 25 | MONI_SIZE = 512 26 | # MONI_2_SIZE = 240 27 | 28 | MHZ = 3 29 | 30 | MEM_MODEL = --model-small --stack-auto --idata-loc 0x48 31 | 32 | -------------------------------------------------------------------------------- /machines/68hc908/.mc68hc908jk1.mk: -------------------------------------------------------------------------------- 1 | # 2 | # include for Makefile 3 | # 4 | RAM_START = 0x80 5 | RAM_SIZE = 128 6 | 7 | FLASH_START = 0xF600 8 | FLASH_SIZE = 1536 9 | 10 | MONI_START = 0xFC00 11 | MONI_SIZE = 1024 12 | 13 | STACKSIZE = 40 14 | 15 | MHZ = 2 16 | 17 | MEM_MODEL = --model-small -------------------------------------------------------------------------------- /machines/68hc908/.mc68hc908jk3.mk: -------------------------------------------------------------------------------- 1 | # 2 | # include for Makefile 3 | # 4 | CPU_VARIANT = hc908jk3 5 | 6 | # without hc08sprg bootloader 7 | NATIVE_RAM_START = 0x80 8 | NATIVE_RAM_SIZE = 128 9 | 10 | # with bootloader 11 | RAM_START = 0x88 12 | RAM_SIZE = 120 13 | 14 | STACK_LOC = 0xFF 15 | # STACKSIZE = 40 16 | 17 | FLASH_START = 0xEC00 18 | FLASH_SIZE = 4096 19 | 20 | MONI_START = 0xFC00 21 | MONI_SIZE = 1024 22 | 23 | # Monitor Mode 24 | # MHZ = 2 25 | # user mode 26 | MHZ = 1 27 | 28 | MEM_MODEL = --model-small -------------------------------------------------------------------------------- /machines/68hc908/.mc68hc908mr32.mk: -------------------------------------------------------------------------------- 1 | # 2 | # include for Makefile 3 | # 4 | CPU_VARIANT = hc908mr32 5 | 6 | # true size 7 | NATIVE_RAM_START = 0x60 8 | NATIVE_RAM_SIZE = 768 9 | 10 | # with bootloader 11 | RAM_START = 0x68 12 | RAM_SIZE = 760 13 | STACK_LOC = 0x035E 14 | 15 | # NATIVE_RAM_SIZE + NATIVE_RAM_START -1 16 | 17 | FLASH_START = 0x8000 18 | NATIVE_FLASH_SIZE = 32256 19 | FLASH_SIZE = 31744 20 | 21 | BOOT_LOADER_SIZE = 512 22 | 23 | MONI_START = 0xFE10 24 | MONI_SIZE = 240 25 | 26 | MHZ = 1 27 | # MHZ = 1.22875 # exact 28 | 29 | # MEM_MODEL = --stack-auto --stack-probe --int-long-rent --xram-loc 0x100 --xram-size 576 30 | MEM_MODEL = --model-large --stack-auto --idata-loc 0x68 31 | 32 | -------------------------------------------------------------------------------- /machines/68hc908/bits68hc908.asm: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BITS_68HC908JB8 3 | 4 | BITS_68HC908JB8 .EQU 1 5 | 6 | ; TODO: MOVE THIS OUT TO regXXXXX.asm, remove all definitions that aren't on the board 7 | 8 | PTA0 .EQU (1 << 0) 9 | PTA1 .EQU (1 << 1) 10 | PTA2 .EQU (1 << 2) 11 | PTA3 .EQU (1 << 3) 12 | PTA4 .EQU (1 << 4) 13 | PTA5 .EQU (1 << 5) 14 | PTA6 .EQU (1 << 6) 15 | PTA7 .EQU (1 << 7) 16 | 17 | PTB0 .EQU 1 18 | PTB1 .EQU 2 19 | PTB2 .EQU 4 20 | PTB3 .EQU 8 21 | PTB4 .EQU 16 22 | PTB5 .EQU 32 23 | PTB6 .EQU 64 24 | PTB7 .EQU 128 25 | 26 | PTC0 .EQU (1 << 0) 27 | PTC1 .EQU (1 << 1) 28 | PTC2 .EQU (1 << 2) 29 | PTC3 .EQU (1 << 3) 30 | PTC4 .EQU (1 << 4) 31 | PTC5 .EQU (1 << 5) 32 | PTC6 .EQU (1 << 6) 33 | PTC7 .EQU (1 << 7) 34 | 35 | 36 | PTD0 .EQU (1 << 0) 37 | PTD1 .EQU (1 << 1) 38 | PTD2 .EQU (1 << 2) 39 | PTD3 .EQU (1 << 3) 40 | PTD4 .EQU (1 << 4) 41 | PTD5 .EQU (1 << 5) 42 | PTD6 .EQU (1 << 6) 43 | PTD7 .EQU (1 << 7) 44 | 45 | 46 | 47 | ; CONFIG bits 48 | COPD .EQU (1 << 0) 49 | 50 | ; TSC bits 51 | TOF .EQU (1 << 7) 52 | TOIE .EQU (1 << 6) 53 | TSTOP .EQU (1 << 5) 54 | TRST .EQU (1 << 4) 55 | PRS2 .EQU (1 << 2) 56 | PRS1 .EQU (1 << 1) 57 | PRS0 .EQU (1 << 0) 58 | 59 | 60 | ; TSC0 bits 61 | CH0F .EQU (1 << 7) 62 | CH0IE .EQU (1 << 6) 63 | MS0B .EQU (1 << 5) 64 | MS0A .EQU (1 << 4) 65 | ELS0B .EQU (1 << 3) 66 | ELS0A .EQU (1 << 2) 67 | TOV0 .EQU (1 << 1) 68 | CH0MAX .EQU (1 << 0) 69 | 70 | ; TSC1 bits 71 | CH1F .EQU (1 << 7) 72 | CH1IE .EQU (1 << 6) 73 | ; MS1B .EQU (1 << 5) ;; does not exist 74 | MS1A .EQU (1 << 4) 75 | ELS1B .EQU (1 << 3) 76 | ELS1A .EQU (1 << 2) 77 | TOV1 .EQU (1 << 1) 78 | CH1MAX .EQU (1 << 0) 79 | 80 | ; INTSCR 81 | ACKI .EQU (1 << 2) 82 | IMASKI .EQU (1 << 1) 83 | MODEI .EQU (1 << 0) 84 | 85 | ; KBSCR 86 | ACKK .EQU (1 << 2) 87 | IMASKK .EQU (1 << 1) 88 | MODEK .EQU (1 << 0) 89 | 90 | ; 91 | ; Register Section Bits FLCR 92 | ; 93 | PGM .EQU $01 94 | ERASE .EQU $02 95 | MASS .EQU $04 96 | HVEN .EQU $08 97 | 98 | 99 | #endif 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /machines/68hc908/macros.asm: -------------------------------------------------------------------------------- 1 | 2 | ; 3 | ; MACRO declaration keywords _must_ be lowercase 4 | ; MACRO names _must_ be all lowercase 5 | ; MACROS may be nested 6 | 7 | 8 | .macro declare_vector 9 | .ORG {1} 10 | .word {2} 11 | .endm 12 | 13 | .macro declare_var ; {name},{size} 14 | {1} .EQU next_var 15 | next_var .set ({1}+{2}) 16 | .endm 17 | 18 | ;;;;; take care to code 19 | ;next_var .set RAM_START 20 | ;;;;; before using 'declare_var' for the first time 21 | 22 | .macro store_reg ; {reg_addr},{value} 23 | #if ({1} > 255) 24 | ldA {2} ;[2] 25 | stA {1} ;[3] 26 | #else 27 | mov {2},{1} 28 | #endif 29 | .endm 30 | 31 | .macro store_reg16 ; {reg_addr},{value} 32 | ldHX {2} ;[2] 33 | stHX {1} ;[3] 34 | .endm 35 | 36 | .macro set_bits ; {bitmask},{reg_addr} 37 | ldHX #{1} 38 | ldA ,X 39 | orA {2} 40 | stA ,X 41 | .endm 42 | 43 | .macro clear_bits ; {bitmask},{reg_addr} 44 | ldHX #{1} 45 | ldA ,x 46 | and #[[~{2}] & $FF] 47 | stA ,x 48 | .endm 49 | 50 | 51 | .macro shake_pin ; {pin}, {port} 52 | brset {1},{2},_off$ 53 | bset {1},{2} 54 | bra _after$ 55 | _off$: 56 | bclr {1},{2} 57 | _after$: 58 | .endm 59 | 60 | 61 | .macro busy_loop_delay ; {count} 62 | ldA {1} ; [2] 63 | _bLoop$: 64 | dbnzA _bLoop$ ; [3] 3*(arg-1) + 2 T 65 | .endm 66 | 67 | .macro and_bits ; {reg_addr},{bitmask} 68 | ldA.8 {1} 69 | and {2} 70 | stA.8 {1} 71 | .macro 72 | 73 | 74 | .macro or_bits ; {reg_addr},{bitmask} 75 | ldA.8 {1} 76 | orA {2} 77 | stA.8 {1} 78 | .endm 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /machines/68hc908/mc68hc908jb8.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/machines/68hc908/mc68hc908jb8.asm -------------------------------------------------------------------------------- /machines/68hc908/mc68hc908jk1.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 68908 3 | 4 | ; 5 | ; variant specific defines 6 | ; 7 | .IFNCONST RAM_START 8 | RAM_START .EQU $80 9 | .ENDIF 10 | .IFNCONST RAM_SIZE 11 | RAM_SIZE .EQU 128 12 | .ENDIF 13 | 14 | .IFNCONST FLASH_START 15 | FLASH_START .EQU $F600 16 | .ENDIF 17 | .IFNCONST FLASH_SIZE 18 | FLASH_SIZE .EQU 1536 19 | .ENDIF 20 | 21 | #include "reg68hc908jk1.asm" 22 | ; 23 | ; Register Section Bits FLCR 24 | ; 25 | PGM .EQU $01 26 | ERASE .EQU $02 27 | MASS .EQU $04 28 | HVEN .EQU $08 29 | 30 | ; 31 | ; Firmware Monitor ROM specific section 32 | ; 33 | ReadMonitor .EQU $FC00 34 | FlashRead .EQU $FC03 35 | FlashErase .EQU $FC06 36 | FlashProgram .EQU $FC09 37 | DelayUs .EQU $FC0C 38 | 39 | MoniRomDelayLoop .EQU $FD21 40 | ; cycles = (((A-3)*3 +10)*X) + 7 41 | ; longest wait time 25.1 s 42 | 43 | fwCtrlByte .EQU RAM_START + $08 44 | fwCpuSpeed .EQU RAM_START + $09 45 | fwLastAddr .EQU RAM_START + $0A 46 | fwDataBlock .EQU RAM_START + $0C 47 | 48 | 49 | .INCLUDE macros.asm 50 | 51 | 52 | .MACRO declare_delay 53 | Delay{1}: 54 | ldx #{2} ;[2] 55 | lda #{3} ;[2] 56 | jsr MoniRomDelayLoop ;[5] 57 | rts ;[4] 58 | .ENDM 59 | 60 | 61 | .MACRO fwFlashEraseProc 62 | store_reg fwCtrlByte,#$40 63 | store_reg fwCpuSpeed,#(4*F_CPU) 64 | ldhx #FLASH_START 65 | jsr FlashErase 66 | .ENDM 67 | 68 | 69 | -------------------------------------------------------------------------------- /machines/68hc908/mc68hc908jk3.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/machines/68hc908/mc68hc908jk3.asm -------------------------------------------------------------------------------- /machines/68hc908/mc68hc908mr32.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 68908 3 | 4 | ; 5 | ; variant specific defines 6 | ; 7 | 8 | #ifndef RAM_START 9 | RAM_START .EQU $60 10 | #endif 11 | 12 | #ifndef RAM_SIZE 13 | RAM_SIZE .EQU 768 14 | #endif 15 | 16 | #ifndef FLASH_START 17 | FLASH_START .EQU $8000 18 | #endif 19 | 20 | #ifndef FLASH_SIZE 21 | FLASH_SIZE .EQU 32256 22 | #endif 23 | 24 | #include "reg68hc908mr32.asm" 25 | 26 | #include "macros.asm" 27 | 28 | .macro switch_to_pll_clock 29 | clr PCTL 30 | bset 5,PCTL ; switch PLL on 31 | bset 7,PBWC ; automatic bandwidth 32 | PLL_lock_wait: 33 | brclr 6,PBWC,PLL_lock_wait 34 | bset 4,PCTL ; select PLL clock as system 35 | .endm 36 | 37 | ; ROM specific routines 38 | WriteSerial .EQU 0xFEC3 39 | 40 | 41 | .macro fw_delay 42 | ldX #{1} ;[2] 43 | ldA #{2} ;[2] 44 | jsr MoniRomDelayLoop ;[5] // TODO: find this in the monitor code 45 | .endm 46 | 47 | .macro declare_delay 48 | Delay{1}: 49 | fw_delay {2},{3} 50 | rts ;[4] 51 | .endm 52 | 53 | 54 | -------------------------------------------------------------------------------- /machines/68hc908/reg68hc908jb8.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef REGS_68HC908JB8 4 | 5 | REGS_68HC908JB8 .EQU 1 6 | 7 | PTA .EQU $00 8 | PTB .EQU $01 9 | PTC .EQU $02 10 | PTD .EQU $03 11 | 12 | DDRA .EQU $04 13 | DDRB .EQU $05 14 | DDRC .EQU $06 15 | DDRD .EQU $07 16 | 17 | 18 | PTE .EQU $0008 19 | DDRE .EQU $0009 20 | TSC .EQU $000a 21 | 22 | TCNT .EQU $000c 23 | TCNTH .EQU $000c 24 | TCNTL .EQU $000d 25 | TMODH .EQU $000e 26 | TMODL .EQU $000f 27 | 28 | TSC0 .EQU $0010 29 | TCH0H .EQU $0011 30 | TCH0L .EQU $0012 31 | TSC1 .EQU $0013 32 | TCH1H .EQU $0014 33 | TCH1L .EQU $0015 34 | 35 | KBSCR .EQU $0016 36 | KBIER .EQU $0017 37 | 38 | UIR2 .EQU $0018 39 | UCR2 .EQU $0019 40 | UCR3 .EQU $001a 41 | UCR4 .EQU $001b 42 | IOCR .EQU $001c 43 | POCR .EQU $001d 44 | ISCR .EQU $001e 45 | 46 | CONFIG .EQU $1F 47 | 48 | UE0D0 .EQU $0020 49 | UE0D1 .EQU $0021 50 | UE0D2 .EQU $0022 51 | UE0D3 .EQU $0023 52 | UE0D4 .EQU $0024 53 | UE0D5 .EQU $0025 54 | UE0D6 .EQU $0026 55 | UE0D7 .EQU $0027 56 | UE1D0 .EQU $0028 57 | UE1D1 .EQU $0029 58 | UE1D2 .EQU $002a 59 | UE1D3 .EQU $002b 60 | UE1D4 .EQU $002c 61 | UE1D5 .EQU $002d 62 | UE1D6 .EQU $002e 63 | UE1D7 .EQU $002f 64 | UE2D0 .EQU $0030 65 | UE2D1 .EQU $0031 66 | UE2D2 .EQU $0032 67 | UE2D3 .EQU $0033 68 | UE2D4 .EQU $0034 69 | UE2D5 .EQU $0035 70 | UE2D6 .EQU $0036 71 | UE2D7 .EQU $0037 72 | UADDR .EQU $0038 73 | UIR0 .EQU $0039 74 | UIR1 .EQU $003a 75 | UCR0 .EQU $003b 76 | UCR1 .EQU $003c 77 | USR0 .EQU $003d 78 | USR1 .EQU $003e 79 | 80 | 81 | BSR .EQU $FE00 82 | RSR .EQU $FE01 83 | BFCR .EQU $FE03 84 | INT1 .EQU $FE04 85 | FLCR .EQU $FE08 86 | FLBPR .EQU $FE09 87 | BRKH .EQU $FE0C 88 | BRKL .EQU $FE0D 89 | BRKSCR .EQU $FE0E 90 | 91 | COPCTL .EQU $FFFF 92 | 93 | 94 | _vect_KBIR .EQU $FFF0 95 | _vect_TIMOVF .EQU $FFF2 96 | _vect_TIM1 .EQU $FFF4 97 | _vect_TIM0 .EQU $FFF6 98 | _vect_IRQ .EQU $FFF8 99 | _vect_USB .EQU $FFFA 100 | _vect_SWI .EQU $FFFC 101 | _vect_RESET .EQU $FFFE 102 | 103 | #endif 104 | 105 | 106 | #include "bits68hc908.asm" 107 | -------------------------------------------------------------------------------- /machines/68hc908/reg68hc908jk3.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef REGS_68HC908JK1 4 | 5 | REGS_68HC908JK1 .EQU 1 6 | 7 | PTA .EQU $00 8 | PTB .EQU $01 9 | PTC .EQU $02 10 | PTD .EQU $03 11 | ; D4:D5 TIM channels 12 | ; D6:D7 25mA open-drain with pullup 13 | 14 | DDRA .EQU $04 15 | DDRB .EQU $05 16 | DDRC .EQU $06 17 | DDRD .EQU $07 18 | 19 | PDCR .EQU $0A 20 | PTAPUE .EQU $0D 21 | 22 | KBSCR .EQU $1A 23 | KBIER .EQU $1B 24 | 25 | INTSCR .EQU $1D 26 | CONFIG2 .EQU $1E 27 | CONFIG .EQU $1F 28 | 29 | TSC .EQU $20 30 | TCNT .EQU $21 31 | TCNTH .EQU $21 32 | TCNTL .EQU $22 33 | TMOD .EQU $23 34 | TMODH .EQU $23 35 | TMODL .EQU $24 36 | TSC0 .EQU $25 37 | TCH0 .EQU $26 38 | TCH0H .EQU $26 39 | TCH0L .EQU $27 40 | 41 | TSC1 .EQU $28 42 | TCH1 .EQU $29 43 | TCH1H .EQU $29 44 | TCH1L .EQU $2A 45 | 46 | ADSCR .EQU $3C 47 | ADR .EQU $3D 48 | ADICLK .EQU $3E 49 | 50 | BSR .EQU $FE00 51 | RSR .EQU $FE01 52 | 53 | BFCR .EQU $FE03 54 | INT1 .EQU $FE04 55 | INT2 .EQU $FE05 56 | INT3 .EQU $FE06 57 | 58 | FLCR .EQU $FE08 59 | FLBPR .EQU $FE09 60 | 61 | BRKH .EQU $FE0C 62 | BRKL .EQU $FE0D 63 | BRKSCR .EQU $FE0E 64 | 65 | COPCTL .EQU $FFFF 66 | 67 | 68 | _vect_ADC .EQU $FFDE 69 | _vect_KBIR .EQU $FFE0 70 | _vect_TIMOVF .EQU $FFF2 71 | _vect_TIM1 .EQU $FFF4 72 | _vect_TIM0 .EQU $FFF6 73 | _vect_IRQ .EQU $FFFA 74 | _vect_SWI .EQU $FFFC 75 | _vect_RESET .EQU $FFFE 76 | 77 | #endif 78 | 79 | #include "bits68hc908.asm" 80 | 81 | 82 | -------------------------------------------------------------------------------- /machines/68hc908/reg68hc908mr32.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef REGS_68HC908MR32 4 | 5 | REGS_68HC908MR32 .EQU 1 6 | 7 | PTA .EQU $00 8 | PTB .EQU $01 9 | PTC .EQU $02 10 | PTD .EQU $03 11 | 12 | DDRA .EQU $04 13 | DDRB .EQU $05 14 | DDRC .EQU $06 15 | DDRD .EQU $07 16 | 17 | PTE .EQU $08 18 | PTF .EQU $09 19 | 20 | DDRE .EQU $0C 21 | DDRF .EQU $0D 22 | 23 | TASC .EQU $0E 24 | TACNTH .EQU $0F 25 | TACNTL .EQU $10 26 | TAMODH .EQU $11 27 | TAMODL .EQU $12 28 | TASC0 .EQU $13 29 | TACH0H .EQU $14 30 | TACH0L .EQU $15 31 | TASC1 .EQU $16 32 | TACH1H .EQU $17 33 | TACH1L .EQU $18 34 | TASC2 .EQU $19 35 | TACH2H .EQU $1A 36 | TACH2L .EQU $1B 37 | TASC3 .EQU $1C 38 | TACH3H .EQU $1D 39 | TACH3L .EQU $1E 40 | 41 | CONFIG .EQU $1F 42 | 43 | PCTL1 .EQU $20 44 | PCTL2 .EQU $21 45 | FCR .EQU $22 46 | FSR .EQU $23 47 | FTACK .EQU $24 48 | PWMOUT .EQU $25 49 | 50 | PCNTH .EQU $26 51 | PCNTL .EQU $27 52 | PMODH .EQU $28 53 | PMODL .EQU $29 54 | PVAL1H .EQU $2A 55 | PVAL1L .EQU $2B 56 | PVAL2H .EQU $2C 57 | PVAL2L .EQU $2D 58 | PVAL3H .EQU $2E 59 | PVAL3L .EQU $2F 60 | PVAL4H .EQU $30 61 | PVAL4L .EQU $31 62 | PVAL5H .EQU $32 63 | PVAL5L .EQU $33 64 | PVAL6H .EQU $34 65 | PVAL6L .EQU $35 66 | DEADTM .EQU $36 67 | DISMAP .EQU $37 68 | 69 | SCC1 .EQU $38 70 | SCC2 .EQU $39 71 | SCC3 .EQU $3A 72 | SCS1 .EQU $3B 73 | SCS2 .EQU $3C 74 | SCDR .EQU $3D 75 | SCBR .EQU $3E 76 | 77 | ISCR .EQU $3F 78 | 79 | ADSCR .EQU $40 80 | ADRH .EQU $41 81 | ADRL .EQU $42 82 | ADCLK .EQU $43 83 | 84 | SPCR .EQU $44 85 | SPSCR .EQU $45 86 | SPDR .EQU $46 87 | 88 | TBSC .EQU $51 89 | TBCNTH .EQU $52 90 | TBCNTL .EQU $53 91 | TBMODH .EQU $54 92 | TBMODL .EQU $55 93 | TBSC0 .EQU $56 94 | TBCH0H .EQU $57 95 | TBCH0L .EQU $58 96 | TBSC1 .EQU $59 97 | TBCH1H .EQU $5A 98 | TBCH1L .EQU $5B 99 | 100 | PCTL .EQU $5C 101 | PBWC .EQU $5D 102 | PPG .EQU $5E 103 | 104 | 105 | SBSR .EQU $FE00 106 | SRSR .EQU $FE01 107 | SBFCR .EQU $FE03 108 | FLCR .EQU $FE08 ; this is not $FE07 as stated on page 26, datasheet Rev.6.1 109 | BRKH .EQU $FE0C 110 | BRKL .EQU $FE0D 111 | BRKSCR .EQU $FE0E 112 | LVISCR .EQU $FE0F 113 | FLBPR .EQU $FF7E 114 | COPCTL .EQU $FFFF 115 | 116 | 117 | _vect_SCItransmit .EQU $FFD2 118 | _vect_SCIreceive .EQU $FFD4 119 | _vect_SCIerror .EQU $FFD6 120 | _vect_SPItransmit .EQU $FFD8 121 | _vect_SPIreceive .EQU $FFDA 122 | _vect_ADC .EQU $FFDC 123 | _vect_TIMOVF .EQU $FFDE 124 | _vect_TIM1 .EQU $FFE0 125 | _vect_TIM0 .EQU $FFE2 126 | _vect_TimAOvf .EQU $FFE4 127 | _vect_TimACh3 .EQU $FFE6 128 | _vect_TimACh2 .EQU $FFE8 129 | _vect_TimACh1 .EQU $FFEA 130 | _vect_TimACh0 .EQU $FFEC 131 | _vect_PWMmc .EQU $FFEE 132 | _vect_Fault4 .EQU $FFF0 133 | _vect_Fault3 .EQU $FFF2 134 | _vect_Fault2 .EQU $FFF4 135 | _vect_Fault1 .EQU $FFF6 136 | _vect_PLL .EQU $FFF8 137 | _vect_IRQ .EQU $FFFA 138 | _vect_SWI .EQU $FFFC 139 | _vect_RESET .EQU $FFFE 140 | 141 | 142 | #include "bits68hc908.asm" 143 | 144 | 145 | #endif 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /machines/atari7800/macro.h: -------------------------------------------------------------------------------- 1 | ; MACRO.H 2 | 3 | ; Based on the 2600 macro.h file. 4 | ; Macros irrelevant to the 7800 have been removed, and the sleep macro 5 | ; has been adapted to give accurate results on the 7800. 6 | 7 | ; Version 1.0 2019/12/11 (based on the 2600 Version 1.05, 13/NOVEMBER/2003) 8 | 9 | ; Available macros... 10 | ; SLEEP n - sleep for n cycles 11 | ; SET_POINTER - load a 16-bit absolute to a 16-bit variable 12 | 13 | ;------------------------------------------------------------------------------- 14 | ; SLEEP duration 15 | ; Original author: Thomas Jentzsch 16 | ; Inserts code which takes the specified number of cycles to execute. This is 17 | ; useful for code where precise timing is required. 18 | ; ILLEGAL-OPCODE VERSION DOES NOT AFFECT FLAGS OR REGISTERS. 19 | ; LEGAL OPCODE VERSION MAY AFFECT FLAGS 20 | ; Uses illegal opcode (DASM 2.20.01 onwards). 21 | 22 | MAC SLEEP ;usage: SLEEP n (n>1) 23 | .CYCLES SET {1} 24 | 25 | IF .CYCLES < 2 26 | ECHO "MACRO ERROR: 'SLEEP': Duration must be > 1" 27 | ERR 28 | ENDIF 29 | 30 | IF .CYCLES & 1 31 | IFNCONST NO_ILLEGAL_OPCODES 32 | nop $80 33 | ELSE 34 | bit $80 35 | ENDIF 36 | .CYCLES SET .CYCLES - 3 37 | ENDIF 38 | 39 | REPEAT .CYCLES / 2 40 | nop 41 | REPEND 42 | ENDM 43 | 44 | ;------------------------------------------------------- 45 | ; SET_POINTER 46 | ; Original author: Manuel Rotschkar 47 | ; 48 | ; Sets a 2 byte RAM pointer to an absolute address. 49 | ; 50 | ; Usage: SET_POINTER pointer, address 51 | ; Example: SET_POINTER SpritePTR, SpriteData 52 | ; 53 | ; Note: Alters the accumulator, NZ flags 54 | ; IN 1: 2 byte RAM location reserved for pointer 55 | ; IN 2: absolute address 56 | 57 | MAC SET_POINTER 58 | .POINTER SET {1} 59 | .ADDRESS SET {2} 60 | 61 | LDA #<.ADDRESS ; Get Lowbyte of Address 62 | STA .POINTER ; Store in pointer 63 | LDA #>.ADDRESS ; Get Hibyte of Address 64 | STA .POINTER+1 ; Store in pointer+1 65 | 66 | ENDM 67 | 68 | ; EOF 69 | -------------------------------------------------------------------------------- /machines/channel-f/macro.h: -------------------------------------------------------------------------------- 1 | ; MACRO.H for Channel F 2 | ; Version 1.01, 2/NOVEMBER/2004 3 | 4 | VERSION_MACRO = 101 5 | 6 | ; 7 | ; THIS FILE IS EXPLICITLY SUPPORTED AS A DASM-PREFERRED COMPANION FILE 8 | ; PLEASE DO *NOT* REDISTRIBUTE MODIFIED VERSIONS OF THIS FILE! 9 | ; 10 | ; This file defines DASM macros useful for development for the Channel F. 11 | ; It is distributed as a companion machine-specific support package 12 | ; for the DASM compiler. Updates to this file, DASM, and associated tools are 13 | ; available at at http://www.atari2600.org/dasm 14 | ; 15 | ; Many thanks to the people who have contributed. If you take issue with the 16 | ; contents, or would like to add something, please write to me 17 | ; (atari2600@taswegian.com) with your contribution. 18 | ; 19 | ; Latest Revisions... 20 | ; 21 | ; 1.01 2/NOV/2004 Contribution from Kevin Lipe 22 | ; 1.00 31/OCT/2004 - initial version 23 | 24 | 25 | 26 | ;=================================================================== 27 | ; M A C R O S 28 | ;=================================================================== 29 | 30 | ;------------------------- 31 | ; CARTRIDGE_START 32 | ; Original Author: Sean Riddle 33 | ; Inserts the $55 that signals a valid Channel F cartridge and 34 | ; then inserts the NOP that takes up the next byte, which places 35 | ; the Channel F at the cartridge entry point, $802. 36 | 37 | MAC CARTRIDGE_START 38 | CartridgeStart: db $55 ; valid cart indicator 39 | NOP ; unused byte 40 | ENDM 41 | 42 | ;------------------------- 43 | ; PROMPTS_NO_T 44 | ; Original Author: Sean Riddle 45 | ; This code functions the same as the "prompts" section of the BIOS, 46 | ; but this code doesn't have a "T?" prompt, so it's useful in games that 47 | ; don't have time limits or settings. 48 | 49 | MAC PROMPTS_NOT 50 | prompts SUBROUTINE 51 | LR K,P ; 52 | PI pushk ; 53 | .prompts2: LI $85 ; red 5 (S) 54 | LR $0,A ; 55 | PI prompt ; 56 | LR A,$4 ; 57 | CI $08 ; is it button 4, Start? 58 | BF $4,.notbut4 ; no, check others 59 | .notbut2: 60 | PI popk ; yes, return 61 | PK ; 62 | 63 | .notbut4: CI $02 ; is it button 2, Mode? 64 | BF $4,.notbut2 ; 65 | LI $8e ; red M 66 | LR $0,A ; 67 | PI prompt ; 68 | LISU 3 ; 69 | LISL 6 ; 70 | LR A,(IS) ; 71 | as 4 ;add the mode to the game # 72 | LR (IS),A ; 73 | BF $0,.prompts2 ; 74 | ENDM 75 | 76 | 77 | 78 | ; EOF 79 | -------------------------------------------------------------------------------- /machines/channel-f/ves.h: -------------------------------------------------------------------------------- 1 | ; VES.H 2 | ; Fairchild Channel F Header 3 | ; Version 1.01, 2/NOVEMBER/2004 4 | 5 | VERSION_CHANNELF = 101 6 | VERSION_VES = 101 7 | 8 | ; THIS IS A PRELIMINARY RELEASE OF *THE* "STANDARD" VES.H 9 | ; THIS FILE IS EXPLICITLY SUPPORTED AS A DASM-PREFERRED COMPANION FILE 10 | ; PLEASE DO *NOT* REDISTRIBUTE THIS FILE! 11 | ; 12 | ; This file defines hardware registers and memory mapping for the 13 | ; Fairchild Channel-F. It is distributed as a companion machine-specific support package 14 | ; for the DASM compiler. Updates to this file, DASM, and associated tools are 15 | ; available at at http://www.atari2600.org/dasm 16 | ; 17 | ; Many thanks to the original author(s) of this file, and to everyone who has 18 | ; contributed to understanding the Channel-F. If you take issue with the 19 | ; contents, or naming of registers, please write to me (atari2600@taswegian.com) 20 | ; with your views. Please contribute, if you think you can improve this 21 | ; file! 22 | ; 23 | ; Latest Revisions... 24 | ; 1.01 2/NOV/2004 Kevin Lipe's version (combined macro/header) 25 | ; renamed to VES.H 26 | ; alternates provided for deprecated equates 27 | ; ALL hardware/BIOS equates now in uppercase and prefixed 28 | ; 1.00 31/OCT/2004 - initial release 29 | 30 | 31 | 32 | ; Please contribute Channel-F header code to atari2600@taswegian.com 33 | 34 | 35 | 36 | INCLUDE_DEPRECATED ; remove to DISABLE deprecated equates 37 | 38 | 39 | ;------------------------------------------------------------------------------- 40 | ; BIOS Calls 41 | ;------------------------ 42 | 43 | BIOS_CLEAR_SCREEN = $00d0 ; uses r31 44 | BIOS_DELAY = $008f 45 | BIOS_PUSH_K = $0107 ; used to allow more subroutine stack space 46 | BIOS_POP_K = $011e 47 | BIOS_DRAW_CHARACTER = $0679 48 | 49 | ;------------------------------------------------------------------------------- 50 | ; Colors 51 | 52 | COLOR_RED = $40 53 | COLOR_BLUE = $80 54 | COLOR_GREEN = $00 55 | COLOR_BACKGROUND = $C0 56 | 57 | ; Alternate (European) spellings... 58 | 59 | COLOUR_RES = COLOR_RED 60 | COLOUR_BLUE = COLOR_BLUE 61 | COLOUR_GREEN = COLOR_GREEN 62 | COLOUR_BACKGROUND = COLOR_BACKGROUND 63 | 64 | ;------------------------------------------------------------------------------- 65 | ; DEPRECATED equates. 66 | ; These present to be compatible with existing equate usage. 67 | ; DO NOT USE THESE IN NEW CODE -- WE WANT TO GET RID OF THEM! 68 | 69 | IFCONST INCLUDE_DEPRECATED 70 | 71 | clrscrn = BIOS_CLEAR_SCREEN ; DEPRECATED! 72 | delay = BIOS_DELAY ; DEPRECATED! 73 | pushk = BIOS_PUSH_K ; DEPRECATED! 74 | popk = BIOS_POP_K ; DEPRECATED! 75 | drawchar = BIOS_DRAW_CHARACTER ; DEPRECATED! 76 | 77 | red = COLOR_RED ; DEPRECATED! 78 | blue = COLOR_BLUE ; DEPRECATED 79 | green = COLOR_GREEN ; DEPRECATED 80 | bkg = COLOR_BACKGROUND ; DEPRECATED 81 | 82 | ENDIF 83 | 84 | ;------------------------------------------------------------------------------- 85 | ; The following required for back-compatibility with code which does not use 86 | ; segments. 87 | 88 | SEG 89 | 90 | ; EOF 91 | -------------------------------------------------------------------------------- /research/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-O0 -std=c99 -Wall -Wextra # try -O3 for fun... 2 | 3 | ALL = hash_compare compare_mod_and minunit_example get_set_progname sizeof bitsets loweror fsize #args 4 | 5 | all: $(ALL) 6 | 7 | clean: 8 | rm -rf *.o $(ALL) 9 | 10 | 11 | MNEMONICS := $(wildcard ../src/mne*.c) ../src/globals.c 12 | 13 | all_mnemonics.txt: $(MNEMONICS) 14 | cat $(MNEMONICS) | grep 'NULL,[ ]*v_' | cut -f3 -d, | sed 's/^[ ]*//g;s/"//g' | sort -u >all_mnemonics.txt 15 | -------------------------------------------------------------------------------- /research/README: -------------------------------------------------------------------------------- 1 | 2 | This is a directory to keep experiments in, stuff that was 3 | written to explore some aspect of DASM and improve on it. 4 | 5 | -------------------------------------------------------------------------------- /research/all_mnemonics.txt: -------------------------------------------------------------------------------- 1 | = 2 | aba 3 | abx 4 | aby 5 | adc 6 | adca 7 | adcb 8 | add 9 | adda 10 | addb 11 | addd 12 | ai 13 | aim 14 | align 15 | am 16 | amd 17 | anc 18 | and 19 | anda 20 | andb 21 | ane 22 | arr 23 | as 24 | asd 25 | asl 26 | asla 27 | aslb 28 | asld 29 | aslx 30 | asr 31 | asra 32 | asrb 33 | asrx 34 | bc 35 | bcc 36 | bclr 37 | bcs 38 | beq 39 | bf 40 | bge 41 | bgt 42 | bhcc 43 | bhcs 44 | bhi 45 | bhs 46 | bih 47 | bil 48 | bit 49 | bita 50 | bitb 51 | ble 52 | blo 53 | bls 54 | blt 55 | bm 56 | bmc 57 | bmi 58 | bms 59 | bnc 60 | bne 61 | bno 62 | bnz 63 | bp 64 | bpl 65 | br 66 | br7 67 | bra 68 | brclr 69 | brk 70 | brn 71 | brset 72 | bset 73 | bsr 74 | bt 75 | bvc 76 | bvs 77 | byte 78 | bz 79 | cba 80 | ci 81 | clc 82 | cld 83 | cli 84 | clr 85 | clra 86 | clrb 87 | clrx 88 | clv 89 | cm 90 | cmp 91 | cmpa 92 | cmpb 93 | com 94 | coma 95 | comb 96 | comx 97 | cpd 98 | cpx 99 | cpy 100 | daa 101 | db 102 | dc 103 | dci 104 | dcp 105 | dd 106 | dec 107 | deca 108 | decb 109 | decx 110 | des 111 | dex 112 | dey 113 | di 114 | ds 115 | dv 116 | dw 117 | echo 118 | ei 119 | eif 120 | eim 121 | else 122 | end 123 | endif 124 | endm 125 | eor 126 | eora 127 | eorb 128 | eqm 129 | equ 130 | err 131 | fdiv 132 | hex 133 | idiv 134 | if 135 | ifconst 136 | ifnconst 137 | in 138 | inc 139 | inca 140 | incb 141 | incbin 142 | incdir 143 | include 144 | incx 145 | ins 146 | inx 147 | iny 148 | isb 149 | jmp 150 | jsr 151 | las 152 | lax 153 | lda 154 | ldaa 155 | ldab 156 | ldd 157 | lds 158 | ldx 159 | ldy 160 | li 161 | lis 162 | lisl 163 | list 164 | lisu 165 | lm 166 | lnk 167 | long 168 | lr 169 | lsl 170 | lsla 171 | lslb 172 | lsld 173 | lslx 174 | lsr 175 | lsra 176 | lsrb 177 | lsrd 178 | lsrx 179 | lxa 180 | mac 181 | mexit 182 | mul 183 | neg 184 | nega 185 | negb 186 | negx 187 | ni 188 | nm 189 | nop 190 | ns 191 | oi 192 | oim 193 | om 194 | ora 195 | oraa 196 | orab 197 | org 198 | out 199 | outs 200 | pha 201 | php 202 | pi 203 | pk 204 | pla 205 | plp 206 | pop 207 | processor 208 | psha 209 | pshb 210 | pshx 211 | pshy 212 | pula 213 | pulb 214 | pulx 215 | puly 216 | rend 217 | repeat 218 | repend 219 | res 220 | rla 221 | rol 222 | rola 223 | rolb 224 | rolx 225 | ror 226 | rora 227 | rorb 228 | rorg 229 | rorx 230 | rra 231 | rsp 232 | rti 233 | rts 234 | sax 235 | sba 236 | sbc 237 | sbca 238 | sbcb 239 | sbx 240 | sec 241 | sed 242 | seg 243 | sei 244 | set 245 | sev 246 | sha 247 | shs 248 | shx 249 | shy 250 | sl 251 | slo 252 | slp 253 | sr 254 | sre 255 | st 256 | sta 257 | staa 258 | stab 259 | std 260 | stop 261 | sts 262 | stx 263 | sty 264 | sub 265 | suba 266 | subb 267 | subd 268 | subroutine 269 | swi 270 | tab 271 | tap 272 | tax 273 | tay 274 | tba 275 | test 276 | tim 277 | tpa 278 | trace 279 | tst 280 | tsta 281 | tstb 282 | tstx 283 | tsx 284 | tsy 285 | txa 286 | txs 287 | tya 288 | tys 289 | wai 290 | word 291 | xdc 292 | xgdx 293 | xgdy 294 | xi 295 | xm 296 | xs 297 | -------------------------------------------------------------------------------- /research/bitsets.c: -------------------------------------------------------------------------------- 1 | /* 2 | Experiments with bit sets. 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | /* 9 | Defining bit sets. 10 | 11 | Short of writing out own bit set abstraction, it seems 12 | obvious that we should use enum to generate the values. 13 | Also, splint can do a little checking if there's a new 14 | type involved. 15 | 16 | Some naming convention for bits and masks is necessary 17 | and below we append _B to bits and _M to masks. A mask 18 | can only be generated if a bit of that name has already 19 | been defined, another neat little check. 20 | */ 21 | 22 | #define BS_NEW_BIT(x) x ## _B 23 | 24 | typedef enum 25 | { 26 | BS_NEW_BIT(OK), 27 | BS_NEW_BIT(IFFY), 28 | BS_NEW_BIT(SOSO), 29 | BS_NEW_BIT(WRONG) 30 | } elements; 31 | 32 | #define BS_NEW_MASK(x) x ## _M = 1 << x ## _B 33 | 34 | typedef enum 35 | { 36 | BS_NEW_MASK(OK), 37 | BS_NEW_MASK(IFFY), 38 | BS_NEW_MASK(SOSO), 39 | BS_NEW_MASK(WRONG) 40 | } masks; 41 | 42 | /* 43 | Operations on bitsets. 44 | 45 | This is much more unstable territory. We obviously need 46 | support for testing whether bits and groups of bits are 47 | set or not. In what form to express that is unclear for 48 | now. The operations drafted below are not as simple to 49 | understand as I would like them yet. :-/ 50 | */ 51 | 52 | #define BS_INCLUDE(set, mask) (set |= mask) 53 | #define BS_EXCLUDE(set, mask) (set &= ~mask) 54 | #define BS_INCLUDES_ONE(set, mask) ((set & mask) != 0) 55 | #define BS_INCLUDES_ALL(set, mask) ((set & mask) == mask) 56 | #define BS_EXCLUDES_ALL(set, mask) ((set & mask) == 0) 57 | /* this is probably not correct */ 58 | #define BS_EXCLUDES_ONE(set, mask) ((set & mask) == ~mask) 59 | 60 | int main(void) 61 | { 62 | /* An empty bit set. */ 63 | masks set = 0; 64 | 65 | /* Basic sanity checks. */ 66 | assert(sizeof(elements) == sizeof(int)); 67 | assert(sizeof(masks) == sizeof(int)); 68 | assert(sizeof(set) == sizeof(int)); 69 | 70 | assert(OK_B == 0); 71 | assert(IFFY_B == 1); 72 | assert(SOSO_B == 2); 73 | assert(WRONG_B == 3); 74 | 75 | assert(OK_M == 1); 76 | assert(IFFY_M == 2); 77 | assert(SOSO_M == 4); 78 | assert(WRONG_M == 8); 79 | 80 | /* Bit set operations on empty set. */ 81 | assert(!BS_INCLUDES_ALL(set, OK_M)); 82 | assert(!BS_INCLUDES_ALL(set, IFFY_M)); 83 | assert(!BS_INCLUDES_ALL(set, SOSO_M)); 84 | assert(!BS_INCLUDES_ALL(set, WRONG_M)); 85 | 86 | assert(!BS_INCLUDES_ONE(set, OK_M)); 87 | assert(!BS_INCLUDES_ONE(set, IFFY_M)); 88 | assert(!BS_INCLUDES_ONE(set, SOSO_M)); 89 | assert(!BS_INCLUDES_ONE(set, WRONG_M)); 90 | 91 | /* Bit set operations on singleton set. */ 92 | BS_INCLUDE(set, OK_M); 93 | 94 | assert(BS_INCLUDES_ALL(set, OK_M)); 95 | assert(!BS_INCLUDES_ALL(set, IFFY_M)); 96 | assert(!BS_INCLUDES_ALL(set, SOSO_M)); 97 | assert(!BS_INCLUDES_ALL(set, WRONG_M)); 98 | 99 | assert(BS_INCLUDES_ONE(set, OK_M)); 100 | assert(!BS_INCLUDES_ONE(set, IFFY_M)); 101 | assert(!BS_INCLUDES_ONE(set, SOSO_M)); 102 | assert(!BS_INCLUDES_ONE(set, WRONG_M)); 103 | 104 | /* Bit set operations on bigger set. */ 105 | BS_INCLUDE(set, WRONG_M); 106 | 107 | assert(BS_INCLUDES_ALL(set, OK_M)); 108 | assert(!BS_INCLUDES_ALL(set, IFFY_M)); 109 | assert(!BS_INCLUDES_ALL(set, SOSO_M)); 110 | assert(BS_INCLUDES_ALL(set, WRONG_M)); 111 | 112 | assert(BS_INCLUDES_ONE(set, OK_M)); 113 | assert(!BS_INCLUDES_ONE(set, IFFY_M)); 114 | assert(!BS_INCLUDES_ONE(set, SOSO_M)); 115 | assert(BS_INCLUDES_ONE(set, WRONG_M)); 116 | 117 | assert(BS_INCLUDES_ALL(set, (OK_M|WRONG_M))); 118 | assert(!BS_INCLUDES_ALL(set, (SOSO_M|WRONG_M))); 119 | assert(!BS_INCLUDES_ALL(set, (OK_M|SOSO_M|WRONG_M))); 120 | assert(!BS_INCLUDES_ALL(set, (SOSO_M|IFFY_M))); 121 | 122 | assert(BS_INCLUDES_ONE(set, (OK_M|WRONG_M))); 123 | assert(BS_INCLUDES_ONE(set, (SOSO_M|WRONG_M))); 124 | assert(BS_INCLUDES_ONE(set, (OK_M|SOSO_M|WRONG_M))); 125 | assert(!BS_INCLUDES_ONE(set, (SOSO_M|IFFY_M))); 126 | } 127 | -------------------------------------------------------------------------------- /research/compare_hashes.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # 4 | # Experiment to compare various basic hash functions. 5 | # 6 | # Peter H. Froehlich 7 | 8 | # I wrote this to play with hash functions since DASM's hash1 9 | # looked suspicious (and it was also duplicated in the code?). 10 | # It turns out that it's not that bad for hashing our opcodes, 11 | # but Dan Bernstein's hash does twice as well for no real cost 12 | # increase, so I'll probably use Dan's instead of Matt's. 13 | # 14 | # Note that perfect hashing is tempting since we know the keys 15 | # in advance, they don't change dynamically (for opcodes!). So 16 | # I gave it some thought (i.e. wasted some brain cycles) before 17 | # realizing that DASM likes to "mix and match" tables, i.e. it 18 | # produces bigger compound tables from smaller ones based on 19 | # what processor is selected. So if we want to preserve that 20 | # aspect of DASM's design, we can't have perfect hashing. :-/ 21 | # 22 | # Just as well, I have a feeling that binary search on "static" 23 | # arrays would do even better, improved locality of reference 24 | # and all that. But I want to keep the hashes, they are a big 25 | # thing in DASM. :-) 26 | 27 | import sys 28 | 29 | WORDS = [] 30 | 31 | # We use "raw" hash functions without a compression step; if we 32 | # want to evaluate for a given table size, we compress results 33 | # later. 34 | 35 | def hash_dillon(s): 36 | hash = 0 37 | for c in s: 38 | hash = (hash << 2) ^ ord(c) 39 | return hash 40 | 41 | def hash_djb1(s): 42 | hash = 5381 43 | for c in s: 44 | hash = ((hash << 5) + hash) + ord(c) # hash * 33 + c 45 | return hash 46 | 47 | def hash_djb2(s): 48 | hash = 5381 49 | for c in s: 50 | hash = ((hash << 5) + hash) ^ ord(c) 51 | return hash 52 | 53 | def hash_sdbm(s): 54 | hash = 0 55 | for c in s: 56 | hash = ord(c) + (hash << 6) + (hash << 16) - hash 57 | return hash 58 | 59 | def hash_silly(s): 60 | hash = 0 61 | for c in s: 62 | hash = hash + ord(c) 63 | return hash 64 | 65 | def hash_silly2(s): 66 | hash = 0 67 | i = 1 68 | for c in s: 69 | hash = hash + i*ord(c) 70 | i += 1 71 | return hash 72 | 73 | def hash_silly3(s): 74 | hash = 0 75 | i = 1 76 | for c in s: 77 | # these work pretty well for some reason (for opcodes anyway) 78 | #hash = hash + i**1*ord(c)**3 79 | hash = hash + i**2*ord(c)**3 80 | i += 1 81 | return hash 82 | 83 | def hash_knuth(s): 84 | hash = len(s) 85 | for c in s: 86 | hash = ((hash<<5)^(hash>>27))^ord(c) 87 | return hash 88 | 89 | # http://smallcode.weblogs.us/2008/01/22/hash-functions-an-empirical-comparison/ 90 | def hash_kankowski(s): 91 | hash = 0 92 | for c in s: 93 | hash = 17 * hash + (ord(c) - ord(' ')); 94 | return hash ^ (hash >> 16); 95 | 96 | def eval_hash(hash_func): 97 | d = {} 98 | for w in WORDS: 99 | h = hash_func(w) 100 | d[h] = d.get(h, 0) + 1 101 | return d 102 | 103 | # Note that DASM uses & for compression; % is the same for positive 104 | # numbers (*unsigned* anyway in DASM), but it could cost a few more 105 | # cycles. 106 | 107 | def compress_dict(d, size): 108 | c = {} 109 | for k in d: 110 | n = k % size 111 | c[n] = c.get(n, 0) + d[k] 112 | return c 113 | 114 | def print_eval(d,s): 115 | print "------%s-----" % (s) 116 | print "Unique hash values: %s" % (len(d)) 117 | print "Max collisions: %s" % (max(d.values())) 118 | print "Min collisions: %s" % (min(d.values())) 119 | print "Avg collisions: %s" % (sum(d.values())/float(len(d))) 120 | print "Med collisions: %s" % (sorted(d.values())[len(d)/2]) 121 | 122 | # read file into WORDS list, assumes one word per line 123 | f = open(sys.argv[1]) 124 | for l in f: 125 | l = l.strip() 126 | WORDS.append(l) 127 | f.close() 128 | 129 | FUNCS = [hash_dillon, hash_djb1, hash_djb2, hash_sdbm, 130 | hash_silly, hash_silly2, hash_silly3, 131 | hash_knuth, hash_kankowski] 132 | 133 | # TODO: generate some nice graphics with PyX? 134 | 135 | for f in FUNCS: 136 | print "========== %s ==========" % f.__name__ 137 | # just the hash code please 138 | d = eval_hash(f) 139 | print_eval(d,"raw") 140 | # Matt's 2.16 DASM uses 4096 for symbols, 1024 for mnemonics 141 | c = compress_dict(d, 4096) 142 | print_eval(c,"4096") 143 | # our DASM uses 1024 for both hash tables right now... 144 | c = compress_dict(d, 1024) 145 | print_eval(c,"1024") 146 | 147 | -------------------------------------------------------------------------------- /research/compare_mod_and.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple hack to compare performance of % and & on modern 3 | machines. Seems that & still wins on a wide variety of 4 | machines, so we'll stick with it for DASM's compression 5 | step in hashing. 6 | 7 | 1.5 GHz PowerPC G4: 8 | 9 | -O3, MAX 1<<31 10 | 11 | Takes 5 seconds to do 2147483648*4 modulos. 12 | ? Takes 5 seconds to do 2147483648*4 ands. 13 | ? Takes 3 seconds to do 2147483648*4 ands and minuses. 14 | 15 | -O0, MAX 1<<27 16 | 17 | Takes 11 seconds to do 134217728*4 modulos. 18 | Takes 3 seconds to do 134217728*4 ands. 19 | ? Takes 2 seconds to do 134217728*4 ands and minuses. 20 | 21 | ugradx i686: 22 | 23 | -O3, MAX 1<<31 24 | 25 | Takes 2 seconds to do 2147483648*4 modulos. 26 | Takes 1 seconds to do 2147483648*4 ands. 27 | Takes 1 seconds to do 2147483648*4 ands and minuses. 28 | 29 | -O0, MAX 1<<27 30 | 31 | Takes 8 seconds to do 134217728*4 modulos. 32 | Takes 1 seconds to do 134217728*4 ands. 33 | Takes 1 seconds to do 134217728*4 ands and minuses. 34 | */ 35 | 36 | #include 37 | #include 38 | 39 | #define MAX 1<<27 40 | 41 | double time_mod(void) 42 | { 43 | unsigned a, b, c, i, d = 13; 44 | time_t before, after; 45 | 46 | before = time(NULL); 47 | 48 | for (i = 0; i < MAX; i++) { 49 | a = i % d; 50 | b = i % d; 51 | c = i % d; 52 | a = i % d; 53 | } 54 | 55 | after = time(NULL); 56 | return difftime(after, before); 57 | } 58 | 59 | double time_and(void) 60 | { 61 | unsigned a, b, c, i, d = 13; 62 | time_t before, after; 63 | 64 | before = time(NULL); 65 | 66 | for (i = 0; i < MAX; i++) { 67 | a = i & d; 68 | b = i & d; 69 | c = i & d; 70 | a = i & d; 71 | } 72 | 73 | after = time(NULL); 74 | return difftime(after, before); 75 | } 76 | 77 | double time_and_minus(void) 78 | { 79 | unsigned a, b, c, i, d = 13; 80 | time_t before, after; 81 | 82 | before = time(NULL); 83 | 84 | for (i = 0; i < MAX; i++) { 85 | a = i & (d-1); 86 | b = i & (d-1); 87 | c = i & (d-1); 88 | a = i & (d-1); 89 | } 90 | 91 | after = time(NULL); 92 | return difftime(after, before); 93 | } 94 | 95 | /* 96 | Added approximations of the actual hash functions that 97 | would be used. Seems that Dan's is a *tiny* bit slower 98 | (figures since there's an extra + in there) but in the 99 | actual program we have to weigh better distribution of 100 | hash values against that. Still to actually measure... 101 | */ 102 | 103 | double time_dillon(void) 104 | { 105 | unsigned a = 0, b, d = 13, *c = &d, i; 106 | time_t before, after; 107 | 108 | before = time(NULL); 109 | 110 | for (i = 0; i < MAX; i++) { 111 | a = (a << 2) + *c; /* ++ is missing :-/ */ 112 | a = (a << 2) + *c; 113 | a = (a << 2) + *c; 114 | a = (a << 2) + *c; 115 | } 116 | 117 | after = time(NULL); 118 | return difftime(after, before); 119 | } 120 | 121 | double time_bernstein(void) 122 | { 123 | unsigned a = 0, b, d = 13, *c = &d, i; 124 | time_t before, after; 125 | 126 | before = time(NULL); 127 | 128 | for (i = 0; i < MAX; i++) { 129 | a = ((a << 5) + a) + *c; /* ++ is missing :-/ */ 130 | a = ((a << 5) + a) + *c; /* ++ is missing :-/ */ 131 | a = ((a << 5) + a) + *c; /* ++ is missing :-/ */ 132 | a = ((a << 5) + a) + *c; /* ++ is missing :-/ */ 133 | } 134 | 135 | after = time(NULL); 136 | return difftime(after, before); 137 | } 138 | 139 | int main(void) 140 | { 141 | printf("Takes %g seconds to do %u*4 modulos.\n", 142 | time_mod(), MAX); 143 | printf("Takes %g seconds to do %u*4 ands.\n", 144 | time_and(), MAX); 145 | printf("Takes %g seconds to do %u*4 ands and minuses.\n", 146 | time_and_minus(), MAX); 147 | printf("Takes %g seconds to do %u*4 dillons.\n", 148 | time_dillon(), MAX); 149 | printf("Takes %g seconds to do %u*4 bernsteins.\n", 150 | time_bernstein(), MAX); 151 | } 152 | -------------------------------------------------------------------------------- /research/fsize.c: -------------------------------------------------------------------------------- 1 | /* 2 | The issue here was to avoid fseek() and friends to get away 3 | from potential issue with how long "long" really is. So we 4 | "abuse" freopen() in append mode to get to the end of the 5 | file once we establish it exists at all with fopen() in read 6 | mode. Pretty convoluted, but probably the best way. Comments 7 | welcome! :-) 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | int file_size(const char *name, fpos_t *size) 14 | { 15 | int status = -1; 16 | FILE *f = fopen(name, "r+"); 17 | if (f != NULL) { 18 | FILE *g = freopen(NULL, "a+", f); 19 | if (g != NULL) { 20 | if (fgetpos(g, size) == 0) { 21 | status = 0; 22 | } 23 | fclose(g); 24 | } 25 | } 26 | return status; 27 | } 28 | 29 | int main(int argc, char *argv[]) 30 | { 31 | printf("Filename %s\n", argv[1]); 32 | fpos_t size; 33 | if (file_size(argv[1], &size) == 0) { 34 | printf("Length of file %s is %ld!\n", argv[1], (long)size); 35 | return EXIT_SUCCESS; 36 | } 37 | else { 38 | printf("File %s not found!\n", argv[1]); 39 | return EXIT_FAILURE; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /research/get_set_progname.c: -------------------------------------------------------------------------------- 1 | /* 2 | Test potentially unportable get/setprogname(3) functions. 3 | 4 | WORKS: 5 | OS X 6 | BREAKS: 7 | Linux, Solaris 8 | TODO: 9 | Windows, NetBSD, ... 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | printf("argv[0] == %s\n", argv[0]); 18 | printf("before setprogname(): getprogname() == %s\n", getprogname()); 19 | setprogname(argv[0]); 20 | printf("after setprogname(): getprogname() == %s\n", getprogname()); 21 | return EXIT_SUCCESS; 22 | } 23 | -------------------------------------------------------------------------------- /research/hash_compare.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/research/hash_compare.c -------------------------------------------------------------------------------- /research/loweror.c: -------------------------------------------------------------------------------- 1 | /* 2 | the findext() function in main.c was full of the "| 0x20" stuff 3 | below; I used this to verify that the intention was to convert 4 | a character to lower case 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | int main(void) 11 | { 12 | for (int i = 0; i < 256; i++) { 13 | int raw = i; 14 | int low = i | 0x20; 15 | printf(" %c \t %c \n", isprint(raw) ? raw : 'X', isprint(low) ? low : 'Y'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /research/minunit.h: -------------------------------------------------------------------------------- 1 | /* see http://www.jera.com/techinfo/jtns/jtn002.html */ 2 | /* code modified to compile without warnings [phf] */ 3 | #define mu_assert(message, test) \ 4 | do { if (!(test)) return message; } while (0) 5 | #define mu_run_test(test) \ 6 | do { const char *message = test(); tests_run++; \ 7 | if (message) return message; } while (0) 8 | extern int tests_run; 9 | -------------------------------------------------------------------------------- /research/minunit_example.c: -------------------------------------------------------------------------------- 1 | /* see http://www.jera.com/techinfo/jtns/jtn002.html */ 2 | /* code modified to compile without warnings [phf] */ 3 | 4 | #include 5 | #include "minunit.h" 6 | 7 | int tests_run = 0; 8 | 9 | int foo = 7; 10 | int bar = 4; 11 | 12 | static const char * test_foo(void) { 13 | mu_assert("error, foo != 7", foo == 7); 14 | return 0; 15 | } 16 | 17 | static const char * test_bar(void) { 18 | mu_assert("error, bar != 5", bar == 5); 19 | return 0; 20 | } 21 | 22 | static const char * all_tests(void) { 23 | mu_run_test(test_foo); 24 | mu_run_test(test_bar); 25 | return 0; 26 | } 27 | 28 | int main(int argc, char **argv) { 29 | const char *result = all_tests(); 30 | if (result != 0) { 31 | printf("%s\n", result); 32 | } 33 | else { 34 | printf("ALL TESTS PASSED\n"); 35 | } 36 | printf("Tests run: %d\n", tests_run); 37 | 38 | return result != 0; 39 | } 40 | -------------------------------------------------------------------------------- /research/sizeof.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple sizeof experiment to judge appropriate types to replace 3 | the DASM chaos with. Looks like we can easily go for "int" all 4 | over the place these days. If we want to be compatible with 16 5 | bit machines like the Amiga, we may want to go for "long". The 6 | best choice might be to typedef "int32_t" to a usable name and 7 | stick with that, then we'd only rule out some 8 bit machines. 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #define S(type) printf("sizeof(" #type ") == %d\n", sizeof(type)) 16 | 17 | int main(void) 18 | { 19 | S(char); 20 | S(int8_t); 21 | S(short); 22 | S(int16_t); 23 | S(int); 24 | S(bool); 25 | S(long); 26 | S(int32_t); 27 | S(long long); 28 | S(int64_t); 29 | S(float); 30 | S(double); 31 | return EXIT_SUCCESS; 32 | } 33 | 34 | /* 35 | Darwin Agnes.local 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc PowerBook6,8 Darwin 36 | 37 | sizeof(char) == 1 38 | sizeof(int8_t) == 1 39 | sizeof(short) == 2 40 | sizeof(int16_t) == 2 41 | sizeof(int) == 4 42 | sizeof(bool) == 4 43 | sizeof(long) == 4 44 | sizeof(int32_t) == 4 45 | sizeof(long long) == 8 46 | sizeof(int64_t) == 8 47 | sizeof(float) == 4 48 | sizeof(double) == 8 49 | 50 | Linux ugradx.cs.jhu.edu 2.6.26.5-45.fc9.i686 #1 SMP Sat Sep 20 03:45:00 EDT 2008 i686 i686 i386 GNU/Linux 51 | 52 | sizeof(char) == 1 53 | sizeof(int8_t) == 1 54 | sizeof(short) == 2 55 | sizeof(int16_t) == 2 56 | sizeof(int) == 4 57 | sizeof(bool) == 1 58 | sizeof(long) == 4 59 | sizeof(int32_t) == 4 60 | sizeof(long long) == 8 61 | sizeof(int64_t) == 8 62 | sizeof(float) == 4 63 | sizeof(double) == 8 64 | 65 | SunOS peregrine 5.10 Generic_118822-11 sun4u sparc 66 | 67 | sizeof(char) == 1 68 | sizeof(int8_t) == 1 69 | sizeof(short) == 2 70 | sizeof(int16_t) == 2 71 | sizeof(int) == 4 72 | sizeof(bool) == 1 73 | sizeof(long) == 4 74 | sizeof(int32_t) == 4 75 | sizeof(long long) == 8 76 | sizeof(int64_t) == 8 77 | sizeof(float) == 4 78 | sizeof(double) == 8 79 | */ 80 | -------------------------------------------------------------------------------- /src/BUGS: -------------------------------------------------------------------------------- 1 | ==== 2 | BUGS 3 | ==== 4 | 5 | A collection of bugs that would require major DASM surgery 6 | and are unlikely to get a fix soon. If possible we offer 7 | workarounds. 8 | 9 | --------------------- 10 | Broken HD6303 Opcodes 11 | --------------------- 12 | 13 | It has been reported several times (by Alan Nash in 2008, 14 | by Rob Hookham in 2014) that the AIM, OIM, EIM, and TIM 15 | opcodes are broken. These instructions are *three* bytes 16 | long according to the data sheets, yet in DASM they are 17 | treated as *two* byte instructions. 18 | 19 | It's my understanding that the instructions are supposed 20 | to work as follows (from Rob's email): 21 | 22 | tim #$10,$C2 23 | tim #$80,$00,x 24 | 25 | So there's an immediate value *and* a zero-page address 26 | for these instructions! DASM, however, only accepts these: 27 | 28 | tim $10 29 | tim $10,x 30 | 31 | I don't know what Matthew Dillon was thinking back in the 32 | day, but in retrospect it seems obvious that these opcodes 33 | simply don't fit into the "regular pattern" of 8-bit CPUs 34 | we deal with in DASM. Fixing this will require changes to 35 | DASM beyond just fixing the instruction table, I don't 36 | think the parser code is even remotely ready for this. :-/ 37 | 38 | The "workaround" for now is to use macros instead of the 39 | actual instructions, see ../test/broken6303hack.asm for 40 | details. 41 | -------------------------------------------------------------------------------- /src/HEADER: -------------------------------------------------------------------------------- 1 | ==================== 2 | Standard file header 3 | ==================== 4 | 5 | /* 6 | the DASM macro assembler (aka small systems cross assembler) 7 | 8 | Copyright (c) 1988-2002 by Matthew Dillon. 9 | Copyright (c) 1995 by Olaf "Rhialto" Seibert. 10 | Copyright (c) 2003-2008 by Andrew Davie. 11 | Copyright (c) 2008-2015 by Peter H. Froehlich. 12 | 13 | This program is free software; you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation; either version 2 of the License, or 16 | (at your option) any later version. 17 | 18 | This program is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License along 24 | with this program; if not, write to the Free Software Foundation, Inc., 25 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 26 | */ 27 | 28 | We're sticking with Matt's 1988 claim, even though ftohex.c 29 | had a 1987 copyright originally, and Matt released version 30 | 2.0 in 1988, making a 1987 version 1.x likely. It's just not 31 | available anywhere, not even from Matt... :-/ We're also 32 | extending his copyright to 2002 compared to Andrew's release 33 | since we plan on integrating more of Matt's 2.16 stuff. 34 | 35 | Note that this header only lists the "main" maintainers and 36 | not all contributors. Those are listed in the AUTHORS file, 37 | and sometimes their contributions are in the NEWS file or 38 | other documentation. Note entirely sure that this is right, 39 | but the alternative is to have a *really* long list of 40 | copyright lines in every single file... :-/ 41 | 42 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # the DASM macro assembler (aka small systems cross assembler) 3 | # 4 | # Copyright (c) 1988-2002 by Matthew Dillon. 5 | # Copyright (c) 1995 by Olaf "Rhialto" Seibert. 6 | # Copyright (c) 2003-2008 by Andrew Davie. 7 | # Copyright (c) 2008 by Peter H. Froehlich. 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License along 20 | # with this program; if not, write to the Free Software Foundation, Inc., 21 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22 | 23 | # Executables will be generated in the trunk/src/ directory (the 24 | # "current directory" as far as this Makefile is concerned). If 25 | # you want to move them somewhere, trunk/bin/ say, do so in the 26 | # trunk/ Makefile! 27 | 28 | 29 | #GOPTI= -O -m32 # -O for more warnings; use -O0 for debugging, use -O3 for speed 30 | 31 | GWARN= -ansi -std=c99 -pedantic -Wall \ 32 | -Wstrict-prototypes -Wdeclaration-after-statement \ 33 | -Wold-style-definition -Wmissing-declarations -Wmissing-prototypes \ 34 | -Wshadow -Wwrite-strings -Wcast-qual -Wnested-externs \ 35 | -Wcast-align -Wpointer-arith -Wbad-function-cast \ 36 | -Wformat-y2k -Wformat-nonliteral -Wformat-security \ 37 | -Wfloat-equal -Wundef -Winline \ 38 | # -Wfour-char-constants # Apple OS X only option, not needed anyway? 39 | # -Wunused # definition is weird in man gcc, effect is weird too 40 | # -Wextra -Wno-unused-parameter # no-unused tames extra a little 41 | # -Wunreachable-code # seems to create 4 spurious warnings? 42 | # -Wconversion # too many right now 43 | # -Wtraditional # too many, not sure if it's worth it anyway 44 | 45 | #GDEBG= -g # -fprofile-arcs -ftest-coverage -pg # -D_FORTIFY_SOURCE=2 46 | 47 | #CFLAGS= $(GOPTI) $(GWARN) $(GDEBG) 48 | #LDFLAGS= -m32 -L/usr/lib32 49 | 50 | ifeq ($(OS),Windows_NT) 51 | detected_OS := Windows 52 | else 53 | detected_OS := $(shell uname -s) 54 | ifeq ($(detected_OS),Darwin) 55 | CFLAGS = -mmacosx-version-min=10.5 56 | endif 57 | endif 58 | 59 | #CC= gcc 60 | 61 | OBJS= main.o ops.o globals.o exp.o symbols.o \ 62 | mne6303.o mne6502.o mne65c02.o mne68705.o mne6811.o mnef8.o mne68908.o 63 | SRCS= main.c ops.c globals.c exp.c symbols.c \ 64 | mne6303.c mne6502.c mne65c02.c mne68705.c mne6811.c mnef8.c mne68908.c 65 | 66 | ALL= dasm ftohex 67 | 68 | all: $(info detected_OS is $(detected_OS)) \ 69 | $(ALL) 70 | 71 | dasm: $(OBJS) 72 | $(CC) $(CFLAGS) $(OBJS) -o dasm $(LDFLAGS) 73 | 74 | ftohex: ftohex.o 75 | 76 | obj: $(OBJS) 77 | 78 | $(OBJS): asm.h 79 | 80 | clean: 81 | rm -rf *.o $(ALL) \ 82 | dasm-alpha-*.tar.gz \ 83 | *.gcda *.gcno *.gcov gmon.out 84 | 85 | # prepare an alpha release containing just the source code, 86 | # nothing else is in the archive since it is not intended 87 | # for the public, just designated volunteers 88 | 89 | alpha: 90 | echo "This is an incomplete alpha release of DASM source code." >README.ALPHA 91 | echo "The purpose is to identify build problems, nothing more." >>README.ALPHA 92 | echo "Please do *not* re-distribute this release in any form!" >>README.ALPHA 93 | echo "Please do *not* distribute binaries derived from it either!" >>README.ALPHA 94 | tar zcvf dasm-alpha-`date +%F`.tar.gz README.ALPHA Makefile *.h *.c 95 | rm -rf README.ALPHA 96 | -------------------------------------------------------------------------------- /src/ftohex.c: -------------------------------------------------------------------------------- 1 | /* 2 | the DASM macro assembler (aka small systems cross assembler) 3 | 4 | Copyright (c) 1988-2002 by Matthew Dillon. 5 | Copyright (c) 1995 by Olaf "Rhialto" Seibert. 6 | Copyright (c) 2003-2008 by Andrew Davie. 7 | Copyright (c) 2008 by Peter H. Froehlich. 8 | 9 | This program is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 2 of the License, or 12 | (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License along 20 | with this program; if not, write to the Free Software Foundation, Inc., 21 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22 | */ 23 | 24 | /* 25 | * FTOHEX.C 26 | * 27 | * FTOHEX format infile [outfile] 28 | * 29 | * format: format used when assembling (asm705/asm65) 30 | * 1,2,3 -generate straight hex file 31 | * 32 | * Note that int and char are not used as Lattice C on IBM PCs uses 33 | * 16 bit ints and unsigned chars. 34 | */ 35 | 36 | #include 37 | #include 38 | 39 | #define PERLINE 16 40 | 41 | void exiterr(const char *str); 42 | void convert(int format, FILE *in, FILE *out); 43 | unsigned int getwlh(FILE *in); 44 | void puth(unsigned char c, FILE *out); 45 | 46 | int 47 | main(int ac, char **av) 48 | { 49 | int format; 50 | FILE *infile; 51 | FILE *outfile; 52 | 53 | if (ac < 3) { 54 | puts("FTOHEX format infile [outfile]"); 55 | puts("format 1 = DEFAULT, 2 = RAS, or 3 = RAW"); 56 | puts("Copyright (c) 1988-2008 by various authors (see file AUTHORS)."); 57 | exit(1); 58 | } 59 | format = atoi(av[1]); 60 | if (format < 1 || format > 3) 61 | exiterr("specify infile format 1, 2, or 3"); 62 | infile = fopen(av[2], "r"); 63 | if (infile == NULL) 64 | exiterr("unable to open input file"); 65 | outfile = (av[3]) ? fopen(av[3], "w") : stdout; 66 | if (outfile == NULL) 67 | exiterr("unable to open output file"); 68 | convert(format, infile, outfile); 69 | fclose(infile); 70 | fclose(outfile); 71 | 72 | return 0; 73 | } 74 | 75 | void 76 | exiterr(const char *str) 77 | { 78 | fputs(str, stderr); 79 | fputs("\n", stderr); 80 | exit(1); 81 | } 82 | 83 | /* 84 | * Formats: 85 | * 86 | * 1: origin (word:lsb,msb) + data 87 | * 2: origin (word:lsb,msb) + length (word:lsb,msb) + data (repeat) 88 | * 3: data 89 | * 90 | * Hex output: 91 | * 92 | * :lloooo00(ll bytes hex code)cc ll=# of bytes 93 | * oooo=origin 94 | * cc=invert of checksum all codes 95 | */ 96 | 97 | void 98 | convert(int format, FILE *in, FILE *out) 99 | { 100 | unsigned int org = 0; 101 | unsigned int idx; 102 | long len; 103 | unsigned char buf[256]; 104 | 105 | if (format < 3) 106 | org = getwlh(in); 107 | if (format == 2) { 108 | len = getwlh(in); 109 | } else { 110 | long begin = ftell(in); 111 | fseek(in, 0, SEEK_END); 112 | len = ftell(in) - begin; 113 | fseek(in, begin, 0); 114 | } 115 | for (;;) { 116 | while (len > 0) { 117 | register unsigned char chk; 118 | register unsigned int i; 119 | 120 | idx = (len > PERLINE) ? PERLINE : len; 121 | fread(buf, idx, 1, in); 122 | putc(':', out); 123 | puth(idx, out); 124 | puth(org >> 8, out); 125 | puth(org & 0xFF, out); 126 | putc('0', out); 127 | putc('0', out); 128 | chk = idx + (org >> 8) + (org & 0xFF); 129 | for (i = 0; i < idx; ++i) { 130 | chk += buf[i]; 131 | puth(buf[i], out); 132 | } 133 | puth((unsigned char)-chk, out); 134 | putc('\r', out); 135 | putc('\n', out); 136 | len -= idx; 137 | org += idx; 138 | } 139 | if (format == 2) { 140 | org = getwlh(in); 141 | if (feof(in)) 142 | break; 143 | len = getwlh(in); 144 | } else { 145 | break; 146 | } 147 | } 148 | fprintf(out, ":00000001FF\r\n"); 149 | } 150 | 151 | unsigned int getwlh(FILE *in) 152 | { 153 | unsigned int result; 154 | 155 | result = getc(in); 156 | result += getc(in) << 8; 157 | return result; 158 | } 159 | 160 | void 161 | puth(unsigned char c, FILE *out) 162 | { 163 | static char dig[] = { "0123456789ABCDEF" }; 164 | putc(dig[c>>4], out); 165 | putc(dig[c&15], out); 166 | } 167 | 168 | -------------------------------------------------------------------------------- /src/symbols.h: -------------------------------------------------------------------------------- 1 | #ifndef _DASM_SYMBOLS_H 2 | #define _DASM_SYMBOLS_H 3 | 4 | /* 5 | the DASM macro assembler (aka small systems cross assembler) 6 | 7 | Copyright (c) 1988-2002 by Matthew Dillon. 8 | Copyright (c) 1995 by Olaf "Rhialto" Seibert. 9 | Copyright (c) 2003-2008 by Andrew Davie. 10 | Copyright (c) 2008 by Peter H. Froehlich. 11 | 12 | This program is free software; you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation; either version 2 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License along 23 | with this program; if not, write to the Free Software Foundation, Inc., 24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 25 | */ 26 | 27 | /** 28 | * @file 29 | * 30 | * @brief Dealing with symbols. 31 | */ 32 | 33 | #include "asm.h" 34 | 35 | #include 36 | 37 | void programlabel(); 38 | void ShowSymbols(FILE *file); 39 | size_t ShowUnresolvedSymbols(void); 40 | void DumpSymbolTable(void); 41 | 42 | /** 43 | * @brief Remove the SYM_REF flag from all symbols in the 44 | * hash table. 45 | */ 46 | void clear_all_symbol_refs(void); 47 | 48 | /** 49 | * @brief Set the special symbol for ".." used as part of 50 | * a DV pseudo-op. 51 | * @note Only the value and flags fields of the symbol are 52 | * set. 53 | */ 54 | void set_special_dv_symbol(int value, dasm_flag_t flags); 55 | 56 | /** 57 | * @brief Create symbol with given name and add it to the hash table. 58 | * @warning Truncates names to MAX_SYM_LEN! 59 | * @note Generates custom names for local symbols (those starting 60 | * with '.' or ending with '$'). Uses alloc_symbol() internally. 61 | * Uses small_alloc() internally for the name of the symbol. The 62 | * created symbol is SYM_UNKNOWN. 63 | * @pre str != NULL && len > 0 64 | */ 65 | SYMBOL *create_symbol(const char *str, size_t len, bool addToOrder); 66 | 67 | /** 68 | * @brief Find symbol with given name in hash table. 69 | * @warning Truncates names to MAX_SYM_LEN! 70 | * @note Handles special names such as '.' for current PC, 71 | * ".." for the special argument to EQM as part of DV (see 72 | * set_special_dv_symbol()), and "..." for the current checksum; also 73 | * handles local names (those starting with '.' or ending 74 | * with '$'). 75 | * @pre str != NULL && len > 0 76 | */ 77 | SYMBOL *find_symbol(const char *str, size_t len); 78 | 79 | /** 80 | * @brief Allocate a fresh symbol. 81 | * @note Uses small_alloc() internally and manages a custom 82 | * free list of symbols to reuse memory. 83 | */ 84 | SYMBOL *alloc_symbol(void); 85 | 86 | /** 87 | * @brief Free zero or more symbols. 88 | * @note Manages a custom free list of symbols to reuse memory. 89 | */ 90 | void free_symbol_list(SYMBOL *sym); 91 | 92 | /** 93 | * @brief A symbol file of the given name will be produced. 94 | * @warning Can only be called once! 95 | * @pre name != NULL 96 | */ 97 | void set_symbol_file_name(const char *name); 98 | 99 | /** 100 | * @brief Sort mode for symbol table for -T option. 101 | */ 102 | typedef enum 103 | { 104 | /* actual sort modes */ 105 | SORTMODE_ALPHA, 106 | SORTMODE_ADDRESS, 107 | SORTMODE_ORDER, 108 | 109 | /* meta data */ 110 | SORTMODE_MIN = SORTMODE_ALPHA, 111 | SORTMODE_DEFAULT = SORTMODE_ALPHA, 112 | SORTMODE_MAX = SORTMODE_ADDRESS 113 | } 114 | sortmode_t; 115 | 116 | /** 117 | * @brief Valid sort mode for -T option? 118 | */ 119 | bool valid_sort_mode(int mode); 120 | 121 | /** 122 | * @brief Set sort mode, -T option. 123 | */ 124 | void set_sort_mode(sortmode_t mode); 125 | 126 | /** 127 | * @brief Print statistics about symbol hash table. 128 | * @warning For debugging only. 129 | */ 130 | void debug_symbol_hash_collisions(void); 131 | 132 | #endif /* _DASM_SYMBOLS_H */ 133 | 134 | /* vim: set tabstop=4 softtabstop=4 expandtab shiftwidth=4 autoindent: */ 135 | -------------------------------------------------------------------------------- /src/test_errors.c: -------------------------------------------------------------------------------- 1 | /* 2 | the DASM macro assembler (aka small systems cross assembler) 3 | 4 | Copyright (c) 1988-2002 by Matthew Dillon. 5 | Copyright (c) 1995 by Olaf "Rhialto" Seibert. 6 | Copyright (c) 2003-2008 by Andrew Davie. 7 | Copyright (c) 2008 by Peter H. Froehlich. 8 | 9 | This program is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 2 of the License, or 12 | (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License along 20 | with this program; if not, write to the Free Software Foundation, Inc., 21 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22 | */ 23 | 24 | /** 25 | * @file 26 | * @brief Unit tests for errors module. 27 | * @todo how do we keep panic* from aborting while unit test 28 | * runs? or maybe it doesn't matter if we switch to Check? 29 | */ 30 | 31 | #include "errors.h" 32 | 33 | #include "asm.h" 34 | #include "util.h" 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | /* fakes for unit test */ 41 | FILE *FI_listfile = NULL; 42 | char *F_listfile = NULL; 43 | INCFILE *pIncfile = NULL; 44 | 45 | int main(int argc, char *argv[]) 46 | { 47 | assert(argc == 1); 48 | setprogname(argv[0]); 49 | /* fake a current file */ 50 | pIncfile = malloc(sizeof(INCFILE)); 51 | pIncfile->next = NULL; 52 | pIncfile->name = checked_strdup("someFileName"); 53 | pIncfile->lineno = 47; 54 | /* enable all messages */ 55 | set_error_level(ERRORLEVEL_DEBUG); 56 | /* test SUPER new API :-) */ 57 | debug_fmt(WARNING_RANGE, "CRAZY", "DEBUG", 2, 14); 58 | info_fmt(WARNING_RANGE, "CRAZY", "DEBUG", 2, 14); 59 | notice_fmt(WARNING_RANGE, "CRAZY", "DEBUG", 2, 14); 60 | warning_fmt(WARNING_RANGE, "CRAZY", "DEBUG", 2, 14); 61 | error_fmt(WARNING_RANGE, "CRAZY", "DEBUG", 2, 14); 62 | fatal_fmt(WARNING_RANGE, "CRAZY", "FATAL", 2, 14); 63 | panic_fmt(WARNING_RANGE, "CRAZY", "DEBUG", 2, 14); 64 | return EXIT_SUCCESS; 65 | } 66 | 67 | /* vim: set tabstop=4 softtabstop=4 expandtab shiftwidth=4 autoindent: */ 68 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | the DASM macro assembler (aka small systems cross assembler) 3 | 4 | Copyright (c) 1988-2002 by Matthew Dillon. 5 | Copyright (c) 1995 by Olaf "Rhialto" Seibert. 6 | Copyright (c) 2003-2008 by Andrew Davie. 7 | Copyright (c) 2008 by Peter H. Froehlich. 8 | 9 | This program is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 2 of the License, or 12 | (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License along 20 | with this program; if not, write to the Free Software Foundation, Inc., 21 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22 | */ 23 | 24 | #ifndef _DASM_VERSION_H 25 | #define _DASM_VERSION_H 26 | 27 | /** 28 | * @file 29 | */ 30 | 31 | /** 32 | * @brief Macro to provide current DASM release as a string. 33 | */ 34 | #define DASM_RELEASE "2.20.15-SNAPSHOT" 35 | 36 | /** 37 | * @brief Macro to provide current DASM headline, including 38 | * release, as a string; printed first in usage messages. 39 | */ 40 | #define DASM_ID "DASM " DASM_RELEASE 41 | 42 | /** 43 | * @brief Macro to print standard DASM copyright, in case we 44 | * go back to printing this part on every run again... 45 | * 46 | * @todo There are several pieces of code out there that have 47 | * 1987 as the first copyright year by Matthew Dillon; almost 48 | * all his later stuff starts at 1988, but ftohex.c is still 49 | * at 1987 even in his 2.16 release. We should settle this... 50 | */ 51 | #define DASM_PRINT_COPYRIGHT \ 52 | (void) puts("Copyright (c) 1988-2020 by the DASM team."); 53 | 54 | /** 55 | * @brief Macro to print standard DASM legalese, including 56 | * copyright, also for usage messages. 57 | */ 58 | #define DASM_PRINT_LEGAL \ 59 | DASM_PRINT_COPYRIGHT \ 60 | (void) puts("License GPLv2+: GNU GPL version 2 or later (see file LICENSE)."); \ 61 | (void) puts("DASM is free software: you are free to change and redistribute it."); \ 62 | (void) puts("There is ABSOLUTELY NO WARRANTY, to the extent permitted by law."); \ 63 | 64 | /** 65 | * @brief Macro to print bug report message, once again for 66 | * usage messages. 67 | */ 68 | #define DASM_PRINT_BUGS \ 69 | (void) puts("Report bugs on https://github.com/dasm-assembler/dasm please!"); 70 | 71 | #endif /* _DASM_VERSION_H */ 72 | 73 | /* vim: set tabstop=4 softtabstop=4 expandtab shiftwidth=4 autoindent: */ 74 | -------------------------------------------------------------------------------- /test/11include.inc: -------------------------------------------------------------------------------- 1 | ; 11include.inc - part of the symbolic include testing. 2 | ; To test non-symbol compliant include filenames, the name needs to begin with digits. 3 | ; Please don't rename it. 4 | ; 5 | ; --Mike Saarna 6 | 7 | .byte $11 8 | -------------------------------------------------------------------------------- /test/6502_16b.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 6502 2 | .TRACE on 3 | 4 | RAM_START .equ $80 5 | my_addr .equ (RAM_START + 192) 6 | 7 | .ORG 0 8 | 9 | and my_addr 10 | and.w my_addr 11 | and.b my_addr ; forced byte addressing and too large value should trigger 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/6502_16b.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/6502_16h.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 6502 2 | .TRACE on 3 | 4 | .ORG 0 5 | 6 | and.b >400 ; forced byte addressing and taking higher part should be OK 7 | and.w >400 8 | 9 | ldy.b >400,X 10 | ldy.w >400,X 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/6502_16h.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/6502_16h.bin.ref -------------------------------------------------------------------------------- /test/6502_16h.hex.ref: -------------------------------------------------------------------------------- 1 | :0A0000002D01002501B401BC010030 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/6502_16l.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 6502 2 | .TRACE on 3 | 4 | .ORG 0 5 | 6 | and.b <400 ; forced byte addressing and taking lower part should be OK 7 | and.w <400 8 | 9 | ldy.b <400,X 10 | ldy.w <400,X 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/6502_16l.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/6502_16l.bin.ref -------------------------------------------------------------------------------- /test/6502_16l.hex.ref: -------------------------------------------------------------------------------- 1 | :0A0000002D90002590B490BC9000F4 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/6502_16w.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 6502 2 | .TRACE on 3 | 4 | RAM_START .equ $80000 5 | my_addr .equ (RAM_START + 192) 6 | 7 | .ORG 0 8 | 9 | and my_addr 10 | and.w my_addr 11 | and.b my_addr ; any op should trigger since we have 64k space 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/6502_16w.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/6502_DCswap.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 6502 3 | 4 | .ORG 0 5 | 6 | DC.w $EE00 ; native is little endian 7 | 8 | DC.s $FF00 ; the opposite 9 | 10 | DC.w "Multibyte String" 11 | 12 | DC.s "Big Endian" 13 | -------------------------------------------------------------------------------- /test/6502_DCswap.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/6502_DCswap.bin.ref -------------------------------------------------------------------------------- /test/6502_DCswap.hex.ref: -------------------------------------------------------------------------------- 1 | :1000000000EEFF004D0075006C0074006900620096 2 | :1000100079007400650020005300740072006900CC 3 | :100020006E00670000420069006700200045006E16 4 | :08003000006400690061006E2C 5 | :00000001FF 6 | -------------------------------------------------------------------------------- /test/6502_X16b.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 6502 2 | .TRACE on 3 | 4 | RAM_START .equ $80 5 | addr_offs .equ (RAM_START + 192) 6 | 7 | .ORG 0 8 | 9 | rol.b addr_offs,X ; forced byte addressing and too large value should trigger 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/6502_X16b.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/6811_X16.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 68hc11 2 | .ORG 0 3 | 4 | addA 500,X ; word offset is not allowed with this mnemonic 5 | 6 | -------------------------------------------------------------------------------- /test/6811_X16.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/6811_Y16.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 68hc11 2 | .ORG 0 3 | 4 | anda 500,Y ; word offset is not allowed with this mnemonic 5 | 6 | -------------------------------------------------------------------------------- /test/6811_Y16.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/68908_DCswap.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 68908 2 | 3 | .ORG 0 4 | 5 | DC.w $EE00 ; native is big endian 6 | 7 | DC.s $FF00 ; the opposite 8 | 9 | DC.w "Multibyte String" 10 | 11 | DC.s "Little Endian" 12 | 13 | -------------------------------------------------------------------------------- /test/68908_DCswap.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/68908_DCswap.bin.ref -------------------------------------------------------------------------------- /test/68908_DCswap.hex.ref: -------------------------------------------------------------------------------- 1 | :10000000EE0000FF004D0075006C00740069006296 2 | :1000100000790074006500200053007400720069CC 3 | :10002000006E00674C006900740074006C0065008D 4 | :0E003000200045006E006400690061006E0053 5 | :00000001FF 6 | -------------------------------------------------------------------------------- /test/68908_SP16b.asm: -------------------------------------------------------------------------------- 1 | .processor 68hc908 2 | .org 0 3 | 4 | ldx.b 500,SP ; should trigger since the user requested byte mode but size is word 5 | 6 | -------------------------------------------------------------------------------- /test/68908_SP16b.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/68908_cbeq_SP16.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 68hc908 2 | .ORG 0 3 | backLoop: 4 | cbeq (500,SP),backLoop ; word offset is not allowed with this mnemonic 5 | 6 | -------------------------------------------------------------------------------- /test/68908_cbeq_SP16.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/68908_dbnz_SP16.asm: -------------------------------------------------------------------------------- 1 | .PROCESSOR 68hc908 2 | .ORG 0 3 | backLoop: 4 | dbnz 400,SP,backLoop ; word offset is not allowed with this mnemonic 5 | 6 | -------------------------------------------------------------------------------- /test/68908_dbnz_SP16.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | # demo.asm doesn't compile! 2 | # no useful reference output for suitef8.asm right now 3 | 4 | DASM=../bin/dasm 5 | FTOHEX=../bin/ftohex 6 | 7 | test: 8 | ./run_tests.sh -S 7 | tee test-report.txt 9 | 10 | %.bin: %.asm 11 | $(DASM) $< -o$@ -f1 -DINEEPROM 12 | 13 | %.hex: %.bin 14 | $(FTOHEX) 1 $< $@ 15 | 16 | clean: 17 | $(MAKE) -C atari2600 clean 18 | $(MAKE) -C atari7800 clean 19 | $(MAKE) -C cmdline_defs clean 20 | $(MAKE) -C selftest clean 21 | $(MAKE) -C channel-f clean 22 | rm -rf *.bin *.hex *.list.txt *.diff *.out 23 | -------------------------------------------------------------------------------- /test/addressexpression.asm: -------------------------------------------------------------------------------- 1 | ; addressexpression - adapted from the "jentzsch3" address expression bug test. 2 | ; Original test courtesy Thomas Jentzsch. Output result code generation 3 | ; added by Mike Saarna. 4 | 5 | processor 6502 6 | ORG $100 7 | 8 | TEST_1 = (.) 9 | TEST_2 = (*) 10 | TEST_3 = (1 - .) 11 | TEST_4 = (1 - *) 12 | TEST_5 = (1 - . - 1) 13 | TEST_6 = (1 - * - 1) 14 | TEST_7 = (1 - 1 - .) 15 | TEST_8 = (1 - 1 - *) 16 | TEST_9 = (1 + *) 17 | TEST_10 = (1 + * + 1) 18 | TEST_11 = (1 + 1 + *) 19 | 20 | if TEST_1 = 256 21 | .byte $01 22 | endif 23 | if TEST_2 = 256 24 | .byte $02 25 | endif 26 | if TEST_3 = -255 27 | .byte $03 28 | endif 29 | if TEST_4 = -255 30 | .byte $04 31 | endif 32 | if TEST_5 = -256 33 | .byte $05 34 | endif 35 | if TEST_6 = -256 36 | .byte $06 37 | endif 38 | if TEST_7 = -256 39 | .byte $07 40 | endif 41 | if TEST_8 = -256 42 | .byte $08 43 | endif 44 | if TEST_9 = 257 45 | .byte $09 46 | endif 47 | if TEST_10 = 258 48 | .byte $0A 49 | endif 50 | if TEST_11 = 258 51 | .byte $0B 52 | endif 53 | 54 | 55 | -------------------------------------------------------------------------------- /test/addressexpression.bin.ref: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /test/addressexpression.hex.ref: -------------------------------------------------------------------------------- 1 | :0B0100000102030405060708090A0BB2 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/align_mod_mac.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .PROCESSOR 6502 4 | 5 | .TRACE 1 6 | 7 | .ifnconst FLASH_START 8 | FLASH_START .EQU $F800 9 | .endif 10 | 11 | .ifnconst segmentModding 12 | segmentModding .EQU 1 13 | .endif 14 | 15 | ; 16 | ; the macro alignspace let you fill up memory until the next {block_size} boundary 17 | ; one must give a unique {name} 18 | ; 19 | .mac alignspace ; {name},{block_size} 20 | _alMod{1} .EQU ({2}-(. % {2})) 21 | _alSpace{1} .DS _alMod{1},$ac 22 | .endm 23 | 24 | ; 25 | ; the macro modspacer fills up memory with {char} until the next {block_size} 26 | ; one must give a unique {name} 27 | ; 28 | .mac modspacer ; {name},{block_size},{char} 29 | _mark{1}: 30 | _delta{1} .EQU (_mark{1} - FLASH_START) 31 | .IF (_delta{1} > 0) 32 | _modulo{1} .EQU ({2}-(_delta{1} % {2})) 33 | 34 | .IF ({3} > 0) 35 | _modpos{1} .EQU (32-(. % 32)) 36 | .IF (_modpos{1} < 16) 37 | .DS 32,{3} 38 | .ENDIF 39 | .ENDIF 40 | _spacer{1} .DS _modulo{1},{3} 41 | .ENDIF 42 | .ENDM 43 | 44 | ; 45 | ; the macro codesegmarker fills up memory 46 | ; the string {name} is padded with ' ' to length 16 and put at the beginning, the remaining is filled with 0xFF 47 | ; one must give a unique {ID} 48 | ; 49 | ; this is useful if you want to speed-up flash programming with a larger code base and the need to incorporate small changes 50 | ; because of the aligned segments a small code change may not introduce a complete shift of the following code and thus 51 | ; avoid to re-program the following pages 52 | ; 53 | ; if the symbol 'segmentModding' == 0 the segment starts at address (FLASH_START + block_size) 54 | ; if 'segmentModding' == 1 the segment starts at next 32 byte boundary address 55 | ; 56 | .mac codesegmarker ; {name},{uniqueID},{block_size} 57 | .IF (segmentModding > 0) 58 | modspacer {2}a,32,$ff 59 | .ELSE 60 | .ORG ({3} + FLASH_START) 61 | .ENDIF 62 | .DC {1} 63 | modspacer {2}b,16,32 64 | .ENDM 65 | 66 | 67 | .ORG FLASH_START 68 | 69 | alignspace Registers,$40 70 | 71 | codesegmarker "serialFunc",5,$2a0 72 | 73 | ; .INCLUDE<------>../common/serialFunc.asm 74 | nop 75 | 76 | codesegmarker "serialISR",6,$2e0 77 | 78 | ; .INCLUDE<------>../common/serialISR.asm 79 | nop 80 | nop 81 | 82 | codesegmarker "timerISR",7,$400 83 | 84 | nop 85 | ; .INCLUDE<------>../common/timerISR.asm 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | <- -------------------------------------------------------------------------------- /test/align_mod_mac.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/align_mod_mac.bin.ref -------------------------------------------------------------------------------- /test/align_mod_mac.hex.ref: -------------------------------------------------------------------------------- 1 | :10F80000ACACACACACACACACACACACACACACACAC38 2 | :10F81000ACACACACACACACACACACACACACACACAC28 3 | :10F82000ACACACACACACACACACACACACACACACAC18 4 | :10F83000ACACACACACACACACACACACACACACACAC08 5 | :10F84000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC8 6 | :10F85000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB8 7 | :10F8600073657269616C46756E63202020202020CC 8 | :10F87000EAFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAD 9 | :10F88000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF88 10 | :10F89000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF78 11 | :10F8A00073657269616C495352202020202020200A 12 | :10F8B000EAEAFFFFFFFFFFFFFFFFFFFFFFFFFFFF82 13 | :10F8C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF48 14 | :10F8D000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF38 15 | :10F8E00074696D6572495352202020202020202009 16 | :01F8F000EA2D 17 | :00000001FF 18 | -------------------------------------------------------------------------------- /test/atari2600/Makefile: -------------------------------------------------------------------------------- 1 | 2 | test: boing26.asm 3 | @../run_tests.sh -R ../../bin -F 3 -I ../../machines/atari2600/ 4 | 5 | boing26.bin: boing26.asm 6 | ../../bin/dasm boing26.asm -f3 -I../../machines/atari2600/ -oboing26.bin 7 | 8 | clean: 9 | rm -rf boing26.bin *.diff *.hex *.list.txt *.out 10 | -------------------------------------------------------------------------------- /test/atari2600/README: -------------------------------------------------------------------------------- 1 | 2 | Some DASM test cases for Atari 2600 software 3 | 4 | For all of these examples, I received express written permission 5 | from all authors to include the code in the DASM distribution. 6 | 7 | boing26.asm 8 | Rob Kudla's Amiga Boing! demo from http://www.qotile.net/minidig/ 9 | boing26.bin.ref 10 | Cartridge ROM by Rob Kudla from http://www.qotile.net/minidig/ 11 | -------------------------------------------------------------------------------- /test/atari2600/boing26.args: -------------------------------------------------------------------------------- 1 | ARGS="-f3 -I../machines/atari2600/" -------------------------------------------------------------------------------- /test/atari2600/boing26.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/atari2600/boing26.bin.ref -------------------------------------------------------------------------------- /test/atari7800/Makefile: -------------------------------------------------------------------------------- 1 | 2 | test: spritesample.asm 3 | @../run_tests.sh -R ../../bin -F 3 -I ../../machines/atari7800/ 4 | 5 | spritesample.bin: spritesample.asm 6 | ../../bin/dasm spritesample.asm -f3 -I../../machines/atari7800/ -ospritesample.bin 7 | 8 | clean: 9 | rm -rf spritesample.bin *.diff *.hex *.list.txt *.out 10 | -------------------------------------------------------------------------------- /test/atari7800/README: -------------------------------------------------------------------------------- 1 | 2 | Some DASM test cases for Atari 7800 software 3 | 4 | For all of these examples, I received express written permission 5 | from all authors to include the code in the DASM distribution. 6 | 7 | spritesample.asm 8 | Dan Boris' simple sprite sample 9 | -------------------------------------------------------------------------------- /test/atari7800/spritesample.args: -------------------------------------------------------------------------------- 1 | ARGS="-f3 -I../machines/atari7800/" -------------------------------------------------------------------------------- /test/atari7800/spritesample.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/atari7800/spritesample.bin.ref -------------------------------------------------------------------------------- /test/badopcode1.asm: -------------------------------------------------------------------------------- 1 | ; Thomas Jentzsch test case for bug 2 | ; in error handling. 3 | 4 | processor 6502 5 | 6 | ORG $f800 7 | ldz #$00 ; illegal mnemonic 8 | 9 | -------------------------------------------------------------------------------- /test/badopcode1.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/badopcode2.asm: -------------------------------------------------------------------------------- 1 | ; Test case for bug in error handling. 2 | 3 | processor 6502 4 | 5 | ORG $f800 6 | jsr ($1000) 7 | 8 | -------------------------------------------------------------------------------- /test/badopcode2.fail: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/broken6303hack.asm: -------------------------------------------------------------------------------- 1 | ; See ../src/BUGS for the details. Here's how to use macros 2 | ; to work around the issue. 3 | 4 | .processor HD6303 5 | 6 | .mac hack 7 | dc.b {1} ; opcode 8 | dc.b {2} ; immediate value 9 | dc.b {3} ; zero-page address 10 | .endm 11 | 12 | .mac aimd 13 | hack $71,{1},{2} 14 | .endm 15 | 16 | .mac aimx 17 | hack $61,{1},{2} 18 | .endm 19 | 20 | .mac oimd 21 | hack $72,{1},{2} 22 | .endm 23 | 24 | .mac oimx 25 | hack $62,{1},{2} 26 | .endm 27 | 28 | .mac eimd 29 | hack $75,{1},{2} 30 | .endm 31 | 32 | .mac eimx 33 | hack $65,{1},{2} 34 | .endm 35 | 36 | .mac timd 37 | hack $7b,{1},{2} 38 | .endm 39 | 40 | .mac timx 41 | hack $6b,{1},{2} 42 | .endm 43 | 44 | .org $0 45 | 46 | ; the broken DASM versions 47 | 48 | aim $10 ; assembles to 71 10 49 | aim $10,x ; assembles to 61 10 50 | oim $10 ; assembles to 72 10 51 | oim $10,x ; assembles to 62 10 52 | eim $10 ; assembles to 75 10 53 | eim $10,x ; assembles to 65 10 54 | tim $10 ; assembles to 7B 10 55 | tim $10,x ; assembles to 6B 10 56 | 57 | ; the fixed macro versions 58 | 59 | aimd $10,$20 ; should be "aim #$10,$20" 60 | aimx $10,$20 ; should be "aim #$10,$20,x" 61 | oimd $10,$20 ; should be "oim #$10,$20" 62 | oimx $10,$20 ; should be "oim #$10,$20,x" 63 | eimd $10,$20 ; should be "eim #$10,$20" 64 | eimx $10,$20 ; should be "eim #$10,$20,x" 65 | timd $10,$20 ; should be "tim #$10,$20" 66 | timx $10,$20 ; should be "tim #$10,$20,x" 67 | 68 | .end 69 | -------------------------------------------------------------------------------- /test/broken6303hack.bin.ref: -------------------------------------------------------------------------------- 1 | qarbue{kq a r b u e { k -------------------------------------------------------------------------------- /test/broken6303hack.hex.ref: -------------------------------------------------------------------------------- 1 | :100000007110611072106210751065107B106B100A 2 | :100010007110206110207210206210207510206570 3 | :0800200010207B10206B102062 4 | :00000001FF 5 | -------------------------------------------------------------------------------- /test/channel-f/Makefile: -------------------------------------------------------------------------------- 1 | 2 | test: lights.asm tetris.asm 3 | @../run_tests.sh -R ../../bin -F 3 -I ../../machines/channel-f/ 4 | 5 | lights.bin: lights.asm 6 | ../../bin/dasm lights.asm -f3 -I../../machines/channel-f/ -olights.bin 7 | tetris.bin: tetris.asm 8 | ../../bin/dasm tetris.asm -f3 -I../../machines/channel-f/ -otetris.bin 9 | 10 | clean: 11 | rm -rf lights.bin tetris.bin *.diff *.hex *.list.txt *.out 12 | -------------------------------------------------------------------------------- /test/channel-f/README: -------------------------------------------------------------------------------- 1 | 2 | Some DASM test cases for Channel-F software 3 | 4 | For all of these examples, I received express written permission 5 | from all authors to include the code in the DASM distribution. 6 | 7 | lights.asm 8 | Sean Riddle's Lights Out game from http://members.cox.net/seanriddle/ 9 | Ported to DASM (well, actually DASM2 :-) by Thomas Mathys 10 | lights.bin.ref 11 | Cartridge ROM by Sean Riddle from http://members.cox.net/seanriddle/ 12 | Generated with f8tool, another assembler for the F8 13 | tetris.asm 14 | Peter Trauner's Tetris game from http://members.cox.net/seanandalicia/ 15 | Ported to DASM (well, two lines were added :-) by Peter Froehlich 16 | tetris.bin.ref 17 | Cartridge ROM by Peter Trauner from http://members.cox.net/seanandalicia/ 18 | Generated with f8tool, another assembler for the F8 19 | -------------------------------------------------------------------------------- /test/channel-f/lights.args: -------------------------------------------------------------------------------- 1 | ARGS="-f3 -I../../machines/channel-f/" -------------------------------------------------------------------------------- /test/channel-f/lights.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/channel-f/lights.bin.ref -------------------------------------------------------------------------------- /test/channel-f/tetris.args: -------------------------------------------------------------------------------- 1 | ARGS="-f3 -I../../machines/channel-f/" -------------------------------------------------------------------------------- /test/channel-f/tetris.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/channel-f/tetris.bin.ref -------------------------------------------------------------------------------- /test/cmdline_defs/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for testing hexadecimal notation on command line args 3 | # 4 | 5 | DASM=../../bin/dasm 6 | FTOHEX=../../bin/ftohex 7 | 8 | test: 9 | @../run_tests.sh -R ../../bin -D RAM_START=0x60 10 | 11 | %.bin: %.asm 12 | $(DASM) $< -o$@ -f1 -T1 -s$*.sym -DRAM_START=0x60 13 | 14 | %.hex: %.bin 15 | $(FTOHEX) 1 $< $@ 16 | 17 | clean: 18 | rm -rf *.bin *.hex *.list.txt *.diff *.sym *.out 19 | -------------------------------------------------------------------------------- /test/cmdline_defs/declare_var_mac.args: -------------------------------------------------------------------------------- 1 | ARGS="-f1 -T1 -s${NAME}.sym -DRAM_START=0x60" -------------------------------------------------------------------------------- /test/cmdline_defs/declare_var_mac.asm: -------------------------------------------------------------------------------- 1 | ../declare_var_mac.asm -------------------------------------------------------------------------------- /test/cmdline_defs/declare_var_mac.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/cmdline_defs/declare_var_mac.bin.ref -------------------------------------------------------------------------------- /test/cmdline_defs/declare_var_mac.hex.ref: -------------------------------------------------------------------------------- 1 | :0B800000CE0066359660A700B7006355 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/cmdline_defs/ramstart.args: -------------------------------------------------------------------------------- 1 | ARGS="-f1 -T1 -s${NAME}.sym -DRAM_START=0x60" -------------------------------------------------------------------------------- /test/cmdline_defs/ramstart.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 68HC11 3 | 4 | .ifnconst RAM_START 5 | RAM_START .EQU 0x80 6 | .endif 7 | 8 | ORG 0 9 | 10 | DC.w RAM_START 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/cmdline_defs/ramstart.bin.ref: -------------------------------------------------------------------------------- 1 | ` -------------------------------------------------------------------------------- /test/cmdline_defs/ramstart.hex.ref: -------------------------------------------------------------------------------- 1 | :0200000000609E 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/concat_str.asm: -------------------------------------------------------------------------------- 1 | 2 | PROCESSOR 6502 3 | 4 | ORG 0 5 | 6 | .macro concat_str ; {name},{size} 7 | {1} .set str_var 8 | str_var .set ({1}{2}) 9 | .endm 10 | 11 | str_var .set "" 12 | 13 | concat_str _1 "A" 14 | concat_str _2 "b" 15 | concar_str _3 "C" 16 | 17 | DC.b str_var 18 | 19 | echo str_var 20 | -------------------------------------------------------------------------------- /test/concat_str.fail: -------------------------------------------------------------------------------- 1 | 39 -------------------------------------------------------------------------------- /test/declare_var_mac.asm: -------------------------------------------------------------------------------- 1 | ; 2 | ; the purpose of this macro is to declare a global variable without need to know its exact location 3 | ; the location is automatically derived from its predecessor 'next_var' which gets redefined at every 4 | ; occurence. This way one can copy-paste, comment-out or conditional-define variable declarations 5 | ; without worrying. Memory usage will be always as compact as possible 6 | ; 7 | .PROCESSOR 6803 8 | 9 | #ifnconst RAM_START 10 | RAM_START .EQU 0x80 11 | #endif 12 | 13 | .mac declare_var ; {name},{size} 14 | {1} .EQU next_var 15 | next_var .set ({1}+{2}) 16 | .endm 17 | 18 | next_var .set RAM_START 19 | 20 | declare_var first, 1 ; declare variable name "first" 8bit 21 | declare_var second, 2 ; declare variable name "second" 16bit 22 | #if (RAM_START == 0x60) 23 | declare_var extra, 3 ; in case of special define, include variable extra 24bit 24 | #endif 25 | declare_var third, 4 ; declare variable name "third" 32bit 26 | 27 | .ORG 0x8000 28 | 29 | example_code: 30 | ldx #third 31 | txs 32 | ldaa first 33 | staa ,X 34 | #if (RAM_START == 0x60) 35 | staa.w extra 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /test/declare_var_mac.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/declare_var_mac.bin.ref -------------------------------------------------------------------------------- /test/declare_var_mac.hex.ref: -------------------------------------------------------------------------------- 1 | :08800000CE0083359680A70035 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/define_echo.asm: -------------------------------------------------------------------------------- 1 | ; Test case for -D and -M options and echo pseudo-op. 2 | 3 | SOURCE_SYMBOL equ 255 4 | IMPROPER_SYMBOL equ 127 5 | 6 | processor 6502 7 | echo "Defined in source file:" 8 | echo SOURCE_SYMBOL 9 | echo "Defined improperly in source file:" 10 | echo IMPROPER_SYMBOL 11 | echo "Defined externally with -D and default:" 12 | echo EXTERNAL_D_DEFAULT 13 | echo "Defined externally with -D and 127:" 14 | echo EXTERNAL_D_VALUE 15 | echo "Defined externally with -M and default:" 16 | echo EXTERNAL_M_DEFAULT 17 | echo "Defined externally with -M and 127:" 18 | echo EXTERNAL_M_VALUE 19 | end 20 | -------------------------------------------------------------------------------- /test/delete_empty_binary.args: -------------------------------------------------------------------------------- 1 | ARGS="-f1 -R" 2 | -------------------------------------------------------------------------------- /test/delete_empty_binary.asm: -------------------------------------------------------------------------------- 1 | jentzsch2.asm -------------------------------------------------------------------------------- /test/delete_empty_binary.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/demo.asm: -------------------------------------------------------------------------------- 1 | ;;; 2 | ; 3 | ; Some useful macros and techniques 4 | ; 5 | processor 6502 6 | 7 | ;;; 8 | mac hexdig 9 | 10 | if [{1}] <= 9 11 | dc.b '0 + [{1}] 12 | else 13 | dc.b 'a + [{1}] - 10 14 | endif 15 | 16 | endm 17 | ;;; 18 | mac hexnum 19 | 20 | if [{1}] >= $10 21 | hexnum [{1}] >> 4 22 | endif 23 | hexdig [{1}] & $0F 24 | 25 | endm 26 | ;;; 27 | 28 | org 0 29 | hexnum $123ab 30 | 31 | ;;;; 32 | ; 33 | ; Using an uninitialised segment to create C-like 'struct's. 34 | ; (idea taken from IBM-370 assembler style "dummy segments") 35 | 36 | seg.u node 37 | org 0 38 | 39 | s_next ds.b 2 ; a node has a pointer to the next one 40 | s_data ds.b 2 ; and 2 bytes of data 41 | s_more ds.b 3 ; and 3 bytes of something more 42 | 43 | seg code 44 | 45 | ptr equ 42 ; dummy value 46 | ldy #s_data 47 | lda (ptr),y ; get first byte of data 48 | 49 | 50 | -------------------------------------------------------------------------------- /test/doublemacro.asm: -------------------------------------------------------------------------------- 1 | ; Test case for double macros 2 | 3 | processor 6502 4 | 5 | MAC testmac ; the first declaration wins 6 | lda #1 7 | ENDM 8 | MAC testmac ; the second is silently ignored without the -S flag, but an error with -S 9 | ldx #1 10 | ENDM 11 | 12 | ORG $f800 13 | 14 | testmac 15 | 16 | -------------------------------------------------------------------------------- /test/doublemacro.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/doublemacro.bin.ref -------------------------------------------------------------------------------- /test/doublemacro.fail: -------------------------------------------------------------------------------- 1 | 25 -------------------------------------------------------------------------------- /test/doublemacro.hex.ref: -------------------------------------------------------------------------------- 1 | :02F80000A9015C 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/empty.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/empty.asm -------------------------------------------------------------------------------- /test/example.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/example.bin.ref -------------------------------------------------------------------------------- /test/file-with-dash.asm: -------------------------------------------------------------------------------- 1 | 2 | MoniRomDelayLoop: 3 | deca ; J $fd21 4a 4 | _Lfd22: 5 | psha ; . $fd22 87 6 | deca ; J $fd23 4a 7 | deca ; J $fd24 4a 8 | _Lfd25: 9 | dbnza _Lfd25 ; K. $fd25 4b fe 10 | pula ; . $fd27 86 11 | dbnzx _Lfd22 ; .. $fd28 5b f8 12 | rts ; . $fd2a 81 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/fill.asm: -------------------------------------------------------------------------------- 1 | ; 2 | ; Test various directives that "fill" memory. 3 | ; 4 | ; This came about because Dennis Debro posted about .align not 5 | ; doing the right thing to the Stella list. Thomas Mathys was 6 | ; able to trace this to v_align, which uses the first value 7 | ; instead of the second as the actual fill byte. Fixed as of 8 | ; release 2.20.12 I hope. :-) 9 | ; 10 | ; Peter H. Froehlich 11 | ; phf at acm dot org 12 | 13 | .processor 6502 14 | .org 0 15 | 16 | ; .ds fills with $a5 as required, works 17 | .ds 33, $a5 ; always filled $a5 18 | ; .align fills with *align* value prior to 2.20.12 19 | .align 64, $f5 ; filled $40 <2.20.11, fills $f5 now 20 | .align 256, $5f ; filled $0 <2.20.11, fills $5f now 21 | 22 | .end 23 | -------------------------------------------------------------------------------- /test/fill.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/fill.bin.ref -------------------------------------------------------------------------------- /test/fill.hex.ref: -------------------------------------------------------------------------------- 1 | :10000000A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A0 2 | :10001000A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A590 3 | :10002000A5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5D0 4 | :10003000F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F570 5 | :100040005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5FC0 6 | :100050005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5FB0 7 | :100060005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5FA0 8 | :100070005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F90 9 | :100080005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F80 10 | :100090005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F70 11 | :1000A0005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F60 12 | :1000B0005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F50 13 | :1000C0005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F40 14 | :1000D0005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F30 15 | :1000E0005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F20 16 | :1000F0005F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F10 17 | :00000001FF 18 | -------------------------------------------------------------------------------- /test/forced_addrmode.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 6803 3 | 4 | 5 | FAR_ADDR .EQU $F01A 6 | DIRECT_ADDR .EQU $40 7 | 8 | .ORG 0 9 | 10 | jsr.b DIRECT_ADDR 11 | jsr.w FAR_ADDR 12 | 13 | jsr DIRECT_ADDR 14 | jsr FAR_ADDR 15 | 16 | jsr.w DIRECT_ADDR 17 | 18 | jsr.b >FAR_ADDR 19 | jsr.b FAR_ADDR 22 | jsr.w test case for bug 2 | ; in error handling. 3 | 4 | processor 6502 5 | include vcs.h 6 | 7 | ORG $f800 8 | 9 | Start 10 | ldz #$00 ; illegal mnemonic 11 | 12 | org $fffc 13 | .word Start 14 | .word Start 15 | -------------------------------------------------------------------------------- /test/jentzsch2.asm: -------------------------------------------------------------------------------- 1 | ; Thomas Jentzsch test case for bug 2 | ; in error handling. 3 | 4 | processor 6502 5 | include vcs.h 6 | 7 | ORG $f800 8 | 9 | Start 10 | bpl .error ; undefined label 11 | 12 | org $fffc 13 | .word Start 14 | .word Start 15 | -------------------------------------------------------------------------------- /test/jentzsch2.fail: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/jmpiw.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 6502 5 | 6 | .ORG 0 7 | RESP0 = $10 ; (curious) why is (only) listing output big endian ordered when processor is little ? 8 | DC.w RESP0 9 | 10 | RESP1 = $100 ; ... but that's a different construction site 11 | DC.w RESP1 12 | 13 | 14 | jmp RESP0 15 | jmp RESP1 16 | jmp (RESP1) 17 | 18 | jmp.in (RESP0) ; forced(indirect_word) and coded(indirect_word) 19 | jmp.in RESP0 ; forced(indirect_word) and coded(byteaddr) ; should this be an error with strict mode ? 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/jmpiw.bin.ref: -------------------------------------------------------------------------------- 1 | LLlll -------------------------------------------------------------------------------- /test/jmpiw.hex.ref: -------------------------------------------------------------------------------- 1 | :10000000100000014C10004C00016C00016C10004D 2 | :030010006C100071 3 | :00000001FF 4 | -------------------------------------------------------------------------------- /test/labelchanges.asm: -------------------------------------------------------------------------------- 1 | ; labelchanges.asm - test various cases of labels changing location in 2 | ; successive passes. Test code provided by Thomas Jentzsch. 3 | 4 | processor 6502 5 | 6 | ;=============================================================================== 7 | 8 | ; automatically decide whether to use a branch or a jump 9 | MAC BNEJ 10 | IF ({1} - .) >= -126 && ({1} - .) <= 129 11 | bne {1} 12 | ELSE 13 | beq skip$ 14 | jmp {1} 15 | skip$ 16 | ENDIF 17 | ENDM 18 | 19 | ;=============================================================================== 20 | 21 | ORG $1000 22 | 23 | BackOk 24 | ds 126, $ea 25 | BNEJ BackOk 26 | 27 | BackJmp 28 | ; this has to use "jmp" 29 | ; and is detected as such 30 | ds 126+1, $ea 31 | BNEJ BackJmp 32 | 33 | ; this can use "bne" 34 | BNEJ ForwardOk 35 | ds 127, $ea 36 | ForwardOk 37 | 38 | ; this has to use "jmp" 39 | ; and is detected as such 40 | BNEJ ForwardJmp 41 | ds 127+3, $ea 42 | ForwardJmp 43 | 44 | ; this has to use "jmp" 45 | ; and is detected as such 46 | BNEJ ForwardJmp2 47 | ds 127+2, $ea 48 | ForwardJmp2 49 | -------------------------------------------------------------------------------- /test/labelchanges.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/labelchanges.bin.ref -------------------------------------------------------------------------------- /test/labelchanges.hex.ref: -------------------------------------------------------------------------------- 1 | :10100000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA40 2 | :10101000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA30 3 | :10102000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA20 4 | :10103000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA10 5 | :10104000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA00 6 | :10105000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAF0 7 | :10106000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAE0 8 | :10107000EAEAEAEAEAEAEAEAEAEAEAEAEAEAD08054 9 | :10108000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAC0 10 | :10109000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAB0 11 | :1010A000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAA0 12 | :1010B000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA90 13 | :1010C000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA80 14 | :1010D000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA70 15 | :1010E000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA60 16 | :1010F000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAF04A 17 | :10110000034C8010D07FEAEAEAEAEAEAEAEAEAEA8D 18 | :10111000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA2F 19 | :10112000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA1F 20 | :10113000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA0F 21 | :10114000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAFF 22 | :10115000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEF 23 | :10116000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEADF 24 | :10117000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEACF 25 | :10118000EAEAEAEAEAF0034C0C12EAEAEAEAEAEAF4 26 | :10119000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAAF 27 | :1011A000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA9F 28 | :1011B000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA8F 29 | :1011C000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA7F 30 | :1011D000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA6F 31 | :1011E000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA5F 32 | :1011F000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA4F 33 | :10120000EAEAEAEAEAEAEAEAEAEAEAEAF0034C9215 34 | :1012100012EAEAEAEAEAEAEAEAEAEAEAEAEAEAEA06 35 | :10122000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA1E 36 | :10123000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEA0E 37 | :10124000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAFE 38 | :10125000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEE 39 | :10126000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEADE 40 | :10127000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEACE 41 | :10128000EAEAEAEAEAEAEAEAEAEAEAEAEAEAEAEABE 42 | :02129000EAEA88 43 | :00000001FF 44 | -------------------------------------------------------------------------------- /test/locals.asm: -------------------------------------------------------------------------------- 1 | ;;;; 2 | ; 3 | ; Test local symbols 4 | ; 5 | processor 6502 6 | 7 | mac test1 8 | bne .end 9 | test$ = 1 10 | test2 11 | .end 12 | nop 13 | endm 14 | 15 | mac test2 16 | bne .end 17 | test$ = 1 18 | test3 19 | .end 20 | nop 21 | endm 22 | 23 | mac test3 24 | bne .end 25 | test$ = 1 26 | nop 27 | .end 28 | nop 29 | endm 30 | 31 | org 0 32 | 33 | test1 34 | test2 35 | test3 36 | 37 | .end 38 | 39 | loop set 0 40 | 41 | -------------------------------------------------------------------------------- /test/locals.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/locals.bin.ref -------------------------------------------------------------------------------- /test/locals.hex.ref: -------------------------------------------------------------------------------- 1 | :10000000D007D004D001EAEAEAEAD004D001EAEA53 2 | :05001000EAD001EAEA5C 3 | :00000001FF 4 | -------------------------------------------------------------------------------- /test/lockup_macro.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 68908 3 | 4 | .macro fw_delay 5 | ldx #{1} ;[2] 6 | lda #{2} ;[2] 7 | jsr MoniRomDelayLoop ;[5] 8 | .endm 9 | 10 | .macro declare_delay 11 | Delay{1}: 12 | fw_delay {2},{3} 13 | rts ;[4] 14 | .endm 15 | 16 | .ORG 0 17 | 18 | .word $B,$AD,$C0,$DE 19 | 20 | declare_delay 100us,1,40 ; 128 cycles, 21 | 22 | declare_delay 4ms,7,234 ; 4928 cycles, 23 | 24 | 25 | #include "file-with-dash.asm" 26 | 27 | 28 | ;MoniRomDelayLoop: 29 | ; rts 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /test/lockup_macro.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/lockup_macro.bin.ref -------------------------------------------------------------------------------- /test/lockup_macro.hex.ref: -------------------------------------------------------------------------------- 1 | :10000000000B00AD00C000DEAE01A628BD1681AE1B 2 | :1000100007A6EABD16814A874A4A4BFE865BF881ED 3 | :00000001FF 4 | -------------------------------------------------------------------------------- /test/longstring.asm: -------------------------------------------------------------------------------- 1 | ; Test long strings 2 | ; 3 | ; This came about due to strings longer than 256 bytes causing 4 | ; segfaults, due to overflow of a buffer in the opcode handling. 5 | ; 6 | ; --Mike Saarna 7 | 8 | .processor 6502 9 | .org 0 10 | 11 | .byte "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" 12 | 13 | .end 14 | -------------------------------------------------------------------------------- /test/longstring.bin.ref: -------------------------------------------------------------------------------- 1 | 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 -------------------------------------------------------------------------------- /test/longstring.hex.ref: -------------------------------------------------------------------------------- 1 | :1000000031323334353637383930313233343536AE 2 | :100010003738393031323334353637383930313298 3 | :100020003334353637383930313233343536373882 4 | :100030003930313233343536373839303132333480 5 | :100040003536373839303132333435363738393060 6 | :10005000313233343536373839303132333435365E 7 | :100060003738393031323334353637383930313248 8 | :100070003334353637383930313233343536373832 9 | :100080003930313233343536373839303132333430 10 | :100090003536373839303132333435363738393010 11 | :1000A000313233343536373839303132333435360E 12 | :1000B00037383930313233343536373839303132F8 13 | :1000C00033343536373839303132333435363738E2 14 | :1000D00039303132333435363738393031323334E0 15 | :1000E00035363738393031323334353637383930C0 16 | :1000F00031323334353637383930313233343536BE 17 | :1001000037383930313233343536373839303132A7 18 | :0801100033343536373839303D 19 | :00000001FF 20 | -------------------------------------------------------------------------------- /test/m_switch_0.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .processor 6502 4 | 5 | 6 | .ds 0x7FFFFFFE 7 | 8 | .end -------------------------------------------------------------------------------- /test/m_switch_0.fail: -------------------------------------------------------------------------------- 1 | 38 -------------------------------------------------------------------------------- /test/m_switch_1.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .processor 6502 4 | 5 | .org 0 6 | 7 | DC.w 37 8 | DC.w 47 9 | DC.w 59 10 | 11 | .ds ((64+4) * 1024) 12 | 13 | DC.w 37,47,59 14 | 15 | .end -------------------------------------------------------------------------------- /test/m_switch_2.args: -------------------------------------------------------------------------------- 1 | ARGS="-m63" -------------------------------------------------------------------------------- /test/m_switch_2.asm: -------------------------------------------------------------------------------- 1 | m_switch_1.asm -------------------------------------------------------------------------------- /test/m_switch_2.fail: -------------------------------------------------------------------------------- 1 | 1 -------------------------------------------------------------------------------- /test/m_switch_3.args: -------------------------------------------------------------------------------- 1 | ARGS="-m65" -------------------------------------------------------------------------------- /test/m_switch_3.asm: -------------------------------------------------------------------------------- 1 | m_switch_1.asm -------------------------------------------------------------------------------- /test/m_switch_3.fail: -------------------------------------------------------------------------------- 1 | 38 -------------------------------------------------------------------------------- /test/macro_included.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 6502 3 | 4 | #include "macro_ipart0.asm" /* head declaration */ 5 | 6 | /* continuing the macro definition in another file does not work */ 7 | 8 | #include "macro_ipart1.asm" /* macro is ended here */ 9 | 10 | 11 | .ORG 0 12 | 13 | headPart 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/macro_included.fail: -------------------------------------------------------------------------------- 1 | 14 -------------------------------------------------------------------------------- /test/macro_ipart0.asm: -------------------------------------------------------------------------------- 1 | 2 | .MACRO headPart 3 | lda #1 4 | -------------------------------------------------------------------------------- /test/macro_ipart1.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | ldx #2 4 | .ENDM ; tailPart -------------------------------------------------------------------------------- /test/macro_same_as_include.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .PROCESSOR 68908 4 | 5 | .INCLUDE same_as_macro 6 | /* include file names and macro names can be shared without interfering */ 7 | .MAC same_as_macro 8 | lda #1 9 | .ENDM 10 | 11 | .ORG 12 | 13 | same_as_macro 14 | 15 | ttt_macro 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/macro_same_as_include.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/macro_same_as_include.bin.ref -------------------------------------------------------------------------------- /test/macro_same_as_include.hex.ref: -------------------------------------------------------------------------------- 1 | :04000000A601AE02A5 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/missing_endm.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 68908 3 | 4 | .ORG 0 5 | 6 | .mac predef 7 | lda #5 8 | .macro 9 | 10 | Main: 11 | predef 12 | rola 13 | write_usb 14 | rora 15 | rts 16 | 17 | .macro write_usb 18 | sta 6 19 | .endm 20 | 21 | ; 22 | ; premature end of file or '"endm" missing' 23 | ; 24 | -------------------------------------------------------------------------------- /test/missing_endm.fail: -------------------------------------------------------------------------------- 1 | 40 -------------------------------------------------------------------------------- /test/multiline_comment.asm: -------------------------------------------------------------------------------- 1 | processor 6502 2 | ORG $1000 3 | 4 | /* comment 1 */ lda #0 5 | 6 | /* IF 0 7 | */ 8 | 9 | lda #1/*test*/ 10 | /* 11 | 12 | */ lda #2 13 | 14 | /* 15 | hello */label lda #3 16 | 17 | /*foo*/ lda #4/*bar*/ 18 | 19 | /* more 20 | comments 21 | */mylabel lda #5 /* too many comments*/ /*but we can deal with it*/ 22 | 23 | -------------------------------------------------------------------------------- /test/multiline_comment.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/multiline_comment.bin.ref -------------------------------------------------------------------------------- /test/multiline_comment.hex.ref: -------------------------------------------------------------------------------- 1 | :02100000A90144 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/negative.asm: -------------------------------------------------------------------------------- 1 | ; Test negative literals. 2 | ; 3 | ; This came about because of the "-1 bug" in 2.20.10 and 4 | ; will hopefully ensure that no such bug ever returns to 5 | ; haunt us again... 6 | ; 7 | ; Peter H. Froehlich 8 | ; phf at acm dot org 9 | 10 | .processor 6502 11 | .org 0 12 | 13 | lda #0 14 | ; lda #+0 ;syntax error? needs a FIX as well :-) 15 | lda #-0 16 | 17 | lda #1 18 | lda #-1 19 | 20 | lda #127 21 | lda #128 22 | lda #129 23 | 24 | lda #-127 25 | lda #-128 26 | lda #-129 27 | 28 | lda #254 29 | lda #255 30 | lda #256 ; should fail? does fail! 31 | 32 | lda #-254 33 | lda #-255 34 | lda #-256 ; should fail? does NOT yet fail? 35 | 36 | lda #1024 ; should fail? does fail! 37 | lda #-1024 ; should fail? does NOT yet fail? 38 | 39 | .end 40 | -------------------------------------------------------------------------------- /test/negative1024.asm: -------------------------------------------------------------------------------- 1 | ; Test negative literals. 2 | ; 3 | ; This came about because of the "-1 bug" in 2.20.10 and 4 | ; will hopefully ensure that no such bug ever returns to 5 | ; haunt us again... 6 | ; 7 | ; Peter H. Froehlich 8 | ; phf at acm dot org 9 | 10 | .processor 6502 11 | .org 0 12 | 13 | lda #1024 ; should fail? does fail! 14 | 15 | .end 16 | -------------------------------------------------------------------------------- /test/negative1024.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/negative1024_2.asm: -------------------------------------------------------------------------------- 1 | ; Test negative literals. 2 | ; 3 | ; This came about because of the "-1 bug" in 2.20.10 and 4 | ; will hopefully ensure that no such bug ever returns to 5 | ; haunt us again... 6 | ; 7 | ; Peter H. Froehlich 8 | ; phf at acm dot org 9 | 10 | .processor 6502 11 | .org 0 12 | 13 | lda.b #-1024 ; should fail? does NOT yet fail? 14 | 15 | .end 16 | -------------------------------------------------------------------------------- /test/negative1024_2.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/negative256.asm: -------------------------------------------------------------------------------- 1 | ; Test negative literals. 2 | ; 3 | ; This came about because of the "-1 bug" in 2.20.10 and 4 | ; will hopefully ensure that no such bug ever returns to 5 | ; haunt us again... 6 | ; 7 | ; Peter H. Froehlich 8 | ; phf at acm dot org 9 | 10 | .processor 6502 11 | .org 0 12 | 13 | lda #256 ; should fail? does fail! 14 | 15 | .end 16 | -------------------------------------------------------------------------------- /test/negative256.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/negative256_2.asm: -------------------------------------------------------------------------------- 1 | ; Test negative literals. 2 | ; 3 | ; This came about because of the "-1 bug" in 2.20.10 and 4 | ; will hopefully ensure that no such bug ever returns to 5 | ; haunt us again... 6 | ; 7 | ; Peter H. Froehlich 8 | ; phf at acm dot org 9 | 10 | .processor 6502 11 | .org 0 12 | .TRACE on 13 | 14 | lda.b #-256 ; should fail? does NOT yet fail? 15 | 16 | .end 17 | -------------------------------------------------------------------------------- /test/negative256_2.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/recursive_eqm.asm: -------------------------------------------------------------------------------- 1 | ; segfault 2 | 3 | str eqm "BB" 4 | 5 | .MAC strcat ; {symbol},{string_trailer} 6 | strcat_tmp eqm {1} + {2} 7 | {1} eqm strcat_tmp 8 | .ENDM 9 | 10 | strcat str,"\nAAA" 11 | strcat str,"\nCC" 12 | 13 | .PROCESSOR 6502 14 | 15 | .ORG 0 16 | 17 | DS str 18 | 19 | lda #1 20 | 21 | ; EOF 22 | 23 | -------------------------------------------------------------------------------- /test/recursive_eqm.fail: -------------------------------------------------------------------------------- 1 | 38 -------------------------------------------------------------------------------- /test/recursive_equ.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 6502 3 | 4 | 5 | ME .EQU (OTHER +1) 6 | OTHER .EQU (ME -1) 7 | 8 | .ORG 0 9 | 10 | DC.b ME 11 | DC.b OTHER 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/recursive_equ.fail: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/recursive_macro0.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 6502 3 | 4 | .MAC rec_test 5 | .IF ({1} > 0) 6 | rec_test [{1}-1] 7 | .ELSE 8 | lda #{1} 9 | .ENDIF 10 | .ENDM 11 | 12 | .ORG 0 13 | 14 | rec_test 5 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/recursive_macro0.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/recursive_macro0.bin.ref -------------------------------------------------------------------------------- /test/recursive_macro0.hex.ref: -------------------------------------------------------------------------------- 1 | :02000000A90055 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/recursive_macro1.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 6502 3 | 4 | .MAC rec_noend 5 | rec_noend 6 | .ENDM 7 | 8 | .ORG 0 9 | 10 | rec_noend 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/recursive_macro1.fail: -------------------------------------------------------------------------------- 1 | 38 -------------------------------------------------------------------------------- /test/recursive_macro2.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 6502 3 | 4 | .ORG 0 5 | 6 | 7 | .MAC m1_noend 8 | m2_noend 9 | .ENDM 10 | 11 | .MAC m2_noend 12 | m1_noend 13 | .ENDM 14 | 15 | 16 | m1_noend 17 | 18 | .END 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/recursive_macro2.fail: -------------------------------------------------------------------------------- 1 | 38 -------------------------------------------------------------------------------- /test/recursive_set.asm: -------------------------------------------------------------------------------- 1 | ; segfault 2 | 3 | str set "BB" 4 | str set str + "AAAA" 5 | 6 | .PROCESSOR 6502 7 | 8 | .ORG 0 9 | 10 | DS str 11 | 12 | lda #1 13 | 14 | ; EOF 15 | 16 | -------------------------------------------------------------------------------- /test/recursive_set.fail: -------------------------------------------------------------------------------- 1 | 38 -------------------------------------------------------------------------------- /test/reverse_segfault.asm: -------------------------------------------------------------------------------- 1 | ; segfault 2 | 3 | str set "" 4 | 5 | str eqm "\nAAAAA" + str 6 | 7 | echo str 8 | 9 | ; EOF 10 | 11 | -------------------------------------------------------------------------------- /test/reverse_segfault.fail: -------------------------------------------------------------------------------- 1 | 38 -------------------------------------------------------------------------------- /test/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Simple test script adapted from Matt Dillon's 2.16 release. 4 | # It's harder to do this in a Makefile, so let's use a script. 5 | 6 | should_fail="0" 7 | 8 | REL_DIR="../bin" 9 | 10 | DEFINES="" 11 | format="1" 12 | 13 | while [ "$1" != "" ] 14 | do 15 | case "$1" in 16 | -R) REL_DIR="$2" 17 | shift 18 | ;; 19 | -S) should_fail="$2" 20 | shift 21 | ;; 22 | -D) DEFINES="${DEFINES} -D$2" 23 | shift 24 | ;; 25 | -F) format="$2" 26 | shift 27 | ;; 28 | -I) DEFINES="${DEFINES} -I$2" 29 | ;; 30 | esac 31 | shift 32 | done 33 | 34 | echo "=== build test cases (strict=off)" 35 | 36 | fail="0" 37 | ok="0" 38 | nTests="0" 39 | 40 | leadingSpace() { 41 | echo "$@" | awk '{ printf(" * % 32s", $0)}' 42 | } 43 | 44 | refFiles=`find . -type f -name '*.bin.ref' | sort` 45 | 46 | for item in $refFiles 47 | do 48 | ARGS="-f${format}" 49 | 50 | NAME=$(echo $item | sed 's/\.bin\.ref$//g;s/^\.\///g') 51 | 52 | leadingSpace "$NAME" 53 | 54 | if test -r ${NAME}.args 55 | then 56 | . ${NAME}.args 57 | fi 58 | 59 | if ${REL_DIR}/dasm ${NAME}.asm ${ARGS} -o$NAME.bin -L$NAME.list.txt -DINEEPROM ${DEFINES} >$NAME.out 2>&1 60 | then 61 | if test -s $NAME.bin 62 | then 63 | ${REL_DIR}/ftohex 1 $NAME.bin $NAME.hex 64 | if cmp -s $NAME.bin $NAME.bin.ref 65 | then 66 | echo " binary is same, pass" 67 | ok="$[$ok+1]" 68 | else 69 | # second compare test is not needed, just help to find the diff 70 | if ! test -r $NAME.hex.ref 71 | then 72 | echo " file [$NAME.hex.ref] missing FAILED!" 73 | else 74 | diff -bBduw $NAME.hex $NAME.hex.ref >$NAME.hex.diff 75 | echo " binaries differ FAILED!" 76 | fi 77 | fail="$[$fail+1]" 78 | fi 79 | else 80 | echo " file doesn't exist or has zero size FAILED!" 81 | fail="$[$fail+1]" 82 | fi 83 | else 84 | echo " assembly FAILED! [$?]" 85 | fail="$[$fail+1]" 86 | fi 87 | nTests="$[$nTests+1]" 88 | done 89 | 90 | LIST=`find . -type f -name '*.fail' | sort` 91 | if [ "$LIST" != "" ] 92 | then 93 | 94 | echo "" 95 | echo "=== error test cases (strict=on)" 96 | 97 | # test for assembly sniplets that should fail 98 | for item in $LIST 99 | do 100 | ARGS="-f${format}" 101 | 102 | NAME=$(echo $item | sed 's/\.fail$//g;s/^\.\///g') 103 | leadingSpace "$NAME" 104 | 105 | if test -r ${NAME}.args 106 | then 107 | . ${NAME}.args 108 | fi 109 | 110 | if ! test -r ${NAME}.asm 111 | then 112 | echo "source file [${NAME}.asm] is missing" 113 | fail="$[$fail+1]" 114 | else 115 | if ${REL_DIR}/dasm ${NAME}.asm -S ${ARGS} -o$NAME.bin -L$NAME.list.txt -DINEEPROM ${DEFINES} >${NAME}.out 2>&1 116 | then 117 | echo " no error FAILED!" 118 | fail="$[$fail+1]" 119 | else 120 | case "$ARGS" in 121 | *-R) if test -r $NAME.bin 122 | then 123 | echo " file exists, FAILED!" 124 | fail="$[$fail+1]" 125 | else 126 | echo " file was deleted, pass" 127 | ok="$[$ok+1]" 128 | fi 129 | ;; 130 | *) got_error_level="$?" 131 | expected_error_level=`cat $item | head -1` 132 | if [ "${expected_error_level}" = "" ] 133 | then 134 | echo " testcase definition incomplete, missing error_level (${got_error_level}), FAILED!" 135 | fail="$[$fail+1]" 136 | else 137 | if [ "${got_error_level}" != "${expected_error_level}" ] 138 | then 139 | echo " got error_level (${got_error_level}) but expected (${expected_error_level}), double FAULT!" 140 | fail="$[$fail+1]" 141 | else 142 | echo " error_code [${got_error_level}] pass" 143 | ok="$[$ok+1]" 144 | fi 145 | fi 146 | ;; 147 | esac 148 | fi 149 | fi 150 | nTests="$[$nTests+1]" 151 | done 152 | 153 | fi 154 | 155 | echo -n "executed ${nTests} tests, $ok OK, $fail failed, result: " 156 | 157 | if [ "$[$ok+${should_fail}]" = "$nTests" ] 158 | then 159 | echo "overall PASS" 160 | exit 0 161 | else 162 | suspect="$[$fail-${should_fail}]" 163 | echo "need to investigate in $suspect test-cases" 164 | exit $suspect 165 | fi 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /test/run_valgrind.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Simple test script adapted from Matt Dillon's 2.16 release. 4 | # It's harder to do this in a Makefile, so let's use a script. 5 | 6 | for i in *.asm 7 | do 8 | NAME=`basename $i .asm` 9 | echo "----- $NAME -----" 10 | valgrind -v --tool=memcheck --leak-check=full --error-exitcode=10 --show-reachable=yes --log-file=$NAME.valgrind ../bin/dasm $i -f1 -o$NAME.bin -DINEEPROM 11 | echo "valgrind returned $?" 12 | done 13 | -------------------------------------------------------------------------------- /test/same_as_macro: -------------------------------------------------------------------------------- 1 | 2 | 3 | .MACRO ttt_macro 4 | ldx #2 5 | .ENDM 6 | 7 | -------------------------------------------------------------------------------- /test/same_names.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .PROCESSOR 68908 5 | 6 | .MAC ldx ; we cant overwrite any of the processor ops 7 | lda {1} 8 | .ENDM 9 | 10 | .MAC LDHX ; also not with different case 11 | ldx <{1} 12 | lda >{1} 13 | psha 14 | pulh 15 | .ENDM 16 | 17 | .MAC M1_postfix7 18 | ldhx #1 19 | .ENDM 20 | 21 | .MAC M2_postfix7 22 | ldx #1 23 | clrh 24 | .ENDM 25 | 26 | M1_postfix7 .EQU 0xA1 ; symbols can share the same name with macros or processor ops 27 | M2_postfix7 .EQU 0xB2 28 | LDA .EQU 0xDA 29 | 30 | .MAC M3_postfix7 31 | pshh 32 | pulx 33 | .ENDM 34 | 35 | 36 | .ORG 0 37 | 38 | ; call to macro1 39 | M1_postfix7 40 | 41 | ; call to macro2 42 | M2_postfix7 43 | 44 | DC.b M1_postfix7 45 | DC.b M2_postfix7 46 | DC.b LDA 47 | 48 | lda #0x0a 49 | LDA #0x0b 50 | 51 | ; call to macro3 52 | M3_postfix7 53 | 54 | ldx #1 55 | ldhx #2 56 | LDHX #3 57 | 58 | .END 59 | 60 | 61 | -------------------------------------------------------------------------------- /test/same_names.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/same_names.bin.ref -------------------------------------------------------------------------------- /test/same_names.hex.ref: -------------------------------------------------------------------------------- 1 | :10000000450001AE018CA1B2DAA60AA60B8B88AE20 2 | :070010000145000245000359 3 | :00000001FF 4 | -------------------------------------------------------------------------------- /test/sample.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/sample.bin.ref -------------------------------------------------------------------------------- /test/sample.hex.ref: -------------------------------------------------------------------------------- 1 | :10FE0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF02 2 | :10FE1000FFFFFFFFFFFFFFFF0F4FB7103D97389722 3 | :10FE200035C680D7398E0009C63837373634C63FD5 4 | :10FE300037C6FF37C6FC3736C6803736C634D730AC 5 | :10FE4000972CC60CD72DC603D72BC610D72814283D 6 | :10FE5000401421151422868E039F9760976A0E86A0 7 | :10FE60003897661505108D70C1AA26F34FCE006A2B 8 | :10FE70008D6608E7001B7A006B26F54D26E18D584C 9 | :10FE8000C15526DB966C2B04916126DAD66D861659 10 | :10FE90009768CEFEE7C40E3AEE008620976C966017 11 | :10FEA000976DAD008D0220BE86099767150520CBA2 12 | :10FEB00004D76BCE006B4F152D04C6AA8D22E60029 13 | :10FEC00008107A006B26F51B168D15C6558D11137B 14 | :10FED0002E40FC142D04393E132E20FBD62F393E24 15 | :10FEE000132E80FBD72F39FF01FF10FF27FEF7FEEF 16 | :10FEF00018FEF9FEF7FEF75F39DC6E9760D7005FFA 17 | :10FF0000398601976E9661976FDC31DD70C60439D2 18 | :10FF1000DE6E18CE00715FA60018A7000818085CF6 19 | :10FF2000D17026F3CB0339CE007118DE6E20E7DEE8 20 | :10FF30006408DF641523FB3BDE6208DF621523FDE6 21 | :10FF40003B5F96348D0296333716481B3348594829 22 | :10FF50005939D6025454CE03003A8D64C4FC584932 23 | :10FF6000584924026A40E32024026C407D006A263E 24 | :10FF70000C581659A64049ED004F5FA740ED20D61A 25 | :10FF800002CB082A07966A8B02976A5FD70215236D 26 | :10FF90007FDC16C30140DD1624257A006626031493 27 | :10FFA00005107A00672603140520DE6809DF68273C 28 | :10FFB000088D8ED1612708D7617F00601505C03B91 29 | :10FFC0001402048D068D00150204177D0029D62A1F 30 | :10FFD000D72A4848474739FFFFFFFFFFFFFFFFFFD2 31 | :10FFE000FFFFFFFFFFFFFFFFFF52FE18FF38FF2F4D 32 | :10FFF000FE18FE18FE18FE18FE18FE18FE18FE1851 33 | :00000001FF 34 | -------------------------------------------------------------------------------- /test/segfault.asm: -------------------------------------------------------------------------------- 1 | ; segfault 2 | 3 | str set "" 4 | str eqm str + "\nAAAAA" 5 | echo str 6 | 7 | ; EOF 8 | 9 | -------------------------------------------------------------------------------- /test/segfault.fail: -------------------------------------------------------------------------------- 1 | 38 -------------------------------------------------------------------------------- /test/selftest/0_no_assembly.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .processor fantasy 4 | .org 0 5 | 6 | ; 7 | ; fake processor in order to abort assembly, testing the test-enginge for aborted assembly 8 | ; 9 | -------------------------------------------------------------------------------- /test/selftest/0_no_assembly.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/selftest/0_no_assembly.bin.ref -------------------------------------------------------------------------------- /test/selftest/1_no_binary.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .processor 6502 4 | .org 0 5 | 6 | ; 7 | ; should create a zero sized file, testing the test-enginge for zero-binaries 8 | ; 9 | -------------------------------------------------------------------------------- /test/selftest/1_no_binary.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/selftest/1_no_binary.bin.ref -------------------------------------------------------------------------------- /test/selftest/2_hexref_missing.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .processor 6502 4 | .org 0 5 | 6 | DC.w 1234 7 | ; 8 | ; should create a file, testing the test-enginge for missing hex reference 9 | ; 10 | -------------------------------------------------------------------------------- /test/selftest/2_hexref_missing.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/selftest/2_hexref_missing.bin.ref -------------------------------------------------------------------------------- /test/selftest/3_binary_different.asm: -------------------------------------------------------------------------------- 1 | 2 | .ORG 3 | 4 | DC.w 1234 5 | ; 6 | ; everything OK here, testing the test-enginge for different binary reference 7 | ; -------------------------------------------------------------------------------- /test/selftest/3_binary_different.bin.ref: -------------------------------------------------------------------------------- 1 | ; 2 | ; this must be different 3 | ; -------------------------------------------------------------------------------- /test/selftest/3_binary_different.hex.ref: -------------------------------------------------------------------------------- 1 | :0200000004D228 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/selftest/4_finally_OK.asm: -------------------------------------------------------------------------------- 1 | 2 | .ORG 3 | 4 | DC.w 1234 5 | ; 6 | ; everything OK here, testing the test-enginge for different binary reference 7 | ; -------------------------------------------------------------------------------- /test/selftest/4_finally_OK.bin.ref: -------------------------------------------------------------------------------- 1 | � -------------------------------------------------------------------------------- /test/selftest/4_finally_OK.hex.ref: -------------------------------------------------------------------------------- 1 | :0200000004D228 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/selftest/5_must_fail.asm: -------------------------------------------------------------------------------- 1 | 2 | .ORG 3 | 4 | DC.w 1234 5 | ; 6 | ; everything OK here, testing the test-enginge for false positives 7 | ; -------------------------------------------------------------------------------- /test/selftest/5_must_fail.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/selftest/6_false_positive_fail.args: -------------------------------------------------------------------------------- 1 | ARGS=" && exit -1" -------------------------------------------------------------------------------- /test/selftest/6_false_positive_fail.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .processor fantasy 4 | .org 0 5 | 6 | ; 7 | ; fake processor in order to abort assembly, testing the test-enginge for wrong error level by faking command-line arguments 8 | ; 9 | ; 10 | -------------------------------------------------------------------------------- /test/selftest/6_false_positive_fail.fail: -------------------------------------------------------------------------------- 1 | 15 2 | -------------------------------------------------------------------------------- /test/selftest/7_false_positive_fail.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .processor fantasy 4 | .org 0 5 | 6 | ; 7 | ; fake processor in order to abort assembly, testing the test-enginge for wrong error level by faking command-line arguments 8 | ; 9 | ; 10 | -------------------------------------------------------------------------------- /test/selftest/7_false_positive_fail.fail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/selftest/7_false_positive_fail.fail -------------------------------------------------------------------------------- /test/selftest/8_false_positive_OK.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | .processor fantasy 4 | .org 0 5 | 6 | ; 7 | ; fake processor in order to abort assembly, testing the test-enginge for wrong error level by faking command-line arguments 8 | ; 9 | ; 10 | -------------------------------------------------------------------------------- /test/selftest/8_false_positive_OK.fail: -------------------------------------------------------------------------------- 1 | 27 2 | -------------------------------------------------------------------------------- /test/selftest/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # here are the tests for testing the test-script 3 | # 4 | 5 | DASM=../../bin/dasm 6 | FTOHEX=../../bin/ftohex 7 | 8 | test: 9 | @../run_tests.sh -R ../../bin -S 7 10 | 11 | %.bin: %.asm 12 | $(DASM) $< -o$@ -f1 13 | 14 | %.hex: %.bin 15 | $(FTOHEX) 1 $< $@ 16 | 17 | clean: 18 | rm -rf *.bin *.hex *.list.txt *.diff *.out 19 | -------------------------------------------------------------------------------- /test/setstr.asm: -------------------------------------------------------------------------------- 1 | ; Test case for the SETSYM pseudo-op 2 | 3 | PROCESSOR 6502 4 | ORG $C000 5 | TESTLABEL = . 6 | TESTSTR setstr TESTLABEL 7 | .byte TESTSTR 8 | -------------------------------------------------------------------------------- /test/setstr.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/setstr.bin.ref -------------------------------------------------------------------------------- /test/setstr.hex.ref: -------------------------------------------------------------------------------- 1 | :09C00000544553544C4142454C97 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/setsym.asm: -------------------------------------------------------------------------------- 1 | ; Test case for the SETSYM pseudo-op 2 | 3 | PROCESSOR 6502 4 | ORG $C000 5 | HERE = . 6 | TESTSTR = "HERE" 7 | TESTSYM setsym TESTSTR 8 | .word TESTSYM 9 | .word 0 10 | -------------------------------------------------------------------------------- /test/setsym.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/setsym.bin.ref -------------------------------------------------------------------------------- /test/setsym.hex.ref: -------------------------------------------------------------------------------- 1 | :04C0000000C000007C 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/stabx.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 6502 5 | 6 | RESP1 = $100 7 | 8 | .ORG 0 9 | 10 | sta.bx RESP1,x 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/stabx.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/staby.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 68hc11 5 | 6 | RESP1 = $100 7 | 8 | .ORG 0 9 | 10 | stab.y RESP1,y 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/staby.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/staby2.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 68hc11 5 | 6 | RESP1 = $10 7 | 8 | .ORG 0 9 | 10 | stab.wy RESP1,y 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/staby2.fail: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/staby3.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 6502 5 | 6 | RESP0 = $10 7 | 8 | .ORG 0 9 | 10 | sta.by (RESP0),y ; wrong statement forced(byteaddr_Y) but coded(indirect_byte_Y) 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/staby3.fail: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/staby4.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 6502 5 | 6 | RESP1 = $100 7 | 8 | .ORG 0 9 | 10 | sta.by RESP1,y ; wrong statement forced(byteaddr_Y) but implied(wordaddr_Y) 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/staby4.fail: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/stawx.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 6502 5 | 6 | 7 | RESP0 = $10 8 | RESP1 = $100 9 | 10 | .ORG 0 11 | 12 | sta.wx RESP0,x 13 | sta.w RESP0,x 14 | sta RESP1,x 15 | 16 | lda (1),Y 17 | lda (RESP0),Y 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/stawx.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/stawx.bin.ref -------------------------------------------------------------------------------- /test/stawx.hex.ref: -------------------------------------------------------------------------------- 1 | :0D0000009D10009D10009D0001B101B11088 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/stawy.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 6502 5 | 6 | 7 | RESP0 = $10 8 | 9 | .ORG 0 10 | 11 | sta.w (RESP0),y ; wrong statement forced(wordaddr) but coded(indirect_byte_Y) 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /test/stawy.fail: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/stawy2.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 6502 5 | 6 | RESP1 = $100 7 | 8 | .ORG 0 9 | 10 | sta (RESP1),y ; wrong statement implied(indirect_word_Y) but not available 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/stawy2.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/stawy3.asm: -------------------------------------------------------------------------------- 1 | 2 | .TRACE on 3 | 4 | .processor 6502 5 | 6 | RESP0 = $10 7 | RESP1 = $100 8 | 9 | .ORG 0 10 | 11 | sta.wy (RESP0),y ; wrong statement forced(wordaddr_Y) but coded(indirect_byte_Y) 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/stawy3.fail: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /test/string_conversion.asm: -------------------------------------------------------------------------------- 1 | ; Bug in string conversion. 2 | ; Reported 2007/08/25 by Eduardo Casino Almao 3 | 4 | ; I've found a bug in the string conversion feature ([exp]d) I'm using 5 | ; version 2.20.10b 6 | ; 7 | ; Basically, if exp is a not-yet-resolved label, the assembler aborts with 8 | ; "program.a: (XX): error Label mismatch... 9 | 10 | processor 6502 11 | 12 | org $0801 13 | 14 | word endprg ; pointer to next line 15 | word 1968 ; line number 16 | byte $9e ; SYS token 17 | byte [start]d ; ASCII of SYS address 18 | byte " TESTPROG BY TESTSOFT" ; Show copyright 19 | endprg byte 0,0,0 ; End of BASIC program 20 | 21 | start rts 22 | 23 | ; The assembler outputs: 24 | ; 25 | ; DASM V2.20.10, Macro Assembler (C)1988-2004 26 | ; testcase.a (13): error: Label mismatch... 27 | ; --> endprg 081c 28 | ; testcase.a (16): error: Label mismatch... 29 | ; --> start 081f 30 | ; Unrecoverable error(s) in pass, aborting assembly! 31 | ; Complete. 32 | ; 33 | ; The offending code is in symbols.c, lines 203 to 210. I think that there 34 | ; should be an extra condition, so if in the previous pass it has been a 35 | ; string conversion, just go for another pass. 36 | ; 37 | ; -----CUT----- 38 | ; /* 39 | ; * If we had an unevaluated IF expression in the 40 | ; * previous pass, don't complain about phase errors 41 | ; * too loudly. 42 | ; */ 43 | ; 203 if (F_verbose >= 1 || !(Redo_if & (REASON_OBSCURE))) 44 | ; { 45 | ; char sBuffer[ MAX_SYM_LEN * 2 ]; 46 | ; sprintf( sBuffer, "%s %s", sym->name, sftos( sym->value, 0 ) ); 47 | ; /*, sftos(sym->value, 48 | ; sym->flags) ); , sftos(pc, cflags & 7));*/ 49 | ; asmerr( ERROR_LABEL_MISMATCH, false, sBuffer ); 50 | ; 210 } 51 | ; ++Redo; 52 | ; Redo_why |= REASON_PHASE_ERROR; 53 | ; -----CUT----- 54 | -------------------------------------------------------------------------------- /test/string_conversion.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/string_conversion.bin.ref -------------------------------------------------------------------------------- /test/string_conversion.hex.ref: -------------------------------------------------------------------------------- 1 | :100801001F08B0079E32303832205445535450529D 2 | :100811004F472042592054455354534F46540000EA 3 | :02082100006075 4 | :00000001FF 5 | -------------------------------------------------------------------------------- /test/string_table.asm: -------------------------------------------------------------------------------- 1 | 2 | .ORG $e295 3 | 4 | _Str0Desc: 5 | DC.b _Str1Desc - _Str0Desc,$03 6 | DC.b $09,$04 7 | _Str1Desc: 8 | DC.b _Str2Desc - _Str1Desc,$03 ; $28,$03 9 | DC.w "MCT Electronikladen" 10 | _Str2Desc: 11 | DC.b _StrTable - _Str2Desc,$03 ; $2e,$03 12 | DC.w "USB08 Evaluation Board" 13 | _StrTable: 14 | _Str0Vec DC.w _Str0Desc ; .. $e2ef e2 95 15 | _Str1Vec DC.w _Str1Desc ; .. $e2f1 e2 99 16 | _Str2Vec DC.w _Str2Desc ; .. $e2f3 e2 c1 17 | -------------------------------------------------------------------------------- /test/string_table.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/string_table.bin.ref -------------------------------------------------------------------------------- /test/string_table.hex.ref: -------------------------------------------------------------------------------- 1 | :10E29500040309042803004D0043005400200045F1 2 | :10E2A500006C0065006300740072006F006E006909 3 | :10E2B500006B006C006100640065006E2E03005564 4 | :10E2C5000053004200300038002000450076006110 5 | :10E2D500006C0075006100740069006F006E00201D 6 | :10E2E5000042006F006100720064E295E299E2C1AC 7 | :00000001FF 8 | -------------------------------------------------------------------------------- /test/stringify.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 6502 3 | 4 | .ORG 1024 5 | .word 1968 6 | .word endprg 7 | .byte $FF ; make odd alignment 8 | .byte [MainStart]d ; ASCII representation of MainStart 9 | .byte " TEST ",0 10 | endprg: 11 | .byte 0,0,0 12 | 13 | .ORG 1234 14 | MainStart: 15 | rts 16 | -------------------------------------------------------------------------------- /test/stringify.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/stringify.bin.ref -------------------------------------------------------------------------------- /test/stringify.hex.ref: -------------------------------------------------------------------------------- 1 | :10040000B0071004FF3132333420544553542000D8 2 | :10041000000000FFFFFFFFFFFFFFFFFFFFFFFFFFE9 3 | :10042000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC 4 | :10043000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFCC 5 | :10044000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBC 6 | :10045000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAC 7 | :10046000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9C 8 | :10047000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8C 9 | :10048000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7C 10 | :10049000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C 11 | :1004A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5C 12 | :1004B000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4C 13 | :1004C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3C 14 | :0304D000FFFF60CB 15 | :00000001FF 16 | -------------------------------------------------------------------------------- /test/suite6303.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/suite6303.bin.ref -------------------------------------------------------------------------------- /test/suite6303.hex.ref: -------------------------------------------------------------------------------- 1 | :100000008B0A9B0AAB0ABB03E8CB0ADB0AEB0AFBB1 2 | :1000100003E8C303E8D30AE30AF303E81B890A9958 3 | :100020000AA90AB903E8C90AD90AE90AF903E8845E 4 | :100030000A940AA40AB403E8C40AD40AE40AF4033A 5 | :10004000E8850A950AA50AB503E8C50AD50AE50AAE 6 | :10005000F503E86F0A7F03E84F5F810A910AA10A5E 7 | :10006000B103E8C10AD10AE10AF103E811630A7396 8 | :1000700003E84353600A7003E84050196A0A7A03A0 9 | :10008000E84A5A880A980AA80AB803E8C80AD80AA7 10 | :10009000E80AF803E86C0A7C03E84C5C860A960AD6 11 | :1000A000A60AB603E8C60AD60AE60AF603E8CC03AF 12 | :1000B000E8DC0AEC0AFC03E83D8A0A9A0AAA0ABAB2 13 | :1000C00003E8CA0ADA0AEA0AFA03E8363732336979 14 | :1000D0000A7903E84959660A7603E84656680A78B9 15 | :1000E00003E8485805670A7703E84757640A74032A 16 | :1000F000E8445404970AA70AB703E8D70AE70AF7BF 17 | :1001000003E8DD0AED0AFD03E8800A900AA00AB0C0 18 | :1001100003E8C00AD00AE00AF003E88303E8930A80 19 | :10012000A30AB303E810820A920AA20AB203E8C241 20 | :100130000AD20AE20AF203E816176D0A7D03E84DB7 21 | :100140005D710A610A720A620A750A650A7B0A6BA6 22 | :100150000A8C03E89C0AAC0ABC03E809340831CED7 23 | :1001600003E8DE0AEE0AFE03E88E03E89E0AAE0A02 24 | :10017000BE03E8DF0AEF0AFF03E89F0AAF0ABF03E6 25 | :10018000E835303A3C381820FE21FE24FE25FE27B3 26 | :10019000FE2CFE2EFE22FE2FFE23FE2DFE2BFE2623 27 | :1001A000FE28FE29FE2AFE8DFE6E0A7E03E89D0AC9 28 | :1001B000AD0ABD03E8013B393F3E1A0C0E0A0D0F94 29 | :0301C0000B060724 30 | :00000001FF 31 | -------------------------------------------------------------------------------- /test/suite6502.asm: -------------------------------------------------------------------------------- 1 | 2 | ; TEST ADDRESSING MODES 3 | 4 | processor 6502 5 | 6 | org 0 7 | 8 | adc #1 9 | adc 1 10 | adc 1,x 11 | adc 1,y ;absolute 12 | adc 1000 13 | adc 1000,x 14 | adc 1000,y 15 | adc (1,x) 16 | adc (1),y 17 | 18 | and #1 19 | and 1 20 | and 1,x 21 | and 1,y ;absolute 22 | and 1000 23 | and 1000,x 24 | and 1000,y 25 | and (1,x) 26 | and (1),y 27 | 28 | asl 29 | asl 1 30 | asl 1,x 31 | asl 1000 32 | asl 1000,x 33 | 34 | bcc . 35 | bcs . 36 | beq . 37 | bit 1 38 | bit 1000 39 | bmi . 40 | bne . 41 | bpl . 42 | brk 43 | bvc . 44 | bvs . 45 | clc 46 | cld 47 | cli 48 | clv 49 | 50 | cmp #1 51 | cmp 1 52 | cmp 1,x 53 | cmp 1,y ;absolute 54 | cmp 1000 55 | cmp 1000,x 56 | cmp 1000,y 57 | cmp (1,x) 58 | cmp (1),y 59 | 60 | cpx #1 61 | cpx 1 62 | cpx 1000 63 | 64 | cpy #1 65 | cpy 1 66 | cpy 1000 67 | 68 | dec 1 69 | dec 1,x 70 | dec 1000 71 | dec 1000,x 72 | 73 | dex 74 | dey 75 | 76 | eor #1 77 | eor 1 78 | eor 1,x 79 | eor 1,y ;absolute 80 | eor 1000 81 | eor 1000,x 82 | eor 1000,y 83 | eor (1,x) 84 | eor (1),y 85 | 86 | inc 1 87 | inc 1,x 88 | inc 1000 89 | inc 1000,x 90 | 91 | inx 92 | iny 93 | 94 | jmp 1 ;absolute 95 | jmp 1000 96 | jmp (1) ;absolute 97 | jmp (1000) 98 | 99 | jsr 1 ;absolute 100 | jsr 1000 101 | 102 | lda #1 103 | lda 1 104 | lda 1,x 105 | lda 1,y ;absolute 106 | lda 1000 107 | lda 1000,x 108 | lda 1000,y 109 | lda (1,x) 110 | lda (1),y 111 | 112 | ldx #1 113 | ldx 1 114 | ldx 1,y 115 | ldx 1000 116 | ldx 1000,y 117 | 118 | ldy #1 119 | ldy 1 120 | ldy 1,x 121 | ldy 1000 122 | ldy 1000,x 123 | 124 | lsr 125 | lsr 1 126 | lsr 1,x 127 | lsr 1000 128 | lsr 1000,x 129 | 130 | nop 131 | 132 | ora #1 133 | ora 1 134 | ora 1,x 135 | ora 1,y ;absolute 136 | ora 1000 137 | ora 1000,x 138 | ora 1000,y 139 | ora (1,x) 140 | ora (1),y 141 | 142 | pha 143 | php 144 | pla 145 | plp 146 | 147 | rol 148 | rol 1 149 | rol 1,x 150 | rol 1000 151 | rol 1000,x 152 | 153 | ror 154 | ror 1 155 | ror 1,x 156 | ror 1000 157 | ror 1000,x 158 | 159 | rti 160 | rts 161 | 162 | sbc #1 163 | sbc 1 164 | sbc 1,x 165 | sbc 1,y ;absolute 166 | sbc 1000 167 | sbc 1000,x 168 | sbc 1000,y 169 | sbc (1,x) 170 | sbc (1),y 171 | 172 | sec 173 | sed 174 | sei 175 | 176 | sta 1 177 | sta 1,x 178 | sta 1,y ;absolute 179 | sta 1000 180 | sta 1000,x 181 | sta 1000,y 182 | sta (1,x) 183 | sta (1),y 184 | 185 | stx 1 186 | stx 1,y 187 | stx 1000 188 | 189 | sty 1 190 | sty 1,x 191 | sty 1000 192 | 193 | tax 194 | tay 195 | tsx 196 | txa 197 | txs 198 | tya 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /test/suite6502.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/suite6502.bin.ref -------------------------------------------------------------------------------- /test/suite6502.hex.ref: -------------------------------------------------------------------------------- 1 | :100000006901650175017901006DE8037DE80379F7 2 | :10001000E803610171012901250135013901002D34 3 | :10002000E8033DE80339E803210131010A0601161E 4 | :10003000010EE8031EE80390FEB0FEF0FE24012C42 5 | :10004000E80330FED0FE10FE0050FE70FE18D858B7 6 | :10005000B8C901C501D501D90100CDE803DDE80328 7 | :10006000D9E803C101D101E001E401ECE803C001DA 8 | :10007000C401CCE803C601D601CEE803DEE803CA1A 9 | :10008000884901450155015901004DE8035DE80328 10 | :1000900059E80341015101E601F601EEE803FEE8EB 11 | :1000A00003E8C84C01004CE8036C01006CE8032035 12 | :1000B000010020E803A901A501B501B90100ADE8DF 13 | :1000C00003BDE803B9E803A101B101A201A601B68D 14 | :1000D00001AEE803BEE803A001A401B401ACE8034B 15 | :1000E000BCE8034A460156014EE8035EE803EA090C 16 | :1000F00001050115011901000DE8031DE80319E8C8 17 | :100100000301011101480868282A260136012EE85A 18 | :10011000033EE8036A660176016EE8037EE8034069 19 | :1001200060E901E501F501F90100EDE803FDE803EF 20 | :10013000F9E803E101F10138F878850195019901A9 21 | :10014000008DE8039DE80399E80381019101860190 22 | :1001500096018EE803840194018CE803AAA8BA8A68 23 | :020160009A986B 24 | :00000001FF 25 | -------------------------------------------------------------------------------- /test/suite65c02.asm: -------------------------------------------------------------------------------- 1 | 2 | ; TEST ADDRESSING MODES 3 | 4 | processor 65c02 5 | 6 | org 0 7 | 8 | adc #1 9 | adc 1 10 | adc 1,x 11 | adc 1,y ;absolute 12 | adc 1000 13 | adc 1000,x 14 | adc 1000,y 15 | adc (1,x) 16 | adc (1),y 17 | adc (1) 18 | 19 | and #1 20 | and 1 21 | and 1,x 22 | and 1,y ;absolute 23 | and 1000 24 | and 1000,x 25 | and 1000,y 26 | and (1,x) 27 | and (1),y 28 | and (1) 29 | 30 | asl 31 | asl 1 32 | asl 1,x 33 | asl 1000 34 | asl 1000,x 35 | 36 | bcc . 37 | bcs . 38 | beq . 39 | bit #$1 40 | bit 1 41 | bit 1,x 42 | bit 1000 43 | bit 1000,x 44 | bmi . 45 | bne . 46 | bpl . 47 | bra . 48 | brk 49 | bvc . 50 | bvs . 51 | 52 | bbr0 1,. 53 | bbr1 1,. 54 | bbr2 1,. 55 | bbr3 1,. 56 | bbr4 1,. 57 | bbr5 1,. 58 | bbr6 1,. 59 | bbr7 1,. 60 | bbs0 1,. 61 | bbs1 1,. 62 | bbs2 1,. 63 | bbs3 1,. 64 | bbs4 1,. 65 | bbs5 1,. 66 | bbs6 1,. 67 | bbs7 1,. 68 | 69 | clc 70 | cld 71 | cli 72 | clv 73 | 74 | cmp #1 75 | cmp 1 76 | cmp 1,x 77 | cmp 1,y ;absolute 78 | cmp 1000 79 | cmp 1000,x 80 | cmp 1000,y 81 | cmp (1,x) 82 | cmp (1),y 83 | cmp (1) 84 | 85 | cpx #1 86 | cpx 1 87 | cpx 1000 88 | 89 | cpy #1 90 | cpy 1 91 | cpy 1000 92 | 93 | dec 1 94 | dec 1,x 95 | dec 1000 96 | dec 1000,x 97 | 98 | dea 99 | dex 100 | dey 101 | 102 | eor #1 103 | eor 1 104 | eor 1,x 105 | eor 1,y ;absolute 106 | eor 1000 107 | eor 1000,x 108 | eor 1000,y 109 | eor (1,x) 110 | eor (1),y 111 | eor (1) 112 | 113 | inc 1 114 | inc 1,x 115 | inc 1000 116 | inc 1000,x 117 | 118 | ina 119 | inx 120 | iny 121 | 122 | jmp 1 ;absolute 123 | jmp 1000 124 | jmp (1) ;absolute 125 | jmp (1000) 126 | jmp (1000,x) 127 | 128 | jsr 1 ;absolute 129 | jsr 1000 130 | 131 | lda #1 132 | lda 1 133 | lda 1,x 134 | lda 1,y ;absolute 135 | lda 1000 136 | lda 1000,x 137 | lda 1000,y 138 | lda (1,x) 139 | lda (1),y 140 | lda (1) 141 | 142 | ldx #1 143 | ldx 1 144 | ldx 1,y 145 | ldx 1000 146 | ldx 1000,y 147 | 148 | ldy #1 149 | ldy 1 150 | ldy 1,x 151 | ldy 1000 152 | ldy 1000,x 153 | 154 | lsr 155 | lsr 1 156 | lsr 1,x 157 | lsr 1000 158 | lsr 1000,x 159 | 160 | nop 161 | 162 | ora #1 163 | ora 1 164 | ora 1,x 165 | ora 1,y ;absolute 166 | ora 1000 167 | ora 1000,x 168 | ora 1000,y 169 | ora (1,x) 170 | ora (1),y 171 | ora (1) 172 | 173 | pha 174 | php 175 | phx 176 | phy 177 | pla 178 | plp 179 | plx 180 | ply 181 | 182 | rol 183 | rol 1 184 | rol 1,x 185 | rol 1000 186 | rol 1000,x 187 | 188 | ror 189 | ror 1 190 | ror 1,x 191 | ror 1000 192 | ror 1000,x 193 | 194 | rmb0 1 195 | rmb1 1 196 | rmb2 1 197 | rmb3 1 198 | rmb4 1 199 | rmb5 1 200 | rmb6 1 201 | rmb7 1 202 | 203 | rti 204 | rts 205 | 206 | sbc #1 207 | sbc 1 208 | sbc 1,x 209 | sbc 1,y ;absolute 210 | sbc 1000 211 | sbc 1000,x 212 | sbc 1000,y 213 | sbc (1,x) 214 | sbc (1),y 215 | sbc (1) 216 | 217 | sec 218 | sed 219 | sei 220 | 221 | smb0 1 222 | smb1 1 223 | smb2 1 224 | smb3 1 225 | smb4 1 226 | smb5 1 227 | smb6 1 228 | smb7 1 229 | 230 | sta 1 231 | sta 1,x 232 | sta 1,y ;absolute 233 | sta 1000 234 | sta 1000,x 235 | sta 1000,y 236 | sta (1,x) 237 | sta (1),y 238 | sta (1) 239 | 240 | stp 241 | 242 | stx 1 243 | stx 1,y 244 | stx 1000 245 | 246 | sty 1 247 | sty 1,x 248 | sty 1000 249 | 250 | stz 1 251 | stz 1,x 252 | stz 1000 253 | stz 1000,x 254 | 255 | tax 256 | tay 257 | tsx 258 | txa 259 | txs 260 | tya 261 | 262 | trb 1 263 | trb 1000 264 | tsb 1 265 | tsb 1000 266 | 267 | wai 268 | 269 | 270 | -------------------------------------------------------------------------------- /test/suite65c02.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/suite65c02.bin.ref -------------------------------------------------------------------------------- /test/suite65c02.hex.ref: -------------------------------------------------------------------------------- 1 | :100000006901650175017901006DE8037DE80379F7 2 | :10001000E8036101710172012901250135013901EE 3 | :10002000002DE8033DE80339E803210131013201E5 4 | :100030000A060116010EE8031EE80390FEB0FEF06A 5 | :10004000FE8901240134012CE8033CE80330FED092 6 | :10005000FE10FE80FE0050FE70FE0F01FD1F01FD30 7 | :100060002F01FD3F01FD4F01FD5F01FD6F01FD7F90 8 | :1000700001FD8F01FD9F01FDAF01FDBF01FDCF011E 9 | :10008000FDDF01FDEF01FDFF01FD18D858B8C901E2 10 | :10009000C501D501D90100CDE803DDE803D9E803A6 11 | :1000A000C101D101D201E001E401ECE803C001C4C7 12 | :1000B00001CCE803C601D601CEE803DEE8033ACA64 13 | :1000C000884901450155015901004DE8035DE803E8 14 | :1000D00059E803410151015201E601F601EEE8033E 15 | :1000E000FEE8031AE8C84C01004CE8036C01006C00 16 | :1000F000E8037CE80320010020E803A901A501B57D 17 | :1001000001B90100ADE803BDE803B9E803A101B1FD 18 | :1001100001B201A201A601B601AEE803BEE803A048 19 | :1001200001A401B401ACE803BCE8034A460156014E 20 | :100130004EE8035EE803EA09010501150119010013 21 | :100140000DE8031DE80319E803010111011201483C 22 | :1001500008DA5A6828FA7A2A260136012EE8033E80 23 | :10016000E8036A660176016EE8037EE8030701177B 24 | :10017000012701370147015701670177014060E915 25 | :1001800001E501F501F90100EDE803FDE803F9E8F7 26 | :1001900003E101F101F20138F87887019701A70125 27 | :1001A000B701C701D701E701F70185019501990161 28 | :1001B000008DE8039DE80399E80381019101920114 29 | :1001C000DB860196018EE803840194018CE80364C8 30 | :1001D0000174019CE8039EE803AAA8BA8A9A9814BD 31 | :0A01E000011CE80304010CE803CB46 32 | :00000001FF 33 | -------------------------------------------------------------------------------- /test/suite68705.asm: -------------------------------------------------------------------------------- 1 | 2 | processor 68705 3 | 4 | org 0 5 | adc #10 6 | adc 10 7 | adc 1000 8 | adc ,x 9 | adc 1,x 10 | adc 1000,x 11 | add #10 12 | add 10 13 | add 1000 14 | add ,x 15 | add 1,x 16 | add 1000,x 17 | 18 | and #10 19 | and 10 20 | and 1000 21 | and ,x 22 | and 1,x 23 | and 1000,x 24 | 25 | asla 26 | aslx 27 | asl 10 28 | asl ,x 29 | asl 10,x 30 | 31 | asra 32 | asrx 33 | asr 10 34 | asr ,x 35 | asr 10,x 36 | 37 | bcc . 38 | bclr 1,23 39 | bcs . 40 | beq . 41 | bhcc . 42 | bhcs . 43 | bhi . 44 | bhs . 45 | bih . 46 | bil . 47 | 48 | bit #10 49 | bit 10 50 | bit 1000 51 | bit ,x 52 | bit 1,x 53 | bit 1000,x 54 | 55 | blo . 56 | bls . 57 | bmc . 58 | bmi . 59 | bms . 60 | bne . 61 | bpl . 62 | bra . 63 | brn . 64 | brclr 1,10,. 65 | brset 1,10,. 66 | bset 1,10 67 | bsr . 68 | 69 | clc 70 | cli 71 | 72 | clra 73 | clrx 74 | clr 10 75 | clr ,x 76 | clr 10,x 77 | 78 | cmp #10 79 | cmp 10 80 | cmp 1000 81 | cmp ,x 82 | cmp 1,x 83 | cmp 1000,x 84 | 85 | coma 86 | comx 87 | com 10 88 | com ,x 89 | com 10,x 90 | 91 | cpx #10 92 | cpx 10 93 | cpx 1000 94 | cpx ,x 95 | cpx 10,x 96 | cpx 1000,x 97 | 98 | deca 99 | decx 100 | dec 10 101 | dec ,x 102 | dec 10,x 103 | 104 | eor #10 105 | eor 10 106 | eor 1000 107 | eor ,x 108 | eor 10,x 109 | eor 1000,x 110 | 111 | inca 112 | incx 113 | inc 10 114 | inc ,x 115 | inc 10,x 116 | 117 | jmp 10 118 | jmp 1000 119 | jmp ,x 120 | jmp 10,x 121 | jmp 1000,x 122 | 123 | jsr 10 124 | jsr 1000 125 | jsr ,x 126 | jsr 10,x 127 | jsr 1000,x 128 | 129 | lda #10 130 | lda 10 131 | lda 1000 132 | lda ,x 133 | lda 10,x 134 | lda 1000,x 135 | 136 | ldx #10 137 | ldx 10 138 | ldx 1000 139 | ldx ,x 140 | ldx 10,x 141 | ldx 1000,x 142 | 143 | lsla 144 | lslx 145 | lsl 10 146 | lsl ,x 147 | lsl 10,x 148 | 149 | lsra 150 | lsrx 151 | lsr 10 152 | lsr ,x 153 | lsr 10,x 154 | 155 | nega 156 | negx 157 | neg 10 158 | neg ,x 159 | neg 10,x 160 | 161 | nop 162 | 163 | ora #10 164 | ora 10 165 | ora 1000 166 | ora ,x 167 | ora 10,x 168 | ora 1000,x 169 | 170 | rola 171 | rolx 172 | rol 10 173 | rol ,x 174 | rol 10,x 175 | 176 | rora 177 | rorx 178 | ror 10 179 | ror ,x 180 | ror 10,x 181 | 182 | rsp 183 | rti 184 | rts 185 | 186 | sbc #10 187 | sbc 10 188 | sbc 1000 189 | sbc ,x 190 | sbc 10,x 191 | sbc 1000,x 192 | 193 | sec 194 | sei 195 | 196 | sta 10 197 | sta 1000 198 | sta ,x 199 | sta 10,x 200 | sta 1000,x 201 | 202 | stx 10 203 | stx 1000 204 | stx ,x 205 | stx 10,x 206 | stx 1000,x 207 | 208 | sub #10 209 | sub 10 210 | sub 1000 211 | sub ,x 212 | sub 10,x 213 | sub 1000,x 214 | 215 | swi 216 | tax 217 | 218 | tsta 219 | tstx 220 | tst 10 221 | tst ,x 222 | tst 10,x 223 | 224 | txa 225 | 226 | -------------------------------------------------------------------------------- /test/suite68705.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/suite68705.bin.ref -------------------------------------------------------------------------------- /test/suite68705.hex.ref: -------------------------------------------------------------------------------- 1 | :10000000A90AB90AC903E8F9E901D903E8AB0ABBAF 2 | :100010000ACB03E8FBEB01DB03E8A40AB40AC40340 3 | :10002000E8F4E401D403E84858380A78680A4757E6 4 | :10003000370A77670A24FE131725FE27FE28FE29B4 5 | :10004000FE22FE24FE2FFE2EFEA50AB50AC503E8F9 6 | :10005000F5E501D503E825FE23FE2CFE2BFE2DFE43 7 | :1000600026FE2AFE20FE21FE030AFD020AFD120AD8 8 | :10007000ADFE989A4F5F3F0A7F6F0AA10AB10AC18D 9 | :1000800003E8F1E101D103E84353330A73630AA3A0 10 | :100090000AB30AC303E8F3E30AD303E84A5A3A0A65 11 | :1000A0007A6A0AA80AB80AC803E8F8E80AD803E88E 12 | :1000B0004C5C3C0A7C6C0ABC0ACC03E8FCEC0ADC15 13 | :1000C00003E8BD0ACD03E8FDED0ADD03E8A60AB6A4 14 | :1000D0000AC603E8F6E60AD603E8AE0ABE0ACE036D 15 | :1000E000E8FEEE0ADE03E84858380A78680A445405 16 | :1000F000340A74640A4050300A70600A9DAA0ABA31 17 | :100100000ACA03E8FAEA0ADA03E84959390A7969B6 18 | :100110000A4656360A76660A9C8081A20AB20AC24C 19 | :1001200003E8F2E20AD203E8999BB70AC703E8F7AB 20 | :10013000E70AD703E8BF0ACF03E8FFEF0ADF03E8C7 21 | :10014000A00AB00AC003E8F0E00AD003E883974DA4 22 | :070150005D3D0A7D6D0A9F71 23 | :00000001FF 24 | -------------------------------------------------------------------------------- /test/suite68hc11.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/suite68hc11.bin.ref -------------------------------------------------------------------------------- /test/suite68hc11.hex.ref: -------------------------------------------------------------------------------- 1 | :100000001B3A183A89019901B903E8A90118A90115 2 | :10001000C901D901F903E8E90118E9018B019B0144 3 | :10002000BB03E8AB0118AB01CB01DB01FB03E8EB41 4 | :100030000118EB01C303E8D301F303E8E30118E37C 5 | :100040000184019401B403E8A40118A401C401D4FB 6 | :1000500001F403E8E40118E401485878000178034A 7 | :10006000E868011868010547577700017703E867DA 8 | :100070000118670124FE1501111D0122181D01330D 9 | :1000800025FE27FE2CFE2EFE22FE24FE8501950174 10 | :10009000B503E8A50118A501C501D501F503E8E5FB 11 | :1000A0000118E5012FFE25FE23FE2DFE2BFE26FE68 12 | :1000B0002AFE20FE130111FC1F0122FC181F013330 13 | :1000C000FB21FE120111FC1E0122FC181E0133FB54 14 | :1000D0001401111C0122181C01338DFE28FE29FE7B 15 | :1000E000110C0E4F5F7F00017F03E86F01186F0155 16 | :1000F0000A81019101B103E8A10118A101C101D157 17 | :1001000001F103E8E10118E10143537300017303B6 18 | :10011000E863011863011A8300011A8303E81A9344 19 | :10012000011AB303E81AA301CDA3018C00018C03CB 20 | :10013000E89C01BC03E8AC01CDAC01188C000118AF 21 | :100140008C03E8189C0118BC03E81AAC0118AC0138 22 | :10015000194A5A7A00017A03E86A01186A013409D7 23 | :10016000180988019801B803E8A80118A801C80176 24 | :10017000D801F803E8E80118E80103024C5C7C00B0 25 | :10018000017C03E86C01186C01310818087E00013D 26 | :100190007E03E86E01186E019D01BD03E8AD0118F4 27 | :1001A000AD0186019601B603E8A60118A601C601B5 28 | :1001B000D601F603E8E60118E601CC0001CC03E81D 29 | :1001C000DC01FC03E8EC0118EC018E00018E03E871 30 | :1001D0009E01BE03E8AE0118AE01CE0001CE03E8D9 31 | :1001E000DE01FE03E8EE01CDEE0118CE000118CECF 32 | :1001F00003E818DE0118FE03E81AEE0118EE0148C4 33 | :10020000587800017803E8680118680105445474BF 34 | :1002100000017403E86401186401043D405070005B 35 | :10022000017003E86001186001018A019A01BA03B4 36 | :10023000E8AA0118AA01CA01DA01FA03E8EA0118DA 37 | :10024000EA0136373C183C323338183849597900BE 38 | :10025000017903E8690118690146567600017603C1 39 | :10026000E866011866013B391082019201B203E889 40 | :10027000A20118A201C201D201F203E8E20118E2D0 41 | :10028000010D0F0B9701B703E8A70118A701D701CC 42 | :10029000F703E8E70118E701DD01FD03E8ED0118C8 43 | :1002A000ED01CF9F01BF03E8AF0118AF01DF01FFF0 44 | :1002B00003E8EF01CDEF0118DF0118FF03E81AEFA3 45 | :1002C0000118EF0180019001B003E8A00118A0011E 46 | :1002D000C001D001F003E8E00118E00183000183D0 47 | :1002E00003E89301B303E8A30118A3013F1606171F 48 | :1002F00000074D5D7D00017D03E86D01186D013043 49 | :0903000018303518353E8F188FB6 50 | :00000001FF 51 | -------------------------------------------------------------------------------- /test/suite68hc908.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/suite68hc908.bin.ref -------------------------------------------------------------------------------- /test/suite68hc908.hex.ref: -------------------------------------------------------------------------------- 1 | :10FB0000BADC0DE0A906B940E907C9FD7CD90300BC 2 | :10FB1000F99EE9059ED901F4AB06BB40EB07CBFD8E 3 | :10FB20007CDB0300FB9EEB059EDB01F4A705AF0623 4 | :10FB3000A406B440E407C4FD7CD40300F49EE405AD 5 | :10FB40009ED401F438406803789E680548583740D1 6 | :10FB50006703779E670547572467256527632861F4 7 | :10FB6000295F225D245B2F592E57A506B540E50776 8 | :10FB7000C5FD7CD50300F59EE5059ED501F4254124 9 | :10FB8000233F2C3D2B3B2D3926372A35203321317D 10 | :10FB90008100012D0102F90201270302F304012172 11 | :10FBA0000502ED06011B0702E70801150902E10A3B 12 | :10FBB000010F0B02DB0C01090D02D50E01030F0230 13 | :10FBC000CF100111021201130214011502160117C0 14 | :10FBD00002180119021A011B021C011D021E011F3D 15 | :10FBE00002ADAD4120DB3109D8610AD59E610BD150 16 | :10FBF00071CF5140CC989A3F406F037F9E6F054F65 17 | :10FC00008C5FA106B140E107C1FD7CD10300F19EEC 18 | :10FC1000E1059ED101F433406303739E63054353B2 19 | :10FC2000754065FD7CA306B340E307C3FD7CD303A9 20 | :10FC300000F39EE3059ED301F4724BFE3B04FB6B85 21 | :10FC400005F89E6B06F47BF25BF03A406A037A9EFD 22 | :10FC50006A054A5A52426293E192DF91DD90DB8F4E 23 | :10FC60008EA806B840E807C8FD7CD80300F89EE8D7 24 | :10FC7000059ED801F43C406C037C9E6C054C5CBC3A 25 | :10FC800040CCFD7EEC03DC0300FCBD40CDFD7EEDF1 26 | :10FC900003DD0300FDA606B640E607C6FD7CD603DD 27 | :10FCA00000F69EE6059ED601F44501F45540AE37B8 28 | :10FCB000BE40EE07CEFD7CDE0300FE9EEE059EDE1E 29 | :10FCC00001F438406803789E68054858344064035E 30 | :10FCD000749E640544546E05405E404E0A407E406A 31 | :10FCE00030406003709E600540509DAA06BA40EA0D 32 | :10FCF00007CAFD7CDA0300FA9EEA059EDA01F48762 33 | :10FD00008B89868A8839406903799E690549593605 34 | :10FD1000406603769E660546569C80A206B240E287 35 | :10FD200007C2FD7CD20300F29EE2059ED201F49947 36 | :10FD30009BB740E707C7FD7CD70300F79EE7059E0A 37 | :10FD4000D701F43540BF40EF07CFFD7CDF0300FF54 38 | :10FD50009EEF059EDF01F4A006B040E007C0FD7CE9 39 | :10FD6000D00300F09EE0059ED001F4838497948533 40 | :10FD7000953D406D037D9E6D044D5D9F0000FD1A15 41 | :00000001FF 42 | -------------------------------------------------------------------------------- /test/suitef8.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/suitef8.bin.ref -------------------------------------------------------------------------------- /test/suitef8.hex.ref: -------------------------------------------------------------------------------- 1 | :100000008E24F88889C0C1C2C3C4C5C6C7C8C9C9BF 2 | :10001000CACACBCBCCCCCDCDCECED0D1D2D3D4D5F9 3 | :10002000D6D7D8D9D9DADADBDBDCDCDDDDDEDE827F 4 | :10003000FF9CFF91FF92FF98FF94FF81FF90FF8F3D 5 | :10004000FF85FF84FF253F708D182A00022A123495 6 | :100050001A30313233343536373839393A3A3B3B56 7 | :100060003C3C3D3D3E3E1B260226FF1FA0AF291211 8 | :10007000342002776F641619505152535455565715 9 | :100080005859595A5A5B5B5C5C5D5D5E5E4041420B 10 | :1000900043444546474849494A4A4B4B4C4C4D4DD1 11 | :1000A0004E4E000102030405060711110E0E10103A 12 | :1000B0000F0F080809090D0D0A0B1D1D1E1E2181B9 13 | :1000C0008A2BF0F1F2F3F4F5F6F7F8F9F9FAFAFB06 14 | :1000D000FBFCFCFDFDFEFE22808B270227FFB0BF4C 15 | :1000E0002800002812340C1C13151214172C23405E 16 | :1000F0008CE0E1E2E3E4E5E6E7E8E9E9EAEAEBEBF4 17 | :10010000ECECEDEDEEEEECEDEE001234DEADBEEF1C 18 | :10011000001234DEADBEEF001234DEADBEEF0012D1 19 | :1001200034DEADBEEF3333333312341234DEADBEC2 20 | :05013000EFDEADBEEFA3 21 | :00000001FF 22 | -------------------------------------------------------------------------------- /test/supercat.asm: -------------------------------------------------------------------------------- 1 | ; Pretty horrible bug... :-/ Switching to signed instead 2 | ; of unsigned arithmetic made this easier to handle but 3 | ; bad use of .ds can still lead to huge files since DASM 4 | ; doesn't enforce an upper bound yet. And what should it 5 | ; be? Hmm... 6 | ; 7 | ; From "supercat" on the atariage.com forums, forwarded by 8 | ; Andrew Davie 2008/04/12. 9 | ; 10 | ; Peter H. Froehlich 11 | ; phf at acm dot org 12 | 13 | .processor 6502 14 | 15 | .org $7FF8 16 | .byte 1,2,3,4,5 17 | 18 | ; original line by "supercat", would produce huge files 19 | ; since the "-1" result would be interpreted as a huge 20 | ; positive number 21 | .ds $7FFC-* 22 | 23 | ; Peter's line made the problem tractable and revealed 24 | ; the actual bug, checking this with xxd clearly shows 25 | ; the -1 bit pattern 0xffffffff which unsigned is huge. 26 | .long $7FFC-* 27 | 28 | .byte 1,2,3,4,5 29 | 30 | .end 31 | -------------------------------------------------------------------------------- /test/supercat.fail: -------------------------------------------------------------------------------- 1 | 18 -------------------------------------------------------------------------------- /test/toobigbyte.asm: -------------------------------------------------------------------------------- 1 | ; Test case for strict mode check for byte data size 2 | 3 | processor 6502 4 | 5 | ORG $f800 6 | 7 | .byte $100 8 | 9 | -------------------------------------------------------------------------------- /test/toobigbyte.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/toobigword.asm: -------------------------------------------------------------------------------- 1 | ; Test case for strict mode check for word data size 2 | 3 | processor 6502 4 | 5 | ORG $f800 6 | 7 | .word $10000 8 | 9 | -------------------------------------------------------------------------------- /test/toobigword.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/toobigword.bin.ref -------------------------------------------------------------------------------- /test/toobigword.fail: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /test/toobigword.hex.ref: -------------------------------------------------------------------------------- 1 | :02F80000000006 2 | :00000001FF 3 | -------------------------------------------------------------------------------- /test/ucasm_compat.asm: -------------------------------------------------------------------------------- 1 | 2 | .PROCESSOR 68hc908 3 | 4 | FIVE_HUNDRED .EQU 500 5 | 6 | _v@0041 .EQU $0041 ; disassembler generated variable name 7 | 8 | .ORG $FC00 9 | 10 | F_@fc00: ; disassembler detected function label 11 | lda _v@fc1a 12 | sta _v@0041 13 | bne _L@fc11 14 | and 300,X 15 | and [X+300] 16 | adc 300,SP 17 | _L@fc11: ; disassembler detected branch or jump label 18 | adc [SP+FIVE_HUNDRED] 19 | adc [SP+500] 20 | rts 21 | 22 | _v@fc1a: ; disassembler generated variable name 23 | DC.b $0C -------------------------------------------------------------------------------- /test/ucasm_compat.bin.ref: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dasm-assembler/dasm/03239cb6ea2566b9437945451bf613238137a9d5/test/ucasm_compat.bin.ref -------------------------------------------------------------------------------- /test/ucasm_compat.hex.ref: -------------------------------------------------------------------------------- 1 | :10FC0000C6FC1AB741260AD4012CD4012C9ED90176 2 | :0BFC10002C9ED901F49ED901F4810C58 3 | :00000001FF 4 | --------------------------------------------------------------------------------