kolibrios/programs/develop/golang/syscalls.s
pavelyakov 1979e6ff29 fixed linker and syscall
git-svn-id: svn://kolibrios.org@9053 a494cfbc-eb01-0410-851d-a64ba20cac60
2021-07-12 12:28:41 +00:00

214 lines
3.0 KiB
ArmAsm
Executable File

SECTION .text
global go.os.Sleep
global go.os.Event
global go.os.GetButtonID
global go.os.CreateButton
global go.os.Exit
global go.os.Redraw
global go.os.Window
global go.os.WriteText
global go.os.GetTime
global go.os.DrawLine
global go.os.DrawBar
global go.os.DebugOutHex
global go.os.DebugOutChar
global go.os.DebugOutStr
global go.os.WriteText2
go.os.Sleep:
push ebp
mov ebp,esp
mov eax, 5
mov ebx, [ebp+8]
int 0x40
mov esp,ebp
pop ebp
ret
go.os.Event:
mov eax, 10
int 0x40
ret
go.os.GetButtonID:
mov eax,17
int 0x40
test al,al
jnz .no_button
shr eax,8
ret
.no_button:
xor eax,eax
dec eax
ret
go.os.Exit:
mov eax, -1
int 0x40
ret
go.os.Redraw:
push ebp
mov ebp,esp
mov eax, 12
mov ebx, [ebp+8]
int 0x40
mov esp,ebp
pop ebp
ret
go.os.Window:
push ebp
mov ebp,esp
mov ebx, [ebp+8]
shl ebx, 16
or ebx, [ebp+16]
mov ecx, [ebp+12]
shl ecx, 16
or ecx, [ebp+20]
mov edx, 0x14
shl edx, 24
or edx, 0xFFFFFF
mov esi, 0x808899ff
mov edi, [ebp+24]
xor eax, eax
int 0x40
mov esp,ebp
pop ebp
ret
go.os.WriteText:
push ebp
mov ebp,esp
mov eax,4
mov ebx,[ebp+8]
shl ebx,16
mov bx,[ebp+12]
mov ecx,[ebp+16]
mov edx,[ebp+20]
mov esi,[ebp+24]
int 0x40
mov esp,ebp
pop ebp
ret
go.os.WriteText2:
push ebp
mov ebp,esp
mov eax,47
mov ebx,[ebp+8]
shl ebx,16
mov ecx,[ebp+12]
mov edx,[ebp+20]
shl edx,16
add edx, [ebp+24]
mov esi,[ebp+28]
int 0x40
mov esp,ebp
pop ebp
ret
go.os.DrawLine:
push ebp
mov ebp,esp
mov ebx,[ebp+8]
shl ebx,16
mov bx,[ebp+16]
mov ecx,[ebp+12]
shl ecx,16
mov cx,[ebp+20]
mov edx,[ebp+24]
mov eax,38
int 0x40
mov esp,ebp
pop ebp
ret
go.os.DrawBar:
push ebp
mov ebp,esp
mov eax,13
mov ebx,[ebp+8]
shl ebx,16
mov bx,[ebp+16]
mov ecx,[ebp+12]
shl ecx,16
mov cx,[ebp+20]
mov edx,[ebp+24]
int 0x40
mov esp,ebp
pop ebp
ret
go.os.GetTime:
mov eax, 3
int 0x40
ret
go.os.DebugOutHex:
mov eax, [esp+4]
mov edx, 8
.new_char:
rol eax, 4
movzx ecx, al
and cl, 0x0f
mov cl, [__hexdigits + ecx]
pushad
mov eax, 63
mov ebx, 1
int 0x40
popad
dec edx
jnz .new_char
ret
go.os.DebugOutChar:
mov al, [esp+4]
pushf
pushad
mov cl,al
mov eax,63
mov ebx,1
int 0x40
popad
popf
ret
go.os.DebugOutStr:
mov edx,[esp+4]
mov eax,63
mov ebx,1
m2:
mov cl, [edx]
test cl,cl
jz m1
int 40h
inc edx
jmp m2
m1:
ret
go.os.CreateButton:
push ebp
mov ebp,esp
mov eax, 8
mov ebx, [ebp+8]
shl ebx, 16
mov bx, [ebp+16]
mov ecx, [ebp+12]
shl ecx, 16
mov cx, [ebp+20]
mov edx, [ebp+24]
mov esi, [ebp+28]
int 0x40
mov esp,ebp
pop ebp
ret
SECTION .data
__hexdigits:
db '0123456789ABCDEF'