 |
 |
Having problems with my os |
 |
Posted: Wed Oct 07, 2009 5:00 pm |
|
|
| Message |
|
|
|
Hello! I'm finally working on my own kernel and as i don't know FAT12 i can't execute progs. So i thought of making a small program wich reads opcodes 'till enter is presed and then it executes that program. But it does not work at all... could you help me please?
Nasm code
| Code: |
[BITS 16]
[ORG 0x7C00]
mov ah,0eh
mov al,'>'
int 10h
jmp next
next:
mov ah,00h
int 16h
mov ah,0Eh
int 10h
cmp al,13h
je finish
cmp al,64
jb nr
ja lit
nr:
inc bx
sub al,48h
mov [msg+bx],al
mov al,0h
jmp next
lit:
inc bx
sub al,55h
mov [msg+bx],al
mov al,0h
jmp next
finish:
mov ax,03h
int 10h
msg db 0
times 510-($-$$) db 0
dw 0xAA55
|
_________________ Software is pretty much like cathedrals: first we build them, then we pray.
|
|
 |
|
|
 |
|
 |
Posted: Thu Oct 08, 2009 2:16 am |
|
|
| Message |
|
|
 |
|
 |
Posted: Thu Oct 08, 2009 3:42 am |
|
|
| Message |
|
|
|
I know your using Nasm but
One thing nice about fasm...
is this:
| Code: |
source0: file 'somehtmldoc.html'
source1: file 'text.txt'
source2: file 'image.bmp'
source3: file 'test.bin'
|
[edit] for space//
Last edited by lone_wolf on Thu Oct 08, 2009 1:01 pm; edited 1 time in total
|
|
 |
|
|
 |
|
 |
Posted: Thu Oct 08, 2009 11:43 am |
|
|
| Message |
|
|
|
so can i say:
========
mov source1,filename
source: file 0
========
i don't rally junderstand the floppy thigny.... _________________ Software is pretty much like cathedrals: first we build them, then we pray.
|
|
 |
|
|
 |
|
 |
Posted: Thu Oct 08, 2009 11:46 am |
|
|
| Message |
|
|
|
later today I will post you a small demo.. to test with.. 
|
|
 |
|
|
 |
|
 |
Posted: Thu Oct 08, 2009 1:00 pm |
|
|
| Message |
|
|
|
Compile with Fasm and load on a floppy..
tested with qemu or real os.. I used rawrite to put on a floppy..
and boot! The test.txt must be in the dir that your boot.asm is..
save as:
test.txt
| Code: |
Hello this is a test. From our test
file to see if we can read it!
|
Fasm boot.asm boot.bin
| Code: |
org 0x0600
use16
start:
xor ax,ax
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x7c00
sti
cld
mov si,sp
mov di,0600h
mov cx,438
rep movsw
jmp 0000:main
main:
mov ah,02
mov bh,0
mov dx,0
int 10h
mov ah,9
mov cx,2000
mov bl,1Fh
mov al,' '
int 10h
mov si,welcome
call print
mov si,source1
call print
jmp $
welcome: db "Demo for reading files without a disk!",13,10,0
print:
mov ah,0Eh ; Request display
again1:
lodsb ; load a byte into AL from DS:SI
or al,al ; Or AL
jz done1 ; Jump 0, to label done1
int 10h ; Call interrupt service
jmp again1 ; Jump to label again1
done1:
ret
source1: file 'test.txt'
times 510 - ($-start) db 0
dw 0xaa55
|
|
|
 |
|
|
|