Need in beta-taster`s help

edited February 2011 in Emulators
Hello to all. I have developed hard-soft emulator of ZX Spectrum 48, but there are problems in work. My topics is: http://www.worldofspectrum.org/forums/showthread.php?t=31044 ,
http://zx.pk.ru/showthread.php?t=13747 (russian).
Some games works, but another stops at some point. Basic 48 shows the next problems:
1. from the first time after loading of any loader of the game from the tape it writes "OK" and runs not, waiting for the user`s command. If now print LOAD "" then second time loads normally.
2. If the number must be printed in BASIC, for example, PRINT 2.33 - the hole part prints always 0 or 1. Another part (after decimal) always prints normally.
Anyone who can help enters in the history of developing new clon of ZX Spectrum.
Thank you very mutch.
Post edited by Vasil on

Comments

  • edited February 2011
    Hi there.
    It's clear that your emulator has some problems.
    Have you ported something or is it written by yourself?
  • edited February 2011
    It written by myself.
  • edited February 2011
    Having written a software ZX emulator myself a long time ago (nearly 20 years now!) I can appreciate the pain you're going through. To get to the '(C) 1982 Sinclair Research Ltd' prompt is an achievement in itself. Mine didn't get that far initially!

    PRINT is a complex routine. It needs DAA to work correctly. It also calls some routines which corrupt the ROM (assuming you've not write-protected the ROM area).

    Try CIRCLE 128,88,87 as this tests a lot of the arithmetic instructions. It's easy to single-step through a debugger and is obvious to see when it doesn't work! If you try PRINT PI what comes up on the screen?

    My advice is to set some breakpoints at various places in the ROM and then try using BASIC commands. Simple commands are STOP and BORDER. More complex ones are PLOT and PAPER. Do the same on a proven emulator (such as Fuse or Spin) and compare the Z80 registers on both emulators.

    I advise reading the online ROM disassembly at Geoff Wearmouth's site (here) to find good places to set breakpoints.

    All the above assumes you're experiencing a software problem...
  • edited February 2011
    As i see, Jimmy, you are the one i need. You see my problem as deep as no one.
    I had really rejoiced too when i have seen '(C) 1982 Sinclair Research Ltd'.
    Excuse me about my english (i am russian).
    Print really uses DAA, but i`v made there breakpoint. And when i write PRINT PI it comes not there !!! Becouse the calculated value (last value) in calculator stack is less then 1. In the screen i see 0.1415..... . CIRCLE 128,88,87 works normally. Stop and border normally. You can help me if you can answer how it making calculations, for example, in print 1. Making breakpoints and wotching registers is possible. Full 48 disassembly i have and use, but calculations for me is too hard to understand.
  • edited February 2011
    It can be another way to finde the problem: to use good known program, loading it to ROM. The program must use a lot of different instructions to make test as large as possible. Running it and using breakpoints it may be found a problem.
  • edited February 2011
    I'd recommend getting a copy of Woody's flags test program. It'll point out a whole bunch of errors.

    [ Sorry, not giving a link as I don't know Woody's views on distributing it ]
  • edited February 2011
    I'd recommend getting a copy of Woody's flags test program. It'll point out a whole bunch of errors.

    [ Sorry, not giving a link as I don't know Woody's views on distributing it ]

    There is only way to boot program in my situacion - it is tape. Test program must be WAV or mp3 format ...
  • edited February 2011
    It's a .tap, which is trivially convertable to any sound format you want :-)
  • edited February 2011
    The routine you want to go through is called "PRINT-FP" and is at $2DE3. If you search Geoff's ROM disassembly for L2DE3: you should find it.

    Try the following :

    PRINT 0
    This should work as the routine traps '0' and just does a PRINT CHR$ 48

    PRINT 1
    PRINT 255
    PRINT 256
    PRINT 65535
    These should work as they are held as 16-bit integers instead of floating point.

    PRINT -255
    This should work as the routine PF-NEGTVE does a PRINT CHR$(45) then does a X=ABS(X).

    PRINT 12345678
    This might work - it might help us home in on the problem. It is interesting that the numbers to the left of the decimal point are wrong.

    You might want to verify the following opcodes as they're relatively unused, but do appear in the PRINT routine :
    • RLD ;nybble shift (not RL D)
    • INC (IY+d)
    • RL D
    • CP (IY+d)
    • RST $28
    • JP M,addr
    • JP P,addr
    • NEG
  • edited February 2011
    Try this;

    http://mdfs.net/Software/Z80/Exerciser/

    It'll more than likely narrow things down.
  • edited February 2011
    Thanks very mutch. I have found my mistake: it was not stop-point at DAA, but loop to M1 cycle. Now i have written DAA, digits before decimal hase appeared, but with errors: PRINT 0 brings 0, PRINT 1 brings 1, PRINT 255 brings 1559, PRINT 256 brings 18976.
    DAA i generate through table. It may be errors there. I do not know how DAA changes H flag becous it descripts not in Z80 manual, but basic uses H not.
    ZEXALL loads not at all ...
  • edited February 2011
    Vasil wrote: »
    Thanks very mutch. I have found my mistake: it was not stop-point at DAA, but loop to M1 cycle. Now i have written DAA, digits before decimal hase appeared, but with errors: PRINT 0 brings 0, PRINT 1 brings 1, PRINT 255 brings 1559, PRINT 256 brings 18976.
    DAA i generate through table. It may be errors there. I do not know how DAA changes H flag becous it descripts not in Z80 manual, but basic uses H not.
    ZEXALL loads not at all ...

    Are you saying that ZEXALL doesn't load, or doesn't run (because of emulation problems)?
  • edited February 2011
    thehive wrote: »
    Are you saying that ZEXALL doesn't load, or doesn't run (because of emulation problems)?

    It doesnt load. But loading is emulator problem about 50 % times (different programms) as i try do that.
  • edited February 2011
    Can you post how you've generated your DAA lookup table?
    I would suspect it's not generated correctly.
  • edited February 2011
    thehive wrote: »
    Can you post how you've generated your DAA lookup table?
    I would suspect it's not generated correctly.

    I`ve allready corrected DAA. It is heare: http://dl.dropbox.com/u/12408899/DAA.ZIP
    Now it works normally, but sometimes PRINR 3 for example may bring 0.3 or 3.0.
    eeprom file may be watched using ponyprog programmer.

    DAA i do like this:

    EX27: OUT EEARL,A
    BST F,HH
    BLD F,ZZ
    CBR F,0B11111000
    OUT EEARH,F
    OUT EECR,ONE ;(ONE=0X01 ALWAYS)
    IN A,EEDR
    SBI EEARH,3
    OUT EECR,ONE ;(EQUAL COMAND READ EEPROM)
    IN F,EEDR
    MOV RES,A ;SAVE BITS 3,5,S
    The next M! cycle.
    F is flag register AVR format: I T H S V N Z C (7...0 resp.)
Sign In or Register to comment.