Compare commits
No commits in common. 'main' and '0.6.0' have entirely different histories.
20 changed files with 256 additions and 500 deletions
@ -0,0 +1,113 @@ |
|||||||
|
; Compresses the current guess to the same format as the dictionary |
||||||
|
; <- bc |
||||||
|
; <- de |
||||||
|
compress_guess: |
||||||
|
call get_guess_offset |
||||||
|
|
||||||
|
; first byte |
||||||
|
ld a, [hl+] ; letter 1 |
||||||
|
and %00111111 |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
ld b, a |
||||||
|
ld a, [hl] ; letter 2 |
||||||
|
and %00110000 |
||||||
|
sra a |
||||||
|
sra a |
||||||
|
sra a |
||||||
|
sra a |
||||||
|
add a, b |
||||||
|
ld d, a |
||||||
|
|
||||||
|
; second byte |
||||||
|
ld a, [hl+] ; letter 2 |
||||||
|
and %00001111 |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
ld b, a |
||||||
|
ld a, [hl] ; letter 3 |
||||||
|
and %00111100 |
||||||
|
sra a |
||||||
|
sra a |
||||||
|
add a, b |
||||||
|
ld e, a |
||||||
|
push de |
||||||
|
|
||||||
|
; third byte |
||||||
|
ld a, [hl+] ; letter 3 |
||||||
|
and %00000011 |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
ld b, a |
||||||
|
ld a, [hl+] ; letter 4 |
||||||
|
and %00111111 |
||||||
|
add a, b |
||||||
|
ld d, a |
||||||
|
|
||||||
|
; fourth byte |
||||||
|
ld a, [hl] ; letter 5 |
||||||
|
and %00111111 |
||||||
|
sla a |
||||||
|
sla a |
||||||
|
ld e, a |
||||||
|
pop bc |
||||||
|
ret |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Try to find the guess within the dictionary |
||||||
|
; -> bc |
||||||
|
; -> de |
||||||
|
; <- a |
||||||
|
find_guess: |
||||||
|
ld hl, dictionary |
||||||
|
|
||||||
|
.loop: |
||||||
|
; check if the end of the dictionary is reached |
||||||
|
push bc |
||||||
|
ld bc, dictionary_end |
||||||
|
ld a, h |
||||||
|
cp a, b |
||||||
|
jp nz, .not_eof |
||||||
|
ld a, l |
||||||
|
cp a, c |
||||||
|
jp nz, .not_eof |
||||||
|
pop bc |
||||||
|
jp .return |
||||||
|
|
||||||
|
.not_eof: |
||||||
|
pop bc |
||||||
|
|
||||||
|
ld a, [hl+] |
||||||
|
cp a, b |
||||||
|
jp nz, .add3 |
||||||
|
ld a, [hl+] |
||||||
|
cp a, c |
||||||
|
jp nz, .add2 |
||||||
|
ld a, [hl+] |
||||||
|
cp a, d |
||||||
|
jp nz, .add1 |
||||||
|
ld a, [hl+] |
||||||
|
cp a, e |
||||||
|
jp nz, .add0 |
||||||
|
ld a, 1 |
||||||
|
ret |
||||||
|
|
||||||
|
.add3: |
||||||
|
inc hl |
||||||
|
.add2: |
||||||
|
inc hl |
||||||
|
.add1: |
||||||
|
inc hl |
||||||
|
.add0: |
||||||
|
jp .loop |
||||||
|
.return: |
||||||
|
ld a, 0 |
||||||
|
ret |
||||||
|
|
@ -1,6 +1,6 @@ |
|||||||
; Window map while within help |
; Window map while within help |
||||||
|
DB $1b,$1b,$13,$14,$01,$12,$14,$1b,$1b,$0e,$05,$17,$1b,$07,$01,$0d,$05,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b |
||||||
|
DB $1b,$1b,$13,$05,$0c,$05,$03,$14,$1b,$03,$08,$05,$03,$0b,$1b,$17,$0f,$12,$04,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b |
||||||
|
DB $1b,$1b,$02,$22,$01,$1b,$1b,$1b,$1b,$04,$05,$22,$13,$05,$0c,$05,$03,$14,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b |
||||||
DB $1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b |
DB $1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b |
||||||
DB $1b,$1b,$13,$14,$01,$12,$14,$1b,$22,$0e,$05,$17,$1b,$07,$01,$0d,$05,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b |
|
||||||
DB $1b,$1b,$13,$05,$0c,$05,$03,$14,$22,$03,$08,$05,$03,$0b,$1b,$17,$0f,$12,$04,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b |
|
||||||
DB $1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b |
|
||||||
DB $1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b,$1b |
|
||||||
|
@ -1,17 +0,0 @@ |
|||||||
; Slash |
|
||||||
DB %00000000, \ |
|
||||||
%00000000, \ |
|
||||||
%00000000, \ |
|
||||||
%00000000, \ |
|
||||||
%00001000, \ |
|
||||||
%00001000, \ |
|
||||||
%00000100, \ |
|
||||||
%00000100, \ |
|
||||||
%01111110, \ |
|
||||||
%01111110, \ |
|
||||||
%00000100, \ |
|
||||||
%00000100, \ |
|
||||||
%00001000, \ |
|
||||||
%00001000, \ |
|
||||||
%00000000, \ |
|
||||||
%00000000 |
|
@ -0,0 +1,17 @@ |
|||||||
|
; Slash |
||||||
|
DB %00000000, \ |
||||||
|
%00000000, \ |
||||||
|
%00000010, \ |
||||||
|
%00000010, \ |
||||||
|
%00000100, \ |
||||||
|
%00000100, \ |
||||||
|
%00001000, \ |
||||||
|
%00001000, \ |
||||||
|
%00010000, \ |
||||||
|
%00010000, \ |
||||||
|
%00100000, \ |
||||||
|
%00100000, \ |
||||||
|
%01000000, \ |
||||||
|
%01000000, \ |
||||||
|
%10000000, \ |
||||||
|
%10000000, \ |
Binary file not shown.
Loading…
Reference in new issue