-1

since the byte is the lowest addressable datum and bit rotating/flipping can come in to play here, are there any programs that can enable you to write ones and zeroes (binary), and after every 8 of them it can write the corresponding byte based on measuring textual ASCII values?

For example, I write:

10010011 and the program reads every character (which is 1 byte) and checks an ASCII table to see if it's a one or zero ... when known, it records the data. When you've written 8 of them it then writes the corresponding byte value from measured input of ASCII 1s and 0s to a file. In other words it can create a byte with the total measured value of the textual ASCII to bit flipping integer, such as through fstream or such.

Any programs that can do this? I ask because I want to actually be able to write opcodes bit-by-bit, not byte-by-byte. I'm sure what I'm saying here has to be possible in some way.

  • You need to use a combination of bitshifts and bitwise or to generate a byte from given bits – 0xec May 31 '14 at 18:31
  • Yes, but you know what I'm saying here? I would like to type these as text in an editor program and have it produce the equivalent byte based on input ones and zeroes. I am not sure on how to program this ... I am NOT asking for advice (wouldn't hurt), but merely asking if there's any programs that can do this. – OllyDebugger May 31 '14 at 18:33
  • 2
    Unless I misunderstand your purpose, it seems extremely simple to write such a program in, oh, I probably could do it in various flavours of Basic, in Z80, ARM, 68000, or 8x86 assembler, in C or in Javascript. I probably forgot a few languages. – usr2564301 May 31 '14 at 19:43
  • Here's an example [trivial] program (bash script) with an example input, produces 40 7F: echo 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 >foo, cat foo | tr -d ' ' | sed 's/\(0\|1\)\{8\}/&\n/g' | xargs -I{} echo 'ibase=2;obase=10000;{}' | bc – nrz May 31 '14 at 20:47
  • 1
    I think people are downvoting this question because nobody writes in binary directly. Hex notation is more compact, supported by more tools, and is still quite trivial to do bit flips programatically or in your head. (i.e. writing a program to flip a hex bit is very similar to the example programs below.) This app will help you practice your Hex skills: play.google.com/store/apps/… – BraveNewCurrency Jun 1 '14 at 21:00
3

Yes, 010 Editor allows you to do this:

010 Editor

Even though I wrote ASCII text in binary above, you could instead use the same interface to write machine code bit-by-bit.

2

The program rax2 (part of radare2) can do this easily:

rax2 10010011b

The above will output the hex value of the binary string, in the example, 0x83

rax2 -b 01000011

The above will output the string represented by the binary, e.g. C

1

windbg

lkd> r $t0 = 0y001000001 ; r $t1 =0; .while (@$t1 < 0n26 ) { !grep -e "Chars" -c ".formats @$t0"; r $t0 = @$t0 + 0y1; r $t1 = @$t1+1;}
  Chars:   ...A
  Chars:   ...B
  Chars:   ...C
  Chars:   ...D
  Chars:   ...E
  Chars:   ...F
  Chars:   ...G
  Chars:   ...H
  Chars:   ...I
  Chars:   ...J
  Chars:   ...K
  Chars:   ...L
  Chars:   ...M
  Chars:   ...N
  Chars:   ...O
  Chars:   ...P
  Chars:   ...Q
  Chars:   ...R
  Chars:   ...S
  Chars:   ...T
  Chars:   ...U
  Chars:   ...V
  Chars:   ...W
  Chars:   ...X
  Chars:   ...Y
  Chars:   ...Z

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.