Category Archives: Assembly Language

Recursive function for finding factorial in Assembly Language


.type factorial function .globl factorial factorial: pushl %ebp # Push base pointer address on top of stack for return purpose movl %esp, %ebp # Now we will be using %ebp as a for all operations on stack subl $4,%ebp # Make … Continue reading

Posted in Assembly Language | Leave a comment

set/reset a bit using Assembly language!


section .data byte_data: .byte 0b01111111 # This is 127 in decimal… we are gonna make it 255 by setting the least significant bit. .section .text .globl _start _start: movl $0, %edi # set the index movb byte_data(,%edi,1), %al or $0b10000000, … Continue reading

Posted in Assembly Language | Leave a comment

Making all bits false using Assembly Language


.section .data data_items: .byte 0b11111111 .section .text .globl _start _start: movl $0, %edi movb data_items(,%edi,1), %eax start_loop: shrl $1, %eax cmpl $0b00000000,%eax je exit_loop jmp start_loop exit_loop: movb %eax, %ebx movl $1, %eax int $0×80

Posted in Assembly Language | Leave a comment

Back to basics


I was reading a wonderful book Programming from Ground up by Jonathan. It reminds me old good days about assembly language on Dyna Microprocessor kits.  I thought about writing some points from that. Let us start reading about the Computer Architecture:

Posted in Assembly Language, General | Leave a comment