]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/z180-serv.c
phys. address 0x00040 points to fifo_list
[z180-stamp.git] / avr / z180-serv.c
index ce264ae76ed8e691e0fb886f28df70e1a068e87e..98601758e5ca3b4bf40209f42f77beceb4634ca1 100644 (file)
@@ -210,14 +210,23 @@ int msg_handling(int state)
        if (pending) {
                switch (state) {
                case 0:                 /* need init */
+                       /* Get address of fifo_list */
                        z80_bus_cmd(Request);
-                       uint32_t addr = z80_read(0x40) +
+                       uint32_t fifo_list = z80_read(0x40) +
                                ((uint16_t) z80_read(0x41) << 8) +
                                ((uint32_t) z80_read(0x42) << 16);
                        z80_bus_cmd(Release);
-                       if (addr != 0) {
-                               z80_memfifo_init(fifo_msgin, addr);
-                               state = 1;
+                       if (fifo_list != 0) {
+                               /* Get address of fifo 0 */
+                               z80_bus_cmd(Request);
+                               uint32_t fifo_addr = z80_read(fifo_list) +
+                                       ((uint16_t) z80_read(fifo_list+1) << 8) +
+                                       ((uint32_t) z80_read(fifo_list+2) << 16);
+                               z80_bus_cmd(Release);
+                               if (fifo_addr != 0) {
+                                       z80_memfifo_init(fifo_msgin, fifo_addr);
+                                       state = 1;
+                               }
                        }
                        break;
                case 1:                 /* awaiting messages */