Desde 1994 en la Red. La pagina de los aficionados a la electronica, informatica y otras curiosidades de la vida. No dudes en visitarnos.
Ahora 2 visitas.| 3410004 Visitas (desde Dic. 2011), hoy: 271 Visitas 854 Pag. Vistas , ultimos 36 dias: 10133 Visitas. 48531 Pag. Vistas. Tu IP: 3.17.150.163
Que ando curioseando:
AutosuficienciaCosas de casaElectronicaEn InternetInformáticaMundo MisticoSin categoríaSociedadTe lo recomiendo

Pin Pon para la tele con 16f84a

Tipico juego de raquetas monocromo para la pantalla de TV.

Pagina original: http://www.rickard.gunee.com/projects/video/pic/pong.php

Asm:

;				PONG
;		(C) Rickard Gunée 1998
;
;	This is shareware, use it at your own risk.
;
;	You will find more info about the project
;	and more info on video signals here:
;	http://www.rickard.gunee.com/projects
;
;	Outputs composite PAL video signal using
;	only two resistors!

		list	p=16C84,r=hex

		__config 0x3FFA

w			equ	0
f			equ	1
pcl			equ	0x02

status		equ	0x03
porta		equ	0x05
portb		equ	0x06
indf		equ	0x00
fsr			equ	0x04
eedata		equ	0x08
eeadr		equ	0x09
eecon1		equ	0x08

rd		equ	0
rp0		equ	5

up1b		equ	3
down1b		equ	2
left1b		equ	4
right1b		equ	5
fire1b		equ	1
up2b		equ	7
down2b		equ	6
left2b		equ	2
right2b		equ	3
fire2b		equ	1
up1p		equ	portb
down1p		equ	portb
left1p		equ	portb
right1p		equ	portb
fire1p		equ	portb
up2p		equ	portb
down2p		equ	portb
left2p		equ	porta
right2p		equ	porta
fire2p		equ	porta

pl1_points	equ	0x0C
pl2_points	equ	0x0D
pl1_ypos	equ	0x0E
pl2_ypos	equ	0x0F
ball_xpos	equ	0x10
ball_ypos	equ	0x11
counter0	equ	0x12
counter1	equ	0x13
counter2	equ	0x14
videostuff	equ	0x15
line		equ	0x16
pl		equ	0x17
counter5	equ	0x18
delaycnt	equ	0x19
ball_xpart	equ	0x1A
ball		equ	0x1B
counter3	equ	0x1C
counter4	equ	0x1D
sound_counter	equ	0x1E
sound_stuff	equ	0x1F
sound_counter2	equ	0x20
stuff		equ	0x21
strptr		equ	0x22
strptr2		equ	0x23
stringbuff	equ	0x24

x_dir		equ	0
x_speed		equ	1
y_dir		equ	2
y_speed		equ	3
serve		equ	4
wait		equ	5

sound_length	equ	0x3

delay		MACRO
		LOCAL	label
		movwf	delaycnt
label		decfsz	delaycnt,f
		goto label
		ENDM

dnop		MACRO
		LOCAL	label
label		goto	label+1
		ENDM

		org 0x000
		goto menu

table
numbers		addwf	pcl,f
;number  0
		retlw 0x1C
		retlw 0x36
		retlw 0x63
		retlw 0x6B
		retlw 0x63
		retlw 0x36
		retlw 0x1C
		retlw 0x0
;number  1
		retlw 0x18
		retlw 0x1C
		retlw 0x18
		retlw 0x18
		retlw 0x18
		retlw 0x18
		retlw 0x7E
		retlw 0x0
;number  2
		retlw 0x3E
		retlw 0x63
		retlw 0x60
		retlw 0x38
		retlw 0xC
		retlw 0x66
		retlw 0x7F
		retlw 0x0
;number  3
		retlw 0x3E
		retlw 0x63
		retlw 0x60
		retlw 0x3C
		retlw 0x60
		retlw 0x63
		retlw 0x3E
		retlw 0x0
;number  4
		retlw 0x38
		retlw 0x3C
		retlw 0x36
		retlw 0x33
		retlw 0x7F
		retlw 0x30
		retlw 0x78
		retlw 0x0
;number  5
		retlw 0x7F
		retlw 0x3
		retlw 0x3
		retlw 0x3F
		retlw 0x60
		retlw 0x63
		retlw 0x3E
		retlw 0x0
;number  6
		retlw 0x1C
		retlw 0x6
		retlw 0x3
		retlw 0x3F
		retlw 0x63
		retlw 0x63
		retlw 0x3E
		retlw 0x0
;number  7
		retlw 0x7F
		retlw 0x63
		retlw 0x30
		retlw 0x18
		retlw 0xC
		retlw 0xC
		retlw 0xC
		retlw 0x0
