annotate bgcolor.s16 @ 46:51672bd41cdd

Rework data segment setup to allow a stack segment and to add space for push and pop instructions
author Michael Pavone <pavone@retrodev.com>
date Tue, 30 Aug 2016 20:50:54 -0700
parents 6e7bfe83d2b0
children 8e39a877c651
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
1
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
2 ;r0 = VDP address
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
3 ;r1 = current color
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
4 ;r2 = color increment
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
5 ;r3 = target line
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
6 ;r4 = screen bottom
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
7 ;r5 = scratch
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
8 ;r6 = right edge
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
9 ;r7 = counter
18
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
10 ;r8 = secondary counter
43
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
11 ldim 1, r0
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
12 ldim 240, r4
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
13 ldimh 0, r4
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
14 ;320 == $140
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
15 ldim $40, r6
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
16 ldimh 1, r6
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
17 top
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
18 ldim 0, r1
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
19 ldim 1, r2
43
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
20 ldim 5, r3
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
21 ldimh 1, r3
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
22 ldim 16, r7
18
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
23 ldim 0, r8
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
24
43
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
25 waitfirst
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
26 ini $C, r5
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
27 cmp r5, r3
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
28 bne waitfirst
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
29 ldim -1, r3
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
30 bra waithblank
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
31
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
32 linestart
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
33 waitline
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
34 ini $C, r5
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
35 cmp r5, r3
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
36 bne waitline
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
37
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
38 waithblank
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
39 ini $D, r5
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
40 cmp r5, r6
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
41 bgr waithblank
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
42
43
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
43 outi 14, r0
6e7bfe83d2b0 Changed the design to vastly simplify the video hardware and support a 23-bit address space on the CPU
Michael Pavone <pavone@retrodev.com>
parents: 18
diff changeset
44 outi 14, r1
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
45 add r2, r1, r1
18
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
46 addi 2, r3
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
47
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
48 addi -1, r7
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
49 bne normal
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
50 ldim 16, r7
18
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
51 ldim 0, r1
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
52
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
53 addi 1, r8
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
54 cmpi 3, r8
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
55 beq cyan
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
56 cmpi 5, r8
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
57 beq magenta
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
58 cmpi 6, r8
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
59 beq grey
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
60 ;TODO: replace with lsli once it works in the assembler
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
61 add r2, r2, r2
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
62 add r2, r2, r2
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
63 add r2, r2, r2
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
64 add r2, r2, r2
18
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
65
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
66
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
67 normal
18
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
68 cmp r3, r4
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
69 bcs top
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
70 bra linestart
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
71
18
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
72 cyan
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
73 ldim $11, r2
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
74 bra normal
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
75 magenta
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
76 ldim $01, r2
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
77 ldimh $01, r2
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
78 bra normal
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
79 grey
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
80 ldim $11, r2
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
81 ldimh $01, r2
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
82 bra normal
cc885122e9e3 More colors in the bgcolor sample
Michael Pavone <pavone@retrodev.com>
parents: 14
diff changeset
83
14
769120da2c1f Make bgcolor demo fancier
Michael Pavone <pavone@retrodev.com>
parents: 11
diff changeset
84