From a6adf07fc704f3e17f756673b94ddae78bee1473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Fri, 25 Feb 2022 01:40:59 +0200 Subject: [PATCH] Add ultra hard mode --- README.md | 1 - dosdl.asm | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bce613c..edf15ce 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ Missing features ---------------- - Ability to set the seed manually -- Hard and extra hard modes Word lists ---------- diff --git a/dosdl.asm b/dosdl.asm index 91bac69..f42dba8 100644 --- a/dosdl.asm +++ b/dosdl.asm @@ -306,6 +306,51 @@ check_ultra_hard_mode: cmp byte [ultra_hard_mode], 1 jne .done + ; See whether any ruled-out letters were used + xor bp, bp + mov cx, 5 + .ruled_out: + xor bh, bh + mov bl, [guess + bp] + mov ax, bx + mov al, [alphabet + bx - 'a'] + cmp al, ' ' + jne .not_ruled_out + + mov [ruled_out_error_str.letter], bl + mov ax, bp + add al, '1' + mov [ruled_out_error_str.position], al + mov si, ruled_out_error_str + jmp print_error + + .not_ruled_out: + inc bp + loop .ruled_out + + ; See whether wrongly places letters were moved + xor bp, bp + mov cx, 5 + .wrong_places: + mov al, [wrong_places + bp] + test al, al + jz .not_wrong_place + + cmp al, [guess + bp] + jne .moved + + mov [not_moved_error_str.letter], al + mov ax, bp + add ax, '1' + mov [not_moved_error_str.position], al + mov si, not_moved_error_str + jmp print_error + + .moved: + .not_wrong_place: + inc bp + loop .wrong_places + .done: check_dictionary: @@ -953,6 +998,7 @@ exact_hit_error_str: db " must be '" .letter db '#' db "'$" + wrong_place_error_str: db " - letter '" .letter db '#' @@ -960,6 +1006,20 @@ wrong_place_error_str: .position db '#' db ' must be reused$' +not_moved_error_str: + db " - letter '" + .letter db '#' + db "' in position " + .position db '#' + db ' must be moved$' + +ruled_out_error_str: + db " - letter '" + .letter db '#' + db "' in position " + .position db '#' + db ' has been ruled out$' + section .rodata greeting_str db 'Welcome to hello DOSdl. Run `dosdl /?` for help.', 13, 10, '$'