Pregunta

I'm trying to create a while loop in the LC-3 assembly language environment that reads in characters or numbers and then breaks the loop when CTRL+D (x04) is typed. I know I can break the loop using brp, brn or brz for positive, negative or zero but how can I trigger a break using the end of stream (x04) hex character?

¿Fue útil?

Solución

The idea is to apply some transformation that gives a condition code you can use to determine if the value was 4. In this case, you can simply subtract 4 (that is, add -4) and check whether that results in zero or not.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top