
.include "shell.inc"
.include "crc_fast.s"

run_crc:
	pha
	jsr reset_crc
	pla
	jsr update_crc_fast
	ldy #0
	lda checksum
	sta ($0),y
	iny
	lda checksum+1
	sta ($0),y
	iny
	lda checksum+2
	sta ($0),y
	iny
	lda checksum+3
	sta ($0),y
	rts
.macro crc_check crc_val,val
	lda #.lobyte(crc_val)
	sta $0
	lda #.hibyte(crc_val)
	sta $1
	lda #val
	jsr run_crc
.endmacro

main:
	crc_check crc_1,$00
	crc_check crc_2,$01
	crc_check crc_3,$02
	crc_check crc_4,$7F
	crc_check crc_5,$80
	crc_check crc_6,$81
	crc_check crc_7,$FF
	lda #$00
	jmp exit

.org $20
crc_1: .res 4
crc_2: .res 4
crc_3: .res 4
crc_4: .res 4
crc_5: .res 4
crc_6: .res 4
crc_7: .res 4
crc_8: .res 4
crc_9: .res 4
crc_10: .res 4
crc_11: .res 4
crc_12: .res 4
crc_13: .res 4
crc_14: .res 4
crc_15: .res 4
crc_16: .res 4
crc_17: .res 4
crc_18: .res 4
crc_19: .res 4
crc_20: .res 4
