aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-17 14:41:20 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-17 14:41:20 +0200
commit396a5d42f979c5200532937f3428d68e049b1298 (patch)
tree34d6fd297fba43d196adb0d386b9a602c6081a95 /asm
parentMakefile fix (diff)
downloadlowbat-bsd-396a5d42f979c5200532937f3428d68e049b1298.tar.gz
lowbat-bsd-396a5d42f979c5200532937f3428d68e049b1298.tar.bz2
lowbat-bsd-396a5d42f979c5200532937f3428d68e049b1298.tar.xz
lowbat-bsd-396a5d42f979c5200532937f3428d68e049b1298.tar.zst
lowbat-bsd-396a5d42f979c5200532937f3428d68e049b1298.zip
Fetch percent is ok
Diffstat (limited to 'asm')
-rw-r--r--asm/jo_f_percent.asm24
-rw-r--r--asm/jo_f_status.asm7
2 files changed, 23 insertions, 8 deletions
diff --git a/asm/jo_f_percent.asm b/asm/jo_f_percent.asm
index 765ca99..76d792b 100644
--- a/asm/jo_f_percent.asm
+++ b/asm/jo_f_percent.asm
@@ -12,18 +12,36 @@
section .text
extern system
+ extern atoi
global jo_f_percent
jo_f_percent:
mov rdi, f_cmd
call system
+ mov rdi, pr_file
+ mov rsi, 0x0
+ mov rax, 0x5
+ syscall
+ jc err
+ mov rdi, rax
+ mov rsi, buff
+ mov rdx, 0x3
+ mov rax, 0x3
+ syscall
+ jc err
+ mov rax, 0x6
+ syscall
+ xor rax, rax
+ mov rdi, rsi
+ call atoi
retq
err:
- mov rax, 0xff
+ mov rax, 0xfe
retq
section .data
- f_cmd: db "apm -l > /tmp/lowbat.percent", 0x0
- buff: db 0x0, 0x0, 0x0, 0x0
+ f_cmd: db "apm -l > /tmp/lowbat.percent", 0x0
+ pr_file: db "/tmp/lowbat.percent", 0x0
+ buff: db 0x0, 0x0, 0x0, 0x0
diff --git a/asm/jo_f_status.asm b/asm/jo_f_status.asm
index 69fad67..326f58e 100644
--- a/asm/jo_f_status.asm
+++ b/asm/jo_f_status.asm
@@ -32,20 +32,17 @@ jo_f_status:
mov rdi, rax
mov rsi, buff
mov rdx, 0x1
- push rax
mov rax, 0x3
syscall
jc err
- pop rax
- mov rdi, rax
mov rax, 0x6
syscall
movsx rax, byte [rsi + 0x0]
- sub rax, 0x30 ; 48
+ sub rax, 0x30 ; 48
retq
err:
- mov rax, 0xff
+ mov rax, 0xfe
retq
section .data