flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 02 Feb 2019, 17:37
RDTSC returns values in the registers directly. So you also need to read them directly.
Code: macro rndNum { local .higher, .done rdtsc cmp al,0xcc ja .higher mov [num],0xff jmp .done .higher: mov [num],0xaa .done: } |
|||
![]() |
|
swank 02 Feb 2019, 20:19
Thanks for the fast reply revolution!
The idea is to create a constant in the binary that changes every time it is compiled (preprocess). But the code always returns 0xaa, with this code: Code: macro rndNum { local .higher, .done rdtsc cmp al,0xcc ja .higher ;mov [num],0xff num = 0xff jmp .done .higher: ;mov [num],0xaa num = 0xaa .done: } rndNum Do I have to use match if I wan't preprocess conditional? |
|||
![]() |
|
revolution 03 Feb 2019, 01:42
The assembler doesn't execute the RDTSC instruction. It is only compiled.
One way to get a changing value during assembly is the %t value. It is the current local time in seconds since 1970-01-01. Code: macro rndNum { if %t and 0xff <= 0xcc num = 0xff else num = 0xaa end if } |
|||
![]() |
|
swank 03 Feb 2019, 03:17
Thanks mate! Works like a charm!!
With your help, I can generate a random 1byte number preprocessed with just one line!! Code: key = %t and 0xff Thanks for the patience! |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.