.segment "NMI" nmi sei ;no irq's allowed... jmp (nminv) ;...could mess up cassettes nnmi pha txa pha tya pha nnmi10 lda #$7f ;disable all nmi's sta d2icr ldy d2icr ;check if real nmi... bmi nnmi20 ;no...rs232/other ; nnmi18 jsr a0int ;check if $a0 in...no .y bne nnmi19 ;...no jmp ($8002) ;...yes ; ; check for stop key down ; nnmi19 jsr ud60 ;no .y jsr stop ;no .y bne nnmi20 ;no stop key...test for rs232 ; ; timb - where system goes on a brk instruction ; timb jsr restor ;restore system indirects jsr ioinit ;restore i/o for basic jsr cint ;restore screen for basic jmp ($a002) ;...no, so basic warm start ; disable nmi's untill ready ; save on stack ; nnmi20 tya ;.y saved through restore and enabl ;show only enables tax ;save in .x for latter ; ; t1 nmi check - transmitt a bit ; and #$01 ;check for t1 beq nnmi30 ;no... ; lda d2pra and #$ff-$04 ;fix for current i/o ora nxtbit ;load data and... sta d2pra ;...send it ; lda enabl ;restore nmi's sta d2icr ;ready for next... ; ; because of 6526 icr structure... ; handle another nmi as a subroutine ; txa ;test for another nmi and #$12 ;test for t2 or flag beq nnmi25 and #$02 ;check for t2 ; jmp nnmi25 ;...then continue output ; nnmi25 jmp nmirti ; ; t2 nmi check - recieve a bit ; nnmi30 txa and #$02 ;mask to t2 beq nnmi40 ;no... ; jmp nmirti ; flag nmi handler - recieve a start bit ; nnmi40 txa ;check for edge and #$10 ;on flag... beq nmirti ;no... ; nmirti lda enabl ;restore nmi's sta d2icr prend pla ;because of missing screen editor tay pla tax pla rti