Professional Documents
Culture Documents
Which Memory?
Memory addresses xffff0000 and above are used for I/O devices. The device controller has registers. These registers are given a memory address. Recall that the processor is attached to a bus, memory is attached to the bus, I/O devices are attached to the bus.
When the bus sees certain addresses, it knows they are not memory addresses, but are addresses for accessing I/O devices.
The receiver control will have a 1 in the rightmost bit when there is a value ready to be read. It will have a 0 in that bit otherwise. The receiver data will have the character pressed on the keyboard (only when the receiver control has a 1 in the rightmost bit)
Polling
To read, you go: do you have something now? Now? Now? Now? Ok now read the value. li $t4, 0xffff0000 #rec. control addr again: lw $t1,0($t4) #get rec. control value andi $t1, $t1, 1 #get rightmost bit beqz $t1, again #if not ready check again lw $t0, 4($t4) #get char. from rec. data
Display
Again 2 registers
Transmitter control (0xffff008) Transmitter data (0xffff000c) li $t4, 0xffff0000 again: lw $t1, 8($t4) andi $t1,$t1,1 beqz $t1,again sw $t0, 12($t4)