📄 stepn.asm
字号:
; ***************************************************************************
; File: STEPN.ASM -> First Application program for the 'C54x DSKplus
;
; ***************************************************************************
.width 80
.length 55
.title "STEPN.ASM program"
.mmregs
.setsect ".text", 0x300,0
.setsect ".data", 0x0500, 1 ; defines the absolute addrs
.text
start:
DP=#004H ; DP=0000 0010 0 Smem=0000 0010 0xxx xxxx=02XX
SP=#0FFAH
ar5=#0205h
ar2=#0202h
AR4=#0204H
ar3=#203h
*ar2=#00h
bk=#04h
ar3=#stepm
; d7,d6, d5, d4, d3 ,d2,d1,d0 =port(00)
; md,stp,f/r,sped.....speed..
wait
*ar5=port(00)
tc=bit(*ar5,15-1)
if (tc) goto wait
tc=bit(*ar5,15-0)
if (tc) goto cntmd1
ntcmd0
b=*ar5
b = b & #00F8h
*ar4=b<<7
tc=bit(*ar5,15-2)
if (tc) goto srevs
sforwp
NOP
PORT(01)=*ar3+%
call tdelay
NOP
OUTP2
NOP
goto wait
NOP
NOP
srevs
PORT(01)=*ar3-%
call tdelay
NOP
NOP
OUTP3:
NOP
goto wait
nop
nop
cntmd1:
ar6 = #cntd
nexte: NOP
b=*ar6+
B= B & #0F000H
B= B << -12
if (BEQ) goto shalt
b=b-#01
if (BEQ) goto sforw
b=b-#01
if (BEQ) goto srevw
b=b-#01
if (BEQ) goto wait
NOP
NOP
sforw: NOP
b=*ar6-
brc =b
blockrepeat(stepf)
b=*ar6
b= b & #0fffh
*ar4=b<<4
PORT(01)= *ar3+%
call tdelay
NOP
nop
stepf:
nop
mar(*ar6+)
goto nexte
NOP
NOP
srevw: NOP
b=*ar6-
brc =b
blockrepeat(stepr)
b=*ar6
b= b & #0fffh
*ar4=b<<4
PORT(01)=*ar3-%
call tdelay
nop
NOP
stepr:
nop
mar(*ar6+)
goto nexte
NOP
NOP
shalt: NOP
b=*ar6-
brc =b
blockrepeat(steph)
b=*ar6
b= b & #0fffh
*ar4=b<<4
nop
NOP
call tdelay
nop
steph: NOP
nop
mar(*ar6+)
goto nexte
NOP
NOP
tdelay:
DLT2: NOP
CALL DLYT
A=*AR4
A= A-#1
*AR4=A
IF(ANEQ) GOTO DLT2
RETURN
DLYT: AR7=#0100H
AR0=#0000H
DLT1:
MAR(*AR7-)
NOP
NOP
TC = (AR0 == AR7)
IF(NTC) GOTO DLT1
NOP
RETURN
.data
stepm:
.word 000cch ; 4
.word 00066h ; 5
.word 00033h ; 6
.word 00099h ; 7
;0=halt 1=forw 2=revw 3=restart
cntd:
.word 01080h ; forw sped=080h
.word 00100h ; step 0010h
.word 00020h ; halt sped 010h=unit time=ut
.word 00010h ; step=0010h=0010h)ut
.word 02060h ; revw sped=060h
.word 00140h ; step 0010h
.word 00080h ; halt sped 080h=unit time=ut
.word 00010h ; step=0010h=0010h)ut=0010h*80h
.word 01130h ; forw sped=130h
.word 00040h ; step 040h
.word 01010h ; forw sped520h
.word 800 ; step=0010h=0010h)ut
.word 00080h ; halt sped=080h
.word 00020h ; step 0020h
.word 02120h ; revw sped120h
.word 00040h ; step=0010h=0010h)ut
.word 02010h ; revw sped=010h
.word 1200 ; step 1200
.word 03000h ; restart
.word 00000h ; step=0010h=0010h)ut
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -