mipsy
mipsy copied to clipboard
seperate length and format for print command
currently, the interactive print accepts these options as print_type
:
"byte" | "half" | "word" | "xbyte" | "xhalf" | "xword" | "hex" | "char" | "string" | "b" | "h" | "w" | "xb" | "xh" | "xw" | "x" | "c" | "s"
This has a few limitations. b
is used for byte so can't be used for binary
, there is no octal, hex is only lowercase.
I think separating out the base or format and the length to print would allow more control.
length:
b | byte
h | half
w | word
format
b | non-padded binary
0b | padded binary
o | non-padded octal
0o | padded octal
x | non-padded hex
0x | padded hex
X | non-padded capital hex
0X | padded capital hex
c | char
s | string
#N | non-padded base N (2-36)
Eg:
[mipsy] print $t0 half x
0xf22
[mipsy] print $t0 half 0X
0x0F22
the print command is a bit of a pig... still trying to think about what's most ergonomic. this seems a bit unergonomic having to type
print $t0 word x
just to print $t0 in hex... and print $t0 x
doesn't seem like a great option given that print _ b
is ambiguous, where b
is either byte or non-padded binary
my instinct is to borrow gdb's syntax and use
print(/{format})? {item}( {length})?
where the default format is decimal and the default length is word, which seems to match with the current defaults.
This allows for all four of the following:
print $t0
print/x $t0
print $t0 byte
or print $t0 b
print/x $t0 byte