Init commit
This commit is contained in:
+316
@@ -0,0 +1,316 @@
|
||||
SECTION .text
|
||||
|
||||
global runtime.goPanicIndex
|
||||
|
||||
runtime.goPanicIndex:
|
||||
ret
|
||||
|
||||
global runtime.goPanicSliceB
|
||||
runtime.goPanicSliceB:
|
||||
ret
|
||||
|
||||
global memcmp
|
||||
extern go_0runtime.Memcmp
|
||||
|
||||
memcmp:
|
||||
call go_0runtime.Memcmp
|
||||
ret
|
||||
|
||||
global memmove
|
||||
extern go_0runtime.MemMove
|
||||
|
||||
memmove:
|
||||
call go_0runtime.MemMove
|
||||
ret
|
||||
|
||||
global runtime.memequal32..f
|
||||
extern go_0runtime.MemEqual32
|
||||
|
||||
runtime.memequal32..f:
|
||||
call go_0runtime.MemEqual32
|
||||
ret
|
||||
|
||||
global runtime.memequal8..f
|
||||
extern go_0runtime.MemEqual8
|
||||
|
||||
runtime.memequal8..f:
|
||||
call go_0runtime.MemEqual8
|
||||
ret
|
||||
|
||||
global runtime.strequal..f
|
||||
extern go_0runtime.StrEqual
|
||||
|
||||
runtime.strequal..f:
|
||||
call go_0runtime.StrEqual
|
||||
ret
|
||||
|
||||
global runtime.concatstrings
|
||||
extern go_0runtime.ConcatStrings
|
||||
|
||||
runtime.concatstrings:
|
||||
call go_0runtime.ConcatStrings
|
||||
ret
|
||||
|
||||
global runtime.slicebytetostring
|
||||
extern go_0runtime.SliceBytetoString
|
||||
|
||||
runtime.slicebytetostring:
|
||||
call go_0runtime.SliceBytetoString
|
||||
ret
|
||||
|
||||
global runtime.intstring
|
||||
extern go_0runtime.IntString
|
||||
|
||||
runtime.intstring:
|
||||
call go_0runtime.IntString
|
||||
ret
|
||||
|
||||
global runtime.stringtoslicebyte
|
||||
extern go_0runtime.StringToSliceByte
|
||||
|
||||
runtime.stringtoslicebyte:
|
||||
call go_0runtime.StringToSliceByte
|
||||
ret
|
||||
|
||||
global runtime.makeslice
|
||||
extern go_0runtime.MakeSlice
|
||||
|
||||
runtime.makeslice:
|
||||
call go_0runtime.MakeSlice
|
||||
ret
|
||||
|
||||
global malloc
|
||||
malloc:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov eax, 68
|
||||
mov ebx, 12
|
||||
mov ecx, dword [esp + 8] ; Параметр size передается через стек
|
||||
int 0x40
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
ret ; Возвращаемое значение находится в регистре EAX
|
||||
|
||||
global go.kos.Sleep
|
||||
global go.kos.Event
|
||||
global go.kos.GetButtonID
|
||||
global go.kos.CreateButton
|
||||
global go.kos.Exit
|
||||
global go.kos.Redraw
|
||||
global go.kos.Window
|
||||
global go.kos.WriteText
|
||||
global go.kos.GetTime
|
||||
global go.kos.DrawLine
|
||||
global go.kos.DrawBar
|
||||
global go.kos.DebugOutHex
|
||||
global go.kos.DebugOutChar
|
||||
global go.kos.DebugOutStr
|
||||
global go.kos.WriteText2
|
||||
|
||||
go.kos.Sleep:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov eax, 5
|
||||
mov ebx, [ebp+8]
|
||||
int 0x40
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
|
||||
go.kos.Event:
|
||||
mov eax, 10
|
||||
int 0x40
|
||||
ret
|
||||
|
||||
go.kos.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.kos.Exit:
|
||||
mov eax, -1
|
||||
int 0x40
|
||||
ret
|
||||
|
||||
go.kos.Redraw:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
mov eax, 12
|
||||
mov ebx, [ebp+8]
|
||||
int 0x40
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
go.kos.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.kos.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.kos.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.kos.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.kos.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.kos.GetTime:
|
||||
mov eax, 3
|
||||
int 0x40
|
||||
ret
|
||||
|
||||
go.kos.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.kos.DebugOutChar:
|
||||
mov al, [esp+4]
|
||||
pushf
|
||||
pushad
|
||||
mov cl, al
|
||||
mov eax, 63
|
||||
mov ebx, 1
|
||||
int 0x40
|
||||
popad
|
||||
popf
|
||||
ret
|
||||
|
||||
go.kos.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.kos.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
|
||||
|
||||
extern go_0example.Main
|
||||
global start_program
|
||||
start_program:
|
||||
mov eax, 68
|
||||
mov ebx, 11
|
||||
int 0x40
|
||||
call go_0example.Main
|
||||
|
||||
|
||||
SECTION .data
|
||||
__hexdigits:
|
||||
db '0123456789ABCDEF'
|
||||
|
||||
__test:
|
||||
dd __hexdigits
|
||||
dd 15
|
||||
Reference in New Issue
Block a user