Chonker is a simplistic, yet intricate game coded using Assembly language for the DOS platform. Hardware/software interrupts were used to respond to button presses. In turn those interrupts were used to create an Escape game in Microsoft Macro Assembler (MASM). This was done to understand interrupts and improve my ability to program in assembly. Probably one of the hardest things I have had to conceptualize and code!
Interrupts offer an alternative way of responding to external events in a microprocessor system. The microprocessor can poll for changes in the environment by constantly looking for those changes, or it can wait until a device signals for a change.
BIOS interrupt used to set the video mode of the project.
Hardware interrupt for character presses.
Coding isn't always a smooth journey - it comes with its fair share of frustration, especially when dealing with low-level languages like Assembly. The reason why this type of code is particularly difficult is because it is extremely low-level and typically what a compiler will spit out. Assembly follows a 1:1 ratio, between what the computer is told to do and what it does. This is how computers understand the code you type in your chosen program, and typically is not the easiest to read or understand. This type of code interacts directly with registers and other logic gates behind the scenes.
For a quick glimpse into coding Assembly, check out this video below see how frustrating this coding can be. Not all coding is fun and cool, here is a clip of this game failing.
Feel like diving into the code? The full .ASM file is available here! Below is a snippet of the game code.
.MODEL small
.STACK 100h
.386
; tracking of chonker (only x-position needed)
xpos DB 20h
ypos DB 8h
; 0.1 delay used to draw chonker at cursor position
.code
delay proc
MOV CX, 01h
MOV DX, 86A0h
MOV AH, 86h
INT 15h ; 1 seconds delay
RET
delay ENDP
; sets position of cursor in video
func1 proc
MOV AH, 2
MOV BH, 0
INT 10h
RET
func1 ENDP
;
PUSH DX
PUSH BX
XOR DX, DX
MOV BX, 0Ah
DIV BX
INC DX
MOV AX, DX
POP BX
POP DX
RET
.... more code in repository
…return to projects.ibrahimsaid.ca
or ibrahimsaid.ca
.