summary refs log tree commit diff stats
path: root/src/border.asm
blob: 12774b697c56050ff369efbe67367a8eaa05c742 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
section .text
    extern height
    extern width
    extern write_byte
    global draw_border

draw_upper_lower_line:
    push rbx

    mov rax, '+'
    call write_byte

    mov bl, byte [width]
_01:mov rax, '-'
    call write_byte
    dec bl
    cmp bl, 0
    jnz _01

    mov rax, '+'
    call write_byte

    mov rax, 10 ;newline
    call write_byte

    pop rbx
    ret

draw_left_right_lines:
    push rbx

    mov rax, '|'
    call write_byte

    mov bl, byte [width]
_02:mov rax, 32 ;space
    call write_byte
    dec bl
    cmp bl, 0
    jnz _02

    mov rax, '|'
    call write_byte

    mov rax, 10 ;newline
    call write_byte
     
    pop rbx
    ret

draw_border:
    push rbx

    call draw_upper_lower_line
    mov bl, byte [height]
_03:call draw_left_right_lines
    dec bl
    cmp bl, 0
    jnz _03

    call draw_upper_lower_line

    pop rbx
    ret