Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  One easy way to manipulate hex numbers is to let interpreted BASIC do the
  work. To do this, activate the BASIC interpreter and use the command mode
  (without line numbers) to enter any operations you want to perform.

  To display the hexadecimal equivalent of a hex number, such as 1234H, you
  can simply do this:

  PRINT &H1234

  Be sure to prefix any hex number with &H so that BASIC knows it is a hex
  number. To get the best display of decimal numbers, particularly large
  numbers, use the PRINT USING format, like this:

  PRINT USING "###,###,###"; &H1234

  To display the hexadecimal equivalent of a decimal number, such as 1234,
  you can simply do this:

  PRINT HEX$( 1234 )

  The examples so far have used only decimal and hex constants. You can as
  easily have BASIC perform some arithmetic and show the result in decimal
  or hexadecimal. Here are two examples:

  PRINT USING "###,###,###"; &H1000 - &H3A2 + 16 * 3
  PRINT HEX$(17766 - 1492 + &H1000)

  By using variables to hold calculated results, you can avoid having to
  retype an expression or a complicated number. Variables that hold hex
  numbers should always be written as double-precision variables (with a #
  at the end of the variable name) so that you get the maximum accuracy. For
  example:

  X# = 1776 - 1492 + &H100
  PRINT USING "###,###,###"; X#, 2 * X#, 3 * X#

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson