用C语言显示字符串(1)

This commit is contained in:
Yourtion
2016-05-09 13:48:34 +08:00
parent fc60d80e6c
commit c718be8fd3
3 changed files with 28 additions and 1 deletions

View File

@@ -67,6 +67,13 @@ hello3.bim : hello3.obj a_nask.obj Makefile
hello3.hrb : hello3.bim Makefile
$(BIM2HRB) hello3.bim hello3.hrb 0
hello4.bim : hello4.obj a_nask.obj Makefile
$(OBJ2BIM) @$(RULEFILE) out:hello4.bim stack:1k map:hello4.map \
hello4.obj a_nask.obj
hello4.hrb : hello4.bim Makefile
$(BIM2HRB) hello4.bim hello4.hrb 0
bug1.bim : bug1.obj Makefile
$(OBJ2BIM) @$(RULEFILE) out:bug1.bim map:bug1.map bug1.obj a_nask.obj
@@ -86,7 +93,8 @@ bug3.hrb : bug3.bim Makefile
$(BIM2HRB) bug3.bim bug3.hrb 0
haribote.img : ipl10.bin haribote.sys Makefile \
hello.hrb hello2.hrb a.hrb hello3.hrb bug1.hrb bug2.hrb bug3.hrb
hello.hrb hello2.hrb a.hrb hello3.hrb bug1.hrb bug2.hrb bug3.hrb \
hello4.hrb
$(EDIMG) imgin:../z_tools/fdimg0at.tek \
wbinimg src:ipl10.bin len:512 from:0 to:0 \
copy from:haribote.sys to:@: \
@@ -99,6 +107,7 @@ haribote.img : ipl10.bin haribote.sys Makefile \
copy from:bug1.hrb to:@: \
copy from:bug2.hrb to:@: \
copy from:bug3.hrb to:@: \
copy from:hello4.hrb to:@: \
imgout:haribote.img
# 其他指令

View File

@@ -4,6 +4,7 @@
[FILE "a_nask.nas"] ; 源文件名信息
GLOBAL _api_putchar
GLOBAL _api_putstr0
GLOBAL _api_end
[SECTION .text]
@@ -13,6 +14,15 @@ _api_putchar: ; void api_putchar(int c);
MOV AL,[ESP+4] ; c
INT 0x40
RET
_api_putstr0: ; void api_putstr0(char *s);
PUSH EBX
MOV EDX,2
MOV EBX,[ESP+8] ; s
INT 0x40
POP EBX
RET
_api_end: ; void api_end(void);
MOV EDX,4
INT 0x40

8
22_day/hello4.c Normal file
View File

@@ -0,0 +1,8 @@
void api_putstr0(int c);
void api_end(void);
void HariMain(void)
{
api_putstr0('hello, world\n');
api_end();
}