flat assembler
Message board for the users of flat assembler.

flat assembler > Examples and Tutorials > bin2hex

Thread Post new topic Reply to topic

Joined: 17 Nov 2011
Posts: 93
For my previous example I've made a template. Here is another program, that uses it with some changes and fixes. Now empty input or file are treated, displaying a 'Nothing to do...' message.

Type your string or redirect a file and you'll get a hex representation of it.
I'm planning to make a simple assembler to assemble such format back to binary. In couple it will be a type of hex redactor...

d\bin2hex>bin2hex < file.bin
00000000 00 01 02 03 04 05 06 07|08 09 0A 0B 0C 0D 0E 0F
00000010 10 11 12 13 14 15 16 17|18 19 1A 1B 1C 1D 1E 1F
00000020 20 21 22 23 24 25 26 27|28 29 2A 2B 2C 2D 2E 2F
00000030 30 31 32 33 34 35 36 37|38 39 3A 3B 3C 3D 3E 3F
00000040 40 41 42 43 44 45 46 47|48 49 4A 4B 4C 4D 4E 4F
00000050 50 51 52 53 54 55 56 57|58 59 5A 5B 5C 5D 5E 5F
00000060 60 61 62 63 64 65 66 67|68 69 6A 6B 6C 6D 6E 6F
00000070 70 71 72 73 74 75 76 77|78 79 7A 7B 7C 7D 7E 7F
00000080 80 81 82 83 84 85 86 87|88 89 8A 8B 8C 8D 8E 8F
00000090 90 91 92 93 94 95 96 97|98 99 9A 9B 9C 9D 9E 9F
000000A0 A0 A1 A2 A3 A4 A5 A6 A7|A8 A9 AA AB AC AD AE AF
000000B0 B0 B1 B2 B3 B4 B5 B6 B7|B8 B9 BA BB BC BD BE BF
000000C0 C0 C1 C2 C3 C4 C5 C6 C7|C8 C9 CA CB CC CD CE CF
000000D0 D0 D1 D2 D3 D4 D5 D6 D7|D8 D9 DA DB DC DD DE DF
000000E0 E0 E1 E2 E3 E4 E5 E6 E7|E8 E9 EA EB EC ED EE EF
000000F0 F0 F1 F2 F3 F4 F5 F6 F7|F8 F9 FA FB FC FD FE FF

Description: Two programs in one archive with some fixes
Filename: bin2hex2.zip
Filesize: 6.32 KB
Downloaded: 238 Time(s)

Filename: bin2hex.zip
Filesize: 3.39 KB
Downloaded: 185 Time(s)

Last edited by Sasha on 18 Jun 2014, 02:05; edited 2 times in total
Post 17 Jun 2014, 18:31
View user's profile Send private message Reply with quote

Joined: 17 Nov 2011
Posts: 93
It was not hard to modify it to assembly style, now it can be assembled back with fasm.

_00000000 db 000h, 001h, 002h, 003h, 004h, 005h, 006h, 007h, 008h, 009h, 00Ah, 00Bh, 00Ch, 00Dh, 00Eh, 00Fh
_00000010 db 010h, 011h, 012h, 013h, 014h, 015h, 016h, 017h, 018h, 019h, 01Ah, 01Bh, 01Ch, 01Dh, 01Eh, 01Fh
_00000020 db 020h, 021h, 022h, 023h, 024h, 025h, 026h, 027h, 028h, 029h, 02Ah, 02Bh, 02Ch, 02Dh, 02Eh, 02Fh
_00000030 db 030h, 031h, 032h, 033h, 034h, 035h, 036h, 037h, 038h, 039h, 03Ah, 03Bh, 03Ch, 03Dh, 03Eh, 03Fh
_00000040 db 040h, 041h, 042h, 043h, 044h, 045h, 046h, 047h, 048h, 049h, 04Ah, 04Bh, 04Ch, 04Dh, 04Eh, 04Fh
_00000050 db 050h, 051h, 052h, 053h, 054h, 055h, 056h, 057h, 058h, 059h, 05Ah, 05Bh, 05Ch, 05Dh, 05Eh, 05Fh
_00000060 db 060h, 061h, 062h, 063h, 064h, 065h, 066h, 067h, 068h, 069h, 06Ah, 06Bh, 06Ch, 06Dh, 06Eh, 06Fh
_00000070 db 070h, 071h, 072h, 073h, 074h, 075h, 076h, 077h, 078h, 079h, 07Ah, 07Bh, 07Ch, 07Dh, 07Eh, 07Fh
_00000080 db 080h, 081h, 082h, 083h, 084h, 085h, 086h, 087h, 088h, 089h, 08Ah, 08Bh, 08Ch, 08Dh, 08Eh, 08Fh
_00000090 db 090h, 091h, 092h, 093h, 094h, 095h, 096h, 097h, 098h, 099h, 09Ah, 09Bh, 09Ch, 09Dh, 09Eh, 09Fh
_000000A0 db 0A0h, 0A1h, 0A2h, 0A3h, 0A4h, 0A5h, 0A6h, 0A7h, 0A8h, 0A9h, 0AAh, 0ABh, 0ACh, 0ADh, 0AEh, 0AFh
_000000B0 db 0B0h, 0B1h, 0B2h, 0B3h, 0B4h, 0B5h, 0B6h, 0B7h, 0B8h, 0B9h, 0BAh, 0BBh, 0BCh, 0BDh, 0BEh, 0BFh
_000000C0 db 0C0h, 0C1h, 0C2h, 0C3h, 0C4h, 0C5h, 0C6h, 0C7h, 0C8h, 0C9h, 0CAh, 0CBh, 0CCh, 0CDh, 0CEh, 0CFh
_000000D0 db 0D0h, 0D1h, 0D2h, 0D3h, 0D4h, 0D5h, 0D6h, 0D7h, 0D8h, 0D9h, 0DAh, 0DBh, 0DCh, 0DDh, 0DEh, 0DFh
_000000E0 db 0E0h, 0E1h, 0E2h, 0E3h, 0E4h, 0E5h, 0E6h, 0E7h, 0E8h, 0E9h, 0EAh, 0EBh, 0ECh, 0EDh, 0EEh, 0EFh
_000000F0 db 0F0h, 0F1h, 0F2h, 0F3h, 0F4h, 0F5h, 0F6h, 0F7h, 0F8h, 0F9h, 0FAh, 0FBh, 0FCh, 0FDh, 0FEh, 0FFh

Filename: bin2asm.zip
Filesize: 3.39 KB
Downloaded: 198 Time(s)

Post 17 Jun 2014, 20:35
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.