Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.

Quick

  • ($a, $b....) = unpack("A2A7...", $packed)
  • push( array, list )

Friday, October 21, 2011

AAD and AAM

You can use AAD and AAM (ASCII adjust for Division/Multiplication) to do quick decimal-binary conversions for numbers 0-99.

Suppose AX = 0506h (representing decimal digits 5 and 6 for the decimal number 56)

then AAD will set AX = 0038h (56d)

and then AAM will set AX = 0506h.

So AAD converts 2 digits in AX to binary in AL, and AAM converts binary in AL to 2 digits in AX.

(Once you've got your two digits you can easily turn them into ASCII characters by adding 30h to each byte and adjusting for the characters between '9' and 'A').

Followers

Blog Archive