Add ultra hard mode

This commit is contained in:
Juhani Krekelä 2022-02-25 01:40:59 +02:00
parent a90e026623
commit a6adf07fc7
2 changed files with 60 additions and 1 deletions

View File

@ -17,7 +17,6 @@ Missing features
----------------
- Ability to set the seed manually
- Hard and extra hard modes
Word lists
----------

View File

@ -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, '$'