How do I convert a hexadecimal offset to a two-byte pointer in VB.NET? -
i'm working on specialty hexadecimal editor includes z80 two-byte pointer converter.
the mathematics behind conversion so:
- take offset wish point to.
- take last 4 digits of offset, , cut off rest.
- if offset outside range
&h4000
-&h7fff
, must converted this:(offset % &h4000) + &h4000
. in other words:- if offset
&h0000
&h3fff
, add&h4000
offset. - if offset
&h4000
&h7fff
, not offset. - if offset
&h8000
&hbfff
, subtract&h4000
offset. - if offset
&hc000
&hffff
, subtract&h8000
offset.
- if offset
my problem don't know how turn 5 or 6-digit hex offset two-digit offset. how shave off bytes @ beginning (step two)?
with "remainder" operator, spelled mod
in visual basic:
offset mod &h10000
Comments
Post a Comment