Skip to content
This repository was archived by the owner on May 24, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -979,6 +979,40 @@ private short getVbState() {
return vbState;
}

private short converIntegerToTextString(short intPtr, byte[] scratchPad) {
// Prepare Hex Values
short index = 1;
scratchPad[0] = 0x30; // Ascii 0
while(index < 10) {
scratchPad[index] = (byte) (scratchPad[(short) (index - 1)] + 1);
index++;
}
scratchPad[index++] = 0x41; // Ascii 'A'
while(index < 16) {
scratchPad[index] = (byte) (scratchPad[(short) (index - 1)] + 1);
index++;
}


short intLen = KMInteger.cast(intPtr).length();
short intOffset = KMInteger.cast(intPtr).getStartOff();
byte[] buf = repository.getHeap();
short tsPtr = KMTextString.instance((short) (intLen * 2));
short tsStartOff = KMTextString.cast(tsPtr).getStartOff();
index = 0;
byte nibble;
while (index < intLen) {
nibble = (byte) ((byte) (buf[intOffset] >> 4) & (byte) 0x0F);
buf[tsStartOff] = scratchPad[nibble];
nibble = (byte) (buf[intOffset] & 0x0F);
buf[(short) (tsStartOff + 1)] = scratchPad[nibble];
index++;
intOffset++;
tsStartOff += 2;
}
return tsPtr;
}

private short getBootParams(byte bootParam, byte[] scratchPad) {
short value = KMType.INVALID_VALUE;
switch (bootParam) {
Expand All@@ -1000,10 +1034,7 @@ private short getBootParams(byte bootParam, byte[] scratchPad) {
}
// Convert Integer to Text String for OS_VERSION.
if (bootParam == OS_VERSION_ID) {
value =
KMTextString
.instance(KMInteger.cast(value).getBuffer(), KMInteger.cast(value).getStartOff(),
KMInteger.cast(value).length());
value = converIntegerToTextString(value, scratchPad);
}
return value;
}
Expand Down