X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/49475345ffc5fd27ca937006ef6aa18858bf7c90..7535ca1b43f9320f0de3c49fc7a12560a5022a7c:/z180/cpuinfo.180 diff --git a/z180/cpuinfo.180 b/z180/cpuinfo.180 index 0ea3e8e..372f003 100644 --- a/z180/cpuinfo.180 +++ b/z180/cpuinfo.180 @@ -29,6 +29,19 @@ base equ 0 done: db 0 result: db 0 +cycls: db 0 +wstates:db 0 + +;------------------------------------------------------------------------------- +cyctab: + db 0 ;Unknown CPU + db 20 ;8080 + db 20 ;8085 + db 21 ;Z80 + db 19 ;HD64180 or higher + db 19 ;HD64180 + db 19 ;Z80180 + db 19 ;Z8S180, Z8L180 ;------------------------------------------------------------------------------- ; Check if register C exists. D holds mask of bit to test. @@ -111,9 +124,10 @@ chk_z80: ; Test differences in certain internal registers ; to determine the 180 variant. - ld b,0 - ld c,icr - in a,(c) + ld a,(wstates) + out0 (DCNTL),a + out0 (RCR),b ; + in0 a,(icr) cp 01FH jr z,icr_ok @@ -125,7 +139,6 @@ chk_z80: icr_ok: inc e ; HD64180 - out0 (RCR),b ; ld c,omcr ; Check, if CPU has OMCR register ld d,M_IOC ; call chk_reg ; @@ -145,29 +158,32 @@ icr_ok: start: ld sp,stack ld hl,done - ld (hl),0 + ld b,h + ld (hl),b inc hl - ld (hl),0 - push hl + ld (hl),b call check - pop hl + ld hl,cyctab + ld d,h + add hl,de + ld a,(hl) + ld hl,cycls + ld (hl),a + dec hl ld (hl),e dec hl ld (hl),0ffH out (040H),a + ;808x Z80 Z180(0W) Z180(MaxW) +loop: ;--------------------------------- + in a,(050h) ;10 11 10 +3*3 19 + jp loop ;10 10 9 +3*3 18 + ;--------------------------------- + ;20 21 19 37 -; ld a,(wstates) -; out0 (DCNTL),a - ;Z80 Z180(0W) Z180(MaxW) -loop: ;-------------------------- - in a,(050h) ;11 10 +3*3 19 - jp loop ;10 9 +3*3 18 - ;-------------------------- - ;21 19 37 - -; jr loop ;12 8 +2*3 14 +; jr loop ;-- 12 8 +2*3 14 - rept 8 + rept 4 dw 0 endm stack: