some functions in assembly

show_str:
              show_str:;show a string dh=row number,dl=colum number,cl=color,ds:si point to the string
              PUSH      AX
              PUSH      BX
              PUSH      ES
             
              MOV       BX,0b800h
              MOV       ES,BX
             
              MOV       AL,DH
              MOV       DH,0a0h
              MUL       DH
             
              MOV       DH,0
              ADD       DL,DL
              ADC       DH,0
              ADD       AX,DX
             
              MOV       BX,AX
             
              do:
              CMP       BYTE PTR DS:[SI],0
              JE        sret
              MOV       AL,DS:[SI]
              MOV       ES:[BX],AL
              INC       SI
              INC       BX
              MOV       ES:[BX],CL
              INC       BX
              JMP       do
             
              sret:
              pop  es
              pop  bx
              pop ax
              RET

the step program of int 0

assume cs:code

code segment

main:

step: mov ax,cs
 mov ds,ax
 mov  si,offset int_0 
 
 mov ax,0
 mov  es,ax
 mov di,200h
 mov  cx,offset int_0_end - offset int_0

 cld 
 rep  movsb

set: mov ax,0
 mov es,ax
 mov  word ptr es:[0],200h
 mov  word ptr es:[2],0h

ok: mov ax,4c00h
 int 21h


int_0: jmp  int_0_begin
 msg:  db 'efish: div overflow'
int_0_begin:
 mov  ax,cs
 mov  ds,ax
 mov  si,202h

 mov  ax,0b800h
 mov  es,ax
 mov  di,12*160+36*2
 
 mov  cx,20
do: mov  al,[si]
 mov  es:[di],al
 inc  si
 add  di,2
 loop  do
 
 mov  ax,4c00h
 int  21h 

int_0_end:nop

code ends

end main

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值