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

460 Digital input/ouput using the eight bit user port The BBC Microcomputer contains an eight bit user port which can be connected to a wide range of devices such as bit pads and general interfacing boxes. The user port can be read from or written to in BASIC and in assembly language, but in either case the user will need to know how to use the 6522 versatile interface adapter integrated circuit. A 6522 data sheet will be essential and the user will discover that this extremely versatile chip is also quite difficult to master. What follows is essential information that you will need to work the chip rather than a course in using it.

Once you have learned to use it you will realise that at least 20 pages would be needed to give a decent introduction to it! The 6522 lives in the memory map between locations &FE60 and &FE6F. The A side is used for the parallel printer port and the B side is used for the user port. The timers and shift register are also available for the user. When writing small programs the user can address the device directly either in BASIC or in Assembly Language. However programs that address the device directly will not work on the far side of the Tube. Machine code calls are provided to address the device whichever side of the Tube the program is on.

Firstly, though, here are some programs in BASIC and assembly language to read and write to the port. 10 REM Read data in 20 REM Set Data Direction Register B 30 REM for all inputs 40 ?&FE62=0 50 REM read a value in and PRINT it 60 X=?&FE60 70 PRINT X 80 GOTO 60 The next program sets up the 6522 to output to the user port and then transfers the bottom eight bits of X to the user port. Again the initialisation need only take place once. 10 REM All outputs 20 ?&FE62=&FF 30 REM now put X out 40 ?&FE60=X And here are those two programs in assembly language. First to read data into the accumulator: 100 LDA #0 110 STA &FE62 120 LDA &FE60