Function at 0x402fe0
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
and esp, 0xfffffff0
sub esp, 0x450
call dbg.__main
mov eax, dword [ebp + 0xc]
mov dword [esp + 4], 0x4080bc
mov eax, dword [eax + 4]
mov dword [esp], eax
call sub.msvcrt.dll_fopen
mov dword [esp + 8], 2
mov dword [esp + 4], 0
mov ebx, eax
mov dword [esp], eax
call sub.msvcrt.dll_fseek
mov dword [esp], ebx
call sub.msvcrt.dll_ftell
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov esi, eax
mov dword [esp], ebx
mov dword [esp + 0x30], eax
call sub.msvcrt.dll_fseek
mov dword [esp], esi
mov dword [esp + 0x1c], esi
call sym._malloc
mov dword [esp + 0xc], ebx
mov dword [esp + 8], esi
mov dword [esp + 4], 1
mov dword [esp], eax
mov dword [esp + 0x24], eax
call sub.msvcrt.dll_fread
mov dword [esp], ebx
call sub.msvcrt.dll_fclose
cmp dword [ebp + 8], 2
jle 0x403702
mov dword [esp + 0x38], 0
xor ebx, ebx
mov edi, 2
mov word [esp + 0x2e], bx
mov ebx, edi
lea esi, [esi]
mov edi, dword [ebp + 0xc]
movzx eax, bl
mov eax, dword [edi + eax*4]
lea edi, [ebx + 1]
mov edx, edi
cmp byte [eax], 0x2d
movzx esi, dl
jne 0x403538
movzx eax, byte [eax + 1]
sub eax, 0x61
cmp al, 0x12
ja case.0x4030c8.1
movzx eax, al
jmp dword [eax*4 + 0x408168]
mov ebx, edi
cmp dword [ebp + 8], esi
jg 0x4030a0
mov ecx, dword [esp + 0x38]
test ecx, ecx
je 0x403709
cmp byte [0x40d020], 0
je 0x40369f
movzx eax, word [esp + 0x2e]
mov edi, dword [esp + 0x38]
mov dword [esp + 0x3c], eax
lea esi, [esi]
movzx esi, word [edi]
mov edx, edi
mov edi, dword [edi + 4]
mov ebx, esi
mov ecx, esi
shr bx, 3
and ecx, 7
movzx eax, bx
mov ebx, 1
mov dword [esp + 0x34], eax
movzx eax, byte [eax + 0x40b020]
shl ebx, cl
mov byte [esp + 0x2e], bl
test al, bl
mov byte [esp + 0x38], al
jne 0x403528
mov eax, dword [esp + 0x24]
mov dword [esp], edx
mov ecx, esi
sub ecx, dword [esp + 0x3c]
lea ebx, [eax + ecx]
mov dword [esp + 0x28], ecx
mov dword [esp + 0x20], ebx
call sym._free
test edi, edi
mov ecx, dword [esp + 0x28]
movzx eax, byte [esp + 0x38]
je 0x4035c8
test ebx, ebx
je 0x403100
mov ebx, dword [esp + 0x34]
cmp dword [esp + 0x30], ecx
jb 0x403330
cmp esi, dword [esp + 0x3c]
jb 0x403330
mov dword [esp + 0x38], edi
movzx edx, byte [esp + 0x2e]
mov edi, dword [esp + 0x20]
nop
or edx, eax
mov eax, edi
mov byte [ebx + 0x40b020], dl
lea edx, [esp + 0x48]
call sym._z80_decode
movzx ecx, byte [esp + 0x48]
mov edx, eax
sub edx, edi
add esi, edx
lea edx, [ecx - 0x2e]
cmp dl, 0xb
ja case.0x4031bd.4
movzx edx, dl
jmp dword [edx*4 + 0x4081b4]
cmp dword [ebp + 8], esi
jle 0x403743
mov eax, dword [ebp + 0xc]
mov dword [esp + 8], 0x10
add ebx, 2
mov dword [esp + 4], 0
mov eax, dword [eax + esi*4]
movzx esi, bl
mov dword [esp], eax
call sub.msvcrt.dll_strtol
mov word [esp + 0x2e], ax
jmp 0x4030d2
mov byte [0x40d020], 1
mov ebx, edi
jmp 0x4030d2
mov byte [0x40d022], 1
mov ebx, edi
jmp 0x4030d2
cmp dword [ebp + 8], esi
jle 0x4037ab
mov eax, dword [ebp + 0xc]
mov dword [esp + 4], 0x4080e3
lea esi, [eax + esi*4]
mov eax, dword [esi]
mov dword [esp], eax
call sub.msvcrt.dll_fopen
mov edi, eax
test eax, eax
je 0x40377c
lea esi, [esp + 0x50]
jmp 0x403263
cmp byte [esp + 0x50], 0
jne 0x4035e0
mov dword [esp + 8], edi
mov dword [esp + 4], 0x400
mov dword [esp], esi
call sub.msvcrt.dll_fgets
test eax, eax
jne 0x403258
mov dword [esp], edi
add ebx, 2
movzx esi, bl
call sub.msvcrt.dll_fclose
jmp 0x4030d2
mov byte [0x40d021], 1
mov ebx, edi
jmp 0x4030d2
movzx edi, word [esp + 0x4c]
mov edx, edi
mov ecx, edi
mov ebx, 1
mov word [esp + 0x34], di
and ecx, 7
shr dx, 3
mov edi, eax
shl ebx, cl
movzx edx, dx
or byte [edx + 0x409020], bl
mov ecx, ebx
mov ebx, esi
sub ebx, dword [esp + 0x3c]
test byte [edx + 0x40b020], cl
jne 0x4032f6
mov dword [esp], 8
call sym._malloc
movzx edx, word [esp + 0x34]
mov word [eax], dx
mov edx, dword [esp + 0x38]
mov dword [eax + 4], edx
mov dword [esp + 0x38], eax
cmp dword [esp + 0x30], ebx
jb 0x403326
mov ebx, esi
mov ecx, esi
mov edx, 1
shr bx, 3
and ecx, 7
movzx ebx, bx
shl edx, cl
movzx eax, byte [ebx + 0x40b020]
test al, dl
jne 0x403326
cmp esi, dword [esp + 0x3c]
jae 0x403190
mov edi, dword [esp + 0x38]
lea esi, [esi]
test edi, edi
jne 0x403100
cmp byte [0x40d022], 0
je 0x4033b0
cmp dword [esp + 0x30], 0xffff
mov esi, dword [esp + 0x1c]
mov ebx, 1
jbe 0x40336b
jmp 0x4033a4
add esi, 1
cmp esi, 0x10000
je 0x4033a4
mov eax, esi
mov ecx, esi
mov edx, ebx
shr ax, 3
and ecx, 7
movzx eax, ax
shl edx, cl
test byte [eax + 0x409020], dl
je 0x403360
mov dword [esp + 8], esi
mov dword [esp + 4], esi
add esi, 1
mov dword [esp], str.ADR__X_equ___X_n
call sym._printf
cmp esi, 0x10000
jne 0x40336b
mov dword [esp], 0x408002
call sym._puts
mov esi, dword [esp + 0x3c]
mov eax, dword [esp + 0x30]
mov edx, 0x10000
add eax, esi
mov ebx, esi
cmp eax, 0x10000
cmovbe edx, eax
mov dword [esp + 0x38], edx
cmp edx, esi
ja 0x4033ed
jmp 0x40347f
add ebx, 1
cmp dword [esp + 0x38], ebx
je 0x40347f
mov esi, ebx
mov ecx, ebx
mov edi, 1
shr si, 3
and ecx, 7
shl edi, cl
movzx esi, si
mov eax, edi
test byte [esi + 0x40b020], al
je 0x4033e0
mov eax, dword [esp + 0x24]
sub eax, dword [esp + 0x3c]
lea edx, [esp + 0x48]
add eax, ebx
call sym._z80_decode
cmp byte [0x40d022], 0
je 0x403660
lea edx, [esp + 0x50]
mov ecx, ebx
lea eax, [esp + 0x48]
mov dword [esp + 0x34], edx
call sym._z80_disasm
mov eax, edi
test byte [esi + 0x409020], al
mov edx, dword [esp + 0x34]
jne 0x4036e9
cmp byte [0x40d021], 0
je 0x40368a
mov dword [esp + 8], ebx
add ebx, 1
mov dword [esp + 4], edx
mov dword [esp], str._t_s_t__X_n
call sym._printf
cmp dword [esp + 0x38], ebx
jne 0x4033ed
lea esp, [ebp - 0xc]
xor eax, eax
pop ebx
pop esi
pop edi
pop ebp
ret
lea edx, [ecx - 0x37]
cmp dl, 1
jbe 0x4035b8
cmp cl, 0x35
je 0x4035b8
cmp cl, 0x1c
je 0x4035a6
nop
mov ebx, esi
mov edi, eax
sub ebx, dword [esp + 0x3c]
jmp 0x4032f6
movzx esi, word [esp + 0x4c]
mov edx, 1
mov eax, esi
mov ecx, esi
mov ebx, esi
sub ebx, dword [esp + 0x3c]
shr ax, 3
and ecx, 7
movzx eax, ax
shl edx, cl
or byte [eax + 0x409020], dl
mov eax, dword [esp + 0x24]
lea edi, [eax + ebx]
jmp 0x4032f6
movzx edi, word [esp + 0x4c]
add edi, esi
jmp 0x4032a5
movzx eax, word [esp + 0x4c]
add esi, eax
mov eax, dword [esp + 0x24]
mov ebx, esi
sub ebx, dword [esp + 0x3c]
lea edi, [eax + ebx]
jmp 0x4032f6
mov dword [esp], edx
call sym._free
jmp 0x403330
mov dword [esp + 8], 0x10
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.msvcrt.dll_strtol
mov ebx, eax
mov ecx, eax
mov dword [esp + 0x3c], eax
mov eax, 1
and ecx, 7
shr bx, 3
shl eax, cl
movzx ebx, bx
mov ecx, eax
test byte [ebx + 0x40b020], al
jne 0x403599
mov dword [esp], 8
mov dword [esp + 0x34], eax
call sym._malloc
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x34]
mov word [eax], dx
mov edx, dword [esp + 0x38]
mov dword [esp + 0x38], eax
mov dword [eax + 4], edx
or byte [ebx + 0x409020], cl
mov ebx, edi
jmp 0x4030d2
cmp word [esp + 0x4c], 0x2a
jne 0x4034b0
lea esi, [esi]
mov esi, dword [esp + 0x30]
add esi, 1
jmp 0x4034b0
mov edx, dword [esp + 0x20]
mov ebx, dword [esp + 0x34]
test edx, edx
jne 0x40316e
jmp 0x403338
mov dword [esp + 8], 0x10
mov dword [esp + 4], 0
mov dword [esp], esi
call sub.msvcrt.dll_strtol
test ax, ax
je 0x403263
mov ecx, eax
mov dword [esp + 0x28], eax
shr cx, 3
movzx edx, cx
mov ecx, eax
mov eax, 1
and ecx, 7
mov dword [esp + 0x3c], edx
shl eax, cl
mov ecx, eax
test byte [edx + 0x40b020], al
jne 0x40364e
mov dword [esp], 8
mov dword [esp + 0x34], eax
call sym._malloc
mov edx, dword [esp + 0x28]
mov ecx, dword [esp + 0x34]
mov word [eax], dx
mov edx, dword [esp + 0x38]
mov dword [esp + 0x38], eax
mov dword [eax + 4], edx
mov eax, dword [esp + 0x3c]
or byte [eax + 0x409020], cl
jmp 0x403263
lea esi, [esp + 0x50]
mov ecx, ebx
lea eax, [esp + 0x48]
mov edx, esi
call sym._z80_disasm
mov dword [esp + 8], esi
mov dword [esp + 4], ebx
mov dword [esp], str._X:__s_n
call sym._printf
jmp 0x4033e0
mov dword [esp + 4], edx
mov dword [esp], str._t_s_n
call sym._printf
jmp 0x4033e0
movzx eax, word [esp + 0x2e]
mov edx, eax
mov ecx, eax
mov eax, 1
shr dx, 3
and ecx, 7
movzx edx, dx
shl eax, cl
test byte [edx + 0x40b020], al
jne 0x4030f0
mov dword [esp], 8
call sym._malloc
movzx esi, word [esp + 0x2e]
mov word [eax], si
mov esi, dword [esp + 0x38]
mov dword [esp + 0x38], eax
mov dword [eax + 4], esi
jmp 0x4030f0
mov dword [esp + 4], ebx
mov dword [esp], str.ADR__X:_n
call sym._printf
mov edx, dword [esp + 0x34]
jmp 0x403451
mov word [esp + 0x2e], 0
movzx eax, word [esp + 0x2e]
mov edx, eax
mov ecx, eax
mov eax, 1
shr dx, 3
and ecx, 7
movzx edx, dx
shl eax, cl
test byte [edx + 0x40b020], al
jne 0x403735
mov dword [esp + 0x38], 0
jmp 0x4036c5
movzx eax, word [esp + 0x2e]
mov dword [esp + 0x3c], eax
jmp 0x403338
mov dword [esp], 2
call dword [0x407438]
mov dword [esp + 8], 0x2d
mov dword [esp + 0xc], eax
mov dword [esp + 4], 1
mov dword [esp], str._s_must_be_followed_by_a_start_offset_in_hex_n
call sym._fwrite
mov dword [esp], 1
call sym._exit
mov ebx, dword [esi]
mov dword [esp], 2
call dword [0x407438]
mov dword [esp + 4], str.Failed_to_open__s_for_reading_n
mov dword [esp + 8], ebx
mov dword [esp], eax
call sym._fprintf
mov dword [esp], 1
call sym._exit
mov dword [esp], 2
call dword [0x407438]
mov dword [esp + 8], 0x22
mov dword [esp + 0xc], eax
mov dword [esp + 4], 1
mov dword [esp], str._f_must_be_followed_by_a_filename_n
call sym._fwrite
mov dword [esp], 1
call sym._exit
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop