changeset 1734:88fbc4e711fd

Implemented the rest of the block move instructions in new Z80 core
author Michael Pavone <pavone@retrodev.com>
date Sun, 03 Feb 2019 10:40:41 -0800
parents 1f0a86f5e055
children ca2336469397
files cpu_dsl.py z80.cpu
diffstat 2 files changed, 41 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/cpu_dsl.py	Sat Feb 02 23:02:19 2019 -0800
+++ b/cpu_dsl.py	Sun Feb 03 10:40:41 2019 -0800
@@ -167,7 +167,7 @@
 			self.args.append((name, size))
 		elif op.op == 'local':
 			name = op.params[0]
-			size = op.params[1]
+			size = int(op.params[1])
 			self.locals[name] = size
 		else:
 			self.implementation.append(op)
@@ -339,7 +339,7 @@
 		if prog.carryFlowDst:
 			lastDst = prog.carryFlowDst
 		else:
-			lastDst = prog.resolveParam(prog.lastDst, None, {})
+			lastDst = prog.resolveParam(prog.lastDst, prog.currentScope, {})
 		storage = prog.flags.getStorage(flag)
 		if calc == 'bit' or calc == 'sign' or calc == 'carry' or calc == 'half' or calc == 'overflow':
 			myRes = lastDst
--- a/z80.cpu	Sat Feb 02 23:02:19 2019 -0800
+++ b/z80.cpu	Sun Feb 03 10:40:41 2019 -0800
@@ -2016,31 +2016,37 @@
 	
 fdcb 11BBBRRR set_iyd_reg
 	z80_set_index B main.R
-
-ed 10100000 ldi
+	
+z80_fetch_mod_hl
 	local tmp 16
-	local tmp8 8
+	arg change 16
 	lsl h 8 tmp
 	or l tmp tmp
 	mov tmp scratch1
-	add 1 tmp tmp
+	add change tmp tmp
 	mov tmp l
 	lsr tmp 8 h
 	ocall read_8
 	cycles 1
 	
+z80_ldd_ldi
+	arg change 16
+	local tmp 16
+	local tmp8 8
+	z80_fetch_mod_hl change
+	
 	add a scratch1 tmp8
 	update_flags H0XN0
 	
 	and 0x2 tmp8 tmp8
-	lsl 4 tmp8 tmp8
+	lsl tmp8 4 tmp8
 	and 0x88 last_flag_result last_flag_result
 	or tmp8 last_flag_result last_flag_result
 	
 	lsl d 8 tmp
 	or e tmp tmp
 	mov tmp scratch2
-	add 1 tmp tmp
+	add change tmp tmp
 	mov tmp e
 	lsr tmp 8 d
 	ocall write_8
@@ -2054,7 +2060,34 @@
 	mov c pvflag
 	or b pvflag pvflag
 	
+	cycles 5
 	
+
+ed 10100000 ldi
+	z80_ldd_ldi 1
+
+ed 10101000 ldd
+	z80_ldd_ldi -1
+
+ed 10110000 ldir
+	z80_ldd_ldi 1
+	if pvflag
 	
+	add 1 pc wz
+	sub 1 pc pc
 	cycles 5
+	
+	end
+
+ed 10111000 lddr
+	z80_ldd_ldi -1
+	if pvflag
+	
+	add 1 pc wz
+	sub 1 pc pc
+	cycles 5
+	
+	end
+	
+
 	
\ No newline at end of file