|
Post by mirkosoft on Apr 20, 2016 19:47:39 GMT
Hi! So maybe you have seen this thread: C128 with SCPU128 & CP/M cartridgeWe know work of C128 with SCPU and CP/M cartridge. All is working correctly. Works WDC65816, Z80, even CP/M 2.2 in 64 mode. In both modes are available 2 CPUs: WDC65816 and Z80 inside cartridge. You maybe forget that I tried to call external Z80 from internal Z80 directly and vice versa, it failed. *internal Z80 = Z80 inside C128 marked as Z8128, external Z80 = Z80 inside CP/M cartridge marked as Z8064. So, I turned off SCPU to get full power of 3 CPUs: 8502, Z8128 and Z8064. First was CP/M, I started 3.0 in 128 mode, then 2.2 in 64 mode - both works - no matter if it was from BOOT after restart or manually typed BOOT command - in case of CP/M 2.2 is in 64 mode Basic v2 this command not present, so using LOAD. Then I tried to call my own routines. I started Z8064 routine - works. Then I started Z8128 routine - it returns always READY only. This was looking very bad 'cause that routine was tested in VICE emulator and was working (I know emulator only), for READY prompt I tried to start it in xscpu64 and also in s64sc with enabled CP/M cartridge - same result always - READY. I was meaning that CP/M cartridge blocks Z80 inside C128! NOT! If Z80 could be blocked CP/M 3.0 couldn't run! We can give away also that CP/M 3.0 started at power on/restart 'cause I started it by typing BOOT command later than restart or power on. Problem is simple: Activation of Z8128 must to be created more carefully, so if you have any idea how to enhance Z8128 switch to work, let us know! I attached my sources and one diskimage version 2. Miro z80s2.d64 (170.75 KB) z80s2.asm (1.98 KB) to6502.asm (158 B) to8502.asm (142 B) z8064poke.0.32.asm (413 B) z8128poke.0.32.asm (399 B) 53 68
|
|
|
Post by mirkosoft on Apr 21, 2016 2:10:02 GMT
So new results. I used old routine made at beginning my Z80 use - in C128 inside only. I tried it on real DCR and also x128 and x64sc (with enabled Z80 cartridge). I created new handler, using described in HANDLER.README, for short: calls Z80 routine with target selection (Z8128/Z8064), Z80 routine must end with the same what 8502 routine: simple RET (it's same as 8502 RTS). So, I tried to use Z8064 test - works in both modes normally Then I tried to use Z8128 routine - works, in few tests it was looking like when is Z8064 activated, Z8128 is disabled until reset - no this is not true! Both Z80 works no matter if was one or second used! Simple problem: Z8128 routines which working in x128 normally, works not 100% normally on real DCR - so for to be sure that's not problem of CP/M cartridge, I removed CP/M cartridge and was surprised: Problem is not in CP/M cartridge - these routines working not correctly on real hardware, only in x128 emulator correctly... I was afraid that if SCPU is turned off, but is in expansion port it affects Z80 inside C128 - but I mean there it needs not to try 'cause CP/M 3.0 is complete Z80 operating system and if it could be true, CP/M couldn't work. So, no problem SCPU, no problem CP/M cartridge. When I look at Z80 code - I'm not beginner but know not so Z80 code like 8502... or is something wrong in handler. For this I attached sources and new diskimage. If you find any bug, or only looking like bug, please report - like we always see emulator is not real machine! Miro z80s3.d64 (170.75 KB) z80handler3.asm (2.52 KB) z8128mode 0-32.asm (255 B) z8128poke 0-32.asm (394 B) z8064poke 0-32.asm (408 B) 25 34 44
|
|
|
Post by remark on Apr 24, 2016 2:00:20 GMT
Hi Miro,
Could you elaborate which mode is working/not working:
1. C64 (8502) activating z80 in cartridge 2. C128 (8502) activating z80 in cartidge 3. CP/M 3 (z80) activating z80 in cartridge
I notice in Z8128poke.0.32.asm you put screen memory at $0400, but when internal z80 is active the MMU puts ROM for CP/M there.
|
|
|
Post by mirkosoft on Apr 24, 2016 17:06:05 GMT
Ok, first: These routines are not running on CP/M - these routines are separate and only one requirement is Z80. Addressing: Z8128 has same addressing like 8502 (8502-$0400 = Z8128-$0400), Z8064 addressing is different (8502-$0400 = Z8064-$F400 like 8502-$1000 = Z8064-$0000)
answer working modes: 1. works 2. works 3. works not
In all cases: code running with Z8064 is 100% working no matter of SCPU mode (8/16-bit) only requires SCPU turbo off, tested was not 2MHz (when I create calling x65Kernal routines from Z80 I'll test it) In case of Z8128 works only if is SCPU turned off, 2MHz tested not yet. Working, but really mysterious behavior, routines - in VICE x128 working correctly. For to be sure I removed CP/M cartridge, removed SCPU, they have same behavior no matter if was before calling Z8128 routine activated and turned off Z8064. Summary: 1. routines cannot be used with CP/M (both versions) 2. Z8064 routines working correctly 3. Z8128 routines have mysterious behavior, but in x128 working
Accessing $0400 is in calling Z8128 from 8502, without running CP/M, have same application from 8502 or Z80 = default VIC-IIe screen. The sources and compiled programs will not run with CP/M not matter if 2.2 or 3.0 CP/M: 2.2 - works only in C64 mode, with Z8064, with or without SCPU, at 1MHz 3.0 - works only in C128 mode, with Z8128, without SCPU, tested was 1MHz
I'm going to test 2MHz and then add reply.
Miro
|
|
|
Post by mirkosoft on Apr 24, 2016 17:31:51 GMT
2MHz mode test: Both Z80 (C128 internal, in CP/M cartridge) can be activated from 8502 @ 2MHz. Z8064 was tested also in SCPU slow mode and turned on 2MHz - works. Z8064 limit is only SCPU in slow mode Z8128 limit is SCPU turned off and accessible in C128 mode only CP/M 2.2 limit is SCPU in slow mode, working in C64 mode only, 2MHz cannot to be tested for garbage screen - overclocking 8502 to 1,3MHz in not applicable, it activates Z80... CP/M 3.0 limit is same as Z8128
|
|
|
Post by remark on Apr 24, 2016 19:34:23 GMT
Thank you Miro for your explanation.I hope you will get it working. If I would do the test, I would do the following:
1. activate internal z80 2. change a specific memory location in RAM 3. activate external z80 4. change another memory in location in RAM 5. change to 8502
If first memory location has changed, the first activation works. If second location changed, the second activation works.
|
|
|
Post by mirkosoft on Apr 26, 2016 1:47:22 GMT
So, finally. I created near same text output except using POKE, I created calling Kernal65 by CPU switching - simple Z80 reads characters, 8502 outputs them to screen. Now it looks like stupidity, but in large programs calling Kernal65 routines, what can be written universally, can reduce code written for Z80...
Examples both working 100% correctly - so now no any problem, now I know that both Z80s working correctly. I attached diskimage and sources - simple start of both routines is SYS5120
Miro
z80call65kernal.d64 (170.75 KB)z8128kernal65call.asm (1.37 KB)_z8064kernal65call.asm (1.13 KB)
|
|
|
Post by mirkosoft on Apr 27, 2016 1:51:18 GMT
So, this night I performed last tests for direct switch from one Z80 to second Z80. It seems that it is not possible to use memory locations which are important for 8502 also when adapt to Z8064 addressing. I must to investigate Z80 RAM of both CPUs, I plan also create Z80 and CP/M RAM copy by simple way: reading byte after byte and placing it into 64K VDC RAM. Both Z80 can access 64K only and it means that VDC RAM is enough as RAMdisk. Then only save it to disk in two halves. I plan to make: Z8128 RAM copy - it's possible only in C128 mode Z8064 RAM copy in 128 mode Z8064 RAM copy in 64 mode CP/M 2.2 RAM copy in 64 mode with running CP/M - it's possible only 64 mode CP/M 3.0 RAM copy in 128 mode with running CP/M - it's possible only in 128 mode - so 5 RAM dumps When I look at access of VDC in CP/M - it is different to 8502 - maybe will be possible to switch Z80 to Z80 directly - I don't want to end fight when I have still chance. Attached is 7z file - you can see what and how I tried for now. Miro call.7z (1.08 KB) 27
|
|
|
Post by mirkosoft on Apr 27, 2016 15:45:22 GMT
Hi! News - good news! I forgot that IO area must to be filled by OUT instruction instead LD... I changed these instructions and surprise: Z8128 can switch to Z8064 Z8064 cannot switch to Z8128 What indicates it? When is Z8128 routine started it increments VIC border one time, then is called Z8064 and after call in loop increments VIC border forever. Now was VIC border incremented one time and then was switched to Z8064 'cause no more increment (I mean, but sure I am not). It has to start incrementing VIC paper, but it works not, only after few seconds displays garbage on VIC screen. I mean switch was succesfull 'cause Z8128 code continues not. But how to handle switch Z80 to Z80 in case starting Z8064? Z8064 performs switch to Z8128 without effect and does same loop like Z8128 only increments VIC paper forever instead incrementing VIC border. So, no effect at switch. If anyone has idea how to handle Z8064 start directly switched from Z8128 suggestions are always welcome. I attached sources and compiled code. Miro IOswitch.zip (1.7 KB) 26
|
|
|
Post by remark on Apr 27, 2016 18:42:53 GMT
Hi! News - good news! I forgot that IO area must to be filled by OUT instruction instead LD... I changed these instructions and surprise: Z8128 can switch to Z8064 Z8064 cannot switch to Z8128 What indicates it? When is Z8128 routine started it increments VIC border one time, then is called Z8064 and after call in loop increments VIC border forever. Now was VIC border incremented one time and then was switched to Z8064 'cause no more increment (I mean, but sure I am not). It has to start incrementing VIC paper, but it works not, only after few seconds displays garbage on VIC screen. I mean switch was succesfull 'cause Z8128 code continues not. But how to handle switch Z80 to Z80 in case starting Z8064? Z8064 performs switch to Z8128 without effect and does same loop like Z8128 only increments VIC paper forever instead incrementing VIC border. So, no effect at switch. If anyone has idea how to handle Z8064 start directly switched from Z8128 suggestions are always welcome. I attached sources and compiled code. Miro 26 If you change: LD BC, $ef00 LD A, $3E ; set MMU OUT (C),A ; of 8502 to: LD A, $3E LD ($ef00), A or to: LD BC, $c500 LD A, $3E OUT (C),A Will this make a difference?
|
|