title: GAS assembly basics, getting the exponent
body: <p>there aren't a lot of GAS assembly tutorials so im terribly lost.
  this is just a simple program that computes the result after the user inputs a base and an exponent. but it won't work, i think there is something wrong with my compare statements.
  your kind help will be greatly appreciated! thanks! :)</p>
  
  <pre><code>.section .data
      input1: .ascii "Input base number: \0"
      input1Len: .long .-input1
      input2: .ascii "Input exponent: \0"
      input2Len: .long .-input2
      newline: .ascii "\n\0"
      newlineLen: .long .-newline
      output: .ascii "result = "
      outputLen: .long .-output
  
  .section .bss
      .lcomm base, 1
      .lcomm exponent, 1
      .lcomm result, 1
      .lcomm one, 1
  
  
  .section .text
  .globl _start
  _start:
  
  #prompt 1st number
  movl $4,%eax
  movl $1,%ebx
  movl $input1,%ecx
  movl input1Len, %edx
  int $0x80
  
  #get 1st input number
  movl $3, %eax
  movl $1, %ebx
  movl $base, %ecx
  int $0x80
  
  #write 1st input number
  movl $4,%eax
  movl $1,%ebx
  movl $base,%ecx
  int $0x80
  
  #prompt 2nd number
  movl $4,%eax
  movl $1,%ebx
  movl $input2,%ecx
  movl input2Len, %edx
  int $0x80   
  
  #get 2nd input number
  movl $3, %eax
  movl $1, %ebx
  movl $exponent, %ecx
  int $0x80
  
  #write 2nd input number
  movl $4,%eax
  movl $1,%ebx
  movl $exponent,%ecx
  int $0x80
  
  #move base to result
  movl (base), %eax
  movl %eax, (result)
  
  #check if exponent==1
  movl (exponent), %ecx
  subl $0x30, %ecx
  cmpl $1, %ecx
  
  while:
  
      movl (base), %eax
      movl (result), %ebx
      subl $0x30, %eax
      subl $0x30, %ebx
  
      #multiply result and base, then update result
      imull %eax, %ebx
      movl %ebx, (result)
      addl $0x30, %ebx
      movl %ebx, (result) 
  
      #subtract 1 from ecx, which is the exponent
      subl $1, %ecx
  
      #compare if ecx is greater than 1
      cmpl $1, %ecx
      jg while
  
  print:
  
      #write output
      movl $4,%eax
      movl $1,%ebx
      movl $output,%ecx
      movl outputLen, %edx
      int $0x80
  
      movl $4,%eax
      movl $1,%ebx
      movl $result,%ecx
      movl $1, %edx
      int $0x80
  
      movl $4,%eax
      movl $1,%ebx
      movl $newline,%ecx
      movl newlineLen, %edx
      int $0x80
  
  _exit:
      movl $1, %eax
      movl %ecx, %ebx
      int $0x80   
  </code></pre>