| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6867 人关注过本帖
标题:proteus无法装载汇编程序
只看楼主 加入收藏
兔先生
Rank: 2
等 级:论坛游民
帖 子:41
专家分:20
注 册:2018-11-9
结帖率:63.64%
收藏
已结贴  问题点数:20 回复次数:4 
proteus无法装载汇编程序
Proteus可以加载其他的汇编程序,但是在由可加载的汇编程序改编而来的新的汇编程序却不能加载。
是否是代码的问题?
改变代码如下,洗衣机课设,主要功能是自动正转和反转,并分为三个档位。
程序代码:
ASSUME CS:CODE,DS:DATA


DATA segment
    db 03h,06h,0Ch,09h,00h,00h    
    
DATA ends

CODE SEGMENT

HEAD:      MOV DX,0606H
        MOV AL,82H
        OUT DX,AL
        
LOP1:   MOV AX,DATA
        MOV DS,AX
        ;读取bl输入的值放入al中
        mov dx, 0602h
        in  al, dx
        
        ;正反转
        mov ah, al
        and al,00000001b
        mov bx,5
        mov ds:bx,al
        ;档位
        and ah,00000110b
        ror ah,1h
        mov bx,4
        mov ds:bx,ah
        
;        mov dx, 0600h

;        mov al,00000000b
;        out dx,al
        call dang
        
        
;        mov al,01000000b
;        out dx,al
;        call dang
        ;CALL ZHUAN  ;转一圈
        call xiyi
        
LOP4:    JMP LOP1
        
        ;mov ax,4c00h
        ;int 21h
        
        
        

;----------------------------------------        
DELAY: MOV CX,0AAAAH
LOP2:    LOOP LOP2
        RET
;----------------------------------------


;----------------------------------------
    
DELAY3: 
        call DELAY
        ret
        
DELAY2: 
        call DELAY
        call DELAY
        ret


DELAY1: 
        call DELAY
        call DELAY
        call DELAY
        ret
;----------------------------------------

;----------------------------------------
;洗衣模式
xiyi:
    MOV AX,DATA
    MOV DS,AX
    MOV BX,4
    mov AL,DS:BX
    CMP AL,01H
        JE qingrou
    CMP AL,02H
        JE r1
    CMP AL,03H
        JE r2
    ret
r1: jmp zhengchang
    ret
r2: jmp shuaigan
    ret    
;----------------------------------------
;轻柔    4回合
qingrou:
    
    
p1:    call cWise1
    call cWise1
    call cWise1
    call cWise1
    call cWise1
    call cWise1
    call cWise1
    call cWise1
    call cWise1
    call cWise1
    call cWise1
    call cWise1
    call cWise1


p2:    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    call ccWise1
    
    ret

;正常    4回合
zhengchang:
    call cWise2
    call cWise2
    call cWise2
    call cWise2
    call cWise2
    call cWise2
    call cWise2
    call cWise2
    call cWise2
    call cWise2
    call cWise2
    call cWise2
    call cWise2

p4:    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2
    call ccWise2

    ret
    
;甩干    4回合
shuaigan:
;正反一圈
    
p5:    call cWise3
    call cWise3
    call cWise3
    call cWise3
    call cWise3
    call cWise3
    call cWise3
    call cWise3
    call cWise3
    call cWise3
    call cWise3
    call cWise3
    call cWise3

    

p6:    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3
    call ccWise3

    ret
;----------------------------------------



;---------------------------------------
;转一圈
zhuan:
    MOV AX,DATA
    MOV DS,AX
    MOV BX,5
    MOV AL,DS:BX
    CMP AL,00H
    JE  CWISE
    JMP CCWISE
    RET
    
;---------------------------------------

;---------------------------------------

;正转一圈
cWise:
    MOV AX,DATA
    MOV DS,AX
    
    MOV BX,4
    mov AL,DS:BX
    CMP AL,01H
        JE l1
    CMP AL,02H
        JE cWise2
    CMP AL,03H
        JE cWise3
    JMP LOP1
l1: JMP cWise1
    RET

cWise3:
MOV AX,DATA
    MOV DS,AX
    
    MOV DX,0600H
    MOV BX,00H

    MOV CL,DS:BX
    MOV AL,CL
;    OR  AL,01001111B    ;方向
    
    OUT DX,AL
;    call DANG
    CALL DELAY3
    
    ADD BX,01H
    
    MOV CL,DS:BX
    MOV AL,CL
;    OR  AL,01001111B    ;档位
    
    OUT DX,AL
;    call DANG
    CALL DELAY3
    
    ADD BX,01H
    
    MOV CL,DS:BX
    MOV AL,CL
;    OR  AL,01001111B
    
    OUT DX,AL
;    call DANG
    CALL DELAY3
    
    ADD BX,01H
    
    MOV CL,DS:BX
    MOV AL,CL
;    OR  AL,01001111B

    OUT DX,AL
;    call DANG
    CALL DELAY3

    ret

cWise2:
    MOV AX,DATA
    MOV DS,AX
    
    MOV DX,0600H
    MOV BX,00H

    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY2
    
    ADD BX,01H
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY2
    
    ADD BX,01H
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY2
    
    ADD BX,01H
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY2

    ret

cWise1:
    MOV AX,DATA
    MOV DS,AX
    
    MOV DX,0600H
    MOV BX,00H

    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY1
    
    ADD BX,01H
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY1
    
    ADD BX,01H
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY1
    
    ADD BX,01H
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY1


    ret
    
;反转一圈
ccWise:
    MOV AX,DATA
    MOV DS,AX
    MOV BX,4
    mov AL,DS:BX
    CMP AL,01H
        JE ccWise1
    CMP AL,02H
        JE ccWise2
    CMP AL,03H
        JE ccWise3
    RET


ccwise3:
    MOV AX,DATA
    MOV DS,AX
    
    MOV DX,0600H
    MOV BX,03H

    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY3
    
    DEC BX
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY3
    
    DEC BX
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY3
    
    DEC BX
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY3
    
    RET

ccwise2:
MOV AX,DATA
    MOV DS,AX
    
    MOV DX,0600H
    MOV BX,03H

    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY2
    
    DEC BX
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY2
    
    DEC BX
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY2
    
    DEC BX
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY2
    
    ret

ccwise1:
    MOV AX,DATA
    MOV DS,AX
    
    MOV DX,0600H
    MOV BX,03H

    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY1
    
    DEC BX
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY1
    
    DEC BX
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY1
    
    DEC BX
    
    MOV CL,DS:BX
    MOV AL,CL
    OUT DX,AL
    CALL DELAY1
    ret

;---------------------------------------

;---------------------------------------
;数码管显示
light0:
        mov dx, 0604h                ; 控制端口a
        mov al, 3fh
        out dx, al                    ; 将al数据输出
        ret
light1:
        mov dx, 0604h                ; 控制端口a
        mov al, 06h
        out dx, al                    ; 将al数据输出
        ret
        
        ;数字2
light2:
        mov dx, 0604h                ; 控制端口a
        mov al, 5Bh
        out dx, al                    ; 将al数据输出
        ret
        ;数字3
light3:
        mov dx, 0604h                ; 控制端口a
        mov al, 4Fh
        out dx, al                    ; 将al数据输出
        ret

        ;数字4
light4:
        mov dx, 0604h                ; 控制端口a
        mov al, 66h
        out dx, al                    ; 将al数据输出
        ret
        
        ;数字5
light5:
        mov dx, 0604h                ; 控制端口a
        mov al, 6Dh
        out dx, al                    ; 将al数据输出
        ret

        ;数字6
light6:
        mov dx, 0604h                ;控制端口a
        mov al, 7Dh
        out dx, al                    ; 将al数据输出
        ret

        ;数字7
light7:
        mov dx, 0604h                ; 控制端口a
        mov al, 07h
        out dx, al                    ; 将al数据输出
        ret

        ;数字8
light8:
        mov dx, 0604h                ; 控制端口a
        mov al, 7Fh
        out dx, al                    ; 将al数据输出
        ret

;---------------------------------------

;---------------------------------------
;输出档位
dang:
    
    MOV AX,DATA
    MOV DS,AX
    MOV BX,04H
    MOV AL,DS:BX
    
    mov cl, 0H            ;判断0
    cmp al, cl
        je light0
        
    mov cl, 01H            ;判断1
    cmp al, cl
        je light1
        
    mov cl, 02H            ;判断2
    cmp al, cl
        je light2
        
    mov cl, 03H            ;判断3
    cmp al, cl
        je light3
    

;输出方向
Fang:
    MOV AX,DATA
    MOV DS,AX
    MOV BX,05H
    MOV AL,DS:BX
    
    mov cl, 0H            ;判断0
    cmp al, cl
        je light0
        
    mov cl, 01H            ;判断1
    cmp al, cl
        je light1
        
;---------------------------------------




        
CODE ENDS 
END HEAD
        
搜索更多相关主题的帖子: OUT RET DATA MOV call 
2020-09-17 12:10
兔先生
Rank: 2
等 级:论坛游民
帖 子:41
专家分:20
注 册:2018-11-9
收藏
得分:0 
回复 楼主 兔先生
如果有大佬可以重新改编代码,也可。
2020-09-17 12:11
Valenciax
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:11
帖 子:340
专家分:2482
注 册:2016-5-15
收藏
得分:20 
编译之下都是一堆警告:暂寄器错误使用,比如

mov ds:bx,al ;8bit的al不能输出到16bit的bx,只能mov bx,ax或 mov bl,al
mov ds:bx,ah ;同上
mov AL,DS:BX ;16bit的bx不能输出到8bit的al,只能mov al,bl 或 mov ax,bx
...
...
共32个错误,楼主自我检查一下.
2020-09-17 15:26
兔先生
Rank: 2
等 级:论坛游民
帖 子:41
专家分:20
注 册:2018-11-9
收藏
得分:0 
bx只是存放地址,“ds:bx”难道也是要对应16位?
这个汇编在Wmd86上编译是通过的,不存在error和waring。
2020-09-17 20:00
兔先生
Rank: 2
等 级:论坛游民
帖 子:41
专家分:20
注 册:2018-11-9
收藏
得分:0 
回复 3楼 Valenciax
感谢大佬,使用dosbox进行编译时报错了,原因为“ds:[bx]”才是正解。
2020-09-17 20:45
快速回复:proteus无法装载汇编程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028484 second(s), 11 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved