* Programmed I/O 2: write * ================ ^^^^^ * 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 start: move.l #-1, $140C ; Clobber status move.l #buf, $1408 ; Set buffer address move.l #4, $1404 ; Set length to write (4 bytes) move.l #1, $1400; ; Write * -------------------------------------------- Now termin0 is reading from file loop: cmpi.l #-1, $140c ; Test if status is still -1 beq loop ; Repeat testing until status changes * ------------------------------ Now termin0 has transfered one line to `buf' stop: bra stop buf: dc.b 'Hello World' end