ASM examples

Unable to display file "http://darcs.erazor-zone.de/ezusb/as31/ezusb_reg_inc.asm": It may not exist, or permission may be denied.

0x000atoOUTC.asm

; Copyright (C) 2003,  Alexander 'E-Razor' Krause
;                      admin@erazor-zone.de
;                      http://projects.erazor-zone.de/ezusb
; First test of the Cypress EZ-USB and ep0
 
.inc ezusb_reg_inc.asm
 
.org 0x0000
ljmp init
 
 
.org 0x0100
init:
	mov dptr, #PORTCCFG
	mov a, #00000000b
	movx @dptr, a
 
	mov dptr, #OEC
	mov a, #11111111b
	movx @dptr, a
 
 
;main
	;mov dptr, #0x000ah
	;mov a,#0x00h
	;movx @dptr,a
 
begin:		
 
	mov dptr, #0x000ah	
	movx a,@dptr
 
	mov dptr, #OUTC
	movx @dptr, a
 
	;lcall  Wait100msec
ljmp begin
 
 
;10ms loop
Wait100msec:
        mov     r1, #100
Wait1msec:                      ; A delay loop
        mov     dptr,#-1200
More:   inc     dptr            ; 3 cycles
        mov     a,dpl           ; + 2
        orl     a,dph           ; + 2
        jnz     More            ; + 3 = 10 cycles x 1200 = 1msec
        djnz    r1, Wait1msec   ; 
        ret

led3.asm

; Copyright (C) 2003,  Alexander 'E-Razor' Krause
;                      admin@erazor-zone.de
;                      http://projects.erazor-zone.de/ezusb
;
; First test of the Cypress EZ-USB
; Rotates a bit from port C and B
;
; Many thanks to Mr. Tony Cureington for ezusb2131.o !
;
 
.inc ezusb_reg_inc.asm
 
.org 0x0000
ljmp init
 
 
.org 0x0100
init:
	mov dptr, #PORTBCFG	;all bits are io
	mov a, #00000000b
	movx @dptr, a
 
	mov dptr, #PORTCCFG
	mov a, #00000000b
	movx @dptr, a
 
 
	mov dptr, #OEB		;enable complete output latch
	mov a, #11111111b
	movx @dptr, a
 
	mov dptr, #OEC
	mov a, #11111111b
	movx @dptr, a
 
 
;main
	mov r1, #10000000b		
begin:		
	mov dptr, #OUTB
	mov a,r1
	rrc	a
	mov r1,a
	movx @dptr, a
 
	mov dptr, #OUTC
	movx @dptr, a
 
	;lcall  Wait100msec
 
	ljmp begin
 
 
;100ms loop
Wait100msec:
        mov     r0, #100
Wait1msec:                      ; A delay loop
        mov     dptr,#-1200
More:   inc     dptr            ; 3 cycles
        mov     a,dpl           ; + 2
        orl     a,dph           ; + 2
        jnz     More            ; + 3 = 10 cycles x 1200 = 1msec
        djnz    r0, Wait1msec   ; 
        ret

Some more examples

 
wiki/projects/linux/ez-usb/asm.txt · Last modified: 2005/08/24 16:05 by e-razor
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki