So I need a hex-editor/viewer of some kind.
There are plenty of tools but pretty much all of them requires installation and has lots of functionality I don't require as I just need to glace at the content. That's all.
Some years ago I made this little BB4W program and now decided to publish it for the benefit of others.
Code: Select all
MODE 12 : OFF
W%=@vdu%!208 / @vdu%!216 : H%=@vdu%!212 / @vdu%!220 - 2 : S%=W%*H%/4
DIM C&(W%/2-1),B% 260
*SYS 1
SYS "DragAcceptFiles",@hwnd%,1 : PRINT "Drop file onto this screen to display."
ON SYS RETURN
REPEAT
WAIT 20
Q%=INKEY(0)
IF @msg%=563 THEN
K%%=0 : Q%=0
SYS "DragQueryFile",@wparam%,0,B%,260
SYS "DragFinish",@wparam%
@msg%=0
ENDIF
IF Q%=130 IF K%% K%%=0 : Q%=0
IF Q%=131 IF E%%-1>L%% K%%=INT(E%%/S%)*S% : Q%=0
IF Q%=132 IF K%% K%%-=S% : Q%=0
IF Q%=133 IF E%%-1>L%% K%%=L%%+1 : Q%=0
IF Q%=0 THEN
CLS : R%=0 : T%=0
IF INSTR($$B%,".")=0 $$B%+="."
F%=OPENIN$$B%
PTR#F%=K%% : E%%=EXT#F%
WHILE NOT EOF#F% AND VPOS<H%
C%=BGET#F%
C&(POS/2)=C%
VDU 17,2,17,128
IF C%<32 VDU 17, 1 : C%+=64 : R%+=1
IF C%>127 VDU 17,135 : C%-=128 : T%+=1
IF C%=127 VDU 17,134 : C%=32
IF C%<32 VDU 17, 1 : C%+=64
VDU C%,32
IF POS=0 OR EOF#F% THEN
IF POS=0 Z%=W%/2 ELSE Z%=POS/2:PRINT
VDU 17,7,17,128
FOR I%=0 TO Z%-1 : PRINT CHR$17 CHR$(7+8*(I% MOD 2)) RIGHT$("0"+STR$~C&(I%),2); : NEXT
ENDIF
ENDWHILE
CLOSE#F%
IF E%%>K%%+S% L%%=K%%+S%-1 ELSE L%%=E%%-1
SYS "SetWindowText",@hwnd%,"Byte "+STR$(K%%+1)+" until "+STR$(L%%+1)+" from "+STR$E%%+". Displayed are "+STR$(L%%-K%%+1)+\
\ " bytes (including "+STR$R%+" CTRL and "+STR$T%+" high). ["+$$B%+"]"
IF K%%>0 PRINT TAB(0,H%+1) CHR$17 CHR$3 "[Page Up] [Home]";
IF E%%-1>L%% PRINT TAB(W%-21,H%+1) CHR$17 CHR$3 "[End] [Page Down]";
ENDIF
UNTIL FALSE
I hope you find it useful and please let me know when you discover a problem/bug or have a suggestion for how to improve the coding itself.
Regards,
Mike