2016-12-02 63 views
2

我想将光标放在“纸张”后面,等待ENTER,然后放在“作者:”之后。两个句子都是打印的定义变量。程序集8086光标的放置

enter image description here

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 
+0

用户可以输入字符 “直到ENTER给出”? –

+0

是的,你应该写论文标题,然后写作者的名字。第二次输入后,你可以点击下一步或主要 – justwarmilk

+0

鼠标点击已经测试和工作,我只是不知道如何使用光标 – justwarmilk

回答

1

呼叫下PROC来定位光标:

;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. 

在前面的例子中后光标将跳到 “纸”。

编辑:两个特效,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 
+0

@justwarmilk,如果您对我的proc'set_cursor'拍摄有任何疑问,那么使用起来非常简单。 –

+0

我试过那个,但它没有显示光标,不知道它是否是模拟器的问题。我需要添加什么才能输入? – justwarmilk

+0

@justwarmilk,光标完全不可见? –