1
extern void print( char color, char * text );
2
int i;
3
int main()
4![](http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif)
{
5
print(0xf,"neocs: loader\n\r");
6![](http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif)
7
print(0xf,"it's written by C!\n\r");
8![](http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif)
9
return 0;
10![](http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif)
11
}
1
extrn _main:near
2
.model tiny
3
.code
4![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
5
public _halt, main, _print,
6![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
7
main 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
18
main endp
19![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
20
_halt proc near
21
hl:
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![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
42
_break:
43
pop si
44
mov sp,bp
45
pop bp
46
ret
47
_print endp
48![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
49
end main
50![](http://www.cppblog.com/Images/OutliningIndicators/None.gif)
Click here to download
posted on 2007-05-20 00:26
shaker(太子) 阅读(1605)
评论(23) 编辑 收藏 引用 所属分类:
C++