diff io.c @ 12:111e5defb8ab

boot is called, rti failed
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 07 Jul 2018 00:37:24 +0900
parents ce7323f9b937
children 2aebc6b17fbf
line wrap: on
line diff
--- a/io.c	Fri Jul 06 18:31:38 2018 +0900
+++ b/io.c	Sat Jul 07 00:37:24 2018 +0900
@@ -98,7 +98,7 @@
 FILE *disk[] = {0,0};
 
 extern void hexadump( unsigned char *b, int l, int loc, int w);
-extern void disasm(int,int);
+extern int disasm(int,int);
 #ifdef USE_MMU
 extern char *prog ;   // for disass
 extern Byte * mem0(Byte *iphymem, Word adr, Byte *immu) ;
@@ -489,12 +489,15 @@
                       len =  getarg(next,&next);
                    }
                    if (skip==2 && s[1]=='i') {
-                     for(int i=0; len > 0 ; i+=16, len-=16) {
+                     Word end = adr + len;
+                     while(adr < end) {
 #ifdef USE_MMU
-                        Byte *phyadr = mem0(phymem,adr+i,mmu);
-                        prog = (char*)phyadr - adr;
+                        Byte *phyadr = mem0(phymem,adr,mmu);
+                        prog = (char*)phyadr - adr  ;
+                        if (phyadr > phymem+memsize) goto restart;
 #endif
-                        disasm(adr+i,adr+i+(len>16?16:len));
+                        int len = adr+16<end? 16 : end-adr -1 ;
+                        adr = disasm(adr,adr+len);
                       }
                    } else {
 #ifdef USE_MMU