mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-02 17:49:01 +08:00
dir命令
This commit is contained in:
@@ -52,6 +52,8 @@ haribote.img : ipl10.bin haribote.sys Makefile
|
|||||||
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
|
||||||
wbinimg src:ipl10.bin len:512 from:0 to:0 \
|
wbinimg src:ipl10.bin len:512 from:0 to:0 \
|
||||||
copy from:haribote.sys to:@: \
|
copy from:haribote.sys to:@: \
|
||||||
|
copy from:ipl10.nas to:@: \
|
||||||
|
copy from:make.bat to:@: \
|
||||||
imgout:haribote.img
|
imgout:haribote.img
|
||||||
|
|
||||||
# 其他指令
|
# 其他指令
|
||||||
|
|||||||
@@ -4,6 +4,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
struct FILEINFO {
|
||||||
|
unsigned char name[8], ext[3], type;
|
||||||
|
char reserve[10];
|
||||||
|
unsigned short time, date, clustno;
|
||||||
|
unsigned int size;
|
||||||
|
};
|
||||||
|
|
||||||
void make_window8(unsigned char *buf, int xsize, int ysize, char *title, char act);
|
void make_window8(unsigned char *buf, int xsize, int ysize, char *title, char act);
|
||||||
void putfonts8_asc_sht(struct SHEET *sht, int x, int y, int c, int b, char *s, int l);
|
void putfonts8_asc_sht(struct SHEET *sht, int x, int y, int c, int b, char *s, int l);
|
||||||
void make_textbox8(struct SHEET *sht, int x0, int y0, int sx, int sy, int c);
|
void make_textbox8(struct SHEET *sht, int x0, int y0, int sx, int sy, int c);
|
||||||
@@ -380,6 +387,7 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
|
|||||||
char s[30], cmdline[30];
|
char s[30], cmdline[30];
|
||||||
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
|
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
struct FILEINFO *finfo = (struct FILEINFO *) (ADR_DISKIMG + 0x002600);
|
||||||
|
|
||||||
fifo32_init(&task->fifo, 128, fifobuf, task);
|
fifo32_init(&task->fifo, 128, fifobuf, task);
|
||||||
timer = timer_alloc();
|
timer = timer_alloc();
|
||||||
@@ -451,7 +459,28 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
|
|||||||
}
|
}
|
||||||
sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128);
|
sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128);
|
||||||
cursor_y = 28;
|
cursor_y = 28;
|
||||||
} else if (cmdline[0] != 0) {
|
} else if (strcmp(cmdline, "dir") == 0 || strcmp(cmdline, "ls") == 0) {
|
||||||
|
/* dir命令 */
|
||||||
|
for (x = 0; x < 224; x++) {
|
||||||
|
if (finfo[x].name[0] == 0x00) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (finfo[x].name[0] != 0xe5) {
|
||||||
|
if ((finfo[x].type & 0x18) == 0) {
|
||||||
|
sprintf(s, "filename.ext %7d", finfo[x].size);
|
||||||
|
for (y = 0; y < 8; y++) {
|
||||||
|
s[y] = finfo[x].name[y];
|
||||||
|
}
|
||||||
|
s[ 9] = finfo[x].ext[0];
|
||||||
|
s[10] = finfo[x].ext[1];
|
||||||
|
s[11] = finfo[x].ext[2];
|
||||||
|
putfonts8_asc_sht(sheet, 8, cursor_y, COL8_FFFFFF, COL8_000000, s, 30);
|
||||||
|
cursor_y = cons_newline(cursor_y, sheet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cursor_y = cons_newline(cursor_y, sheet);
|
||||||
|
} else if (cmdline[0] != 0) {
|
||||||
/*不是命令,也不是空行 */
|
/*不是命令,也不是空行 */
|
||||||
putfonts8_asc_sht(sheet, 8, cursor_y, COL8_FFFFFF, COL8_000000, "Bad command.", 12);
|
putfonts8_asc_sht(sheet, 8, cursor_y, COL8_FFFFFF, COL8_000000, "Bad command.", 12);
|
||||||
cursor_y = cons_newline(cursor_y, sheet);
|
cursor_y = cons_newline(cursor_y, sheet);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ struct BOOTINFO { /* 0x0ff0-0x0fff */
|
|||||||
char *vram;
|
char *vram;
|
||||||
};
|
};
|
||||||
#define ADR_BOOTINFO 0x00000ff0
|
#define ADR_BOOTINFO 0x00000ff0
|
||||||
|
#define ADR_DISKIMG 0x00100000
|
||||||
|
|
||||||
/* naskfunc.nas */
|
/* naskfunc.nas */
|
||||||
void io_hlt(void);
|
void io_hlt(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user