Linux, MX, Assembly, AT & At Syntax environment of my programming environment .section .data .section .bss .lcomm buffer, 1. Text .gobal_start_start: movl% esp,% ebp subl $ 8,% esp # 8 (% ebp) is 2 rg == input # 12 (% ebp) third rg == output # open, read, open, write, $ 5 ,% AX MLL, 8% (EBP),% EBX MLL $ 0,% XX MLL $ 0666,% ADX Intex $ 0 x 80 #% Ax Input FD # MOLL First Local VRL MLL AX, -4 (% EBP) Movl $ 5,% eax movl 12 (% ebp),% ebx movl $ 03101,% ecx movl $ 0666,% edx int $ 0x80 # FD of output in AX # Second local square in MOVL movl% eax, -8 (% Ebp loop: 1 byte to file Type # $ 3,% eax movl-4 (% ebp),% ex movl $ buffer,% ecx movl $ 1,% edx int $ 0x80 #buffer, 1 byte of file in cmpb $ 0, buffer program_exchange custom buffer call convert #will return% al addl changes to $ 4, write% esp movb% al, buffer # 1 byte buffer $ 1,% edx movl $ buffer,% ecx movl -8 (% ebp),% ebx movl $ 4,% eax int $ 0x80 jmp loop program_exit: movl buffer,% ebx movl $ 1,% eax int $ 0x80 buffer cmpb $ 'a',% al jl convert_and% s data in cmpb $ 'jade',% abop mobb 8 (% EBP) AlJG Convert_and Edib $ 32,% in Al #Convert_and Vert: movl% ebp,% esp popl% ebp ret
Note that < Code> read (2) return 0 indicates the end of the file. You are trying to find the end of the file by looking for an ascii NUL which is very rare on Unix-derived systems (if you want an easy way to create terabyte-sized files, Then find dd if = / dev / zero of = / tmp / huge BS = 1048576 = 1048576 count = 1 . The whole thing will be ascii NUL is full of characters (Or integer 0 , however you want to interpret it.)
Comments
Post a Comment