P730 CEEFAX 730 Wed 3 Feb 21:00/26 |B2201212|a17T/SWR14|i14TEXT|m10|s÷n1÷e Mastering Sideways NLRAMMM M Unrecognised Interupts  ---------------------------------------- ----------- A o the 6502 processor informing it that a  requires immediate attention. I not recognised by the operating system are first offered to  then to thf user via the IRQ2 vector. Service call 5 is used to offer unrecog nised interupts to the paged  ecause an interupt could be generated by almost any device,  o identify the source of an intfrupt  hout  that might be responsible for  g it. ISWR gram to process interupts it must  ept service call 5 and poll the hardware that it expects to  to see if that device was responsib|c
P730 CEEFAX 730 Wed 3 Feb 21:02/02 |B2202212|a17 ^SRTEXTD ele for the  f so process itN If you do not want the interupt to be offered to the other roms the acculvlator should be  before returningN Always return from an unrecognised RTS RTI. O o the BBC Micro is to use the 6522  tile interface adaptor (VIA)N There are two 6522 VIAs in the BBC BNVIAA d for internal functions and the joystic k fire buttons. VIAB lel printer interface and the sser portN P ice connected to VIA-B, and a  ffer will be ssfd to demonstrate how int erupts generated by  n be intercepted and processed in sidfwa ys ram. TBUFFER generate an object codf file just  &100 bytes longN ghfn the object code i s loadfd into SWR it uses 
P730 CEEFAX 730 Wed 3 Feb 21:03/35 |B2203212|a17T/SgR14|i14TEXT|m36D8|s÷n1÷ eing 15.75k in the ram bank as a paralle l printfr buffer.  sed in this way thf sizf of the object c ode NF r this reason a number of  e been used in the source code to make t he object code  memory. TSR uffer is as small as it can beN All the optional coding has been left out. There is no binary version number,  ng, version string, copyright mfssage or tubf relocation NJ tial fump to the service entry point, ro m typf  d jhnimum copyright string (linfs  0)N Reseting the user print vector is do ne with the minimum of  the Osbyte &A8 call out of the object co de (lines T erpreter does not implement * commands o enable the buffer but instfad inte|c
P730 CEEFAX 730 Wed 3 Feb 21:03/42 |B2204212|a17T/SkR14|i14TEXT|m3A43|s÷n1÷ ercepts service call &FE (tube  st initialisation) to set up the user pr int extended vector  ter buffer code (lines 470-710). T se the buffer load the object codf into SWR and press the Break S l &FE is always issued on resbt and so t he buffer will  you press Break. A Break key type *FX5,3 to enable the buff erN Thf  al but with a 15.73k bufferN Typf FX or press Ctrl+Break to disable thf buff er after printing has  The buffer was designed to be used with an Epson parallel printer  e suitable for other parallel printfrs u nless they use C col as the Epson range (most parallel  inters use the Centronics protocol)N It is snsuitable for all serial  d I suspect that the early versions |c
P730 CEEFAX 230 Wed 3 Feb 21:10/00 |B2205212|a17 SCR14|i14 @XT|m3DAE|s÷n1÷ eof the Solidisk  not allow this program to work properly , I the program with one to confirm  picion. T ally usdd to provide a printer driver  r printers which do not have either a Ce ntronics parallel or a  nterfaceN With this printer b0ffer progr am the qser  prhlter buffer with the SkR buffer and p he  T am rfads data from thd printer b1ffer us ing Osbyte  tes it into the ScR buffer 5r—n£ a  er (line 1080) to indicate the position in SGR to store each @NT e data is rdad from the ScR buffer prhng another  the byte —o be written into the VIA-B rinter output register chen a bytd is r ecieved by the printer the F
P730 CEEFAX 730 Wed 3 Feb 21:14/38 |B2206212|a17T/SkR14|i14TEXT|m41119|s÷n1 ÷ege line goes low and generates an IRQ interuptN This is the  rupt processed by the program. T inters are updated with every rfad and w rite of the SWR buffer  r reaches &C000 it is reset to &8100 (li nes 900-920  he last character in the buffer has bebn  elf dormant and the MOS is  g Osbyte &7B (lines 1350-1470)N ghen all the data is SW R buffer the computer is released to  tinue with other tasks but you must not press the Break kfy or use FX l printing has bfen completed. You can c ontinue with any  ssing or programlhng while the printer i s using SR TVIA llel printer intfrface is quite  x device controled by 16 rfchstersN |c
P730 CEEFAX 730 Wed 3 Feb 21:15/52 |B2207212^SRTEXT ÷eThe VIA-B rfgisters are S eila addrfsses &60 to &6F as shown in fi gure 14.1 M ------------------+ FEFAIO ut (no handshake) !  ------------------------------+ FEE Interupt control !  +----------------------------------- --+ FEDI !  --------------+ FECP ol (handshake) !  --------------------------+ FEBA liary (timer/shift reg) control !  +-------------------------------------+ &FE6A ! Shift register !  ----------+ FETMSB a M ----------------------+ FET LSB latch/counter ! M ----------------------------------+ 
P730 CEEFAX 730 Wed 3 Feb 21:00/05 |B2208212417ED|s÷n1 ÷e&FE67 ! Timer 1 MSB latch !  ------------+ FE hmer 1 LSB latch !   1 MSB latch/countdr !  ------------------------------------+ F E64 ! hmer 1 LSB latch/counter !   !  --------------------+ FED register B a   ! A Input/Output ! +--------------------------------- ----+ FEBIO a  ----------------+ FTVIA B registers  ---- BVIAIO ouped into an A side and a B side of|c
P730 CEEFAX 730 Wed 3 Feb 21:00/08 |B2209212 ÷e T ided into 8 data lines and 2 H ines Thf data lines are called PA0 to P A7 on the A side PBPBB side. The handshake lines are called CA 1 and CAACBCB on the B side The BBC Micro qses A side of VIA-B for the printdr interface and the B side of VIA-B  t PA0 to PA7 are used as the output dat a lines for CA usfd for thd printer acknowledge and CA 2  T buffer program qses the outp0t register at &FE61, the  er at &FE6C, the interupt status registe r at FDD ster at &FE6E. T register is usfd to set qp the handshak ing  d line 1150). Thd number &0A is  n the least significant nybble of th|c
P730 CEEFAX 730 Wed 3 Feb 21:04/10 |B220A212|a17$^SgR14|i14TEXT|m41EC1|s÷n1 ÷eis register and this has  sending a strobe pulse (CA2 low) to the printer for 1 MH following a write to the output refhster at FETC ires a strobe pulsf width of at  5 micro seconds at the recieving terlhna l. The peripheral  own in figure 14.2 with bits 1 and 3 set (see  ine 1550).  4 3 2 1 0 -------+-------+-------+-------+-------+ -------+-------+-------+ CB ! CB1 ! CA2 ! CA1 !  rol! control !control!  -----+-------+-------+-------+-------+-- -----+-------+-------+  1 0 1 0 &0A FT l control (handshake) register. 
P730 CEEFAX 730 Wed 3 Feb 21:06/35 |B220B212 ÷e------- ----------------------------- --------------- T e is connected to CA1 and is used to gen erate an  ecieved data and is ready to accept  data from the printer buffer. The Centr onics protocol takes the  f low for about 12 micro sfcondsN CA1 is rfset to zero  register (lines 1490-1510 and line 1550 ) and  spt status register will be set to 1  n the voltage on the CA1 input line goes from high to lowN CA1 will  the interupt status register and genera te an IRQ interupt CA status register has been set. Bit 2 (CA 1) is set N y storing &82 in the control register as  e 1560)N Bit 2 of the control  an be cleared by clearing bit 7 and |c
P730 CEEFAX 730 Wed 3 Feb 21:12/56 |B220C212|a17T/SWR14 ÷esetting bit 2, ie. by  control register (lines 1420-1430).  1 0  -+-----+-----+-----+-----+ IRQT 1 ! T2 ! CB1 ! CB2 ! SR ! CA1 ! CA2 ! Interupt status  -----+-----+-----+-----+-----+ SC r! T1 ! T2 ! CB1 ! CB2 ! SR ! CA1 ! C A2 ! Interupt control M ----+-----+-----+-----+-----+-----+  1 0 0 0 0 0 1 0 &82 FI tus and control registers.  -------------------------------------- T k as a pair and the status  nterrogated by the buffer program to see if the printer  rupt (lines 1140-1160). If bits 1 and 7 of the  the printer was not the source of th|c
P730 CEEFAX 730 Wed 3 Feb 21:02/00 |B220D212|a17T/SkR14428FF|s÷n1 ÷ee  the MOS with all the rechster  (line 1160, lines 1280-1300 and lines 64 0-710). If the  ed with *FX5,3 control is also ret2rned to MOS 1300 and lines 640-710). DD BUFFER REM CGH 1987 MODE HIMEMC  DIM savf 50 H DEM  0 romnumber=&F4   ptv=&222   r=&8100 FE  hake=&FE6C FED  rol=&FE6E FFF  =&FFF7 AA X Y &FF USRANDFFFF DIV236 FORTOSTEP  230 P%=HIMEM [OPT  0 BRK BRK  BRK JMP OPTFN 
P730 CEEFAX 730 Wed 3 Feb 21:02/25 |B220E212|a17$^SgR14|i14TEXT|m42C69|s÷n1 ÷e OPT FNequb((copyright+diff) M OD 256)  B RK OPTFNC  BRK  B RK  PHA  0 TXA PHA  TYA PHA  TSX LDAX  CMP £3 BEQ 470 CMP £&FE BNE exit LDAM OD 256 STA  10 LDA £(buffer+diff) DIV 256 520 STA extvec+&34  LDA romnumbfr STA +&35 LDA  STA datin+diff+1 STA in+diff+2 STA 1 STA  LDX £&33 LDYFF 620 STX sptv STY uptv+1  PL
P730 CEEFAX 730 Wed 3 Feb 21:04/00 |B220F212|a17T'SkR14|i14 @XT|m42FD3|s÷n1 ÷eA TAY PLA 680 TAX PLA  0 .return RTS   r CPY BNE return CH@  BNE active STA f  PHA  TXA PHA  TYA PHA   loop 810 LDY dati. diff+2  0 LDX dath. diff+1  INX BNE  INY 900 CPY £&C0  BNE nottop LDY 930 .nottop CPX diff+1 BNE  CPY datout+diff+2  BE  SEC N %frespace TYA  PHA LDA £&91  LDX £3 JSR  50 PLA B B in
P730 CEEFAX 730 Wed 3 Feb 21:05/36 |B2210212|a17 ^SWRTEXTD ÷enerloop  STY pointer INC 1100 STA dathn+diff+2  CLC BCC  130 .interupt LDA  50 BIT status BEQ restore LDA  CMP £3 BNE  LDA +diff BNE  LDA £&82 BIT 1250 BNE notpoll   270 BCC outerloop  CLC BCC t  PHP  0 LDA £0 STAR diff LDA  0 CMP datout5diff+1  BNE output LDAR f+2 CMP  0 BNE output PLP 1420 LDX £2 ST
P730 CEEFAX 730 Wed 3 Feb 21:05/59 |B2211212|a17 ^SWRTFXTA ÷eX control LDAB  INX JSR  470 JMP restore+diff  ut LDA  AND £&F0 ORAA  20 LDX £&82   LDY pointer STA ndshake STX  STY printout INC atout+diff+1 BNE 1600 LDY datout+diff+2  INY CPYC  BNE moreroom LDY 81  STY out+diff+2   PLP BCS  BCC step& 1710 .lastbyte ] 1730 NEXT INPUTS "filename$ IFNEND  60 $save="SAVE "+filename$+" "+STR$|÷(HI MEM)+" "+STR$|÷(las FFFF 000 FFFF8000b XMOD 
P730 CEEFAX 730 Wed 3 Feb 21:00/11 |B2212212|a17 SWRTEXTAF ÷e 1780 Y%=savf DIV 256 OPT  800 CALL oscli OPT END 1830 DEFFNequb(byte) #P  0 P%=P%+1  DEFFN  rd) #PMOD P rd DIV 256 PP   20 DEFFNequd(double) P  940 P%=P%S4  DEFFN string$) P PPL EN(string$)  