Need in beta-taster`s help
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.
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
It's clear that your emulator has some problems.
Have you ported something or is it written by yourself?
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...
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.
[ 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 ...
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 :
http://mdfs.net/Software/Z80/Exerciser/
It'll more than likely narrow things down.
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)?
It doesnt load. But loading is emulator problem about 50 % times (different programms) as i try do that.
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.)