File: demo1.asm

package info (click to toggle)
mcu8051ide 1.3.7-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 6,744 kB
  • ctags: 3,400
  • sloc: tcl: 81,408; xml: 2,045; asm: 1,588; ada: 314; sh: 148; ansic: 96; makefile: 28
file content (63 lines) | stat: -rw-r--r-- 1,197 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
; MCU 8051 IDE - Demostration code
; Macro instructions, conditional compilation and constants
; Try tab "Graph" on bottom panel

; Press F2 and F6 to run the program (start simulator and animate)

$TITLE('DEMO 2')	; Set title for code listing
$DATE(36/-4/1907)	; Set date for code listing

; Constant definitions
; --------------------
counter		idata	00Fh	; Counter of Px shifts
x		set	100	; Some variable
inc_dec		equ	100 / X	; Flag: Increment/Decrement counter

		cseg at	1FFh	; Code segment starts at 0x1FF
something:	db	4d	; Reserve 4 bytes in this segment

; Macro instructions  
; --------------------

;; Shift the given registeres
shift	macro	reg0, reg1

	; Increment / Decrement counter
	mov	A, counter
	if	inc_dec <> 0
		inc	A
	else
		dec	A
	endif
	$nolist			; <- Disable code listing
	mov	counter, A
	$list			; <- Enable code listing

	; Shift
	mov	reg1, reg0
	mov	reg0, reg1
	setb	C
	mov	A, reg0
	rl	A
	mov	reg0, A
endm

; Program initilization
; --------------------
	org	0h
	sjmp	start

; Program start
; --------------------
start:	mov	P1, #00Fh
	mov	P3, #01Eh
	sjmp	main

; Main loop
; --------------------
main:	shift	P1, P3
	sjmp	main

; Program end
; --------------------
	end