All pastes #91683 Raw Edit

blinking cpu leds

public text v1 · immutable
#91683 ·published 2006-07-18 20:24 UTC
rendered paste body
.globl main
main:    movl $101, %eax
         movl $0x60, %ebx
         movl $5, %ecx
         movl $0xff, %edx
         int  $0x80
         cmpl $0, %eax
         jne  .end
         movl $10, %edx
.here:   movb $0x02, %bl
         call ledout
         call delay
         movb $0x04, %bl
         call ledout
         call delay
         movb $0x01, %bl
         call ledout
         call delay
         dec  %edx
         cmpl $0, %edx
         jne .here
         movb $0x00, %bl
         call ledout

.end:    test %ebx, %ebx
         movl $1, %eax
         int $0x80

ledout:  movb $0xed, %al
         outb %al, $0x60

.wait:   inb  $0x64, %al
         testb $0x02, %al
         jne .wait
         movb %bl, %al
         outb %al, $0x60

.wait2:  inb  $0x64, %al
         testb $0x02, %al
         jne .wait2
         ret

delay:   movl $0x07ffffff, %ecx

.loop:   decl %ecx
         cmpl $0, %ecx
         jne .loop
         ret