.include "labmac.i" .section .text .globl main main: MOVE.L #0xff, D1 JSR outhxl MOVE.L #0x12345678, D1 JSR outhxl MOVE.L #0xABCDEF00, D1 JSR outhxl MOVE.L #0xA70C, D1 JSR outhxl RTS outhxl: ROL.L #8, D1 | put 1. byte (left) in position JSR outhex | call output ROL.L #8, D1 | put 2. byte in position JSR outhex | call output ROL.L #8, D1 | put 3. byte in position JSR outhex | call output ROL.L #8, D1 | put 4. byte (right) in position JSR outhex | call output MOVE.L #10, D1 | print a new line CALLEXEC LCD_PutChar RTS outhex: MOVE.L D1, D7 | copy input number LSR.B #4, D1 | isolate left hex digit JSR digit | call output routine for 1st digit MOVE.L D7, D1 | restore input AND.L #0x0F, D1 | isolate right hex digit JSR digit | call output routine for 2nd digit MOVE.L #' ', D1 | print a space character CALLEXEC LCD_PutChar MOVE.L D7, D1 | restore input RTS Zero = 48 | ascii code for 0 LetterA = 55 | ascii code for A - 10 digit: CMP.B #10, D1 | Is digit within 0..9 ? BGE abcdef ADD.B #Zero, D1 | Yes: transform 0 ? 0, 1 ? 1 CALLEXEC LCD_PutChar | print as character RTS abcdef: ADD.B #LetterA, D1 | No: transform 10 ? A, 11 ? B CALLEXEC LCD_PutChar | print as character RTS