KatomPower
KatomPower

Reputation: 129

Assembly - Writing Text In A Certain Location To Display On DOSBox

I am currently working on a game called: "4 In A Row". I am trying to write the instructions of the game to appear on DOSBox when I load the game up. I want to display it in a certain location on the screen but I don't know how to do that.

https://i.sstatic.net/FphXn.png

I have outlined the code for the instructions.

Thank you very much for anyone who can help me.

The code:

inst1 db 'To drop a disc into one of the columns press: 1, 2, 3 or 4.',13,10,'$'

    Instructions1:
        lea dx, [inst1]
        mov dx, offset inst1
        mov ah, 9
        int 21h

Upvotes: 1

Views: 2851

Answers (2)

Try a "gotoxy" before displaying the text :

inst1 db 'To drop a disc into one of the columns press: 1, 2, 3 or 4.',13,10,'$'

;SET CURSOR POSITION (GOTOXY).
  MOV  DL, 20    ;SCREEN COLUMN.
  MOV  DH, 5     ;SCREEN ROW.
  MOV  AH, 2     ;SERVICE TO SET CURSOR POSITION.
  MOV  BH, 0     ;PAGE NUMBER.
  INT  10H       ;BIOS SCREEN SERVICES.

Instructions1:
    lea dx, [inst1]
    mov dx, offset inst1
    mov ah, 9
    int 21h

Upvotes: 2

Rob
Rob

Reputation: 94

I should be cautious about answering on StackOverflow when I cannot check my work. But from memory...

I believe that you want to look into Int 10h using AH = 2. In English, you want to set the cursor position first, before calling 21h to write to STDOUT at that position.

I hope this gets you started down the right path!

Upvotes: 2

Related Questions