summary refs log tree commit diff stats
path: root/src/border.asm
diff options
context:
space:
mode:
authorChristian Krinitsin <code@krinitsin.xyz>2024-11-21 11:14:01 +0100
committerChristian Krinitsin <code@krinitsin.xyz>2024-11-21 11:14:01 +0100
commitb1ae885a7e701f69a8b18c2e3012329733c8e57c (patch)
tree6e576ecbfa4a9266106870c8d39fca65f119fd92 /src/border.asm
parent0532d16d65c09494ff21b7e1a9cd3005058be8fc (diff)
downloadx86_64-Snake-b1ae885a7e701f69a8b18c2e3012329733c8e57c.tar.gz
x86_64-Snake-b1ae885a7e701f69a8b18c2e3012329733c8e57c.zip
move into src/ and provide shell files to set the right input properties
Diffstat (limited to 'src/border.asm')
-rw-r--r--src/border.asm64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/border.asm b/src/border.asm
new file mode 100644
index 0000000..12774b6
--- /dev/null
+++ b/src/border.asm
@@ -0,0 +1,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