]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/z180-serv.c
message buffer init changes. cp/m r/w for new memory map
[z180-stamp.git] / avr / z180-serv.c
index b5d8140dcee1ab3f327dd54e6d06bce83c11d35e..69bcd9c609286d88e248927b73b334f8ed4f6c05 100644 (file)
@@ -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);