I’m working on simple program to change memory bank configuration of old x86 16bit PC with MASM6.
Currently, when I execute the code from the main memory it hang up. It seems that it’s because the code itself is in the main memory. When the code is executed, code itself is destroyed due to the memory configuration is changed.
Therefore I want to move the code from main memory to video memory and want to execute it from the video memory.
Please give me advices about the following codes to move the code from main memory to video memory and execute it. Executing following code still makes the system hang up.
.MODEL SMALL
.STACK 100H
.DATA
MSG DB ' Bank Configuration is Successfully Changed',0DH,0AH,'$'
.CODE
MAIN PROC
MOV CX,OFFSET T_HERE - OFFSET F_HERE
MOV SI,OFFSET F_HERE
MOV DI,0B800H
REP MOVSB
JMP T_HERE
F_HERE:
MOV AX,@DATA
MOV AX,0B800H
MOV DS,AX
MOV DX,03872H
MOV AX,0DH
OUT DX,AX
MOV AH9
LEA DX,MSG
INT 21H
MOV AH,4CH
INT 21H
T_HERE:
MAIN ENDP
END MAIN