First commit

This commit is contained in:
Juhani Krekelä 2022-02-23 00:38:06 +02:00
commit 25f04d9a1c
9 changed files with 220796 additions and 0 deletions

2
.gitignore vendored Normal file
View File

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

20
LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright (c) 2022 Lynn
Copyright (c) 2022 Juhani 'nortti' Krekelä
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

20
Makefile Normal file
View File

@ -0,0 +1,20 @@
NASM ?= nasm
PYTHON ?= python
all: dosdl.com
dosdl.com: dosdl.asm dictionary.inc targets.inc
$(NASM) -fbin -o $@ $<
dictionary.inc: dictionary.json compress-dict.py
$(PYTHON) compress-dict.py $< $@
targets.inc: targets.json compress-targets.py
$(PYTHON) compress-targets.py $< $@
clean:
rm -f *.inc *.com
distclean: clean
.PHONY: all clean distclean

15
README.md Normal file
View File

@ -0,0 +1,15 @@
hello DOSdl
===========
Hello DOSdl is a variant of Wordle / hello wordl for MS-DOS running on IBM PC
compatible systems.
Word lists
----------
The words lists are taken from
[hello wordl](https://github.com/lynn/hello-wordl) and are identical as of
2022-02-02, to allow cross-play between hello DOSdl and hello wordl. See the
link for further details.
Licensing
---------
Hello DOSdl is free software under the MIT license. See LICENSE for details.

36
compress-dict.py Normal file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env python
import json
import sys
alphabet = 'abcdefghijklmnopqrstuvwxyz'
srcpath = sys.argv[1]
targetpath = sys.argv[2]
with open(srcpath, 'r') as f:
words = json.load(f)
# We only care about 5-letter words
words = [word for word in words if len(word) == 5]
# Split dictionary into per-startletter arrays
arrays = {letter: [] for letter in alphabet}
for word in words:
assert word[0] in alphabet
number = 0
# First letter is implicit
for index, letter in enumerate(word[1:]):
number += alphabet.index(letter) << (5 * index)
packed = bytes([number & 0xff, (number >> 8) & 0xff, number >> 16])
arrays[word[0]].append(packed)
with open(targetpath, 'w') as f:
for startletter, array in arrays.items():
f.write(f'dictionary_{startletter}:\n')
for packed in array:
f.write(f'\tdb {", ".join(str(byte) for byte in packed)}\n')
f.write('\n')
f.write('dictionaries:\n')
for startletter in arrays:
f.write(f'\tdw dictionary_{startletter}\n')

27
compress-targets.py Normal file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python
import json
import sys
alphabet = 'abcdefghijklmnopqrstuvwxyz*'
srcpath = sys.argv[1]
targetpath = sys.argv[2]
with open(srcpath, 'r') as f:
words = json.load(f)
# We only care about 5-letter words
words = [word for word in words if len(word) == 5]
array = []
for word in words:
number = 0
for index, letter in enumerate(word):
number += alphabet.index(letter) << (5 * index)
packed = bytes([number & 0xff, (number >> 8) & 0xff, (number >> 16) & 0xff, number >> 24])
array.append(packed)
with open(targetpath, 'w') as f:
f.write('tagets:\n')
for packed in array:
f.write(f'\tdb {", ".join(str(byte) for byte in packed)}\n')

182721
dictionary.json Normal file

File diff suppressed because it is too large Load Diff

6
dosdl.asm Normal file
View File

@ -0,0 +1,6 @@
org 0x100
ret
%include "dictionary.inc"
%include "targets.inc"

37949
targets.json Normal file

File diff suppressed because it is too large Load Diff