鱼C论坛

 找回密码
 立即注册
查看: 1674|回复: 0

关于实验9的代码,跟答案的思路不同,可取吗?

[复制链接]
发表于 2012-11-8 09:41:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
assume cs:codesg,ds:datasg,ss:stacksg
datasg segment
        db 'welcome to masm!'
        db 2h,24h,71h
datasg ends

stacksg segment
        dw 8 dup (0)
stacksg ends

codesg segment
        start:        mov ax,        0b800h
                        mov ds,        ax        ;写入显示缓存的段地址
                        mov si,        10h        ;颜色偏移地址
                        mov di,        720h
                        mov ax,        datasg
                        mov es,        ax        ;需要写入内存的段地址
                        mov ax,        stacksg
                        mov ss,        ax
                        mov sp, 10h
                        mov cx,        3
                        
                        s0:        push cx
                                mov dh,es:[si];DL为将要显示的颜色
                                mov bx,        0        ;内容偏移地址
                                mov cx,        16        ;内部循环计数
                                        s1:        mov dl,es:[bx]        ;把字符串内容逐一写入内存
                                                mov ds:[bx+di],        dx
                                                inc di
                                                inc bx
                                                loop s1
                                add di,        090h
                                inc si
                                pop cx
                                loop s0
                        
                        mov ax,4c00h
                        int 21h
codesg ends
end start



补充内容 (2012-11-8 09:44):
对比了下答案,还是复杂太多了,
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-8 02:18

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表