Mercurial > hg > Members > kono > os9 > sbc09
comparison io.c @ 44:b26c23331d02
add more function on vdisk
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Jul 2018 11:31:17 +0900 |
parents | 01519215ec70 |
children | 07c84761da6f |
comparison
equal
deleted
inserted
replaced
43:7a83a6a1685a | 44:b26c23331d02 |
---|---|
69 * IOPAGE + 0x30 Timer control 0x8f start timer/0x80 stop timer/0x04 update date | 69 * IOPAGE + 0x30 Timer control 0x8f start timer/0x80 stop timer/0x04 update date |
70 * read 0x10 bit menas timer | 70 * read 0x10 bit menas timer |
71 * IOPAGE + 0x31- YY/MM/DD/HH/MM/SS | 71 * IOPAGE + 0x31- YY/MM/DD/HH/MM/SS |
72 * | 72 * |
73 * IOPAGE + 0x40 Disk control 0x81 read/0x55 write 0 ... ok / 0xff .. error | 73 * IOPAGE + 0x40 Disk control 0x81 read/0x55 write 0 ... ok / 0xff .. error |
74 * IOPAGE + 0x41 drive no | 74 * IOPAGE + 0x41 drive no / ( VDISK 0 for system, 1 for user ) |
75 * IOPAGE + 0x42 LSN2 | 75 * IOPAGE + 0x42 LSN2 |
76 * IOPAGE + 0x43 LSN1 | 76 * IOPAGE + 0x43 LSN1 |
77 * IOPAGE + 0x44 LSN0 | 77 * IOPAGE + 0x44 LSN0 |
78 * IOPAGE + 0x45 ADR2 | 78 * IOPAGE + 0x45 ADR2 |
79 * IOPAGE + 0x46 ADR1 | 79 * IOPAGE + 0x46 ADR1 |
104 FILE *disk[] = {0,0}; | 104 FILE *disk[] = {0,0}; |
105 | 105 |
106 #ifdef USE_MMU | 106 #ifdef USE_MMU |
107 extern char *prog ; // for disass | 107 extern char *prog ; // for disass |
108 extern Byte * mem0(Byte *iphymem, Word adr, Byte *immu) ; | 108 extern Byte * mem0(Byte *iphymem, Word adr, Byte *immu) ; |
109 #define pmem(a) mem0(phymem,a,mmu) | |
110 #else | |
111 #define pmem(a) (&mem[a]) | |
109 #endif | 112 #endif |
113 | |
110 | 114 |
111 extern int bpskip ; | 115 extern int bpskip ; |
112 extern int stkskip ; | 116 extern int stkskip ; |
113 extern FILE *logfile; | 117 extern FILE *logfile; |
114 | 118 |
305 } else { | 309 } else { |
306 mem[(IOPAGE&0xfe00)+a]=c; | 310 mem[(IOPAGE&0xfe00)+a]=c; |
307 } | 311 } |
308 } | 312 } |
309 | 313 |
314 | |
310 void do_disk(int a, int c) { | 315 void do_disk(int a, int c) { |
311 if (a!=0x40+(IOPAGE&0x1ff)) { | 316 if (a!=0x40+(IOPAGE&0x1ff)) { |
312 mem[(IOPAGE&0xfe00)+a]=c; | 317 mem[(IOPAGE&0xfe00)+a]=c; |
313 return; | 318 return; |
314 } | 319 } |
315 int drv = mem[IOPAGE+0x41]; | 320 int drv = mem[IOPAGE+0x41]; |
316 int lsn = (mem[IOPAGE+0x42]<<16) + (mem[IOPAGE+0x43]<<8) + mem[IOPAGE+0x44]; | 321 int lsn = (mem[IOPAGE+0x42]<<16) + (mem[IOPAGE+0x43]<<8) + mem[IOPAGE+0x44]; |
317 int buf = (mem[IOPAGE+0x45]<<8) + mem[IOPAGE+0x46]; | 322 int buf = (mem[IOPAGE+0x45]<<8) + mem[IOPAGE+0x46]; |
318 if (drv > 1 || disk[drv]==0) goto error; | 323 if (drv > 1 || disk[drv]==0) goto error; |
319 #ifdef USE_MMU | 324 Byte *phy = pmem(buf); |
320 Byte *phy = mem0(phymem,buf,mmu); | |
321 #else | |
322 Byte *phy = &mem[buf]; | |
323 #endif | |
324 if (c==0x81) { | 325 if (c==0x81) { |
325 if (lseek(fileno(disk[drv]),lsn*SECSIZE,SEEK_SET)==-1) goto error; | 326 if (lseek(fileno(disk[drv]),lsn*SECSIZE,SEEK_SET)==-1) goto error; |
326 if (read(fileno(disk[drv]),phy,SECSIZE)==-1) goto error; | 327 if (read(fileno(disk[drv]),phy,SECSIZE)==-1) goto error; |
327 } else if (c==0x55) { | 328 } else if (c==0x55) { |
328 if (lseek(fileno(disk[drv]),lsn*SECSIZE,SEEK_SET)==-1) goto error; | 329 if (lseek(fileno(disk[drv]),lsn*SECSIZE,SEEK_SET)==-1) goto error; |
329 if (write(fileno(disk[drv]),phy,SECSIZE)==-1) goto error; | 330 if (write(fileno(disk[drv]),phy,SECSIZE)==-1) goto error; |
331 #ifdef VDISK | |
332 } else { | |
333 do_vdisk(c); | |
334 #endif | |
330 } | 335 } |
331 mem[IOPAGE+0x40] = 0; | 336 mem[IOPAGE+0x40] = 0; |
332 return; | 337 return; |
333 error : | 338 error : |
334 mem[IOPAGE+0x40] = 0xff; | 339 mem[IOPAGE+0x40] = 0xff; |