keep TinyTerm ********************************************** * June 97 by Laine Houghton * * written for assembly with orca/M * * * * This is a dumb terminal program. * * It was created to see how fast * * the buffer would fill up over * * taking the display at 19200. * * it did quite well for a 1 meg apple// * * * ********************************************** vroom start ; ; GLOBAL VARIABLES ; POKE EQU $19 ;ZERO WRITE POINTER PEEK EQU $1B ;ZERO PAGE READ POINTER PAGEW EQU $1D ;WRITE PAGE COUNTER PAGERD EQU $1E ;READ PAGE COUNTER should be S * 16 dec 32 = $20 SLOT EQU $20 ;N * 16 2*16=32 TDREG EQU $C088+SLOT ;CHAR OUT RDREG EQU $C088+SLOT ;CHAR IN STATUS EQU $C089+SLOT ;ACIA STATUS COMMAND EQU $C08A+SLOT ;SET PARMS CONTROL EQU $C08B+SLOT ;SET PARMS HOME EQU $FC58 ;CLEAR SCREEN COUT EQU $FDED ;PRINT TO SCREEN MONITOR EQU $FF69 ;APPLE MONITOR PRINTBYTE EQU $FDDA ;PRINT TO SCREEN AS BYTE KEYPRESS EQU $C000 KEYDATA EQU $C010 buff equ $1000 ; ; MAIN LDA $3FE ;GET SYSTEM IRUPT VECTOR STA RPTVCTR+1 ;STORE IN OUR PROGRAM LDA $3FF ;FOR LATER USE STA RPTVCTR+2 ;DONE LDA #IRUPT STA $3FF ;DONE Here is the main thing you want. putting your SSC driver into the interrupt vector location. You'll note my driver address is just a jsr to HANDLE which is the actual driver. LDA #BUFF ;HIGH BUFFER ADDRESS STA POKE+1 ;HIGH WRITE STA PEEK+1 ;HIGH READ LDA #$00 ;DONE STA PAGEW ;ZERO WRITE PAGE COUNTER STA PAGERD ;ZERO READ PAGE COUNTER INC POKE ;SET WRITE AHEAD OF READ this reads better LDA #0 STA STATUS ;RESET ACIA LDA #$1F STA CONTROL ;19200 8 DATA 1 STOP LDA #$09 STA COMMAND ;DTR, RUPTS, RTS, NO PARITY CLI JMP CHECK ;REMOVE ME LATER ; ;HERE IS THE ACIA SERVICE ROUTINE ; HANDLE CLC BIT STATUS ;CHECK BIT 7 BMI OURS ;ACIA HAS A CHAR SEC ;SHOW NOT OURS RTS ;AND RETURN remember IRUPT was a jsr to handle. I set the carry so the return does a bcs to RPTVCTR which is a jump to the previously installed handler. OURS BIT OFFLINE ;IS BUFFER FULL? BMI DONE ;YEP LOOSE THE CHAR this you have to do verify the char is good LDA STATUS ;FATAL ERROR CHECK AND #$0B CMP #$08 ;CHECK RDREG BEQ GOOD ;NO ERRORS LDA RDREG ;IS BAD CLEAR IT BCC DONE GOOD LDA POKE+1 ;WILL WE OVER RUN CMP PEEK+1 ;THE READER ? BNE BETTER ;GOT ROOM LDX POKE ;OPPS! CHECK INX ;LOW BYTE CPX PEEK BEQ STOP ;NO MORE ROOM BETTER LDA RDREG ;GET THE CHAR LDY #$00 STA (POKE),Y ;PUT IT IN THE BUFFER INC POKE ;BUMP THE POINTER LDA #$00 ;CROSSING A PAGE? CMP POKE BNE DONE ;NO INC POKE+1 ;YEP BUMP HI BYTE INC PAGEW LDA #$08 ;DONE 8 PAGES? CMP PAGEW BEQ WRTRST ;YEP GO TO START OF BUFFER DONE CLC ;WAS OURS RTS ;WERE FINISHED STOP DEC OFFLINE ;FULL BUFFER SHUT DOWN CLC RTS WRTRST LDA #$00 ;RESET BUFFER WRITE STA PAGEW ;POINTERS LDA #>BUFF STA POKE LDA #BUFF STA PEEK LDA # This definitely answers my main question- the interrupt vector routine > is at $03FE/$03FF, which is saved, overwritten with the HANDLE > routine's address and then called if the HANDLE routine doesn't > service the interrupt. I didn't notice if you reset the original > values at $03FE/$03FF when the program was done.. I assume you > would/should. I didn't, often using the three finger salute for a known clean slate. But yes, a well written program should restore everything they mess with. A lazy programmer should invalidate the power up byte and jump to the monitor cold start routine. From looking over some other code I had, Here's another couple of cents to add. The routine could handle 9600 all day long. A large file at 19,200 would choke it. It amazes me considering the interrup ( this being say the character 'A' in Apple) sets prodos into motion saving all kinds of register, stack, and machine state information before it hands off control to my driver. I chew on X number of bytes and tell prodos it's theirs again. Prodos restores everything it saved and hands control back to my buffer reader. The buffer reader tries to get something done before the incoming 'p' starts the whole thing over again. LDA #0 STA STATUS ;RESET ACIA LDA #$1F LDA #$1E will get you 9600 8 data 1 stop STA CONTROL ;19200 8 DATA 1 STOP LDA #$09 LDA #$08 will stop the SSC from generating interrupts STA COMMAND ;DTR, RUPTS, RTS, NO PARITY CLI