| Issue 4: | Behavior of JmpLE | |
| 1 person starred this issue and may be notified of changes. | Back to list |
This program works to fill 32 bytes of memory with 0xAA
org 0x60
Data: bss 0x20
Filler: bss 0x01
InitVal:
db 0xAA
org 0x00
sip 0x00
load r1,1
load r0,Filler
load r2,Data
load r3,[InitVal]
Loop: istore r3,[r2]
add r2,r2,r1
jmpEQ r2=r0,Done
jmp Loop
Done:
halt
This program never terminates (Since comparand value in R0 is treated as 2's complement -128)
org 0x60
Data: bss 0x1F
Filler: bss 0x01
InitVal:
db 0xAA
org 0x00
sip 0x00
load r1,1
load r0,Filler
load r2,Data
load r3,[InitVal]
Loop: istore r3,[r2]
add r2,r2,r1
jmpLE r2<=r0,Loop
Done:
halt
Oct 22, 2012
Project Member
#1
vance.mo...@gmail.com
Status:
Started
Oct 22, 2012
Just playing with bug tracker settings.
Owner:
vance.mo...@gmail.com
Oct 22, 2012
From Clock.java:
...
/**
* Opcode F - JMPLE
* @param register
* @return
*/
private boolean jmple(int register) {
int value = Integer.parseInt(controller.getRegisterValue(register),16);
int registerZero = Integer.parseInt(controller.getRegisterValue(0),16);
if (registerZero > 127) {
registerZero -= 256;
}
if (value > 127) {
value -= 256;
}
if (value <= registerZero){
return true;
} else {
return false;
}
}
...
No idea why we thought this was a good idea.
I commented out the two if statements that were converting both register 0 and the comparison register to signed values. Ran the example code in this bug report and it worked just fine.
Status:
Fixed
|