将下面代码排列成正确格式 org 0x7c00start: mov ax, cs mov ds, ax mov es, ax ; 清屏 xor ax, ax mov es, ax mov di, 0 mov cx, 80 * 25 mov ax, 0x0720 rep stosw ; 输出字符串 mov si, str mov ah, 0x0eprint: lodsb cmp al, 0 je_sum int 0x10 jmp print ; 计算ASCII值的总和calc_sum: mov si, str xor cx, cxsum_loop: lodsb cmp al, 0 je end add cx, ax jmp sum_loop ; 显示ASCII值的总和end: mov ax, cx mov bx, 10 xor cx, cx div bx push ax cmp ax, 0 jz print_sum jmp endprint_sum: pop ax add al, '0' mov ah, 0x0e int 0x10 jmp endstr db "21210929周何昊然", 0times 510-($-$$) db 0dw 0xaa55```
时间: 2024-03-20 16:41:41 浏览: 94
```assembly
org 0x7c00
start:
mov ax, cs
mov ds, ax
mov es, ax
; 清屏
xor ax, ax
mov es, ax
mov di, 0
mov cx, 80 * 25
mov ax, 0x0720
rep stosw
; 输出字符串
mov si, str
mov ah, 0x0e
print:
lodsb
cmp al, 0
je end
int 0x10
jmp print
; 计算ASCII值的总和
calc_sum:
mov si, str
xor cx, cx
sum_loop:
lodsb
cmp al, 0
je end
add cx, ax
jmp sum_loop
; 显示ASCII值的总和
end:
mov ax, cx
mov bx, 10
xor cx, cx
div bx
push ax
cmp ax, 0
jz print_sum
jmp end
print_sum:
pop ax
add al, '0'
mov ah, 0x0e
int 0x10
jmp end
str db "21210929周何昊然", 0
times 510-($-$$) db 0
dw 0xaa55
```
阅读全文