分析下面的程序,画出堆栈最满时各单元的地址及内容。
S_SEG SEGMENT AT 1000H ;定义堆栈段
DW 200 DUP (?) ;200*2=190H
TOS LABEL WORD
S_SEG ENDS
C_SEG SEGMENT
ASSUME CS: C_SEG, SS: S_SEG
START: MOV AX, S_SEG
MOV SS, AX ;SS=1000H
MOV SP, OFFSET TOS ;SP=190H
PUSH DS
MOV AX, 0
PUSH AX
┇
PUSH T_ADDR
PUSH AX
PUSHF
┇
POPF
POP AX
POP T_ADDR
RET
C_SEG ENDS
END START
分析下面的程序,写出堆栈最满时各单元的地址及内容。
STACK SEGMENT AT 500H ;定义堆栈段
DW 128 DUP (?)
TOS LABEL WORD
STACK ENDS
CODE SEGMENT
MAIN PROC FAR ;主程序部分
ASSUME CS: CODE, SS: STACK
START: MOV AX, STACK
MOV SS, AX
MOV SP, OFFSET TOS
PUSH DS
SUB AX, AX
PUSH AX
MOV AX, 4321H
CALL HTOA
RET
MAIN ENDP ;主程序部分结束
HTOA PROC NEAR ;HTOA子程序
CMP AX, 15
JLE B1
PUSH AX
PUSH BP ;保存原BP
MOV BP, SP
MOV BX, [BP+2]
AND BX, 000FH
MOV [BP+2], BX
POP BP ;恢复原BP
MOV CL, 4
SHR AX, CL
CALL HTOA
POP AX
B1: ADD AL, 30H
CMP AL, 3AH
JL PRINTIT
ADD AL, 7H
PRINTIT: MOV DL, AL
MOV AH, 2
INT 21H
RET
HOTA ENDP ;HOTA子程序结束
CODE ENDS
END START