?? main.asm
字號:
;*****************************************************************
;* This stationery serves as the framework for a *
;* user application (single file, absolute assembly application) *
;* For a more comprehensive program that *
;* demonstrates the more advanced functionality of this *
;* processor, please see the demonstration applications *
;* located in the examples subdirectory of the *
;* Metrowerks CodeWarrior for the HC12 Program directory *
;*****************************************************************
; export symbols
XDEF MAIN ; export 'Entry' symbol
ABSENTRY MAIN ; for absolute assembly: mark this as application entry point
; include derivative specific macros
INCLUDE 'mc9s12dg128.inc'
ROMStart EQU $4000 ; absolute address to place code/constant data
; variable/data section
ORG RAMStart
; Insert here your data definition. For demonstration, temp_byte is used.
temp_byte ds.b 1
; code section
ORG ROMStart
MAIN:
CLI ; enable interrupts
MOVB #1,temp_byte ; just some demonstration code
NOP
; Insert here you own code
LDD #$FFFF
STD DDRAB
BCLR PORTA,mPORTA_BIT7
CALL DELAY
BSET PORTA,mPORTA_BIT7
CALL DELAY
LDAA #$30
STAA $1000
CALL WRI
CALL DELAY
LDAA #$0C
STAA $1000
CALL WRI
CALL DELAY
LDAA #$01
STAA $1000
CALL WRI
CALL DELAY
LDAA #$06
STAA $1000
CALL WRI
CALL DELAY
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DISPLAY:LDX #$30
STX $1002 ;;R2
LDY #$30
STY $1006
LDAA #$80 ;;COMM
STAA $1000
CALL WRI
DISP: STX $1002
CALL WRD
CALL DELAY
LDX $1002
DBNE X,DISP
CALL DELAY
DD: DBNE X,DD
DEX
JMP DD
WRI:BCLR PORTA,mPORTA_BIT4
BSET PORTA,mPORTA_BIT5
WRI1:
LDAA #$FF
STAA PORTB
BSET PORTA,mPORTA_BIT6
LDAA PORTB
BCLR PORTA,mPORTA_BIT6
LDAB #$80
STAB $1004
ANDA $1004
BEQ WRI1
LDAA #$FF
STAA DDRB
BCLR PORTA,mPORTA_BIT5
LDAA $1000
STAA PORTB
BSET PORTA,mPORTA_BIT6
BCLR PORTA,mPORTA_BIT6
RTC
WRD:BCLR PORTA,mPORTA_BIT4
BSET PORTA,mPORTA_BIT5
WRD1:LDAA #$FF
STAA PORTB
BSET PORTA,mPORTA_BIT6
LDAA PORTB
BCLR PORTA,mPORTA_BIT6
LDAB #$80
STAB $1005
ANDA $1005
BEQ WRD1
LDAA #$FF
STAA DDRB
BSET PORTA,mPORTA_BIT4
BCLR PORTA,mPORTA_BIT5
LDAA $1007
STAA PORTB
INCA
STAA $1007
BSET PORTA,mPORTA_BIT6
BCLR PORTA,mPORTA_BIT6
RTC
DELAY:LDY #$0006
DELAY0:LDX #$FFFF
DELAY1:DBNE X, DELAY1
DBNE Y, DELAY0
RTC
;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFE
fdb MAIN ; Reset
END
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -