From 4bd49b803d4fb81873a8fadb2ca7b9df461ab72b Mon Sep 17 00:00:00 2001 From: "Leo C." Date: Thu, 25 Apr 2024 23:21:45 +0200 Subject: [PATCH] SVN --> GIT Clean up whitespace --- avr/8080int-jmp.asm | 123 +++++++++++++------------ avr/8080int-orig.asm | 77 ++++++++-------- avr/8080int-t3-jmp.asm | 97 ++++++++++---------- avr/8080int-t3.asm | 113 ++++++++++++----------- avr/8080int.asm | 107 +++++++++++----------- avr/Makefile | 17 ++-- avr/Z80int-jmp.asm | 185 +++++++++++++++++++------------------- avr/avrcpm.asm | 5 +- avr/config.inc | 33 ++++--- avr/dram-4bit.asm | 3 +- avr/dram-4bit.inc | 3 +- avr/dram-8bit.asm | 3 +- avr/dram-8bit.inc | 6 +- avr/dram-refresh.asm | 35 ++++---- avr/dsk_cpm.asm | 9 +- avr/dsk_fat16.asm | 85 +++++++++--------- avr/dsk_fsys.asm | 197 ++++++++++++++++++++--------------------- avr/dsk_mgr.asm | 22 +++-- avr/dsk_ram.asm | 37 ++++---- avr/heap.asm | 15 ++-- avr/hw-uart.asm | 25 +++--- avr/i2c.asm | 25 +++--- avr/init.asm | 15 ++-- avr/macros.inc | 23 +++-- avr/mmc-old.asm | 16 ++-- avr/mmc.asm | 81 +++++++++-------- avr/svnrev.inc | 2 +- avr/sw-uart.asm | 65 +++++++------- avr/timer.asm | 77 ++++++++-------- avr/utils.asm | 61 +++++++------ avr/virt_ports.asm | 21 +++-- 31 files changed, 775 insertions(+), 808 deletions(-) diff --git a/avr/8080int-jmp.asm b/avr/8080int-jmp.asm index 23ef640..6a2df73 100644 --- a/avr/8080int-jmp.asm +++ b/avr/8080int-jmp.asm @@ -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. @@ -25,7 +25,7 @@ ; .dseg -z_regs: +z_regs: z_b: .byte 1 z_c: .byte 1 z_d: .byte 1 @@ -88,7 +88,7 @@ z_istat: .byte 1 #endif .cseg - + ;Init z80 z80_init: ldi z_pcl,low (IPLADDR) @@ -145,14 +145,14 @@ noprintpc: ; ; instr fetch, op, store ; -.macro instr +.macro instr .ifndef opcjmp_table_pos_ .set todo_table_pos_ = PC ; Place the opcode jump table on the next available location. .equ opcjmp = (PC+255) & 0xff00 .set opcjmp_table_pos_ = opcjmp .endif - + .if todo_table_pos_ < opcjmp + 256 + 128 .if todo_table_pos_ + 3 >= opcjmp .set todo_table_pos_ = opcjmp + 256 + 128 @@ -174,15 +174,15 @@ noprintpc: .endif .if cnt_ == 1 ; jump direct to action - .if fetch_ ; - rjmp @0 ; - .endif + .if fetch_ ; + rjmp @0 ; + .endif .if op_ rjmp do_@1 ; do op and return to main - .endif - .if store_ ; - rjmp @2 ; - .endif + .endif + .if store_ ; + rjmp @2 ; + .endif .endif ; two or tree actions @@ -194,7 +194,7 @@ noprintpc: .if fetch_ ; must fetch .if op_ || store_ rcall @0 ; fetch and come back here - .else ; + .else ; rjmp @0 ; fetch and return to main .endif .endif @@ -207,20 +207,20 @@ noprintpc: .endif .if store_ ; must store rjmp @2 ; store is allways last - .endif - + .endif + .set todo_table_pos_ = PC .endif .endm - + ; ------------ Fetch phase stuff ----------------- ;.org (PC+255) & 0xff00 fetch_ops: -do_fetch_nop: +do_fetch_nop: ret do_fetch_a: @@ -326,7 +326,7 @@ do_fetch_rst: store_ops: do_store_nop: ret - + do_store_a: mov z_a,opl ret @@ -664,8 +664,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 @@ -704,7 +704,7 @@ do_store_am: #endif .endm - + .macro do_z80_flags_copy_HC #if EM_Z80 bmov z_flags, ZFL_H, z_flags, ZFL_H @@ -745,7 +745,7 @@ haltinv: do_op_nop: ret - + ;---------------------------------------------------------------- ;|Mnemonic |SZHPNC|Description |Notes | ;---------------------------------------------------------------- @@ -804,7 +804,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 @@ -867,7 +867,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) @@ -879,7 +879,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 @@ -894,7 +894,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 @@ -913,8 +913,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 @@ -932,9 +932,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 @@ -951,9 +951,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 @@ -1142,7 +1142,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 @@ -1198,13 +1198,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: @@ -1218,7 +1218,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 @@ -1232,8 +1232,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<= 0xA0) - brlo op_da_a13 ; + brlo op_da_a13 ; op_da_a12: ; ldi oph,0x60 ; add 6 to lower nibble add opl,oph ; @@ -1265,7 +1265,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 ; | @@ -1279,7 +1279,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<= 0xA0) - brlo op_da_a13 ; -op_da_a12: + brlo op_da_a13 ; +op_da_a12: ori oph,0x60 ; add 0x60 ori temp2,(1<HL | ;|EX DE,HL |------|Exchange |DE<->HL | ;-----------------------------Z80-------------------------------- -; +; do_op_exhl: lds temp,z_l lds temp2,z_h @@ -1453,7 +1453,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 ;---------------------------------------------------------------- @@ -1468,7 +1468,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 ;---------------------------------------------------------------- @@ -1483,7 +1483,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 ;---------------------------------------------------------------- @@ -1498,7 +1498,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 ;---------------------------------------------------------------- @@ -1513,7 +1513,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 ;---------------------------------------------------------------- @@ -1528,7 +1528,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 ;---------------------------------------------------------------- @@ -1543,7 +1543,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 ;---------------------------------------------------------------- @@ -1558,15 +1558,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 @@ -1834,7 +1834,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 .org opcjmp + 256 @@ -1871,6 +1871,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 diff --git a/avr/8080int-orig.asm b/avr/8080int-orig.asm index 18f2c1e..5785a86 100644 --- a/avr/8080int-orig.asm +++ b/avr/8080int-orig.asm @@ -338,7 +338,7 @@ do_fetch_rst: andi opl,0x38 ldi oph,0 ret - + ; ------------ Store phase stuff ----------------- .equ STORE_NOP = (0<<5) @@ -818,8 +818,8 @@ opjumps: .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 @@ -852,7 +852,7 @@ opjumps: #endif .endm - + .macro do_z80_flags_copy_HC #if EM_Z80 bmov z_flags, ZFL_H, z_flags, ZFL_H @@ -890,7 +890,7 @@ do_op_inv: haltinv: rjmp haltinv - + do_op_nop: ret @@ -952,7 +952,7 @@ do_op_in: ; 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 @@ -1015,7 +1015,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) @@ -1027,7 +1027,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 @@ -1042,7 +1042,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 @@ -1061,8 +1061,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 @@ -1080,9 +1080,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 @@ -1099,9 +1099,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 @@ -1288,7 +1288,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 @@ -1344,13 +1344,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: @@ -1367,7 +1367,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 @@ -1381,8 +1381,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<= 0xA0) - brlo op_da_a13 ; + brlo op_da_a13 ; op_da_a12: ; ldi oph,0x60 ; add 6 to lower nibble add opl,oph ; @@ -1414,7 +1414,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 ; | @@ -1428,7 +1428,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<= 0xA0) - brlo op_da_a13 ; -op_da_a12: + brlo op_da_a13 ; +op_da_a12: ori oph,0x60 ; add 0x60 ori temp2,(1<HL | ;|EX DE,HL |------|Exchange |DE<->HL | ;-----------------------------Z80-------------------------------- -; +; do_op_exhl: lds temp,z_l lds temp2,z_h @@ -1710,13 +1710,13 @@ do_op_ifm: ;sign negative, aka s=1 clr insdecl 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. These 16-bit words consist of -; the fetch operation (bit 0-4), the processing operation (bit 10-16) and the store +; The table is made of 256 words. These 16-bit words consist of +; the fetch operation (bit 0-4), the processing operation (bit 10-16) and the store ; operation (bit 5-9). .org (PC+255) & 0xff00 inst_table: @@ -1981,7 +1981,7 @@ inst_table: ; 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: @@ -2017,6 +2017,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 diff --git a/avr/8080int-t3-jmp.asm b/avr/8080int-t3-jmp.asm index ca9fc72..90c6be9 100644 --- a/avr/8080int-t3-jmp.asm +++ b/avr/8080int-t3-jmp.asm @@ -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. @@ -25,7 +25,7 @@ ; .dseg - + z_b: .byte 1 z_c: .byte 1 z_d: .byte 1 @@ -88,7 +88,7 @@ z_istat: .byte 1 #endif .cseg - + ;Init z80 z80_init: ldi z_pcl,low (IPLADDR) @@ -130,7 +130,7 @@ noprintpc: .endif ;hier kommt die Interruptbehandlung rein - + mem_read_s z_pc ;temp=memReadByte(z_pc) adiw z_pcl,1 ;++z_pc ldi zl,low(todo_table*2) ;zhl=todo_table @@ -139,7 +139,7 @@ noprintpc: mul temp,temp2 ;2 add zl,r0 ;1 adc zh,r1 ;1 - lpm insdecl,Z+ ;do_store + lpm insdecl,Z+ ;do_store lpm insdech,Z+ ;do_op lpm zl,Z ;do_fetch ldi zh,high(fetch_ops) @@ -148,7 +148,7 @@ noprintpc: ; .listmac ;----------------------------------------------------- -; Generate jump to target and position in table +; Generate jump to target and position in table ; gen_opjmp target ; .macro gen_opjmp @@ -170,11 +170,11 @@ noprintpc: ; ; instr fetch, op, store ; -.macro instr +.macro instr .ifndef inst_table_odd_ .set inst_table_odd_ = 0 .endif - + .if inst_table_odd_ .db inst_table_next_, low(@2), @1, low(@0) .set inst_table_odd_ = 0 @@ -209,20 +209,20 @@ noprintpc: .macro store_end rjmp main .endm - + ;----------------------------------- ; go back to main directly ; .macro op_end_nojmp rjmp main .endm - + ; ------------ Fetch phase stuff ----------------- .org (PC+255) & 0xff00 fetch_ops: -do_fetch_nop: +do_fetch_nop: fetch_end do_fetch_a: @@ -328,7 +328,7 @@ do_fetch_rst: store_ops: do_store_nop: store_end - + do_store_a: mov z_a,opl store_end @@ -715,8 +715,8 @@ opjumps: .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 @@ -755,7 +755,7 @@ opjumps: #endif .endm - + .macro do_z80_flags_copy_HC #if EM_Z80 bmov z_flags, ZFL_H, z_flags, ZFL_H @@ -796,7 +796,7 @@ haltinv: do_op_nop: op_end - + ;---------------------------------------------------------------- ;|Mnemonic |SZHPNC|Description |Notes | ;---------------------------------------------------------------- @@ -855,7 +855,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 @@ -864,7 +864,7 @@ do_op_inc: ldpmx temp2, sz53p_tab, opl or z_flags,temp2 ; bmov z_flags, ZFL_H, temp, AVR_H - do_z80_flags_V + do_z80_flags_V op_end do_op_inca: @@ -918,7 +918,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) @@ -930,7 +930,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 @@ -945,7 +945,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 @@ -964,8 +964,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 @@ -983,9 +983,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 @@ -1002,9 +1002,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 @@ -1193,7 +1193,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 @@ -1249,13 +1249,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: @@ -1269,7 +1269,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 @@ -1283,8 +1283,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<= 0xA0) - brlo op_da_a13 ; + brlo op_da_a13 ; op_da_a12: ; ldi oph,0x60 ; add 6 to lower nibble add opl,oph ; @@ -1316,7 +1316,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 ; | @@ -1330,7 +1330,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<= 0xA0) - brlo op_da_a13 ; -op_da_a12: + brlo op_da_a13 ; +op_da_a12: ori oph,0x60 ; add 0x60 ori temp2,(1<HL | ;|EX DE,HL |------|Exchange |DE<->HL | ;-----------------------------Z80-------------------------------- -; +; do_op_exhl: lds temp,z_l lds temp2,z_h @@ -1596,12 +1596,12 @@ do_op_ifm: ;sign negative, aka s=1 op_end_nojmp op_end - + ; ----------------------- 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: @@ -1867,7 +1867,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: @@ -1903,6 +1903,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 diff --git a/avr/8080int-t3.asm b/avr/8080int-t3.asm index 130e4ce..dbc2234 100644 --- a/avr/8080int-t3.asm +++ b/avr/8080int-t3.asm @@ -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. @@ -25,7 +25,7 @@ ; .dseg -z_regs: +z_regs: z_b: .byte 1 z_c: .byte 1 z_d: .byte 1 @@ -143,7 +143,7 @@ noprintpc: .endif ;hier kommt die Interruptbehandlung rein - + ldi zl,low(main) ;da will ich wieder hin. ldi zh,high(main) ; push zl ; @@ -158,14 +158,14 @@ noprintpc: 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 .if high(opjumps) != high(opjumps) ldi temp2,high(opjumps) .endif - lpm temp,Z+ ;do_op + lpm temp,Z+ ;do_op push temp ; low push temp2 ; high @@ -176,7 +176,7 @@ noprintpc: ; .listmac ;----------------------------------------------------- -; Generate jump to target and position in table +; Generate jump to target and position in table ; gen_opjmp target ; .macro gen_opjmp @@ -198,11 +198,11 @@ noprintpc: ; ; instr fetch, op, store ; -.macro instr +.macro instr .ifndef inst_table_odd_ .set inst_table_odd_ = 0 .endif - + .if inst_table_odd_ .db inst_table_next_, low(@2), @1, low(@0) .set inst_table_odd_ = 0 @@ -237,20 +237,20 @@ noprintpc: .macro store_end rjmp main .endm - + ;----------------------------------- ; go back to main ; .macro op_end_nojmp rjmp main .endm - + ; ------------ Fetch phase stuff ----------------- .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: @@ -356,7 +356,7 @@ do_fetch_rst: store_ops: do_store_nop: ret - + do_store_a: mov z_a,opl ret @@ -741,8 +741,8 @@ opjumps: .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 @@ -781,7 +781,7 @@ opjumps: #endif .endm - + .macro do_z80_flags_copy_HC #if EM_Z80 bmov z_flags, ZFL_H, z_flags, ZFL_H @@ -822,7 +822,7 @@ haltinv: do_op_nop: ret - + ;---------------------------------------------------------------- ;|Mnemonic |SZHPNC|Description |Notes | ;---------------------------------------------------------------- @@ -881,7 +881,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 @@ -944,7 +944,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) @@ -956,7 +956,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 @@ -971,7 +971,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 @@ -990,8 +990,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 @@ -1009,9 +1009,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 @@ -1028,9 +1028,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 @@ -1219,7 +1219,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 @@ -1275,13 +1275,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: @@ -1295,7 +1295,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 @@ -1309,8 +1309,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<= 0xA0) - brlo op_da_a13 ; + brlo op_da_a13 ; op_da_a12: ; ldi oph,0x60 ; add 6 to lower nibble add opl,oph ; @@ -1342,7 +1342,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 ; | @@ -1356,7 +1356,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<= 0xA0) - brlo op_da_a13 ; -op_da_a12: + brlo op_da_a13 ; +op_da_a12: ori oph,0x60 ; add 0x60 ori temp2,(1<HL | ;|EX DE,HL |------|Exchange |DE<->HL | ;-----------------------------Z80-------------------------------- -; +; do_op_exhl: lds temp,z_l lds temp2,z_h @@ -1530,7 +1530,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 ;---------------------------------------------------------------- @@ -1545,7 +1545,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 ;---------------------------------------------------------------- @@ -1560,7 +1560,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 ;---------------------------------------------------------------- @@ -1575,7 +1575,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 ;---------------------------------------------------------------- @@ -1590,7 +1590,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 ;---------------------------------------------------------------- @@ -1605,7 +1605,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 ;---------------------------------------------------------------- @@ -1620,7 +1620,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 ;---------------------------------------------------------------- @@ -1635,15 +1635,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: @@ -1909,7 +1909,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: @@ -1945,6 +1945,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 diff --git a/avr/8080int.asm b/avr/8080int.asm index 5e68a92..e04af46 100644 --- a/avr/8080int.asm +++ b/avr/8080int.asm @@ -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. @@ -29,13 +29,13 @@ ; ; 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<= 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<= 0xA0) - brlo op_da_a13 ; -op_da_a12: + brlo op_da_a13 ; +op_da_a12: ori oph,0x60 ; add 0x60 ori temp2,(1<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 diff --git a/avr/Makefile b/avr/Makefile index 38c5dd6..5b5d3d7 100644 --- a/avr/Makefile +++ b/avr/Makefile @@ -25,24 +25,24 @@ VMINOR = $(call conf-val, VMINOR, config.inc) TARGET = avrcpm -ASRC0 = avrcpm.asm +ASRC0 = avrcpm.asm -ASRC0 += config.inc macros.inc init.asm dram-refresh.asm timer.asm utils.asm +ASRC0 += config.inc macros.inc init.asm dram-refresh.asm timer.asm utils.asm ASRC0 += mmc.asm mmc-old.asm virt_ports.asm -ASRC0 += dsk_cpm.asm dsk_fat16.asm dsk_fsys.asm dsk_mgr.asm dsk_ram.asm +ASRC0 += dsk_cpm.asm dsk_fat16.asm dsk_fsys.asm dsk_mgr.asm dsk_ram.asm ASRC0 += 8080int-orig.asm 8080int.asm 8080int-jmp.asm 8080int-t3.asm 8080int-t3-jmp.asm Z80int-jmp.asm ifneq ($(DRAM_8BIT),0) ASRC0 += dram-8bit.inc dram-8bit.asm sw-uart.asm i2c.asm else - ASRC0 += dram-4bit.inc dram-4bit.asm hw-uart.asm + ASRC0 += dram-4bit.inc dram-4bit.asm hw-uart.asm endif ASRC = $(ASRC0) svnrev.inc #ASRC := $(ASRC0) svnrev.inc # Place -D or -U options here -CDEFS = -D$(MCU) +CDEFS = -D$(MCU) ifdef F_CPU CDEFS += -DF_CPU=$(F_CPU) @@ -96,7 +96,7 @@ AWK = gawk OBJCOPY = avr-objcopy CRCGEN = crcgen -HEXTOBIN = $(OBJCOPY) -I ihex -O binary --gap-fill 0xff +HEXTOBIN = $(OBJCOPY) -I ihex -O binary --gap-fill 0xff #(call conf-val,config-id,config-file) #conf-val = $(shell awk -vID=$(strip $1) '$$0 ~ "^[ \t]*\#define[ \t]+" ID "[ \t]+" {print $$3}' $2 ) @@ -122,7 +122,7 @@ AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep #AVRDUDE_NO_VERIFY = -V # Increase verbosity level. Please use this when submitting bug -# reports about avrdude. See +# reports about avrdude. See # to submit bug reports. #AVRDUDE_VERBOSE = -v -v @@ -145,7 +145,7 @@ map: $(TARGET).map bin: $(TARGET)-$(VMAJOR).$(VMINOR).bin -# Program the device. +# Program the device. program: $(TARGET).hex $(TARGET).eep $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) @@ -188,4 +188,3 @@ svnrev.inc: $(ASRC0) clean: $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).obj $(TARGET).map $(TARGET).lst \ $(TARGET)-$(VMAJOR).$(VMINOR).bin - diff --git a/avr/Z80int-jmp.asm b/avr/Z80int-jmp.asm index 7f4ccc5..ab544d8 100644 --- a/avr/Z80int-jmp.asm +++ b/avr/Z80int-jmp.asm @@ -1,6 +1,6 @@ ; 8080/Z80 Interpreter. ; This is part of the Z80-CP/M emulator written by Sprite_tm. -; +; ; Copyright (C) 2010 Sprite_tm ; Copyright (C) 2010-2013 Leo C. @@ -27,7 +27,7 @@ #if EM_Z80 .dseg -z_regs: +z_regs: z_c2: .equ oz_c2 = z_c2 - z_regs .byte 1 @@ -86,7 +86,7 @@ z_istat: #endif .cseg - + ;Init z80 z80_init: ldiw z_pc,IPLADDR @@ -155,7 +155,7 @@ int_nobreak: ;-------------------------------------------------- -; init opcode table +; init opcode table ; ; opctable opc_name, pos ; @@ -191,7 +191,7 @@ int_nobreak: .set opc_tablen_1 = 256 ;.message "add tab_1" .endif - .else + .else .if (opc_tablow_1 + opc_tablen_1) == opcjmp_table_pos_ .set opc_tablen_1 = opc_tablen_1 + 256 ;.message "tab_1++" @@ -206,7 +206,7 @@ int_nobreak: .endm ;-------------------------------------------------- -; +; ; checkspace frompos, size ; .macro checkspace @@ -236,7 +236,7 @@ int_nobreak: ; ; instr fetch, op, store ; -.macro instr +.macro instr .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 @@ -297,7 +297,7 @@ int_nobreak: .org l_@0_@1_@2 .if fetch_ ; must fetch - .if op_ || store_ + .if op_ || store_ .if do_@0 == 0 m_do_@0 .else @@ -335,7 +335,7 @@ int_nobreak: .else ljmp do_@2 ; store is allways last .endif - .endif + .endif .endif .endif @@ -499,12 +499,12 @@ do_fetch_dir16: store_ops: .equ do_store_nop = do_x_nop - + do_store_a: mov z_a,opl ret -;.macro m_do_store_b +;.macro m_do_store_b ; std y+oz_b,opl ;.endm ;.equ do_store_b = 0 @@ -850,8 +850,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 @@ -890,7 +890,7 @@ do_store_am: #endif .endm - + .macro do_z80_flags_copy_HC #if EM_Z80 bmov z_flags, ZFL_H, z_flags, ZFL_C @@ -978,7 +978,7 @@ do_op_outa: ; out (opl),a ; do_op_ina: ; in a,(opl) .if PORT_DEBUG - push opl + push opl cp opl,_0 ; don't debug port 0 (con stat) breq dbg_op_ina_1 printnewline @@ -1050,7 +1050,7 @@ do_op_inc: bst z_flags,ZFL_C ; save C flag subi opl,-1 in temp,sreg - ldpmx z_flags,flagmap_tab,temp + ldpmx z_flags,flagmap_tab,temp bld z_flags,ZFL_C ret #endif @@ -1125,7 +1125,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) @@ -1152,7 +1152,7 @@ do_op_incBC: ;|DEC xx |------|Decrement |xx=xx-1 | ;|DEC ss |------|Decrement |ss=ss-1 | ; -; +; do_op_dec16: subi opl, 1 sbci oph, 0 @@ -1182,7 +1182,7 @@ do_op_decBC: ; ; 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 @@ -1201,8 +1201,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 @@ -1220,9 +1220,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 @@ -1239,9 +1239,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 @@ -1424,7 +1424,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 @@ -1479,13 +1479,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: @@ -1499,7 +1499,7 @@ do_op_rmem8: #if 0 #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 @@ -1514,8 +1514,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<= 0xA0) - brlo op_da_a13 ; + brlo op_da_a13 ; op_da_a12: ; ldi oph,0x60 ; add 6 to lower nibble add opl,oph ; @@ -1546,8 +1546,8 @@ op_da_sub: ;Else (sub-op) brlo op_da_s10 ; | op_da_s01: ; then ldi oph,0x06 ; add 6 to lower nibble - sub opl,oph ; - brhc PC+2 ; if + sub opl,oph ; + brhc PC+2 ; if ori temp2,(1<= 0xA0) - brlo op_da_s13 ; + brlo op_da_s13 ; op_da_s12: ; ldi oph,0x60 ; add 6 to lower nibble sub opl,oph ; @@ -1573,7 +1573,7 @@ do_op_DAA: ldi oph,0 ;oph: what to add #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 @@ -1590,7 +1590,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<= 0xA0) - brlo op_da_a13 ; -op_da_a12: + brlo op_da_a13 ; +op_da_a12: ori oph,0x60 ; add 0x60 ori temp2,(1<= 0x90) brlo op_da_s03 ; | -op_da_s02: +op_da_s02: ori oph,0x60 ; sub 0x60 ori temp2,(1<= 0xA0) - brlo op_da_s13 ; -op_da_s12: + brlo op_da_s13 ; +op_da_s12: ori oph,0x60 ; sub 0x60 ori temp2,(1<HL | ;|EX DE,HL |------|Exchange |DE<->HL | ;-----------------------------Z80-------------------------------- -; +; do_op_exhl: movw temp,z_l movw z_l,opl @@ -1811,7 +1811,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 ;---------------------------------------------------------------- @@ -1826,7 +1826,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 ;---------------------------------------------------------------- @@ -1841,7 +1841,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 ;---------------------------------------------------------------- @@ -1856,7 +1856,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 ;---------------------------------------------------------------- @@ -1871,7 +1871,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 ;---------------------------------------------------------------- @@ -1886,7 +1886,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 ;---------------------------------------------------------------- @@ -1901,7 +1901,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 ;---------------------------------------------------------------- @@ -1916,7 +1916,7 @@ 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 ;---------------------------------------------------------------- @@ -1952,7 +1952,7 @@ do_op_djnz: dec z_b brne opdjnze pop temp ; nix tun - pop temp ; direkt zurueck zu main + pop temp ; direkt zurueck zu main opdjnze: ret @@ -2099,10 +2099,10 @@ do_op_prefixCB: ; 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. opctable opcjmp, PC ;+3*256 - + instr fetch_nop, op_nop, store_nop ;00 ;NOP instr fetch_DIR16, op_nop, store_BC ;01 nn nn ;LD BC,nn instr fetch_nop, op_nop, store_MBC ;02 ;LD (BC),A @@ -2558,7 +2558,7 @@ do_op_stxx: ;store xx to mem loc in opl:h ;---------------------------------------------------------------- ;|EX [SP],IX|------|Exchange |[SP]<->IX | ;|EX [SP],IY|------|Exchange |[SP]<->IY | -; +; checkspace PC, 13 do_op_EXxx: @@ -2889,25 +2889,25 @@ instr fetch_nop, op_noni, store_nop ;FF ; checkspace PC, 9 do_op_rlc: - ;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. clr temp lsl opl adc temp,_0 or opl,temp - ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N or z_flags,temp ret checkspace PC, 9 -do_op_rrc: - ;Rotate Right Cyclical. All bits move 1 to the +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 + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N bmov z_flags,ZFL_C, opl,7 ret @@ -2915,14 +2915,14 @@ do_op_rrc: checkspace PC, 11 do_op_rl: - ;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 sec rol opl in temp,sreg - ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N bmov z_flags,ZFL_C, temp,AVR_C ret @@ -2930,13 +2930,13 @@ do_op_rl: checkspace PC, 10 do_op_rr: - ;Rotate Right. All bits move 1 to the right, the lsb + ;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 + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N bmov z_flags,ZFL_C, temp,AVR_C ; ret @@ -2945,7 +2945,7 @@ do_op_rr: do_op_sla: lsl opl in temp,sreg - ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N bmov z_flags,ZFL_C, temp,AVR_C ; ret @@ -2955,7 +2955,7 @@ 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 + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N bmov z_flags,ZFL_C, temp,AVR_C ; ret @@ -2965,7 +2965,7 @@ do_op_sll: sec rol opl in temp,sreg - ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N bmov z_flags,ZFL_C, temp,AVR_C ; ret @@ -2974,7 +2974,7 @@ do_op_sll: do_op_srl: lsr opl in temp,sreg - ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N + ldpmx z_flags,sz53p_tab,opl ;S,Z,H,P,N bmov z_flags,ZFL_C, temp,AVR_C ; ret @@ -3141,7 +3141,7 @@ opbite: ; ret -;.macro m_do_store_b +;.macro m_do_store_b ; std y+oz_b,opl ;.endm ;.equ do_store_b = 0 @@ -3259,7 +3259,7 @@ instr fetch_E, op_BIT0, store_nop ;43 ;BIT 0,E instr fetch_H, op_BIT0, store_nop ;44 ;BIT 0,H instr fetch_L, op_BIT0, store_nop ;45 ;BIT 0,L instr fetch2_mhl, op_BIT0, store_nop ;46 ;BIT 0,(HL) -instr fetch_A, op_BIT0, store_nop ;47 ;BIT 0,A +instr fetch_A, op_BIT0, store_nop ;47 ;BIT 0,A instr fetch_B, op_BIT1, store_nop ;48 ;BIT 1,B instr fetch_C, op_BIT1, store_nop ;49 ;BIT 1,C instr fetch_D, op_BIT1, store_nop ;4A ;BIT 1,D @@ -3454,7 +3454,7 @@ instr fetch_nop, op_RLC, store2_D ;02 ;RLC (Ix+d),D instr fetch_nop, op_RLC, store2_E ;03 ;RLC (Ix+d),E instr fetch_nop, op_RLC, store2_H ;04 ;RLC (Ix+d),H instr fetch_nop, op_RLC, store2_L ;05 ;RLC (Ix+d),L -instr fetch_nop, op_RLC, store_nop ;06 ;RLC (Ix+d) +instr fetch_nop, op_RLC, store_nop ;06 ;RLC (Ix+d) instr fetch_nop, op_RLC, store2_A ;07 ;RLC (Ix+d),A instr fetch_nop, op_RRC, store2_B ;08 ;RRC (Ix+d),B instr fetch_nop, op_RRC, store2_C ;09 ;RRC (Ix+d),C @@ -3462,7 +3462,7 @@ instr fetch_nop, op_RRC, store2_D ;0A ;RRC (Ix+d),D instr fetch_nop, op_RRC, store2_E ;0B ;RRC (Ix+d),E instr fetch_nop, op_RRC, store2_H ;0C ;RRC (Ix+d),H instr fetch_nop, op_RRC, store2_L ;0D ;RRC (Ix+d),L -instr fetch_nop, op_RRC, store_nop ;0E ;RRC (Ix+d) +instr fetch_nop, op_RRC, store_nop ;0E ;RRC (Ix+d) instr fetch_nop, op_RRC, store2_A ;0F ;RRC (Ix+d),A instr fetch_nop, op_RL, store2_B ;10 ;RL (Ix+d),B instr fetch_nop, op_RL, store2_C ;11 ;RL (Ix+d),C @@ -3470,7 +3470,7 @@ instr fetch_nop, op_RL, store2_D ;12 ;RL (Ix+d),D instr fetch_nop, op_RL, store2_E ;13 ;RL (Ix+d),E instr fetch_nop, op_RL, store2_H ;14 ;RL (Ix+d),H instr fetch_nop, op_RL, store2_L ;15 ;RL (Ix+d),L -instr fetch_nop, op_RL, store_nop ;16 ;RL (Ix+d) +instr fetch_nop, op_RL, store_nop ;16 ;RL (Ix+d) instr fetch_nop, op_RL, store2_A ;17 ;RL (Ix+d),A instr fetch_nop, op_RR, store2_B ;18 ;RR (Ix+d),B instr fetch_nop, op_RR, store2_C ;19 ;RR (Ix+d),C @@ -3478,7 +3478,7 @@ instr fetch_nop, op_RR, store2_D ;1A ;RR (Ix+d),D instr fetch_nop, op_RR, store2_E ;1B ;RR (Ix+d),E instr fetch_nop, op_RR, store2_H ;1C ;RR (Ix+d),H instr fetch_nop, op_RR, store2_L ;1D ;RR (Ix+d),L -instr fetch_nop, op_RR, store_nop ;1E ;RR (Ix+d) +instr fetch_nop, op_RR, store_nop ;1E ;RR (Ix+d) instr fetch_nop, op_RR, store2_A ;1F ;RR (Ix+d),A instr fetch_nop, op_SLA, store2_B ;20 ;SLA (Ix+d),B instr fetch_nop, op_SLA, store2_C ;21 ;SLA (Ix+d),C @@ -3486,7 +3486,7 @@ instr fetch_nop, op_SLA, store2_D ;22 ;SLA (Ix+d),D instr fetch_nop, op_SLA, store2_E ;23 ;SLA (Ix+d),E instr fetch_nop, op_SLA, store2_H ;24 ;SLA (Ix+d),H instr fetch_nop, op_SLA, store2_L ;25 ;SLA (Ix+d),L -instr fetch_nop, op_SLA, store_nop ;26 ;SLA (Ix+d) +instr fetch_nop, op_SLA, store_nop ;26 ;SLA (Ix+d) instr fetch_nop, op_SLA, store2_A ;27 ;SLA (Ix+d),A instr fetch_nop, op_SRA, store2_B ;28 ;SRA (Ix+d),B instr fetch_nop, op_SRA, store2_C ;29 ;SRA (Ix+d),C @@ -3494,7 +3494,7 @@ instr fetch_nop, op_SRA, store2_D ;2A ;SRA (Ix+d),D instr fetch_nop, op_SRA, store2_E ;2B ;SRA (Ix+d),E instr fetch_nop, op_SRA, store2_H ;2C ;SRA (Ix+d),H instr fetch_nop, op_SRA, store2_L ;2D ;SRA (Ix+d),L -instr fetch_nop, op_SRA, store_nop ;2E ;SRA (Ix+d) +instr fetch_nop, op_SRA, store_nop ;2E ;SRA (Ix+d) instr fetch_nop, op_SRA, store2_A ;2F ;SRA (Ix+d),A instr fetch_nop, op_SLL, store2_B ;30 ;SLL (Ix+d),B instr fetch_nop, op_SLL, store2_C ;31 ;SLL (Ix+d),C @@ -3502,7 +3502,7 @@ instr fetch_nop, op_SLL, store2_D ;32 ;SLL (Ix+d),D instr fetch_nop, op_SLL, store2_E ;33 ;SLL (Ix+d),E instr fetch_nop, op_SLL, store2_H ;34 ;SLL (Ix+d),H instr fetch_nop, op_SLL, store2_L ;35 ;SLL (Ix+d),L -instr fetch_nop, op_SLL, store_nop ;36 ;SLL (Ix+d) +instr fetch_nop, op_SLL, store_nop ;36 ;SLL (Ix+d) instr fetch_nop, op_SLL, store2_A ;37 ;SLL (Ix+d),A instr fetch_nop, op_SRL, store2_B ;38 ;SRL (Ix+d),B instr fetch_nop, op_SRL, store2_C ;39 ;SRL (Ix+d),C @@ -3510,7 +3510,7 @@ instr fetch_nop, op_SRL, store2_D ;3A ;SRL (Ix+d),D instr fetch_nop, op_SRL, store2_E ;3B ;SRL (Ix+d),E instr fetch_nop, op_SRL, store2_H ;3C ;SRL (Ix+d),H instr fetch_nop, op_SRL, store2_L ;3D ;SRL (Ix+d),L -instr fetch_nop, op_SRL, store_nop ;3E ;SRL (Ix+d) +instr fetch_nop, op_SRL, store_nop ;3E ;SRL (Ix+d) instr fetch_nop, op_SRL, store2_A ;3F ;SRL (Ix+d),A instr fetch_nop, op_BIT0, store_nop ;40 ;BIT 0,(Ix+d),B instr fetch_nop, op_BIT0, store_nop ;41 ;BIT 0,(Ix+d),C @@ -3519,7 +3519,7 @@ instr fetch_nop, op_BIT0, store_nop ;43 ;BIT 0,(Ix+d),E instr fetch_nop, op_BIT0, store_nop ;44 ;BIT 0,(Ix+d),H instr fetch_nop, op_BIT0, store_nop ;45 ;BIT 0,(Ix+d),L instr fetch_nop, op_BIT0, store_nop ;46 ;BIT 0,(Ix+d) -instr fetch_nop, op_BIT0, store_nop ;47 ;BIT 0,(Ix+d),A +instr fetch_nop, op_BIT0, store_nop ;47 ;BIT 0,(Ix+d),A instr fetch_nop, op_BIT1, store_nop ;48 ;BIT 1,(Ix+d),B instr fetch_nop, op_BIT1, store_nop ;49 ;BIT 1,(Ix+d),C instr fetch_nop, op_BIT1, store_nop ;4A ;BIT 1,(Ix+d),D @@ -3720,7 +3720,7 @@ instr fetch_nop, op_SET7, store2_A ;FF ;SET 7,(Ix+d),A do_op_in: ; in opl,(opl) .if PORT_DEBUG - push opl + push opl cp opl,_0 ; don't debug port 0 (con stat) breq dbg_op_in_1 printnewline @@ -3819,7 +3819,7 @@ do_op_ADCHL: lsr z_flags ; ZFL_C --> Carry ldi z_flags,0 ; clear N adc z_l,opl - in temp,sreg ; save lower Z + in temp,sreg ; save lower Z adc z_h,oph in temp2,sreg @@ -3925,7 +3925,7 @@ do_op_ldar: ldd z_a,y+oz_r op_ldar1: bst z_flags,ZFL_C ;save C - ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N + ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N bld z_flags,ZFL_C ; ldd temp,y+oz_istat bmov z_flags,ZFL_P, temp,IFF2 @@ -3958,7 +3958,7 @@ do_op_rld: or temp,oph mov z_a,temp bst z_flags,ZFL_C ;save C - ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N + ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N bld z_flags,ZFL_C ; ret @@ -3975,7 +3975,7 @@ do_op_rrd: or temp,oph mov z_a,temp bst z_flags,ZFL_C ;save C - ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N + ldpmx z_flags,sz53p_tab,z_a ;S,Z,H,P,N bld z_flags,ZFL_C ; ret @@ -4071,7 +4071,7 @@ do_op_LDDR: op_CPxx_common: movw x,z_l ; HL - + movw z,z_c ;BC cbr z_flags,(1< 21 cycles ; vim:set ts=8 noet nowrap - diff --git a/avr/dsk_cpm.asm b/avr/dsk_cpm.asm index 91cd434..d965ff3 100644 --- a/avr/dsk_cpm.asm +++ b/avr/dsk_cpm.asm @@ -49,9 +49,9 @@ cpm_lba_to_phys: ; [r] seektrk Track to read ; -------------------------------------------------------------------- ; Description: -; ==================================================================== +; ==================================================================== cpm_add_partition: - + ldi temp,dskType_CPM std y+0,temp @@ -63,7 +63,7 @@ cpm_add_partition: std y+3,temp ldd temp,z+PART_START+3 std y+4,temp - + ldd temp,z+PART_SIZE+2 ldd temp2,z+PART_SIZE+3 or temp,temp2 ;part size larger than 65535 sectors? @@ -81,8 +81,7 @@ cpm_add_prune: cpm_add_e: ret - + #endif /* CPMDSK_SUPPORT */ ; vim:set ts=8 noet nowrap - diff --git a/avr/dsk_fat16.asm b/avr/dsk_fat16.asm index 74d162e..aeb1e5a 100644 --- a/avr/dsk_fat16.asm +++ b/avr/dsk_fat16.asm @@ -32,9 +32,9 @@ #if FAT16_SUPPORT -; ############################################################################ +; ############################################################################ ; Defines for FAT16 Structures -; ############################################################################ +; ############################################################################ /*These are the Offsets to the Variables within the Bootsector of a FAT16 Partition. @@ -52,15 +52,15 @@ #define FAT16_IMAGENAME_PREFIX "CPMDSK_" #define FAT16_IMAGENAME_SUFFIX "IMG" -; ############################################################################ +; ############################################################################ ; Start of Data Segment -; ############################################################################ +; ############################################################################ .dseg fat_vars: fat_partfound: .byte 1 ; (partition: 0= no found 0xff=found ) -fat_parttbl: .byte 4 ; first fat16 partition entry +fat_parttbl: .byte 4 ; first fat16 partition entry ; only startsector is needed fat_clustersize: .byte 1 ; sectors per cluster fat_ptr2fat: .byte 4 ; pointer to the first fat sector @@ -93,9 +93,9 @@ fat_buf: .byte 512 .endif -; ############################################################################ +; ############################################################################ ; Start of Code Segment -; ############################################################################ +; ############################################################################ .cseg @@ -164,11 +164,11 @@ fat_reset_cache: ; This funktion sets the internal Variables to the Start and Size ; of a given FAT16 Paritition. This Information will be used for a ; later scanning of the Partition. See Function "fat_scan_partition" -; for more information. +; for more information. ; ============================================================================ fat_add_partition: - + .if FAT16_DEBUG > 0 printstring "fat16 part found" printnewline @@ -194,7 +194,7 @@ fat_add_partition: ret ; ============================================================================ -; Read and Scann a FAT16 Partition for Imagedatefiles +; Read and Scann a FAT16 Partition for Imagedatefiles ; ============================================================================ ; Registers : none ; Variables : none @@ -212,8 +212,8 @@ fat_scan_partition: ; Check if a FAT16 Partition was realy found lds yl,fat_partfound - cpi yl,0 - breq fat_scan_error + cpi yl,0 + breq fat_scan_error .if FAT16_DEBUG > 0 @@ -232,8 +232,8 @@ fat_scan_partition: .endif ; Scan partition start - ldiw z,fat_parttbl - ldd xl,z+0 + ldiw z,fat_parttbl + ldd xl,z+0 ldd xh,z+1 ldd yl,z+2 ldd yh,z+3 @@ -321,7 +321,7 @@ fat_bootblock_check: ldd _tmp1,z+FAT16_BSO_RESSECT+1 ; Calculate begin of FAT within the Volume - ldd xl,y+o_fat_parttbl+0 + ldd xl,y+o_fat_parttbl+0 ldd xh,y+o_fat_parttbl+1 ldd temp,y+o_fat_parttbl+2 ldd temp2,y+o_fat_parttbl+3 @@ -450,7 +450,7 @@ fat_next_sector_loop: ; Looks at a read directory block for image entries fat_look_for_images: - + ldiw x,hostbuf fat_look_for_loop: @@ -491,7 +491,7 @@ fat_look_continue: brne fat_look_for_loop fat_scan_next_sector: - + dec temp3 brne fat_next_sector_loop @@ -528,12 +528,12 @@ dbg_pptblraw_lp: ; Parameters: [in] yh,yl Directory entry ; ; ---------------------------------------------------------------------------- -; Registers : +; Registers : ; Variables : [used] ; [changes] temp ; ---------------------------------------------------------------------------- ; Description: -; +; ; ============================================================================ fat_store_new_entry: @@ -568,7 +568,7 @@ fat_store_new_entry: fat_st_searchpos: ldd temp,z+PTAB_TYPE tst temp - breq fat_st_insert_slot + breq fat_st_insert_slot sbrs temp,log2(dskType_FAT) rjmp fat_st_search_next @@ -620,7 +620,7 @@ fat_st_insert_slot: ldd _tmp0,y+0x1A ldd _tmp1,y+0x1B std z+PTAB_START, _tmp0 - std z+PTAB_START+1,_tmp1 + std z+PTAB_START+1,_tmp1 std z+PTAB_START+2,temp2 std z+PTAB_START+3,_0 @@ -645,11 +645,11 @@ fat_st_insert_slot: adc xh,_0 adc temp,_0 -; store ammount of sectors in partitiontable +; store ammount of sectors in partitiontable tst temp ;file size larger than 65535 sectors? breq fat_add_noprune - + ldi xl,255 ldi xh,255 fat_add_noprune: @@ -675,7 +675,7 @@ fat_add_noprune: pop yl pop yh .endif - + ; Table counts one more entry if it was'nt allready full @@ -699,7 +699,7 @@ fat_add_nomore: ; ============================================================================ -; Function: Cluster to HostSector +; Function: Cluster to HostSector ; ============================================================================ ; Registers: [in] xl,xh Cluster Number ; [out] yh,yl,xh,xl Sector Number on Disk @@ -751,7 +751,7 @@ fat_c2s_end: ; ==================================================================== ; Function: Searches a physical Cluster, given the logical Cluster ; ==================================================================== -; Registers: [in] xh:xl logical- Cluster +; Registers: [in] xh:xl logical- Cluster ; [out] temp2:temp physical- Cluster ; Variables: ; -------------------------------------------------------------------- @@ -769,9 +769,9 @@ fat_find_phsy_clust: lcall printhexw printnewline .endif - + ; Get First FAT- Cluster Number of Diskimage - + ldd temp, z+1 ldd temp2,z+2 @@ -781,7 +781,7 @@ fat_find_phsy_clust: printnewline .endif -fat_next_phsy_clust: +fat_next_phsy_clust: cp xl,_0 cpc xh,_0 breq fat_found_phsy_clust @@ -790,7 +790,7 @@ fat_next_phsy_clust: ; Trick: 512 Bytes Per Sector equals to 256 FAT- entries per Sector ; so given: temp is the Offset within the FAT Sector -; temp2 is the number off the FAT sector to Read +; temp2 is the number off the FAT sector to Read push xl push xh @@ -836,7 +836,7 @@ fat_next_phsy_clust: push zh ldiw z,fat_buf -; in zh,zl Pointer to Word within the Sector to read +; in zh,zl Pointer to Word within the Sector to read ; in yh..xl Start sector number (LBA) ; out zh,zl word thats been read lcall mmcReadSect @@ -873,20 +873,20 @@ fat_phys_1: sbiw x,1 rjmp fat_next_phsy_clust - + ; Found the physical cluster fat_found_phsy_clust: - + .if FAT16_DBG_FAT > 0 printstring "Found phys. Cluster at:" lcall printhexw printnewline -.endif +.endif ret ; ============================================================================ -; Function: This Routine searches for the Sector within an Imagefile +; Function: This Routine searches for the Sector within an Imagefile ; ============================================================================ ; Registers: [out] xl,xh,yl,yh Pointer to the sector on the SD-Card ; [out] temp Error variable (0= No Error) @@ -908,7 +908,7 @@ fat_found_phsy_clust: ; also the same, then the cached physical sector will be used. ; When the clusters or the disks don't match, a seek for the physical ; cluster is performed. This seek is done thru an access over the fat of -; the fat16 partition. the routine starts at the first cluster of the +; the fat16 partition. the routine starts at the first cluster of the ; imagefile and goes along the linked list of clusternumber till it reaches ; the searched cluster. The found clusternumber will be used to calculate ; the sektor where this cluster lies on the sd card. Both the found physical @@ -942,16 +942,16 @@ fat_search_clst_lp: ror _tmp0 ror xh ror xl - + lsr zl rjmp fat_search_clst_lp - + ; at this point xh and xl are carying the logical cluster number ; printstring "find subsector" ; ################# Get subsector within the logical cluster for later use -fat_found_clst: +fat_found_clst: mov _tmp0,xl ldd zl,y+o_fat_clustersize lsr zl @@ -961,7 +961,7 @@ fat_search_clst_lp2: lsl _tmp0 lsr zl - rjmp fat_search_clst_lp2 + rjmp fat_search_clst_lp2 fat_found_subsec: mov zl,temp @@ -1017,7 +1017,7 @@ fat_wrong_cache_clst: printnewline pop temp pop temp2 -.endif +.endif ; Save the found Sector for later use into cache @@ -1026,7 +1026,7 @@ fat_wrong_cache_clst: std y+o_fat_clust_ptr+2,temp std y+o_fat_clust_ptr+3,temp2 -; Add- Subsector to Startsector +; Add- Subsector to Startsector fat_add_offset: ldd zl,y+o_fat_clust_offset add xl,zl @@ -1050,4 +1050,3 @@ fat_add_offset: #endif /* FAT16_SUPPORT */ ; vim:set ts=8 noet nowrap - diff --git a/avr/dsk_fsys.asm b/avr/dsk_fsys.asm index 4f9b226..057d523 100644 --- a/avr/dsk_fsys.asm +++ b/avr/dsk_fsys.asm @@ -155,7 +155,7 @@ dbg_pcpel: pop xl pop xh ret - + dbg_print_biosd: printnewline lds temp,bcbadr @@ -176,7 +176,7 @@ dbg_print_biosd: printstring " " ret .endif - + ; ==================================================================== ; ==================================================================== ; Function: Get a Pointer to a Partitiontable entry @@ -191,7 +191,7 @@ dbg_print_biosd: ; Description: ; ==================================================================== dsk_getpartentry: - + ldi zh,PARTENTRY_SIZE mul zh,zl ldiw z,hostparttbl @@ -205,13 +205,13 @@ dsk_getpartentry: ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; Registers : -; Variables : -; +; Registers : +; Variables : +; ; -------------------------------------------------------------------- ; Description: ; ==================================================================== - + dsk_param_getadr: ldiw z,biospar_base add zl,temp3 @@ -242,7 +242,7 @@ sbcb_l: st z+,temp dec temp3 brne sbcb_l - + ; rcall dbg_print_biosd rcall dpb_drvtblclear ; rcall dbg_prdrvtbl @@ -254,8 +254,8 @@ sbcb_l: ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; Registers : -; Variables : +; Registers : +; Variables : ; return 0, if selected disk not exist. ; return !0, if disk exist ; -------------------------------------------------------------------- @@ -289,7 +289,7 @@ dskDiskCheck: ldi temp2,0x40 ldi temp,2 lcall clockput -; sbrs temp,7 +; sbrs temp,7 ; rjmp dsk_dchpart0 lcall mgr_prnt_parttbl @@ -301,7 +301,7 @@ dskDiskCheck: dsk_dchpart0: cbr temp2,0x80 lds temp,seekdsk - + ; Check if selected disk # is less then # of disks. dsk_dchpart1: @@ -329,14 +329,14 @@ dsk_dchend: printstring ", " lcall printhexw pop temp -.endif +.endif ret dsk_dch_err: ldi temp,0 ;error return - ret - + ret + ; Check RAMDISK dsk_dchrd: @@ -357,8 +357,8 @@ dsk_dchrd_err: ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; Registers : -; Variables : +; Registers : +; Variables : ; -------------------------------------------------------------------- ; Description: ; ==================================================================== @@ -367,7 +367,7 @@ dskErrorRet: lds temp,erflag ret - + ; ==================================================================== ; ==================================================================== @@ -381,39 +381,39 @@ str_CPM_Disk: dpbdat_avrcpm: ;(dpb243) .db 0x00,0x1A ;sector offset, low(spt) - .db 0x00,0x03 ;high (spt), block shift - .db 0x07,0x00 ;bock mask, extent mask + .db 0x00,0x03 ;high (spt), block shift + .db 0x07,0x00 ;bock mask, extent mask .db 0xF2,0x00 ;disk size - 1, - .db 0x3F,0x00 ;dir max + .db 0x3F,0x00 ;dir max .db 0xC0,0x00 ;alloc0, alloc1 .db 0x10,0x00 ;chk size .db 0x02,0x00 ;offset dpbdat_myz80: ; .db 0x02,0x80 ;sector offset, low(spt) - .db 0x00,0x05 ;high (spt), block shift - .db 0x1F,0x01 ;bock mask, extent mask + .db 0x00,0x05 ;high (spt), block shift + .db 0x1F,0x01 ;bock mask, extent mask .db 0xFF,0x07 ;disk size - 1, - .db 0xFF,0x03 ;dir max + .db 0xFF,0x03 ;dir max .db 0xFF,0x00 ;alloc0, alloc1 .db 0x00,0x01 ;chk size .db 0x00,0x00 ;offset dpbdat_simhd: ; .db 0x00,0x20 ;sector offset, low(spt) - .db 0x00,0x05 ;high (spt), block shift - .db 0x1F,0x01 ;bock mask, extent mask + .db 0x00,0x05 ;high (spt), block shift + .db 0x1F,0x01 ;bock mask, extent mask .db 0xF9,0x07 ;disk size - 1, - .db 0xFF,0x03 ;dir max + .db 0xFF,0x03 ;dir max .db 0xFF,0x00 ;alloc0, alloc1 .db 0x00,0x01 ;chk size .db 0x06,0x00 ;offset #if 0 -;rd1016 +;rd1016 .db 0x20,0x00 ;spt .db 0x04,0x0F ;block shift, bock mask - .db 0x00,0xFB ;extent mask, low(disk size -1), + .db 0x00,0xFB ;extent mask, low(disk size -1), .db 0x01,0xBF ;high(disk size -1), low(dir max) .db 0x00,0xE0 ;high(dir max), alloc0 .db 0x00,0x30 ;alloc1, low(chk size) @@ -422,7 +422,7 @@ dpbdat_simhd: ; ;rd9192s .db 0x20,0x00 ;spt .db 0x05,0x1F ;block shift, bock mask - .db 0x01,0xFD ;extent mask, low(disk size -1), + .db 0x01,0xFD ;extent mask, low(disk size -1), .db 0x07,0xFF ;high(disk size -1), low(dir max) .db 0x01,0xF0 ;high(dir max), alloc0 .db 0x00,0x80 ;alloc1, low(chk size) @@ -437,9 +437,9 @@ dpbdat_simhd: ; ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; Registers : -; Variables : -; +; Registers : +; Variables : +; ; -------------------------------------------------------------------- ; Description: ; ==================================================================== @@ -451,16 +451,16 @@ dpb_drvtbl_entry_p: add xl,temp adc xh,_0 ret - + ; ==================================================================== ; Function: get drive table entry for drive # in temp ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; Registers : -; Variables : -; +; Registers : +; Variables : +; ; -------------------------------------------------------------------- ; Description: ; ==================================================================== @@ -468,7 +468,7 @@ dpb_drvtbl_entry_p: dpb_drvtbl_entry_get: rcall dpb_drvtbl_entry_p - ljmp dram_readw_pp + ljmp dram_readw_pp ; ==================================================================== @@ -476,9 +476,9 @@ dpb_drvtbl_entry_get: ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; Registers : -; Variables : -; +; Registers : +; Variables : +; ; -------------------------------------------------------------------- ; Description: ; ==================================================================== @@ -489,7 +489,7 @@ dpb_drvtblclear: ldsw x,biosdrvtbl sbiw x,0 breq dpb_drvi_ex - + dpb_drvi_1: ldi temp3,8 dpb_drvi_lp: @@ -498,7 +498,7 @@ dpb_drvi_lp: rcall dram_writew_pp dec temp3 brne dpb_drvi_lp - + lds temp,biosenddat lds temp2,biosenddat+1 cp temp,_0 @@ -516,7 +516,7 @@ dpb_drvi_ex: ; Parameters ; -------------------------------------------------------------------- ; Registers : temp drive # -; +; ; -------------------------------------------------------------------- ; Description: Not implemented yet. ; ==================================================================== @@ -532,7 +532,7 @@ dsk_tst_avrcpmhd: ; Parameters ; -------------------------------------------------------------------- ; Registers : temp drive # -; +; ; -------------------------------------------------------------------- ; Description: From the YAZE Doc: ; @@ -566,7 +566,7 @@ dsk_tst_yaze: lpm temp2,z+ ; get length lcall strncmp_p brne dsk_tyze_not - + ldiw z,hostbuf+31 clt ;dpb in RAM ldi temp,1 ;1 sector header size @@ -578,14 +578,14 @@ dsk_tst_yaze: dsk_tyze_not: clr temp ;Not a YAZE disk image. ret - + ; ==================================================================== ; Function: Test disk format: MyZ80 ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- ; Registers : temp drive # -; +; ; -------------------------------------------------------------------- ; Description: Test, if first 2 Sectors are filled with 0xE5, ; and Size = 8192KB + 256Bytes. @@ -601,10 +601,10 @@ dsk_tst_myz80: ldi temp,high(16385) cpc temp2,temp brne dsk_tmyz80_not ;wrong size - + ldiw z,hostbuf ldi temp2,0 - + dsk_tmyz80_loop: ld temp,z+ cpi temp,0xE5 @@ -620,18 +620,18 @@ dsk_tmyz80_loop: dsk_tmyz80_not: clr temp ;Not a MyZ80 hard disk image. ret - + ; ==================================================================== ; Function: Test disk format: simhd, simh altair 8800 hard disk format ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- ; Registers : temp drive # -; +; ; -------------------------------------------------------------------- -; Description: Test, if Size = 8192 KB and +; Description: Test, if Size = 8192 KB and ; first 6 tracks are filled with 0xE5. -; Actually, only the first phys. sector is tested, since +; Actually, only the first phys. sector is tested, since ; the other 47 sectors are not in memory at this time. ; ==================================================================== @@ -645,13 +645,13 @@ dsk_tst_simhd: ldi temp,high(16384) cpc temp2,temp brne dsk_tsimhd_not ;wrong size - + ldiw y,hostbuf+128-10 ldiw z,str_CPM_Disk*2 lpm temp2,z+ ; get length lcall strncmp_p breq dsk_tsimhd_found - + ldiw z,hostbuf ldi temp2,high(512) clr _tmp0 ;low(512) @@ -672,14 +672,14 @@ dsk_tsimhd_found: dsk_tsimhd_not: clr temp ;Not a simhd hard disk image. ret - + ; ==================================================================== -; Function: +; Function: ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- ; Registers : temp3 drive # -; +; ; -------------------------------------------------------------------- ; Description: ; ==================================================================== @@ -688,10 +688,10 @@ dsk_format_get: ; Get first sector (512 byte) of current drive into hostbuf. - ldi temp,0 + ldi temp,0 ldi temp2,0 ; rcall dsk_readhost_lba - + ; Test for variable format avrcpmhd. rcall dsk_tst_avrcpmhd @@ -711,7 +711,7 @@ dsk_format_get: rcall dsk_tst_myz80 brne dsk_imgt_done - + ; No special image found. Use avrcpm. ldiw z,dpbdat_avrcpm*2 @@ -719,7 +719,7 @@ dsk_format_get: ori temp,0xff dsk_imgt_done: - ret + ret ; ==================================================================== ; Function: Add CP/M image format data to partition table data @@ -727,16 +727,16 @@ dsk_imgt_done: ; Parameters ; -------------------------------------------------------------------- ; Registers : temp3 drive # -; +; ; -------------------------------------------------------------------- ; Description: ; ==================================================================== dpb_imgdata_get: -; Test for known CP/M formats +; Test for known CP/M formats - rcall dsk_format_get + rcall dsk_format_get breq dpb_imgd_err ;no known format detected dpb_imgd_0: @@ -777,7 +777,7 @@ dpb_imgd_1: andi temp2,0x0f swap temp2 std z+PTAB_BSH,temp2 - + andi temp,~dskType_MASK ldd temp2,z+PTAB_TYPE andi temp2,dskType_MASK @@ -788,16 +788,16 @@ dpb_imgd_1: ret ; ==================================================================== -; Function: +; Function: ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- ; Registers : temp drive # -; +; ; return !0 if ok ; 0 on error ; -------------------------------------------------------------------- -; Description: Init CP/M data structures +; Description: Init CP/M data structures ; ; ----------------------------------------------------------------- ; DPH: | XLT | | | |DIRBUF | DPB | CSV | ALV | @@ -807,19 +807,19 @@ dpb_imgd_1: ; ------------------------------------------------------------- ; DPB: | SPT |BSH|BLM|EXM| DSM | DRM |AL0|AL1| CKS | OFF | ; ------------------------------------------------------------- -;offset: 0 2 3 4 5 7 9 10 11 13 +;offset: 0 2 3 4 5 7 9 10 11 13 ; ==================================================================== dpb_biosdph_get: mov temp3,temp ;save disk # - rcall dsk_format_get + rcall dsk_format_get brne dpb_di_0 rjmp dpb_di_err dpb_di_0: -; get mem for DPH +; get mem for DPH ldi temp, low (16) ldi temp2,high(16) @@ -837,14 +837,14 @@ dpb_di_1: lds temp2,biosdirbuf+1 rcall dram_writew_pp ;DIRBUF -; get mem for DPB - +; get mem for DPB + ldi temp, low (15) ldi temp2,high(15) rcall heap_get breq dpb_di_err_p1 movw x,temp - + adiw z,1 ;skip sector offset byte push temp3 ldi temp3,15 @@ -910,7 +910,7 @@ dpb_dicks0: mov temp,temp3 rcall dpb_drvtbl_entry_p movw temp,y - rcall dram_writew_pp + rcall dram_writew_pp ori temp,0xff ;return ok ret @@ -923,13 +923,13 @@ dpb_di_err_p1: dpb_di_err: eor temp,temp ;return 0 (+ Z-flag) ret - + ; ==================================================================== -; Function: +; Function: ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; Registers : +; Registers : ; ; -------------------------------------------------------------------- ; Description: @@ -952,16 +952,16 @@ dsk_sdrvpl: brne dsk_sdrvpl std y+o_secpblk,_tmp0 ;Sectors per block ret - + ; ==================================================================== ; Function: Does a Disk interaction ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; Registers : -; Variables : -; +; Registers : +; Variables : +; ; -------------------------------------------------------------------- ; Description: ; ==================================================================== @@ -1119,9 +1119,9 @@ dsk_sh1: ror xl dec temp brne dsk_sh1 - ;todo: temp2 should be 0 here. + ;todo: temp2 should be 0 here. ;xh:xl = host block to seek -; +; sbic flags,readop rjmp dsk_rwoper ;to perform the read @@ -1243,7 +1243,7 @@ dsk_wmove: dec temp3 brne dsk_wmove rjmp dsk_rwmfin - + dsk_rmove: ld temp,z+ mem_write @@ -1271,13 +1271,13 @@ dsk_wdir1: ret ; ==================================================================== -; Function: +; Function: ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- ; Registers : temp2:temp block to read (lba) ; temp3 disk # -; +; ; -------------------------------------------------------------------- ; Description: ; ==================================================================== @@ -1301,9 +1301,9 @@ dsk_readhost_lba: ; -------------------------------------------------------------------- ; Registers : temp2:temp host block to read/write (lba) ; temp3 disk # -; +; ; -------------------------------------------------------------------- -; Description: +; Description: ; ==================================================================== dsk_rw_hostbuf: ldiw y,fsys_vars @@ -1383,12 +1383,12 @@ dsk_writehost: rcall dsk_hostparam breq dsk_hstwr_err - + ldiw z,hostbuf rcall mmcWriteSect tst temp brne dsk_hstwr_err - + dsk_hstwr_ok: sts erflag,_0 ret @@ -1423,7 +1423,7 @@ dsk_readhost: rcall dsk_hostparam breq dsk_hstrd_err - + ldiw z,hostbuf lcall mmcReadSect tst temp @@ -1447,11 +1447,11 @@ dsk_hstrd_err: ; [r] seeksec Sector to read ; [r] seektrk Track to read ; hostdsk = host disk #, (partition #) -; hostlba = host block #, relative to partition start +; hostlba = host block #, relative to partition start ; Read/Write "hostsize" bytes to/from hostbuf ; -------------------------------------------------------------------- ; Description: -; ==================================================================== +; ==================================================================== dsk_hostparam: @@ -1480,7 +1480,7 @@ dsk_hostparam: ldd _tmp0,z+PTAB_SIZE ; get disksize ldd _tmp1,z+PTAB_SIZE+1 - + cp xl,_tmp0 ; check given sector against disksize cpc xh,_tmp1 brcc dsk_hst_param_err @@ -1545,10 +1545,9 @@ dsk_hst_param_err: pop r15 printstring " " .endif - + clr temp ret ; -------------------------------------------------------------------- ; vim:set ts=8 noet nowrap - diff --git a/avr/dsk_mgr.asm b/avr/dsk_mgr.asm index 55bca46..ba88cfe 100644 --- a/avr/dsk_mgr.asm +++ b/avr/dsk_mgr.asm @@ -30,7 +30,7 @@ ; ==================================================================== ; Parameters ; -------------------------------------------------------------------- -; +; ; Registers : [w] temp Number of disk images (raw and fat16) found. ; + 0x80 if sd card changes. (not used, doesn't work) ; SREG : Z according to temp @@ -43,7 +43,7 @@ ; on the Disk will be used for a detailed analyses. If there ; are any Files like "cpm_x.img" are found, these Files will be ; used as Disks by the CP/M- System. ( x must be in the Range A to D ) -; ==================================================================== +; ==================================================================== mgr_init_partitions: sts ndisks,_0 ; Set Number of Disks to 0 @@ -60,7 +60,7 @@ mgr_picl: lcall mmcInit andi temp,MMCST_NOINIT | MMCST_NODISK brne mgr_pierr - + ;Load first sector from MMC (boot sector) ldiw y,0 ; Sector 0 movw x,y @@ -81,7 +81,7 @@ mgr_check_bootsektor: ;Test, if it has a valid MBR lds temp,hostbuf+510 ;MBR signature (0xAA55) at and of sector? - cpi temp,0x55 + cpi temp,0x55 lds temp,hostbuf+510+1 ldi temp2,0xAA cpc temp,temp2 @@ -114,7 +114,7 @@ mgr_search: #if CPMDSK_SUPPORT -; Search for valid Partitions and ImageFiles +; Search for valid Partitions and ImageFiles ldiw z,hostbuf+510-64 ;Point to first byte of partition table mgr_ploop: @@ -125,14 +125,14 @@ mgr_ploop: ; Test for CP/M Partition cpi temp,PARTID_CPM brne mgr_nextp - + lcall cpm_add_partition inc temp3 sts ndisks,temp3 adiw y,PARTENTRY_SIZE cpi temp3,MAXDISKS breq mgr_pend - + mgr_nextp: adiw z,16 cpi zl,low(hostbuf+510) ;End of partition table reached? @@ -260,7 +260,7 @@ mgr_prtb_nofat: rcall mgr_prnt_diskname rcall mgr_prnt_table_ram rjmp mgr_prnt_size -mgr_prnt_noramdisk: +mgr_prnt_noramdisk: #endif #endif @@ -280,7 +280,7 @@ mgr_prnt_size: lcall print_ultoa printstring "KB." -mgr_goto_next_part: +mgr_goto_next_part: adiw z,PARTENTRY_SIZE inc xh dec yl @@ -290,7 +290,7 @@ mgr_pppre: pop r14 pop r15 ret - + mgr_prnt_diskname: push temp @@ -331,5 +331,3 @@ mgr_prnt_table_ram: mgr_prnt_table_err: printstring "Unknown Entry at: " ret - - diff --git a/avr/dsk_ram.asm b/avr/dsk_ram.asm index 5c8c876..924a56a 100644 --- a/avr/dsk_ram.asm +++ b/avr/dsk_ram.asm @@ -21,7 +21,7 @@ ; #ifndef RAMDISKCNT - #define RAMDISKCNT 0 + #define RAMDISKCNT 0 #endif #if RAMDISKCNT @@ -33,7 +33,7 @@ .dseg rdskbuf: .byte 32 - + .cseg ; ---------------------------------------------- @@ -43,7 +43,7 @@ rdsk_adr: lds temp2,seektrk lsr zh ror zl ;Col 0..7 - + mov temp,temp2 andi temp,0x0f swap temp @@ -53,7 +53,7 @@ rdsk_adr: mov yh,yl ;Row 8..10 lds temp,seekdsk subi temp,RAMDISKNR - + sbrc temp2,4 sbr yl,(1< 1 printnewline printstring "wr-adr: " -.endif +.endif lds xl,dmaadr lds xh,dmaadr+1 ldiw z,rdskbuf - ldi temp3,128 + ldi temp3,128 rdsk_wrldl: mem_read st z+,temp adiw x,1 dec temp3 - brne rdsk_wrldl + brne rdsk_wrldl ldi temp2,RAM_DQ_MASK | (1<= TXBUFSIZE) - ldi zl,low(txfifo) ; + ldi zl,low(txfifo) ; ldi zh,high(txfifo) ; lds temp,txidx_w ; add zl,temp ; @@ -203,4 +203,3 @@ putc_l: ret ; vim:set ts=8 noet nowrap - diff --git a/avr/i2c.asm b/avr/i2c.asm index 9b13191..ee20d06 100644 --- a/avr/i2c.asm +++ b/avr/i2c.asm @@ -1,4 +1,4 @@ -; I2C (TWI) master interface. +; I2C (TWI) master interface. ; This is part of the Z80-CP/M emulator written by Sprite_tm. ; ; Copyright (C) 2013 Leo C. @@ -21,7 +21,7 @@ ; $Id$ ; -#if I2C_SUPPORT +#if I2C_SUPPORT /* General TWI Master status codes */ #define TWI_START 0x08 /* START has been transmitted */ @@ -55,31 +55,31 @@ ; TWSTO: TWI STOP Condition Bit ; TWEN: TWI Enable Bit ; TWIE: TWI Interrupt Enable -; +; ; (1<= 0 No error ; > 0 status tbd. ; @@ -108,7 +108,7 @@ i2c_buf: INTERRUPT TWIaddr - + push temp in temp,sreg push temp @@ -117,7 +117,7 @@ i2c_buf: push zl ldiw z,i2c_var - ldd temp2,z+oi2ci_idx + ldd temp2,z+oi2ci_idx inm8 temp,TWSR cpi temp,TWI_START @@ -184,7 +184,7 @@ i2ci_MRX_DATA_NACK: i2ci_default: ldi temp,(1< 0x3f sts @0,@1 @@ -31,7 +31,7 @@ .endm ;------------------------------------------------ -; +; .macro inm8 .if @1 > 0x3f lds @0,@1 @@ -41,7 +41,7 @@ .endm ;------------------------------------------------ -; +; .macro sbism8 .if @0 > 0x1f in _tmp0,@0 @@ -55,7 +55,7 @@ ; load 16 bit constant to register pair .macro ldiw - ldi @0l, low(@1) + ldi @0l, low(@1) ldi @0h, high(@1) .endm @@ -63,7 +63,7 @@ ; load 16 bit direct from data space .macro ldsw - lds @0l, @1 + lds @0l, @1 lds @0h, @1+1 .endm @@ -71,7 +71,7 @@ ; store 16 bit direct to data space .macro stsw - sts @0, @1l + sts @0, @1l sts @0+1,@1h .endm @@ -79,7 +79,7 @@ ; add 16 bit constant to register pair .macro addiw - subi @0l, low(-@1) + subi @0l, low(-@1) sbci @0h, high(-@1) .endm @@ -87,7 +87,7 @@ ; sub 16 bit constant from register pair .macro subiw - subi @0l, low(@1) + subi @0l, low(@1) sbci @0h, high(@1) .endm @@ -102,7 +102,7 @@ .endm ;------------------------------------------------ -; +; ; ; .macro INTERRUPT @@ -112,7 +112,7 @@ .if dist_ <= 2048 rjmp pos_ - .elif (dist_ - (FLASHEND+1)) > -2048 + .elif (dist_ - (FLASHEND+1)) > -2048 .set disp_ = (dist_ - (FLASHEND+1)) & 0xFFF ; rjmp pos_ - (FLASHEND+1) .dw 0xC000 | disp_ @@ -124,7 +124,7 @@ .endm ;------------------------------------------------ -; +; ; #if 1 @@ -278,4 +278,3 @@ .endm ; vim:set ts=8 noet nowrap - diff --git a/avr/mmc-old.asm b/avr/mmc-old.asm index edb2bbf..b39b410 100644 --- a/avr/mmc-old.asm +++ b/avr/mmc-old.asm @@ -8,7 +8,7 @@ mmcByte: printstring "MMC: <--" rcall printhex .endif - + out SPDR,temp mmcWrByteW: in temp,SPSR @@ -49,7 +49,7 @@ mmcWaitErr: mmcInit: ldi temp,0x53 out SPCR,temp - + ;Init start: send 80 clocks with cs disabled sbi P_MMC_CS,mmc_cs @@ -104,7 +104,7 @@ mmcInitLoop: ;Read OCR till card is ready ldi temp2,100 ;repeat counter -mmcInitOcrLoop: +mmcInitOcrLoop: push temp2 cbi P_MMC_CS,mmc_cs ;enable /CS @@ -137,12 +137,12 @@ mmcInitOcrLoop: ldi temp,10 rcall delay_ms - + pop temp2 dec temp2 - brne mmcInitOcrLoop ;repeat + brne mmcInitOcrLoop ;repeat - ldi temp2,4 + ldi temp2,4 rjmp mmcWaitErr mmcInitOcrLoopDone: @@ -279,7 +279,7 @@ resetAVR: lds temp,txcount ;Wait, till tx buffer is empty tst temp brne resetAVR - + cli ldi temp,(1< 1 printstring "SPI_CLK_SLOW " @@ -76,7 +76,7 @@ .endm ;------------------------------------------------ -; +; .macro spi_clkfast .if MMC_DEBUG > 1 printstring "SPI_CLK_FAST " @@ -92,7 +92,7 @@ .endm ;------------------------------------------------ -; +; .macro spi_disable .if MMC_DEBUG > 1 printstring "SPI_DISABLE " @@ -133,7 +133,7 @@ mul_yx_512: rol yl rol yh ret - + ;------------------------------------------------ spi_rcvr: out SPDR,_255 @@ -157,14 +157,14 @@ spi_xmit: .endif out SPDR,temp ;fall thru -spi_wait: +spi_wait: sbism8 SPSR,SPIF rjmp spi_wait ret - + ;------------------------------------------------ -; Wait for card ready -; return 1:OK, 0:Timeout +; Wait for card ready +; return 1:OK, 0:Timeout mmcWaitReady: push temp2 @@ -187,7 +187,7 @@ mmc_wrl2: brne mmc_wrl ;tmp is 0 here mmc_wrbreak: - pop temp2 + pop temp2 tst temp ;set flags ret @@ -203,7 +203,7 @@ mmcDeselect: ret ;------------------------------------------------ -; Select the card and wait for ready +; Select the card and wait for ready ; return 255:Successful, 0:Timeout mmcSelect: @@ -212,10 +212,10 @@ mmcSelect: breq mmcDeselect ;return via Deselect sbr temp,255 ret - + ;------------------------------------------------ -; Send a command packet to MMC +; Send a command packet to MMC ; temp2: Command ; yh..xl: Argument ; return: @@ -227,8 +227,8 @@ mmcCmd: sbrs temp2,7 rjmp mmc_cmddo -; ACMD is the command sequence of CMD55-CMD - +; ACMD is the command sequence of CMD55-CMD + push yh push yl push xh @@ -246,7 +246,7 @@ mmcCmd: cpi temp,2 brlo mmc_cmddo ; fall thru, if (retval <= 1) - + tst temp ret ; else return error @@ -278,7 +278,7 @@ dmmccmd_nonl: ldi temp,0xFF rjmp mmc_cmdexit - + ; Send command packet mmc_cmd_p: @@ -294,11 +294,11 @@ mmc_cmd_p: rcall spi_wait out SPDR,xl rcall spi_wait - + ldi temp,0x95 ;CRC for CMD0(0) cpi temp2,CMD0 breq mmc_cmdxcrc - ldi temp,0x87 ;CRC for CMD8(0x1AA) + ldi temp,0x87 ;CRC for CMD8(0x1AA) cpi temp2,CMD8 breq mmc_cmdxcrc ldi temp,0x01 ;Dummy CRC + Stop @@ -314,7 +314,7 @@ mmc_cmdxcrc: cpi temp2,CMD12 ; Skip a stuff byte when stop reading brne mmc_cmdres rcall spi_rcvr - + ; Wait for a valid response in timeout of 10 attempts mmc_cmdres: @@ -339,7 +339,7 @@ mmc_cmdexit: .endif tst temp ;set flags ret - + ;------------------------------------------------ ; Send command and receive ocr response ; temp2: Command, zl: expected cmd response @@ -390,7 +390,7 @@ mmc_ttex: ; Initialize MMC/SD card mmcInit: -.if MMC_DEBUG +.if MMC_DEBUG printnewline printstring "mmcInit " .endif @@ -413,7 +413,7 @@ mmci_lp: cpi temp,1 breq mmci_1 rjmp mmci_lend -mmci_1: +mmci_1: ldi zh,10 ;Initialization timeout of 1000 ms. ldi temp,100 sts delay_timer1,temp @@ -432,7 +432,7 @@ mmci_1: ; The card can work at vdd range of 2.7-3.6V. ; Wait for leaving idle state (ACMD41 with HCS bit). - + ldi temp2,ACMD41 ldi yh,0x40 ldi yl,0 @@ -444,7 +444,7 @@ mmci_v2l2: rcall mmc_timeout_1s brne mmci_v2l2 rjmp mmci_sdv2end - + ; Check CCS bit in the OCR mmci_ccc: ldi temp2,CMD58 @@ -460,14 +460,14 @@ mmci_ccc: mmci_sdv2end: rjmp mmci_lend - + ; SDv1 or MMCv3 mmci_sdv1: ldi temp2,ACMD41 ldiw y,0 movw x,y - rcall mmcCmd + rcall mmcCmd cpi temp,2 brsh mmci_mmcv3 sbr temp3,CT_SD1 ;SDv1 @@ -484,19 +484,19 @@ mmci_v1_l: rcall mmc_timeout_1s brne mmci_v1_l rjmp mmci_lend ;Timeout - + ; Set R/W block length to 512 mmci_v1_2: - ldi temp2,CMD16 + ldi temp2,CMD16 ldiw x,512 rcall mmcCmd breq mmci_lend ldi temp3,0 - + mmci_lend: sts mmcCardType,temp3 rcall mmcDeselect - + ; Initialization succeded? lds temp,mmcStat @@ -520,7 +520,7 @@ mmci_lex: spi_disable ret - + ;-------------------------------------------------------------- .equ MMC_RDOP = 0 ;Read Operation @@ -543,7 +543,7 @@ mmcReadWord: printnewline printstring "mmcRdWord " .endif - ldi temp,(1< 1 - cpi temp,0xFE ;If not valid data token, + cpi temp,0xFE ;If not valid data token, breq mmc_rcv_dbg1 printstring "Token: " lcall printhex printstring " " mmc_rcv_dbg1: .endif - cpi temp,0xFE ;If not valid data token, + cpi temp,0xFE ;If not valid data token, breq mmc_rw_2 rjmp mmc_rwexit_error mmc_rw_2: @@ -678,18 +678,18 @@ mmc_rcv_readloop: rjmp mmc_rcv_readloop mmc_rcv_rle: - st z+,temp ;Store last byte in buffer + st z+,temp ;Store last byte in buffer mmc_rcv_rlend: .if MMC_DEBUG > 3 printnewline .endif rcall spi_wait ;while SPI module shifts in crc part1. rcall spi_rcvr ;Read second crc. - + ldi temp2,RES_OK ;Return success rjmp mmc_rwexit - + ;------------------------------------------------------------------------------- ; Send a data packet to MMC @@ -710,7 +710,7 @@ mmc_x_loop: out SPDR,temp sbiw yl,1 brne mmc_x_loop - + rcall spi_wait ldi temp,0xFF ;dummy crc rcall spi_xmit @@ -758,4 +758,3 @@ mmc_dbg_rwerex: ;-------------------------------------------------------------- ; vim:set ts=8 noet nowrap - diff --git a/avr/svnrev.inc b/avr/svnrev.inc index d9a547f..bf22bdf 100644 --- a/avr/svnrev.inc +++ b/avr/svnrev.inc @@ -1,7 +1,7 @@ /* This file was generated by the "svnrev" utility * (http://www.compuphase.com/svnrev.htm). * You should not modify it manually, as it may be re-generated. - * + * * $Revision: 215$ * $Date: 2013-04-27$ */ diff --git a/avr/sw-uart.asm b/avr/sw-uart.asm index 3216293..7c59245 100644 --- a/avr/sw-uart.asm +++ b/avr/sw-uart.asm @@ -1,4 +1,4 @@ -; Serial interface using the ATmega8/88 USART. +; Serial interface using the ATmega8/88 USART. ; This is part of the Z80-CP/M emulator written by Sprite_tm. ; ; Copyright (C) 2010 Leo C. @@ -25,14 +25,14 @@ #error "ATmega8 is not supported (yet)! Please update this driver, or buy an ATmega88." #endif -#define SSER_BIT_TC (F_CPU+BAUD/2) / BAUD +#define SSER_BIT_TC (F_CPU+BAUD/2) / BAUD #define SSER_CHAR_TC (10 * 1000 / BAUD) + 2 #define RXBUFMASK RXBUFSIZE-1 #define TXBUFMASK TXBUFSIZE-1 .dseg - + srx_state: .byte 1 srx_char_to: @@ -67,12 +67,12 @@ txfifo: .cseg -; Init +; Init uart_init: ; - Init clock/timer system and serial port -; Init timer 1 as +; Init timer 1 as ; - Soft UART TX (OC1A/OCR1A). ; - Soft UART RX (ICP1/ICR1). ; - 1ms System timer is already configured at this point. @@ -95,15 +95,15 @@ uart_init: sts srx_char_time,temp ret - + ;------------------------------------------------------------------ .cseg ; Timer/Counter1 Input Capture interrupt - + INTERRUPT ICP1addr - + push temp in temp,sreg push temp @@ -118,17 +118,17 @@ uart_init: outm8 TCCR1B,temp ldi temp,(1<= TXBUFSIZE) - ldi zl,low(txfifo) ; + ldi zl,low(txfifo) ; ldi zh,high(txfifo) ; lds temp,txidx_w ; add zl,temp ; @@ -577,4 +577,3 @@ uwe_loop: ; vim:set ts=8 noet nowrap - diff --git a/avr/timer.asm b/avr/timer.asm index 5a4cc12..4b25230 100644 --- a/avr/timer.asm +++ b/avr/timer.asm @@ -40,8 +40,8 @@ timer_sec: ; don't change order here, clock put/get depends on it. cntms_out: ; register for ms .byte 2 -utime_io: ; register for uptime. - .byte 4 +utime_io: ; register for uptime. + .byte 4 cnt_1ms: .equ ot_1ms = cnt_1ms-timer_var .byte 2 @@ -50,10 +50,10 @@ uptime: .byte 4 timer_top: .equ timer_size = timer_top - timer_base - + .equ utofs = cnt_1ms-cntms_out .equ timerofs = cnt_1ms-timer_ms - + clk_out: .equ oclk_out = clk_out-timer_var .byte 7 ; @@ -62,18 +62,18 @@ clock: .byte 7 ;Format (bin): s m h D M YY .equ clkofs = clock-clk_out - .cseg + .cseg ; ------------- system timer 1ms --------------- ; Timer/Counter1 Compare Match B interrupt - + INTERRUPT OC1Baddr .if TIMER_DEBUG cbi PORTC,5 -.endif +.endif push zl in zl,SREG push zl @@ -83,7 +83,7 @@ clock: addiw z,F_CPU/1000 outm8 OCR1BH,zh outm8 OCR1BL,zl - + push yl push yh ldiw y,timer_var @@ -93,7 +93,7 @@ clock: subi zl,1 brcs syscl0 ;timer was 0 before (not running) sts srx_char_to,zl ;timer is running, store new value - brne syscl0 + brne syscl0 rcall srx_to syscl0: #endif @@ -101,7 +101,7 @@ syscl0: subi zl,1 brcs syscl_t1n std y+ot_timer1,zl -syscl_t1n: +syscl_t1n: ldd zl,y+ot_timer2 subi zl,1 brcs syscl_t2n @@ -169,7 +169,7 @@ syscl_clk_date: ldd zl,y+o_clock+5 ;year andi zl,0x03 brne syscl_clknl - inc zh ;leap year + inc zh ;leap year syscl_clknl: ldd zl,y+o_clock+3 ;day inc zl @@ -201,7 +201,7 @@ syscl_end: pop zl .if TIMER_DEBUG sbi PORTC,5 -.endif +.endif reti ; days per month @@ -225,18 +225,18 @@ dly_loop: ret ; ---------------------------------------------- -; +; clockget: ldiw z,clk_out tst temp3 breq clkget_copy ;lowest byte requestet, latch clock - + add zl,temp3 adc zh,_0 ld temp,z clkget_end: ret - + clkget_copy: ldi temp3,7 @@ -255,7 +255,7 @@ clkget_l: std z+1,temp2 ldi temp3,5 clkget_l2: - ld temp,-z + ld temp,-z rcall binbcd2 st z,temp dec temp3 @@ -265,7 +265,7 @@ clkget_l2: ret ;req. byte in temp ; ---------------------------------------------- -; +; clockput: ldiw z,clk_out add zl,temp3 @@ -275,12 +275,12 @@ clockput: breq clkput_copy ;lowest byte stored, latch clock clkput_end: ret - + clkput_copy: ldi temp3,5 clkput_l2: - ld temp,z + ld temp,z rcall bcdbin2 st z+,temp dec temp3 @@ -324,7 +324,7 @@ tobcd_l: add temp,_tmp0 pop temp2 ret - + binbcd4: ldi temp3,16 @@ -428,7 +428,7 @@ rtc_get: eor temp,temp3 andi temp,0x03 breq rtc_get_1 - subi temp3, low(-1) + subi temp3, low(-1) sbci temp2, high(-1) rtc_get_1: ldiw x,clock @@ -466,7 +466,7 @@ rtc_get_e: ;---------------------------------------------- ; Set hardware clock from software clock -; +; ; Register: temp2: s ; temp3: m ; xh: h @@ -539,7 +539,7 @@ rtc_set: #endif /* I2C_SUPPORT */ ; ---------------------------------------------- -; +; utimeget: ldi temp,0xFF @@ -547,13 +547,13 @@ utimeget: subi temp3,1 brcs utimget_end ;Rel. port number = 0 ? (controlport) breq utimget_copy ;lowest byte requestet, latch clock - + add zl,temp3 adc zh,_0 ld temp,z utimget_end: ret - + utimget_copy: ldi temp2,6 cli @@ -570,7 +570,7 @@ utimget_l: utimeput: subi temp3,1 brcc utput__1 - + ; clock control cpi temp,starttimercmd @@ -583,8 +583,8 @@ utimeput: brne utcp_ex rjmp uptime_print ;cnt_1ms utcp_ex: - ret - + ret + utput_quit: rcall timer_print rjmp timer_start @@ -592,12 +592,12 @@ utput_quit: utput__1: ldiw z,cntms_out breq utput__copy ;lowest byte requestet, latch clock - + add zl,temp3 adc zh,_0 st z,temp ret - + utput__copy: st z,temp adiw z,5 @@ -628,7 +628,7 @@ ts_loop: ; print timer ; - + timer_print: push r15 ; push r14 ; @@ -646,9 +646,9 @@ timer_print: ld temp2,z+ sbc yh,temp2 brsh tp_s - + addiw y,1000 - sec + sec tp_s: push yh push yl @@ -669,7 +669,7 @@ tp_s: ldd r15,z+timerofs ld yh,z+ sbc r15,yh - + printnewline printstring "Timer running. Elapsed: " rcall print_ultoa @@ -687,7 +687,7 @@ tp_s: pop r14 pop r15 ret - + uptime_print: push r15 push r14 @@ -697,16 +697,16 @@ uptime_print: push temp ld temp,z+ push temp - + ld temp,z+ ld temp2,z+ ld r14,z+ sei ld r15,z+ - + printnewline printstring "Uptime: " - + rcall print_ultoa printstring "," @@ -722,4 +722,3 @@ uptime_print: ret ; vim:set ts=8 noet nowrap - diff --git a/avr/utils.asm b/avr/utils.asm index 5ae5c1d..bd0d8d0 100644 --- a/avr/utils.asm +++ b/avr/utils.asm @@ -35,43 +35,43 @@ print_ultoa: push r14 push temp2 push temp - + clr yl ;yl = stack level ultoa1: ldi z_flags, 32 ;yh = r15:temp % 10 clr yh ;r15:temp /= 10 -ultoa2: lsl temp - rol temp2 - rol r14 - rol r15 - rol yh - cpi yh,10 - brcs ultoa3 - subi yh,10 +ultoa2: lsl temp + rol temp2 + rol r14 + rol r15 + rol yh + cpi yh,10 + brcs ultoa3 + subi yh,10 inc temp -ultoa3: dec z_flags +ultoa3: dec z_flags brne ultoa2 cpi yh, 10 ;yh is a numeral digit '0'-'9' subi yh, -'0' push yh ;Stack it - inc yl + inc yl cp temp,_0 ;Repeat until r15:temp gets zero cpc temp2,_0 cpc r14,_0 cpc r15,_0 - brne ultoa1 - + brne ultoa1 + ldi temp, '0' ultoa5: cpi yl,3 ; at least 3 digits (ms) brge ultoa6 - push temp + push temp inc yl rjmp ultoa5 ultoa6: pop temp ;Flush stacked digits rcall uartputc - dec yl - brne ultoa6 + dec yl + brne ultoa6 pop temp pop temp2 @@ -95,7 +95,7 @@ printhexw: printhex: swap temp rcall printhexn - swap temp + swap temp ;fall thru ;Prints the lower nibble @@ -122,7 +122,7 @@ printspace: ret ;----------------------------------------------------------------------- -;Prints the zero-terminated string following the call statement. +;Prints the zero-terminated string following the call statement. printstr: push zh ;SP+5 @@ -161,7 +161,7 @@ printstr_end: pop zl pop zh ret - + ; ------------------------ String functions ------------------------- ; @@ -213,7 +213,7 @@ strncmp_pex: ;----------------------------------------------------------------------- ; Memory compare: DRAM - AVR-RAM -; DRAM-Addr. in x, AVRRAM-Addr. in y +; DRAM-Addr. in x, AVRRAM-Addr. in y ; Compare temp3 bytes. ; ; Return Z-Flag == 1 if match @@ -283,14 +283,14 @@ dbg_hdl1: cpi temp2,8 brne PC+2 rcall printspace - + rcall printspace ld temp,z+ rcall printhex dec temp2 brne dbg_hdl1 sbiw z,16 - + rcall printspace rcall printspace ldi temp2,16 @@ -312,7 +312,7 @@ dbg_hdp: pop temp2 ret #endif - + ;----------------------------------------------------------------------- ; Print a line with the 8080/Z80 registers @@ -321,7 +321,7 @@ printregs: rcall printflags printstring " A =" mov temp,z_a - rcall printhex + rcall printhex printstring " BC =" #if 1 movw temp,z_c @@ -369,7 +369,7 @@ printregs: rcall printflags printstring " a'=" ldd temp,y+oz_a2 - rcall printhex + rcall printhex printstring " bc'=" ldd temp2,y+oz_b2 ldd temp,y+oz_c2 @@ -392,7 +392,7 @@ printregs: rcall printhexw printstring " I=" ldd temp,y+oz_i - rcall printhex + rcall printhex printstring " " #endif @@ -402,11 +402,11 @@ printregs: #if EM_Z80 zflags_to_ch: .db "SZ H VNC",0,0 -#else +#else zflags_to_ch: .db "SZ H PNC",0,0 #endif - + printflags: push temp2 mov temp2,temp @@ -420,7 +420,7 @@ pr_zfl_next: breq pr_zfl_end cpi temp,' ' ; Test if no flag breq pr_zfl_noflag - sbrs temp2,7 ; + sbrs temp2,7 ; ldi temp,' ' ; Flag not set rcall uartputc pr_zfl_noflag: @@ -428,9 +428,8 @@ pr_zfl_noflag: rjmp pr_zfl_next pr_zfl_end: pop zh - pop zl + pop zl pop temp2 ret ; vim:set ts=8 noet nowrap - diff --git a/avr/virt_ports.asm b/avr/virt_ports.asm index 660f4e7..e9e7ddc 100644 --- a/avr/virt_ports.asm +++ b/avr/virt_ports.asm @@ -29,14 +29,14 @@ ; Returns 0xFF if the UART has a byte, 0 otherwise. ;01 1 in/out - Console input, aka UDR. / Console Output ;02 2 out - Console Output (deprecated) -;03 3 in - "UART" status: bit 0 = rx (UARTRXRDY) +;03 3 in - "UART" status: bit 0 = rx (UARTRXRDY) ; bit 1 = tx (UARTTXRDY) ;03 3 out - "UART" control (tbd) ;04 4 in/out - "UART" data register, no wait ; ;------------------------ Virtual I2C interface -------------------------- ;05 5 out - Control Port: 1 = Start read operation -; 2 = Start write operation +; 2 = Start write operation ;05 5 in - Status of last Transfer: 0 = ok, else fail ;06 6 in/out - Number of bytes to transfer, including Slave address ;07,08 7,8 in/out - Read/Write address low/high @@ -47,7 +47,7 @@ ;10,11 16,17 in/out - Track select ;12,13 18,19 in/out - Sector select ;14,15 20,21 in/out - Write addr -; +; ;16 22 out - Trigger disk i/o operations ; Bit 7 = 1: Read sector ; Bit 6 = 1: Write sector @@ -58,14 +58,14 @@ ; Bits 0..2: 0 - write to allocated ; 1 - write to directory ; 2 - write unallocated -; 3 - write to directory +; 3 - write to directory ; ;16 22 in - Result of last read/write operation. ; 0x00 = ok, 0xff = error (--> Bad Sector) ; ; ;------------------------ ADC Interface ---------------------------------- -;17-19 23,25 in - ADC Channels 6,7 and 8 (Temp-Sensor) +;17-19 23,25 in - ADC Channels 6,7 and 8 (Temp-Sensor) ; ADC 6,7 only Devices in 32 pin Case (TQFP/MLF) ; 8 Bit only ; Fixed ADC clock (FCPU/128, 156KHz at 20MHz CPU) @@ -73,7 +73,7 @@ ;20,21 in - ADC: Measure VCC ; ;------------------------ Wall Clock and Timers -------------------------- -;40 64-71 in/out - Timer/Clock control. +;40 64-71 in/out - Timer/Clock control. ;41-46 ; ;47-4D clock - BCD format: ss, mm, hh, DD, MM, YYl, YYh @@ -176,7 +176,7 @@ dvp_1: brts dvp_11 printstring "Port In: " rjmp dvp_12 -dvp_11: +dvp_11: printstring "Port Out: " dvp_12: push temp @@ -192,7 +192,7 @@ vprw_loop: cp _tmp1,_0 breq vprw_exit ;no more ports - mov temp3,temp2 + mov temp3,temp2 sub temp3,_tmp0 ;base port brcs vprw_next ;port # too high cp temp3,_tmp1 ;may be in range @@ -245,14 +245,14 @@ vprw_exit: ; trap for nonexistent port? .if PORT_DEBUG > 1 printstring ", not found!" -.endif +.endif ldi temp,0xff pop yl pop yh ret vport_out_dummy: - ret + ret ;--------------------------------------------------------------------- @@ -313,4 +313,3 @@ dbg_ctrl: ;--------------------------------------------------------------------- ; vim:set ts=8 noet nowrap - -- 2.39.2