Jump to content

Signetics 2650 & 2636 programming/Tutorial code - background grid

0% developed
From Wikibooks, open books for an open world

Tutorial code - Background grid

[edit | edit source]

This is the code for the tutorial Background grid

reset_vector:
        bcta,un	reset
interrupt_vector:
        retc,un	        ;just in case an interrupt occurs before we disable them
reset:	
        lodi,r0 $20	;initialise program status word, just to be sure!
        lpsu            ;inhibit interrupts, stack pointer=0
        lpsl            ;register bank 0, without carry, arithmetic compare

        eorz	r0
        stra,r0	effects   ;initialise the 74LS378
	
        bsta,un InitPVI   ;initialise video chip

endless:
        bctr,un endless   

;===================================================================
; subroutine - initialise PVI
InitPVI:
        eorz	r0		;r0 = 0
        lodi,r3	$CA		;set 1F00-1FC9 to 00 (most of PVI)
loop1:			        ;sets all colours to black, turns off sound, score 1 field at top.
        stra,r0	shape1,r3-
        brnr,r3	loop1

        lodi,r0 $78
        stra,r0 coloursback

        lodi,r0 $FF
        stra,r0 score12
        stra,r0 score34

        lodi,r3 $2D
loopIS:			;load sprite shape and coords
        loda,r0 one,r3-
        stra,r0 grid,r3
        brnr,r3 loopIS


        retc,un

	
one:			
        dw	$FFFF	; 1
        dw	$FFFF	; 2
        dw	$FFFF	; 3
        dw	$FFFF	; 4
        dw	$FFFF	; 5
        dw	$FFFF	; 6
        dw	$FFFF	; 7
        dw	$FFFF	; 8
        dw	$FFFF	; 9
        dw	$FFFF	; 10
        dw	$FFFF	; 11
        dw	$FFFF	; 12
        dw	$FFFF	; 13
        dw	$FFFF	; 14
        dw	$FFFF	; 15
        dw	$FFFF	; 16
        dw	$FFFF	; 17
        dw	$FFFF	; 18
        dw	$FFFF	; 19
        dw	$FFFF	; 20

                        ; EXTEND x1,2,4           EXTEND x8
                        ; -------------    -----------------------
        db	$09     ; Rows 1-4	   4B	4A   3	2B  2A	1
        db	$09     ; Rows 5-8	   8B	8A   7	6B  6A	5
        db	$09     ; Rows 9-12	   12B	12A  11	10B 10A	9
        db	$09     ; Rows 13-16	   16B	16A  15	14B 14A	13
        db	$09     ; Rows 17-20	   20B	20A  19	18B 18A	17