Title : Frightmare

Publisher : Cascade Games Ltd

Release Year: 1988

No. Players: 1

Entry Type: Arcade: Action

Machine Type: ZX-Spectrum 48K/128K

Availability: Available

Updated On : May 25, 2020

Roles :
Known Errors: Bugfix provided by pushHL:#
  • The player is supposed to wake up at 7:54 after visiting 79 rooms, but it never happens due to a bug in the dream state routine. At 39% the second word should update to 'vision' but stays the same. It's very lucky that the game doesn't crash at this point which is down to the program reading $ff, one is then added to it to get $00 and this value points to the second word. $00 obviously points to first option of second word which is 'dream' and is why it stays the same. Here's the bug:#
    b102: ld a, (iy+$05) ;first word^b105: inc a          ;move to next word in list^b106: cp $0f         ;gone past last word (nefarious)?^b108: call nc, $b110 ;yes^b10b: ld (iy+$05), a ;no, so preserve word and continue^b10e: jr $b0de^b110: ld a, (ix+$06) ;second word   <----Here is bug should be ld a, (iy+$06)^b113: inc a          ;move to next word in list^b114: cp $07         ;gone past last word (frightmare)?^b116: jr z, $b11d    ;yes^b118: ld (iy+$06), a ;no, so preserve second word,^b11b: xor a          ;set first word to beginning of list and continue^b11c: ret^                     ;player reaches ultimate dream state (nefarious frightmare)^                     ;in normal game this code never runs due to bug^b11d: ld a, $13      ;length =19 (nefariousfrightmare)^b11f: ld (iy+$07), a^b122: ld a, $06      ;set second word to frightmare^b124: ld (iy+$06), a^b127: ld a, $0e      ;set first word to nefarious^b129: ld (iy+$05), a^b12c: ld a, $01      ;disallow any further changes to dream state^b12e: ld ($b0cb), a^                     ;message update^b131: ld de, $5801^b134: ld hl, $5800^b137: ld (hl), $00^b139: ld bc, $003f^b13c: ldir^b13e: call $a6f5^b141: pop ix^b143: ret
    There's also a problem with stack so we need to find two bytes to get the extra POP in. The following patch fixes the problem:#
    org $b110^defb $fd        ;fix original bug, iy not ix^^org $b0f9^defb $32        ;update normal jump (jp $b132)^^org $b11d^dec a           ;a=7 at this point so 1 byte saved here^ld (iy+6),a^ld a,$13^ld (iy+7),a^ld a,$0e^ld (iy+5),a^ld a,1^ld ($b0cb),a^pop ix          ;now lose 2 bytes to clear stack with extra pop^ld de,$5801^ld hl,$5800^ld (hl),l       ;2nd byte saved here
#Modified "BUGFIX" file provided by pushHL (48K version) and Metalbrain (128K version compatible with +2A).