]>
wirehaze git hosting - BOS.git/blob - kernel/shell/commands.asm
1 ;----------------------------------------------------------;
2 ; BOS kernel Christoffer Bubach, 2003-2005. ;
3 ;----------------------------------------------------------;
5 ; Command table and some commands for the shell. ;
7 ;----------------------------------------------------------;
9 ; I should really do something about this file, divide it into
10 ; smaller ones or something. I'm just too lazy. Next version..
28 db 0xFF ; end of command table
32 dd show_ver
; commands.inc
33 dd show_help
; commands.inc
34 dd show_help
; commands.inc
35 dd show_about
; commands.inc
36 dd clrscr
; commands.inc
37 dd clrscr
; comamnds.inc
38 dd reboot
; commands.inc
39 dd dump_regs
; debug.inc
40 dd print_time
; time_date.inc
41 dd print_date
; time_date.inc
42 dd delay_test
; commands.inc
43 dd vga_test
; commands.inc
44 dd mem_test
; commands.inc
45 dd fdd_test
; commands.inc
49 ;--------------------------;
50 ; not a valid command ;
51 ;--------------------------;
52 not_a_valid_cmd db 13,10,'No such command or program exists.', 0
58 mov esi, not_a_valid_cmd
70 bos_ver_str db 13,10,'BOS version 0.05 by Christoffer Bubach, 2003-2005.', 0
84 ;--------------------;
86 ;--------------------;
87 bos_help_str db 13,10,13,10,' BOS 0.04 by Christoffer Bubach, 2003-2005.',13,10,\
88 '--------------------------------------------',13,10,\
89 'Type a command and press ENTER to execute it.',13,10,13,10,\
90 '"help" or "?" - Displays this text.',13,10,\
91 '"ver" - Shows version information.',13,10,\
92 '"about" - Shows information about the OS.',13,10,\
93 '"cls" or "clrscr" - Clears the screen.',13,10,\
94 '"memtest" - Shows memory info (and allocates/frees some, to test).',13,10,\
95 '"vgatest" - Test some VGA stuff.',13,10,\
96 '"fddtest" - Read and print bootsector from A:',13,10,\
97 '"delay" - Tests the delay function for 5 s.',13,10,\
98 '"time" - Prints current time.',13,10,\
99 '"date" - Prints current date.',13,10,\
100 '"regdump" - Dump some standard registers.',13,10,\
101 '"reboot" - Restarts the computer.',0
106 mov esi, bos_help_str
118 bos_about_str db 13,10,'About BOS',13,10,\
119 'Hmm.. I started with OS-dev in late 2003.. Anyway..',13,10,13,10,\
120 'Thanks for helping me get this far goes to:',13,10,\
121 'all people at mega-tokyo.com, osdever.net and flatassembler.net',13,10,\
122 'Robert ',153,'stling for Primula, http://ostling.no-ip.com/',13,10,\
123 'J.Thim for EelOS, http://www.ludd.luth.se/~ivileel/',13,10,\
124 'Tomasz Grysztar for fasm and fasmw, http://flatassembler.net/',13,10,\
125 'ASHLEY4, Candy, John S. Fine and Petroff Heroj.',0
130 mov esi, bos_about_str
139 ;-----------------------;
141 ;-----------------------;
148 jmp shell
; no normal return, as it gives an extra line feed
166 bos_delay_str db 13,10,'~1 second has passed.', 0
174 mov esi, bos_delay_str
184 bos_vga_str db 13,10,'It works..! :-D', 0
187 mov ax, 1 ; clear the screen
188 call set_mode_0x13
; set mode 0x13
190 mov cx, 256 ; loop out some pixels
200 ; draw mario and some ground
206 call put_0x13_sprite
; in vga.inc
258 mov ax, 1 ; clear the screen
259 call set_mode_0x03
; set mode 0x03
261 mov esi, bos_vga_str
; print that it worked!
269 ;--------------------------;
271 ;--------------------------;
274 mov bh, 7 ; make newline
280 mov dword [edi], 'shit' ; set DMA buffer to shit, as a test
289 mov cl, 0x01 ; sector
290 mov bl, 0x00 ; 1 = write
294 mov esi, 0x80000 ; dma buffer
300 call print_char
; print it. is it still
312 mov bl, 'E' ; error sign... :'(
317 call fdd_recal_seek
; do somthing about the error.. :P
326 ;------------------------------;
328 ;------------------------------;
330 bos_mem_str1 db 13,10,'Performing memory test. (debugging allocs assume 32mb RAM)', 0
331 bos_mem_str2 db 13,10,'Total installed memory (in bytes): ',0
332 bos_mem_str3 db 13,10,13,10,'Memory chunks:',0
333 bos_mem_str4 db 13,10,'Address Size Type Previous Next',0
334 bos_mem_str5 db 13,10,'-------------------------------------------------------',0
335 bos_mem_str6 db '0x',0
336 bos_mem_str7 db 'Free ',0
337 bos_mem_str8 db 'Used ',0
338 bos_mem_str9 db 'None ',0
339 bos_mem_str0 db ' ',0
340 bos_mem_crlf db 13,10,0
344 ;---------DEBUG---------
350 ;---------END DEBUG---------
358 ;---------DEBUG---------
360 je .free_the_test_block
362 mov ebx, 0x1000000 ;first test
363 mov [test_size2
], ebx
365 mov [test_address2
], ebx
367 mov ebx, 0xE00000 ; second test
373 mov ebx, 0x10000 ; third test
376 mov [test_address
], ebx ; test allocation
384 .free_the_test_block:
385 mov ebx, [test_address
]
386 mov ecx, [test_size
] ; and freeing
388 mov ebx, [test_address2
]
389 mov ecx, [test_size2
] ; and freeing
393 ;---------END DEBUG---------
395 mov esi, bos_mem_str1
398 mov esi, bos_mem_str2
401 mov esi, bos_mem_str6
404 mov ebx, [ram_amount
]
408 mov esi, bos_mem_str3
411 mov esi, bos_mem_str4
414 mov esi, bos_mem_str5
418 mov [current_mem_pos
], 0
419 mov eax, [first_free
]
422 ;-------------------------;
423 ; this is a used block ;
424 ;-------------------------;
426 mov eax, [current_mem_pos
]
428 cmp eax, [ram_amount
] ; .free will always let us
429 jae .end ; decide if we are to quit or not.
433 mov ebx, [ram_amount
] ; no next block, use ram size
434 sub ebx, eax ; get size in ebx
448 mov [current_mem_pos
], eax
451 ;-------------------------;
452 ; this is a free block ;
453 ;-------------------------;
455 mov eax, [current_mem_pos
] ; current pos. in eax
456 mov ebx, [eax+4] ; current size in ebx
457 mov ecx, [eax] ; prev pointer in ecx
458 mov edx, [eax+8] ; next pointer in edx
463 mov [current_mem_pos
], eax
473 ;-------------------------;
474 ; print mem block info ;
475 ;-------------------------;
477 push eax ; current pos
478 push ebx ; current size
479 push ecx ; prev pointer
480 push edx ; next pointer
484 mov esi, bos_mem_crlf
487 mov esi, bos_mem_str6
496 mov esi, bos_mem_str0
499 mov esi, bos_mem_str6
508 mov esi, bos_mem_str0
516 mov esi, bos_mem_str8
; it's used
519 mov esi, bos_mem_str9
522 mov esi, bos_mem_str9
528 mov esi, bos_mem_str7
; it's free
531 mov esi, bos_mem_str6
535 pop ebx ; pop the pushed ecx
536 mov cl, 0x04 ; into ebx instead.. ;)
538 mov esi, bos_mem_str0
541 mov esi, bos_mem_str6