| | |
int 21 causes an access violation
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Jan 2007
Posts: 13
Reputation:
Solved Threads: 0
Hello guys. I am having a problem with the following code. When I try to run the program the instruction int 21 causes an access violation. Can someone tell me how to fix this problem?
Assembly Syntax (Toggle Plain Text)
.386 .model flat .stack 100h .data message db 'Hello World', 13, 10, '$' .code _start: lea dx, message mov ah, 9h ; string output int 21h ; display string mov ax, 4c00h int 21h mov ah, 1h int 21h ; read character into al mov dl, al mov ah, 2h int 21h ; display character in dl mov ax, 4c00h int 21h end _start
Access violation is caused when a program attempts to
access memory reserved for the operating system.
I thought this could only happen in a windows program?
I assume your using MASM:
Program flow stops before line 23, because you terminated
with 21/4C.
access memory reserved for the operating system.
I thought this could only happen in a windows program?
I assume your using MASM:
Assembly Syntax (Toggle Plain Text)
mov ax, seg message ; initialize the DS register so mov ds, ax ; you can access variable 'message' lea dx, message
Program flow stops before line 23, because you terminated
with 21/4C.
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
•
•
Join Date: Jan 2007
Posts: 13
Reputation:
Solved Threads: 0
•
•
•
•
Access violation is caused when a program attempts to
access memory reserved for the operating system.
I thought this could only happen in a windows program?
I assume your using MASM:
Assembly Syntax (Toggle Plain Text)
mov ax, seg message ; initialize the DS register so mov ds, ax ; you can access variable 'message' lea dx, message
Program flow stops before line 23, because you terminated
with 21/4C.
![]() |
Similar Threads
- C++ "Access violation reading location 0x00000021." (C++)
- Access violation reading location 0xcccccc00 (C++)
- Memory Access Violation (C++)
- Need an easy way around an access violation (C++)
- access violation(segmentational fault) gah (C)
- Access violation (C++)
- Access Violation (C)
- Access violation in C (C)
- Access Violation (Segmentation Fault) + atol (C++)
Other Threads in the Assembly Forum
- Previous Thread: need coding assembly ic 8051
- Next Thread: Who Here Uses MASM
| Thread Tools | Search this Thread |





