Search code examples
stringassemblytexttasmdosbox

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

Solution

  • 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