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stack
+cli
+mov sp, stack + 0x100
+sti
+
+;Check for an empty tail
+;Check
+cmp byte [si], 0x0
+jne extract
+;Print an error message and abort if the tail is empty
+mov si, errormsg
+mov ah, 0x2
+int 0x21
+je done
+
+;Find the end of the data file name and add a null if needed
+;Set DI at the tail
+extract:
+mov di, si
+findend:
+;Check for the string end
+cmp byte [di], 0x0
+je load
+;Check for a space
+cmp byte [di], 0x20
+je addnull
+inc di
+jmp findend
+;Add a null
+addnull:
+mov al, 0x0
+stosb
+
+;Load the data file
+;Load
+load:
+mov bx, stack + 0x100
+mov ah, 0x0
+int 0x22
+;Check for errors
+cmp al, 0x0
+jne done
+
+;Setup
+start:
+;Set SI to the beginning of the data file
+mov si, stack + 0x100
+;Initialise the scene ID with zeroes and set DI at its beginning
+mov di, sceneid
+mov cx, 0xff
+mov al, 0x0
+rep stosb
+mov di, sceneid
+
+;Intro
+;Print the intro
+mov ah, 0x0
+int 0x21
+;Read any key to start
+mov ah, 0x0
+int 0x16
+call readquit
+;Set the ID of the first scene
+mov al, "0"
+stosb
+
+;Search for the current scene
+searchscene:
+lodsb
+cmp al, 0x1
+je checkscene
+jmp searchscene
+
+;Check for the current scene
+;Set DI to the current scene id
+checkscene:
+mov di, sceneid
+;Load the current characters
+checkloop:
+mov al, [si]
+mov bl, [di]
+;Compare the characters
+cmp al, bl
+jne searchscene
+;Check for the string end
+cmp al, 0x0
+je loadoptions
+;Compare the next characters
+inc si
+inc di
+jmp checkloop
+
+;Load the number of options to BL
+loadoptions:
+inc si
+lodsb
+mov bl, al
+
+;Print the scene
+;Move SI to the beginning of the scene text
+inc si
+;Print the scene
+mov ah, 0x0
+int 0x21
+
+;Read the player choice
+;Set DI at the options key
+readchoice:
+mov di, options
+;Set the maximum number of options
+mov cx, 0x9
+;Read a keypress
+mov ah, 0x0
+int 0x16
+;Check for quitting
+call readquit
+;Check for an ending scene
+cmp bl, "0"
+je ending
+;Compare the keypress to the key
+cmpchoice:
+cmp al, [di]
+je setscene
+cmp bl, [di]
+je readchoice
+inc di
+loop cmpchoice
+jmp readchoice
+
+;Set the next scene
+;Find the end of the current scene id
+setscene:
+mov di, sceneid
+findidend:
+cmp byte [di], 0x0
+je addoption
+inc di
+jmp findidend
+;Add the chosen option
+addoption:
+stosb
+;Go to the next scene
+jmp searchscene
+
+ending:
+mov si, crlf
+mov ah, 0x0
+int 0x21
+jmp start
+
+;Return to the system
+done:
+int 0x20
+
+;Data
+errormsg db "File not found", 0x0
+sceneid times 0xff db 0x0
+options db "123456789"
+crlf db 0xd, 0xa, 0x0
+
+;***
+
+;Quit the game
+readquit:
+
+;Check for keypress escape
+cmp al, 0x1b
+je done
+
+;Return
+ret
+
+;***
+
+;Stack
+stack:
diff --git a/make.sh b/make.sh
index 4328fea..c200260 100755
--- a/make.sh
+++ b/make.sh
@@ -24,3 +24,9 @@ nasm TEMPLE.ASM -f bin -o TEMPLE.BIN
zip -r TEMPLE.ZIP TEMPLE.BIN TEMPLE.ASM README.MD LICENSE.MD 1>/dev/null
mv TEMPLE.ZIP ..
cd ..
+
+cd TEMPLENG/
+nasm TEMPLENG.ASM -f bin -o TEMPLENG.BIN
+zip -r TEMPLENG.ZIP TEMPLENG.BIN TEMPLENG.ASM README.MD LICENSE.MD TEMPLE.DAT 1>/dev/null
+mv TEMPLENG.ZIP ..
+cd ..