Package smsqmulator

Class Helper

java.lang.Object
smsqmulator.Helper

public class Helper extends Object
This isn't really a class per se - it just contains various public static final utility routines.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final int
    Converts a string of max 4 chars to an integer, each byte is the hex of the char.
    static int
    Converts a three letter name into an "upper cased" int and adds '0' at end.
    static final int
    limit2Range(int value, int min, int max)
    Checks that a number fits between the min and max values, it not sets it to the corresponding limit.
    static final String
    regListToString(int reglist, boolean reversed)
    Converts an M68K register list (for MOVEM) to a disassembly string.
    static final void
    reportError(String title, String text, JFrame frame)
    This shows an error window with a title and a warning string.
    static final void
    reportError(String title, String text, JFrame frame, Exception e)
    This shows an error window with a title, a warning string and the Java error string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Helper

      public Helper()
  • Method Details

    • reportError

      public static final void reportError(String title, String text, JFrame frame)
      This shows an error window with a title and a warning string.
      Parameters:
      title - a string, the title of the error window.
      text - a sgtring, the error message.
      frame - a JFrame for the JOptionPane.
    • reportError

      public static final void reportError(String title, String text, JFrame frame, Exception e)
      This shows an error window with a title, a warning string and the Java error string.
      Parameters:
      title - a string, the title of the error window.
      text - a string, the error message.
      frame - a JFrame for the JOptionPane.
      e - the error to report.
    • convertUsageName

      public static int convertUsageName(String s)
      Converts a three letter name into an "upper cased" int and adds '0' at end.
      Parameters:
      s - the string to convert, eg 'nfa'.
      Returns:
      the converted int, eg the hex representation of 'NFA0', or 0 if error.
    • regListToString

      public static final String regListToString(int reglist, boolean reversed)
      Converts an M68K register list (for MOVEM) to a disassembly string. this is copied from Tony Headford's code.
      Parameters:
      reglist - the register list.
      reversed - true id list is reversed.
      Returns:
      the register list as a normal disassembly string.
    • convertStringToInt

      public static final int convertStringToInt(String toConvert)
      Converts a string of max 4 chars to an integer, each byte is the hex of the char.
      Parameters:
      toConvert - the string to convert into an int.
      Returns:
      the int which ius right filled with 0 if the length of the string is smaller than 4. If the string is longer than 4 chars long, anything after the fourth char is ignored.
    • limit2Range

      public static final int limit2Range(int value, int min, int max)
      Checks that a number fits between the min and max values, it not sets it to the corresponding limit.
      Parameters:
      value - number to check
      min - min value number may have
      max - max value number may have
      Returns:
      the number, or the corresponding limit if number would have exceeded it.