* Programmed I/O: READ * ============== ^^^^ * CPU is doing the I/O operation... * - basically, the CPU runs a program that achieves transfer of * - the data from I/O device <--> memory * * I/O device is termin0 (keyboard), memory mapped as follows: * * $1400 = command register - 0 = read, 1 = write * $1404 = length register * $1408 = address register * $140C = status register * xdef start, stop xdef buf, len start: move.l #-1, $140C ; Clobber status move.l #buf, $1408 ; Set buffer address move.l #0, $1400; ; Read * -------------------------------------------- Now termin0 is reading from file rloop: cmpi.l #-1, $140c ; Test if status is still -1 beq rloop ; Repeat testing until status changes * ------------------------------ Now termin0 has transfered one line to `buf' normal: move.l $1404, len ; get length of string read stop: bra stop buf: ds.b 80 len: ds.l 1 end