Code misunderstanding

Post here to discuss the original 8x8 Game System.

Moderators: Chuckt, Garth, bitfogav

Post Reply
tgraz34
decided to stick around...
decided to stick around...
Posts: 32
Joined: Tue Jun 08, 2010 12:14 pm

Code misunderstanding

Post by tgraz34 » Sat Oct 30, 2010 8:53 am

Could someone please explain to me what the numbers after each bsf/bcf command represent.

Thanks

Code: Select all

draw_ball				;	this routine draws the ball on the screen
	movf ball_y, w		;	copy our ball_y co-ordinate to w
	movwf PORTB			;	and then to portb (our data bus)
	bsf PORTA, 2		;	now latch this 8-bits to the green 74373
	bcf PORTA, 2		;	and now close the latches
	movf ball_x, w		;	copy ball_x co-ordinate to w
	movwf PORTB			;	then to port b (our data bus)
	bsf PORTA, 4		;	now latch this 8-bits to the COLUMN data 74373
	bcf PORTA, 4		;	and close the latches
	bcf PORTA, 3		;	enable both the green and column 74373 outputs
	bcf PORTA, 6		;	3 is green and 6 is column data
	call delay			;	hold this data on the screen for a split second
	bsf PORTA, 3		;	close both green and column outputs
	bsf PORTA, 6		;	3 is green and 6 is column data
	return				;	and return to the main program

elementalrage
semi-newbie
semi-newbie
Posts: 24
Joined: Mon Sep 13, 2010 11:06 am
Location: Central US

Re: Code misunderstanding

Post by elementalrage » Sat Oct 30, 2010 10:10 am

The number after each "bcf/bsf" is the PORT pin.

So, "bsf PORTA, 4" represents setting or turning on (high) PORTA - Pin 4 or RA4.

I hope that's what you're asking, if not, let me know...

darrin

tgraz34
decided to stick around...
decided to stick around...
Posts: 32
Joined: Tue Jun 08, 2010 12:14 pm

Re: Code misunderstanding

Post by tgraz34 » Sat Oct 30, 2010 1:11 pm

Thank you darrin :D

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: Code misunderstanding

Post by brad » Sun Oct 31, 2010 2:12 pm

Nice clarification!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest