9 int cmd_quit(), cmd_dump(), cmd_seg(), cmd_rel(), cmd_bzimage(), cmd_help();
10 int cmd_nop(), cmd_memdump(), cmd_set_base(), cmd_dir(), cmd_type(), cmd_more();
11 int cmd_regs(), cmd_monhelp();
15 extern struct t_cmd_list
{
20 unsigned int current_address
;
25 static char minibuf
[2] = " ";
27 char *cmd
, *args
, *ptr
;
28 struct t_cmd_list
* cptr
;
41 /* First out of the way. */
43 /* Then align DS to 64k boundry -> DMA is simple. */
44 relocator(0x1000-__get_ds()+__get_cs());
46 relocator(-1); /* Top of available memory */
48 printf("Relocated to CS=$%04x DS=$%04x\n", __get_cs(), __get_ds());
51 disk_drive
= __argr
.h
.dl
;
58 cmd_bzimage((void*)0);
62 printf("Unable to boot, sorry\nreboot:");
64 read(0, command_buf
, sizeof(command_buf
)-1) ;
69 printf("\033S \033R+\033Sa\033Rc");
73 ch
= read(0, command_buf
, sizeof(command_buf
)-1) ;
75 command_buf
[ch
] = '\0';
76 if( ch
== 1 && command_buf
[0] != '\n' )
79 help_key(command_buf
[0]&0xFF);
82 if( command_buf
[ch
-1] == '\n' ) command_buf
[ch
-1] = 0;
84 for(ptr
=command_buf
; *ptr
; ptr
++)
86 if(*ptr
=='"') do { ptr
++; } while(*ptr
&& *ptr
!= '"');
87 if( isupper(*ptr
) ) *ptr
= tolower(*ptr
);
91 while(*cmd
== ' ') cmd
++;
92 if( !isalpha(cmd
[0]) || !isalpha(cmd
[1]) )
100 args
= strchr(cmd
, ' ');
101 if( args
) *args
++ = 0;
102 else args
= cmd
+ strlen(cmd
);
105 if( *cmd
== 0 ) continue;
107 for(cptr
= cmd_list
; cptr
->command
; cptr
++)
109 if( strcmp(cptr
->command
, cmd
) == 0 )
113 printf("\033S \033Sa\033Rg");
117 (void) (*cptr
->func
)(args
);
119 printf("Command not found.\n");
124 /****************************************************************************/
131 printf("\033E\033Rg\033Sa\033J");
136 printf(" TAR floppy booter");
139 printf(" DOS floppy booter");
141 printf(" floppy booter");
145 printf(" boot monitor");
147 printf(", Version %s", VERSION
);
154 printf("Processor: %s", x86_name
);
155 if(x86_fpu
) printf(" with FPU");
156 if(x86_emu
) printf(" in protected mode");
160 printf("There is %u bytes available", &offt
-sbrk(0));
161 printf(", %dk of boot memory", boot_mem_top
/64);
164 printf(", %d.%dM of main memory",
165 (int)(main_mem_top
/1024),
166 (int)((10*main_mem_top
)/1024%10));
171 /****************************************************************************/
174 getnum(numptr
, valptr
)
176 unsigned int * valptr
;
178 char * ptr
= *numptr
;
179 unsigned int val
= 0;
180 int base
= number_base
;
183 while( *ptr
&& *ptr
<= ' ' ) ptr
++;
186 case '$': case '&': case 'X':
187 base
=16; ptr
++; break;
189 base
=10; ptr
++; break;
191 base
=2; ptr
++; break;
193 if( ptr
[1] == 'X' ) { base
=16; ptr
+=2; }
204 if( ch
>= '0' && ch
<= '9' ) d
= ch
- '0';
205 if( ch
>= 'a' && ch
<= 'z' ) d
= ch
- 'a' + 10;
206 if( ch
>= 'A' && ch
<= 'Z' ) d
= ch
- 'A' + 10;
210 val
= val
* base
+ d
;
220 if(valptr
) *valptr
= val
;
226 /****************************************************************************/
229 struct t_cmd_list cmd_list
[] =
231 {"zimage", cmd_bzimage
}, /* Load and run 386 zimage file */
232 {"bzimage",cmd_bzimage
}, /* Load and run 386 bzimage file */
233 {"=", cmd_bzimage
}, /* Load and run 386 bzimage file */
235 {"exit", cmd_quit
}, {"quit", cmd_quit
}, {"q", cmd_quit
},
237 {"help", cmd_help
}, /* Display from help.txt */
238 {"dir", cmd_dir
}, /* Display directory */
239 {"cat", cmd_type
}, /* Cat/Type a file to the screen */
240 {"type", cmd_type
}, /* Cat/Type a file to the screen */
241 {"more", cmd_more
}, /* More a file to the screen */
244 /* Debugger/monitor commands */
245 {"?", cmd_monhelp
}, /* Display builtin help */
247 {"memdump",cmd_memdump
}, {"mem",cmd_memdump
}, {"m", cmd_memdump
},
249 {"seg", cmd_seg
}, /* Set default segment */
250 {"rel", cmd_rel
}, /* Relocate self */
251 {"base", cmd_set_base
},
260 {"edit", cmd_edit}, Alter memory
261 {"move", cmd_move}, Move memory contents
263 {"load", cmd_load}, Load file of inode
264 {"stat", cmd_stat}, Stat info of inode
266 {"image", cmd_image}, Load and run 8086 image file
268 {"read", cmd_read}, Read sector
269 {"write", cmd_write}, Write sector
271 {"call", cmd_call}, load and run a bcc linux-8086 program.