396
|
1 nam WInfo
|
|
2 ttl OS9 Level II sub to get window information - Ron Lammardo
|
|
3
|
|
4 *
|
|
5 * 11/22/87 - Edition #1 - for OS9 Level II V02.00.01
|
|
6 * 12/22/95 - Edition #2 - for ALL versions of OS-9 by Alan DeKok
|
|
7 *
|
|
8
|
|
9 ifp1
|
|
10 use defsfile
|
|
11 endc
|
|
12
|
|
13 typelang set sbrtn+objct
|
|
14 attrev set reent+revision
|
|
15 revision set 1
|
|
16
|
|
17 mod Eom,Mname,Typelang,Attrev,Start,Datend
|
|
18
|
|
19 mname fcs /WInfo/
|
|
20 edition fcb 2 edition
|
|
21
|
|
22 org 0
|
|
23 use winfodefs
|
|
24
|
|
25 org 0
|
|
26 stackadr rmb 2 stack address for return
|
|
27 de rmb 1 device table entry #
|
|
28 sctype rmb 1 screen type
|
|
29 offset rmb 2 screen start offset in block
|
|
30 datimg rmb 2 address of sys DAT image in sysprc
|
|
31 datadr rmb 2 address of sys DAT in system
|
|
32 entry rmb 2 address of currently proccessed window entry
|
|
33 wnum rmb 1 window entry number
|
|
34 scrblock rmb 1 block # containing screen mem
|
|
35 blockcnt rmb 1 # of blocks in screen
|
|
36 wstart rmb 2 x,y coordinates of window start on screen
|
|
37 wsize rmb 2 x,y size of window
|
|
38 cwstart rmb 2 x,y coordinates of current working area
|
|
39 cwsize rmb 2 x,y size of current working area
|
|
40 paramadr rmb 2 address of window name to dump
|
|
41 paramln. rmb 1
|
|
42 paramln rmb 1 size of window name to dump
|
|
43 vdgadr rmb 2 address of vdg screen
|
|
44 vdgflag rmb 1 vdg screen flag (1=yes)
|
|
45 scrnaddr rmb 2 address of screen
|
|
46 d$devtbl rmb 2 address of device table
|
|
47 mdname rmb 2 adress of module name
|
|
48 drvnam rmb 2 address of device driver name
|
|
49 buffaddr rmb 2 address of return packet
|
|
50 buffln. rmb 1 dummy byte
|
|
51 buffln rmb 1 length of return packet..must be > WI$size
|
|
52 weaddr rmb 2 logical address of window entry insys map (debugging only)
|
|
53 devmaddr rmb 2 device static storage entry in sys map (debugging only)
|
|
54 fgc rmb 1 foreground color
|
|
55 bgc rmb 1 background color
|
|
56 bdc rmb 1 border color
|
|
57 curx rmb 1 x coordinate of cursor
|
|
58 cury rmb 1 y coordinate of cursor
|
|
59 bpr rmb 2 bytes per row
|
|
60 stymark rmb 1 screen type marker byte
|
|
61 paltaddr rmb 2 address of palette registers
|
|
62 msb rmb 1 working field - msb for 2 digit mults
|
|
63 lsb rmb 1 working field - lsb for 2 digit mults
|
|
64 lset rmb 1 logic set #
|
|
65 psetgb rmb 2 pset group/buffer
|
|
66 fontgb rmb 2 font group/buffer
|
|
67 gcurgb rmb 2 gfx cursor group/buffer
|
|
68 minidat rmb 2 temp dat for cpymem
|
|
69 bfngrp rmb 2 buffer #/group return
|
|
70 drawcrsr rmb 4 draw cursor position - xxyy
|
|
71 sysdat rmb 16 system DAT image
|
|
72 devname rmb 5 device descriptor name
|
|
73 devtable rmb 9 device table entry
|
|
74 devmem equ . device memory copy
|
|
75 sc rmb 32 screen table
|
|
76 we rmb 64 window entry
|
|
77 rmb 32 filler so we got 128 bytes for dev memory
|
|
78 datend equ .
|
|
79
|
|
80 E$Param equ $38 bad Parameter error
|
|
81
|
|
82 cc3io fcs /CC3IO/ used to compare device driver name
|
|
83
|
|
84 tmpdat fcb 0,0 mini-dat image for block 0 data fetches
|
|
85
|
|
86 blnkpalt fcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
|
|
87 fcb $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
|
|
88
|
|
89 stytable fcb $01,$03,$03,$0f
|
|
90 blktable fcb 1,1,0,0,2,2,4,4
|
|
91
|
|
92 errmsg1 equ *
|
|
93 fcc /Requested device not in device table/
|
|
94 errm1ln equ *-errmsg1
|
|
95 errmsg2 fcc /Requested device is not CC3IO/
|
|
96 errm2ln equ *-errmsg2
|
|
97 errmsg3 fcc /Can not access window until written to/
|
|
98 errm3ln equ *-errmsg3
|
|
99
|
|
100 start equ *
|
|
101 pshs u,dp save registers
|
|
102 tfr s,d put in 'd' for computations
|
|
103 clrb clear lsb
|
|
104 suba #1 bump down page to make sure we don't conflict
|
|
105 tfr a,dp now set direct page
|
|
106 tfr d,u and set u register
|
|
107 sts <stackadr save address of stack
|
|
108 leax stackadr+2,u start adrress of bytes to init
|
|
109 ldb #devtable end addr..# of bytes to clear
|
|
110 lda #$ff fill character
|
|
111 lbsr zapblock init the characters
|
|
112
|
|
113 * get passed parameters
|
|
114
|
|
115 ldx 5,s # of parameters
|
|
116 cmpx #2 do we have two params?
|
|
117 lbne badparms no...error
|
|
118 ldx 7,s 1st param addr (window name addr)
|
|
119 stx <paramadr save the window name addr
|
|
120 os9 F$PrsNam get end of name
|
|
121 lbcs exit exit on error
|
|
122 clra clear msb
|
|
123 std <paramln. save window name length
|
|
124 ldx 11,s 2nd param addr (buffer addr)
|
|
125 stx <buffaddr save the buffer address
|
|
126 ldx 13,s 2nd param length
|
|
127 stx <buffln. save the buffer length address
|
|
128 cmpx #WI$Size check if buffer big enough
|
|
129 lblo smllbuff no..send buffer to small status
|
|
130
|
|
131 * clear return buffer
|
|
132
|
|
133 ldx <buffaddr address of return buffer
|
|
134 ldb #WI$ermsg end address to init
|
|
135 lda #$ff fill char
|
|
136 lbsr zapblock zap the block
|
|
137 ldb #40 # of bytes to init
|
|
138 lda #$20 space fill
|
|
139 lbsr zapblock zap the message
|
|
140
|
|
141 * get system process descriptor for sys DAT image
|
|
142
|
|
143 leax tmpdat,pcr addr of sys mini-dat
|
|
144 tfr x,d put it in d
|
|
145 ldx #$004C Addr of dat image in system direct page
|
|
146 ldy #2 2 bytes to get
|
|
147 pshs u save u
|
|
148 leau datadr,u addr of receiver
|
|
149 os9 F$CpyMem get it
|
|
150 puls u restore u
|
|
151 lbcs exit exit on error
|
|
152 leax tmpdat,pcr addr of sys mini-data
|
|
153 tfr x,d put it in d
|
|
154 ldx datadr,u physical addr of sys DAT in sys addr map
|
|
155 pshs u save u
|
|
156 leay sysdat,u addr of receiver
|
|
157 sty <datimg save it for later
|
|
158 tfr y,u put in u for call
|
|
159 ldy #16+16+1 16 bytes to get in image
|
|
160 os9 F$CpyMem get it
|
|
161 puls u restore u
|
|
162 lbcs exit and exit on error
|
|
163
|
|
164 ldx <datimg get ptr to system DAT image
|
|
165 lda 16+16,x grab Level III SCF map info
|
|
166 beq not.l3
|
|
167 sta 3,x
|
|
168 inca
|
|
169 sta 5,x
|
|
170
|
|
171 * get offset in system map to device tables
|
|
172 not.l3 ldy #2 2 bytes to get
|
|
173 ldd <datimg addr of sys DAT image
|
|
174 ldx #D.DevTbl addr of device table addr
|
|
175 pshs u save u
|
|
176 leau d$devtbl,u addr of reciever
|
|
177 os9 F$Cpymem get it
|
|
178 puls u restore u
|
|
179 lbcs exit exit on error
|
|
180 clr <de clear device table entry #
|
|
181 ldx d$devtbl,u addr of device table
|
|
182 leax -$0D,x back off one entry for increment in loop
|
|
183 stx d$devtbl,u and save it again
|
|
184 leax devtable,u get the addr of our copy of devtable
|
|
185 stx <entry save the entry addr for later
|
|
186
|
|
187 * just do an I$Attach instead of rooting through the device table
|
|
188
|
|
189 lda #READ. read-only permissions
|
|
190 ldx <paramadr point to window name
|
|
191 pshs u save for later
|
|
192 OS9 I$Attach get U=address of device table entry
|
|
193 puls x kill end of device name pointer
|
|
194 lbcs error1 exit on error
|
|
195
|
|
196 OS9 I$Detach so link count is correct
|
|
197 exg x,u now U=memory, and X=ptr to device table entry
|
|
198
|
|
199 leay devtable,u addr of reciever
|
|
200 pshs u save u
|
|
201 tfr y,u put reciever addr in u
|
|
202 ldy #9 copy table entry
|
|
203 ldd <datimg addr of sys DAT image
|
|
204 os9 F$Cpymem get it
|
|
205 puls u restore u
|
|
206 lbcs exit exit on error
|
|
207 leax devtable,u
|
|
208 lda V$USRS,x test for entry in use
|
|
209 lbeq error3 if not in use...give out error saying so
|
|
210
|
|
211 * Alan DeKok's mod: lots of code removed here
|
|
212
|
|
213 * get driver name offset
|
|
214
|
|
215 ldx <entry get device entry address
|
|
216 ldx V$DRIV,x get driver module start addr
|
|
217 leax M$Name,x get addr of module name
|
|
218 ldy #2 get 2 bytes
|
|
219 ldd <datimg addr of sys DAT image
|
|
220 pshs u save u
|
|
221 leau mdname,u addr of reciever
|
|
222 os9 F$CpyMem get it
|
|
223 puls u restore u
|
|
224 lbcs exit exit on error
|
|
225
|
|
226 * now get actual driver name
|
|
227
|
|
228 ldx <entry addr of deice entry
|
|
229 ldd V$DRIV,x driver module start addr
|
|
230 addd mdname,u + module offset to driver name
|
|
231 tfr d,x put it in x so we can grab it
|
|
232 ldy #5 5 bytes in name (CC3IO)
|
|
233 ldd <datimg addr of sys DAT image
|
|
234 pshs u save u
|
|
235 leau devname,u addr of receiver
|
|
236 os9 F$CpyMem get it
|
|
237 puls u restore u
|
|
238 lbcs exit exit on error
|
|
239
|
|
240 * we got the requested device...now see if its cc3io
|
|
241
|
|
242 ldb #5 5 bytes to compare
|
|
243 leax cc3io,pcr get addr of 'CC3IO'
|
|
244 leay devname,u get addr of the driver nam
|
|
245 os9 F$CmpNam see if they're the same
|
|
246 lbcs error2 if not-skip to next entry
|
|
247
|
|
248 * get the device static storage
|
|
249
|
|
250 ldx <entry addr of device entry
|
|
251 ldd V$STAT,x addr of static storage
|
|
252 tfr d,x put in x so we can get it
|
|
253 stx <devmaddr save device mem addr
|
|
254 ldd <datimg addr of sys DAT image
|
|
255 ldy #$80 bytes to get
|
|
256 pshs u save u
|
|
257 leau devmem,u addr of receiver
|
|
258 os9 F$CpyMem get it
|
|
259 puls u restore u
|
|
260 lbcs exit exit on error
|
|
261
|
|
262 * get the window entry number
|
|
263
|
|
264 leax devmem,u addr of device mem
|
|
265 lda $35,x offset to window entry #
|
|
266 sta wnum,u save it
|
|
267
|
|
268 * check if its a vdg screen
|
|
269
|
|
270 clr <vdgflag else clear the flag
|
|
271 leax devmem,u addr of device memory
|
|
272 lda 6,x offset to window type
|
|
273 anda #$80 check the high bit
|
|
274 lbeq vdgscrn if not set,its a vdg screen so jump
|
|
275
|
|
276 * get actual window entry
|
|
277
|
|
278 lda wnum,u window entry #
|
|
279 ldb #64 window entry size
|
|
280 mul find offset
|
|
281 addd #$1280 add it to start of window entrys
|
|
282 std <weaddr save window entry address
|
|
283 tfr d,x put in x so we can get it
|
|
284 ldy #64 64 bytes to get in window entry
|
|
285 ldd <datimg addr of sys DAT image
|
|
286 pshs u save u
|
|
287 leau we,u addr of receiver
|
|
288 os9 F$CpyMem get it
|
|
289 puls u restore u
|
|
290 lbcs exit exit on error
|
|
291
|
|
292
|
|
293 * check if window ok
|
|
294
|
|
295 lda we,u check msb of screen table address
|
|
296 cmpa #$ff is it valid ???
|
|
297 lbeq error3 send error message
|
|
298
|
|
299 * get screen table entry
|
|
300
|
|
301 ldx we,u address of screen table
|
|
302 ldy #32 32 bytes in screen table
|
|
303 ldd <datimg addr of sys DAT image
|
|
304 pshs u save u
|
|
305 leau sc,u addr of receiver
|
|
306 os9 F$CpyMem get it
|
|
307 puls u restore u
|
|
308 lbcs exit exit on error
|
|
309 leax sc,u address of screen table
|
|
310 ldb 5,x border prn
|
|
311 stb <bdc save it
|
|
312 ldb ,x screen type
|
|
313 stb <stymark
|
|
314
|
|
315 * remove bias to get actual screen type
|
|
316
|
|
317 cmpb #$80
|
|
318 bls lowtype
|
|
319 ldb #4 4 = 16 colors possible
|
|
320 stb <stymark make that the screen type marker
|
|
321 ldb #$87
|
|
322 subb ,x
|
|
323 bra getblock
|
|
324 lowtype equ *
|
|
325 addb #4
|
|
326 getblock equ *
|
|
327 stb <sctype save the screen type
|
|
328 decb decrement for indexing
|
|
329 leax blktable,pcr address of block count table
|
|
330 lda b,x get block count (via indexing table)
|
|
331 sta <blockcnt save it
|
|
332 leax sc,u address of screen table
|
|
333 lda 1,x get first block used
|
|
334 sta <scrblock save it
|
|
335 leax 16,x address of palettes
|
|
336 stx <paltaddr save it for later
|
|
337 leax we,u addr of window entry
|
|
338
|
|
339 * get screen start in block
|
|
340
|
|
341 leax $34,x screen start
|
|
342 lda ,x+ get msb
|
|
343 suba #$80 ?????
|
|
344 ldb ,x+ get lsb
|
|
345 std <offset save screen offset
|
|
346 ldy ,x++ get screen start coordinates
|
|
347 sty <wstart save them
|
|
348 ldd ,x++ get screen size (x,y)
|
|
349 std <wsize save it
|
|
350 leax we,u get start of window entry
|
|
351 leax 5,x addr of cwarea start
|
|
352 ldy ,x++ working area start coordinates
|
|
353 sty <cwstart save them
|
|
354 ldd ,x++ working area size coordinates
|
|
355 std <cwsize save them
|
|
356 cmpd <wsize see if its same as total window size
|
|
357 beq getbpr if it is,skip next section
|
|
358
|
|
359 * adjust block offset to take change working area into account
|
|
360
|
|
361 clr <msb clear temp area
|
|
362 lda <cwstart x offset of area
|
|
363 lsla multiply by 2 for attribute bytes
|
|
364 sta <lsb save it
|
|
365 lda <cwstart+1 y offset of area
|
|
366 lsla multiply by 2 for attribute bytes
|
|
367 ldb <wsize x-size of window
|
|
368 mul mulitply
|
|
369 addd <msb add x offset of area
|
|
370 addd <offset add original block offset
|
|
371 std <offset save new block offset
|
|
372
|
|
373 * get # of bytes per row and cursor coordinates
|
|
374
|
|
375 getbpr equ *
|
|
376 ldx #$1075 address of gfx table start pointer
|
|
377 ldy #2 # of bytes to get
|
|
378 ldd <datimg addr of sys DAT image
|
|
379 pshs u save u
|
|
380 leau msb,u addr of receiver
|
|
381 os9 F$Cpymem get it
|
|
382 puls u restore u
|
|
383 lbcs exit exit on error
|
|
384 lda <wnum get window entry number
|
|
385 ldb #$12 size of gfx table entry
|
|
386 mul get the offset to start of our gfx window entry
|
|
387 addd #1 add 1 for draw cursor start
|
|
388 ldx <msb load addr of table start
|
|
389 leax d,x and add offset
|
|
390 ldy #4 get 4 bytes
|
|
391 ldd <datimg addr of sys DAT image
|
|
392 pshs u save u
|
|
393 leau drawcrsr,u addr of receiver
|
|
394 os9 F$Cpymem get it
|
|
395 puls u restore u
|
|
396 lbcs exit exit on error
|
|
397
|
|
398 clr <curx clear fields
|
|
399 clr <cury
|
|
400 leax we,u address of window entry
|
|
401 ldd $14,x butes per row
|
|
402 std <bpr save bytes per row
|
|
403
|
|
404 * get foreground/background prn's
|
|
405
|
|
406 leay stytable,pcr addr of screen type mask table
|
|
407 ldb <stymark get sty marker byte
|
|
408 decb decrement for indexing
|
|
409 leay b,y addr of mask (via indexing)
|
|
410 ldd $16,x get fore/back palette #'s
|
|
411 anda ,y strip of bias againt mask
|
|
412 andb ,y
|
|
413 sta <fgc save foreground prn
|
|
414 stb <bgc save background prn
|
|
415
|
|
416 lda $1A,x logic set #
|
|
417 sta <lset save it
|
|
418 lda $1B,x block # of font
|
|
419 ldy $1C,x block offset of font
|
|
420 lbsr fetchit get group/buffer of font
|
|
421 std <fontgb save it
|
|
422 lda $1E,x block # of pset
|
|
423 ldy $1F,x block offset of pset
|
|
424 leay -$20,y back off to get header start of pset
|
|
425 lbsr fetchit get group/buffer of pset
|
|
426 std <psetgb save it
|
|
427 lda $28,x block # of gfx cursor
|
|
428 ldy $29,x block offset of gfx cursor
|
|
429 lbsr fetchit get group/buffer of gfx cursor
|
|
430 std <gcurgb save it
|
|
431
|
|
432 ldd $0B,x cursor logical address
|
|
433 subd 3,x subtract screen logical start
|
|
434 lbra getcrps get x,y cursor coords
|
|
435
|
|
436 * get block number and offset in block for VDG type screen
|
|
437
|
|
438 vdgscrn equ *
|
|
439 leax blnkpalt,pcr address of $ff's for vdg palettes
|
|
440 stx <paltaddr save the addr
|
|
441 lda #$ff fill char
|
|
442 sta <fgc no palettes for vdg screen
|
|
443 sta <bgc
|
|
444 sta <bdc
|
|
445 lda #1 vdgflag=1
|
|
446 sta <vdgflag
|
|
447 sta <blockcnt 1 block in screen
|
|
448 clra
|
|
449 clrb
|
|
450 std <wstart window starts at 0,0
|
|
451 std <cwstart
|
|
452 clr <sctype screentype = 0
|
|
453 leax devmem,u address of device memory
|
|
454 ldd $38,x logical screen start addr
|
|
455 std vdgadr,u msb of vdg address
|
|
456 lsra divide by 16
|
|
457 lsra
|
|
458 lsra
|
|
459 lsra
|
|
460 lsra divide by 2
|
|
461 inca add 1
|
|
462 lsla multiply by 2
|
|
463 deca subtract 1
|
|
464 ldx <datimg addr of sys DAT image
|
|
465 ldb a,x add on block # in map and get the physical block
|
|
466 stb <scrblock save it
|
|
467 ldd vdgadr,u get the physical screen address
|
|
468 anda #%00011111 strip off block # bias
|
|
469 std <offset save offset within block
|
|
470 ldd #$2010 32 * 16 screen
|
|
471 std <cwsize save it
|
|
472 std <wsize save it
|
|
473 clr <curx clear cursor offset counters
|
|
474 clr <cury
|
|
475 ldd #$0020 32 bytes/row
|
|
476 std <bpr save it
|
|
477 leax devmem,u address of device memory
|
|
478 ldd $3C,x cursor address
|
|
479 subd $38,x screen address
|
|
480
|
|
481 getcrps equ *
|
|
482 cmpd <bpr are we done getting row?
|
|
483 blo gotycur yes..skip this
|
|
484 subd <bpr subtract bytes/row
|
|
485 inc <cury increment row #
|
|
486 bra getcrps and check for more
|
|
487
|
|
488 gotycur equ *
|
|
489 stb <curx save y cursor pos
|
|
490 tst <vdgflag is it vdg screen??
|
|
491 bne savexcur yes..more processing
|
|
492 lda <sctype get screen type to determine divisor
|
|
493 cmpa #5 is it type 5 screen???
|
|
494 beq gotxcur go save x cursor position
|
|
495 lsrb divide by two to get actual offset
|
|
496 cmpa #8 is it type 7 screen???
|
|
497 bne gotxcur go save x cursor position
|
|
498 lsrb divide by two again
|
|
499
|
|
500 gotxcur equ *
|
|
501 stb <curx save y cursor pos
|
|
502 lbra retbuffr go return buffer
|
|
503
|
|
504 savexcur equ *
|
|
505 leax devmem,u address of device mem
|
|
506 lda $37,x screen # on display
|
|
507 bne chkmedrs if not 0 then its medium or hi res
|
|
508 tst $45,x test med-res flag
|
|
509 lbeq retbuffr its not hi-res gfx
|
|
510
|
|
511 chkmedrs equ *
|
|
512 ldb #3 3 bytes per screen table entry
|
|
513 mul get screen table offset
|
|
514 leax $4A,x start of screen tables
|
|
515 leax b,x offset for screen #
|
|
516 inc <vdgflag =2 for med-res gfx
|
|
517 clr <offset screen starts at begin of block
|
|
518 clr <offset+1
|
|
519 lda ,x+ get start block
|
|
520 sta <scrblock save it
|
|
521 lda ,x+ get block count
|
|
522 lbne vdghires if there its a hi-res
|
|
523 ldx #$0180 BPR for med-res vdg screen
|
|
524 stx <bpr save it for later
|
|
525 lda #%00010000 default mode of 1
|
|
526 leax devmem,u get start of device mem again
|
|
527 tst $3f,x screen mode
|
|
528 bpl vdgtyp1 if its is..go save it
|
|
529 clra make the mode=0
|
|
530
|
|
531 vdgtyp1 equ *
|
|
532 ora $66,x foreground color
|
|
533 sta <sctype thats our screen type
|
|
534 lbra retbuffr go return buffer
|
|
535
|
|
536 * hi res vdg screen
|
|
537
|
|
538 vdghires equ *
|
|
539 sta <blockcnt save the block count
|
|
540 lda ,x get the screen type
|
|
541 sta <sctype save it
|
|
542 ldy #$2818 sizex/sizey for screen type 0,1,2
|
|
543 ldx #$0280 BPR for screen type 0,1,2
|
|
544 cmpa #2 is screen type <= 2
|
|
545 bls vdgbpr if yes..go save BPR
|
|
546 ldy #$5018 BPR for screen types 3,4
|
|
547 ldx #$0500 BPR for screen types 3,4
|
|
548
|
|
549 vdgbpr equ *
|
|
550 sty <wsize save the size
|
|
551 sty <cwsize same for current working size
|
|
552 stx <bpr save the bytes per row
|
|
553 leax devmem,u get address of device mem again
|
|
554 leax $6B,x address of palettes
|
|
555 stx <paltaddr save it for later
|
|
556 inc <vdgflag =3 (hi res vdg)
|
|
557 lbra retbuffr
|
|
558
|
|
559 * dump the screen
|
|
560
|
|
561 retbuffr equ *
|
|
562 ldx <buffaddr address of return buffer
|
|
563 clra
|
|
564 sta WI$stat,x status is ok (=0)
|
|
565 lda <vdgflag
|
|
566 sta WI$vdg,x
|
|
567 lda <sctype
|
|
568 sta WI$sty,x
|
|
569 lda <scrblock
|
|
570 sta WI$block,x
|
|
571 lda <blockcnt
|
|
572 sta WI$blcnt,x
|
|
573 ldd <offset
|
|
574 std WI$offst,x
|
|
575 lda <wstart
|
|
576 sta WI$cpx,x
|
|
577 lda <wstart+1
|
|
578 sta WI$cpy,x
|
|
579 lda <wsize
|
|
580 sta WI$szx,x
|
|
581 lda <wsize+1
|
|
582 sta WI$szy,x
|
|
583 lda <cwstart
|
|
584 sta WI$cwcpx,x
|
|
585 lda <cwstart+1
|
|
586 sta WI$cwcpy,x
|
|
587 lda <cwsize
|
|
588 sta WI$cwszx,x
|
|
589 lda <cwsize+1
|
|
590 sta WI$cwszy,x
|
|
591 lda <curx
|
|
592 sta WI$curx,x
|
|
593 lda <cury
|
|
594 sta WI$cury,x
|
|
595 ldd <bpr
|
|
596 std WI$bpr,x
|
|
597 leay we,u
|
|
598 lda $19,y
|
|
599 sta WI$cbsw,x
|
|
600 lda <bdc
|
|
601 sta WI$bdprn,x
|
|
602 lda <fgc
|
|
603 sta WI$fgprn,x
|
|
604 lda <bgc
|
|
605 sta WI$bgprn,x
|
|
606 lda <lset
|
|
607 sta WI$Lset,x
|
|
608 ldd <fontgb
|
|
609 sta WI$FntGr,x
|
|
610 stb WI$FntBf,x
|
|
611 ldd <psetgb
|
|
612 sta WI$PstGr,x
|
|
613 stb WI$PstBf,x
|
|
614 ldd <gcurgb
|
|
615 sta WI$GcrGr,x
|
|
616 stb WI$GcrBf,x
|
|
617 ldd <drawcrsr
|
|
618 std WI$DrCrx,x
|
|
619 ldd <drawcrsr+2
|
|
620 std WI$DrCry,x
|
|
621 lda edition,pcr
|
|
622 sta WI$Edtn,x
|
|
623 ldd <weaddr
|
|
624 std WI$weadr,x
|
|
625 ldd <devmaddr
|
|
626 std WI$devm,x
|
|
627 leay WI$pregs,x addr of where to move palettes to
|
|
628 ldx <paltaddr addr of palettes
|
|
629 ldd #16 16 bytes to move
|
|
630 lbsr u$movexy move it
|
|
631 bra clrexit done so return from sub
|
|
632
|
|
633 badparms equ *
|
|
634 ldb #E$Param bad parameter error
|
|
635 bra exit go return it
|
|
636
|
|
637 clrexit clrb no error..clear b reg
|
|
638 exit equ *
|
|
639 lds <stackadr restore stack
|
|
640 puls u,dp restore u and dp registers
|
|
641 clra clear carry bit
|
|
642 tstb
|
|
643 beq return
|
|
644 coma set carry bit
|
|
645 return equ *
|
|
646 rts
|
|
647
|
|
648 zapblock equ *
|
|
649 sta ,x+
|
|
650 decb
|
|
651 bne zapblock
|
|
652 rts
|
|
653
|
|
654 * fetch 2 bytes from block [a] at offset [y]+3
|
|
655
|
|
656
|
|
657
|
|
658 fetchit equ *
|
|
659 clr <minidat
|
|
660 sta <minidat+1
|
|
661 bne fetchok jump if valid block #
|
|
662 clra else clear group #
|
|
663 clrb clear buffer #
|
|
664 rts
|
|
665
|
|
666 fetchok equ *
|
|
667 pshs x save x
|
|
668 leax 3,y poistion to group #
|
|
669 tfr x,d put in d for arithmetic
|
|
670 anda #%00011111 strip off hig order bytes
|
|
671 tfr d,x and put back in x
|
|
672 leay minidat,u adr of temp DAT image
|
|
673 tfr y,d put in d for os9 call
|
|
674 ldy #2 bytes to get
|
|
675 pshs u save u
|
|
676 leau bfngrp,u addr of receving field
|
|
677 os9 F$Cpymem get it
|
|
678 puls u restore u
|
|
679 lbcs exit exit on error
|
|
680 ldd <bfngrp put it in d for return
|
|
681 puls x restore x
|
|
682 rts
|
|
683
|
|
684 * move [d] bytes from [x] to [y]
|
|
685
|
|
686 u$movexy pshs u
|
|
687 tfr d,u
|
|
688 movexy10 lda ,x+
|
|
689 sta ,y+
|
|
690 leau -1,u
|
|
691 cmpu #0
|
|
692 bne movexy10
|
|
693 puls u,pc
|
|
694
|
|
695 error1 equ *
|
|
696 ldb #1 error number
|
|
697 pshs b save error #
|
|
698 leax errmsg1,pcr address of error msg
|
|
699 ldd #errm1ln length of error message
|
|
700 bra moverr go move it
|
|
701
|
|
702 error2 equ *
|
|
703 ldb #2 error number
|
|
704 pshs b save error #
|
|
705 leax errmsg2,pcr address of error msg
|
|
706 ldd #errm2ln length of error message
|
|
707 bra moverr go move it
|
|
708
|
|
709 error3 equ *
|
|
710 ldb #3 error number
|
|
711 pshs b save error #
|
|
712 leax errmsg3,pcr address of error msg
|
|
713 ldd #errm3ln length of error message
|
|
714 bra moverr go move it
|
|
715
|
|
716 moverr equ *
|
|
717 ldy <buffaddr address of return buffer
|
|
718 leay WI$ErMsg,y address of error message
|
|
719 lbsr u$movexy
|
|
720 puls b
|
|
721
|
|
722 storstat equ *
|
|
723 ldy <buffaddr address of return buffer
|
|
724 stb WI$Stat,y save the status byte
|
|
725 lbra clrexit done
|
|
726
|
|
727
|
|
728 smllbuff equ *
|
|
729 ldb #$ff buffer too small status #
|
|
730 bra storstat go store status # and exit
|
|
731
|
|
732
|
|
733 emod
|
|
734 eom equ *
|