assembly 8086 cursor placement

丶灬走出姿态 提交于 2019-12-19 21:42:08

问题


I want to place the cursor after the "paper:" wait until an ENTER is given and then place it after "author(s):". both sentences are defined variables that are printed.

    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

回答1:


Call next proc to position cursor :

;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

Example :

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.

In previous example cursor will jump to after "paper: ".

Edit : two more procs, cursor_on and cursor_off, to show and hide cursor:

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


来源:https://stackoverflow.com/questions/40940029/assembly-8086-cursor-placement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!