Skip to content

netmonk/asm

Repository files navigation

This section contains the code of my journey into asm. 

My current system is 64bit and linux(arch) so all the asm code is for this plateform. 
In any case you can do whatever you want with the code at the condition you quote your sources. 

-- fibo.asm: 
it is an attempt to compute the fibonacci number only based on register (r11/r12)
So once the integer is bigger than 64bits its unecessary to continue to compute. 
May be next step would be to implement a bigmath routine which instead of relying only on register with size limitation
should just use buffer. 
The main operation to implement would be the addition of two buffers. 

During the coding of fibo, i realise that the main problem is not to compute arithmetic operation on register, the loop
and the addition juste take 6 lines in the code, but the main problem is to display value. 


---------------------------------------------------------
Commit of 02/2014:
Adding fibo2test.asm using mmx registers and instruction instead of standard registers ! :) 
---------------------------------------------------------

Registers are just number in binary format (or hex) and displaying the content is not so easy. 
Indeed to display a decimal integer needs a dedicated process which take more instruction than just adding two registers.
I isolated two process: 
- rax2hex.asm which displays the content of the rax register (64bits) into 16chars representings the Hexadecimal value. 
- rax2dec.asm which displays the content of the rax register (64bits) into a decimal integer. 

Currently the code of rax2dec.asm is the one used in fibo.asm. 
But the rax2hex.asm was my first attempt and running fine too in the first version of fibo.asm. 

Have fun
---------------------------------------------------------
Commit of 16/10/2022
Adapt 10power.asm to display rdrand instruction result on ia64

Made a test to file a file with random data and compressed it to see just how random it is. 

plonky@micronetmonk:~/work/asm$ ./rdrand  >tmpfile 
^C    
plonky@micronetmonk:~/work/asm$ wc -l tmpfile 
1 tmpfile
plonky@micronetmonk:~/work/asm$ wc -c tmpfile 
497643930 tmpfile
plonky@micronetmonk:~/work/asm$ ls -altr tmpfile 
-rw-rw-r-- 1 plonky plonky 497643930 oct.  16 21:17 tmpfile
plonky@micronetmonk:~/work/asm$ ls -altrh tmpfile 
-rw-rw-r-- 1 plonky plonky 475M oct.  16 21:17 tmpfile
plonky@micronetmonk:~/work/asm$ gzip tmpfile 
plonky@micronetmonk:~/work/asm$ ls -altrh tmpfile.gz 
-rw-rw-r-- 1 plonky plonky 223M oct.  16 21:17 tmpfile.gz

So for a pure text file filed of number, it shrinks from 475mb of size to 223mb. Which is closer to 0.5 ratio than 0.1 ration often seen on text file. 

I cannot tell if the data is very random, but i least the compression ratio close to 0.5 means it's more random than average file. 

---------------------------------------------------------
Netmonk, netmonk at netmonk dot org 
http://www.netmonk.org 
 

About

Mostly NASM sources of my journey in 64bits/linux !

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published