The YGREC8's Manual : the IN opcode

Created dim. 29 oct. 2023 23:40:23 CET by whygee@f-cpu.org

PRELIMINARY / WORK IN PROGRESS


Encoding

15141312 111098 7654 3210
1 1 0 0 Imm9 SND

Description

This is the complementary instruction to the OUT opcode.

This opcode reads the I/O register space at the address given by the 9-bit Imm9 field and writes the value to the core register given by the SND field.

Unimplemented addresses are not reported (no trap/error).

Effects

IN does not affect the Carry, Sign or Zero flags.

However reading from the I/O space could have all kinds of side effects, be careful where you read.

Forms

This is a core operation that supports only the Imm9 format, with no condition/inhibition.

No indirect/register address form is provided, keeping decoding as fast as possible. This could change in the future (with a PF option? with a dedicated IO index register?) but so far, it's already enough (and messy) to get it going.

Example

IN 123 R3 ; read IO register #123 and write the value to R3