Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF

461 and secondly to write data out to the user port. This time the program is presented as two subroutines. The first, called INIT , sets up the 6522 and the second subroutine, WRITE , actually puts the data out from the accumulator onto the user port. 200 .INIT LDA #&FF 210 STA &FE62 220 RTS 230 .WRITE STA &FE60 240 RTS As has been made clear above, these programs will not work from the second processor. The 6522 is one of the memory input/output devices in the area of memory referred to as SHEILA.

SHEILA controls the section of memory map in the range &FE00 to &FEFF, and the VIA (versatile interface adaptor) uses addresses between &FE60 and &FE6F which are therefore SHEILA+&60 to SHEILA+&6F. Two OSBYTE calls (see chapter 43) are provided to read and write to SHEILA. Here are the same two routines shown above but written so that they will work over the Tube. 100 LDA #&97 \OSBYTE to write to SHEILA 110 LDX #&62 \Offset to Data direction reg. 120 LDY #0 \Value to be written 130 JSR &FFF4 \Call OSBYTE 140 LDA #&96 \OSBYTE to read from SHEILA 150 LDX #&60 \Offset to data register 160 JSR &FFF4 \Call OSBYTE to get value And the next routine to INIT and WRITE to the user port:

200 .INIT LDA #&97 \OSBYTE to write to SHEILA 210 LDX #&62 \Offset to Data direction register 220 LDY #&FF \All outputs 230 JSR &FFF4 \Call OSBYTE 240 RTS 250 .WRITE TAY \Move value to Y 260 LDA #&97 \Write-to-SHEILA code 270 LDX #&60 \Offset to data register 280 JSR &FFF4 \OSBYTE call 290 RTS In practice the user will often wish to use the handshake lines with data transfers. For information on this topic you are referred to other books. Space simply does not permit an adequate explanation here.