Monistode Binutils: A Simple Assembly Language Binutils
Monistode Binutils is a toolset created for the purpose of learning and building a basic assembly language assembler, linker and disassembler. This meta-repo serves as the central hub for Monistode Binutils, allowing you to easily access and use the tool.
Getting Started
You can get started with Monistode Binutils by following these steps:
Installation
You can install Monistode Binutils using pipx, which ensures that it runs in an isolated environment:
pipx install monistode-binutils
Assembling Code
Once you've installed Monistode Binutils, you can assemble your code using the mstas command:
mstas config.yaml your-assembly-file.s output-file.o
Make sure to replace config.yaml, your-assembly-file.s, and output-file.o with the appropriate file names and paths.
Disassembling Code
You can also disassemble code with the mstdas command:
mstdas config.yaml input-file.o
Again, replace config.yaml and input-file.o with the actual configuration and input file you want to disassemble.
Example Assembly Language
Here's an example of a simple assembly language that Monistode Binutils supports:
opcode_length: 6
opcode_offset: 0
text_byte_length: 6
data_byte_length: 8
text_address_size: 16
data_address_size: 16
commands:
- mnemonic: yelp
opcode: !!int 0b1
arguments:
- type: padding
bits: 2
- type: immediate
bits: 16
- mnemonic: jmp
opcode: !!int 0b10
arguments:
- type: padding
bits: 2
- type: text_addr
bits: 16
Example Usage
You can create and assemble an assembly file:
.text
_start:
YELP $512
YELP $2
YELP $43
YELP $17
JMP main + 138
main:
YELP $24
After assembly, you can disassemble it to see the machine code:
Object file:
Parameters:
Opcode size: 6
Text byte: 6
Data byte: 8
Text address: 16
Data address: 16
Sections:
Name: text
Size: 24 entries (18 bytes of disk)
Name: symbol_table
Size: 2 entries (36 bytes of disk)
Name: relocation_table
Size: 1 entries (33 bytes of disk)
.text
_start:
0000: yelp $512 # 000001 000000 001000 000000
0004: yelp $2 # 000001 000000 000000 000010
0008: yelp $43 # 000001 000000 000000 101011
000c: yelp $17 # 000001 000000 000000 010001
0010: jmp main + 138 # 000010 000000 000010 000111
main:
0014: yelp $24 # 000001 000000 000000 011000
.symbol_table
text:00000000 _start
text:00000014 main
.relocation_table
text:00000011 + 2bits (16-bit) text -> main, relative
Metadata
Release files for monistode-binutils 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| monistode_binutils-0.1.10.tar.gz | 1.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| monistode_binutils-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.1 kB
Release files / monistode_binutils-0.1.10.tar.gz
| Download URL | monistode_binutils-0.1.10.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c87771d688cc6e5ebe09a3359c68006a2be52c227002993f425b1889214cb342
|
|
BLAKE2b-256 checksum How to use checksums |
914cfea7e5db0edcb5bb4371ca8c40441779f4973d119e0ce4aaa9980ecab092
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.6 Linux/6.6.2-zen1-1-zen
|
Release files / monistode_binutils-0.1.10-py3-none-any.whl
| Download URL | monistode_binutils-0.1.10-py3-none-any.whl |
|---|---|
| Size | 2.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4a6b14537089530887503f9deb9fa8510013e978c294f933bbbe3e1eb66a4b9
|
|
BLAKE2b-256 checksum How to use checksums |
b80689711f59bdbc1b31f59b0fb226e4a2762e07189bfe7a37a70771ef469836
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.6 Linux/6.6.2-zen1-1-zen
|