;number  8
		retlw 0x3E
		retlw 0x63
		retlw 0x63
		retlw 0x3E
		retlw 0x63
		retlw 0x63
		retlw 0x3E
		retlw 0x0
;number  9
		retlw 0x3E
		retlw 0x63
		retlw 0x63
		retlw 0x7E
		retlw 0x60
		retlw 0x30
		retlw 0x1E
		retlw 0x0

;P
		retlw 0x3F
		retlw 0x66
		retlw 0x66
		retlw 0x3E
		retlw 0x6
		retlw 0x6
		retlw 0xF
		retlw 0x0
;L
		retlw 0xF
		retlw 0x6
		retlw 0x6
		retlw 0x6
		retlw 0x46
		retlw 0x66
		retlw 0x7F
		retlw 0x0
;.
		retlw 0x0
		retlw 0x0
		retlw 0x0
		retlw 0x0
		retlw 0x0
		retlw 0x18
		retlw 0x18
		retlw 0x0
; W
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x6B
		retlw 0x6B
		retlw 0x7F
		retlw 0x36
		retlw 0x0
; O
		retlw 0x3E
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x3E
		retlw 0x0
; N
		retlw 0x63
		retlw 0x67
		retlw 0x6F
		retlw 0x7B
		retlw 0x73
		retlw 0x63
		retlw 0x63
		retlw 0x0
; G
		retlw 0x3C
		retlw 0x66
		retlw 0x3
		retlw 0x3
		retlw 0x73
		retlw 0x66
		retlw 0x5C
		retlw 0x0

		; C
		retlw 0x3C	;0xC3
		retlw 0x42	;0x99
		retlw 0x99	;0xFC
		retlw 0x85	;0xFC
		retlw 0x85	;0xFC
		retlw 0x99	;0x99
		retlw 0x42	;0xC3
		retlw 0x3C	;0xFF
;R
		retlw 0x3F
		retlw 0x66
		retlw 0x66
		retlw 0x3E
		retlw 0x36
		retlw 0x66
		retlw 0x67
		retlw 0x0
; U
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x3E
		retlw 0x0
; E
		retlw 0x7F
		retlw 0x46
		retlw 0x16
		retlw 0x1E
		retlw 0x16
		retlw 0x46
		retlw 0x7F
		retlw 0x0
; space
		retlw 0x0
		retlw 0x0
		retlw 0x0
		retlw 0x0
		retlw 0x0
		retlw 0x0
		retlw 0x0
		retlw 0x0
; H
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x7F
		retlw 0x63
		retlw 0x63
		retlw 0x63
		retlw 0x0
; C
		retlw 0x3C
		retlw 0x66
		retlw 0x3
		retlw 0x3
		retlw 0x3
		retlw 0x66
		retlw 0x3C
		retlw 0x0

l_0	EQU	0x00
l_1	EQU	0x08
l_2	EQU	0x10
l_3	EQU	0x18
l_4	EQU	0x20
l_5	EQU	0x28
l_6	EQU	0x30
l_7	EQU	0x38
l_8	EQU	0x40
l_9	EQU	0x48
l_P	EQU	0x50
l_L	EQU	0x58
l_dot	EQU	0x60
l_W	EQU	0x68
l_O	EQU	0x70
l_N	EQU	0x78
l_G	EQU	0x80
l_CC	EQU	0x88
l_R	EQU	0x90
l_U	EQU	0x98
l_E	EQU	0xA0
l_space	EQU	0xA8
l_H	EQU	0xB0
l_C	EQU	0xB8

dosound		btfss	sound_stuff,0
		goto	skipsound
		bsf	porta,4
		btfsc	sound_counter,2
		bcf	porta,4
		incf	sound_counter,f
		return
skipsound	dnop
		nop
		return

shortsync	movwf	counter1
shortsync_l0
		bcf	porta,0		;2us sync
		bcf	portb,0
		dnop
		movlw	0x1D		;30us black
		movwf	counter2
		nop
		bsf	porta,0
shortsync_l1	decfsz	counter2,f
		goto	shortsync_l1
		decfsz	counter1,f
		goto	shortsync_l0
		retlw	5

vertsync
		movlw	5
		btfss	videostuff,0
		movlw	6
		call	shortsync
		incf	videostuff,f

longsync	movwf	counter1
longsync_l0	movlw	0x1D
		movwf	counter2
		bcf	porta,0		;30 us sync
		bcf	portb,0
longsync_l1	decfsz	counter2,f
		goto	longsync_l1
		nop			;2us black
		bsf	porta,0
		nop
		decfsz	counter1,f
		goto	longsync_l0

		movlw	5
		btfss	videostuff,0
		movlw	4
		call	shortsync
		return

start
		movlw	sound_length
		movwf	sound_counter2
		bcf	sound_stuff,0
		clrf	sound_counter

		clrf	pl1_points
		clrf	pl2_points
		clrf	counter4

		movlw	0x50
		movwf	pl1_ypos
		movlw	0x50
		movwf	pl2_ypos
		movlw	10
		movwf	ball_xpos
		movwf	ball_ypos
		movlw	20
		movwf	ball

		movlw	0xFE
		tris	portb

		clrf	videostuff
		bsf	stuff,0

main		call	vertsync

		dnop
		bcf	porta,0			;sync
		bcf	portb,0

		movfw	pl1_points
		sublw	0xA
		skpnz
		goto	plwon
		movfw	pl2_points
		sublw	0xA
		skpnz
		goto	plwon

		nop
		dnop

		bsf	porta,0			;set black level

		movlw	0x14
		subwf	ball_ypos,w
		skpc
		movlw	0
		movwf	counter0
		movlw	0x92
		subwf	counter0,w
		skpnc
		movlw	0x92
		skpnc
		movwf	counter0
		movfw	counter0
		btfsc	stuff,1
		movwf	pl1_ypos
		btfsc	stuff,2
		movwf	pl2_ypos
		dnop

		bsf	porta,0			;set white
		btfsc	ball,wait
		goto	waitfire
		btfsc	ball,x_speed		;if speed is high
		goto	highxspeed		;then skip slowtest
		btfsc	videostuff,0		;slowtest
		goto	skipball
		nop
highxspeedr	btfsc	ball,x_dir		;check xdir
		goto	goleft
		incf	ball_xpos,f		;move ball right
		movfw	ball_xpos
		sublw	0x29			;bounce ?
		skpz
		goto	norbounce
		bsf	ball,x_dir		;yes, set left motion
		decf	ball_xpos,f		;if bounce also prevent ball from getting outa here
		bsf	sound_stuff,0
		movfw	ball_ypos
		addlw	0B
		subwf	pl2_ypos,w
		skpnc
		goto	rmiss1
		movfw	pl2_ypos
		addlw	0x35
		subwf	ball_ypos,w		;ball_ypos - (pl2_ypos + 50)
		skpnc
		goto	rmiss2
		bsf	ball,x_dir		;change ball direction
		btfsc	fire2p,fire2b
		goto	nofirer
		bsf	ball,x_speed		;if fire increase speed
		btfsc	up2p,up2b
		bcf	ball,y_dir
		btfsc	down2p,down2b
		bsf	ball,y_dir
		bsf	ball,y_speed
		dnop
		bsf	sound_stuff,0
goleftr		btfsc	ball,y_dir
		goto	goup
		incf	ball_ypos,f
		movfw	ball_ypos
		sublw	0xBD
		skpnz
		bsf	ball,y_dir
		skpnz
		bsf	sound_stuff,0
		skpnz
		decf	ball_ypos,f
		nop
goupr	movlw	0x09
		delay
		nop
skipballr	movlw	2			;move bars 2 pixels / frame
		movwf	counter2
movebarl	btfss	up1p,up1b		;player 1 pressed up ?
		decf	pl1_ypos,f		;yes, move up player 1
		btfss	down1p,down1b		;player 1 pressed down ?
		incf	pl1_ypos,f		;yes, move down player 2
		movfw	pl1_ypos		;get player 1 ypos
		skpnz				;ypos = 0 ? (oob)
		incf	pl1_ypos,f		;yes, move down one step
		sublw	0x93
		skpnz				;ypos=150 ? (oob)
		decf	pl1_ypos,f		;yes, move up one step
		btfss	up2p,up2b		;player 2 pressed up ?
		decf	pl2_ypos,f		;yes, move up player 1
		btfss	down2p,down2b		;player 2 pressed down ?
		incf	pl2_ypos,f		;yes, move down player 2
		movfw	pl2_ypos		;get player 2 ypos
		skpnz				;ypos = 0 (oob)
		incf	pl2_ypos,f		;yes, move down one step
		sublw	0x93
		skpnz				;ypos=150 ? (oob)
		decf	pl2_ypos,f		;yes, move up one step
		decfsz	counter2,f
		goto	movebarl

		btfss	ball,y_speed		;fast y-speed ?
		goto	yslow			;yes, skip it
		btfsc	ball,y_dir		;ball going up ?
		goto	fastup
		incf	ball_ypos,f		;ball going down !
		movfw	ball_ypos
		sublw	0xBD			;check for bounce
		skpnz
		bsf	ball,y_dir		;if bounce, change y-dir
		skpnz
		bsf	sound_stuff,0
		skpnz
		decf	ball_ypos,f		;and go up one step
		nop
fastr		nop

		btfss	sound_stuff,0		;sound ?
		goto	nosoundatall
		decfsz	sound_counter2,f		;decrease timer
nosoundatall	goto	nosoundfin		;if timer is zero then
		bcf	sound_stuff,0		;stop sound
		movlw	sound_length		;setup time for next time
		movwf	sound_counter2
		bsf	porta,4			;set high level to decrease power consumption
nosoundfinr
		movlw	2
		delay

		clrf	line
		movlw	0x32
		call	emptylines

		dnop
		dnop
		dnop
		nop
nocmprr
		movlw	0xC8		;200 lines
		movwf	counter1
l6		movfw	line
		subwf	pl1_ypos,w	;w=ypos-line, if w>0 then c=1
		bcf	porta,0		;start sync
		bcf	portb,0
		skpnc
		goto	nolpl		;if c=1 then line < ypos, don't show it
		movfw	pl1_ypos
		addlw	0x32
		subwf	line,w		;w=line-(ypos+50)
		bsf	pl,0		;if c=0 then line < (ypos+50), show it
		skpnc
nolplr		bcf	pl,0		;if c=1 then line > (ypos+50), don't show it
		nop
		nop
		bsf	porta,0		;end of sync, set black
		movfw	line
		subwf	pl2_ypos,w	;w=ypos-line, if w>0 then c=1
		skpnc
		goto	norpl		;if c=1 then line < ypos, don't show it
		movfw	pl2_ypos
		addlw	0x32
		subwf	line,w		;w=line-(ypos+50)
		bsf	pl,1		;if c=0 then line < (ypos+50), show it
		skpnc
norplr		bcf	pl,1		;if c=1 then line > (ypos+50), don't show it
		nop
		movfw	ball_ypos
		subwf	line,w		;w=ball_ypos - line
		skpc			;line < ball_ypos
		goto	noball		;yes, ball is not on line				30
		movfw	ball_ypos
		addlw	0x0A
		subwf	line,w		;w=line-(ball_ypos+9)
		skpc			;line < ball_ypos+9 ?
		goto	ballonline	;yes: ball is on this line				35
noballr		dnop
		dnop
		nop
		btfsc	pl,0
		bsf	portb,0
		dnop
		dnop
		movlw	0x2A-3
		bcf	portb,0
		delay
		call	dosound
		nop
		btfsc	pl,1
		bsf	portb,0
		dnop
		dnop
		nop
		bcf	portb,0
		dnop
		dnop
endofball	incf	line,f
		decfsz	counter1,f
		goto	l6								;191

		movlw	0x3
		movwf	counter1
l8		nop
		bcf	porta,0
		bcf	portb,0
		movlw	3
		delay
		bsf	porta,0
		movlw	6
		delay
		bsf	portb,0
		movlw	0x33
		delay
		nop
		decfsz	counter1,f
		goto	l8

		dnop
		bcf	porta,0
		bcf	portb,0
		movlw	3
		delay
		bsf	porta,0
		movlw	6
		delay
		bsf	portb,0
		movlw	0x2E
		delay

		movfw	pl1_points
		movwf	counter2
		rlf	counter2,f
		rlf	counter2,f
		rlf	counter2,f
		movfw	pl2_points
		movwf	counter0
		rlf	counter0,f
		rlf	counter0,f
		rlf	counter0,f
		dnop

		movlw	0x00
		tris	portb

		clrf	counter4
		clrf	line
		movlw	0x10
		movwf	counter1
l9		dnop
		bcf	porta,0
		bcf	portb,0
		movlw	3
		delay
		nop
		bsf	porta,0
		nop
		movlw	3
		delay

		call	dosound

		bsf	portb,0

		movlw	3
		delay

		movfw	counter2
		addlw	-4			;?!?!?!?!?!!
		call	numbers
		btfsc	ball,serve
		xorlw	0xFF

		movwf	portb
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		bsf	portb,0
		movlw	0x1C
		delay
		nop

		movfw	counter0
		call	numbers
		btfss	ball,serve
		xorlw	0xFF

		movwf	portb
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		bsf	portb,0

		btfsc	counter4,0
		incf	counter2,f
		btfsc	counter4,0
		incf	counter0,f
		incf	counter4,f
		movlw	4
		delay
		decfsz	counter1,f
		goto	l9

		movlw	0xFE
		tris	portb
		nop

		bcf	porta,0
		bcf	portb,0
		movlw	3
		delay
		bsf	porta,0
		movlw	6
		delay
		bsf	portb,0
		movlw	0x32
		delay
		nop

		movlw	0x1E
		call	emptylines

		goto	main

nolpl		goto	nolplj
nolplj		goto	nolplr

norpl		goto	norplj
norplj		goto	norplr

ballonline	dnop				;screen starts here
		dnop
		btfsc	pl,0			;start showing player 1
		bsf	portb,0
		movfw	ball_xpos
		sublw	0x29
		movwf	ball_xpart
		nop
		movfw	ball_xpos
		bcf	portb,0
		delay
		bsf	portb,0
		dnop
		movfw	ball_xpart
		bcf	portb,0
		delay
		btfsc	pl,1
		bsf	portb,0
		nop
		dnop
		dnop
		bcf	portb,0
		dnop
		goto	endofball

noball		dnop
		goto	noballr

goleft		decf	ball_xpos,f
		skpz
		goto	nolbounce
		bsf	sound_stuff,0
		bcf 	ball,x_dir
		incf	ball_xpos,f
		movfw	ball_ypos
		addlw	0x0B
		subwf	pl1_ypos,w
		skpnc
		goto	lmiss1
		movfw	pl1_ypos
		addlw	0x35
		subwf	ball_ypos,w		;ball_ypos - (pl2_ypos + 50)
		skpnc
		goto	lmiss2
		bcf	ball,x_dir		;change ball direction
		btfsc	fire1p,fire1b
		goto	nofirel
		bsf	ball,x_speed
		btfsc	up1p,up1b
		bcf	ball,y_dir
		btfsc	down1p,down1b
		bsf	ball,y_dir
		bsf	ball,y_speed
		bsf	sound_stuff,0
		goto	goleftr

lmiss1		dnop
		dnop
		nop
lmiss2		bsf	ball,wait		;start waiting
		btfss	ball,serve
		goto	chservel
		incf	pl2_points,f
		bsf	sound_stuff,0
		nop
		dnop
		goto	goleftr

chservel	bsf	ball,serve
		nop
		dnop
		goto	goleftr

rmiss1		dnop
		dnop
		nop
rmiss2		bsf	ball,wait
		btfsc	ball,serve
		goto	chserver
		incf	pl1_points,f
		bsf	sound_stuff,0
		nop
		dnop
		goto	goleftr

chserver	bcf	ball,serve
		nop
		dnop
		goto	goleftr

goup	decf	ball_ypos,f
		skpnz
		bcf	ball,y_dir
		skpnz
		bsf	sound_stuff,0
		skpnz
		incf	ball_ypos,f
		goto	goupr

skipball	movlw	0x16			;like major wait or something
		delay
		goto	skipballr

highxspeed	goto	highxspeedr		;small wait or something

nolbounce	movlw	6			;wait
		delay
		goto	goleftr

norbounce	movlw	6			;wait
		delay
		nop
		goto	goleftr

waitfire	btfsc	ball,serve		;whos serve is it ?
		goto	pl2serve
		nop
		movlw	1			;ball x pos = 1
		movwf	ball_xpos
		movfw	pl1_ypos
		addlw	0x14
		movwf	ball_ypos		;ball y pos = pl1 ypos + 20
		movlw	0x20
		movwf	ball			;setup ball
		btfss	up1p,up1b
		bsf	ball,y_dir		;is player pressing up ?
		btfss	fire1p,fire1b
		bcf	ball,wait		;is player pressing fire ?
		btfss	fire1p,fire1b
		bsf	sound_stuff,0		;is player pressing fire ?
		btfsc	stuff,1
		bcf	ball,wait		;computerized fire ?
		btfsc	stuff,1
		bsf	sound_stuff,0		;computerized fire ?
		nop
		movlw	0x0F
		delay
		goto	skipballr

pl2serve	movlw	0x28			;ball x pos ? 40
		movwf	ball_xpos
		movfw	pl2_ypos
		addlw	0x14
		movwf	ball_ypos		;ball y pos = pl2 ypos + 20
		movlw	0x31
		movwf	ball			;setup ball
		btfss	up2p,up2b
		bsf	ball,y_dir		;is player pressing up ?
		btfss	fire2p,fire2b
		bcf	ball,wait		;is player pressing fire ?
		btfss	fire2p,fire2b
		bsf	sound_stuff,0		;is player pressing fire ?
		btfsc	stuff,2
		bcf	ball,wait		;computerized fire ?
		btfsc	stuff,2
		bsf	sound_stuff,0		;computerized fire ?
		nop
		movlw	0x0F
		delay
		goto	skipballr

nofirer:	dnop				;like wait or something
		dnop
		nop
		goto	skipballr

nofirel		dnop				;like wait or something
		dnop
		nop
		goto	skipballr

fastup		decf	ball_ypos,f		;move ball up
		skpnz				;check for bounce
		bcf	ball,y_dir		;if bounce change y-dir
		skpnz
		bsf	sound_stuff,0
		skpnz
		incf	ball_ypos,f		;and also move ball down one step
		goto	fastr

yslow		movlw	2			;like wait or something
		delay
		goto	fastr

nosoundfin	nop
		goto	nosoundfinr		;wait and stuff

emptycharline	movlw	0x10			;17 black lines
		dnop
emptylines	movwf	counter1
		dnop
		nop
ell		bcf	porta,0
		bcf	portb,0
		movlw	3
		delay
		movlw	0x7
		bsf	porta,0
		delay
		btfsc	stuff,0
		bsf	portb,0
		call	dosound

		movlw	0x2F
		delay
		decfsz	counter1,f
		goto	ell
		nop
		bcf	porta,0
		goto	syncret

plwon		movlw	0xff
		movwf	portb
		movlw	0xFE
		tris	portb
plwonw		btfss	fire1p,fire1b
		goto	plwonw
		movlw	0xFF
		delay
		bcf	stuff,0
		bcf	sound_stuff,0
plwonl		movlw	0x00
		tris	portb
		call	vertsync		;do vertical retrace
		movlw	0x8E
		call	emptylines
		movlw	pl1won_str
		btfsc	ball,serve
		movlw	pl2won_str
		call	printstring
		dnop
		movlw	0x8D
		call	emptylines
		movlw	0xff
		movwf	portb
		movlw	0xFE
		tris	portb
		btfsc	fire1p,fire1b
		goto	plwonl
wfplw		btfss	fire1p,fire1b
		goto	wfplw
		movlw	0xFF
		delay
		btfss	fire1p,fire1b
		goto	wfplw
		goto	menu

menu		bcf	stuff,0
		movlw	pp_str
		movwf	counter4
		movlw	sound_length
		movwf	sound_counter2
		bcf	sound_stuff,0
		clrf	sound_counter
		movlw	0x0E
		tris	porta

menul		movlw	0x00
		tris	portb
		call	vertsync		;do vertical retrace
		call	emptycharline
		call	emptycharline
		call	emptycharline
		movlw	pong_str
		dnop
		call	printstring
		call	emptycharline
		dnop
		movlw	crg_str
		call	printstring
		call	emptycharline
		call	emptycharline
		call	emptycharline
		dnop
		movlw	pl12_str
		call	printstring
		call	emptycharline
		movfw	counter4
		dnop
		call	printstring
		dnop
		movlw	0x62
		call	emptylines
		movlw	0xff
		movwf	portb
		movlw	0xFE
		tris	portb
		movfw	counter4
		btfss	down1p,down1b
		movlw	pp_str
		btfss	left1p,left1b
		movlw	cc_str
		btfss	right1p,right1b
		movlw	pc_str
		bcf	portb,0
		movwf	counter4
		movlw	3
		delay
		bsf	portb,0
		movlw	59
		delay

		btfsc	fire1p,fire1b
		goto	menul
wfupgs		btfss	fire1p,fire1b
		goto	wfupgs
		movlw	0xFF
		delay
		btfss	fire1p,fire1b
		goto	wfupgs

		bcf	stuff,1
		bsf	stuff,2
		movfw	counter4
		sublw	pp_str
		skpnz
		bcf	stuff,2
		movfw	counter4
		sublw	cc_str
		skpnz
		bsf	stuff,1
		movlw	0xFF
		delay

		goto	start

printstring	movwf	strptr
		clrf	line
		movlw	0x08
		movwf	counter1
printstrl0	bcf	porta,0
		movlw	0x08
		movwf	counter0
		movlw	stringbuff
		movwf	fsr
		movfw	strptr
		movwf	eeadr
		dnop
		dnop
		nop
		bsf	porta,0
prnstrl1	bsf	status,rp0
		bsf	eecon1,rd
		bcf	status,rp0
		movfw	eedata
		addwf	line,w
		call	table
		movwf	indf
		incf	fsr,f
		incf	eeadr,f
		decfsz	counter0,f
		goto	prnstrl1
		movlw	0xE
		delay
		incf	line,f
		bcf	porta,0

		movlw	0x08
		movwf	counter0
		movlw	stringbuff
		movwf	fsr
		movlw	2
		delay
		bsf	porta,0
		movlw	0xD			;22us black + 8us black col brst
		delay
prnstrl2	movfw	indf
		movwf	portb
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		rrf	portb,f
		bcf	portb,0
		incf	fsr,f
		decfsz	counter0,f
		goto	prnstrl2
		movlw	0x8			;22us black
		delay
		decfsz	counter1,f
		goto	printstrl0
		nop
		bcf	porta,0
		goto	syncret

syncret		movlw	2
		delay
		nop
		bsf	porta,0
		movlw	0x38
		delay
		return

		org 0x2100

pl1won_str	equ	0x0
		dw	l_P
		dw	l_L
		dw	l_dot
		dw	l_1
		dw	l_space
		dw	l_W
		dw	l_O
		dw	l_N

pl2won_str	equ	0x8
		dw	l_P
		dw	l_L
		dw	l_dot
		dw	l_2
		dw	l_space
		dw	l_W
		dw	l_O
		dw	l_N

pong_str	equ	0x10
		dw	l_space
		dw	l_space
		dw	l_P
		dw	l_O
		dw	l_N
		dw	l_G
		dw	l_space
		dw	l_space

pl12_str	equ	0x18
		dw	l_P
		dw	l_L
		dw	l_1
		dw	l_space
		dw	l_space
		dw	l_P
		dw	l_L
		dw	l_2

pp_str		equ	0x20
		dw	l_space
		dw	l_H
		dw	l_space
		dw	l_space
		dw	l_space
		dw	l_space
		dw	l_H
		dw	l_space

pc_str		equ	0x28
		dw	l_space
		dw	l_H
		dw	l_space
		dw	l_space
		dw	l_space
		dw	l_space
		dw	l_C
		dw	l_space

cc_str		equ	0x30
		dw	l_space
		dw	l_C
		dw	l_space
		dw	l_space
		dw	l_space
		dw	l_space
		dw	l_C
		dw	l_space

crg_str		equ	0x38
		dw	l_CC
		dw	l_R
		dw	l_dot
		dw	l_G
		dw	l_U
		dw	l_N
		dw	l_E
		dw	l_E

		end


hex:

:020000040000FA
:10000000602B82071C34363463346B3463343634EB
:100010001C34003418341C34183418341834183490
:100020007E3400343E346334603438340C34663407
:100030007F3400343E34633460343C3460346334A1
:100040003E34003438343C34363433347F34303446
:10005000783400347F34033403343F346034633401
:100060003E3400341C34063403343F346334633488
:100070003E3400347F346334303418340C340C3460
:100080000C3400343E34633463343E3463346334BC
:100090003E3400343E34633463347E346034303470
:1000A0001E3400343F34663466343E34063406343D
:1000B0000F3400340F3406340634063446346634C4
:1000C0007F340034003400340034003400341834F9
:1000D000183400346334633463346B346B347F34EA
:1000E000363400343E34633463346334633463340D
:1000F0003E340034633467346F347B347334633498
:10010000633400343C34663403340334733466346B
:100110005C3400343C344234993485348534993429
:1001200042343C343F34663466343E3436346634CC
:100130006734003463346334633463346334633466
:100140003E3400347F34463416341E34163446347C
:100150007F34003400340034003400340034003480
:10016000003400346334633463347F346334633481
:10017000633400343C34663403340334033466346B
:100180003C3400341F1CC92805161E1905129E0A8E
:100190000800CA2800000800930005100610D028A7
:1001A0001D30940000000514940BD428930BCD2827
:1001B00005340530151C0630CC20950A93001D30FF
:1001C000940005100610940BE328000005140000AD
:1001D000930BDF280530151C0430CC2008000330B9
:1001E000A0001F109E018C018D019D0150308E00DA
:1001F00050308F0010309000910020309B00FE3076
:10020000660095012114D9200529051006100C0857
:100210000A3C0319392B0D080A3C0319392B00003D
:100220001129051414301102031C00309200923081
:10023000120203189230031892001208A1188E00BF
:1002400021198F00232905149B1AD52A9B18C92A26
:100250001518C42A00001B18832A900A1008293C8C
:10026000031DCF2A1B1490031F1411080B3E0F020D
:100270000318AD2A0F08353E11020318B02A1B14CB
:100280008518062B9B14861B1B11061B1B159B1523
:1002900049291F141B19BC2A910A1108BD3C0319D6
:1002A0001B1503191F14031991030000093099004D
:1002B000990B5829000002309400861D8E03061DFC
:1002C0008E0A0E0803198E0A933C03198E03861FAB
:1002D0008F03061F8F0A0F0803198F0A933C031917
:1002E0008F03940B5D299B1D162B1B190E2B910A56
:1002F0001108BD3C03191B1503191F1403199103A1
:10030000000000001F1C8529A00B1B2B1F100330B1
:10031000A000051602309900990B8C299601323005
:100320001F239229932994290000C83093001608AE
:100330000E02051006100318612A0E08323E16023E
:1003400017140318171000000000051416080F02F8
:100350000318632A0F08323E1602971403189710E9
:10036000000011081602031C812A11080A3E160219
:10037000031C652ABB29BC29000017180614C029D4
:10038000C129273006109900990BC429C22000000A
:1003900097180614CB29CC2900000610CF29D029A4
:1003A000960A930B9729033093000000051006105E
:1003B00003309900990BDA29051406309900990B3E
:1003C000DF29061433309900990BE4290000930BC0
:1003D000D529EA290510061003309900990BEE295A
:1003E000051406309900990BF32906142E30990054
:1003F000990BF8290C089400940D940D940D0D0898
:100400009200920D920D920D052A003066009D011A
:100410009601103093000C2A051006100330990045
:10042000990B102A00000514000003309900990B65
:10043000172AC220061403309900990B1D2A1408AC
:10044000FC3E01201B1AFF3A8600860C860C860CA7
:10045000860C860C860C860C06141C309900990BB1
:100460002F2A0000120801201B1EFF3A8600860C6E
:10047000860C860C860C860C860C860C06141D18C1
:10048000940A1D18920A9D0A04309900990B462A75
:10049000930B0B2AFE306600000005100610033097
:1004A0009900990B512A051406309900990B562A88
:1004B000061432309900990B5B2A00001E301F236E
:1004C0000329622AA229642AAF29662A672A1718F3
:1004D00006141008293C9A00000010080610990024
:1004E000990B702A0614742A1A0806109900990BA1
:1004F000772A9718061400007D2A7E2A0610802A83
:10050000D029822ABA299003031DCA2A1F141B105E
:10051000900A11080B3E0E0203189E2A0E08353E63
:1005200011020318A12A1B1086180A2B9B14861986
:100530001B1106191B159B151F144A299F2AA02A57
:1005400000009B161B1EA92A8D0A1F140000A82A52
:100550004A291B160000AC2A4A29AE2AAF2A0000FD
:100560009B161B1AB82A8C0A1F140000B72A4A29A6
:100570001B120000BB2A4A29910303191B110319FE
:100580001F140319910A562916309900990BC62A8F
:100590005B292B2906309900990BCC2A4A29063071
:1005A0009900990BD12A00004A291B1AEF2A000052
:1005B000013090000E08143E910020309B00861DF3
:1005C0001B15861C9B12861C1F14A1189B12A118B8
:1005D0001F1400000F309900990BEC2A5B2928307A
:1005E00090000F08143E910031309B00861F1B15B0
:1005F000851C9B12851C1F1421199B1221191F1485
:1006000000000F309900990B032B5B29072B082B57
:1006100000005B290B2B0C2B00005B2991030319B5
:100620001B1103191F140319910A81290230990023
:10063000990B182B812900008A2910301F2B930059
:10064000212B00000510061003309900990B262B72
:10065000073005149900990B2B2B21180614C22082
:100660002F309900990B322B930B222B0000051091
:10067000F52BFF308600FE306600861C3D2BFF30D8
:100680009900990B412B21101F1000306600D920D2
:100690008E301F2300301B1A0830B2234F2B8D30B1
:1006A0001F23FF308600FE3066008618452B861C0F
:1006B000572BFF309900990B5B2B861C572B602B17
:1006C000211020309D000330A0001F109E010E302D
:1006D000650000306600D9201D231D231D23103026
:1006E000712BB2231D23742B3830B2231D231D23FD
:1006F0001D237A2B1830B2231D231D087F2BB22314
:10070000812B62301F23FF308600FE3066001D08FB
:10071000061D2030061E3030861E283006109D0033
:1007200003309900990B922B061459309900990BBC
:10073000972B8618692B861C9B2BFF309900990BF1
:100740009F2B861C9B2BA11021151D08203C0319F3
:1007500021111D08303C0319A114FF309900990B99
:10076000AF2BEF28A2009601083093000510083047
:1007700092002430840022088900BE2BBF2B000089
:100780000514831608148312080816070120800038
:10079000840A890A920BC12B0E309900990BCE2B3B
:1007A000960A051008309200243084000230990027
:1007B000990BD82B05140D309900990BDD2B0008EF
:1007C0008600860C860C860C860C860C860C860CA5
:1007D0000610840A920BDF2B08309900990BEE2B40
:1007E000930BB62B00000510F52B02309900990BE6
:1007F000F72B0000051438309900990BFD2B0800E9
:02400E00FA3F77
:104200005000580060000800A800680070007800A6
:104210005000580060001000A8006800700078008E
:10422000A800A8005000700078008000A800A80036
:10423000500058000800A800A800500058001000C6
:10424000A800B000A800A800A800A800B000A8001E
:10425000A800B000A800A800A800A800B800A80006
:10426000A800B800A800A800A800A800B800A800EE
:10427000880090006000800098007800A000A000F6
:00000001FF

Escribe un comentario

Tu comentario