更灵活的定位内存地址的方法 ——将每个单词的前四个字母改为大写

October 5, 2013
masm

很简单的一个程序

assume cs:code, ss:stack, ds:data

data segment
    db '1. display      '
    db '2. brows        '
    db '3. replace      '
    db '4. modify       '
data ends

stack segment
    dw 0, 0, 0, 0, 0, 0, 0, 0
stack ends

code segment
start:
    mov ax, data
    mov ds, ax
    mov ax, stack 
    mov ss, ax
    mov sp, 10h
    mov bx, 3
    mov cx, 4
s:
    push cx
    mov si, 4
    mov cx, si
    mov si, 0
s0:
    mov al, [bx][si]
    and al, 11011111b
    mov [bx][si], al
    inc si
    loop s0

    pop cx
    add bx, 10h
    loop s

    mov ax, 4c00h
    int 21h
code ends

end start

逻辑挺清晰的。自不必说。

comments powered by Disqus