0
点赞
收藏
分享

微信扫一扫

汇编语言(王爽)监测点6.1

楠蛮鬼影 2022-02-03 阅读 67
c语言

(1)

用内存0:0-0:15单元的内容改写程序中的数据

assume cs:codesg
codesg segment
	dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h;数据部分
start:	mov ax,0
		mov ds,ax;ds为0
		mov bx,0
	
	
		mov cx,8
	s:	mov ax,[bx];用ax来装0:0中的数据
		mov cs:[bx],ax;将ax赋值给程序数据部分,就是最上面的八个数据,这里这八个数据是当作内存空间
		add bx,2
		loop s

		mov ax,4c00h
		int 21h

codesg ends
end

mov cs:[bx],ax

用内存0:0-0:15单元的内容改写程序中的数据,用栈传送数据


assume cs:codesg
codesg segment
	dw 0123h,0456h,0789h,0abch,0defh,0fedh,0cbah,0987h
	dw 0,0,0,0,0,0,0,0,0,0
start:	mov ax,cs
		mov ss,ax
		mov sp,24h;栈顶8*2+10*2=36(24h)
	
		mov ax,0
		mov ds,ax;
		mov bx,0
		mov cx,8
	s:	push [bx];将0:0-0:15数据依次送到栈内
		pop cs:[bx];将栈顶的元素赋值给程序开始的8个数据部分(这8个数据被当作存储空间来使用)
		add bx,2
		loop s

		mov ax,4c00h
		int 21h

codesg ends
end

mov ax,cs
mov sp,24h
pop cs:[bx]

举报

相关推荐

0 条评论