Where is -32768 from?

This is the LC3 build code I'm working with

.ORIG x3000
LOOP LDI R0, KBSR 
BRzp LOOP

From LC3 Assembly , I know that LDI is the indirect addressing mode of the load, that is, it is read in the address stored in the place, and then read the value in this place

From the Lc3 Keyboard , I know that KBSR is the keyboard status register, which is one when the keyboard received a new character.

Here is my test run in the Lc3 simulator? I entered the character 'a'enter image description here

After executing LDI R0, KBSR, register 0 stores the value -32768.

Does anyone know, based on my definitions for ldi and KBSR, where does this number come from? I was expecting something like 1 to be saved because the keyboard received a new character.

+1
1

KBSR ( ) 15 , , 0b1000_0000_0000_0000 ( 0x8000)... - 2 - -32768 .

+3

All Articles