[Contents] [Commodore] [New] [Search] [Home]

Commodore 1571 firmware
Null Buffer

        .page
        .subttl 'nulbuf.src'          
;*********************************
;* nulbuf: set null records in   *
;*         act-buf for extention *
;*    vars:  nr,rs,lx,act-buf    *
;*      in: nr= last record      *
;*          position in previous *
;*          buffer.              *
;*     out: nr= last record      *
;*          position in buffer   *
;*          for next nulbuf or   *
;*          to set lstchr.       *
;*********************************

nulbuf           
        jsr  set00      ; set indirect ptr
        ldy  #2          
        lda  #0          
nb10             
        sta  (dirbuf),y ; clear buffer
        iny      
        bne  nb10        

        jsr  addnr      ; advance nr
nb20             
        sta  nr,x        
        tay      
        lda  #$ff        
        sta  (dirbuf),y ; init record cr
        jsr  addnr       
        bcc  nb20       ; not done

        bne  nb30        
        lda  #0          
        sta  nr,x        
nb30             
        rts      

; add rs & nr, leave in accum
; c=1: cross buffer boundary

addnr            
        ldx  lindx       
        lda  nr,x        
        sec      
        beq  an05        

        clc      
        adc  rs,x        
        bcc  an10        
        bne  an05        
        lda  #2          
        bit  er00        
        rts      

an05             
        adc  #1         ; adjust for link
        sec      
an10             
        rts


[Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated March 24, 1998.