assembly

reading from File in assembly

血红的双手。 提交于 2020-06-26 14:47:16
问题 i am trying to read a username and a password from a file in x86 assembly for the perpose of authentication obviously the file consists of two lines , the user name and the password how can i read the two lines seperately and compare them? My attempt: proc read_file mov ah,3dh lea dx,file_name int 21h mov bx, ax xor si,si repeat: mov ah, 3fh lea dx, buffer mov cx, 100 int 21h mov si, ax mov buffer[si], '$' mov ah, 09h int 21h ;print on screen cmp si, 100 je repeat jmp stop;jump to end stop:

How do IBMs lis and ori instructions work?

限于喜欢 提交于 2020-06-26 13:44:28
问题 I want to know how do lis and ori instructions work? There is a description IBM description which i cannot understand well. Could someone explain to me what is the result on this example: lis r1, 0x0028 ori r1, r1, 0x776F 回答1: lis is defined here ( http://www-01.ibm.com/support/knowledgecenter/api/content/nl/en-us/ssw_aix_53/com.ibm.aix.aixassem/doc/alangref/fixed_point_load.htm#idx175 ) Extended Mnemonic lis rx, value => Equivalent to addis rx, 0, value . aka Load Immediate Shifted addis is

Iterating through and modifying a string in MIPS

一世执手 提交于 2020-06-25 22:01:07
问题 I'm trying to write a method to do a caesar shift on a string of text in the MIPS assembly language. My encryption method is as follows: encryptMessage: la $s0, message #s0 will hold message that will be iterated through lw $t1, key #s1 will hold the key to shift by li $t0, 0 #t0 will be iterator, starting at 0 encryptionLoop: add $s1, $s0, $t0 #$s1 = message[i] lb $s2, 0($s1) #Loading char to shift into $s2 beq $s2, $zero, exit #Breaking the loop if we've reached the end: http:/

Iterating through and modifying a string in MIPS

╄→尐↘猪︶ㄣ 提交于 2020-06-25 21:59:09
问题 I'm trying to write a method to do a caesar shift on a string of text in the MIPS assembly language. My encryption method is as follows: encryptMessage: la $s0, message #s0 will hold message that will be iterated through lw $t1, key #s1 will hold the key to shift by li $t0, 0 #t0 will be iterator, starting at 0 encryptionLoop: add $s1, $s0, $t0 #$s1 = message[i] lb $s2, 0($s1) #Loading char to shift into $s2 beq $s2, $zero, exit #Breaking the loop if we've reached the end: http:/

hexadecimal value of opcodes

拈花ヽ惹草 提交于 2020-06-25 21:51:11
问题 I created a very simple assembly program that prints the letter 'a' in DOS. I opened it in a hex editor and the result was this: Assembly code: mov ah, 2 mov dx, 'a' int 21h Hex code B4 02 B2 61 CD 21 I wanted to understand how it was generated! Like, I do not know if I'm right, but I realized that: B4 = mov ah 02 = 2 B2 = mov dx 61 = 'a' CD = int 21h = 21 The 02 , 61 and 21 I understood what turned but and B4 , B2 and CD ? 回答1: Here's a nice reference: http://ref.x86asm.net/coder32.html As

hexadecimal value of opcodes

若如初见. 提交于 2020-06-25 21:50:11
问题 I created a very simple assembly program that prints the letter 'a' in DOS. I opened it in a hex editor and the result was this: Assembly code: mov ah, 2 mov dx, 'a' int 21h Hex code B4 02 B2 61 CD 21 I wanted to understand how it was generated! Like, I do not know if I'm right, but I realized that: B4 = mov ah 02 = 2 B2 = mov dx 61 = 'a' CD = int 21h = 21 The 02 , 61 and 21 I understood what turned but and B4 , B2 and CD ? 回答1: Here's a nice reference: http://ref.x86asm.net/coder32.html As

GDB complains No Source Available

让人想犯罪 __ 提交于 2020-06-24 12:04:04
问题 I'm running on Ubuntu 12.10 64bit. I am trying to debug a simple assembly program in GDB. However GDB's gui mode (-tui) seems unable to find the source code of my assembly file. I've rebuilt the project in the currently directory and searched google to no avail, please help me out here. My commands: nasm -f elf64 -g -F dwarf hello.asm gcc -g hello.o -o hello gdb -tui hello Debug information seems to be loaded, I can set a breakpoint at main() but the top half the screen still says ' [ No

explanation about push ebp and pop ebp instruction in assembly

放肆的年华 提交于 2020-06-24 02:34:08
问题 i used stack in assembly but i didn't got idea about push ebp and pop ebp. .intel_syntax noprefix .include "console.i" .text askl: .asciz "Enter length: " askb: .asciz "Enter breadth: " ans: .asciz "Perimeter = " _entry: push ebp # establishing stack-frame mov ebp, esp sub esp, 12 Prompt askl GetInt [ebp-4] # length Prompt askb GetInt [ebp-8] # breadth mov eax, [ebp-4] # eax = l add eax, [ebp-8] # eax = l + b add eax, eax # eax = 2 * (l + b) mov [ebp-12], eax Prompt ans PutInt [ebp-12] PutEoL

Decipher phase 2 stage

删除回忆录丶 提交于 2020-06-23 19:26:53
问题 I am finding difficulties in defusing phase 2. i need to get 6 numbers in order to defuse the phase 2: The assembly line for phase 2 section is as follows: 08048b54 <phase_2>: 8048b54: 53 push %ebx 8048b55: 83 ec 30 sub $0x30,%esp 8048b58: 65 a1 14 00 00 00 mov %gs:0x14,%eax 8048b5e: 89 44 24 24 mov %eax,0x24(%esp) 8048b62: 31 c0 xor %eax,%eax 8048b64: 8d 44 24 0c lea 0xc(%esp),%eax 8048b68: 50 push %eax 8048b69: ff 74 24 3c pushl 0x3c(%esp) 8048b6d: e8 d2 05 00 00 call 8049144 <read_six

Decipher phase 2 stage

爷,独闯天下 提交于 2020-06-23 19:20:11
问题 I am finding difficulties in defusing phase 2. i need to get 6 numbers in order to defuse the phase 2: The assembly line for phase 2 section is as follows: 08048b54 <phase_2>: 8048b54: 53 push %ebx 8048b55: 83 ec 30 sub $0x30,%esp 8048b58: 65 a1 14 00 00 00 mov %gs:0x14,%eax 8048b5e: 89 44 24 24 mov %eax,0x24(%esp) 8048b62: 31 c0 xor %eax,%eax 8048b64: 8d 44 24 0c lea 0xc(%esp),%eax 8048b68: 50 push %eax 8048b69: ff 74 24 3c pushl 0x3c(%esp) 8048b6d: e8 d2 05 00 00 call 8049144 <read_six