MAXLEN DB ACTLEN STRING 20 H DB DB

  • Slides: 12
Download presentation

⑴ 数据区定义的缓冲区如下: MAXLEN DB ACTLEN STRING 20 H DB DB ? 20 H DUP

⑴ 数据区定义的缓冲区如下: MAXLEN DB ACTLEN STRING 20 H DB DB ? 20 H DUP (? ) ⑵ 输入字符串的指令如下: LEA DX, MAXLEN MOV AH, 0 AH INT 21 H 如果我们键入字符串By brooks too broad for leaping(回车), 则缓冲区内容为 20 1 F By brooks too broad for leaping 0 D, 实际上缓冲区占 34个字节,能输入 31个字符。 8

例5:从键盘输入字符串到缓冲区的程序 Dseg segment user_string db 50, 0, 50 dup(? ) Dseg ends Cseg segment

例5:从键盘输入字符串到缓冲区的程序 Dseg segment user_string db 50, 0, 50 dup(? ) Dseg ends Cseg segment assume cs: cseg, ds: dseg start: mov ax, dseg mov ds, ax lea dx, user_string mov ah, 0 a. H int 21 H ;从键盘输入字符串 Cseg ends end start 9

功能号 9 显示字符串 DS: DX=串地址 例12:显示字符串 ; 数据段 MESSAGE DB ‘The sort operation is

功能号 9 显示字符串 DS: DX=串地址 例12:显示字符串 ; 数据段 MESSAGE DB ‘The sort operation is finished. ’, 0 DH, 0 AH, ’$’ ; 程序段 mov mov int ah,9 dx, seg MESSAGE ds, dx dx, offset MESSAGE 21 h

3、DOS显示功能调用 例12:显示字符串 MESSAGE mov mov int DB ‘The sort operation is finished. ’, 0

3、DOS显示功能调用 例12:显示字符串 MESSAGE mov mov int DB ‘The sort operation is finished. ’, 0 DH, 0 AH, ’$’ ah,9 dx, seg MESSAGE ds, dx dx, offset MESSAGE 21 h 12