long pow10 (int p);
void printf(const char *format,...);
main()
{
int n;
printf("%c,%d",'a',-32766);
}
void printf(const char *format,...)
{
char c;
int a=0,argc=0,num,n;
while((c=*(format++))!=0)
{
if (c=='%'){
argc++;
c=*(format++);
if (c=='c'){
*(char far *)(0xb800000...
- [yangle0125] 注意%d 参数 不能超出-32767~32767的范围 02/27 20:05
- [游客] 我只是看了看debug的结果,方法谈不上。综合研究可以作为下面c语言学习的一个兴趣课,实际上研究不宜 02/26 18:25
- [crazyman] 能把你这种探索学习的方法给我们说说就好了。 02/26 18:00
- [yangle0125] 课程设计二 终于完成 所有功能测试无误 感觉这个程序的代码编写并不是很难,难在这个程序的调试上,通 02/21 14:41
- [deepblue] 浏览了一下,逻辑上很清晰,加上前两个功能就可以了,等着看你的结果 02/15 18:26
- [yangle0125] 噢对了,想问一下如果把程序里的 pushf call dword ptr ds:[13 02/15 12:37
- [wsrf] 我也同意楼主的说法,应该去掉。 不过对于博主所说的第一个目的,我认为是不存在的,至少书中没有这层意 02/14 09:27
- [yangle0125] 程序已改,有空了我会再把动态形式加上 02/10 09:55
- [yangle0125] 噢 明白了 谢谢 02/10 09:36
- [tomato] 如果将端口号和分隔符放到一个数据段中,程序只需一个循环就够了,一则,代码量会减少,二则,程序逻辑会更 02/10 09:15
- [yuhuofei] 你好,我现在已经不在石家庄了,很高兴认识你。 03/31 09:05
[2009-02-27 20:01] 综合研究 简单的printf函数
阅读全文 |
评论次数(1) |
浏览次数(664) |
所属类型(汇编作业)
[2009-02-26 11:51] 综合研究 关于malloc的研究代码
现将研究malloc用法的程序中每一句所对应的汇编代码简述如下:
(1)#define Buffer ...
mov bx,0200
mov es,bx
xor bx,bx
(2)Buffer=(char *)malloc(20)
mov es:[bx],ax
(3)Buffer[10]=0
mov byte ptr es:[bx+0a],00
(4)while (Buffer[10]!=8)
cmp byte ptr es:[bx+0a],08
jnz 021f
(5)Buffer[Buffer[10]]='a'+Buffer[10...
(1)#define Buffer ...
mov bx,0200
mov es,bx
xor bx,bx
(2)Buffer=(char *)malloc(20)
mov es:[bx],ax
(3)Buffer[10]=0
mov byte ptr es:[bx+0a],00
(4)while (Buffer[10]!=8)
cmp byte ptr es:[bx+0a],08
jnz 021f
(5)Buffer[Buffer[10]]='a'+Buffer[10...
阅读全文 |
评论次数(2) |
浏览次数(718) |
所属类型(汇编作业)
[2009-02-15 17:03] 课程设计 二 最终代码 测试通过
assume cs:code
code segment
;装载程序到扇区
start:
push cs
pop es
mov bx,offset boot
mov al,2;写入的扇区数
mov ch,0;磁道号
mov cl,1;扇区号
mov dl,0;表示软驱a
mov dh,0;面号
mov ah,3;功能号,3表示写
int 13h
mov ax,4c00h
int 21h
boot:
;装载第二扇区
mov ax,0
mov es,ax
mov bx,7e00h
mov al...
code segment
;装载程序到扇区
start:
push cs
pop es
mov bx,offset boot
mov al,2;写入的扇区数
mov ch,0;磁道号
mov cl,1;扇区号
mov dl,0;表示软驱a
mov dh,0;面号
mov ah,3;功能号,3表示写
int 13h
mov ax,4c00h
int 21h
boot:
;装载第二扇区
mov ax,0
mov es,ax
mov bx,7e00h
mov al...
阅读全文 |
评论次数(2) |
浏览次数(713) |
所属类型(汇编作业)
[2009-02-12 17:16] 第十七章 实验17 疑问
assume cs:code
code segment
start:
;安装int7ch
mov ax,code
mov ds,ax
mov si,offset int7ch
mov ax,0
mov es,ax
mov di,550h
mov cx,offset int7chend-offset int7ch
cld
rep movsb
;设置中断向量表
mov word ptr es:[7ch*4],550h
mov word ptr es:[7ch*4+2],0h
;读盘测试
mov ax,0
mov es,ax
mov bx,200h
...
code segment
start:
;安装int7ch
mov ax,code
mov ds,ax
mov si,offset int7ch
mov ax,0
mov es,ax
mov di,550h
mov cx,offset int7chend-offset int7ch
cld
rep movsb
;设置中断向量表
mov word ptr es:[7ch*4],550h
mov word ptr es:[7ch*4+2],0h
;读盘测试
mov ax,0
mov es,ax
mov bx,200h
...
阅读全文 |
评论次数(1) |
浏览次数(794) |
所属类型(汇编作业)
[2009-02-10 14:36] 第十七章 检测点 关于字符串输入的一个疑问
正确
在进入int16前,cpu把tf,if置零,如果没有设置if=1的指令,该例程将等不到键盘的输入。进一步说,当缓冲区没有字符时,int16将设置if=1,并进入等待。
书上17.3节给出的处理字符串输入的程序中,对于那个2号功能,即charshow,我认为noempty标号下面的mov byte ptr es:[di+2],' ' 是多余的,应该去掉。加入空格的一个目的是为了与屏幕上已有的字符隔开,比如屏幕上原来有:pill一词,现在如果从p开始写了一个字符k,这样的话就会变成kill,而加入一个空格的话就是k ll,不会引起歧义。
加空格还有一个更重要的目的,就是在按退格键的...
在进入int16前,cpu把tf,if置零,如果没有设置if=1的指令,该例程将等不到键盘的输入。进一步说,当缓冲区没有字符时,int16将设置if=1,并进入等待。
书上17.3节给出的处理字符串输入的程序中,对于那个2号功能,即charshow,我认为noempty标号下面的mov byte ptr es:[di+2],' ' 是多余的,应该去掉。加入空格的一个目的是为了与屏幕上已有的字符隔开,比如屏幕上原来有:pill一词,现在如果从p开始写了一个字符k,这样的话就会变成kill,而加入一个空格的话就是k ll,不会引起歧义。
加空格还有一个更重要的目的,就是在按退格键的...
阅读全文 |
评论次数(1) |
浏览次数(690) |
所属类型(汇编作业)
[2009-02-08 16:23] 第十六章 实验16
assume cs:code
code segment
start:
;安装int7ch
mov ax,code
mov ds,ax
mov si,offset int7ch
mov ax,0
mov es,ax
mov di,201h
mov cx,offset int7chend-offset int7ch
cld
rep movsb
;设置中断向量表
mov word ptr es:[7ch*4],201h
mov word ptr es:[7ch*4+2],0h
;依次测试功能
mov ah,0
int 7ch
mov ah,1
mov ...
code segment
start:
;安装int7ch
mov ax,code
mov ds,ax
mov si,offset int7ch
mov ax,0
mov es,ax
mov di,201h
mov cx,offset int7chend-offset int7ch
cld
rep movsb
;设置中断向量表
mov word ptr es:[7ch*4],201h
mov word ptr es:[7ch*4+2],0h
;依次测试功能
mov ah,0
int 7ch
mov ah,1
mov ...
阅读全文 |
评论次数(2) |
浏览次数(602) |
所属类型(汇编作业)
[2009-02-07 15:27] 第十六章 求正弦的参数判断
mov bl,0
mov cx,7
s:
cmp al,bl
je next
add bl,30
loop s
wrong:
出错处理
next:
程序继续...
mov cx,7
s:
cmp al,bl
je next
add bl,30
loop s
wrong:
出错处理
next:
程序继续...
阅读全文 |
评论次数(2) |
浏览次数(551) |
所属类型(汇编作业)
[2009-02-07 11:53] 第十五章 实验15
assume cs:code,ss:stack
stack segment
db 128 dup (0)
stack ends
code segment
start:
mov ax,stack
mov ss,ax
mov sp,128
push cs
pop ds
mov ax,0
mov es,ax
mov si,offset int9
mov di,204h
mov cx,offset int9end-offset int9
cld
rep movsb
push es:[9*4]
pop es:[200]
push es:[9*4+...
stack segment
db 128 dup (0)
stack ends
code segment
start:
mov ax,stack
mov ss,ax
mov sp,128
push cs
pop ds
mov ax,0
mov es,ax
mov si,offset int9
mov di,204h
mov cx,offset int9end-offset int9
cld
rep movsb
push es:[9*4]
pop es:[200]
push es:[9*4+...
阅读全文 |
评论次数(1) |
浏览次数(621) |
所属类型(汇编作业)
[2009-02-07 10:37] 第十五章 检测点 疑问
15.1
(1)
pushf
call dword ptr ds:[0]
疑问:既然在进入中断例程后tf,if都已置零,那在这之前标志寄存器就已经进栈,是不是可以再精简,只剩一句:
call dword ptr [0]
解答:刚刚想了想,应该是这样,首先不能省去pushf
因为我们编写的这个例程中,在调用系统提供的int9之前,cpu是不会做pushf 等那四步工作的,然而在这个例程执行完毕后在两处执行了iret,一是系统的int9结尾,一是我们编写的这个例程结尾,为了与系统int9例程结尾的iret配对,在调用系统的int9前我们需要pushf
至于i...
(1)
pushf
call dword ptr ds:[0]
疑问:既然在进入中断例程后tf,if都已置零,那在这之前标志寄存器就已经进栈,是不是可以再精简,只剩一句:
call dword ptr [0]
解答:刚刚想了想,应该是这样,首先不能省去pushf
因为我们编写的这个例程中,在调用系统提供的int9之前,cpu是不会做pushf 等那四步工作的,然而在这个例程执行完毕后在两处执行了iret,一是系统的int9结尾,一是我们编写的这个例程结尾,为了与系统int9例程结尾的iret配对,在调用系统的int9前我们需要pushf
至于i...
阅读全文 |
评论次数(1) |
浏览次数(570) |
所属类型(汇编作业)
[2009-02-06 22:13] 第十四章 实验14
assume cs:code
data segment
db 9,'/',8,'/',7,' ',4,':',2,':',0,0
data ends
code segment
start:
mov ax,data
mov ds,ax
mov si,0
mov ax,0b800h
mov es,ax
mov di,160*4+8*2
mov cx,6
s1:
mov ax,[si]
out 70h,al
in al,71h
mov ah,al
shr ah,1
shr ah,1
shr ah,1
shr ah,1
...
data segment
db 9,'/',8,'/',7,' ',4,':',2,':',0,0
data ends
code segment
start:
mov ax,data
mov ds,ax
mov si,0
mov ax,0b800h
mov es,ax
mov di,160*4+8*2
mov cx,6
s1:
mov ax,[si]
out 70h,al
in al,71h
mov ah,al
shr ah,1
shr ah,1
shr ah,1
shr ah,1
...
阅读全文 |
评论次数(5) |
浏览次数(875) |
所属类型(汇编作业)
『 查看更多文章 』