| UMBC |
CMSC 391 -- Programming Microcontrollers |
|
Hello, World!
2000: .org 0x2000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Equates ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2000: .equ pStr, 0x0038 ;Print string
; pointed to by
; DPTR, must be
; terminated by
; 0 or a high bit
2000: .equ newline, 0x0048 ;print CR/LF (13
; and 10)
;;Notes: 1. This is DOS style, not Linux style.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Code ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
begin:
2000: 90 20 0A mov dptr, #hello
;;Notes: 1. The opcode for mov dptr, is 90h.
;; 2. The address of the string to be printed is 200Ah,
;; notice this is big-endian!
;; 3. This is one of the extremely few times you can
;; use 16-bit operands.
2003: 12 00 38 lcall pStr
2006: 12 00 48 lcall newline
2009: 22 ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Data ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
200A: 48 65 6C 6C
6F 2C 20 77
6F 72 6C 64
21 00 hello: .db "Hello, world!",0
©2004, Gary L. Burt