DOS Hex2bin

7 views
Skip to first unread message

Kerr-Mudd,John

unread,
Nov 8, 2019, 2:08:56 PM11/8/19
to
Of course to convert this you already need it (catch22!)

BA3C0153EB24AC3C307210244FD43780F301750588FCD510AA88C7E2E953BB01
0089F929D1B440CD214B89D789D6B9C3FEB43FCD215B9109C975CBC3

--
Bah, and indeed, Humbug.

Kerr-Mudd,John

unread,
Nov 9, 2019, 4:06:04 AM11/9/19
to
On Sat, 09 Nov 2019 07:11:24 GMT, Herbert Kleebauer <kl...@unibwm.de>
wrote:

> On 08.11.2019 22:57, Mike Gonta wrote:
>
>> Putting a DOS header on it is simple enough though. Or even simpler:
>>
>> Write the hex2bin to "C:\some stuff\hex2bin.com".
>
> As far as I remember, it doesn't matter whether it is named .com
> or .exe . If it has an exe header it is executed as an exe,
> otherwise as a com file. So you can't write a com program
> starting with "MZ", you can't even write a text file starting
> with "MZ" and open it with "start".
>
> Write a text file a.txt with the content "AN loves MZ" and then
> open it in the default editor by typing "start a.txt". Then
> change the content to "MZ loves AN" and again try to open it
> with "start a.txt".
>
> But in these days nearly nobody can execute 16 bit programs
> in Windows (because of AMD's crippled hardware and Microsoft
> not providing a software workaround) so if you provide a
> hex2bin, use a combined 16/32 binary which is executed as
> 16 bit code in real DOS and as 32 bit code in Windows and
> it doesn't matter whether you call it hex2bin.com or hex2bin.exe.
>

Mine's especially DOS though because IO is redirected.

c:\> hex2bin<hex2bin.hex>h2bin2.com

hex2bin.hex:
BA3C0153EB24AC3C307210244FD43780F301750588FCD510AA88C7E2E953BB01
0089F929D1B440CD214B89D789D6B9C3FEB43FCD215B9109C975CBC3

For completeness, here's my 8086 dump program
bin2hex.hex:
BF6B5457BA3B0189D6B93053B43FCD21722891ACD4102704F0144086C43C0A1C
692FAB4380E3DF7504B80D0AABE2E4B30189F95A29D1B440CD21C3

recreate using:
c:\> hex2bin<bin2hex.hex>bin2hex.com

(xposted to both ala and amp)

Kerr-Mudd,John

unread,
Nov 20, 2019, 5:19:57 AM11/20/19
to
On Fri, 08 Nov 2019 19:08:56 GMT, "Kerr-Mudd,John"
<nots...@invalid.org> wrote:

> Of course to convert this you already need it (catch22!)
>
> BA3C0153EB24AC3C307210244FD43780F301750588FCD510AA88C7E2E953BB01
> 0089F929D1B440CD214B89D789D6B9C3FEB43FCD215B9109C975CBC3
>

No interest? Ah well.


I'm now working on a sokoban program (max of 256 bytes). What I'd like
(for size obv) is to have the board/maze input as a text file redirected
from stdin. Opening a file from the PSP costs me 16 precious bytes.

The problem then is that keyboard input from int 0x16 is also redirected;
so it's unusable! My googlefu is weak; anyone here recall how to code
(just the 4 csrkeys, and esc to exit) a keyin that *isn't* redirected?

Must I inf-loop around "in al,0x60"?

NimbUs

unread,
Nov 20, 2019, 11:40:47 AM11/20/19
to
Kerr-Mudd,John wrote as news:XnsAB0D691E76D01admin127001@
144.76.35.198:

> The problem then is that keyboard input from int 0x16 is also
redirected;
> so it's unusable!

Are U sure ? Console I/O "redirection" is a DOS feature - not a BIOS
one !
Even if the DOS "CON" input has been redirected, it will only affect
the DOS int 21h readchar functions. You are still able to read the
keyboard using BIOS int 16h.

My googlefu is weak; anyone here recall how to code
> (just the 4 csrkeys, and esc to exit) a keyin that *isn't*
redirected?

> Must I inf-loop around "in al,0x60"?

You would not need/want to do such a thing ordinarily, nor would you
need/want to hook the int 9 driver, nor int 15h/4F either. Or did I
misunderstand the particular situation you were facing ?

--
Nim

Kerr-Mudd,John

unread,
Nov 20, 2019, 12:12:07 PM11/20/19
to
On Wed, 20 Nov 2019 16:40:46 GMT, NimbUs <nim...@xxx.invalid> wrote:

