ZX81 emulator for iOS
Re: ZX81 emulator for iOS
same for the microdigital tk85.
- 1024MAK
- Posts: 5341
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: ZX81 emulator for iOS
Err, the Timex "ULA" directly controls the DRAM chips /RAS, /CAS and /WR control lines... and a buffer chip is used to isolate the lower address bus, unlike a Sinclair ZX81 (where resistors are used). The buffer is directly controlled by the Timex ULA as well...gozzo wrote:the ts 1500 uses dynamic rams so i suppose it would need similar mod as the rampacks..
So if a standard TS1500 at the hardware level is not capable of hi-res using the on board RAM, I'm not sure if a simple mod exists.
Further, apparently a different ROM is fitted, so the I register pointer needs adjusting.
Mark
It's late, so I blame any errors on cosmic radiation and not the cider and tiredness
Last edited by 1024MAK on Tue Dec 27, 2016 6:20 pm, edited 1 time in total.
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Autumn is here. Bye bye summer 2024...
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Autumn is here. Bye bye summer 2024...
Re: ZX81 emulator for iOS
Apart from 1024MAK technical details.kpalser wrote:Thank you for all your efforts!dr beep wrote:Well, Kevin. Time is on your site.
We played games and I found some time to finish the texting and files.
Now in your mail.
Not only the 1K games, but also SHOGUN, My first ZX81 program, added.
Fun part: since spring there is a SHOGUN-app for download, but my AI is better and the game will be free.
Time to admit to arrogance in an assumption on my part. Whilst I'd seen YouTube videos of your games, today was the first time I ran them on the app emulator core. I understood that 16K WRX programs need a hardware modification in the RAM pack (is that true of TS1500?) but 1K WRX could work on unmodified ZX81s. Hence, my assumption that 1K WRX would just work with the app. Something is off in my code - it was written independently of other ZX81 emulators based on studying the various online sources documenting the hardware and has run fine with everything that I had thrown at it. That is up to now.
Subsequently, I have fired up EightyOne on a PC emulator (being a Mac user) and saw the same behaviour when WRX is not turned on. I've just been consulting the EightyOne source code, in particular the "BYTE zx81_opcode_fetch(int Address)" function to see how it handles the WRX option. It's structured quite differently from my code.
My focus in the short term has changed to fixing the WRX shortcoming in the app so that I can include your games.
On EightyOne you need to turn on WRX too.
So I assume that the programs should run when WRX is emulated.
The displaymethod always follows this method.
If Wilf Rigters 1K hires demo works, then all my programs should too.
Re: ZX81 emulator for iOS
In fact is quite easy.
When in screendisplay:
Execute opcodes as normal except,
When uppermemory is called:
Check In lowermemory
If bit 6 is set: execute the opcode in lowermemory with number of tstates, R increase according command
Else
If bit 7 is set : display content of address in I and R (high /lowbyte) inverted, 4 tstates R increase as NOP
If bit is not set : diplay content of address in I and R, 4 tstates, R increase as NOP
When in screendisplay:
Execute opcodes as normal except,
When uppermemory is called:
Check In lowermemory
If bit 6 is set: execute the opcode in lowermemory with number of tstates, R increase according command
Else
If bit 7 is set : display content of address in I and R (high /lowbyte) inverted, 4 tstates R increase as NOP
If bit is not set : diplay content of address in I and R, 4 tstates, R increase as NOP
Re: ZX81 emulator for iOS
OK I have the WRX code working in a fashion thanks to comparisons with the EightyOne code.
My primary objective was to get the code to work without having a WRX switch, unlike EightyOne, when only 1k & 2k (unexpanded). And then later have a modified WRX option for the 16k configuration to turn it on and off as being none standard. I currently have three issues below. Could one of you fine fellows please educate/correct me on the first point?
1) I don't like adding code that I don't fully understand. See below - "if Z80CPU.I >= 32 { romAddress = (UInt16(Z80CPU.I) << 8) | UInt16(Z80CPU.R) } else " is new. The else clause was my original code version. What is the significance of the 32 ("zx81.maxireg" constant in EightyOne)? Seems hacky. Does the I register value really influence switching to "(I << 8) | R" instead of "(I << 8) | (readByte & 63) << 3 | lineControl"? I was comfortable with latter and suddenly the former is thrown into the mix which seems arbitrary. That the I register value would effect what was shown on the address lines.
2) Setting aside the future WRX option for the 16k configuration to turn it on and off is yet to be implemented (i.e. WRX is turned on all the time), it only works on my emulator when the 16k RAM setting is on. I need to investigate more.
3) Some rolling on the "Blocky" game - looks like I need to tweak some of my magic CRT constants.
My swift code follows. Notes on Swift:
Thanks,
Kevin
My primary objective was to get the code to work without having a WRX switch, unlike EightyOne, when only 1k & 2k (unexpanded). And then later have a modified WRX option for the 16k configuration to turn it on and off as being none standard. I currently have three issues below. Could one of you fine fellows please educate/correct me on the first point?
1) I don't like adding code that I don't fully understand. See below - "if Z80CPU.I >= 32 { romAddress = (UInt16(Z80CPU.I) << 8) | UInt16(Z80CPU.R) } else " is new. The else clause was my original code version. What is the significance of the 32 ("zx81.maxireg" constant in EightyOne)? Seems hacky. Does the I register value really influence switching to "(I << 8) | R" instead of "(I << 8) | (readByte & 63) << 3 | lineControl"? I was comfortable with latter and suddenly the former is thrown into the mix which seems arbitrary. That the I register value would effect what was shown on the address lines.
2) Setting aside the future WRX option for the 16k configuration to turn it on and off is yet to be implemented (i.e. WRX is turned on all the time), it only works on my emulator when the 16k RAM setting is on. I need to investigate more.
3) Some rolling on the "Blocky" game - looks like I need to tweak some of my magic CRT constants.
My swift code follows. Notes on Swift:
- "&+" just means "+" without reporting overflow as an error (also faster to execute).
- in conditions zero values do not equate to false, hence "== 0" is required.
Code: Select all
final func readM1CycleZ80(fromAddress address: UInt16) -> UInt8 {
// Memory Map:
// 0-8K BASIC ROM.
// 8-16K Shadow of BASIC ROM. Can be disabled by 64K RAM pack.
// 16K-17K Area occupied by 1K of onboard RAM. Disabled by RAM packs.
// 16K-32K Area occupied by 16K RAM pack.
// 8K-64K Area occupied by 64K RAM pack.
// use memoryPointer instead of "memory[Int(address)]" to avoid performance
// penalties of bounds checking
// take into account the address line
if (address & 0x8000) == 0 {
return memoryPointer.advanced(by: Int(address)).pointee
} else {
// simulate the address lines pointing to a memory
// address before 32768
let readByte: UInt8 = memoryPointer.advanced(by: Int((address & 16383) &+ 16384)).pointee
// "The hardware in the ZX81 ULA takes control when any opcode
// is executed above 32K (A15 high and M1 low) with data bit 6
// equal to zero."
if (readByte & 64) == 0 {
if !sendingSyncSignal {
processConsumedCPUCycles()
let romAddress: UInt16
// generate the adress to the 8bit scanline pattern in the ROM
if Z80CPU.I >= 32 { // <- new for WRX
// WRX
// I register + R
romAddress = (UInt16(Z80CPU.I) << 8) | UInt16(Z80CPU.R) // <- new for WRX
} else {
// A9-A15 (I register), A3-A8 (ULA 6 bit character code), A0-A2 (ULA MODULO)
romAddress = (UInt16(Z80CPU.I) << 8) | (UInt16(readByte & 63) << 3) | UInt16(lineControl)
}
var videoByte: UInt8
if (romAddress & 0x8000) == 0 {
videoByte = memoryPointer.advanced(by: Int(romAddress)).pointee
} else {
videoByte = memoryPointer.advanced(by: Int((romAddress & 16383) &+ 16384)).pointee
}
// invert the video pixels if bit 7 of the character code is set
if (readByte & 128) != 0 {
videoByte = ~videoByte
}
displayView.addWriteEightPixelsToQueue(videoByte)
cyclesPassedToDisplay = cyclesPassedToDisplay &+ 4
}
// "The ULA forces the data lines low. The CPU interprets
// the byte as a NOP" (0x0)
return 0x0
}
return readByte
}
}
Kevin
-
- Posts: 20
- Joined: Sun Jan 01, 2017 4:14 am
- Contact:
Re: ZX81 emulator for iOS
@kpalser
I ReTweeted someone who said they just got one for their iPad.
https://t.co/iIvOB1Lt6H
Is that your emulator.
_I wish there was one for android
__heck I'de build one myself if I wasn't knee deep in making a listing of all the know ZX81 Versions (still chuggin), and knew how lol
I ReTweeted someone who said they just got one for their iPad.
https://t.co/iIvOB1Lt6H
Is that your emulator.
_I wish there was one for android
__heck I'de build one myself if I wasn't knee deep in making a listing of all the know ZX81 Versions (still chuggin), and knew how lol
Re: ZX81 emulator for iOS
Yes, it is his emulatorAmericanPi wrote:@kpalser
I ReTweeted someone who said they just got one for their iPad.
https://t.co/iIvOB1Lt6H
Is that your emulator.
_I wish there was one for android
__heck I'de build one myself if I wasn't knee deep in making a listing of all the know ZX81 Versions (still chuggin), and knew how lol
Yes, it is my othello
Android is (far) future (read info).
-
- Posts: 20
- Joined: Sun Jan 01, 2017 4:14 am
- Contact:
Re: ZX81 emulator for iOS
dr beep wrote:
Yes, it is his emulator
Yes, it is my othello
Android is (far) future (read info).
Your response is pretty short and seems purposefully snippity.
Are you being purposefully rude?
Re: ZX81 emulator for iOS
@AmericanPi There is a good Android based ZX81 emulator I run on my Kindle called Zed Ex Beta. Sadly it is no longer on Google Play so you will have to search for it.
2X Timex Sinclair 1000, ZX81, ZX80Core, 5X 16K Ram Pack, ZXBlast, ZX P file to Ear Input Signal Converter, Elf II
- 1024MAK
- Posts: 5341
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: ZX81 emulator for iOS
I would not consider dr beep's post to be rude.AmericanPi wrote:dr beep wrote:
Yes, it is his emulator
Yes, it is my othello
Android is (far) future (read info).
Your response is pretty short and seems purposefully snippity.
Are you being purposefully rude?
Remember that this is an international forum with many members not having English as a first language. Sometimes someone can write and post text that they think is fine, but others misinterpret.
It is possible that dr beep was travelling when he wrote that. Maybe with a poor signal. I know I try to keep replies that I write on mobile devices short and to the point. As the touch screen keyboards are rather annoying, especially when you go over a bump, hit the wrong letter and then auto suggest / auto correct changes what you wrote
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Autumn is here. Bye bye summer 2024...
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Autumn is here. Bye bye summer 2024...