flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Weird problem while testing OS |
Author |
|
adefeo 27 Nov 2005, 22:15
I've been working on my OS project, Metropolis (see http://512dev.us.tt for details once it's back up - changing webhosts now). It compiles right, but I can't get it to run. I don't get a PANIC or an error, but this is what the screen looks like:
And the second underscore kinda flickers on and off O_o . The source is at http://512net.juleos.co.uk/metro_dev/001source/ Bootloader is boot.asm Kernel is kernel.asm (duh) Command routines are in commands.inca It's all realmode x86 ASM compiled with Win32 FASM 1.64 I make an image for bochs using this script: Code: fasm boot.asm boot.bin fasm kernel.asm kernel.bin copy /b boot.bin+kernel.bin osdisk.img I then load osdisk.img into bochs with 8MB RAM, no hard drives, and 1 floppy drive...everything else is default values. This is the bochsout.txt log: Quote:
Any help to why this is failing to run correctly would be GREATLY appreciated. Thanks, Anthony |
|||
27 Nov 2005, 22:15 |
|
Artlav 28 Nov 2005, 17:41
Wow... Runned it through the debugger. Result: 13 bugs.
Here is the correct code, corrections marked with ;### In the boot.asm put 7c00 instead of 7c0 (typo?). Also i reccomend this function, if you using the Bochs emulator, it prints the debug in the bochs console: Code: print2e9: ;ds:si 0-string addres nop push ax si lp2e9: lodsb cmp al,0 je endpr2e9 out 0e9h,al jmp lp2e9 endpr2e9: pop si ax ret ;###endp print2e9 kernel.asm: Code: use16 org 0x0000 command_length equ 3 ;###Constants better be before all (to be available for all) jmp begin ;### Otherwise the cls code will be executed before setup include 'commands.inc' ;==================== ;Main kernel program ;==================== begin: ;reset segment registers mov ax, cs mov ds, ax mov es, ax main: mov si, welcomemsg call kprint jmp loadprompt ;==================== ;Kernel routines ;==================== kprint: ;string output, SI = string mov ah,0x0E mov bh,0x00 mov bl,0x15 nextchar: lodsb or al,al jz return int 0x10 jmp nextchar return: ret kputchar: ;char output, al = char code ;##Absent from the original mov ah,0x0E mov bh,0x00 mov bl,0x15 int 0x10 ret kscanf: ;string input, DX = max length, if CX != 0, then string isnt echoed xor bx, bx start: xor ax, ax int 0x16 ;##Input with wait - int 16h, AX=0000h cmp al, 0x0D je return_press mov [es:di+bx], al inc bx cmp bx, dx je return_press push bx xor bx,bx cmp bx,cx je putchar putreturn: pop bx ;##Stack async - multiple problems, when amount of push not equals amount of pop's jmp start putchar: pop bx push bx ;##Stack async (2) xor ah,ah call kputchar ;##Originally it calls the putchar label above, while there was no putchar function jmp putreturn return_press: xor al,al mov [es:di+bx],al ret loadprompt: ;display the command prompt mov si, loadpromptmsg ;##Was loadprompt - loaded the addres of loadprompt ael instead of msg (typo?) call kprint mov si, prompt_title call kprint commandready: mov si, prompt call kprint xor cx, cx mov dx, 20 mov di, cmdbuffer call kscanf ;routines to compare inputs to builtin commands ;will also compare to disk files once FAT12 support is implemented compare_command_cls: ;##locating the variable after the labeb makes the transfer in the label, instead of the code. mov di, cmdbuffer mov si, command_cls mov cx, command_length repe cmpsb ;##cmpsw compares words, while yoou got bytes ;##cmp cx,0 is useless, since rep cmpsb returns zf flag. je cls jmp invalid_cmd invalid_cmd: mov si, invalidcmd call kprint jmp commandready ;==================== ;Data ;==================== welcomemsg db 'Metropolis 0.01 Codename Infinity: Kernel Loaded',13,10,0 loadpromptmsg db 'Starting shell...',13,10,0 prompt_title db 'MetroShell 0.1',13,10,0 command_cls db "cls",0 ;##Movedthe command there - better location invalidcmd db 'The command entered was not recognized',13,10,0 prompt db '>',0 cmdbuffer db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 times 1024-$ db 0 |
|||
28 Nov 2005, 17:41 |
|
Rohan 01 Jan 2006, 18:42
can you help me with my bootsector it doesn't work
Code: use16 org 0x7C00 jmp start ;------------------------------------- OSName db 'noname' ; BytsPerSec dw 512 ; ReservedSec dw 1 ; SecPerFAT db 2 ; SecPerClus db 1 ; TotalSect dw 2880 ; RootEntriesSize dw 511 ; MediaType db 0xf0 ; FatSize dw 9 ; TrackSect dw 18 ; Heads dw 2 ; FATCopy db 1 ; SecPerPartit db 2 ; HidenSec dd 0 ; ?-4 SecPerTrack db 2 ; LargeSec dd 0 ; ;-------------------------------------- Reserved db 0 ; Signatured db 0 ; FddNumber db 1 ; FSType db 'FAT12' ; start: mov cx,3 read: _loop: mov ah,0 ; int 13h mov ah,2 ; int 13h xor cx,cx ; xor dl,dl ; ffd A mov dh,1 ; mov cl,4 ; int 13h je ok ; dec cx jz error ; jmp read ok: mov al,3 mov bh,0 mov cx,8 mov dh,12 mov dl,45 mov bp,Name int 13h error: mov al,3 mov bh,0 mov cx,12 mov bp,ermsg int 13h ermsg db 'Error$' Name db 'Test' int 20h rb 7C00h+512-2-$ dw 0xAA55 |
|||
01 Jan 2006, 18:42 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.