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 6124855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:10:50+00:00 2026-05-23T16:10:50+00:00

I currently have three segments of memory, my main data segment, stack segment and

  • 0

I currently have three segments of memory, my main data segment, stack segment and the segment where my API lives. The following instructions are executed from the data segment, they push the address of cursorRow and welcomeMsg then do a far call to the function in my API segment. The cursorRow variable lives in the main data segment that is calling the API function. The call looks like this:

  push cursorRow
  push welcomeMsg
  call API_SEGMENT:API_printString

How can I alter cursorRow, inside of the segment where my API lives, through the stack? cursorRow needs to be updated from the API. NO API functions alter the data segment. I have tried things like: inc byte [ds:bp+8] and add [ds:bp+8], 1.
Here is the API procedure being called:

printStringProc:
    push bp 
    mov bp, sp
    mov si, [bp+6]
    .printloop:
        lodsb
        cmp al, 0
        je printStringDone
        mov ah, 0x0E ; teletype output
        mov bh, 0x00 ; page number
        mov bl, 0x07 ; color (only in graphic mode)
        int 0x10
        jmp .printloop
    printStringDone:
    ; move the cursor down
    mov ah, 02h ; move cursor
    mov dh, [bp+8]
    mov dl, 0 ; column
    mov bh, 0 ; page number
    int 10h

    add [ds:bp+8], 1

  pop bp
  retf 

it prints strings, but the cursorRow variable doesn’t correctly update. I hope I’m clear enough on my issue. It’s hard to explain 😀

  • 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-23T16:10:50+00:00Added an answer on May 23, 2026 at 4:10 pm

    This is because you passed the pointer to cursorRow, not cursorRow itself. When you perform

    inc [ds:bp+8]
    

    you: 1) get the value of bp, 2) add 8, 3) assume the result is a pointer in ds, 4) increment the value stored there (the pointer to cursorRow). Since the pointer is stored on the stack, you are incrementing the pointer when you do this. What you need to do is take the pointer off of the stack and increment the value that points to.

    mov bx, [bp+8]
    inc [bx]
    

    This code: 1) gets the value of bp, 2) adds 8, 3) assumes the result is a pointer in ss, 4) load the value stored there (the pointer to cursorRow) into bx, 5) assumes bx is a pointer in ds, 6) increments the value stored there (the value of cursorRow).

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

Sidebar

Related Questions

I have three divs: A, B and C. A is currently visible and I
I have a memory heap manager which partitions the heap into different segments based
Currently I have three tables. GrandParent( tel int, G_Counter int, GField varchar(10)); Parent( tel
I currently have a fairly straight forward UI which displays three 250 x 180
I have three inputs coming in from a form. They are name , neighborhoods
I've tried very hard to have a normalized database and currently have three tables
I currently have one record (with various values) and three user constants with specific
There is probably is simple fix for this but I currently have code similar
I have a dotnet windows service that's currently hung, but running. Is there anyway
I currently have an MS Access application that connects to a PostgreSQL database via

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.