Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Print the bits of a read byte in QuickBMS

Featured Replies

  • Author
  • Localization

GHFear, posted Wed May 01, 2019 4:39 am (47480)


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 ?
  • Author
  • Localization

Shokoniraya, posted Wed May 01, 2019 1:05 pm (47491)


add % before and after but i dont see any code to write as 01 mode

Code:
get TEST byte
print "%TEST%"
  • Author
  • Localization

aluigi, posted Wed May 01, 2019 2:18 pm (47497)


There is no binary printing output in quickbms.
  • Author
  • Localization

GHFear, posted Wed May 01, 2019 4:25 pm (47500)


aluigi wrote:
There is no binary printing output in quickbms.

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

aluigi, posted Wed May 01, 2019 4:40 pm (47501)


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.
  • Author
  • Localization

GHFear, posted Wed May 01, 2019 4:53 pm (47503)


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
  • Author
  • Localization

aluigi, posted Wed May 01, 2019 5:25 pm (47507)


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 :)
  • Author
  • Localization

GHFear, posted Thu May 02, 2019 3:29 am (47527)


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         string STR 0
    next i
   
    string STR r STR
endfunction
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.