Files
Assembleur/README.md
2024-12-05 16:20:17 +01:00

1.4 KiB

Assembleur

Usage

./Assembleur [--help] [--reversed] [--version] [--output file] [--format type] file

There are 3 format types :

  • "int" : 32 bits integers are written. Exemple : 10878976
  • "binint" : bits are written. Exemple : 00000000 10100110 00000000 00000000
  • "bin" : the file is written in pure binary
  • "logisim" (default) : the file is written in binary for use in LogiSim

Exemple

operations:
	add R1 R2 #1
	sub R1 R2 R3
	and R1 R2 #33
	xor R1 R2 R3
	or R1 R2 R3
	sl R1 R2 R3
	sr R1 R2 R3
	mul R1 R2 R3
io:
	str R1 R2 R3
	ld R1 R2 R3
sauts:
	jmp controle
	jequ R1 R2 io
	jneq R1 R2 sauts
	jsup R1 R2 operations
	jinf R1 R2 controle
controle:
	call io
	ret

Produces

00000100 10100000 00000000 00000001
00010000 10100110 00000000 00000000
00100100 10100000 00000000 00100001
01000000 10100110 00000000 00000000
00110000 10100110 00000000 00000000
01010000 10100110 00000000 00000000
01100000 10100110 00000000 00000000
01110000 10100110 00000000 00000000
01000001 01001100 00000000 00000000
01010001 01001100 00000000 00000000
11000000 00000000 00000000 00010000
11010001 01000000 00000000 00001001
11100001 01000000 00000000 00001011
11110001 01000000 00000000 00000001
11000001 01000000 00000000 00010000
11010000 00000000 00000000 00001001
11100000 00000000 00000000 00000000

Build

You should have xmake installed

xmake

Run

xmake run