Friday, December 28, 2007

User Programs code of staOS

Program 1:

org 0x100
mov si, msg
call os_print_string
mov ah, 00
int 0x16
jmp 0x0050:0000


msg db "Knock the door it will open, ask we will give",0x0d,0x0a,0x00

os_print_string:
pusha

mov ah, 0Eh
mov bl, 12

.repeat:
lodsb
cmp al, 0
je .done
int 10h
jmp .repeat

.done:
popa
ret

Program 2
This program is for calling operating system function from user program.

org 0x100
bits 16
mov si, sys_msg
call 0x0003
mov ax, input
call 0x0007
call 0x000f
call 0x0013
jmp 0x0050:0000
input times 30 db 0
sys_msg db "Enter string: ",0x00

program 3

org 0x100
bits 16
mov si, msg
call DisplayMessage
mov cx, 10
LL:
call read
call DisplayCharacter
loop LL
jmp 0x0050:0000
read:
mov ah, 0x10
int 0x16 ret
DisplayCharacter:
mov ah, 0x0e
mov bh, 0x00
mov bl, 0x02
int 0x10
retDisplayMessage:
lodsb
or al, al
jz .DONE
mov ah, 0x0e
mov bh, 0x00
mov bl, 0x05
int 0x10
jmp DisplayMessage
.DONE:

program 4


org 0x100
mov si, msg
call os_print_string
mov ah, 00
int 0x16
jmp 0x0050:0000
msg db "Motivation is a tool for success",0x0d,0x0a,0x00
os_print_string:
pusha
mov ah, 0Eh
mov bl, 12
.repeat:
lodsb
cmp al, 0
je .done
int 10h
jmp .repeat
.done:
popa
ret

Program 5


org 0x100
mov si, msg
call os_print_string
mov ah, 00
int 0x16
jmp 0x0050:0000
msg db "Hello, World from staOS 1.0",0x0d,0x0a,0x00
os_print_string:
pusha
mov ah, 0Eh
mov bl, 12
.repeat:
lodsb
cmp al, 0
je .done
int 10h
jmp .repeat
.done:
popa
ret




1 comment:

Anonymous said...

Hi Stalin,

Its great, keep going....
improve the blog much more ....
i will be contributing u soon...

Thanks & Regrads,
kingslee.