https://github.com/fredrik-hjarner/fasm68k
fasm68k - Motorola 68000 instruction set for fasmg (flat assembler g)
https://github.com/fredrik-hjarner/fasm68k
assembler assembly fasm68k fasmg instruction-set m68k motorola-68000
Last synced: about 1 year ago
JSON representation
fasm68k - Motorola 68000 instruction set for fasmg (flat assembler g)
- Host: GitHub
- URL: https://github.com/fredrik-hjarner/fasm68k
- Owner: fredrik-hjarner
- Created: 2025-05-04T18:22:39.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-06T19:35:39.000Z (about 1 year ago)
- Last Synced: 2025-05-07T03:15:01.975Z (about 1 year ago)
- Topics: assembler, assembly, fasm68k, fasmg, instruction-set, m68k, motorola-68000
- Language: Assembly
- Homepage:
- Size: 794 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fasm68k - Motorola 68000 instruction set for fasmg (flat assembler g)
**Note**: Consider this to be in alpha stage. Currently supports all 68k
instructions that are validated with about [10,000 tests](https://raw.githubusercontent.com/fredrik-hjarner/fasm68k/refs/heads/master/src/tests/valid_instructions.asm)
but the code might still
contain bugs. If you find bugs then don't hesitate reporting them, since the
hardest part is to find the bugs while it might be way easier to fix them.
## Description
The fasm68k instruction set adds support to assemble assembly code for the
Motorola 68000 cpu with Tomasz Grysztar's fasmg.
[Here](https://github.com/BigEvilCorporation/megadrive_samples/compare/master...fredrik-hjarner:megadrive_samples_fasm68k:master)
you can see what was needed to adapt BigEvilCorporation's megadrive_samples for
fasm68k.
## Usage
Linux
Get fasm68k and it's dependences (i.e. fasmg and examples) by running:
`git clone --recurse-submodules git@github.com:fredrik-hjarner/fasm68k.git`
Step into the repository directory:
`cd fasm68k`
Script must be executable:
`chmod +x fasm68k`
To assemble the examples run these commands and binary files should be created
which you can run in a Mega Drive/Genesis emulator:
`./fasm68k megadrive_samples_fasm68k/1_hello_world/hello.asm`
`./fasm68k megadrive_samples_fasm68k/2_scroll_planes/scroll.asm`
`./fasm68k megadrive_samples_fasm68k/3_sprites/sprites.asm`
`./fasm68k megadrive_samples_fasm68k/4_gamepad/gamepad.asm`
`./fasm68k megadrive_samples_fasm68k/6_psg_tone/psg_tone.asm`
Add a new line at the bottom of your .bashrc file adding the fasm68k directory
to the PATH so you can run fasm68k from anywhere and not only from the specific
folder you cloned it into:
`export PATH=$HOME/code/fasm68k:$PATH`
Windows
TODO
## Differences from other m68k assemblers
- Macros are completely different and it's the main reason for this project to
exist. fasmg's macro langauge is more powerful than the macro languages of other
assemblers. Check out [fasmg's manual](https://flatassembler.net/docs.php?article=fasmg_manual) for more information.
- fasm68k does not support `*` to get the current address. Either use `@` or `$`
instead.
- Some operators are different. While I have added support for `<<` and `>> `for
bit shifting, the preferred way is to use `shl` and `shr`. Likewise try to use
`or` instead of `|` and `and` instead of `&`.
- Binary numbers are written as `01010101b` (instead of `%01010101`).
- You prefix labels with dot `.label1` to make them local (instead of prefixing
with @ `@label1`).
- Currently no optimizations and might be missing some aliases for some
instructions.