Turn into EXE and create Makefile and gitignore

This commit is contained in:
José Carlos Cuevas 2020-06-06 13:47:22 +02:00
parent 87c505b8a8
commit 5cf5824b14
3 changed files with 24 additions and 1 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.com
*.exe

View file

@ -2,3 +2,6 @@ FASM = fasm
mine.exe: mine.asm
$(FASM) $? $@
clean:
-rm *.exe

View file

@ -1,5 +1,17 @@
format MZ ;Specify the
org 100h ;specify .COM file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
COLUMNS = 8
LINES = 8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
start:
; mov al,13h ;AX=0000 at program start
; int 10h ;init mode 13h
@ -32,9 +44,13 @@ mainloop:
mov dword [lastkeypressed], 0h ;Reset the current key as it is not one we are checking
dec al ;if ESC, AL now 0
jnz mainloop ;fall through if 0, jump otherwise
exit:
mov al,03 ;AX=0000 due to mainloop exit condition
int 10h ;Switch back to text mode as a convenience
ret ;.COM files can exit with RET
mov ah,4Ch ;Function to exit, now we are an EXE, do it correctly
mov al,00 ;Exit code as 0, everything went well
int 21h
upkey:
cmp ax, [lastkeypressed]
@ -90,6 +106,8 @@ lalt:
int 21h
jmp mainloop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Data segment
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
lastkeypressed: db 0