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

Commodore 1571 firmware
ROM Signature Check

        .page
	.subttl "signature.src'

; test 256k-bit of rom
; using signature generation test bits 15,  11,  8,  6
; exit if ok

signature
	php
	sei		; no irqs
	ldx  #0
	stx  $00  	; sig_lo
	stx  $01        ; sig_hi
	lda  #3		; skip checksum & signature bytes
	sta  ip		; even page
	tay		
	lda  #$80	; start at $8000
	sta  ip+1	; high order
2$	lda  (ip),y	; get a byte
	sta  $02  
	ldx  #8		; 8 bits in a byte right?
3$	lda  $02  
	and  #1		; bit 0
	sta  $03  
	lda  $01  	; get sig_hi	
	bpl  4$		; test bit 15
	
	inc  $03  
4$	ror  a 
	bcc  5$		; test bit 8

	inc  $03  	
5$      ror  a
	ror  a
	ror  a
	bcc  6$
	
	inc  $03  
6$	lda  $00  	; sig_lo
	rol  a
	rol  a
	bcc  7$		; test bit 6
	
	inc  $03  
7$	ror  $03  	; sum into carry
	rol  $00  	; carry into bit 0 low byte
	rol  $01  	; carry into bit 0 high byte

	ror  $02  	; ready for next bit
	dex
	bne  3$

	inc  ip 	
	bne  2$

	inc  ip+1	; next page
	bne  2$

	dey
	dey
	dey		; .y = 0

	lda  $00  
	cmp  signature_lo
	bne  sig_err

	lda  $01  	
	cmp  signature_hi
	bne  sig_err

	sty  $00  	; clear
	sty  $01  	
	sty  $02  	
	sty  $03  

	plp
	rts


sig_err ldx  #3		; 4 blinks
	stx  temp
	jmp  perr	; bye bye ....

[Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated September 05, 2020.