hi,
i m new in assembly language. i perform simple tasks but when i call some interrupts then system halts and show "stop working dialog box and program close.
.code ; Tell MASM where the code starts
start:
call main
exit
main proc
LOCAL x: DWORD
mov dl, 2
mov ah, 2
int 21h
mov x, input("dsfasd")
main endp
program have no syntax error and built successfully.
this is working on win7 ultimate
Interrupts are not directly supported in protected mode in Win32 or Win64. You are trying to build DOS real mode code. What you need to use are Windows API function calls.
but i want to learn how interrupts work. what should i do
Quote from: suleman on January 21, 2013, 07:58:08 PM
but i want to learn how interrupts work. what should i do
1. Find out what OS you have. If it is 64-bit, you'll have to install an emulation platform for 16-bit ( DOSBox is the simplest bet). If your OS is 32-bit, you may probably use the Windows built-in NTVDM to run 16-bit code.
2. Forget the include files contained in Masm32 - they're supposed for Win32 only; don't use "exit" or "input" macros.
3. re-post your program in the DOS 16-bit sub-forum.
mov dl,2
also, ASCII 2 is a heart char or something - an old "control character"
if you want to see the number 2 on the screen, use 32h, the ASCII "2" char
this is a 16-bit program - use a 16-bit linker to build it
.MODEL Small
.386
.STACK 1024
OPTION CaseMap:None
;####################################################################################
; .DATA
;************************************************************************************
; .DATA?
;####################################################################################
.CODE
;************************************************************************************
_main PROC FAR
;----------------------------------
;DS = DGROUP (not required for this program)
; mov ax,@data
; mov ds,ax
;----------------------------------
mov dl,32h
mov ah,2
int 21h
;----------------------------------
;terminate program
mov ax,4C00h
int 21h
_main ENDP
;####################################################################################
END _main