whypro 发表于 2010-12-12 14:40:47

汇编之读写数组(c语言风格)

本帖最后由 whypro 于 2010-12-12 15:04 编辑

.data ;16位下
arrayH word 100h,200h,300h
.code
mov ax,arrayH      ;ax=100h
mov ax,;ax=200h

.data ;32位下
arrayH dword 10000h,20000h
.code
mov ax,arrayH      ;ax=10000h
mov ax,;ax=20000h

废话就不说了直接上代码:
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
.data
arrayK dword 10000h,20000h
szCaption db '消息框!',0
szText db 100 dup(0)
szCharsFormat db 'ArrayK:%d,%d',0
.code
start:
invoke        wsprintf,addr szText, addr szCharsFormat, arrayK, arrayK+4
invoke MessageBox,NULL,offset szText,offset szCaption,MB_OK
mov        arrayK,1
mov        arrayK+4,2
invoke        wsprintf,addr szText, addr szCharsFormat, arrayK, arrayK+4
invoke MessageBox,NULL,offset szText,offset szCaption,MB_OK
invoke ExitProcess,NULL
end start
页: [1]
查看完整版本: 汇编之读写数组(c语言风格)