eris2010

Documentation: http://frombelow.net/projects/eris2010/
Clone: git clone https://git.frombelow.net/eris2010.git
Log | Files | Refs | Submodules | README | LICENSE

via_test.asm (971B)


      1 ;;; Copyright 2021 Gerd Beuster (gerd@frombelow.net). This is free
      2 ;;; software under the GNU GPL v3 license or any later version. See
      3 ;;; COPYING in the root directory for details.
      4 
      5 ;;; Connect LEDs to the 65C22 and enjoy some blinkenlights
      6 	.include "os.inc"
      7 
      8 	.dsection code
      9 	.section code
     10 init:
     11 	.block
     12         cld
     13         #io.SETUP
     14 	#io.PRINTSNL "VIA Test"
     15 	;; Configure all ports of A except PA4 as input
     16 	lda #$00
     17 	lda #%00010000
     18         sta via.ddra
     19 	;; Configure all ports of B as output
     20 	lda #%11111111
     21         sta via.ddrb
     22 loop:	jsr read_and_write_via
     23 	jsr io.getc_nonblocking
     24 	cmp #'q'
     25 	beq reset
     26 	cmp #'Q'
     27 	beq reset
     28 	jmp loop
     29 reset:
     30 	jmp ($fffc)
     31 	.bend
     32 
     33 read_and_write_via:
     34 	.block
     35 	inc via.rb
     36 	#io.PRINTS "RA: "
     37 	lda via.ra
     38 	jsr io.puth
     39 	lda #" "
     40 	jsr io.putc
     41 	#io.PRINTS "RB: "
     42 	lda via.rb
     43 	jsr io.puth
     44 	jsr io.putnl
     45 	ldx #$00
     46 	ldy #$00
     47 delay:	
     48 	dey
     49 	bne delay
     50 	dex
     51 	bne delay
     52 	lda via.ra		; Blink PA4
     53 	eor #%00010000
     54 	sta via.ra
     55 	rts
     56 	.bend
     57 
     58 	.send code