【问题标题】:assembly 8086 cursor placement装配 8086 光标放置
【发布时间】:2016-12-02 20:02:50
【问题描述】:

我想将光标放在“paper:”之后,等到给出 ENTER 后,然后将其放在“author(s):”之后。两个句子都是被打印的定义变量。

    insert db "******* Insert new paper *******",0,0Ah,0Ah,0Ah, 0Dh, "$"  
    inserttitle db "  Title of paper:      ",0Dh,0Ah,0Ah, "  Name of author(s):     ",0Dh ,"$"
    mainext db ,0Ah,0Ah,0Ah,0Ah,0Ah,0Ah,0Ah,0Ah,"     <<Main>>              <<Next>>","$"

 INSERT NEW PAPER

newpaper proc

    call clrscr

    mov dx, offset insert
    call printf

    mov dx, offset inserttitle
    call printf

    mov dx, offset mainext
    call printf

    call w8click   
    ret

newpaper endp

【问题讨论】:

  • 用户能否输入字符“直到给出 ENTER”?
  • 是的,你应该写论文标题,然后写作者姓名。第二次输入后,您可以单击下一步或主要
  • 鼠标点击已经过测试并且可以正常工作,我只是不知道如何使用光标
  • 鼠标?那你用鼠标吗?好的,这样做:当鼠标被点击时,你调用我的 proc set_cursor 将光标设置在鼠标位置。

标签: assembly x86-16 emu8086 text-cursor


【解决方案1】:

调用下一个过程来定位光标:

;INPUT : DL=X, DH=Y.
set_cursor proc
      mov  ah, 2                  ;◄■■ SERVICE TO SET CURSOR POSITION.
      mov  bh, 0                  ;◄■■ VIDEO PAGE.
      int  10h                    ;◄■■ BIOS SERVICES.
      RET
set_cursor endp

例子:

call clrscr

mov  dx, offset inserttitle ;◄■■ "  Title of paper:      "
call printf

mov  dl, 18                 ;◄■■ SCREEN COLUMN 18 (X).
mov  dh, 2                  ;◄■■ SCREEN ROW 2 (Y).
call set_cursor             ;◄■■ SET CURSOR POSITION.

在前面的例子中,光标会跳转到“paper:”之后。

编辑:另外两个 proc,cursor_oncursor_off,用于显示和隐藏光标:

cursor_on proc
   mov  ah, 1
   mov  cx, 4          ;◄■■ BIG CURSOR.
   int  10h
   ret
cursor_on endp


cursor_off proc
   mov  ah, 1
   mov  cx, 20h        ;◄■■ NO CURSOR.
   int  10h
   ret
cursor_off endp

【讨论】:

  • @justwarmilk,如果您对我的 proc set_cursor 有任何疑问,只需拍摄,它非常易于使用。
  • 我试过了,但是没有显示光标,不知道是不是模拟器的问题。我需要添加什么才能输入?
  • @justwarmilk,光标是完全不可见的吗?
  • @justwarmilk,添加了另外两个 proc 来显示和隐藏光标。
【解决方案2】:

这是一个接收位置 X,Y 的宏


gotoxy macro x y 
    mov ah,02h
    mov bh, 00h
    mov dl,x
    mov dh,y
    int 10h
    goto endm

; to call it just write: gotoxy 2,4

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-18
    相关资源
    最近更新 更多