projects
/
ld45_start_nothing
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
foo
[ld45_start_nothing]
/
src
/
dbglog.asm
1
; vi:filetype=nasm ts=8 sts=8 sw=8:
2
section .text
3
4
; expects the address of a zero-terminated string in esi
5
global dbglog_str
6
dbglog_str:
7
mov al, [esi]
8
cmp al, 0
9
jz .end
10
inc esi
11
call ser_putchar
12
jmp dbglog_str
13
.end: ret
14
15
global dbglog_str_num
16
dbglog_str_num:
17
pusha
18
call dbglog_str
19
mov eax, [esp + 28] ; eax pushed by pusha
20
21
mov esi, numbuf + 16
22
mov byte [esi], 0
23
mov ebx, 10
24
.convloop:
25
xor edx, edx
26
div ebx
27
add dl, '0'
28
dec esi
29
mov [esi], dl
30
cmp eax, 0
31
jnz .convloop
32
33
call dbglog_str
34
popa
35
ret
36
37
38
UART_DATA equ 3f8h
39
UART_LSTAT equ 3fdh
40
LST_TREG_EMPTY equ 20h
41
42
ser_putchar:
43
push edx
44
cmp al, 10
45
jnz .notlf
46
push eax
47
mov al, 13
48
call ser_putchar
49
pop eax
50
51
.notlf: mov ah, al
52
; wait until the transmit register is empty
53
mov dx, UART_LSTAT
54
.wait: in al, dx
55
and al, LST_TREG_EMPTY
56
jz .wait
57
mov dx, UART_DATA
58
mov al, ah
59
out dx, al
60
61
pop edx
62
ret
63
64
65
66
section .data
67
numbuf: times 16 db 0