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:

  1. take offset wish point to.
  2. take last 4 digits of offset, , cut off rest.
  3. 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.

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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -