TTKCLASS

.Page
;++
;			TrackClass will return the class (from 0 to 8) of
;		the track in IIOB+Track in the "Y" register
;
;		returns:		"Y" reg = class of track
;					"A" reg = IIOB+Track
;					"X" reg = unchanged
;--

TrkClss	.Equ *				; Entry point
	Lda	IIOB+Track		; Fetch current track value
	Ldy	#MaxClass		; Maximum class value
$21	Cmp	ClssTbl,Y		; Track >= Table entry?
	Bcs	$42			; Yep
	Dey
	Bne	$21			; Try the next track class
$42	Rts				; "Y" reg = track class value


ClssTbl	.Equ *				; Start of track class table
	.Byte 00			; Track  0:15
	.Byte 10			; Track 16:31
	.Byte 20			; Track 32:47
	.Byte 30			; Track 48:63
	.Byte 40			; Track 64:79