Hacker News new | ask | show | jobs
by tomcam 3883 days ago
Here's something more appropriate (air coded, modulo my iPhone's spell corrector)

  section .text
  global _start

  _start:

  ; Write the ‘1’ to a file
  mov eax, 4       ; sys_write
  mov edx, 1       ; # of bytes to write
  mov ecx, ‘1’     ; Means light should be on
  mov ebx, file_open ; File descriptor
  mov eax, 4       ; Call to sys_write 
  int 0x80         ; Call kernel to write file
  
  ; Close file
  move eax, 6
  mov mov ebx, 
  int 0x80         ; Call kernel to close file
  
  ; Quit to OS
  move eax, 1      ; SYS_EXIT
  int 0x80         ; Call kernel to exit to OS
  
  section.data
  
  filename db ‘/sys/class/leds/beaglebone:green:usr0/brightness’,0
  len equ $-filename

  section .bss
  file_open resb 1
  state db ‘1’