Compare commits

...

2 Commits

Author SHA1 Message Date
Juhani Krekelä e2cbdcaf92 Terminate program on ^C 2022-02-25 01:42:51 +02:00
Juhani Krekelä a6adf07fc7 Add ultra hard mode 2022-02-25 01:40:59 +02:00
2 changed files with 66 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

@ -155,6 +155,9 @@ read_guess:
mov ah, 8
int 0x21
cmp al, 3
je .ctrl_c
cmp al, 8
je .backspace
@ -214,6 +217,9 @@ read_guess:
jmp .loop
.ctrl_c:
ret
.done:
check_hard_mode:
@ -306,6 +312,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 +1004,7 @@ exact_hit_error_str:
db " must be '"
.letter db '#'
db "'$"
wrong_place_error_str:
db " - letter '"
.letter db '#'
@ -960,6 +1012,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, '$'