|
|
@@ -4,6 +4,8 @@ SYS_WRITE equ 4
|
|
|
STDIN equ 0
|
|
|
STDOUT equ 1
|
|
|
SYS_IOCTL equ 54
|
|
|
+SYS_TIMER_FD_CREATE equ 0x142
|
|
|
+SYS_TIMER_FD_SETTIME equ 0x145
|
|
|
|
|
|
section .bss
|
|
|
sz RESB 4 ; 4 byte for window size
|
|
|
@@ -11,8 +13,11 @@ section .bss
|
|
|
srow resb 1;
|
|
|
scol resb 1;
|
|
|
section .data
|
|
|
+ ;num to ascii variables
|
|
|
ha db 0 ;hundreds
|
|
|
ta db 0 ;tens
|
|
|
+
|
|
|
+ ;graphics layout
|
|
|
rcount db 0;
|
|
|
lb db 0xa; linebrak
|
|
|
tof db 0; ; top offset
|
|
|
@@ -27,11 +32,25 @@ section .data
|
|
|
hl db 0x2d ;horizontal line |
|
|
|
vl db 0x7c ;vertical line -
|
|
|
|
|
|
+ ;timer
|
|
|
+ tfd RESB 4 ;file descriptro
|
|
|
+ itimer RESQ 2 ;timer init struct
|
|
|
+ tval RESB 8 ;variable to store triggercount when reading timmerfd
|
|
|
|
|
|
section .text
|
|
|
global _start
|
|
|
|
|
|
_start:
|
|
|
+
|
|
|
+ ;create timer
|
|
|
+ mov eax, SYS_TIMER_FD_CREATE
|
|
|
+ mov ebx, 1
|
|
|
+ mov ecx, 0
|
|
|
+ int 0x80
|
|
|
+
|
|
|
+ ;store fd adress
|
|
|
+ mov [tfd], eax
|
|
|
+
|
|
|
; get windwo size
|
|
|
mov eax, SYS_IOCTL ; syscall ioctl
|
|
|
mov ebx, STDOUT ; stdout for something?
|
|
|
@@ -205,3 +224,12 @@ inctens:
|
|
|
inc byte [ta] ;increment tens
|
|
|
sub ecx, 0xa
|
|
|
jmp tens
|
|
|
+
|
|
|
+;read from timerfd blocking system till timer triggers
|
|
|
+fd_wait:
|
|
|
+ mov eax, SYS_READ
|
|
|
+ mov ebx, [tfd]
|
|
|
+ mov ecx, tval
|
|
|
+ mov edx, 0x20
|
|
|
+ int 0x80
|
|
|
+ ret
|