File: jumptable.asm

package info (click to toggle)
pasmo 0.5.3-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 892 kB
  • ctags: 1,805
  • sloc: cpp: 8,508; asm: 3,020; sh: 790; makefile: 627
file content (107 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (8)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
;	jumptable.asm
;	Test of ## operator.

	org 100h

bdos	equ 5

conin	equ 1
pstring	equ 9

start	jp init

jpfunc	macro nfunc
	jp function_ ## nfunc
	endm

table:
	irp func, mess1, mess2, presskey, endline
	jpfunc func
	endm

print	ld c, pstring
	jp bdos

init
	if 0

	rept 3, nfunc
	ld a, nfunc
	call usefunc
	endm

	else

	rept 3, nfunc, 2, -1
	ld a, nfunc
	call usefunc
	endm

	endif

	ld a, 3
	call usefunc

	ld c, 0
	call bdos

usefunc
	ld b, a
	add a, a
	add a, b
	ld c, a
	ld b, 0
	ld hl, table
	add hl, bc
	push hl
	ret

function_mess1	proc
	local message

	ld de, message
	call print
	ret

message	db "Hello, world\r\n$"

	endp

function_mess2	proc
	local message

	ld c, pstring
	ld de, message
	jp bdos

message	db 'Have a nice day', 0Dh, 0Ah, '$'

	endp

function_presskey	proc
	local message

	ld c, pstring
	ld de, message
	call bdos
	ld c, conin
	call bdos
	ret

message	db 'Press any key...$'

	endp

function_endline	proc
	local message

	ld de, message
	jp print

message	db 0Dh, 0Ah, '$'

	endp

	end start

;	End of jumptable.asm