From 2217c8551dde4e881d8e25ac7472c7fc1f103092 Mon Sep 17 00:00:00 2001 From: Leo Date: Wed, 21 Mar 2012 15:56:16 +0000 Subject: [PATCH] * avr/Z80int-jmp.asm - Bugfix: XOR A,+d)> - Bugfix: CP - LDxx, CPxx refactored - INC/DEC cleaned up git-svn-id: svn://cu.loc/avr-cpm/avrcpm/trunk@184 57430480-672e-4586-8877-bcf8adbbf3b7 --- avr/Makefile | 2 +- avr/Z80int-jmp.asm | 435 ++++++++++++++++++++++----------------------- 2 files changed, 218 insertions(+), 219 deletions(-) diff --git a/avr/Makefile b/avr/Makefile index 722d6a5..664425f 100644 --- a/avr/Makefile +++ b/avr/Makefile @@ -129,7 +129,7 @@ tags: $(SRC) $(ASRC) ctags $(SRC) $(ASRC) svnrev.inc: $(ASRC0) - svnrev -osvnrev.inc $^ + @svnrev -osvnrev.inc $^ # Target: clean project. clean: diff --git a/avr/Z80int-jmp.asm b/avr/Z80int-jmp.asm index 01a877f..b73de8f 100644 --- a/avr/Z80int-jmp.asm +++ b/avr/Z80int-jmp.asm @@ -25,7 +25,7 @@ ; #if EM_Z80 - #define OPC_TABSTART 0x1a00 + #define OPC_TABSTART 0x1900 #else #define OPC_TABSTART 0x1200 #endif @@ -200,51 +200,63 @@ int_nobreak: ; .macro instr - .set fetch_ = (do_@0 != do_fetch_nop) ; must call or jump to fetch phase - .set op_ = (do_@1 != do_op_nop) ; must call or jump to op phase - .set store_ = (do_@2 != do_store_nop) ; must jump to store phase - .set cnt_ = fetch_ + op_ + store_ + .set fetch_ = (do_@0 != do_fetch_nop) ; must call or jump to fetch action + .set op_ = (do_@1 != do_op_nop) ; must call or jump to op action + .set store_ = (do_@2 != do_store_nop) ; must jump to store action + .set cnt_ = fetch_ + op_ + store_ ; number of actions for this instruction + + .set action_1_ = 0 + .set action_2_ = 0 + .set action_3_ = 0 + + .if cnt_ == 1 + .if fetch_ + .set action_1_ = do_@0 + .elif op_ + .set action_1_ = do_@1 + .else + .set action_1_ = do_@2 + .endif + .elif cnt_ == 2 + .if fetch_ + .set action_1_ = do_@0 + .if op_ + .set action_2_ = do_@1 + .else + .set action_2_ = do_@2 + .endif + .else + .set action_1_ = do_@1 + .set action_2_ = do_@2 + .endif + .elif cnt_ == 3 + .set action_1_ = do_@0 + .set action_2_ = do_@1 + .set action_3_ = do_@2 + .endif + .set longdist_ = 0 .set pc_save_ = PC .org opcjmp_table_pos_ .set opcjmp_table_pos_ = opcjmp_table_pos_ + 1 + .if cnt_ == 0 ; nothing to do (nop) ret ; go back to main .elif cnt_ == 1 ; jump direct to action - .if fetch_ ; - .if (PC - do_@0) > 2047 - .set longdist_ = 1 - .else - rjmp do_@0 ; do op and return to main - .endif - .endif - .if op_ - .if (PC - do_@1) > 2047 - .set longdist_ = 1 - .else - rjmp do_@1 ; do op and return to main - .endif - .endif - .if store_ ; - .if (PC - do_@2) > 2047 - .set longdist_ = 1 - .else - rjmp do_@2 ; do op and return to main - .endif - .endif + .if (PC - action_1_) > 2047 + .set longdist_ = 1 ; target action out of reach for rel jump + .else + rjmp action_1_ ; do op and return to main + .endif .endif + .set done_ = 0 .if (cnt_ > 1) || longdist_ - - .set labelexists_ = 0 - .if defined (l_@0_@1_@2) - .set labelexists_ = 1 - .endif ; two or tree actions - .if labelexists_ ; same combination of fetch/op/store allready present? + .if defined (l_@0_@1_@2) .if (PC - l_@0_@1_@2) <= 2047 rjmp l_@0_@1_@2 ; generate a jump to action table .set done_ = 1 @@ -266,7 +278,7 @@ int_nobreak: .endif .endif - .if labelexists_ + .if defined (l_@0_@1_@2) rjmp todo_table_pos_ .org todo_table_pos_ jmp l_@0_@1_@2 @@ -994,63 +1006,97 @@ do_op_ina: ; in a,(opl) ;|INC r |**-P0-|Increment |r=r+1 | ;|INC [HL] |**-P0-|Increment |[HL]=[HL]+1 | ; -; + do_op_inc: + andi z_flags,(1<