end
endcase
end
- `INSN_RET: begin
+ `INSN_RET,`INSN_RETCC: begin
case (cycle)
0: begin
rd <= 1;
end
1: begin // SPECIAL CASE: cycle does NOT increase linearly with ret!
`EXEC_INC_PC;
- if (opcode != `INSN_RETCC)
- $stop;
case (opcode[4:3]) // cycle 1 is skipped if we are not retcc
`INSN_cc_NZ: if (registers[`REG_F][7]) begin `EXEC_NEWCYCLE; end
`INSN_cc_Z: if (~registers[`REG_F][7]) begin `EXEC_NEWCYCLE; end
end
`INSN_RET,`INSN_RETCC: begin
case (cycle)
- 0: if (opcode != `INSN_RETCC)
+ 0: if (opcode[0]) // i.e., not RETCC
cycle <= 1; // Skip cycle 1; it gets incremented on the next round.
1: begin /* Nothing need happen here. */ end
2: registers[`REG_PCL] <= rdata;
.cplfail:
db "CPL",0
.testfailed:
- db "test failed.",$0D,$0A,0
+ db " test failed.",$0D,$0A,0
.ok:
db "OK!",$0D,$0A,0
ld a, [hli]
ld b, $00
cp b
- jr z, .done
+ ret z
call putc
jr puts
-.done:
- ret
-