; Interrupts in ATALAN
;

; Example on using Display List interrupts in Atalan.

; (c) 2010 Rudla Kudla


use atari

s@$8000:array(0..39,0..23) of byte

;24 lines of text, 4th line will execute DLI


const gr0:array of dl_command = ( 
	3 times BLANK8, 
	CHR0+LMS, s, 
	2 times CHR0, 
	CHR0+DLI, 
	20 times CHR0, 
	NEXT, gr0
	)

;Here we define the Display List Interrupt (DLI) procedure.

;It is special procedure of type dli.

;dli is procedure type based on interrupt type. 


set_col:dli =
	wait'line
	COLPF(2) = white	

;Here we define the VBI procedure.

;It is special procedure of type vbi.

;It cycles the border color.

 
cycle:vbi =
	inc	COLOR0(5)
	COLBK = COLOR0(5)		;as we are using deferred VBI, we must copy the color to hardware register

;Initialize graphics.


sdlstl = gr0
COLOR0(2) = red+8
COLOR0(5) = black

;Write some text on screen


s(1,1) = "Demonstration of Interrupts inATALAN"

;Set the inerrupts.


on'vbi cycle
on'dli set_col