📄 exec_library.asm
字号:
%include "macro.inc"%include "orzmicro.inc"%include "floppy_device.inc"%include "fat12_handler.inc"%include "exec_library.inc"%define R_BLOCK_SIZE 512 db "ORZEXE.0" ; Executable file revision 0 id dd 0x1000 ; Stack size dd _DATA_LEN ; Data size[ORG -0x10][BITS 32] mov esi,floppy_name mov ecx,floppy_len call Find mov [floppyID],eax mov esi,fat12_name mov ecx,fat12_len call Find mov [fat12_ID],eax ;;;; mov ebx,[floppyID] mov eax,dev_Open xor ecx,ecx xor edx,edx int i_SendMessageW mov [floppyDevID],eax ;;;; mov eax,[floppyID] mov [msg+shndl_Init.devTaskID],eax mov eax,[floppyDevID] mov [msg+shndl_Init.deviceID],eax mov ebx,[fat12_ID] mov eax,hndl_Init mov esi,msg mov ecx,shndl_Init.msize xor edx,edx int i_SendMessageW mov [handlerID],eax ;;;;Start: mov edi,msg_in mov edx,msg_in_len int i_GetMessage jnz Process xor ebx,ebx xor ecx,ecx xor edx,edx mov eax,msg_Sleep int i_SendMessageW jmp StartProcess: cmp eax,exec_RunProgramm jnz Process0 jmp RunProgrammProcess0:Ok: xor eax,eaxErr: xor ecx,ecx int i_ProcessMessage jmp Start;-------------------------------------------------------------------------RunProgramm: push ecx mov ecx,0x100 mov esi,msg_in+sexec_RunProgramm.fileName mov edi,msg+shndl_FileName.fileName rep movsb mov eax,[handlerID] mov [msg+shndl_FileName.handlerID],eax mov ebx,[fat12_ID] mov eax,hndl_ReadFile mov esi,msg pop ecx add ecx,4 xor edx,edx int i_SendMessageW cmp eax,0xFFFF0000 jc RunProgramm2 jmp ErrRunProgramm2: mov [msg+shndl_Read.fileID],eax mov [msg+shndl_Read.blockSize],DWORD R_BLOCK_SIZE ;;;; mov edi,buffer+krnl_CreateTask.stackSize-8 xor edx,edxRunProgramm0: push edi,edx mov ebx,[fat12_ID] mov eax,hndl_Read mov esi,msg mov ecx,shndl_Read.msize mov edx,R_BLOCK_SIZE int i_SendMessageW pop edx,edi add edx,ecx cmp ecx,R_BLOCK_SIZE jc RunProgramm1 add edi,R_BLOCK_SIZE jmp short RunProgramm0RunProgramm1: mov ecx,MAX_TASK_NAME+1 mov esi,msg_in+sexec_RunProgramm.taskName mov edi,buffer+krnl_CreateTask.taskName rep movsb xor ebx,ebx mov eax,msg_CreateTask mov esi,buffer mov ecx,edx add ecx,krnl_CreateTask.msize-0x10 xor edx,edx int i_SendMessageW mov ebx,[fat12_ID] mov eax,hndl_CloseFile mov esi,msg mov ecx,shndl_FileHandler.msize xor edx,edx int i_SendMessageW jmp Ok;-------------------------------------------------------------------------floppyID dd 0floppy_name db "floppy.device"floppy_len equ $-floppy_namefat12_ID dd 0fat12_name db "fat12.handler"fat12_len equ $-fat12_namefloppyDevID dd 0handlerID dd 0;---------------------------------------------------------------Find: xor ebx,ebx xor edx,edx mov eax,msg_FindTaskByName int i_SendMessageW jnc Find0 jmp BigErrorFind0: ret;;;;Sleep: xor ebx,ebx mov eax,msg_Sleep xor ecx,ecx xor edx,edx int i_SendMessageW ret;;;;BigError: mov ax,0xFAC0 mov ds,ax%include "console_library.inc"%include "debug.inc";---------------------------------------------------------------;;;; DATA;---------------------------------------------------------------_DATA_START equ $msg_in equ _DATA_STARTmsg_in_len equ 0x200_end_msg_in equ msg_in+msg_in_lenmsg equ _end_msg_inmsg_len equ 0x100_end_msg equ msg+msg_lenbuffer equ _end_msgbuffer_len equ 32768_end_buffer equ buffer+buffer_len_DATA_LEN equ _end_buffer-_DATA_START
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -