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
|
;;; -*- asm -*-
;;;
.ORG 4000h
call cond_jr_no ;cd
halt ;76
inc8:
ld bc,data8 ;01
;; BC should have &data8
ld a,(bc) ;0a
inc a ;3c
ld (bc),a ;02
halt
dec8:
ld a,0a5h ;3e
dec a ;3d
ret ;c9
;; Test jump-not-taken of JR [C,NC,Z]
cond_jr_no:
ld a,01h ;3e 01
cp a ;bf
jr nz,wrong ;20 07
ccf ;3f
jr c,wrong ;38
scf ;37
jr nc,wrong ;30
ret ;c9
wrong:
jp wrong
;; Test jump-taken of JR [C,NC,Z]
cond_jr_yes:
ld a,01h ;3e 01
ld b,02h ;06 02
cp b ;b8
jr nz,right1 ;20
jp wrong
right1: scf ;37
jr c,right2 ;38
jp wrong
right2: ccf ;3f
jr nc,right3 ;30
jp wrong
right3: ret ;c9
data8:
.db 0a5h
data16:
.dw data8
|