From 5cf5824b1405b49ea3a1bd3fa27ff62d9575f616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Sat, 6 Jun 2020 13:47:22 +0200 Subject: [PATCH] Turn into EXE and create Makefile and gitignore --- .gitignore | 2 ++ Makefile | 3 +++ mine.asm | 20 +++++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2dc4c3a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.com +*.exe diff --git a/Makefile b/Makefile index e8384da..69e65b8 100644 --- a/Makefile +++ b/Makefile @@ -2,3 +2,6 @@ FASM = fasm mine.exe: mine.asm $(FASM) $? $@ + +clean: + -rm *.exe diff --git a/mine.asm b/mine.asm index 58c62c0..4b4ace5 100644 --- a/mine.asm +++ b/mine.asm @@ -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