Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 745649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T09:36:29+00:00 2026-05-14T09:36:29+00:00

I really do not understand why this simple code works fine in the first

  • 0

I really do not understand why this simple code works fine in the first attempt but when
putting it in a procedure an error shows:

NTVDM CPU has encountered an illegal instruction
CS:db22 IP:4de4 OP:f0 ff ff ff ff

The first code segment works just fine:

.model small
.stack 100h
.code

start:
  mov ax,@data
  mov ds,ax
  mov es,ax

   MOV AH,02H    ;sets cursor up            
   MOV BH,00H
   MOV DH,02
   MOV DL,00
   INT 10H

EXIT:

MOV AH,4CH
INT 21H
END

However This generates an error:

.model small
.stack 100h
.code

start:
  mov ax,@data
  mov ds,ax
  mov es,ax

  call set_cursor

  PROC set_cursor near

  MOV AH,02H    ;sets cursor up             
  MOV BH,00H
  MOV DH,02
  MOV DL,00
  INT 10H
 RET
 set_cursor ENDP

EXIT:

  MOV AH,4CH
  INT 21H
  END

Note: Nothing is wrong with windows config. I have tried many sample codes that work fine

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T09:36:29+00:00Added an answer on May 14, 2026 at 9:36 am

    You left out a JMP:

    call set_cursor
    jmp EXIT ; <== you forgot this part
    
    PROC set_cursor near
    

    What’s happening is that after call set_cursor, you’re then falling through to the proc and and executing it again, then when you hit the ret it pops the stack and you jump to, well, who knows?

    Edit: As someone else pointed out, you’re better off putting your PROC after your main code ends, instead of sticking it in the middle and jumping around it. But you’ve probably figured that out already 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should really be allowed - I do not understand why it is not.
I have to be missing something simple, but I'm really not sure what. I
This is probably going to be a really simple explanation, but I'm going to
This seems like a really simple question; but I can't see how it's actually
Not really a programming question, but relevant to many programmers... Let's say I have
The following code works (and it's very simple): class Scrape(QApplication): def __init__(self): super(Scrape, self).__init__(None)
I really didn't know how to ask this question in a simple fashion. I
This is a very simple question for many of you reading this, but it's
Is there really not a TSpinEdit control for floats in Delphi? It looks like
Since it's really not possible to return a single embedded document (yet), what is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.