Package smsqmulator
Class Helper
java.lang.Object
smsqmulator.Helper
This isn't really a class per se - it just contains various public static final utility routines.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final int
convertStringToInt
(String toConvert) 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.
-
Constructor Details
-
Helper
public Helper()
-
-
Method Details
-
reportError
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
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
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
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
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 checkmin
- min value number may havemax
- max value number may have- Returns:
- the number, or the corresponding limit if number would have exceeded it.
-