ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Sat Jul 20, 2019 10:20 pm

All times are UTC




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Wed May 01, 2019 4:39 am 
User avatar

Joined: Fri Mar 30, 2018 2:48 am
Posts: 233
How would I print the bits in a byte I read?

let's say I read 0x32 and want it to print "00110010".


Code:
get TEST byte
print ?

_________________
Private help and contact:
https://bit.ly/31PFc3i


If you appreciate my work and want to donate:
Paypal: ghfear@hotmail.com


Top
   
PostPosted: Wed May 01, 2019 1:05 pm 
User avatar

Joined: Sat Sep 15, 2018 5:22 am
Posts: 239
add % before and after but i dont see any code to write as 01 mode

Code:
get TEST byte
print "%TEST%"


Last edited by Shokoniraya on Wed May 01, 2019 4:49 pm, edited 1 time in total.

Top
   
PostPosted: Wed May 01, 2019 2:18 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10553
There is no binary printing output in quickbms.


Top
   
PostPosted: Wed May 01, 2019 4:25 pm 
User avatar

Joined: Fri Mar 30, 2018 2:48 am
Posts: 233
aluigi wrote:
There is no binary printing output in quickbms.

God damn bro. No problem. I Guess I can use c# for that instead.

_________________
Private help and contact:
https://bit.ly/31PFc3i


If you appreciate my work and want to donate:
Paypal: ghfear@hotmail.com


Top
   
PostPosted: Wed May 01, 2019 4:40 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10553
If you need to convert a number in binary you can use a tool like my calcc:
http://aluigi.altervista.org/mytoolz.htm#calcc

Example for number 0x12345678:
Code:
0x12345678
 305419896              0000000012345678   0000000000002215053170
 0000000000000000000000000000000000010010001101000101011001111000
 305419896              .4Vx               3.0541989600000000000e+008
 00000000000000000102031011121320          18.52.86.120
 JDIVTY                 SNFZ4              Wed 05 Sep 1979 22:51:36
 0.00000000             1.508974781700064e-315
 01 Jan 1601 00:00:30

It's not like having the output directly in quickbms but if you need to visualize only few numbers it's good.


Top
   
PostPosted: Wed May 01, 2019 4:53 pm 
User avatar

Joined: Fri Mar 30, 2018 2:48 am
Posts: 233
aluigi wrote:
If you need to convert a number in binary you can use a tool like my calcc:
http://aluigi.altervista.org/mytoolz.htm#calcc

Example for number 0x12345678:
Code:
0x12345678
 305419896              0000000012345678   0000000000002215053170
 0000000000000000000000000000000000010010001101000101011001111000
 305419896              .4Vx               3.0541989600000000000e+008
 00000000000000000102031011121320          18.52.86.120
 JDIVTY                 SNFZ4              Wed 05 Sep 1979 22:51:36
 0.00000000             1.508974781700064e-315
 01 Jan 1601 00:00:30

It's not like having the output directly in quickbms but if you need to visualize only few numbers it's good.


I was actually going to make the bitvalues a string and then compare that to another string and then write different text to a temp File based on what bits were active. Maybe I can do that some other way?

So if the bits are XXX00001 it would write "N 4 0" and XXX00010 would be "N 3 0".
XXX00100 = N 2 0
XXX01000 = N 1 0
XXX10000 = N 0 0

_________________
Private help and contact:
https://bit.ly/31PFc3i


If you appreciate my work and want to donate:
Paypal: ghfear@hotmail.com


Top
   
PostPosted: Wed May 01, 2019 5:25 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 10553
A simple converter to bits is the following:
Code:
math VAR = 0x12345678
callfunction TOBIT 1
print "%STR%"

startfunction TOBIT
    set STR string ""
    for TMP = VAR != 0
        xmath TMP2 "TMP & 1"
        string STR + TMP2
    next TMP u>> 1
    string STR r STR
endfunction

That thing of counting the left zeroes depends, honestly quickbms is not done for these things :)


Top
   
PostPosted: Thu May 02, 2019 3:29 am 
User avatar

Joined: Fri Mar 30, 2018 2:48 am
Posts: 233
aluigi wrote:
A simple converter to bits is the following:
Code:
math VAR = 0x12345678
callfunction TOBIT 1
print "%STR%"

startfunction TOBIT
    set STR string ""
    for TMP = VAR != 0
        xmath TMP2 "TMP & 1"
        string STR + TMP2
    next TMP u>> 1
    string STR r STR
endfunction

That thing of counting the left zeroes depends, honestly quickbms is not done for these things :)


yeah :) this is good. The only problem now is I need all the 0000s in front of the first 1 too. Now it cuts off all the 0000s.
Could I force it to show all 8 bits?

Output looks like this:
110
1001000
110
1001000
110
1010
1010
110
1
11
100
1100
1100
10100
1000100
10100
1100
1
11


EDIT:
Nevermind, I fixed it like this:

Code:
startfunction TOBIT

    set STR string ""
    math TEST = 8
    for TMP = NOTEBITS != 0
        math TEST - 1
        xmath TMP2 "TMP & 1"
        string STR + TMP2
    next TMP u>> 1
   
    for i = 0 < TEST
        string STR + 0
    next i
   
    string STR r STR
endfunction

_________________
Private help and contact:
https://bit.ly/31PFc3i


If you appreciate my work and want to donate:
Paypal: ghfear@hotmail.com


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited