100% developed

Signetics 2650 & 2636 programming/Tutorial code - objects

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Tutorial code - Objects[edit | edit source]

This is the code for the tutorial Objects


reset_vector:
        bcta,un	reset
interrupt_vector:
        retc,un
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 $02
        stra,r0 scoreformat	
        lodi,r0 $aa		;blank the score digits
        stra,r0 score12
        lodi,r0 $aa
        stra,r0 score34

        lodi,r0 $78		;screen black
        stra,r0 backgnd

        lodi,r0	%00000011
        stra,r0 colours12	; obj 1 white, 2 red
        lodi,r0	%00101001
        stra,r0 colours34	; obj 3 green, 4 yellow

        lodi,r0	%11100100
        stra,r0 objectsize

        lodi,r3 $0E
loopISe:			;load object descriptors
        loda,r0 one,r3-
        stra,r0 shape1,r3
        loda,r0 two,r3
        stra,r0 shape2,r3
        loda,r0 three,r3
        stra,r0 shape3,r3
        loda,r0 four,r3
        stra,r0 shape4,r3
        brnr,r3 loopISe	

        retc,un
	
one:			
        db	$08
        db	$18
        db	$08
        db	$08
        db	$08
        db	$08
        db	$08
        db	$08
        db	$1c
        db	$1c
        db	10	;hc
        db	10	;hcb
        db	20	;vc
        db	20	;vcb
two:			
        db	$1c
        db	$3e
        db	$22
        db	$02
        db	$0e
        db	$18
        db	$30
        db	$20
        db	$3e
        db	$3e
        db	40	
        db	35	 
        db	60	
        db	10	
three:		
        db	$7c
        db	$7c
        db	$04
        db	$04
        db	$1c
        db	$1c
        db	$04
        db	$04
        db	$7c
        db	$7c
        db	60
        db	120	
        db	90
        db	250
four:			
        db	$40
        db	$40
        db	$40
        db	$40
        db	$48
        db	$7e
        db	$7e
        db	$08
        db	$08
        db	$08
        db	100
        db	110	
        db	0
        db	255	;