Menu

#337 tape hooks to check CARRY flag

v1.2
closed-accepted
nobody
None
5
2016-06-06
2015-07-04
ub880d
No

tape hooks don't check CARRY flag to be set for LOAD and cleared for VERIFY. result is when VERIFY is requested, LOAD is performed instead.

test tap http://sindik.at/~ub880d/tmp/loadtest.tap , code is:

    cpu z80undoc
    relaxed on

    org 32768
    xor a
    ld  ix,0x4000
    ld  de,0x1b00
    ld  a,255
;    scf                ;scf for load, no carry for verify
    call    0x556
    ret

this program shouldn't load headless screen (included in the tap). but fuse with enabled tape traps loads it.

1 Attachments

Related

Bugs: #352
Patches: #337
Wiki: Fuse 1.2 Release Plan

Discussion

  • Fredrick Meunier

    Thanks, applied in [r5311].

     

    Related

    Commit: [r5311]

  • Fredrick Meunier

    • status: open --> pending-accepted
    • Group: future --> v1.2
     
  • Fredrick Meunier

    On fuse-emulator-devel, Alberto Garcia reports a problem with this patch:

    On Wed, Jun 01, 2016 at 03:33:16PM +0200, Alberto Garcia wrote:

    I cannot load LoneWolf-TheMirrorOfDeath128.tap.zip using the new
    Fuse (the loading screen does not even show up). With Fuse 1.1.1 it
    works fine.

    http://www.worldofspectrum.org/infoseekid.cgi?id=0002920

    Here's the cause of this problem:

    20150704 tape.c: skip tape traps if VERIFY is requested (patch #337) (UB880D).

    The TZX version is also problematic, but Fuse 1.1.1 was having
    issues with that one too.

    Actually it seems that I cannot load this one at all, not even with
    --no-detect-loader --no-auto-load --no-traps --no-fastload
    --no-accelerate-loader

    Interestingly enough, if I convert the .tzx to a .tap file (with all
    the "conversion may well not work" warnings) then I can load it just
    fine (with both 1.1.1 and 1.2).

     

    Last edit: Fredrick Meunier 2016-06-02
  • Fredrick Meunier

    Thanks to Berto's report, I've had another look at this change and I believe we are being caught by a longstanding bug introduced in 2004 with [patches:#41] Fix up registers on tape load trap in [r2137].

    trap_load_block() was already intended to cover the verify case so [patches:#337] should not have been required, but [patches:#41] added the line

    AF_ = 0x0145;
    

    which hardcodes the value of the verify flag (the C flag in the F' register) before it is later tested for verify behaviour.

    The attached patch fix_verify_with_tape_traps.patch removes tape_traps_verify.diff and restores the older verify detection code.

    This keeps loadtest.tap working with the verify being done by the tape trap but isn't enough alone to sort out what's going on with Lone Wolf 3.

    The Lone Wolf 3 tap looks broken to me - it seems to set the verify flag for several of the blocks which won't load under any situation. My guess is that this tap has been preparared and only tested by using it with systems that shortcut loading for tap blocks like emulator traps or ESXDOS TAP loading etc.

    The Lone Wolf 3 tzx on the other hand seems to have problematic encoding. Doing some experiments changing its encoding to pzx I can get it to load (only tested without accelleration), but I will need to do some more tests to work out what exactly is the difference between the broken tzx and working pzx versions I have in order to decide whether that is resolvable with a Fuse patch. My gut feel is that this will boil down to a problem with the tzx encoding of Lone Wolf 3 rather than Fuse.

     

    Related

    Commit: [r2137]
    Patches: #337
    Patches: #41

    • ub880d

      ub880d - 2016-06-02

      Answer for tap file is here:

      0xFDB4 DD 21 1C FB  LD      IX,0xFB1C
      0xFDB8 21 15 00     LD      HL,0x0015
      0xFDBB 3E 36        LD      A,0x36
      0xFDBD 37           SCF     
      0xFDBE CD C4 FC     CALL    0xFCC4
      
      ===
      
      0xFE07 DD 2A 5B FB  LD      IX,(0xFB5B)
      0xFE0B 2A 2D FB     LD      HL,(0xFB2D)
      0xFE0E 3E 69        LD      A,0x69
      0xFE10 B7           OR      A
      0xFE11 CD C4 FC     CALL    0xFCC4
      
      ===
      
      0xFCC4 ED 73 05 FB  LD      (0xFB05),SP
      0xFCC8 E5           PUSH    HL
      0xFCC9 F5           PUSH    AF
      0xFCCA 01 19 00     LD      BC,0x0019
      0xFCCD CD 11 FF     CALL    0xFF11
      0xFCD0 CD 07 FD     CALL    0xFD07
      0xFCD3 D9           EXX     
      0xFCD4 21 FF FF     LD      HL,0xFFFF
      0xFCD7 F1           POP     AF
      0xFCD8 E1           POP     HL
      0xFCD9 C3 FF FC     JP      0xFCFF
      
      ===
      
      0xFF11 32 59 FB     LD      (0xFB59),A
      0xFF14 F3           DI      
      0xFF15 C9           RET     
      
      ===
      
      0xFD07 54           LD      D,H
      0xFD08 5D           LD      E,L
      0xFD09 CD 56 05     CALL    0x0556
      0xFD0C F3           DI      
      0xFD0D ED 7B 05 FB  LD      SP,(0xFB05)
      0xFD11 C9           RET     
      

      first "call 0xfcc4" is to load header, second to load data of block, but there is "or a" at 0xFE10, so carry is reset. changing the instruction to "scf" game loads correctly.

       

      Last edit: ub880d 2016-06-02
    • Alberto Garcia

      Alberto Garcia - 2016-06-04

      The Lone Wolf 3 tap looks broken to me - it seems to set the verify flag for several of the blocks which won't load under any situation.

      How come it is working with Fuse 1.1.1 then ? :-? I'm still unable to load it with the latest trunk.

       
      • ub880d

        ub880d - 2016-06-04

        Alberto, it is not a bug that you cannot load the tape. The bug is if you can load the tap.

        I already posted my analysis of the loader code in the tap.

        If you disable the tape traps in emulator it is not possible to load the tape even in 1.1.1 (which is correct behavior).

         

        Last edit: ub880d 2016-06-04
        • Alberto Garcia

          Alberto Garcia - 2016-06-04

          Ah sorry, you're right!

           
  • Fredrick Meunier

    • status: pending-accepted --> open
     
  • Fredrick Meunier

    Comitted fix_verify_with_tape_traps.patch in [r5586] and [r5587].

     

    Related

    Commit: [r5586]
    Commit: [r5587]

  • Fredrick Meunier

    • status: open --> pending-accepted
     
  • Fredrick Meunier

    Following up on the tzx issues in [bugs:#352] Problems loading Lone Wolf 3 - The Mirror of Death.tzx as they seem to be separate.

     

    Related

    Bugs: #352

  • Fredrick Meunier

    • status: pending-accepted --> closed-accepted
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.