summaryrefslogtreecommitdiff
path: root/avr
diff options
context:
space:
mode:
authorLeo C2015-06-09 09:31:33 +0200
committerLeo C2015-06-09 09:31:33 +0200
commit8bbf185ed81c12534c0ad9b26f0049035fde8df4 (patch)
treee250b318b3486acd854cf831138cba42fafdadd3 /avr
parentb08e079d1541c80028e3a11affec3f863eb9129d (diff)
downloadz180-stamp-8bbf185ed81c12534c0ad9b26f0049035fde8df4.zip
message buffer init changes. cp/m r/w for new memory map
Diffstat (limited to 'avr')
-rw-r--r--avr/z180-serv.c58
1 files changed, 14 insertions, 44 deletions
diff --git a/avr/z180-serv.c b/avr/z180-serv.c
index b5d8140..69bcd9c 100644
--- a/avr/z180-serv.c
+++ b/avr/z180-serv.c
@@ -211,8 +211,8 @@ void do_msg_get_set_time(uint8_t subf, int len, uint8_t * msg)
#define MAX_DRIVE 4
#define BLOCK_SIZE 512
-#define TPA_BASE 0x10000
-#define COMMON_BASE 0xC000
+//#define TPA_BASE 0x10000
+//#define COMMON_BASE 0xC000
struct cpm_drive_s {
uint8_t drv;
@@ -390,52 +390,31 @@ void do_msg_cpm_rw(uint8_t subf, int len, uint8_t * msg)
res = f_lseek(&drv_table[drv].fd, pos);
while (!res && secs--) {
- unsigned int cnt, br;
-
- /* check bank boundary crossing */
- cnt = 0;
- if (addr < (TPA_BASE + COMMON_BASE) &&
- (addr + BLOCK_SIZE) > (TPA_BASE + COMMON_BASE)) {
- cnt = (TPA_BASE + COMMON_BASE) - addr;
- }
-
- if (cnt) {
- debug_cpmsd("## %67c addr: %.5lx, cnt: %3d\n", ' ', addr, cnt);
- debug_cpmsd("## %67c addr: %.5lx, cnt: %3d\n", ' ', addr+cnt-TPA_BASE, BLOCK_SIZE-cnt);
- }
-
+ unsigned int brw;
if (dowrite) {
if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
buserr = 1;
break;
} else {
- if (cnt) {
- z80_read_block(disk_buffer, addr, cnt);
- addr = addr + cnt - TPA_BASE;
- }
- z80_read_block(disk_buffer+cnt, addr, BLOCK_SIZE - cnt);
+ z80_read_block(disk_buffer, addr, BLOCK_SIZE);
z80_bus_cmd(Release);
}
- res = f_write(&drv_table[drv].fd, disk_buffer, BLOCK_SIZE, &br);
+ res = f_write(&drv_table[drv].fd, disk_buffer, BLOCK_SIZE, &brw);
} else {
- res = f_read(&drv_table[drv].fd, disk_buffer, BLOCK_SIZE, &br);
- if (res == FR_OK && br == BLOCK_SIZE) {
+ res = f_read(&drv_table[drv].fd, disk_buffer, BLOCK_SIZE, &brw);
+ if (res == FR_OK && brw == BLOCK_SIZE) {
if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
buserr = 1;
break;
} else {
- if (cnt) {
- z80_write_block(disk_buffer, addr, cnt);
- addr = addr + cnt - TPA_BASE;
- }
- z80_write_block(disk_buffer+cnt, addr, BLOCK_SIZE - cnt);
+ z80_write_block(disk_buffer, addr, BLOCK_SIZE);
z80_bus_cmd(Release);
}
}
}
- if (br != BLOCK_SIZE) {
- debug_cpmsd("## %7lu f_read res: %d, bytes rd/wr: %u\n", get_timer(0), res, br);
+ if (brw != BLOCK_SIZE) {
+ debug_cpmsd("## %7lu f_read res: %d, bytes rd/wr: %u\n", get_timer(0), res, brw);
dump_ram(disk_buffer, 0, 64, "Read Data");
res = -1;
}
@@ -588,20 +567,11 @@ int msg_handling(int state)
init_request = z80_read(0x43);
z80_bus_cmd(Release);
if ( init_request != 0) {
- /* Get address of fifo_list */
- uint32_t fifo_addr = 0;
+ /* Get address of fifo 0 */
z80_bus_cmd(Request);
- uint32_t fifo_list = z80_read(0x40) +
- ((uint16_t) z80_read(0x41) << 8) +
- ((uint32_t) z80_read(0x42) << 16);
- if (fifo_list != 0) {
- /* Get address of fifo 0 */
- fifo_addr = z80_read(fifo_list) +
- ((uint16_t) z80_read(fifo_list+1) << 8);
- /* TODO: log to phys addr translation
- ((uint32_t) z80_read(fifo_list+2) << 16);
- */
- }
+ uint32_t fifo_addr = z80_read(0x40) +
+ ((uint16_t) z80_read(0x40+1) << 8) +
+ ((uint32_t) z80_read(0x40+2) << 16);
z80_write(0x43, 0);
z80_bus_cmd(Release);