]>
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..
27 db 0xFF ; end of command table
30 call_table: dd show_ver
; commands.inc
31 dd show_help
; commands.inc
32 dd show_help
; commands.inc
33 dd show_about
; commands.inc
34 dd clrscr
; commands.inc
35 dd clrscr
; comamnds.inc
36 dd reboot
; commands.inc
37 dd dump_regs
; debug.inc
38 dd print_time
; time_date.inc
39 dd print_date
; time_date.inc
40 dd delay_test
; commands.inc
41 dd vga_test
; commands.inc
42 dd mem_test
; commands.inc
43 dd fdd_test
; commands.inc
47 ;--------------------------;
48 ; not a valid command ;
49 ;--------------------------;
50 not_a_valid_cmd db 13,10,'No such command or program exists.', 0
56 mov esi, not_a_valid_cmd
68 bos_ver_str db 13,10,'BOS version 0.04 by Christoffer Bubach, 2003-2005.', 0
82 ;--------------------;
84 ;--------------------;
85 bos_help_str db 13,10,13,10,' BOS 0.04 by Christoffer Bubach, 2003-2005.',13,10,\
86 '--------------------------------------------',13,10,\
87 'Type a command and press ENTER to execute it.',13,10,13,10,\
88 '"help" or "?" - Displays this text.',13,10,\
89 '"ver" - Shows version information.',13,10,\
90 '"about" - Shows information about the OS.',13,10,\
91 '"cls" or "clrscr" - Clears the screen.',13,10,\
92 '"memtest" - Shows memory info (and allocates/frees some, to test).',13,10,\
93 '"vgatest" - Test some VGA stuff.',13,10,\
94 '"fddtest" - Read and print bootsector from A:',13,10,\
95 '"delay" - Tests the delay function for 5 s.',13,10,\
96 '"time" - Prints current time.',13,10,\
97 '"date" - Prints current date.',13,10,\
98 '"regdump" - Dump some standard registers.',13,10,\
99 '"reboot" - Restarts the computer.',0
104 mov esi, bos_help_str
116 bos_about_str db 13,10,'About BOS',13,10,\
117 'Hmm.. I started with OS-dev in late 2003.. Anyway..',13,10,13,10,\
118 'Thanks for helping me get this far goes to:',13,10,\
119 'all people at mega-tokyo.com, osdever.net and flatassembler.net',13,10,\
120 'Robert ',153,'stling for Primula, http://ostling.no-ip.com/',13,10,\
121 'J.Thim for EelOS, http://www.ludd.luth.se/~ivileel/',13,10,\
122 'Tomasz Grysztar for fasm and fasmw, http://flatassembler.net/',13,10,\
123 'ASHLEY4, Candy, John S. Fine and Petroff Heroj.',0
128 mov esi, bos_about_str
137 ;-----------------------;
139 ;-----------------------;
146 jmp shell
; no normal return, as it gives an extra line feed
164 bos_delay_str db 13,10,'~1 second has passed.', 0
172 mov esi, bos_delay_str
182 bos_vga_str db 13,10,'It works..! :-D', 0
185 mov ax, 1 ; clear the screen
186 call set_mode_0x13
; set mode 0x13
188 mov cx, 256 ; loop out some pixels
198 ; draw mario and some ground
204 call put_0x13_sprite
; in vga.inc
256 mov ax, 1 ; clear the screen
257 call set_mode_0x03
; set mode 0x03
259 mov esi, bos_vga_str
; print that it worked!
267 ;--------------------------;
269 ;--------------------------;
272 mov bh, 7 ; make newline
278 mov dword [edi], 'shit' ; set DMA buffer to shit, as a test
287 mov cl, 0x01 ; sector
288 mov bl, 0x00 ; 1 = write
292 mov esi, 0x80000 ; dma buffer
298 call print_char
; print it. is it still
310 mov bl, 'E' ; error sign... :'(
315 call fdd_recal_seek
; do somthing about the error.. :P
324 ;------------------------------;
326 ;------------------------------;
328 bos_mem_str1 db 13,10,'Performing memory test. (debugging allocs assume 32mb RAM)', 0
329 bos_mem_str2 db 13,10,'Total installed memory (in bytes): ',0
330 bos_mem_str3 db 13,10,13,10,'Memory chunks:',0
331 bos_mem_str4 db 13,10,'Address Size Type Previous Next',0
332 bos_mem_str5 db 13,10,'-------------------------------------------------------',0
333 bos_mem_str6 db '0x',0
334 bos_mem_str7 db 'Free ',0
335 bos_mem_str8 db 'Used ',0
336 bos_mem_str9 db 'None ',0
337 bos_mem_str0 db ' ',0
338 bos_mem_crlf db 13,10,0
342 ;---------DEBUG---------
348 ;---------END DEBUG---------
356 ;---------DEBUG---------
358 je .free_the_test_block
360 mov ebx, 0x1000000 ;first test
361 mov [test_size2
], ebx
363 mov [test_address2
], ebx
365 mov ebx, 0xE00000 ; second test
371 mov ebx, 0x10000 ; third test
374 mov [test_address
], ebx ; test allocation
382 .free_the_test_block:
383 mov ebx, [test_address
]
384 mov ecx, [test_size
] ; and freeing
386 mov ebx, [test_address2
]
387 mov ecx, [test_size2
] ; and freeing
391 ;---------END DEBUG---------
393 mov esi, bos_mem_str1
396 mov esi, bos_mem_str2
399 mov esi, bos_mem_str6
402 mov ebx, [ram_amount
]
406 mov esi, bos_mem_str3
409 mov esi, bos_mem_str4
412 mov esi, bos_mem_str5
416 mov [current_mem_pos
], 0
417 mov eax, [first_free
]
420 ;-------------------------;
421 ; this is a used block ;
422 ;-------------------------;
424 mov eax, [current_mem_pos
]
426 cmp eax, [ram_amount
] ; .free will always let us
427 jae .end ; decide if we are to quit or not.
431 mov ebx, [ram_amount
] ; no next block, use ram size
432 sub ebx, eax ; get size in ebx
446 mov [current_mem_pos
], eax
449 ;-------------------------;
450 ; this is a free block ;
451 ;-------------------------;
453 mov eax, [current_mem_pos
] ; current pos. in eax
454 mov ebx, [eax+4] ; current size in ebx
455 mov ecx, [eax] ; prev pointer in ecx
456 mov edx, [eax+8] ; next pointer in edx
461 mov [current_mem_pos
], eax
471 ;-------------------------;
472 ; print mem block info ;
473 ;-------------------------;
475 push eax ; current pos
476 push ebx ; current size
477 push ecx ; prev pointer
478 push edx ; next pointer
482 mov esi, bos_mem_crlf
485 mov esi, bos_mem_str6
494 mov esi, bos_mem_str0
497 mov esi, bos_mem_str6
506 mov esi, bos_mem_str0
514 mov esi, bos_mem_str8
; it's used
517 mov esi, bos_mem_str9
520 mov esi, bos_mem_str9
526 mov esi, bos_mem_str7
; it's free
529 mov esi, bos_mem_str6
533 pop ebx ; pop the pushed ecx
534 mov cl, 0x04 ; into ebx instead.. ;)
536 mov esi, bos_mem_str0
539 mov esi, bos_mem_str6