-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathgraphic15.src
140 lines (106 loc) · 2.24 KB
/
graphic15.src
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
.page
.subttl 'graphics15'
; clear (de-allocate) 10k graphics area, if installed
clrhir
lda mvdflg ;see if already cleared
bne clrh05 ;branch if not,
rts ;else done
clrh05
ldy #0
sty mvdflg ;flag 'moved'
lda memsiz+1 ;is this a 16k or a 64k ted system?
bmi clrh10 ;branch if 64k
; to de-allocate hires ram in a 16k ted, it is necessary to:
; 1. move strings up to the normal top of memory
; 2. correct the memsiz and fretop pointers
; 3. fix the forward pointers in all string descriptors
jsr garba2 ;clean up string area
jsr getdif ;get memsiz-fretop in x,y
lda msiz ;set up destination pointers for move
sta index1
lda msiz+1
sta index1+1
jsr mover ;do move
ldx #1
clrh06
lda msiz,x
sta memsiz,x
lda index1,x
sta fretop,x
dex
bpl clrh06
jmp fixfor ;fix forward pointers in all string descriptors, do rts
clrh10
ldy #0
sty mvdflg ;change flag
sty index1 ;set up pointers for memory transfer
sty index2
lda #$10
sta index1+1 ;destination
lda #$40
sta index2+1 ;origin
clrh20
jsr indin2 ;lda (index2),y
sta (index1),y
iny
bne clrh20 ;do 1 full page
inc index1+1
inc index2+1
lda strend+1 ;test if page containing last bytes was moved
cmp index2+1
bcs clrh20 ;keep going until msb of index2 > msb of strend
lda strend+1 ;update pointers
sec
sbc #$30
sta strend+1
lda txttab+1
sbc #$30
sta txttab+1
lda vartab+1
sbc #$30
sta vartab+1
lda arytab+1
sbc #$30
sta arytab+1
lda datptr+1
sbc #$30
sta datptr+1
jmp seth30
addoff
lda (fndpnt),y
bit mvdflg
bne addof2 ;if z then subtract.else add $30
sec
sbc #$30
sta (fndpnt),y
rts
addof2
clc
adc #$30
sta (fndpnt),y
rts
isgrap ;test if graphics mode allocated, error if not
lda mvdflg
beq isgrer ;oh-oh, bad news
rts ;ok!
isgrer
ldx #errng ;'no graphics area' error
jmp error
go2txt ;switch to text mode subroutine
lda ted+6 ;turn off bit map mode
and #%11011111
sta ted+6
lda ted+7 ;turn off multicolor mode
and #%11101111
sta ted+7
lda ted+20 ;restore video matrix base
and #%00000111
ora #%00001000 ;$0800
sta ted+20
lda ted+18 ;switch to 'fetch from rom'
ora #%00000100
sta ted+18
lda #0
sta graphm ;reset text flag
rts
;.end