随笔-60  评论-111  文章-0  trackbacks-0
 1extern void print( char color, char * text );
 2int i;
 3int main()
 4{
 5    print(0xf,"neocs: loader\n\r");
 6
 7    print(0xf,"it's written by C!\n\r");
 8
 9    return 0;
10
11}
 1extrn _main:near
 2.model tiny
 3.code
 4
 5public _halt, main, _print,
 6
 7main    proc near
 8    mov dx,ax
 9    mov ax,cs
10    mov ds,ax
11    mov es,ax
12    mov ss,ax
13    mov ax,0fff0h
14    mov sp,ax
15    mov ax,dx
16    call _main
17    call _halt
18main    endp
19
20_halt    proc near 
21hl:
22    hlt
23    jmp short hl
24_halt    endp
25    
26_print    proc near 
27    push bp
28    mov bp,sp
29    push si
30    mov si,word ptr ss:[bp+6]
31    mov bl,byte ptr ss:[bp+4]
32_loop:
33    mov al,byte ptr ds:[si]
34    test al,al
35    jz _break
36    mov bh,0
37    mov ah,0eh
38    int 010h
39    inc si
40    jmp short _loop
41
42_break:
43    pop si
44    mov sp,bp
45    pop bp
46    ret
47_print    endp
48
49end main
50


Click here to download
posted on 2007-05-20 00:26 shaker(太子) 阅读(1592) 评论(23)  编辑 收藏 引用 所属分类: C++

评论:
# re: write a simple os with asm&c 2007-05-23 14:31 | htqx


c 程序要用什么编译选项?   回复  更多评论
  
# re: write a simple os with asm&c 2007-05-26 18:20 | To Be C++
@htqx
在make文件里面由的 参考下!  回复  更多评论
  
# re: write a simple os with asm&c 2007-06-04 11:35 | 过客
汇编??  回复  更多评论
  
# re: write a simple os with asm&c 2007-06-05 21:53 | To Be C++
and C  回复  更多评论
  
# mwbthkuc 2008-06-14 21:44 | mwbthkuc
gqzoynql http://bxvoconj.com ktjadufn zfhaylgf <a href="http://ckctivjs.com">bxbqmyqk</a> [URL=http://ttlglqkw.com]mhxylwch[/URL]   回复  更多评论
  
# fioricet gusty alluvium 2008-06-15 04:10 | fioricet gusty alluvium
The best thing to give to your enemy is forgiveness; to an opponent, tolerance; to a friend, your heart; to your child, a good example; to a father, deference; to your mother, conduct that will make her proud of you; to yourself, respect; to all men, charity.  回复  更多评论
  
# benadryl 2008-06-15 07:12 | benadryl
Do not believe that he who seeks to comfort you lives untroubled among the simple and quiet words that sometimes do you good. His life has much difficulty... Were it otherwise he would never have been able to find those words.  回复  更多评论
  
# purchase viagra 2008-06-15 12:56 | purchase viagra
Never let the demands of tomorrow interfere with the pleasures and excitement of today.  回复  更多评论
  
# buy fioricet 2008-06-15 16:47 | buy fioricet
I like weights. You know where you stand with them. Well, sometimes you're lying under them, trying not to let them crush you, but you see, you KNOW they'd crush you if they could. There's honesty.  回复  更多评论
  
# alprazolam online 2008-06-15 20:40 | alprazolam online
Keep cool and you command everybody.  回复  更多评论
  
# buy xenical 2008-06-16 00:07 | buy xenical
No.  回复  更多评论
  
# buy hydrocodone 2008-06-16 00:10 | buy hydrocodone
Humor is also a way of saying something serious.  回复  更多评论
  
# generic viagra online 2008-06-16 00:10 | generic viagra online
You create your opportunities by asking for them.  回复  更多评论
  
# soma 2008-06-16 05:09 | soma
Books...are like lobster shells, we surround ourselves with 'em, then we grow out of 'em and leave 'em behind, as evidence of our earlier stages of development.  回复  更多评论
  
# order carisoprodol 2008-06-16 05:09 | order carisoprodol
Here's to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes... the ones who see things differently -- they're not fond of rules... You can quote them, disagree with them, glorify or vilify them, but the only thing you can't do is ignore them because they change things... they push the human race forward, and while some may see them as the crazy ones, we see genius, because the ones who are crazy enough to think that they can change the world, are the ones who do.  回复  更多评论
  
# losec 2008-06-16 05:10 | losec
Even the fear of death is nothing compared to the fear of not having lived authentically and fully.  回复  更多评论
  
# omeprazole 2008-06-16 09:29 | omeprazole
Life is a great big canvas; throw all the paint on it you can.  回复  更多评论
  
# cetirizine 2008-06-16 13:12 | cetirizine
I never met anybody who said when they were a kid, "I wanna grow up and be a critic."  回复  更多评论
  
# ambien 2008-06-16 17:01 | ambien
What is the use of a house if you haven't got a tolerable planet to put it on?  回复  更多评论
  
# lorcet 2008-06-16 20:24 | lorcet
Winning is important to me, but what brings me real joy is the experience of being fully engaged in whatever I'm doing.  回复  更多评论
  
# tylenol 2008-06-16 23:50 | tylenol
He who will not reason is a bigot; he who cannot is a fool; and he who dares not is a slave.  回复  更多评论
  
# escitalopram 2008-06-16 23:51 | escitalopram
Laughing is the sensation of feeling good all over and showing it principally in one spot.  回复  更多评论
  
# furosemide impedor chromotherapy 2008-06-16 23:57 | furosemide impedor chromotherapy
Do it now. It is not safe to leave a generous feeling to the cooling influences of the world.  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理