Include license info in the executable
This commit is contained in:
parent
e5b42749e5
commit
9b2cd70f4d
5
Makefile
5
Makefile
|
@ -7,7 +7,7 @@ RAREST_WORD = murky
|
||||||
|
|
||||||
all: dosdl.com
|
all: dosdl.com
|
||||||
|
|
||||||
dosdl.com: dosdl.asm dictionary.inc targets.inc
|
dosdl.com: dosdl.asm dictionary.inc targets.inc license.inc
|
||||||
$(NASM) -fbin -o $@ $<
|
$(NASM) -fbin -o $@ $<
|
||||||
|
|
||||||
dictionary.inc: dictionary.json targets.json compress-dict.py
|
dictionary.inc: dictionary.json targets.json compress-dict.py
|
||||||
|
@ -16,6 +16,9 @@ dictionary.inc: dictionary.json targets.json compress-dict.py
|
||||||
targets.inc: targets.json compress-targets.py
|
targets.inc: targets.json compress-targets.py
|
||||||
$(PYTHON) compress-targets.py $< $(RAREST_WORD) $@
|
$(PYTHON) compress-targets.py $< $(RAREST_WORD) $@
|
||||||
|
|
||||||
|
license.inc: LICENSE embed-textfile.py
|
||||||
|
$(PYTHON) embed-textfile.py $< license_str $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.inc *.com
|
rm -f *.inc *.com
|
||||||
|
|
||||||
|
|
20
dosdl.asm
20
dosdl.asm
|
@ -25,7 +25,7 @@ parse_arguments:
|
||||||
|
|
||||||
.leading_spaces_skipped:
|
.leading_spaces_skipped:
|
||||||
|
|
||||||
; See whether we have /h or /u
|
; See whether we have /h, /u, /l, or /?
|
||||||
cmp cx, 2
|
cmp cx, 2
|
||||||
jb .not_mode_option
|
jb .not_mode_option
|
||||||
cmp byte [si], '/'
|
cmp byte [si], '/'
|
||||||
|
@ -62,6 +62,12 @@ parse_arguments:
|
||||||
.option_done:
|
.option_done:
|
||||||
|
|
||||||
.not_ultra_hard_mode:
|
.not_ultra_hard_mode:
|
||||||
|
cmp byte [si + 1], 'l'
|
||||||
|
je print_license
|
||||||
|
|
||||||
|
cmp byte [si + 2], '?'
|
||||||
|
je print_help
|
||||||
|
|
||||||
.not_mode_option:
|
.not_mode_option:
|
||||||
|
|
||||||
test cx, cx
|
test cx, cx
|
||||||
|
@ -74,6 +80,13 @@ print_help:
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
print_license:
|
||||||
|
mov ah, 9
|
||||||
|
mov dx, license_str
|
||||||
|
int 0x21
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
seed_rng_date:
|
seed_rng_date:
|
||||||
; Get date
|
; Get date
|
||||||
mov ah, 0x2a
|
mov ah, 0x2a
|
||||||
|
@ -1039,9 +1052,11 @@ guesses_str db ' guesses.$'
|
||||||
guess_str db ' guess.$'
|
guess_str db ' guess.$'
|
||||||
|
|
||||||
help_str:
|
help_str:
|
||||||
db 'Usage: dosdl [/h | /u]', 13, 10
|
db 'Usage: dosdl [/h | /u | /l | /?]', 13, 10
|
||||||
db '/h Enable hard mode.', 13, 10
|
db '/h Enable hard mode.', 13, 10
|
||||||
db '/u Enable ultra hard mode.', 13, 10
|
db '/u Enable ultra hard mode.', 13, 10
|
||||||
|
db '/l Display license info.', 13, 10
|
||||||
|
db '/? Display this help.', 13, 10
|
||||||
db 13, 10
|
db 13, 10
|
||||||
db 'Hello DOSdl is a word guessing game. You have six tries to guess the correct', 13, 10
|
db 'Hello DOSdl is a word guessing game. You have six tries to guess the correct', 13, 10
|
||||||
db 'English word. After a guess the game displays feedback under each letter:', 13, 10
|
db 'English word. After a guess the game displays feedback under each letter:', 13, 10
|
||||||
|
@ -1061,3 +1076,4 @@ help_str:
|
||||||
|
|
||||||
%include "dictionary.inc"
|
%include "dictionary.inc"
|
||||||
%include "targets.inc"
|
%include "targets.inc"
|
||||||
|
%include "license.inc"
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import sys
|
||||||
|
srcpath = sys.argv[1]
|
||||||
|
name = sys.argv[2]
|
||||||
|
targetpath = sys.argv[3]
|
||||||
|
|
||||||
|
with open(srcpath, 'r') as f:
|
||||||
|
lines = [line.rstrip() for line in f]
|
||||||
|
|
||||||
|
with open(targetpath, 'w') as f:
|
||||||
|
f.write(f'{name}:\n')
|
||||||
|
for line in lines:
|
||||||
|
encoded = line.encode('cp437')
|
||||||
|
if len(encoded) > 0:
|
||||||
|
f.write(f'\tdb {", ".join(str(char) for char in encoded)}, 13, 10\n')
|
||||||
|
else:
|
||||||
|
f.write('\tdb 13, 10\n')
|
||||||
|
f.write("\tdb '$'\n")
|
Loading…
Reference in New Issue