From: Leo Date: Tue, 20 Mar 2012 10:57:19 +0000 (+0000) Subject: * avr/Z80int-jmp.asm X-Git-Tag: 3.0~5 X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/commitdiff_plain/8fec4e62390540b7e1df0731efb5145b45f817c9?hp=29fb1fd423f3f8402c2f7f997ce3d5f62fdbf219 * avr/Z80int-jmp.asm - Z80 shift and rotate instructions added - Extra store and fetch ops for "LD (Ix+d),n" git-svn-id: svn://cu.loc/avr-cpm/avrcpm/trunk@183 57430480-672e-4586-8877-bcf8adbbf3b7 --- diff --git a/avr/Z80int-jmp.asm b/avr/Z80int-jmp.asm index a172c92..01a877f 100644 --- a/avr/Z80int-jmp.asm +++ b/avr/Z80int-jmp.asm @@ -460,6 +460,12 @@ do_fetch_dir8: adiw z_pcl,1 ret +do_fetch_dir8_2: + movw xl,z_pcl + adiw xl,1 + mem_read_d opl + ret + do_fetch_dir16: mem_read_ds opl, z_pc adiw z_pcl,1 @@ -2504,6 +2510,29 @@ storemxx2: mem_write_s opl ;store operand ret +do_store_mxx_2: + sbic flags,prefixfd + rjmp storemxx2_fd + ldd xh,y+oz_xh + ldd xl,y+oz_xl + rjmp storemxx21 +storemxx2_fd: + ldd xh,y+oz_yh + ldd xl,y+oz_yl +storemxx21: + mem_read_s z_pc ;get displacement + adiw z_pcl,1 + adiw z_pcl,1 + clr temp2 ;sign extend + tst temp + brpl storemxx22 + com temp2 +storemxx22: + add xl,temp ;add displacement + adc xh,temp2 + mem_write_s opl ;store operand + ret + do_store_xx: sbic flags,prefixfd rjmp storexx_fd @@ -2768,6 +2797,95 @@ do_op_CPDR: ret +;---------------------------------------------------------------- +;|Mnemonic |SZHPNC|Description |Notes | +;---------------------------------------------------------------- +;|RLC m |**0P0*|Rotate Left Circular |m=m<- | +;|RRC m |**0P0*|Rotate Right Circular|m=->m | +;|RL m |**0P0*|Rotate Left |m={CY,m}<- | +;|RR m |**0P0*|Rotate Right |m=->{CY,m} | +;|SLA m |**0P0*|Shift Left Arithmetic|m=m*2 | +;|SRA m |**0P0*|Shift Right Arith. |m=m/2 | +;|SLL m |**0P0*|Shift Right Logical | +;|SRL m |**0P0*|Shift Right Logical |m=->{0,m,CY} | + + +do_op_rlc: + ;Rotate Left Cyclical. All bits move 1 to the + ;left, the msb becomes c and lsb. + clr temp + lsl opl + adc temp,_0 + or opl,temp + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + or z_flags,temp + ret + +do_op_rrc: + ;Rotate Right Cyclical. All bits move 1 to the + ;right, the lsb becomes c and msb. + lsr opl + brcc PC+2 + ori opl,0x80 + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + bmov z_flags,ZFL_C, opl,7 + ret + + +do_op_rl: + ;Rotate Left. All bits move 1 to the left, the msb + ;becomes c, c becomes lsb. + clc + sbrc z_flags,ZFL_C + sec + rol opl + in temp,sreg + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + bmov z_flags,ZFL_C, temp,AVR_C + ret + + +do_op_rr: + ;Rotate Right. All bits move 1 to the right, the lsb + ;becomes c, c becomes msb. + + ror opl + in temp,sreg ;CY + bmov opl,7, z_flags,ZFL_C ;old CY --> Bit 7 + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + bmov z_flags,ZFL_C, temp,AVR_C ; + ret + +do_op_sla: + lsl opl + in temp,sreg + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + bmov z_flags,ZFL_C, temp,AVR_C ; + ret + +do_op_sra: + lsr opl + in temp,sreg + bmov opl,7, opl,6 ;old CY --> Bit 7 + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + bmov z_flags,ZFL_C, temp,AVR_C ; + ret + +do_op_sll: + sec + rol opl + in temp,sreg + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + bmov z_flags,ZFL_C, temp,AVR_C ; + ret + +do_op_srl: + lsr opl + in temp,sreg + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + bmov z_flags,ZFL_C, temp,AVR_C ; + ret + ;---------------------------------------------------------------- ;|Mnemonic |SZHPNC|Description |Notes | ;---------------------------------------------------------------- @@ -2775,8 +2893,6 @@ do_op_CPDR: ;|RES b,m |------|Reset bit |m=m&{~2^b} | ;|SET b,m |------|Set bit |m=mv{2^b} | -; .org ((PC+255) & 0xff00) + 0x600 - do_op_BIT7: ldi temp,0x80 @@ -2805,7 +2921,7 @@ opbit: and temp,opl in temp,sreg ori z_flags,(1<