简体   繁体   中英

how to store the value (AL) of the position that the cursor is pointing at In emu8086 assembly language

When I move the pointer to the left or right while running tic tac toe on the emu8086 emulator, I am unable to retrieve the value that is found in the position that the cursor is pointing at. The value that is recorded is still that of the cursor's initial location. how could I find out what the new position's value is?

L3:
    inc line
    add dl,1 ;Move cursor Right
    int 10h
    cmp line,3
    jz B_Win 
    cmp al,'B'
    jnz menu
    jz L3
    

 B_Win:
 jmp exit

I tried moving the cursor to the right and thought the value AL might change with it but it didnt

retrieve the value that is found in the position that the cursor is pointing at.

It would seem that you want to read from the screen. You can use the BIOS.ReadCharacterAndAttribute function 08h for that.

  inc  Col          ; Move to the right
  call SetCursorPosition
  mov  bh, 0        ; Displaypage
  mov  ah, 08h      ; BIOS.ReadCharacterAndAttribute
  int  10h          ; -> AL is character, AH is attribute
  cmp  al, 'B'

  ...

SetCursorPosition:
  mov  dh, Row
  mov  dl, Column
  mov  bh, 0        ; Displaypage
  mov  ah, 02h      ; BIOS.SetCursorPosition
  int  10h
  ret

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM