lecture17

lecture17 - ECE252 Microprocessors Spring 2011 Lecture 17:...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Jie Hu, ECE/NJIT, Spring 2011 ECE252 L17-Programming.1 ECE252 Microprocessors Spring 2011 Lecture 17: Programming 68000 Jie Hu http://web.njit.edu/~jhu/ece252/002
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Jie Hu, ECE/NJIT, Spring 2011 ECE252 L17-Programming.2 Block Diagram of Macintosh 512K Motherboard Processor 68000 I/O Interface 6522 Real- time clock Serial I/O 8530 Floppy disk controller System ROM RAM buffers and Mux PAL decoders Dynamic RAM 512KB Sound logic Video logic Speaker Video display Control signals Modem Printer Mouse Keyboard System bus Disk drive
Background image of page 2
Jie Hu, ECE/NJIT, Spring 2011 ECE252 L17-Programming.3 Review of Last Lecture Subroutine Parameter passing by Value by Reference by Stack Number Conversion BCD to Binary Conversion Binary to BCD Conversion
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Jie Hu, ECE/NJIT, Spring 2011 ECE252 L17-Programming.4 Today’s Lecture Number Conversion BCD to ASCII Conversion Binary to ASCII Conversion ASCII to Binary Conversion ASCII to BCD Conversion Programming 68000 Keyboard Buffer Search Data Table String Operations Sorting Command Recognizer Control Applications
Background image of page 4
Jie Hu, ECE/NJIT, Spring 2011 ECE252 L17-Programming.5 BCD to ASCII Code Conversion Needed when to print out a BCD number to the monitor For example: 0001 0010 0111 (BCD) print out ‘127’ ASCII code of string ‘127’ is: $31, $32, $37 Assume lower word of D3 holds a BCD number PBCD MOVE.W #3, D2 ;initialize loop counter MOVE.W D3, D4 ;copy to D4 CONT3 ROL.W #4, D4 ;rotate to lower 4 bits MOVE.B D4, D1 ;copy to D1 ANDI.B #$0F, D1 ;get the BCD digit ADDI.B #$30, D1 ;convert to ASCII MOVE.B #6, D0 TRAP #15 DBRA D2, CONT3 ;to next BCD digit RTS
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Jie Hu, ECE/NJIT, Spring 2011 ECE252 L17-Programming.6 Binary to ASCII Conversion Needed when to print out a binary number in decimal format to the monitor How? First convert to BCD, Next from BCD to ASCII code (for printing) Example: Lower word of D2 holds a binary number (<10000) PBIN BSR B2BCD ;call B2BCD to convert to BCD BSR PBCD ;convert BCD to ASCII RTS
Background image of page 6
Jie Hu, ECE/NJIT, Spring 2011 ECE252 L17-Programming.7 ASCII to Binary Conversion Read keyboard inputs (in ASCII codes) and convert to binary value Example: input ‘7’’8’ 78 in decimal, 101110 in binary Example: store the converted binary value in lower word of D2 A2BIN CLR.L D1 CLR.L D2 CONT4 MOVE.B #5, D0 ;read keyboard input TRAP #15 MOVE.B #6, D0 ;display the input TRAP #15 CMPI.B #$D, D1 ;if carriage return?
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 22

lecture17 - ECE252 Microprocessors Spring 2011 Lecture 17:...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online