📄 chap1.asm
字号:
; Chapter 1 6808 assembly language programs; Jonathan W. Valvano; This software accompanies the book,; Embedded Microcomputer Systems: Real Time Interfacing; published by Brooks Cole, 1999;; Program 1.10. Assembly definitions of the MC68HC708XL36 I/O ports.PORTA equ $0000 8-bit bidirectional I/O portPORTB equ $0001 8-bit bidirectional I/O portPORTC equ $0002 8-bit bidirectional I/O portPORTD equ $0003 8-bit bidirectional I/O portDDRA equ $0004 specifies whether each bit is input(0) or output(1)DDRB equ $0005 specifies whether each bit is input(0) or output(1)DDRC equ $0006 specifies whether each bit is input(0) or output(1)DDRD equ $0007 specifies whether each bit is input(0) or output(1)PORTE equ $0008 8-bit bidirectional I/O portPORTF equ $0009 6-bit bidirectional I/O portPORTG equ $000A 4-bit bidirectional I/O portPORTH equ $000B 4-bit bidirectional I/O portDDRE equ $000C specifies whether each bit is input(0) or output(1)DDRF equ $000D specifies whether each bit is input(0) or output(1)DDRG equ $000E specifies whether each bit is input(0) or output(1)DDRH equ $000F specifies whether each bit is input(0) or output(1)TSC equ $0021 Timer status and controlTCNT equ $0022 16-bit up counter incremented every clock period; Program 1.14. Assembly software that reads from port A and writes to port B.; Program to implement a NOT gate; Port A are the 8 digital inputs and Port B are the 8 digital outputs; Software continuously repeats the following; 1) Read value from Port A; 2) Calculate the logical complement; 3) Write the result out to Port BNotGate lda PORTA Read from Port A into Register A coma Logical complement sta PORTB Write from Register A to Port B bra NotGate; Program 1.16. Assembly software that initializes an I/O port to input.; MC68HC708XL36 clr DDRA; Program 1.18. Assembly software that reads from an I/O port input.; MC68HC708XL36 lda PORTA sta Happiness; Program 1.20. Assembly software that initializes an I/O port to output.; MC68HC708XL36 lda #$0F sta DDRA;Program 1.22. Assembly software that outputs an I/O port output.; MC68HC708XL36 lda #$FF sta PORTA; Program 1.24. Assembly subroutines that provide initialization, read and write access an I/O port.; MC68HC708XL36Init sta DDRA rtsSet sta PORTA rtsRead lda PORTA rts; Program 1.26. Assembly subroutine that initializes the I/O port.; MC68HC708XL36PORTC equ $0002 ;I/O portDDRC equ $0006 init mov #$F0,DDRC rts; Program 1.27. Assembly program that implements the 4 bit NOT gate.; MC68HC708XL36 org $6E00 ;EEPROMmain rsp ;SP=$00FF bsr init ;ritualloop lda PORTC ;input coma ;logical not nsa ;swap 7-4, 3-0 sta PORTC ;output bra loop ;repeat org $FFFE fdb main ;reset vector
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -