]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/8080int.asm
Remove unsupported experimental ADC support
[avrcpm.git] / avr / 8080int.asm
index 5e68a92a0d34e54fb22210653858293b38192daa..e04af460b26500cd608902c126ccdc55b524b647 100644 (file)
@@ -1,6 +1,6 @@
 ; 8080 Interpreter.
 ; This is part of the Z80-CP/M emulator written by Sprite_tm.
-; 
+;
 
 ;    Copyright (C) 2010 Sprite_tm
 ;    Copyright (C) 2010 Leo C.
 ;
 ;      instr fetch, op, store
 ;
-.macro instr   
+.macro instr
        .db     low(@2), low(do_@1), high(do_@1), low(@0)
 .endm
 
 
        .dseg
-       
+
 z_b:   .byte   1
 z_c:   .byte   1
 z_d:   .byte   1
@@ -153,7 +153,7 @@ noprintpc:
 .endif
 
        ;hier kommt die Interruptbehandlung rein
-       
+
        ldi     zl,low(main)                            ;da will ich wieder hin.
        ldi     zh,high(main)                           ;
        push    zl                                      ;
@@ -167,17 +167,17 @@ noprintpc:
        add     zl,r0                                   ;1
        adc     zh,r1                                   ;1
        ldi     temp2,high(store_ops)                   ;
-       lpm     temp,Z+                                 ;do_store 
+       lpm     temp,Z+                                 ;do_store
        push    temp                                    ;         low
        push    temp2                                   ;         high
 
-       lpm     temp,Z+                                 ;do_op    
+       lpm     temp,Z+                                 ;do_op
        push    temp                                    ;         low
        lpm     temp,Z+                                 ;         high
        push    temp                                    ;
 
        lpm     zl,Z                                    ;do_fetch
-       
+
 ;mov   zh,temp2                                ;
        ldi     zh,high(fetch_ops)
        ijmp                                            ;direkt
@@ -188,7 +188,7 @@ noprintpc:
 
 .org (PC+255) & 0xff00                 ; wichtig !!!fetch und store muessen in einer page liegen
 fetch_ops:
-do_fetch_nop:  
+do_fetch_nop:
        ret
 
 do_fetch_a:
@@ -294,7 +294,7 @@ do_fetch_rst:
 store_ops:
 do_store_nop:
        ret
-       
+
 do_store_a:
        mov z_a,opl
        ret
@@ -631,8 +631,8 @@ do_store_am:
 
 .macro ldpmx
        ldi     zh,high(@1*2)   ; table must be page aligned
-       mov     zl,@2                  
-       lpm     @0,z    
+       mov     zl,@2
+       lpm     @0,z
 .endm
 
 .macro do_z80_flags_V
@@ -671,7 +671,7 @@ do_store_am:
 #endif
 .endm
 
-       
+
 .macro do_z80_flags_copy_HC
 #if EM_Z80
        bmov    z_flags, ZFL_H, z_flags, ZFL_H
@@ -712,7 +712,7 @@ haltinv:
 
 do_op_nop:
        ret
-       
+
 ;----------------------------------------------------------------
 ;|Mnemonic  |SZHPNC|Description          |Notes                 |
 ;----------------------------------------------------------------
@@ -771,7 +771,7 @@ do_op_ina:                          ; in a,(opl)
 ;|INC r     |**-P0-|Increment            |r=r+1                 |
 ;|INC [HL]  |**-P0-|Increment            |[HL]=[HL]+1           |
 ;
-; 
+;
 do_op_inc:
        ldi     temp,1
        add     opl,temp
@@ -834,7 +834,7 @@ do_op_deca:
 ;|INC xx    |------|Increment            |xx=xx+1               |
 ;|INC ss    |------|Increment            |ss=ss+1               |
 ;
-; 
+;
 do_op_inc16:
        subi    opl,low(-1)
        sbci    oph,high(-1)
@@ -846,7 +846,7 @@ do_op_inc16:
 ;|DEC xx    |------|Decrement            |xx=xx-1               |
 ;|DEC ss    |------|Decrement            |ss=ss-1               |
 ;
-; 
+;
 do_op_dec16:
        subi   opl, 1
        sbci   oph, 0
@@ -861,7 +861,7 @@ do_op_dec16:
 ;
 ;
 do_op_rlca:
-       ;Rotate Left Cyclical. All bits move 1 to the 
+       ;Rotate Left Cyclical. All bits move 1 to the
        ;left, the msb becomes c and lsb.
        do_z80_flags_op_rotate
        lsl     z_a
@@ -880,8 +880,8 @@ do_op_rlc_noc:
 ;|RRCA      |---- *|Rotate Right Circular|A=->A                 |
 ;
 ;
-do_op_rrca: 
-       ;Rotate Right Cyclical. All bits move 1 to the 
+do_op_rrca:
+       ;Rotate Right Cyclical. All bits move 1 to the
        ;right, the lsb becomes c and msb.
        do_z80_flags_op_rotate
        lsr     z_a
@@ -899,9 +899,9 @@ do_op_rrc_noc:
 ;|----------|SZHP C|---------- 8080 ----------------------------|
 ;|RRA       |---- *|Rotate Right Acc.    |A=->{CY,A}            |
 ;
-; 
-do_op_rra: 
-       ;Rotate Right. All bits move 1 to the right, the lsb 
+;
+do_op_rra:
+       ;Rotate Right. All bits move 1 to the right, the lsb
        ;becomes c, c becomes msb.
        clc                             ; get z80 carry to avr carry
        sbrc    z_flags,ZFL_C
@@ -918,9 +918,9 @@ do_op_rra:
 ;|----------|SZHP C|---------- 8080 ----------------------------|
 ;|RLA       |---- *|Rotate Left Acc.     |A={CY,A}<-            |
 ;
-; 
+;
 do_op_rla:
-       ;Rotate Left. All bits move 1 to the left, the msb 
+       ;Rotate Left. All bits move 1 to the left, the msb
        ;becomes c, c becomes lsb.
        clc
        sbrc z_flags,ZFL_C
@@ -1109,7 +1109,7 @@ do_op_sthl: ;store hl to mem loc in opl:h
 ;----------------------------------------------------------------
 ;|LD dst,src|------|Load                 |dst=src               |
 ;
-; 
+;
 do_op_rmem16:
        movw xl,opl
        mem_read_d opl
@@ -1165,13 +1165,13 @@ do_op_rmem8:
 ;
 ; ---------------------
 ; | N | H | low   |H' |
-; |   |   |nibble |   |  
+; |   |   |nibble |   |
 ; |---+---+-------+---|
-; | 0 | * |  0-9  | 0 | 
-; | 0 | * |  a-f  | 1 | 
-; | 1 | 0 |   *   | 0 | 
-; | 1 | 1 |  6-f  | 0 | 
-; | 1 | 1 |  0-5  | 1 | 
+; | 0 | * |  0-9  | 0 |
+; | 0 | * |  a-f  | 1 |
+; | 1 | 0 |   *   | 0 |
+; | 1 | 1 |  6-f  | 0 |
+; | 1 | 1 |  0-5  | 1 |
 ; ---------------------
 ;
 ; Ohter flags:
@@ -1185,7 +1185,7 @@ do_op_rmem8:
 do_op_da:
 
 #if EM_Z80
-       sbrc    z_flags,ZFL_N                   ;if add-op      
+       sbrc    z_flags,ZFL_N                   ;if add-op
        rjmp    op_da_sub                       ;then
 #endif
 
@@ -1199,8 +1199,8 @@ op_da_add:
        brlo    op_da_a10                       ;  |
 op_da_a01:                                     ;  then
        ldi     oph,0x06                        ;    add 6 to lower nibble
-       add     opl,oph                         ;    
-       brhc    op_da_02                        ;    if 
+       add     opl,oph                         ;
+       brhc    op_da_02                        ;    if
        ori     temp2,(1<<ZFL_H)                ;      set new H flag
 op_da_02:                                      ;
        brcc    op_da_a10                       ;    if
@@ -1209,7 +1209,7 @@ op_da_a10:                                        ;  endif
        sbrc    z_flags,ZFL_C                   ;  |
        rjmp    op_da_a12                       ;  if (C flag ...
        cpi     opl,0xA0                        ;  |... or upper nibble >= 0xA0)
-       brlo    op_da_a13                       ; 
+       brlo    op_da_a13                       ;
 op_da_a12:                                     ;
        ldi     oph,0x60                        ;    add 6 to lower nibble
        add     opl,oph                         ;
@@ -1232,7 +1232,7 @@ do_op_da:
        ldi     temp2,0                         ;new C and H flag
        ldi     oph,0                           ;oph: what to add
 
-       sbrc    z_flags,ZFL_N                   ;if add-op      
+       sbrc    z_flags,ZFL_N                   ;if add-op
        rjmp    op_da_sub                       ;then
 op_da_add:
        mov     temp,opl                        ;  |
@@ -1246,7 +1246,7 @@ op_da_add:
        rjmp    op_da_a02                       ;    if (C flag ...
        cpi     opl,0x90                        ;    |... or upper nibble >= 0x90)
        brlo    op_da_a03                       ;    |
-op_da_a02:                             
+op_da_a02:
        ori     oph,0x60                        ;      add 0x60
        ori     temp2,(1<<ZFL_C)                ;      set new C flag
 op_da_a03:                                     ;    endif
@@ -1255,8 +1255,8 @@ op_da_a10:                                        ;  else (lower nibble is 0x09 or lower)
        sbrc    z_flags,ZFL_C                   ;    |
        rjmp    op_da_a12                       ;    if (C flag ...
        cpi     opl,0xA0                        ;    |... or upper nibble >= 0xA0)
-       brlo    op_da_a13                       ; 
-op_da_a12:                             
+       brlo    op_da_a13                       ;
+op_da_a12:
        ori     oph,0x60                        ;      add 0x60
        ori     temp2,(1<<ZFL_C)                ;      set new C flag
 op_da_a13:
@@ -1275,7 +1275,7 @@ op_da_ae:
        ldpmx   z_flags, sz53p_tab, opl         ; get S,Z,P flag
        or      z_flags,temp2                   ; merge new C and H flag
        ret
-       
+
 op_da_sub:                                     ;else (sub-op)
        rcall do_op_inv                         ;  TODO: !
        ret                                     ;endif
@@ -1383,7 +1383,7 @@ do_op_pop16:
 ;|EX [SP],HL|------|Exchange             |[SP]<->HL             |
 ;|EX DE,HL  |------|Exchange             |DE<->HL               |
 ;-----------------------------Z80--------------------------------
-; 
+;
 do_op_exhl:
        lds temp,z_l
        lds temp2,z_h
@@ -1420,7 +1420,7 @@ do_op_ifnz:
        sbrs z_flags, ZFL_Z
        ret
        pop     temp                            ; nix tun
-       pop temp                                ; direkt zurueck zu main        
+       pop temp                                ; direkt zurueck zu main
        ret
 
 ;----------------------------------------------------------------
@@ -1435,7 +1435,7 @@ do_op_ifz:
        sbrc z_flags, ZFL_Z
        ret
        pop     temp                            ; nix tun
-       pop temp                                ; direkt zurueck zu main        
+       pop temp                                ; direkt zurueck zu main
        ret
 
 ;----------------------------------------------------------------
@@ -1450,7 +1450,7 @@ do_op_ifnc:
        sbrs z_flags, ZFL_C
        ret
        pop     temp                            ; nix tun
-       pop temp                                ; direkt zuruech zu main        
+       pop temp                                ; direkt zuruech zu main
        ret
 
 ;----------------------------------------------------------------
@@ -1465,7 +1465,7 @@ do_op_ifc:
        sbrc z_flags, ZFL_C
        ret
        pop     temp                            ; nix tun
-       pop temp                                ; direkt zuruech zu main        
+       pop temp                                ; direkt zuruech zu main
        ret
 
 ;----------------------------------------------------------------
@@ -1480,7 +1480,7 @@ do_op_ifpo:
        sbrs z_flags, ZFL_P
        ret
        pop     temp                            ; nix tun
-       pop temp                                ; direkt zuruech zu main        
+       pop temp                                ; direkt zuruech zu main
        ret
 
 ;----------------------------------------------------------------
@@ -1495,7 +1495,7 @@ do_op_ifpe:
        sbrc z_flags, ZFL_P
        ret
        pop     temp                            ; nix tun
-       pop temp                                ; direkt zuruech zu main        
+       pop temp                                ; direkt zuruech zu main
        ret
 
 ;----------------------------------------------------------------
@@ -1510,7 +1510,7 @@ do_op_ifp: ;sign positive, aka s=0
        sbrs z_flags, ZFL_S
         ret
        pop     temp                            ; nix tun
-       pop temp                                ; direkt zuruech zu main        
+       pop temp                                ; direkt zuruech zu main
        ret
 
 ;----------------------------------------------------------------
@@ -1525,15 +1525,15 @@ do_op_ifm: ;sign negative, aka s=1
        sbrc z_flags, ZFL_S
         ret
        pop     temp                            ; nix tun
-       pop temp                                ; direkt zuruech zu main        
+       pop temp                                ; direkt zuruech zu main
        ret
 
-        
+
 ; ----------------------- Opcode decoding -------------------------
 
 ; Lookup table for Z80 opcodes. Translates the first byte of the instruction word into three
 ; operations: fetch, do something, store.
-; The table is made of 256 words. 
+; The table is made of 256 words.
 
 ;.org (PC+255) & 0xff00
 todo_table:
@@ -1799,7 +1799,7 @@ instr     do_fetch_RST,   op_nop,         do_store_CALL   ;FF             ;RST 38H
 ; Lookup table, stolen from z80ex, Z80 emulation library.
 ; http://z80ex.sourceforge.net/
 
-; The S, Z, 5 and 3 bits and the parity of the lookup value 
+; The S, Z, 5 and 3 bits and the parity of the lookup value
 
        .org (PC+255) & 0xff00
 sz53p_tab:
@@ -1835,6 +1835,5 @@ sz53p_tab:
        .db 0xac,0xa8,0xa8,0xac,0xa8,0xac,0xac,0xa8
        .db 0xa4,0xa0,0xa0,0xa4,0xa0,0xa4,0xa4,0xa0
        .db 0xa8,0xac,0xac,0xa8,0xac,0xa8,0xa8,0xac
-       
-; vim:set ts=8 noet nowrap
 
+; vim:set ts=8 noet nowrap