0

I an trying to create Hangman using ASSEMBLY 8086x TASM MS-DOS. I want to create a procedure that takes lets the user type a certain letter and it will appear on the screen on specific coordinates. Is there a way to print a character on the screen on specific locations with x and y? Here is what I have written so far:

proc b
mov cx,10
InTheWordLoop:
push cx
   mov ah, 1 ;char input
   int 21h
   mov bx, offset ArrayBasketball
   mov si,0
   cmp [byte ptr (bx + si)], al
   jne fin
   mov ah,2
   mov dl,al
   fin:
   inc si
   pop cx
   loop InTheWordLoop
   
   
ret
endp b

I want to print the character above the underlines. The word in this example is "Basketball" which has 10 characters.

Gili
  • 1
  • what OS? int 21h suggest MS-DOS , what gfx and mode? I assume VGA and text mode 3 (80x25 chars) see [Graphics mode in assembly 8086](https://stackoverflow.com/a/48664419/2521214) for details on how direct VRAM access works where you can print at desired position and much more... I do not see any function to move cursor in [int 21h](http://spike.scu.edu.au/~barry/interrupts.html) but IIRC you could move the cursor by commands inside the text you are printing (like CR,LF... You know the codes below 32) – Spektre Jun 17 '21 at 07:29
  • You can use interrupt 10h service 02h if you're writing to a terminal: http://vitaly_filatov.tripod.com/ng/asm/asm_023.3.html – ecm Jun 17 '21 at 09:22

1 Answers1

0

I am not really familiar with MS-DOS but have you tried using escape sequences to move your cursor?

For example:

\033[y;xH

will move your cursor to specified x and y

Original stackovweflow post

OKEE
  • 450
  • 3
  • 15
  • 1
    https://en.wikipedia.org/wiki/ANSI_escape_code#DOS,_OS/2,_and_Windows has some info about DOS support for these escape sequences; it's a mixed bag, and if programming specifically for DOS, that's definitely not the easiest way to do things. – Peter Cordes Jun 17 '21 at 11:27
  • This is not how you do it in DOS. There are DOS API functions that you can call for this, and/or BIOS API functions. – Cody Gray - on strike Jun 18 '21 at 09:40