Let's say that you want to assemble a CoreWars 8086 warrior from source code and you're looking at the bomber.asm or cannon.asm examples. How do you take that text file and make it into a binary that CoreWars will process? You run it through an assembler like nasm.
Here's bomber.asm:

; The simplest 'bomber' survivor.
;
; Bombs the entire arena by writing the byte 0xCC starting with offset 0.
; The above byte was chosen since it specifies a 'bad' opcode (INT3), thus
; hitting another survivor's code would probably kill it.
;
; @note The survivor makes no attempt to avoid bombing itself :)
;
; @author DL
;
;
; 1. initialization
;
mov al, 0CCh ; AL = our bomb data (0xCC, see above)
mov bx, 0 ; BX = starting offset
;
; 2. bombing loop
;
@loop:
mov [bx], al ; write the value in AL to the offset BX points to
inc bx ; advance BX to the next offset
jmp @loop
Then, install the assembler, nasm, or use a computer that already has it installed. If you're on a Mac, you can use HomeBrew to install it. Other options are here. If you're an EECS student at Lassonde, our wonderful tech team has installed nasm on the Linux machines. Then, all you have to do is type
nasm bomber.asm
and the assembler will create a binary file called bomber. Inside are binary values. You can look at that binary data in a "hex editor" like ImHex and it will get interpreted like this:
| Address: | 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 |
| Value: | B0 | CC | BB | 00 | 00 | 88 | 07 | 43 | EB | FB |

You could also go to the CoreWars 8086 online website and type the code into the editor and it will assemble it for you, live. Kind of cool, actually. It would look something like this:

The online simulator will also accept uploads of binary files that you produce using the little green "up" arrow icon. It will then process the binary and disassemble it for you on the screen.

James Andrew Smith is a Professional Engineer and Associate Professor in the Electrical Engineering and Computer Science Department of York University’s Lassonde School, with degrees in Electrical and Mechanical Engineering from the University of Alberta and McGill University. Previously a program director in biomedical engineering, his research background spans robotics, locomotion, human birth, music and engineering education. While on sabbatical in 2018-19 with his wife and kids he lived in Strasbourg, France and he taught at the INSA Strasbourg and Hochschule Karlsruhe and wrote about his personal and professional perspectives. James is a proponent of using social media to advocate for justice, equity, diversity and inclusion as well as evidence-based applications of research in the public sphere. You can find him on Twitter. You can find him on BlueSky. Originally from Québec City, he now lives in Toronto, Canada.
