📄 e3.h
字号:
%else%ifdef FREEBSD ;----------------------- FREE B S D ----------------------- ;sys/termios.h %define TERMIOS_SET 802c7414h ;TIOCSETA %define TERMIOS_GET 402c7413h ;TIOCGETA %define TERMIOS_WSIZE 40087468h ; rw ; size ; 't' ; nr. %define NCCS 20 %define VMIN 16 %define speed_t3 resd %define ICRNL 0x100 %define IXON 0x200 %define ICANON 0x100 %define ISIG 0x80 %define ECHO 0x8 %define TSize word ;due oversized ICANON;------ struc stat_struc.st_dev: resd 1.st_ino: resd 1.st_mode: resw 1.st_nlink: resw 1.st_uid: resd 1.st_gid: resd 1.st_rdev: resd 1.st_atime: resd 1.st_atimes: resd 1.st_mtime: resd 1.st_mtimes: resd 1.st_ctime: resd 1.st_ctimes: resd 1.st_size: resd 2.st_blocks: resd 2.st_blksize: resd 1.st_flags: resd 1.st_gen: resd 1.st_spare: resd 5 endstruc%define SYS_exit 1%define SYS_fork 2%define SYS_read 3%define SYS_write 4%define SYS_open 5%define SYS_close 6%define SYS_unlink 10%define SYS_execve 59%define SYS_lseek 19 ;also 199%define SYS_utime 138%define SYS_kill 37%define SYS_rename 128%define SYS_pipe 42%define SYS_ioctl 54%define SYS_dup2 90%define SYS_sigaction 46 ;also 342%define SYS_readlink 58%define SYS_fchown 123%define SYS_fstat 189%define SYS_wait4 7%define SYS_select 93%define time_t resd struc utimbuf_struc.actime: time_t 2.modtime:time_t 2 endstruc %undef CAPTURE_STDERR ;******is buggy in e3/BSD******%ifdef EX %define USE_EX_NO_SED %define EX_PATH '/usr/bin/ex' ;(ex is usually a symlink to vi) [ old was /bin/ex ]%else %undef USE_EX_NO_SED %ifndef PERLPIPE %define SEDPATH '/usr/bin/sed' ;DEFAULT %else %define SEDPATH '/usr/bin/perl' %endif%endifMAXERRNO equ 32ERRNOMEM equ 12ERRNOIO equ 5ERRNOEXEC equ 31ERRNOREGFILE equ 21 %macro errortext 0db "Op not permitted",10 ;1db "No such file|directory",10 ;2db 10 ;3db 10 ;4db "Input/output",10 ;5db "No such device",10 ;6db 10 ;7db 10 ;8db "Bad file descriptor",10 ;9db "No child processes",10 ;10db 10 ;11 db "Memory exhausted",10 ;12db "Permission denied",10 ;13db 10 ;14db 10 ;15db "Device busy",10 ;16db "File exists",10 ;17db 10 ;18db "No such device",10 ;19db 10 ;20db "Is a directory",10 ;21db "Invalid argument",10 ;22db "Too many open files",10 ;23db "Too many open files",10 ;24db "Inappropriate ioctl",10 ;25db "Text file busy",10 ;26db "File too large",10 ;27db "No space on device",10 ;28db "Illegal seek",10 ;29db "R/O file system",10 ;30db "Can't exec " ;31%ifdef USE_EX_NO_SEDdb EX_PATH,10%elsedb SEDPATH,10%endifdb "Broken pipe",10 ;32 %endmacro%ifdef LIBC extern open,read,write,close,lseek,rename,_exit,ioctl,fstat,fchown,select,unlink extern errno %undef SYS_readlink %undef SYS_brk %undef SYS_kill %undef SYS_sigaction %undef USE_PIPE%endif%else%ifdef W32 ;----------------------- W I N 32 -----------------------%define W32LF ;<-- controls linefeed styleSTD_INPUT_HANDLE equ -10STD_OUTPUT_HANDLE equ -11ENABLE_WINDOW_INPUT equ 8FILE_ATTRIBUTE_NORMAL equ 128OPEN_EXISTING equ 3CREATE_ALWAYS equ 2GENERIC_READ equ $80000000GENERIC_WRITE equ $40000000INVALID_HANDLE_VALUE equ -1FOREGROUND_BLUE equ 1FOREGROUND_GREEN equ 2FOREGROUND_RED equ 4FOREGROUND_INTENSITY equ 8DARKWHITE equ (FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_RED)WHITE equ (DARKWHITE|FOREGROUND_INTENSITY)BACKGROUND_BLUE equ 16YELLOW_BLUE equ FOREGROUND_GREEN|FOREGROUND_RED|FOREGROUND_INTENSITY|BACKGROUND_BLUEYELLOW_BLUE_TWICE equ YELLOW_BLUE| (YELLOW_BLUE<<16)LEFT_ALT_PRESSED equ 2CTRL_PRESSED equ 12VK_SPACE equ 0x0020VK_PRIOR equ 0x0021VK_DELETE equ 0x002ECF_OEMTEXT equ 7extern MessageBoxA,MessageBeep,ExitProcessextern GetStdHandle,GetCommandLineA,GetLastError,SetConsoleTextAttributeextern SetConsoleMode,GetConsoleScreenBufferInfo,SetConsoleCursorPositionextern WriteFile,ReadFile,CreateFileA,CloseHandle,SetFilePointer,MoveFileA,DeleteFileAextern FillConsoleOutputAttribute,WaitForSingleObject,ReadConsoleA,ReadConsoleInputAextern FlushConsoleInputBuffer,WriteConsoleOutputCharacterA,WriteConsoleOutputAttributeextern HeapCreate,HeapAlloc,HeapFree,HeapDestroy,OpenClipboard,EmptyClipboardextern SetClipboardData,GetClipboardData,IsClipboardFormatAvailable,CloseClipboard %define W32_EXTENDED_IO %undef USE_PIPEMAXERRNO equ 32ERRNOMEM equ 8ERRNOIO equ 7 %macro errortext 0db "invalid function",10 ;1db "file not found",10 ;2db "path not found",10 ;3db "too many open files",10 ;4db "access denied",10 ;5db "invalid handle",10 ;6db "I/O error",10 ;7db "not enough memory",10 ;8db 10 ;9db 10 ;10db 10 ;11db 10 ;12db 10 ;13db 10 ;14db 10 ;15db 10 ;16db 10 ;17db 10 ;18db 10 ;19db 10 ;20db 10 ;21db 10 ;22db 10 ;23db 10 ;24db 10 ;25db 10 ;26db 10 ;27db 10 ;28db 10 ;29db 10 ;30db 10 ;31db "sharing violation",10 ;32 %endmacro%else ;----------------------- END OS -----------------------%error no OS defined%endif%endif%endif%endif%endif%endif%ifdef TERMIOS_SET%ifdef ARMCPU struc termios_struc.c_iflag: resd 1.c_oflag: resd 1.c_cflag: resd 1.c_lflag: resd 1.c_line: resb 1.c_cc: resb NCCS endstruc%else%define tcflag_t resd%define cc_t resb struc termios_struc.c_iflag: tcflag_t 1.c_oflag: tcflag_t 1.c_cflag: tcflag_t 1.c_lflag: tcflag_t 1.c_line: cc_t 1%ifdef speed_t1c_ixxxxx: speed_t1 1c_oxxxxx: speed_t1 1%endif.c_cc: cc_t NCCS%ifdef speed_t2res: resd 3c_ixxxxx: speed_t2 1c_oxxxxx: speed_t2 1%endif%ifdef speed_t3c_ispeed speed_t3 1c_ospeed speed_t3 1%endif endstruc%endif struc winsize_struc.ws_row:resw 1.ws_col:resw 1.ws_xpixel:resw 1.ws_ypixel:resw 1 endstruc%ifndef IXON ;all except *BSD%define ICRNL 0000400q%define IXON 0002000q%define ICANON 0000002q%define ISIG 0000001q%define ECHO 0000010q%define TSize byte%endif%endif;-------%ifndef LINUX %undef CRIPLED_ELF%endif;%ifdef LESSWRITEOPS ;constraints %define LESSWRITEOPS_OR_CURSORMGNT%endif%ifdef CURSORMGNT %define LESSWRITEOPS_OR_CURSORMGNT%endifstdtxtlen equ 10 ;do not move this to EOF: code size would increase%ifdef FREEBSDSIGCONT equ 19SIGSTOP equ 17O_WRONLY_CREAT_TRUNC equ 601h ;see fcntl.h%else%ifdef QNXO_WRONLY_CREAT_TRUNC equ 1401q%elseO_WRONLY_CREAT_TRUNC equ 1101q%endif%endifO_RDONLY equ 0PERMS equ 644qstdin equ 0stdout equ 1optslen equ 124TAB equ 8TABCHAR equ 09hSPACECHAR equ ' 'CHANGED equ '*'UNCHANGED equ SPACECHARLINEFEED equ 0ahNEWLINE equ LINEFEEDRETURN equ 0dhSEDBLOCK equ 4096;--------------------------------------------------------------------------%ifdef CRIPLED_ELF;; building e3 via "nasm -f bin ...." using an idea from;"A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux"; %macro ELFheader 0ehdr: db 0x7F, "ELF", 1, 1, 1, 0 ;Elf32_Ehdr starts here dd 0,0 dw 2 ;e_type dw 3 ;e_machine dd 1 ;e_version dd _start ;e_entry dd phdr1- $$ ;e_phoff dd 0 ;e_shoff dd 0 ;e_flags dw ehdrsize ;e_ehsize dw phdrsize ;e_phentsize dw 2 ;e_phnumphdr1: ;Elf32_Phdr starts here dd 1 ;both p_type and e_shentsize,e_shnum dw 0 ;both p_offset and e_shstrndxehdrsize equ $ - ehdr dw 0 dd $$ ;p_vaddr dd $$ ;p_paddr dd filesize ;p_filesz dd filesize ;p_memsz dd 5 ;p_flags i.e. READ/EXECUTE dd 0; 0x1000 ;p_alignphdrsize equ $ - phdr1phdr2: ;another Elf32_Phdr starts here dd 1 ;p_type dd filesize dd $$+filesize dd $$+filesize dd 0 ;p_filesz dd bsssize ;p_memsz dd 6 ;p_flags i.e. READ/WRITE dd 0; 0x1000 ;p_align %endmacro%endif;-------%ifndef ARMCPU %macro ORGheader 0%ifdef USE_SPECIAL_HEADER%ifdef TINLINK org 0x800004A ;see file contrib/README.tinlink624%else org 0x8048000 ELFheader%endif%else ;nothing%endif %endmacro%endif;-------%ifdef DYN ;DYN == "libc dynamic linked" %define _start main ;call it "main", libc startup code expects this name%endif;--------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -