-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen.asm
62 lines (53 loc) · 959 Bytes
/
screen.asm
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
init_screen:
mov edx, m_screen_size
mov eax, 1
mov ecx, 0
.L0:
inc eax
dec edx
je .L2
.L1:
cmp eax, m_screen_w
je .L3
inc ecx
inc eax
dec edx
jne .L1
.L2:
ret
.L3:
add ecx, 2
movsx rax, ecx
mov BYTE[rdi+rax], 0xa; '\n'
mov eax, 0
jmp .L0
print_screen:
mov rax, rdi
add rdi, m_screen_size * 4
mov ecx, 1
mov edx, 0
.L0:
cmp DWORD[rax], 0
jne .L1
movsx r8, edx
mov BYTE[rsi+r8], 0x20 ; ' '
jmp .L2
.L1:
movsx r8, edx
mov BYTE[rsi+r8], 0xb1 ; '▒'
.L2:
cmp ecx, m_screen_w
jne .L3
inc edx
mov ecx, 0
.L3:
inc edx
inc ecx
add rax, 4
cmp rax, rdi
jne .L0
mov eax, sys_write
mov edi, 1
mov edx, m_screen_size + m_screen_h
syscall
ret