assembly

Exit program x86

旧街凉风 提交于 2020-07-10 09:38:20
问题 I am learning x86 assembly. I am trying to understand how "exiting program" works on x86. We have a code : push ebp mov ebp,esp //Some stuff here mov esp, ebp pop ebp ret When processor executes instruction "ret" : EIP will have value, which is popped from stack, in other words 0. so processor will go to 0 address and will try to execute instructions ... which doesn't contain program code/executable code. So, what is really going on with processor? Are there condition check, for example, if

How to set Timer

廉价感情. 提交于 2020-07-10 05:59:27
问题 Is there any way I can set timer 60 seconds with xor ah,ah Enter_Again: xor ah, ah ; I should put 60 seconds here int 16h ; The user should press S before 60 seconds mov bl,al cmp al,"S" 回答1: Your previous questions suggest you are running under DOS. There is no BIOS or DOS call that times out keyboard input. You can latch (chain) onto Interrupt 0x1c which is a user interrupt routine that gets called about 18.2 times a second. One minute is about 1092 of these interrupts. Your timer interrupt

What is -fverbose-asm trying to say in assembly?

笑着哭i 提交于 2020-07-10 05:14:34
问题 I have compiled this function: void print_ints(int len, ...){ va_list args; va_start(args, len); for(int i =0; i<len ; i++) { int val = va_arg(args,int); printf("i:%i\tval:%i\n",i,val); } va_end(args); } into this assembly: print_ints: pushq %rbp # movq %rsp, %rbp #, subq $224, %rsp #, movl %edi, -212(%rbp) # len, len movq %rsi, -168(%rbp) #, movq %rdx, -160(%rbp) #, movq %rcx, -152(%rbp) #, movq %r8, -144(%rbp) #, movq %r9, -136(%rbp) #, testb %al, %al # je .L7 #, movaps %xmm0, -128(%rbp) #,

What is -fverbose-asm trying to say in assembly?

柔情痞子 提交于 2020-07-10 05:14:11
问题 I have compiled this function: void print_ints(int len, ...){ va_list args; va_start(args, len); for(int i =0; i<len ; i++) { int val = va_arg(args,int); printf("i:%i\tval:%i\n",i,val); } va_end(args); } into this assembly: print_ints: pushq %rbp # movq %rsp, %rbp #, subq $224, %rsp #, movl %edi, -212(%rbp) # len, len movq %rsi, -168(%rbp) #, movq %rdx, -160(%rbp) #, movq %rcx, -152(%rbp) #, movq %r8, -144(%rbp) #, movq %r9, -136(%rbp) #, testb %al, %al # je .L7 #, movaps %xmm0, -128(%rbp) #,

Understanding disassembled C code: dec %eax and movl $0x0,-0x8(%ebp)

我是研究僧i 提交于 2020-07-09 19:52:17
问题 I'm trying to understand the lines in a piece of disassembled code as shown below. I'd like to know the following: dec %eax : Why is the eax register being decremented? What is the initial value of the eax register? movl $0x0,-0x8(%ebp) : Why are we moving the value 0x0 onto the stack? Doesn't movl store a 32-bit value (4 bytes)? If so, why is the value being stored 8 bytes below the base pointer instead of 4 bytes? Here's the disassembled binary: Contents of section .text: 0000 554889e5

Understanding disassembled C code: dec %eax and movl $0x0,-0x8(%ebp)

核能气质少年 提交于 2020-07-09 19:51:03
问题 I'm trying to understand the lines in a piece of disassembled code as shown below. I'd like to know the following: dec %eax : Why is the eax register being decremented? What is the initial value of the eax register? movl $0x0,-0x8(%ebp) : Why are we moving the value 0x0 onto the stack? Doesn't movl store a 32-bit value (4 bytes)? If so, why is the value being stored 8 bytes below the base pointer instead of 4 bytes? Here's the disassembled binary: Contents of section .text: 0000 554889e5

Interrupts IQR and XIRQ - assembly

吃可爱长大的小学妹 提交于 2020-07-09 12:06:14
问题 I've been struggling with a topic related to IRQ (interrupts itself); i'm using an old MC68HC11 Been practicing for a while; i decided to move on and check the hardest exercises showed in this chapter that's why i found an interesting one (and a little tricky tbh) Take a look at this: This is what i tried so far (This is just an outline ): Do NOTE: FLAGNMI means XIRQ FLAGIQR means IRQ IRQ EQU $FFF2 XIRQ EQU $FFF4 RESET EQU $FFFE RWM EQU $0000 ROM EQU $C000 LEDS EQU $1004 VARIABLE EQU $1003

relocation R_X86_64_8 against undefined symbol `ELF' can not be used when making a PIE object

冷暖自知 提交于 2020-07-09 11:55:27
问题 Having this in gas: .text .globl main main: xor %eax, %eax lea str(%rip), %rdi call printf call exit str: .byte 0x7F, "ELF", 1,1,1,0 I thought the .byte directive could be concatenate as in nasm db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident source : http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html 回答1: In GAS syntax, "ELF" is a symbol reference to the symbol name ELF , not a multi-char string. In the context of .byte directive, it's only looking for a number, not a possible string. And

relocation R_X86_64_8 against undefined symbol `ELF' can not be used when making a PIE object

假装没事ソ 提交于 2020-07-09 11:55:09
问题 Having this in gas: .text .globl main main: xor %eax, %eax lea str(%rip), %rdi call printf call exit str: .byte 0x7F, "ELF", 1,1,1,0 I thought the .byte directive could be concatenate as in nasm db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident source : http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html 回答1: In GAS syntax, "ELF" is a symbol reference to the symbol name ELF , not a multi-char string. In the context of .byte directive, it's only looking for a number, not a possible string. And

Change the color with the user option

淺唱寂寞╮ 提交于 2020-07-09 11:52:07
问题 I'm working in my project with assembly emu8086 and I've done a lot of things: Now I'm struggling to put the option selected by the user. I want to change the leds color from (0-7) using the user option, I've already done a lot of things I only dont understand how I'll do this to change the color, if the user select 1 both squares(leds) need to change to blue and this for all the colors, I need to verify the user option. Here is my code: title ac-cores-mov-cursor.asm - desenha poligno