> Kerr-Mudd,John wrote as news:XnsAB0D691E76D01admin127001@
> 144.76.35.198:
>
>> The problem then is that keyboard input from int 0x16 is also
> redirected;
>> so it's unusable!
>
> Are U sure ? Console I/O "redirection" is a DOS feature - not a BIOS
> one !
> Even if the DOS "CON" input has been redirected, it will only affect
> the DOS int 21h readchar functions. You are still able to read the
> keyboard using BIOS int 16h.

I shudda tried it!! Doh!

240 byte monchrome sokoban; further testing reqd, then if there's space
I'll display "moves taken".


>
> My googlefu is weak; anyone here recall how to code
>> (just the 4 csrkeys, and esc to exit) a keyin that *isn't*
> redirected?
>
>> Must I inf-loop around "in al,0x60"?
>
> You would not need/want to do such a thing ordinarily, nor would you
> need/want to hook the int 9 driver, nor int 15h/4F either. Or did I
> misunderstand the particular situation you were facing ?
>
No quite; I was barking up the wrong tree.

Kerr-Mudd,John

unread,
Nov 24, 2019, 1:59:29 PM11/24/19
to
On Wed, 20 Nov 2019 17:12:07 GMT, "Kerr-Mudd,John"
<nots...@invalid.org> wrote:

[]
>
> 240 byte monchrome sokoban; further testing reqd, then if there's space
> I'll display "moves taken".

243 bytes; colo{u}r, displays moves taken; but no undo.
It accepts 1 screen in text format from stdin
e.g. soko<sample.txt
R to reset, escape to exit, std csr arrow keys



soko.com
BAF301B508B43FCD2191B800B8500751BEF301BF3E0389FB98AC3C0D744ABA5F
773C237434BA20003C5F742D3C2074293C2D742580F6303C2E741EBA230C3C24
741580F6303C2A740EBA260E3C40740380F63089FDEB02FEC492AB92E2BBEB12
FEC20E1F5974A8C38DBFA00089FB4649E2A788E289EF061F98CD1688E03C1374
E13C0174DBBBA0003C5074113C48740BBB02003C4D74063C4B75DDF7DB8D318A
043C2074223C2375CF80382075CAFEC1B8030C3104807C01307502FEC2807801
307502FECA3100FEC5B8060E3104310501DF88E8BB9A00E80E0088C8B302E807
0008D27593E978FFD40A0530308827884702C3


sample.txt
#### ####
# ### #
# $ * $ #
# + #
### .$###
# . #
#####

Kerr-Mudd,John

unread,
Dec 3, 2019, 6:37:28 AM12/3/19
to
Now with U to undo a (single) move.

BAFC01B900B8B43FCD2191500751590E1F51BEFC01BF3E035731D2AC3C0D7435
BB5F773C237425BB230C423C24741D4AB73C3C2A7416BB260E3C407414B73E3C
2B740EBB20303C2E7402B70093AB93EB0C89FDEBF75F81C7A000574649E2BC5F
89EF061FB68098CD1688E03C13749F80FE8073063C16746B01DF3C017463BBA0
003C5074113C48740BBB02003C4D74063C4B75D0F7DBB6008D318B043C237223
75C280382075BDFEC1FEC632600180FC0D720980780130740242424AB8030C31
003104FEC5B8060E3104310588E8BD9A00E81C0088C8BD0200E8140080FA0075
8559C3FECDF6C601B68074D7FEC9EBB7D40A053030886600884602C3

Kerr-Mudd,John

unread,
Dec 3, 2019, 11:53:06 AM12/3/19
to
On Tue, 03 Dec 2019 11:37:27 GMT, "Kerr-Mudd,John"
But Undo wrecks the scoring; More Research Needed.

Kerr-Mudd,John

unread,
Dec 3, 2019, 3:13:57 PM12/3/19
to
On Tue, 03 Dec 2019 16:53:05 GMT, "Kerr-Mudd,John"
<nots...@invalid.org> wrote:

> On Tue, 03 Dec 2019 11:37:27 GMT, "Kerr-Mudd,John"
> <nots...@invalid.org> wrote:
>
>> On Sun, 24 Nov 2019 18:59:29 GMT, "Kerr-Mudd,John"
>> <nots...@invalid.org> wrote:
>>

>>> It accepts 1 screen in text format from stdin
>>> e.g. soko<sample.txt
>>> R to reset, escape to exit, std csr arrow keys
[]
>>> sample.txt
>>> #### ####
>>> # ### #
>>> # $ * $ #
>>> # + #
>>> ### .$###
>>> # . #
>>> #####
>>>
>>>
>> Now with U to undo a (single) move.
>>

>>
> But Undo wrecks the scoring; More Research Needed.
>
OK fixed (255)

BAFF01B900B8B43FCD2191500751590E1F51BEFF01BF3E035731D2AC3C0D7435
BB5F773C237425BB230C423C24741D4AB73C3C2A7416BB260E3C407414B73E3C
2B740EBB20303C2E7402B70093AB93EB0C89FDEBF75F81C7A000574649E2BC5F
89EF061FB68098CD1688E03C13749F80FE8073063C16746F01DF3C017467BBA0
003C5074113C48740BBB02003C4D74063C4B75D0F7DBB6008D318A043C237225
75C280382075BDFEC18A44013240013C0D720980780130740242424AFEC6B803
0C31003104FEC5B8060E3104310588E856BE9A00E81D0088C8BE0200E815005E
80FA00758159C380ED02F6C601B68074D449EBB5D40A0530308824884402C3

Kerr-Mudd,John

unread,
Dec 17, 2019, 1:37:06 PM12/17/19
to
On Tue, 03 Dec 2019 20:13:56 GMT, "Kerr-Mudd,John"
<nots...@invalid.org> wrote:

> On Tue, 03 Dec 2019 16:53:05 GMT, "Kerr-Mudd,John"
> <nots...@invalid.org> wrote:
>
>> On Tue, 03 Dec 2019 11:37:27 GMT, "Kerr-Mudd,John"
>> <nots...@invalid.org> wrote:
>>
>>> On Sun, 24 Nov 2019 18:59:29 GMT, "Kerr-Mudd,John"
>>> <nots...@invalid.org> wrote:
>>>
>
>>>> It accepts 1 screen in text format from stdin
>>>> e.g. soko<sample.txt
>>>> R to reset, escape to exit, std csr arrow keys
> []
>>>> sample.txt
>>>> #### ####
>>>> # ### #
>>>> # $ * $ #
>>>> # + #
>>>> ### .$###
>>>> # . #
>>>> #####
>>>>
>>>>
>>> Now with U to undo a (single) move.
>>>
>
>>>
>> But Undo wrecks the scoring; More Research Needed.
>>
> OK fixed (255)


saved ~8 bytes to spend on cls

(xposting to clax doesn't seem to work)

BAFF01B900B8B43FCD21510750B510B8200231FFF2AB590E1F51BEFF01BF3E08
5799ACBB20003C207230742A3C2D7426BB233C3C2A741FB70C3C247418BB5F77
3C237412BB20303C2E740BBB260E7702B73E89FD4A4293ABEB085F81C7A00057
4649E2BE5F89EF061FB68098CD1688E03C13749980FE8073063C16746D01DFB6
013C017463BBA0003C5074103C48740AB3023C4D74063C4B75CFF7DB8D318A04
3C23722675C380382075BEFEC1FECEB8030C310031048A44018A600130C480FC
0D7207D432740242424AFEC5B8060E310431055788E8BF4800E81900AEAF88C8
E812005F09D2758359C380ED02F9D0DE72D849EBBAD40A0530308825AFAAC3

Frank Kotler

unread,
Dec 17, 2019, 4:24:52 PM12/17/19
to
On 12/17/2019 01:37 PM, Kerr-Mudd,John wrote:

...
>> (xposting to clax doesn't seem to work)

It should! Try it again (if you like)...

Best,
Frank

Dennis Boone

unread,
Dec 17, 2019, 7:07:50 PM12/17/19
to
> Of course to convert this you already need it (catch22!)

https://www.pcorner.com/list/MAG/DEBUGSCR.ZIP/INFO/ might be useful too.

De

Kerr-Mudd,John

unread,
Dec 18, 2019, 4:30:24 AM12/18/19
to
On Wed, 18 Dec 2019 00:07:45 GMT, d...@ihatespam.msu.edu (Dennis Boone)
wrote:

> > Of course to convert this you already need it (catch22!)
>
> https://www.pcorner.com/list/MAG/DEBUGSCR.ZIP/INFO/ might be useful too.
>
> De
>


A BASIC program? No thanks.

use xxd -r (linux) or my DOS xxd-r.com


Of course, it's the same catch. (Lines will probably wrap, sorry)

-d 100 lfe

0BD1:0100 BA 9D 01 81 3E 82 00 2D-68 74 67 31 DB BE FE 41 ....>..-
htg1...A
0BD1:0110 56 BA 00 02 53 31 DB 89-D7 B9 00 40 B4 3F CD 21 V...S1.....
@.?.!
0BD1:0120 5B 91 E3 57 81 FE FE 41-75 0E B0 2D AE 74 04 B0
[..W...Au..-.t..
0BD1:0130 3E F2 AE 80 3D 64 75 37-B3 32 B0 3A F2 AE 75 D4 >...
=du7.2.:..u.
0BD1:0140 83 C7 04 83 E9 04 72 CC-87 F7 AC 3C 30 72 0F 24 ......r....
<0r.$
0BD1:0150 4F D4 37 80 F2 01 75 05-4F 8A 25 D5 10 AA 4B 74
O.7...u.O.%...Kt
0BD1:0160 04 E2 E7 EB AF 87 F7 B0-0A F2 AE 75 A7 EB C9 BA
...........u....
0BD1:0170 87 01 B4 09 CD 21 B8 01-4C CD 21 B3 01 5A 89 F1
.....!..L.!..Z..
0BD1:0180 29 D1 B4 40 CD 21 C3 4E-6F 74 20 64 65 62 75 67 )..@.!.Not
debug
0BD1:0190 20 64 75 6D 70 20 66 69-6C 65 0D 0A 24 55 73 61 dump file..
$Usa
0BD1:01A0 67 65 20 69 73 3A 20 78-78 64 2D 72 3C 64 69 73 ge is: xxd-r
<dis
0BD1:01B0 66 69 6C 65 3E 63 6F 6D-66 69 6C 65 0D 0A 20 22 file>comfile..
"
0BD1:01C0 64 69 73 66 69 6C 65 22-20 69 73 20 65 69 74 68 disfile" is
eith
0BD1:01D0 65 72 20 61 20 67 72 64-62 20 6F 72 20 4D 53 20 er a grdb or
MS
0BD1:01E0 64 65 62 75 67 20 22 64-22 75 6D 70 0D 0A 24 31 debug "d"ump..
$1
0BD1:01F0 32 33 34 35 36 37 38 39-41 42 43 44 45 46 23456789ABCDEF
-q

Kerr-Mudd,John

unread,
Dec 18, 2019, 5:33:26 AM12/18/19
to
On Wed, 18 Dec 2019 09:30:23 GMT, "Kerr-Mudd,John"
<nots...@invalid.org> wrote:

> On Wed, 18 Dec 2019 00:07:45 GMT, d...@ihatespam.msu.edu (Dennis Boone)
> wrote:
>
>> > Of course to convert this you already need it (catch22!)
>>
>> https://www.pcorner.com/list/MAG/DEBUGSCR.ZIP/INFO/ might be useful
>> too.
>>
>> De
>>
>
>
> A BASIC program? No thanks.
>
> use xxd -r (linux) or my DOS xxd-r.com
>
[older prog cut]

This is better:

->d 100 l100
161A:0100 BA AF 01 81-3E 82 00 2D-68 74 62 E8-81 00 B0 2D ....>..-
htb....-
161A:0110 E8 62 00 E3-55 80 3D 64-74 04 B0 3E-EB F2 B0 0D .b..U.
=dt..>....
161A:0120 E8 52 00 E3-4C B0 3A E8-4B 00 E3 45-B0 20 E8 44 .R..L.:.K..E.
.D
161A:0130 00 B3 31 8A-05 47 3C 30-72 11 24 4F-D4 37 80 F2 ..1..G<0r.
$O.7..
161A:0140 01 75 05 4E-8A 24 D5 10-88 04 46 E2-11 80 FA 01 .u.N.
$....F.....
161A:0150 9F 75 02 4A-4E 53 50 E8-2B 00 58 5B-E3 13 4B 74 .u.JNSP.+.X
[..Kt
161A:0160 BD 9E 75 CF-42 86 04 46-EB CB BA A1-01 B4 09 CD
..u.B..F........
161A:0170 21 B4 4C CD-21 F2 AE 74-0B 53 50 E8-07 00 58 5B
!.L.!..t.SP...X[
161A:0180 09 C9 75 F1-C3 B3 01 89-F1 29 D1 B4-40 CD 21 BA ..u......)..
@.!.
161A:0190 00 02 B9 00-03 31 DB B4-3F CD 21 89-D6 89 D7 91
.....1..?.!.....
161A:01A0 C3 4E 6F 74-20 64 62 67-20 64 75 6D-70 0D 0A 55 .Not dbg
dump..U
161A:01B0 73 61 67 65-20 69 73 3A-20 78 78 64-2D 72 3C 64 sage is: xxd-r
<d
161A:01C0 62 67 66 69-6C 65 3E 63-6F 6D 66 69-6C 65 0D 0A bgfile>
comfile..
161A:01D0 64 62 67 66-69 6C 65 3A-20 67 72 64-62 20 6F 72 dbgfile: grdb
or
161A:01E0 20 4D 53 20-64 65 62 75-67 20 22 64-22 75 6D 70 MS debug
"d"ump
161A:01F0 0D 0A 4C 47-50 4C 28 63-29 4D 4A 32-30 31 38 24 ..LGPL(c)
MJ2018$
-> q

Dennis Boone

unread,
Dec 19, 2019, 9:16:11 PM12/19/19
to

> A BASIC program? No thanks.

Several variants there, but the important part is the concept:
a typable-in way to get the first tool in.

De
Reply all
Reply to author
Forward
0 new messages