与屏幕上的其他元素一起打印

时间:2021-06-16 09:37:43

标签: assembly printing x86-16 tasm

我正在 TASM MS-DOS 中创建一个注册页面。我创建了一个带有按钮的导航栏来导航到登录页面。我现在试图在屏幕上打印“用户名:”并让用户输入他的用户名,但只要导航栏在屏幕上,它就不起作用。这是我的代码:

SignUpMessage db " Sign Up$"
userName db 12 dup(?)

proc AddBreakLines
    mov si, 0
    mov cx, 5
    BreakLineLoop:
        call printNewLine
        inc si
        loop BreakLineLoop
    ret
endp AddBreakLines

proc AddSpaces
    mov si, 0
    mov cx, 54
    mov dx, offset space
    SpaceLoop:
        call printStr
        inc si
        loop SpaceLoop
    ret
endp AddSpaces
 

proc SignUpPage
    mov ah, 0   ; set display mode function.
    mov al, 13h ; mode 13h = 320x200 pixels, 256 colors.
    int 10h     ; set it!
    mov al, 0Fh
    mov cx, -1  ;col
    mov dx, -1 ;row
    mov ah, 0ch ; put pixel

    signUpTopBar:
    inc cx
    int 10h
    cmp cx, 640
    jne signUpTopBar

    mov cx, 10  ; reset to start of col
    inc dx      ;next row
    cmp dx, 30
    jne signUpTopBar

    mov al, 0h
    mov cx, 0  ;col
    mov dx, 5  ;row
    mov ah, 0ch ; put pixel


    loginButton:
    inc cx
    int 10h
    cmp cx, 60
    jne loginButton

    mov cx, 0  ; reset to start of col
    inc dx      ;next row
    cmp dx, 30
    jne loginButton

    call printNewLine
    call printNewLine
    mov dx, offset LoginMessage
    mov ah, 09h
    int 21h

    mov ax, 0h
    int 33h
    mov ax, 1h
    int 33h
    pressLogin:
    mov ax, 3h
    int 33h
    cmp bx, 01h
    jne pressLogin
    shr cx, 1
    sub dx, 2
    cmp cx, 60
    ja pressLogin
    cmp dx, 5
    jb pressLogin
    cmp dx, 30
    ja pressLogin
    mov si, 0
    mov cx, 200
    BREAKLINE_SIGNUP:
        call printNewLine
        inc si
        loop BREAKLINE_SIGNUP
    call LoginPage
    
   mov dx, offset userName
   mov bx, dx
   mov [byte ptr bx], 9
   mov ah, 02h
   int 21h
   
    ret
endp SignUpPage

proc LoginPage
    mov ah, 0   ; set display mode function.
    mov al, 13h ; mode 13h = 320x200 pixels, 256 colors.
    int 10h     ; set it!
    mov al, 0Fh
    mov cx, -1  ;col
    mov dx, -1 ;row
    mov ah, 0ch ; put pixel

   
    loginTopBar:
    inc cx
    int 10h
    cmp cx, 640
    jne loginTopBar

    mov cx, 10  ; reset to start of col
    inc dx      ;next row
    cmp dx, 30
    jne loginTopBar

    mov al, 0h
    mov cx, 0  ;col
    mov dx, 5  ;row
    mov ah, 0ch ; put pixel


    signUpButton:
    inc cx
    int 10h
    cmp cx, 70
    jne signUpButton

    mov cx, 0  ; reset to start of col
    inc dx      ;next row
    cmp dx, 30
    jne signUpButton

    call printNewLine
    call printNewLine
    mov dx, offset SignUpMessage
    mov ah, 09h
    int 21h

    mov ax, 0h
    int 33h
    mov ax, 1h
    int 33h
    pressSignUp:
    mov ax, 3h
    int 33h
    cmp bx, 01h
    jne pressSignUp
    shr cx, 1
    sub dx, 2
    cmp cx, 60
    ja pressSignUp
    cmp dx, 5
    jb pressSignUp
    cmp dx, 30
    ja pressSignUp
    mov si, 0
    mov cx, 200
    call SignUpPage
    ret
endp LoginPage


函数“printNewLine”是一个从库Assembly-Library打印新行的过程

当我尝试将用于打印消息的代码放在导航栏之前时,它会打印橙色线条和线条。有时,它会打印许多紫色线条。

0 个答案:

没有答案