⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p228.asm

📁 汇编语言课后习题答案
💻 ASM
字号:
data segment
  thirty db 30
  msg0 db 'I like my IBM_PC              '
  msg1 db '8088 programming is fun       '
  msg2 db 'Time to by more diskettes     '
  msg3 db 'This program works            '
  msg4 db 'Turn off that printer         '
  msg5 db 'I have more memory than you   '
  msg6 db 'The PSP can be useful         '
  msg7 db 'BASIC was easier than this    '
  msg8 db 'DOS is indispensable          '
  msg9 db 'Last massage of the day       '
  
  errmsg db 'error!!!   invalid parameter!!'

data ends


stack segment
        db 256 dup(?)
   tos  label word
stack ends



code segment
main proc far
    assume cs:code,ds:data,ss:stack
start:
    
 

    mov ax,stack 
    mov ss,ax
    mov sp,offset tos  


    push ds
    sub ax,ax
    push ax

    mov ax, data
    mov ds, ax

begin:
    mov ah,1
    int 21h

    sub al,'0'
    jc error
    cmp al,9
    ja error

    mov bx,offset msg0
    mul thirty
    add bx,ax
    call display
    jmp begin

error:
    mov bx, offset errmsg
    call display
    ret

display proc near
    mov cx,30
displ:
    mov dl,[bx]
    call dispchar
    inc bx
    loop displ

    mov dl,0dh
    call dispchar 
  
    mov dl,0ah
    call dispchar

    ret
display endp

dispchar proc near
    mov ah,2
    int 21h
    ret
dispchar endp

main endp

code ends

    end start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -