⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0809.asm

📁 TCP_USB试验平台下的几个常见的实验的相应要求与代码
💻 ASM
字号:
; a口同步
data segment
    t0 equ 280h
    t1 equ 281h
    t2 equ 282h
    ctrl53 equ 283h
       pa equ 288h
        pb equ 289h
        pc equ 28ah
        ctrl55 equ 28bh
    cs0809 equ 298h
    table db 3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh,77h,7ch,39h,5eh,79h,71h,76h,73h
        dat db 00h
data ends

code segment
    assume ds:data,cs:code
start:
    mov dx,data
    mov ds,dx
    
    MOV DX,CTrL53
    MOV AL,00100101B
    OUT DX,AL
    MOV DX,T0
    MOV AL,10H
    OUT DX,AL
    MOV DX,CTrL53
    MOV AL,01100111B
    OUT DX,AL
    MOV DX,T1
    MOV AL,10H
    OUT DX,AL
    MOV DX,CTrL53
    MOV AL,10100111B
    OUT DX,AL
    MOV DX,T2
    MOV AL,01H
    OUT DX,AL  
   mov dx,ctrl55
    mov al,10001000b
    out dx,al

   ; mov dx,pa
    ;mov al,00h
    ;out dx,al

l0:    mov dx,cs0809
    out dx,al
    
    call delay2

    mov dx,cs0809
    in al,dx

    mov dat,al
    mov dx,pa
  out dx,al
    call led

    mov bl,dat
    call binihex
    call crlf
    
    jmp l0





delay2 proc near
push ax
push dx

;mov dx,pa
;mov al,00000011b
;out dx,al

mov dx,pc
  loop3:  in al,dx
    test al,80h
    jnz loop3
    
loop4:in al,dx
    test al,80h
    jz loop4

;mov dx,pa
;mov al,00h
 ;   out dx,al

pop dx
pop ax
ret
delay2 endp










led proc near
push dx
push ax
    mov cx,0200h

 l1:  push cx
   mov al,dat
    and al,0fh
    lea bx,table
    xlat
    
    mov dx,pb
    out dx,al
    
    mov dx,pc
    mov al,0fdh
    out dx,al

    mov dx,pb
    mov al,00h
    out dx,al
    
    mov dx,pc
    mov al,0fch
    out dx,al




    mov al,dat
    mov cl,4
    shr al,cl    
    and al,0fh
    xlat

    mov dx,pb
    out dx,al

    mov dx,pc
    mov al,0feh
    out dx,al
    
    mov dx,pb
    mov al,00h
    out dx,al

    mov dx,pc
    mov al,0fch
    out dx,al
    pop cx
loop l1   

pop dx
pop ax
ret
led endp

binihex proc near
         mov ch,2
rotate:mov cl,4
    
        rol bl,cl
        mov al,bl
         and al,0fh
      add al,30h
        cmp al,3ah
         jl printit
            add al,7h
printit:mov dl,al
         mov ah,2
         int 21h
          dec ch
         jnz rotate
          ret
binihex endp

crlf proc near 
        mov dl,0dh
         mov ah,2
       int 21h
         mov dl,0ah
       mov ah,2
         int 21h
         ret
crlf endp


code ends
end start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -