openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

ex1.asm (1694B)


      1 ;
      2 ;
      3 ; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4 ; 
      5 ; Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6 ; 
      7 ;
      8 ;Here is an example program for programming the LEDs on the 5605.
      9 ;This is about as simple as it gets.
     10 ;
     11 ;The situation is this:
     12 ;
     13 ;    26 ports (port 0-25) each have one LED.
     14 ;
     15 ;    The LED is dark if there has been no activity,
     16 ;    or is on if there has been either RX, TX, or Collision.
     17 ;
     18 ;    We shift out port 0 status first, port 25 last.
     19 ;
     20 ;
     21 ;-------------------------- start of program --------------------------
     22 
     23 begin:
     24 	ld	A,0		; start with port 0
     25 	ld	(portnum),A
     26 
     27 portloop:
     28 	port	A		; specify which port we're dealing with
     29 	pushst	RX
     30 	pushst	TX
     31 	tor			; RX | TX
     32 	pushst	COLL
     33 	tor			; RX | TX | COLL
     34 	pack			; send to output buffer
     35 
     36 	inc	(portnum)
     37 	ld	A,(portnum)
     38 	cmp	A,26
     39 	jnz	portloop
     40 
     41 	send	26		; send 26 LED pulses and halt
     42 	
     43 
     44 ; data storage
     45 portnum		equ	0x7F	; temp to hold which port we're working on
     46 
     47 
     48 ; symbolic labels
     49 ; this gives symbolic names to the various bits of the port status fields
     50 
     51 RX		equ	0x0	; received packet
     52 TX		equ	0x1	; transmitted packet
     53 COLL		equ	0x2	; collision indicator
     54 SPEED_C		equ	0x3	;  100 Mbps
     55 SPEED_M		equ	0x4	; 1000 Mbps
     56 DUPLEX		equ	0x5	; half/full duplex
     57 FLOW		equ	0x6	; flow control capable
     58 LINKUP		equ	0x7	; link down/up status
     59 LINKEN		equ	0x8	; link disabled/enabled status
     60 
     61 ;-------------------------- end of program --------------------------
     62 ;
     63 ;This program is 23 bytes in length and uses one data storage location.
     64 ;This wasn't necessary, as the B register could have been used, but
     65 ;the point was to show some of the instructions.
     66