Rev 1510 | Details | Compare with Previous | Last modification | View Log
Rev | Author | Line No. | Line |
---|---|---|---|
113 | alone | 1 | DEVICE ZXSPECTRUM128 |
2 | include "../../_sdk/sys_h.asm" |
||
3 | |||
4 | STACK=0x4000 |
||
5 | MAXVERTICES=256 |
||
564 | alone | 6 | MAXEDGES=768;512;256 |
113 | alone | 7 | scrbase=0x8000 |
1891 | alone | 8 | prarr_scrbase=0x8000 |
113 | alone | 9 | |
1891 | alone | 10 | scrwidpix=320 |
115 | alone | 11 | scrhgt=200 |
12 | |||
498 | alone | 13 | COLORS_UNCROSSED=%11001001 |
115 | alone | 14 | COLORS_CROSSED=%11010010 |
15 | |||
500 | alone | 16 | nofocuskey=0xff |
17 | |||
113 | alone | 18 | org PROGSTART |
19 | begin |
||
20 | ld sp,STACK |
||
583 | alone | 21 | OS_HIDEFROMPARENT |
113 | alone | 22 | |
23 | ld e,0 |
||
24 | OS_SETGFX ;e=0:EGA, e=2:MC, e=3:6912, e=6:text ;+SET FOCUS ;e=-1: disable gfx (out: e=old gfxmode) |
||
25 | |||
505 | alone | 26 | ;OS_GETSCREENPAGES |
344 | alone | 27 | ;de=࠭ 0- ࠭ (d=), hl=࠭ 1- ࠭ (h=) |
498 | alone | 28 | call cls |
113 | alone | 29 | |
498 | alone | 30 | ld de,pal |
31 | OS_SETPAL |
||
32 | |||
113 | alone | 33 | ld a,r |
34 | ld (rndseed1),a |
||
1510 | alone | 35 | OS_GETTIMER ;dehl=timer |
36 | ld (rndseed2),hl |
||
37 | ld (oldupdtimer),hl |
||
120 | alone | 38 | |
39 | ld de,filename |
||
40 | OS_OPENHANDLE |
||
41 | ;ld a,-1 |
||
42 | or a |
||
43 | jr nz,noloadini |
||
44 | push bc |
||
45 | ld de,SAVEDATA |
||
46 | ld hl,SAVEDATAsz |
||
47 | OS_READHANDLE |
||
48 | pop bc |
||
49 | OS_CLOSEHANDLE |
||
50 | jr loadiniq |
||
51 | noloadini |
||
498 | alone | 52 | ;ld a,8 |
120 | alone | 53 | xor a |
113 | alone | 54 | ld (level),a |
115 | alone | 55 | call countverticesneeded |
120 | alone | 56 | ;jr $ |
113 | alone | 57 | call genmesh |
120 | alone | 58 | loadiniq |
500 | alone | 59 | call cls |
113 | alone | 60 | call redraw |
61 | |||
62 | jr mouseloop_go |
||
63 | mouseloop |
||
344 | alone | 64 | ;1. 뢮 |
65 | ;2. ᮡ⨥ |
||
66 | ;[3. ࠥ] |
||
67 | ;4. ࠡ뢠 ᮡ⨥ ( ᮢ) |
||
68 | ;5. ࠥ |
||
113 | alone | 69 | |
70 | ld a,(clickstate) |
||
71 | or a |
||
72 | jr z,mouseloop_nomove |
||
73 | call drawcurvertex |
||
115 | alone | 74 | ;call drawconnectedvertices |
113 | alone | 75 | call drawcuredges |
76 | |||
77 | ;call ahl_coords |
||
78 | call movecurvertex |
||
79 | |||
80 | call drawcuredges |
||
115 | alone | 81 | ;call drawconnectedvertices |
113 | alone | 82 | call drawcurvertex |
115 | alone | 83 | |
84 | call ahl_coords |
||
85 | cp 8 |
||
86 | jr nc,$+2+2+3 |
||
87 | ld a,1 |
||
88 | ld (invalidatetime),a |
||
89 | |||
113 | alone | 90 | mouseloop_nomove |
91 | |||
500 | alone | 92 | call clsifneeded ;TODO ? |
344 | alone | 93 | call redrawifneeded ;TODO ? |
115 | alone | 94 | |
500 | alone | 95 | ld a,(key) |
96 | cp nofocuskey |
||
97 | call nz,prlevelifneeded |
||
113 | alone | 98 | |
99 | mouseloop_go |
||
344 | alone | 100 | ;ᥩ 뢥, ५ |
500 | alone | 101 | ld a,(key) |
102 | cp nofocuskey |
||
103 | jr z,mouseloop_noprarr |
||
113 | alone | 104 | call ahl_coords |
105 | call shapes_memorizearr |
||
106 | call ahl_coords |
||
107 | call shapes_prarr8c |
||
500 | alone | 108 | mouseloop_noprarr |
344 | alone | 109 | ;call waitsomething ; ६ ५ |
115 | alone | 110 | mainloop_nothing0 |
111 | call updatetime |
||
344 | alone | 112 | ; ६ ५ |
115 | alone | 113 | YIELD ;halt |
114 | call control |
||
115 | jr nz,mainloop_something |
||
116 | ld a,(invalidatetime) |
||
117 | or a |
||
118 | jr z,mainloop_nothing0 |
||
119 | mainloop_something |
||
344 | alone | 120 | ;- |
113 | alone | 121 | |
500 | alone | 122 | ld a,(key) |
123 | cp nofocuskey |
||
124 | jr z,mouseloop_norearr |
||
504 | alone | 125 | ld a,(oldarry) |
126 | ld hl,(oldarrx) |
||
113 | alone | 127 | call shapes_rearr |
500 | alone | 128 | mouseloop_norearr |
344 | alone | 129 | ;ᥩ 뢥, ५ |
113 | alone | 130 | |
115 | alone | 131 | key=$+1 |
132 | ld a,0 |
||
116 | alone | 133 | cp key_esc |
120 | alone | 134 | call z,quitifnoclickstate |
113 | alone | 135 | cp key_redraw |
498 | alone | 136 | push af |
137 | call z,cls |
||
138 | pop af |
||
113 | alone | 139 | call z,redraw |
140 | |||
141 | ;call control_keys |
||
142 | clickstate=$+1 |
||
143 | ld a,0 |
||
144 | or a |
||
145 | jr nz,mouseloop_wasclicked |
||
146 | ld a,(mousebuttons) |
||
147 | cpl |
||
148 | and 7 |
||
149 | call nz,mouse_fire |
||
500 | alone | 150 | jp mouseloop |
113 | alone | 151 | mouseloop_wasclicked |
152 | ld a,(mousebuttons) |
||
153 | cpl |
||
154 | and 7 |
||
155 | call z,mouse_unfire |
||
115 | alone | 156 | jp mouseloop |
113 | alone | 157 | |
158 | |||
159 | mouse_unfire |
||
160 | ld a,1 |
||
161 | ld (doredraw),a |
||
162 | xor a |
||
163 | ld (clickstate),a |
||
115 | alone | 164 | |
344 | alone | 165 | ; 稪 crossededges ⭮ ࠬ, ᥪ 砫 |
166 | ; ⮣ ன 樨 設 易 ६㥬 祭 ( ) |
||
167 | ; 樨 設 易 ६㥬 祭 ( ) |
||
115 | alone | 168 | |
344 | alone | 169 | ; 樨 設 易 ६㥬 祭 ( ) |
115 | alone | 170 | ld hl,inccrossedandself |
171 | call inccrossededges |
||
344 | alone | 172 | ; ⠥ |
115 | alone | 173 | ;call countcrossededges |
113 | alone | 174 | |
344 | alone | 175 | ; 㦥 塞 |
115 | alone | 176 | ld a,(nextlevelon) |
177 | or a |
||
178 | ret nz |
||
179 | |||
113 | alone | 180 | ;check if untangled |
115 | alone | 181 | ;ld hl,(ncrossededges) |
182 | ld hl,edges |
||
183 | ld de,0 ;count*2 |
||
184 | ld bc,(nedges) |
||
185 | sumcrossededges0 |
||
186 | inc hl |
||
187 | inc hl |
||
188 | ld a,(hl) ;crossed |
||
189 | inc hl |
||
190 | add a,e |
||
191 | ld e,a |
||
564 | alone | 192 | ld a,(hl) ;crossedHSB |
115 | alone | 193 | adc a,d |
564 | alone | 194 | ;sub e |
115 | alone | 195 | ld d,a |
564 | alone | 196 | inc hl |
115 | alone | 197 | dec bc |
198 | ld a,b |
||
199 | or c |
||
200 | jr nz,sumcrossededges0 |
||
201 | ;de=2*ncrossededges |
||
202 | ld a,d |
||
203 | or e |
||
113 | alone | 204 | jr z,levelcomplete |
205 | |||
206 | ret |
||
115 | alone | 207 | |
113 | alone | 208 | levelcomplete |
115 | alone | 209 | ld a,' ' |
210 | ld (nextlevelon),a |
||
211 | ;ld a,1 |
||
212 | ld (invalidatetime),a |
||
213 | ret |
||
214 | |||
215 | mouse_fire_nextlevel |
||
216 | call ahl_coords |
||
217 | cp 8 |
||
218 | jr nc,mouse_fire_nonextlevel |
||
504 | alone | 219 | ld bc,-(8*(nextlevelon+1-tlevel)) |
220 | ;or a |
||
221 | ;sbc hl,bc |
||
222 | add hl,bc |
||
115 | alone | 223 | ld bc,8*10 ;"NEXT LEVEL" |
224 | or a |
||
225 | sbc hl,bc |
||
226 | jr nc,mouse_fire_nonextlevel |
||
227 | ;levelcomplete_go |
||
228 | xor a |
||
229 | ld (nextlevelon),a |
||
230 | inc a;ld a,1 |
||
231 | ld (invalidatetime),a |
||
504 | alone | 232 | ;ld a,1 |
233 | ld (docls),a |
||
234 | ld (doredraw),a |
||
115 | alone | 235 | ld hl,level |
236 | inc (hl) |
||
564 | alone | 237 | ;jr $ |
115 | alone | 238 | call countverticesneeded |
504 | alone | 239 | jp genmesh |
115 | alone | 240 | |
113 | alone | 241 | mouse_fire |
115 | alone | 242 | ld a,(nextlevelon) |
243 | or a |
||
244 | jr nz,mouse_fire_nextlevel |
||
245 | mouse_fire_nonextlevel |
||
113 | alone | 246 | call ahl_coords |
247 | call findvertex |
||
248 | ret c ;not found |
||
249 | ld (curvertex),a |
||
250 | ld a,1 |
||
251 | ld (clickstate),a |
||
344 | alone | 252 | ; ன 樨 設 易 ६㥬 祭 ( ) |
115 | alone | 253 | ld hl,deccrossedandself |
254 | call inccrossededges |
||
344 | alone | 255 | ;ࠥ ⥪ 設, ⥪騥 ᮢ뢠 ᨥ |
113 | alone | 256 | call undrawcurvertex |
257 | call undrawconnectedvertices |
||
258 | call undrawcuredges |
||
115 | alone | 259 | ;call cls |
260 | call drawunconnectededges |
||
261 | call drawunconnectedvertices |
||
113 | alone | 262 | |
115 | alone | 263 | call prlevel |
264 | |||
113 | alone | 265 | call drawcuredges |
266 | call drawconnectedvertices |
||
504 | alone | 267 | ;jp drawcurvertex |
268 | drawcurvertex |
||
269 | ;ld a,(clickstate) |
||
270 | ;or a |
||
271 | ;ret z ;unclicked |
||
272 | call getcurvertexxy_ahl |
||
273 | jp shapes_prarr_ring8c |
||
274 | drawringon |
||
275 | bit 0,l |
||
276 | ld de,sprringon_l+1 |
||
277 | jr nz,$+5+2 |
||
278 | ld de,sprringon_r+1 |
||
279 | dec hl |
||
280 | dec hl |
||
281 | jp prarr_cross8c_go |
||
113 | alone | 282 | |
504 | alone | 283 | |
113 | alone | 284 | movecurvertex |
285 | ld a,(clickstate) |
||
286 | or a |
||
287 | ret z ;unclicked |
||
288 | call getcurvertexaddr |
||
289 | push hl |
||
290 | call ahl_coords |
||
120 | alone | 291 | cp 7 |
292 | jr nc,$+4 |
||
293 | ld a,7 ;max dy = 192 (for fast mul) |
||
113 | alone | 294 | ex de,hl |
295 | pop hl |
||
296 | ld (hl),e |
||
297 | inc hl |
||
298 | ld (hl),d ;x |
||
299 | inc hl |
||
300 | ld (hl),a ;y |
||
301 | inc hl |
||
302 | ld (hl),0 |
||
303 | ret |
||
304 | |||
305 | undrawcurvertex |
||
306 | ;ld a,(clickstate) |
||
307 | ;or a |
||
308 | ;ret z ;unclicked |
||
309 | call getcurvertexxy_ahl |
||
310 | ;jp shapes_prarr_ring8c |
||
311 | drawringoff |
||
312 | bit 0,l |
||
313 | ld de,sprringoff_l+1 |
||
314 | jr nz,$+5+2 |
||
315 | ld de,sprringoff_r+1 |
||
316 | dec hl |
||
317 | dec hl |
||
318 | jp prarr_cross8c_go |
||
319 | |||
320 | getcurvertexxy_ahl |
||
321 | call getcurvertexaddr |
||
322 | ld c,(hl) |
||
323 | inc hl |
||
324 | ld b,(hl) ;x |
||
325 | inc hl |
||
326 | ld e,(hl) |
||
327 | inc hl |
||
328 | ld d,(hl) ;y |
||
329 | ld a,e ;y |
||
330 | ld h,b |
||
331 | ld l,c ;x |
||
332 | ret |
||
333 | |||
334 | getcurvertexaddr |
||
335 | curvertex=$+1 |
||
504 | alone | 336 | ld hl,0 |
337 | ld de,vertices |
||
338 | add hl,hl |
||
339 | add hl,hl |
||
113 | alone | 340 | add hl,de |
341 | ret |
||
342 | |||
343 | undrawcuredges |
||
504 | alone | 344 | call setlinenormalmask |
345 | ;ld a,0x47 ;keep left pixel ; cls । redraw |
||
346 | ;ld (lineverR_and_r),a |
||
347 | ;ld (lineverL_and_r),a |
||
348 | ;cpl |
||
349 | ;ld (lineverR_and_l),a |
||
350 | ;ld (lineverL_and_l),a |
||
351 | ;ld hl,delpixel |
||
352 | xor a |
||
113 | alone | 353 | jr drawcuredges_go |
354 | drawcuredges |
||
355 | ld a,0xff |
||
504 | alone | 356 | ld (lineverR_and_l),a |
357 | ld (lineverL_and_l),a |
||
358 | ld (lineverR_and_r),a |
||
359 | ld (lineverL_and_r),a |
||
360 | ld (linehorR_and_r),a |
||
361 | ld (linehorL_and_r),a |
||
362 | ld (linehorR_and_l),a |
||
363 | ld (linehorL_and_l),a |
||
364 | ;ld hl,invpixel |
||
365 | ;ld a,0xff |
||
113 | alone | 366 | drawcuredges_go |
504 | alone | 367 | ;ld (pixelprocver),hl |
368 | ;ld (pixelprochor),hl |
||
369 | ld (drawcuredges_colormask),a |
||
113 | alone | 370 | ld a,(clickstate) |
371 | or a |
||
372 | ret z ;unclicked |
||
373 | ;find all edges with current vertex (1st or 2nd), draw them |
||
374 | ;vertex1,vertex2,crossed |
||
375 | ld hl,edges |
||
115 | alone | 376 | ld bc,(nedges) |
113 | alone | 377 | drawcuredges0 |
378 | push bc |
||
379 | ld e,(hl) |
||
380 | inc hl |
||
381 | ld d,(hl) |
||
382 | inc hl |
||
383 | ld a,(curvertex) |
||
384 | cp d |
||
385 | jr z,$+3 |
||
386 | cp e |
||
387 | jr nz,drawcuredgesno |
||
564 | alone | 388 | push hl |
113 | alone | 389 | ld a,(hl) |
564 | alone | 390 | inc hl |
391 | or (hl) ;crossedHSB |
||
113 | alone | 392 | ;e=vertex1 |
393 | ;d=vertex2 |
||
394 | ;a=crossed |
||
395 | or a |
||
115 | alone | 396 | ld a,COLORS_UNCROSSED;%11001001 |
113 | alone | 397 | jr z,$+4 |
115 | alone | 398 | ld a,COLORS_CROSSED;%11010010 |
504 | alone | 399 | drawcuredges_colormask=$+1 |
113 | alone | 400 | and 0 |
401 | call drawedge |
||
402 | pop hl |
||
403 | drawcuredgesno |
||
404 | pop bc |
||
564 | alone | 405 | inc hl |
504 | alone | 406 | ;inc hl |
407 | ;dec bc |
||
408 | ;ld a,b |
||
409 | ;or c |
||
410 | ;jr nz,drawcuredges0 |
||
411 | cpi |
||
412 | jp pe,drawcuredges0 |
||
413 | ;ld hl,prpixel |
||
414 | ;ld (pixelprocver),hl |
||
415 | ;ld (pixelprochor),hl |
||
416 | setlinenormalmask |
||
417 | ld a,0x47 ;keep left pixel ; cls । redraw |
||
418 | ld (lineverR_and_r),a |
||
419 | ld (lineverL_and_r),a |
||
420 | ld (linehorR_and_r),a |
||
421 | ld (linehorL_and_r),a |
||
422 | cpl |
||
423 | ld (lineverR_and_l),a |
||
424 | ld (lineverL_and_l),a |
||
425 | ld (linehorR_and_l),a |
||
426 | ld (linehorL_and_l),a |
||
113 | alone | 427 | ret |
428 | |||
429 | drawconnectedvertices |
||
430 | ld hl,shapes_prarr_ring8c;drawringon |
||
431 | jr drawconnectedvertices_go |
||
432 | undrawconnectedvertices |
||
433 | ld hl,drawringoff |
||
434 | drawconnectedvertices_go |
||
435 | ld (drawconnectedvertices_drawproc),hl |
||
436 | ld hl,edges |
||
115 | alone | 437 | ld bc,(nedges) |
113 | alone | 438 | drawconnectedvertices0 |
439 | push bc |
||
440 | ld e,(hl) |
||
441 | inc hl |
||
442 | ld d,(hl) |
||
443 | inc hl |
||
444 | ;e=vertex1 |
||
445 | ;d=vertex2 |
||
446 | ld a,(curvertex) |
||
447 | cp d |
||
448 | jr z,drawconnectedvertices_e |
||
449 | cp e |
||
450 | jr nz,drawconnectedverticesno |
||
451 | ld e,d |
||
452 | drawconnectedvertices_e |
||
453 | push hl |
||
454 | ld d,0 ;e=connected vertex |
||
455 | ld hl,vertices |
||
456 | add hl,de |
||
457 | add hl,de |
||
458 | add hl,de |
||
459 | add hl,de |
||
460 | ld c,(hl) |
||
461 | inc hl |
||
462 | ld b,(hl) ;x |
||
463 | inc hl |
||
464 | ld e,(hl) |
||
465 | inc hl |
||
466 | ld d,(hl) ;y |
||
467 | ld a,e ;y |
||
468 | ld h,b |
||
469 | ld l,c ;x |
||
470 | drawconnectedvertices_drawproc=$+1 |
||
471 | call drawringon |
||
472 | pop hl |
||
473 | drawconnectedverticesno |
||
474 | pop bc |
||
564 | alone | 475 | inc hl ;crossedHSB |
504 | alone | 476 | ;inc hl |
477 | ;dec bc |
||
478 | ;ld a,b |
||
479 | ;or c |
||
480 | ;jr nz,drawconnectedvertices0 |
||
481 | cpi |
||
482 | jp pe,drawconnectedvertices0 |
||
113 | alone | 483 | ret |
484 | |||
115 | alone | 485 | drawunconnectededges |
344 | alone | 486 | ;㥬 , 易 ⥪饩 設 |
115 | alone | 487 | ;find all edges with current vertex (1st or 2nd), draw others |
488 | ;vertex1,vertex2,crossed |
||
489 | ld hl,edges |
||
490 | ld bc,(nedges) |
||
491 | drawunconnectededges0 |
||
492 | push bc |
||
493 | ld e,(hl) |
||
494 | inc hl |
||
495 | ld d,(hl) |
||
496 | inc hl |
||
497 | ld a,(curvertex) |
||
498 | cp d |
||
499 | jr z,$+3 |
||
500 | cp e |
||
501 | jr z,drawunconnectededgesno |
||
564 | alone | 502 | push hl |
115 | alone | 503 | ld a,(hl) |
564 | alone | 504 | inc hl |
505 | or (hl) ;crossedHSB |
||
115 | alone | 506 | ;e=vertex1 |
507 | ;d=vertex2 |
||
508 | ;a=crossed |
||
509 | or a |
||
510 | ld a,COLORS_UNCROSSED;%11001001 |
||
511 | jr z,$+4 |
||
512 | ld a,COLORS_CROSSED;%11010010 |
||
513 | call drawedge |
||
514 | pop hl |
||
515 | drawunconnectededgesno |
||
516 | pop bc |
||
564 | alone | 517 | inc hl |
504 | alone | 518 | ;inc hl |
519 | ;dec bc |
||
520 | ;ld a,b |
||
521 | ;or c |
||
522 | ;jr nz,drawunconnectededges0 |
||
523 | cpi |
||
524 | jp pe,drawunconnectededges0 |
||
115 | alone | 525 | ret |
526 | |||
527 | drawunconnectedvertices |
||
344 | alone | 528 | ;㥬 設, ⥪饩 易 |
529 | ; ⮣: |
||
530 | ;⨬ ⠡ 易 設 |
||
115 | alone | 531 | ld hl,vertlinkflags |
532 | ld de,vertlinkflags+1 |
||
533 | ld bc,MAXVERTICES-1 |
||
534 | ld (hl),0 |
||
535 | ldir |
||
344 | alone | 536 | ;砥 ⠬ ⥪ 設 |
115 | alone | 537 | ld de,vertlinkflags |
538 | ld hl,(curvertex) |
||
504 | alone | 539 | ld h,b;0 |
115 | alone | 540 | add hl,de |
113 | alone | 541 | inc (hl) |
344 | alone | 542 | ;ॡࠥ , 饬 ⠬ 易 設 砥 ⠡ 易 設 |
115 | alone | 543 | ld hl,edges |
544 | ld bc,(nedges) |
||
545 | drawunconnectedvertices0 |
||
546 | ld e,(hl) |
||
547 | inc hl |
||
548 | ld d,(hl) |
||
549 | inc hl |
||
550 | ;e=vertex1 |
||
551 | ;d=vertex2 |
||
552 | ld a,(curvertex) |
||
553 | cp d |
||
554 | jr z,drawunconnectedvertices_e |
||
555 | cp e |
||
556 | jr nz,drawunconnectedverticesno |
||
557 | ld e,d |
||
558 | drawunconnectedvertices_e |
||
559 | push hl |
||
560 | ld d,0 ;e=connected vertex |
||
561 | ld hl,vertlinkflags |
||
562 | add hl,de |
||
563 | inc (hl) |
||
564 | pop hl |
||
565 | drawunconnectedverticesno |
||
564 | alone | 566 | inc hl ;crossedHSB |
115 | alone | 567 | inc hl |
568 | dec bc |
||
569 | ld a,b |
||
570 | or c |
||
571 | jr nz,drawunconnectedvertices0 |
||
344 | alone | 572 | ;ॡࠥ 設, 뢮 ⮫쪮 訥 ⠡ |
115 | alone | 573 | ld hl,vertlinkflags |
574 | ld a,(nvertices) |
||
575 | ld b,a |
||
576 | drawunconnectedvertices1 |
||
577 | push bc |
||
578 | push hl |
||
579 | ld a,(nvertices) |
||
580 | sub b |
||
581 | ld e,a |
||
582 | ld a,(hl) ;linkflag |
||
583 | ld d,0 ;e=connected vertex |
||
584 | ld hl,vertices |
||
585 | add hl,de |
||
586 | add hl,de |
||
587 | add hl,de |
||
588 | add hl,de |
||
589 | ld c,(hl) |
||
590 | inc hl |
||
591 | ld b,(hl) ;x |
||
592 | inc hl |
||
593 | ld e,(hl) |
||
594 | inc hl |
||
595 | ld d,(hl) ;y |
||
596 | or a |
||
597 | ld a,e ;y |
||
598 | ld h,b |
||
599 | ld l,c ;x |
||
600 | call z,drawringon |
||
601 | pop hl |
||
602 | inc hl |
||
603 | pop bc |
||
604 | djnz drawunconnectedvertices1 |
||
605 | ret |
||
606 | |||
607 | countverticesneeded |
||
608 | ld a,6 |
||
609 | ld (verticesneeded),a |
||
610 | ld a,(level) |
||
611 | or a |
||
612 | ret z |
||
613 | ld b,a |
||
614 | countverticesneeded0 |
||
615 | ld a,b |
||
113 | alone | 616 | add a,3 ;a=4.. |
617 | ld hl,verticesneeded |
||
618 | add a,(hl) |
||
115 | alone | 619 | jr nc,$+3 |
620 | sbc a,a |
||
113 | alone | 621 | ld (hl),a |
115 | alone | 622 | djnz countverticesneeded0 |
113 | alone | 623 | ret |
624 | |||
625 | ahl_coords |
||
626 | ld a,(arry) |
||
627 | ld hl,(arrx) |
||
628 | ret |
||
629 | |||
630 | |||
120 | alone | 631 | quitifnoclickstate |
632 | ld a,(clickstate) |
||
633 | or a |
||
634 | ret nz |
||
113 | alone | 635 | quit |
120 | alone | 636 | ld de,filename |
637 | OS_CREATEHANDLE |
||
638 | push bc |
||
639 | ld de,SAVEDATA |
||
640 | ld hl,SAVEDATAsz |
||
641 | OS_WRITEHANDLE |
||
642 | pop bc |
||
643 | OS_CLOSEHANDLE |
||
113 | alone | 644 | QUIT |
120 | alone | 645 | |
646 | filename |
||
647 | db "untangle.ini",0 |
||
113 | alone | 648 | |
649 | redrawifneeded |
||
504 | alone | 650 | xor a |
113 | alone | 651 | doredraw=$+1 |
504 | alone | 652 | cp 0 |
113 | alone | 653 | ret z |
654 | redraw |
||
655 | xor a |
||
656 | ld (doredraw),a |
||
505 | alone | 657 | call setscrpgs |
115 | alone | 658 | call drawedges |
659 | call drawvertices |
||
504 | alone | 660 | jr prlevel |
115 | alone | 661 | |
662 | prlevelifneeded |
||
504 | alone | 663 | xor a |
115 | alone | 664 | invalidatetime=$+1 |
504 | alone | 665 | cp 0 |
115 | alone | 666 | ret z |
667 | prlevel |
||
113 | alone | 668 | ld a,(level) |
669 | inc a |
||
115 | alone | 670 | ld hl,tleveldig1 |
671 | call dectotxt12 |
||
672 | ;ld (tleveldig2),a |
||
673 | ;ld a,b |
||
674 | ;ld (tleveldig1),a |
||
675 | ld a,(cur_h) |
||
676 | ld hl,ttimeh1 |
||
677 | call dectotxt12 |
||
678 | ld a,(cur_m) |
||
679 | ld hl,ttimem1 |
||
680 | call dectotxt12 |
||
681 | ld a,(cur_s) |
||
682 | ld hl,ttimes1 |
||
683 | call dectotxt12 |
||
684 | |||
685 | xor a |
||
686 | ld (invalidatetime),a |
||
504 | alone | 687 | ld b,a |
688 | ld c,a ;ld bc,0 |
||
689 | ld hl,tlevel |
||
690 | jp prtext |
||
115 | alone | 691 | |
692 | dectotxt12 |
||
113 | alone | 693 | ld b,'0'-1 |
694 | inc b |
||
695 | sub 10 |
||
696 | jr nc,$-3 |
||
697 | add a,'0'+10 |
||
115 | alone | 698 | ld (hl),b |
699 | inc hl |
||
700 | ld (hl),a |
||
701 | ret |
||
702 | |||
703 | updatetime |
||
1510 | alone | 704 | OS_GETTIMER ;dehl=timer |
705 | ld de,(oldupdtimer) |
||
115 | alone | 706 | ld (oldupdtimer),hl |
707 | or a |
||
708 | sbc hl,de ;hl=frames |
||
709 | ret z |
||
710 | ld b,h |
||
711 | ld c,l |
||
712 | updatetime0 |
||
713 | call inctime |
||
504 | alone | 714 | ;dec bc |
715 | ;ld a,b |
||
716 | ;or c |
||
717 | ;jr nz,updatetime0 |
||
718 | cpi |
||
719 | jp pe,updatetime0 |
||
113 | alone | 720 | ret |
115 | alone | 721 | inctime |
722 | ld hl,cur_f |
||
723 | inc (hl) |
||
724 | ld a,(hl) |
||
725 | sub 50 |
||
726 | ret c |
||
727 | ld (hl),a |
||
728 | ld a,1 |
||
729 | ld (invalidatetime),a |
||
730 | ld hl,cur_s |
||
731 | inc (hl) |
||
732 | ld a,(hl) |
||
733 | sub 60 |
||
734 | ret c |
||
735 | ld (hl),a |
||
736 | ld hl,cur_m |
||
737 | inc (hl) |
||
738 | ld a,(hl) |
||
739 | sub 60 |
||
740 | ret c |
||
741 | ld (hl),a |
||
742 | ld hl,cur_h |
||
743 | inc (hl) |
||
744 | ret |
||
113 | alone | 745 | |
115 | alone | 746 | if 1==0 |
113 | alone | 747 | genvertices |
748 | ;x,X,y,Y |
||
749 | ld hl,vertices |
||
750 | ld a,(nvertices) |
||
751 | ld b,a |
||
752 | genvertices0 |
||
115 | alone | 753 | push bc |
113 | alone | 754 | ld c,160 |
755 | call rnd |
||
756 | add a,a |
||
757 | ld (hl),a |
||
758 | inc hl |
||
759 | ld (hl),0 |
||
760 | rl (hl) |
||
761 | inc hl |
||
762 | ld c,200 |
||
763 | call rnd |
||
764 | ld (hl),a |
||
765 | inc hl |
||
766 | ld (hl),0 |
||
767 | inc hl |
||
115 | alone | 768 | pop bc |
113 | alone | 769 | djnz genvertices0 |
770 | ret |
||
115 | alone | 771 | endif |
113 | alone | 772 | |
115 | alone | 773 | if 1==0 |
113 | alone | 774 | genedges |
775 | ;vertex1,vertex2,crossed |
||
776 | ld hl,edges |
||
115 | alone | 777 | ld bc,(nedges) |
113 | alone | 778 | genedges0 |
115 | alone | 779 | push bc |
113 | alone | 780 | ld a,(nvertices) |
781 | ld c,a |
||
782 | call rnd |
||
783 | ld (hl),a |
||
784 | inc hl |
||
785 | ld a,(nvertices) |
||
786 | ld c,a |
||
787 | call rnd |
||
788 | ld (hl),a |
||
789 | inc hl |
||
790 | ld (hl),0 ;uncrossed |
||
791 | inc hl |
||
564 | alone | 792 | ld (hl),0 ;crossedHSB |
793 | inc hl |
||
115 | alone | 794 | pop bc |
795 | dec bc |
||
796 | ld a,b |
||
797 | or c |
||
798 | jr nz,genedges0 |
||
113 | alone | 799 | ret |
115 | alone | 800 | endif |
113 | alone | 801 | |
802 | drawedges |
||
803 | ;vertex1,vertex2,crossed |
||
804 | ld hl,edges |
||
115 | alone | 805 | ld bc,(nedges) |
113 | alone | 806 | drawedges0 |
807 | push bc |
||
808 | ld e,(hl) |
||
809 | inc hl |
||
810 | ld d,(hl) |
||
811 | inc hl |
||
812 | ld a,(hl) |
||
564 | alone | 813 | inc hl |
814 | or (hl) ;crossedHSB |
||
113 | alone | 815 | push hl |
816 | ;e=vertex1 |
||
817 | ;d=vertex2 |
||
818 | ;a=crossed |
||
819 | or a |
||
115 | alone | 820 | ld a,COLORS_UNCROSSED;%11001001 |
113 | alone | 821 | jr z,$+4 |
115 | alone | 822 | ld a,COLORS_CROSSED;%11010010 |
113 | alone | 823 | call drawedge |
824 | pop hl |
||
825 | pop bc |
||
504 | alone | 826 | ;inc hl |
827 | ;dec bc |
||
828 | ;ld a,b |
||
829 | ;or c |
||
830 | ;jr nz,drawedges0 |
||
831 | cpi |
||
832 | jp pe,drawedges0 |
||
113 | alone | 833 | ret |
834 | |||
835 | drawvertices |
||
836 | ;x,X,y,Y |
||
837 | ld hl,vertices |
||
838 | ld a,(nvertices) |
||
839 | ld b,a |
||
840 | drawvertices0 |
||
841 | push bc |
||
842 | ld c,(hl) |
||
843 | inc hl |
||
844 | ld b,(hl) ;x |
||
845 | inc hl |
||
846 | ld e,(hl) |
||
847 | inc hl |
||
848 | ld d,(hl) ;y |
||
849 | inc hl |
||
850 | push hl |
||
851 | ld a,e ;y |
||
852 | ld h,b |
||
853 | ld l,c ;x |
||
854 | call drawringon;shapes_prarr_ring8c |
||
855 | pop hl |
||
856 | pop bc |
||
857 | djnz drawvertices0 |
||
858 | ret |
||
859 | |||
860 | findvertex |
||
861 | ;in: hl=arrx, a=arry |
||
862 | ;out: CY=not found, or else a=vertex # |
||
863 | ex de,hl |
||
864 | ld c,a |
||
865 | ;x,X,y,Y |
||
866 | ld hl,vertices |
||
867 | ld a,(nvertices) |
||
868 | ld b,a |
||
869 | findvertex0 |
||
870 | ld a,(hl) |
||
871 | inc hl |
||
872 | push hl |
||
873 | ld h,(hl) |
||
874 | ld l,a ;x |
||
875 | or a |
||
876 | sbc hl,de ;x-arrx |
||
877 | inc hl |
||
878 | inc hl |
||
879 | push de |
||
880 | ld de,5 |
||
881 | or a |
||
882 | sbc hl,de ;CY = -2..+2 |
||
883 | pop de |
||
884 | pop hl |
||
885 | inc hl |
||
886 | jr nc,findvertexno |
||
887 | push hl |
||
888 | ld a,(hl) |
||
889 | inc hl |
||
890 | ld h,(hl) |
||
891 | ld l,a ;y |
||
892 | push bc |
||
893 | xor a |
||
894 | ld b,a |
||
895 | sbc hl,bc ;y=arry |
||
896 | inc hl |
||
897 | inc hl |
||
898 | ld bc,5 |
||
899 | or a |
||
900 | sbc hl,bc ;CY = -2..+2 |
||
901 | pop bc |
||
902 | pop hl |
||
903 | jr c,findvertexok |
||
904 | findvertexno |
||
905 | inc hl |
||
906 | inc hl |
||
907 | djnz findvertex0 |
||
908 | scf |
||
909 | ret |
||
910 | findvertexok |
||
911 | ld a,(nvertices) |
||
912 | sub b |
||
913 | or a |
||
914 | ret |
||
915 | |||
916 | rnd |
||
917 | ;0..c-1 |
||
918 | ;ld a,r |
||
919 | push de |
||
920 | push hl |
||
921 | call func_rnd |
||
922 | pop hl |
||
923 | pop de |
||
924 | rnd0 |
||
925 | sub c |
||
926 | jr nc,rnd0 |
||
927 | add a,c |
||
928 | ret |
||
929 | |||
930 | func_rnd |
||
931 | ;Patrik Rak |
||
932 | rndseed1=$+1 |
||
933 | ld hl,0xA280 ; xz -> yw |
||
934 | rndseed2=$+1 |
||
935 | ld de,0xC0DE ; yw -> zt |
||
936 | ld (rndseed1),de ; x = y, z = w |
||
937 | ld a,e ; w = w ^ ( w << 3 ) |
||
938 | add a,a |
||
939 | add a,a |
||
940 | add a,a |
||
941 | xor e |
||
942 | ld e,a |
||
943 | ld a,h ; t = x ^ (x << 1) |
||
944 | add a,a |
||
945 | xor h |
||
946 | ld d,a |
||
947 | rra ; t = t ^ (t >> 1) ^ w |
||
948 | xor d |
||
949 | xor e |
||
950 | ld h,l ; y = z |
||
951 | ld l,a ; w = t |
||
952 | ld (rndseed2),hl |
||
953 | ;ex de,hl |
||
954 | ;ld hl,0 |
||
955 | ;res 7,c ;int |
||
956 | ret |
||
957 | |||
958 | |||
959 | div4signedup |
||
960 | or a |
||
961 | jp m,$+5 |
||
962 | add a,3 |
||
963 | sra a |
||
964 | sra a |
||
965 | ret |
||
966 | |||
498 | alone | 967 | clsifneeded |
504 | alone | 968 | xor a |
498 | alone | 969 | docls=$+1 |
504 | alone | 970 | cp 0 |
498 | alone | 971 | ret z |
504 | alone | 972 | ld (docls),a ;0 |
113 | alone | 973 | cls |
974 | ld e,0 |
||
975 | OS_CLS |
||
976 | ret |
||
977 | |||
978 | prtext |
||
344 | alone | 979 | ;bc=न |
113 | alone | 980 | ;hl=text |
981 | ld a,(hl) |
||
982 | or a |
||
983 | ret z |
||
984 | call prcharxy |
||
985 | inc hl |
||
986 | inc c |
||
987 | jr prtext |
||
988 | |||
989 | prnum |
||
990 | ld bc,1000 |
||
991 | call prdig |
||
992 | ld bc,100 |
||
993 | call prdig |
||
994 | ld bc,10 |
||
995 | call prdig |
||
996 | ld bc,1 |
||
997 | prdig |
||
998 | ld a,'0'-1 |
||
999 | prdig0 |
||
1000 | inc a |
||
1001 | or a |
||
1002 | sbc hl,bc |
||
1003 | jr nc,prdig0 |
||
1004 | add hl,bc |
||
1005 | ;push hl |
||
1006 | ;call prchar |
||
1007 | ;pop hl |
||
1008 | ;ret |
||
120 | alone | 1009 | prchar |
1010 | ;a=code |
||
1011 | ;de=screen |
||
1012 | push de |
||
113 | alone | 1013 | push hl |
1014 | call prcharin |
||
120 | alone | 1015 | pop hl |
1016 | pop de |
||
1017 | inc e |
||
1018 | ret |
||
113 | alone | 1019 | |
1020 | calcscraddr |
||
1021 | ;bc=yx |
||
344 | alone | 1022 | ; bc |
113 | alone | 1023 | ex de,hl |
1024 | ld a,c ;x |
||
1025 | ld l,b ;y |
||
1026 | ld h,0 |
||
1027 | ld b,h |
||
1028 | ld c,l |
||
1029 | add hl,hl |
||
1030 | add hl,hl |
||
1031 | add hl,bc ;*5 |
||
1032 | add hl,hl |
||
1033 | add hl,hl |
||
1034 | add hl,hl ;*40 |
||
1035 | add hl,hl |
||
1036 | add hl,hl |
||
1037 | add hl,hl |
||
1038 | add a,l |
||
1039 | ld l,a |
||
1040 | ld a,h |
||
1041 | adc a,0x80 |
||
1042 | ld h,a |
||
1043 | ex de,hl |
||
1044 | ret |
||
1045 | |||
1046 | prcharxy |
||
1047 | ;a=code |
||
1048 | ;bc=yx |
||
1049 | push de |
||
1050 | push hl |
||
1051 | push bc |
||
1052 | push af |
||
1053 | call calcscraddr |
||
1054 | pop af |
||
1055 | call prcharin |
||
1056 | pop bc |
||
1057 | pop hl |
||
1058 | pop de |
||
1059 | ret |
||
1060 | |||
1061 | prcharin |
||
1062 | sub 32 |
||
120 | alone | 1063 | ld l,a |
1064 | ld h,0 |
||
1065 | add hl,hl |
||
1066 | add hl,hl |
||
1067 | add hl,hl |
||
1068 | add hl,hl |
||
1069 | add hl,hl |
||
113 | alone | 1070 | ;ld bc,font-(32*32) |
1071 | ;add hl,bc |
||
1072 | ld a,h |
||
1073 | add a,font/256 |
||
1074 | ld h,a |
||
1075 | prcharin_go |
||
1076 | ex de,hl |
||
1077 | |||
1078 | ld bc,40 |
||
1079 | push hl |
||
1080 | push hl |
||
1081 | dup 8 |
||
120 | alone | 1082 | ld a,(de) ;font |
113 | alone | 1083 | ld (hl),a ;scr |
120 | alone | 1084 | inc de |
113 | alone | 1085 | add hl,bc |
1086 | edup |
||
1087 | pop hl |
||
1088 | set 6,h |
||
1089 | ;ld d,font/256 |
||
1090 | dup 8 |
||
120 | alone | 1091 | ld a,(de) ;font |
113 | alone | 1092 | ld (hl),a ;scr |
120 | alone | 1093 | inc de |
113 | alone | 1094 | add hl,bc |
1095 | edup |
||
1096 | pop hl |
||
1097 | set 5,h |
||
1098 | push hl |
||
1099 | ;ld d,font/256 |
||
1100 | dup 8 |
||
120 | alone | 1101 | ld a,(de) ;font |
113 | alone | 1102 | ld (hl),a ;scr |
120 | alone | 1103 | inc de |
113 | alone | 1104 | add hl,bc |
1105 | edup |
||
1106 | pop hl |
||
1107 | set 6,h |
||
1108 | ;ld d,font/256 |
||
1109 | dup 8 |
||
120 | alone | 1110 | ld a,(de) ;font |
113 | alone | 1111 | ld (hl),a ;scr |
120 | alone | 1112 | inc de |
113 | alone | 1113 | add hl,bc |
1114 | edup |
||
1115 | ret |
||
1116 | |||
504 | alone | 1117 | if 1==0 |
1118 | |||
113 | alone | 1119 | invpixel |
498 | alone | 1120 | ;bc=x ( ) |
1121 | ;e=y ( ) |
||
1122 | ;screen pages are mapped in 2 CPU windows |
||
1123 | ;addr = tY(y) + tX(x) |
||
1124 | push bc |
||
1125 | ld a,b |
||
113 | alone | 1126 | rra |
498 | alone | 1127 | ld a,c |
113 | alone | 1128 | rra |
498 | alone | 1129 | ld l,a |
1130 | ;ld d,ty/256 |
||
1131 | ;ld h,tx/256 |
||
1132 | ld a,(de) ;(y*40) |
||
113 | alone | 1133 | jr c,invpixel_r |
498 | alone | 1134 | add a,(hl) ;x div 4 |
1135 | ld c,a |
||
1136 | inc d |
||
1137 | inc h |
||
1138 | ld a,(de) ;'(y*40) |
||
1139 | adc a,(hl) ;f(x mod 4) |
||
1140 | ld b,a |
||
1141 | ld a,(bc) |
||
115 | alone | 1142 | invpixel_color_l=$+1 |
498 | alone | 1143 | xor 0;lx |
1144 | ld (bc),a |
||
1145 | dec h |
||
1146 | dec d |
||
1147 | pop bc |
||
113 | alone | 1148 | ret |
1149 | invpixel_r |
||
498 | alone | 1150 | add a,(hl) ;x div 4 |
1151 | ld c,a |
||
1152 | inc d |
||
1153 | inc h |
||
1154 | ld a,(de) ;'(y*40) |
||
1155 | adc a,(hl) ;f(x mod 4) |
||
1156 | ld b,a |
||
1157 | ld a,(bc) |
||
115 | alone | 1158 | invpixel_color_r=$+1 |
498 | alone | 1159 | xor 0;lx |
1160 | ld (bc),a |
||
1161 | dec h |
||
1162 | dec d |
||
1163 | pop bc |
||
113 | alone | 1164 | ret |
1165 | |||
1166 | prpixel |
||
498 | alone | 1167 | ;bc=x ( ) |
1168 | ;e=y ( ) |
||
1169 | ;screen pages are mapped in 2 CPU windows |
||
1170 | ;addr = tY(y) + tX(x) |
||
1171 | push bc |
||
1172 | ld a,b |
||
113 | alone | 1173 | rra |
498 | alone | 1174 | ld a,c |
113 | alone | 1175 | rra |
498 | alone | 1176 | ld l,a |
1177 | ;ld d,ty/256 |
||
1178 | ;ld h,tx/256 |
||
1179 | ld a,(de) ;(y*40) |
||
113 | alone | 1180 | jr c,prpixel_r |
498 | alone | 1181 | add a,(hl) ;x div 4 |
1182 | ld c,a |
||
1183 | inc d |
||
1184 | inc h |
||
1185 | ld a,(de) ;'(y*40) |
||
1186 | adc a,(hl) ;f(x mod 4) |
||
1187 | ld b,a |
||
1188 | ld a,(bc) |
||
1189 | and 0xb8 ;keep right pixel ; cls । redraw |
||
115 | alone | 1190 | prpixel_color_l=$+1 |
498 | alone | 1191 | or 0;lx |
1192 | ld (bc),a |
||
1193 | dec h |
||
1194 | dec d |
||
1195 | pop bc |
||
113 | alone | 1196 | ret |
1197 | prpixel_r |
||
498 | alone | 1198 | add a,(hl) ;x div 4 |
1199 | ld c,a |
||
1200 | inc d |
||
1201 | inc h |
||
1202 | ld a,(de) ;'(y*40) |
||
1203 | adc a,(hl) ;f(x mod 4) |
||
1204 | ld b,a |
||
1205 | ld a,(bc) |
||
1206 | and 0x47 ;keep left pixel ; cls । redraw |
||
1207 | prpixel_color_r=$+1 |
||
1208 | or 0;lx |
||
1209 | ld (bc),a |
||
1210 | dec h |
||
1211 | dec d |
||
1212 | pop bc |
||
1213 | ret |
||
1214 | |||
1215 | delpixel |
||
1216 | ;bc=x ( ) |
||
1217 | ;e=y ( ) |
||
1218 | ;screen pages are mapped in 2 CPU windows |
||
1219 | ;addr = tY(y) + tX(x) |
||
1220 | push bc |
||
1221 | ld a,b |
||
113 | alone | 1222 | rra |
498 | alone | 1223 | ld a,c |
113 | alone | 1224 | rra |
1225 | ld l,a |
||
498 | alone | 1226 | ;ld d,ty/256 |
1227 | ;ld h,tx/256 |
||
1228 | ld a,(de) ;(y*40) |
||
1229 | jr c,delpixel_r |
||
1230 | add a,(hl) ;x div 4 |
||
1231 | ld c,a |
||
1232 | inc d |
||
1233 | inc h |
||
1234 | ld a,(de) ;'(y*40) |
||
1235 | adc a,(hl) ;f(x mod 4) |
||
1236 | ld b,a |
||
1237 | ld a,(bc) |
||
1238 | and 0xb8 ;keep right pixel |
||
1239 | ld (bc),a |
||
1240 | dec h |
||
1241 | dec d |
||
1242 | pop bc |
||
113 | alone | 1243 | ret |
498 | alone | 1244 | delpixel_r |
1245 | add a,(hl) ;x div 4 |
||
1246 | ld c,a |
||
1247 | inc d |
||
1248 | inc h |
||
1249 | ld a,(de) ;'(y*40) |
||
1250 | adc a,(hl) ;f(x mod 4) |
||
1251 | ld b,a |
||
1252 | ld a,(bc) |
||
1253 | and 0x47 ;keep left pixel |
||
1254 | ld (bc),a |
||
1255 | dec h |
||
1256 | dec d |
||
1257 | pop bc |
||
1258 | ret |
||
504 | alone | 1259 | |
1260 | endif |
||
113 | alone | 1261 | |
498 | alone | 1262 | drawedge |
1263 | ;e=vertex1 |
||
1264 | ;d=vertex2 |
||
1265 | ;a=color = %33210210 |
||
1266 | ;ld (prpixel_color_l),a |
||
1267 | ;ld (prpixel_color_r),a |
||
1268 | ld l,a |
||
1269 | and 0x47;%01000111 ;keep left pixel |
||
504 | alone | 1270 | ;ld (invpixel_color_l),a |
1271 | ;ld (prpixel_color_l),a |
||
1272 | ld (lineverR_color_l),a |
||
1273 | ld (lineverL_color_l),a |
||
1274 | ld (linehorR_color_l),a |
||
1275 | ld (linehorL_color_l),a |
||
498 | alone | 1276 | xor l ;keep right pixel |
504 | alone | 1277 | ;ld (invpixel_color_r),a |
1278 | ;ld (prpixel_color_r),a |
||
1279 | ld (lineverR_color_r),a |
||
1280 | ld (lineverL_color_r),a |
||
1281 | ld (linehorR_color_r),a |
||
1282 | ld (linehorL_color_r),a |
||
498 | alone | 1283 | ld h,0 |
1284 | ld l,e ;vertex1 |
||
1285 | ld bc,vertices |
||
1286 | add hl,hl |
||
1287 | add hl,hl |
||
1288 | add hl,bc |
||
1289 | ld c,(hl) |
||
1290 | inc hl |
||
1291 | ld b,(hl) ;x |
||
1292 | inc hl |
||
1293 | ld a,(hl) ;y |
||
1294 | |||
1295 | ld h,0 |
||
1296 | ld l,d ;vertex2 |
||
1297 | ld de,vertices |
||
1298 | add hl,hl |
||
1299 | add hl,hl |
||
1300 | add hl,de ;NC |
||
1301 | ld e,(hl) |
||
1302 | inc hl |
||
1303 | ld d,(hl) ;x2 |
||
1304 | inc hl |
||
1305 | ;bc=x ( ࠭, ⥫) |
||
1306 | ;a=y |
||
1307 | ;de=x2 |
||
1308 | ;(hl)=y2 |
||
1309 | ;or a |
||
1310 | ;sbc hl,de |
||
1311 | ;add hl,de |
||
1312 | ;jp p,shapes_line_noswap |
||
1313 | sub (hl) |
||
1314 | jr c,shapes_line_noswap |
||
1315 | push af ;dy |
||
1316 | ld a,d |
||
1317 | ld d,b |
||
1318 | ld b,a |
||
1319 | ld a,e |
||
1320 | ld e,c |
||
1321 | ld c,a ;x <-> x2 |
||
1322 | ex de,hl |
||
1323 | sbc hl,bc |
||
1324 | push hl ;dx |
||
1325 | ex de,hl |
||
1326 | ld e,(hl) ;y |
||
1327 | jp shapes_line_noswapq |
||
113 | alone | 1328 | shapes_line_noswap |
498 | alone | 1329 | neg |
1330 | push af ;dy |
||
1331 | neg |
||
1332 | add a,(hl) |
||
1333 | ex de,hl |
||
500 | alone | 1334 | or a |
113 | alone | 1335 | sbc hl,bc |
1336 | push hl ;dx |
||
498 | alone | 1337 | ld e,a ;y |
1338 | shapes_line_noswapq |
||
113 | alone | 1339 | exx |
1340 | pop bc ;dx |
||
498 | alone | 1341 | ld a,0x03 ;inc bc |
113 | alone | 1342 | jp p,shapes_line_nodec |
1343 | xor a |
||
1344 | sub c |
||
1345 | ld c,a |
||
1346 | sbc a,b |
||
1347 | sub c |
||
1348 | ld b,a ;dx >= 0 |
||
498 | alone | 1349 | ld a,0x0b ;dec bc |
113 | alone | 1350 | shapes_line_nodec |
498 | alone | 1351 | pop hl ;dy |
1352 | ld l,h |
||
1353 | ld h,0 |
||
344 | alone | 1354 | ;a= inc/dec bc |
1355 | ;bc'=x ( ࠭, ⥫) |
||
498 | alone | 1356 | ;e'=y |
113 | alone | 1357 | or a |
1358 | sbc hl,bc |
||
1359 | add hl,bc |
||
498 | alone | 1360 | ;bc=dx |
1361 | ;hl=dy |
||
504 | alone | 1362 | jp nc,shapes_linever ;dy>=dx |
113 | alone | 1363 | ex de,hl |
1364 | ld hy,b |
||
1365 | ld ly,c ;counter=dx |
||
120 | alone | 1366 | |
1367 | ;0x0000 -> 0x0101 |
||
1368 | ;0x0001 -> 0x0102 |
||
1369 | ;0x00ff -> 0x0100 |
||
1370 | ;0x0100 -> 0x0201 |
||
1371 | inc ly |
||
1372 | inc hy |
||
1373 | |||
344 | alone | 1374 | ;inc iy ;inc hy ;㥬, ᥫ (⥭ 横) |
113 | alone | 1375 | ld h,b |
1376 | ld l,c |
||
1377 | sra h |
||
344 | alone | 1378 | rr l ;ym=dx div 2 ;TODO dx<0? |
113 | alone | 1379 | ;xor a |
1380 | ;sub l |
||
1381 | ;ld l,a |
||
1382 | ;sbc a,h |
||
1383 | ;sub l |
||
1384 | ;ld h,a ;mym=256-(dx div 2) |
||
1385 | exx |
||
504 | alone | 1386 | ld h,tx/256 |
1387 | ld d,ty/256 |
||
1388 | cp 0x03 ;inc bc |
||
1389 | jr nz,shapes_linehorL |
||
1390 | ;jr z,shapes_linehorR |
||
1391 | if 1==0 |
||
113 | alone | 1392 | ld (shapes_lineincx),a |
1393 | ;bc=x |
||
498 | alone | 1394 | ;e=y |
113 | alone | 1395 | ;hl'=xm |
1396 | ;bc'=dx |
||
1397 | ;de'=dy |
||
1398 | shapes_linehor0 |
||
120 | alone | 1399 | pixelprochor=$+1 |
1400 | call prpixel |
||
113 | alone | 1401 | shapes_lineincx=$ |
1402 | inc bc ;x+1 |
||
1403 | exx |
||
1404 | ;add hl,de ;mym+dy |
||
1405 | or a |
||
1406 | sbc hl,de ;ym-dy |
||
1407 | exx |
||
1408 | jr nc,shapes_linehor1 |
||
498 | alone | 1409 | inc e ;y+1 |
113 | alone | 1410 | exx |
1411 | ;or a |
||
1412 | ;sbc hl,bc ;mym-dx |
||
1413 | add hl,bc ;ym+dx |
||
1414 | exx |
||
1415 | shapes_linehor1 |
||
120 | alone | 1416 | dec ly |
1417 | jp nz,shapes_linehor0 |
||
1418 | dec hy |
||
1419 | jp nz,shapes_linehor0 |
||
113 | alone | 1420 | ret |
504 | alone | 1421 | endif |
1422 | |||
1423 | if 1==1 |
||
1424 | shapes_linehorR |
||
1425 | ld a,b |
||
1426 | rra |
||
1427 | ld a,c |
||
1428 | rra |
||
1429 | ld l,a |
||
1430 | ld b,ly |
||
1431 | ld a,(de) ;(y*40) |
||
1432 | jr c,shapes_linehorR_r |
||
1433 | add a,(hl) ;x div 4 |
||
1434 | ld c,a |
||
1435 | inc d |
||
1436 | inc h |
||
1437 | ld a,(de) ;'(y*40) |
||
1438 | adc a,(hl) ;f(x mod 4) |
||
1439 | ld h,a |
||
1440 | ld l,c |
||
1441 | ld de,40 |
||
1442 | ;hl=scr |
||
1443 | ;de=40 |
||
1444 | ;b=pixels |
||
1445 | shapes_linehorR0_l |
||
1446 | ld a,(hl) |
||
1447 | linehorR_and_l=$+1 |
||
1448 | and 0xb8 ;keep right pixel ; cls । redraw |
||
1449 | linehorR_color_l=$+1 |
||
1450 | xor 0;lx |
||
1451 | ld (hl),a |
||
1452 | exx |
||
1453 | ;or a |
||
1454 | sbc hl,de ;ym-dy |
||
1455 | exx |
||
1456 | jr nc,shapes_linehorR0_ldjnz |
||
1457 | add hl,de ;y+1 |
||
1458 | exx |
||
1459 | add hl,bc ;ym+dx |
||
1460 | exx |
||
1461 | shapes_linehorR0_ldjnz |
||
1462 | djnz shapes_linehorR0_r |
||
1463 | dec hy |
||
1464 | jp nz,shapes_linehorR0_r |
||
1465 | ret |
||
1466 | shapes_linehorR_r |
||
1467 | add a,(hl) ;x div 4 |
||
1468 | ld c,a |
||
1469 | inc d |
||
1470 | inc h |
||
1471 | ld a,(de) ;'(y*40) |
||
1472 | adc a,(hl) ;f(x mod 4) |
||
1473 | ld h,a |
||
1474 | ld l,c |
||
1475 | ld de,40 |
||
1476 | ;hl=scr |
||
1477 | ;de=40 |
||
1478 | ;b=pixels |
||
1479 | shapes_linehorR0_r |
||
1480 | ld a,(hl) |
||
1481 | linehorR_and_r=$+1 |
||
1482 | and 0x47 ;keep left pixel ; cls । redraw |
||
1483 | linehorR_color_r=$+1 |
||
1484 | xor 0;lx |
||
1485 | ld (hl),a |
||
1486 | bit 6,h |
||
1487 | set 6,h |
||
1488 | jr z,shapes_linehorR_incxok |
||
1489 | ld a,h |
||
1490 | xor 0x60 |
||
1491 | ld h,a |
||
1492 | and 0x20 |
||
1493 | jr nz,shapes_linehorR_incxok |
||
1494 | inc hl |
||
1495 | shapes_linehorR_incxok |
||
1496 | exx |
||
1497 | ;or a |
||
1498 | sbc hl,de ;ym-dy |
||
1499 | exx |
||
1500 | jr nc,shapes_linehorR0_rdjnz |
||
1501 | add hl,de ;y+1 |
||
1502 | exx |
||
1503 | add hl,bc ;ym+dx |
||
1504 | exx |
||
1505 | shapes_linehorR0_rdjnz |
||
1506 | djnz shapes_linehorR0_l |
||
1507 | dec hy |
||
1508 | jp nz,shapes_linehorR0_l |
||
1509 | ret |
||
1510 | |||
1511 | shapes_linehorL |
||
1512 | ld a,b |
||
1513 | rra |
||
1514 | ld a,c |
||
1515 | rra |
||
1516 | ld l,a |
||
1517 | ld b,ly |
||
1518 | ld a,(de) ;(y*40) |
||
1519 | jr c,shapes_linehorL_r |
||
1520 | add a,(hl) ;x div 4 |
||
1521 | ld c,a |
||
1522 | inc d |
||
1523 | inc h |
||
1524 | ld a,(de) ;'(y*40) |
||
1525 | adc a,(hl) ;f(x mod 4) |
||
1526 | ld h,a |
||
1527 | ld l,c |
||
1528 | ld de,40 |
||
1529 | ;hl=scr |
||
1530 | ;de=40 |
||
1531 | ;b=pixels |
||
1532 | shapes_linehorL0_l |
||
1533 | ld a,(hl) |
||
1534 | linehorL_and_l=$+1 |
||
1535 | and 0xb8 ;keep right pixel ; cls । redraw |
||
1536 | linehorL_color_l=$+1 |
||
1537 | xor 0;lx |
||
1538 | ld (hl),a |
||
1539 | bit 6,h |
||
1540 | res 6,h |
||
1541 | jr nz,shapes_linehorL_decxok |
||
1542 | ld a,h |
||
1543 | xor 0x60 |
||
1544 | ld h,a |
||
1545 | and 0x20 |
||
1546 | jr z,shapes_linehorL_decxok |
||
1547 | dec hl |
||
1548 | shapes_linehorL_decxok |
||
1549 | exx |
||
1550 | ;or a |
||
1551 | sbc hl,de ;ym-dy |
||
1552 | exx |
||
1553 | jr nc,shapes_linehorL0_ldjnz |
||
1554 | add hl,de ;y+1 |
||
1555 | exx |
||
1556 | add hl,bc ;ym+dx |
||
1557 | exx |
||
1558 | shapes_linehorL0_ldjnz |
||
1559 | djnz shapes_linehorL0_r |
||
1560 | dec hy |
||
1561 | jp nz,shapes_linehorL0_r |
||
1562 | ret |
||
1563 | shapes_linehorL_r |
||
1564 | add a,(hl) ;x div 4 |
||
1565 | ld c,a |
||
1566 | inc d |
||
1567 | inc h |
||
1568 | ld a,(de) ;'(y*40) |
||
1569 | adc a,(hl) ;f(x mod 4) |
||
1570 | ld h,a |
||
1571 | ld l,c |
||
1572 | ld de,40 |
||
1573 | ;hl=scr |
||
1574 | ;de=40 |
||
1575 | ;b=pixels |
||
1576 | shapes_linehorL0_r |
||
1577 | ld a,(hl) |
||
1578 | linehorL_and_r=$+1 |
||
1579 | and 0x47 ;keep left pixel ; cls । redraw |
||
1580 | linehorL_color_r=$+1 |
||
1581 | xor 0;lx |
||
1582 | ld (hl),a |
||
1583 | exx |
||
1584 | ;or a |
||
1585 | sbc hl,de ;ym-dy |
||
1586 | exx |
||
1587 | jr nc,shapes_linehorL0_rdjnz |
||
1588 | add hl,de ;y+1 |
||
1589 | exx |
||
1590 | add hl,bc ;ym+dx |
||
1591 | exx |
||
1592 | shapes_linehorL0_rdjnz |
||
1593 | djnz shapes_linehorL0_l |
||
1594 | dec hy |
||
1595 | jp nz,shapes_linehorL0_l |
||
1596 | ret |
||
1597 | |||
1598 | endif |
||
1599 | |||
113 | alone | 1600 | shapes_linever |
498 | alone | 1601 | ld d,h |
1602 | ld e,l |
||
113 | alone | 1603 | ld hy,d |
1604 | ld ly,e ;counter=dy |
||
120 | alone | 1605 | |
1606 | ;0x0000 -> 0x0101 |
||
1607 | ;0x0001 -> 0x0102 |
||
1608 | ;0x00ff -> 0x0100 |
||
1609 | ;0x0100 -> 0x0201 |
||
1610 | inc ly |
||
1611 | inc hy |
||
1612 | |||
344 | alone | 1613 | ;inc iy ;inc hy ;㥬, ᥫ (⥭ 横) |
498 | alone | 1614 | ;ld h,d |
1615 | ;ld l,e |
||
113 | alone | 1616 | sra h |
1617 | rr l |
||
1618 | ;xor a |
||
1619 | ;sub l |
||
1620 | ;ld l,a |
||
1621 | ;sbc a,h |
||
1622 | ;sub l |
||
1623 | ;ld h,a ;mxm=256-(dy div 2) |
||
1624 | exx |
||
504 | alone | 1625 | ld h,tx/256 |
1626 | ld d,ty/256 |
||
1627 | cp 0x03 ;inc bc |
||
1628 | jr nz,shapes_lineverL |
||
1629 | ;jr z,shapes_lineverR |
||
1630 | if 1==0 |
||
113 | alone | 1631 | ld (shapes_lineincx2),a |
1632 | ;bc=x |
||
498 | alone | 1633 | ;e=y |
113 | alone | 1634 | ;hl'=xm |
1635 | ;bc'=dx |
||
1636 | ;de'=dy |
||
1637 | shapes_linever0 |
||
120 | alone | 1638 | pixelprocver=$+1 |
1639 | call prpixel |
||
498 | alone | 1640 | inc e ;y+1 |
113 | alone | 1641 | exx |
1642 | ;add hl,bc ;mxm+dx |
||
1643 | or a |
||
504 | alone | 1644 | sbc hl,bc ;xm-dx |
113 | alone | 1645 | exx |
1646 | jr nc,shapes_linever1 |
||
1647 | shapes_lineincx2=$ |
||
1648 | inc bc ;x+1 |
||
1649 | exx |
||
1650 | ;or a |
||
1651 | ;sbc hl,de ;mxm-dy |
||
1652 | add hl,de ;xm+dy |
||
1653 | exx |
||
1654 | shapes_linever1 |
||
120 | alone | 1655 | dec ly |
1656 | jp nz,shapes_linever0 |
||
1657 | dec hy |
||
1658 | jp nz,shapes_linever0 |
||
113 | alone | 1659 | ret |
504 | alone | 1660 | endif |
113 | alone | 1661 | |
504 | alone | 1662 | if 1==1 |
1663 | ;bc=x |
||
1664 | ;e=y |
||
1665 | ;hl'=xm |
||
1666 | ;bc'=dx |
||
1667 | ;de'=dy |
||
1668 | shapes_lineverR |
||
1669 | ld a,b |
||
1670 | rra |
||
1671 | ld a,c |
||
1672 | rra |
||
1673 | ld l,a |
||
1674 | ld b,ly |
||
1675 | ld a,(de) ;(y*40) |
||
1676 | jr c,shapes_lineverR_r |
||
1677 | add a,(hl) ;x div 4 |
||
1678 | ld c,a |
||
1679 | inc d |
||
1680 | inc h |
||
1681 | ld a,(de) ;'(y*40) |
||
1682 | adc a,(hl) ;f(x mod 4) |
||
1683 | ld h,a |
||
1684 | ld l,c |
||
1685 | ld de,40 |
||
1686 | ;hl=scr |
||
1687 | ;de=40 |
||
1688 | ;b=pixels |
||
1689 | shapes_lineverR0_l |
||
1690 | ld a,(hl) |
||
1691 | lineverR_and_l=$+1 |
||
1692 | and 0xb8 ;keep right pixel ; cls । redraw |
||
1693 | lineverR_color_l=$+1 |
||
1694 | xor 0;lx |
||
1695 | ld (hl),a |
||
1696 | add hl,de ;y+1 ;NC |
||
1697 | exx |
||
1698 | ;or a |
||
1699 | sbc hl,bc ;xm-dx |
||
1700 | jr c,shapes_lineverRincx_r |
||
1701 | ;add hl,de ;xm+dy |
||
1702 | exx |
||
1703 | shapes_lineverR0_ldjnz |
||
1704 | djnz shapes_lineverR0_l |
||
1705 | dec hy |
||
1706 | jp nz,shapes_lineverR0_l |
||
1707 | ret |
||
1708 | shapes_lineverR_r |
||
1709 | add a,(hl) ;x div 4 |
||
1710 | ld c,a |
||
1711 | inc d |
||
1712 | inc h |
||
1713 | ld a,(de) ;'(y*40) |
||
1714 | adc a,(hl) ;f(x mod 4) |
||
1715 | ld h,a |
||
1716 | ld l,c |
||
1717 | ld de,40 |
||
1718 | shapes_lineverR0_r |
||
1719 | ld a,(hl) |
||
1720 | lineverR_and_r=$+1 |
||
1721 | and 0x47 ;keep left pixel ; cls । redraw |
||
1722 | lineverR_color_r=$+1 |
||
1723 | xor 0;lx |
||
1724 | ld (hl),a |
||
1725 | add hl,de ;y+1 ;NC |
||
1726 | exx |
||
1727 | ;or a |
||
1728 | sbc hl,bc ;xm-dx |
||
1729 | jr c,shapes_lineverRincx_l |
||
1730 | exx |
||
1731 | djnz shapes_lineverR0_r |
||
1732 | dec hy |
||
1733 | jp nz,shapes_lineverR0_r |
||
1734 | ret |
||
1735 | shapes_lineverRincx_r |
||
1736 | add hl,de ;xm+dy |
||
1737 | exx |
||
1738 | djnz shapes_lineverR0_r |
||
1739 | dec hy |
||
1740 | jp nz,shapes_lineverR0_r |
||
1741 | ret |
||
1742 | shapes_lineverRincx_l |
||
1743 | add hl,de ;xm+dy |
||
1744 | exx |
||
1745 | bit 6,h |
||
1746 | set 6,h |
||
1747 | jr z,shapes_lineverR0_ldjnz |
||
1748 | ld a,h |
||
1749 | xor 0x60 |
||
1750 | ld h,a |
||
1751 | and 0x20 |
||
1752 | jr nz,shapes_lineverR0_ldjnz |
||
1753 | inc hl |
||
1754 | jp shapes_lineverR0_ldjnz |
||
113 | alone | 1755 | |
504 | alone | 1756 | shapes_lineverL |
1757 | ld a,b |
||
1758 | rra |
||
1759 | ld a,c |
||
1760 | rra |
||
1761 | ld l,a |
||
1762 | ld b,ly |
||
1763 | ld a,(de) ;(y*40) |
||
1764 | jr c,shapes_lineverL_r |
||
1765 | add a,(hl) ;x div 4 |
||
1766 | ld c,a |
||
1767 | inc d |
||
1768 | inc h |
||
1769 | ld a,(de) ;'(y*40) |
||
1770 | adc a,(hl) ;f(x mod 4) |
||
1771 | ld h,a |
||
1772 | ld l,c |
||
1773 | ld de,40 |
||
1774 | ;hl=scr |
||
1775 | ;de=40 |
||
1776 | ;b=pixels |
||
1777 | shapes_lineverL0_l |
||
1778 | ld a,(hl) |
||
1779 | lineverL_and_l=$+1 |
||
1780 | and 0xb8 ;keep right pixel ; cls । redraw |
||
1781 | lineverL_color_l=$+1 |
||
1782 | xor 0;lx |
||
1783 | ld (hl),a |
||
1784 | add hl,de ;y+1 ;NC |
||
1785 | exx |
||
1786 | ;or a |
||
1787 | sbc hl,bc ;xm-dx |
||
1788 | jr c,shapes_lineverLdecx_r |
||
1789 | ;add hl,de ;xm+dy |
||
1790 | exx |
||
1791 | djnz shapes_lineverL0_l |
||
1792 | dec hy |
||
1793 | jp nz,shapes_lineverL0_l |
||
1794 | ret |
||
1795 | shapes_lineverL_r |
||
1796 | add a,(hl) ;x div 4 |
||
1797 | ld c,a |
||
1798 | inc d |
||
1799 | inc h |
||
1800 | ld a,(de) ;'(y*40) |
||
1801 | adc a,(hl) ;f(x mod 4) |
||
1802 | ld h,a |
||
1803 | ld l,c |
||
1804 | ld de,40 |
||
1805 | shapes_lineverL0_r |
||
1806 | ld a,(hl) |
||
1807 | lineverL_and_r=$+1 |
||
1808 | and 0x47 ;keep left pixel ; cls । redraw |
||
1809 | lineverL_color_r=$+1 |
||
1810 | xor 0;lx |
||
1811 | ld (hl),a |
||
1812 | add hl,de ;y+1 ;NC |
||
1813 | exx |
||
1814 | ;or a |
||
1815 | sbc hl,bc ;xm-dx |
||
1816 | jr c,shapes_lineverLdecx_l |
||
1817 | exx |
||
1818 | shapes_lineverL0_rdjnz |
||
1819 | djnz shapes_lineverL0_r |
||
1820 | dec hy |
||
1821 | jp nz,shapes_lineverL0_r |
||
1822 | ret |
||
1823 | shapes_lineverLdecx_r |
||
1824 | add hl,de ;xm+dy |
||
1825 | exx |
||
1826 | bit 6,h |
||
1827 | res 6,h |
||
1828 | jr nz,shapes_lineverL0_rdjnz |
||
1829 | ld a,h |
||
1830 | xor 0x60 |
||
1831 | ld h,a |
||
1832 | and 0x20 |
||
1833 | jr z,shapes_lineverL0_rdjnz |
||
1834 | dec hl |
||
1835 | jp shapes_lineverL0_rdjnz |
||
1836 | shapes_lineverLdecx_l |
||
1837 | add hl,de ;xm+dy |
||
1838 | exx |
||
1839 | djnz shapes_lineverL0_l |
||
1840 | dec hy |
||
1841 | jp nz,shapes_lineverL0_l |
||
1842 | ret |
||
120 | alone | 1843 | |
504 | alone | 1844 | endif |
113 | alone | 1845 | |
115 | alone | 1846 | oldupdtimer |
1847 | dw 0 |
||
113 | alone | 1848 | |
1849 | align 256 |
||
498 | alone | 1850 | tx |
1851 | dup 256 |
||
1852 | db ($&0xff)/4 |
||
1853 | edup |
||
1854 | dup 64 |
||
1855 | db 0x80 |
||
1856 | db 0xc0 |
||
1857 | db 0xa0 |
||
1858 | db 0xe0 |
||
1859 | edup |
||
1860 | ty |
||
500 | alone | 1861 | dup 200 |
498 | alone | 1862 | db 0xff&(($&0xff)*40) |
1863 | edup |
||
500 | alone | 1864 | ds 56,0xff&8000 |
1865 | dup 200 |
||
498 | alone | 1866 | db (($&0xff)*40)/256 |
1867 | edup |
||
500 | alone | 1868 | ds 56,8000/256 |
113 | alone | 1869 | font |
1870 | incbin "fontgfx" |
||
1871 | |||
1872 | genmesh |
||
1873 | xor a |
||
1874 | ld (nvertices),a |
||
1875 | ld (nvertices2),a |
||
1876 | ld (curmeshvertex),a |
||
504 | alone | 1877 | ld h,a |
1878 | ld l,a ;ld hl,0 |
||
115 | alone | 1879 | ld (nedges),hl |
1880 | ;ld (ncrossededges),hl |
||
344 | alone | 1881 | ld (genmeshedge_old),hl ; ॡ |
1882 | ;ᮧ 2 祪 ( sqrt(verticesneeded)) ࠬ : |
||
113 | alone | 1883 | ld (genmeshx),hl |
1884 | ld (genmeshy),hl |
||
1885 | call genmeshvertex ;in verlist2 |
||
504 | alone | 1886 | ld a,(verticesneeded) |
1887 | ;ld h,0 |
||
1888 | ;sqrt |
||
1889 | ;in: a [hl] |
||
1890 | ;out: d |
||
1891 | or a |
||
1892 | ld de,64 |
||
1893 | ;ld a,l |
||
1894 | ld l,d;h |
||
1895 | ld h,d |
||
1896 | ld b,8 |
||
1897 | sqrt0 |
||
1898 | sbc hl,de |
||
1899 | jr nc,$+3 |
||
1900 | add hl,de |
||
1901 | ccf |
||
1902 | rl d |
||
1903 | add a,a |
||
1904 | adc hl,hl |
||
1905 | add a,a |
||
1906 | adc hl,hl |
||
1907 | djnz sqrt0 |
||
1908 | |||
344 | alone | 1909 | ld b,d ;㤥 ᢥ sqrt |
113 | alone | 1910 | genmeshfirstrow0 |
1911 | push bc |
||
344 | alone | 1912 | call newedgeinlist2 ;楯塞 ॡ vertlist2 |
113 | alone | 1913 | pop bc |
1914 | djnz genmeshfirstrow0 |
||
1915 | |||
1916 | call copyvertlist2to1 |
||
1917 | |||
1918 | genmeshrows0 |
||
344 | alone | 1919 | ;稭 騩 |
113 | alone | 1920 | ld hl,(genmeshy) |
1921 | ld bc,25 |
||
1922 | add hl,bc |
||
1923 | ld (genmeshy),hl |
||
1924 | xor a |
||
1925 | ld (curopenvertinlist1),a |
||
1926 | ld (nvertices2),a |
||
504 | alone | 1927 | ld h,a |
1928 | ld l,a ;ld hl,0 |
||
1929 | ld (genmeshx),hl |
||
344 | alone | 1930 | ;᭠砫 楯塞 ࢮ ⮩ 窥 ॡ |
113 | alone | 1931 | ;. . . . |
344 | alone | 1932 | ;| ^⥪ 窠 |
1933 | ;* ⥪ 楯塞 窠 |
||
113 | alone | 1934 | ld a,(nvertices) |
1935 | push af |
||
1936 | call genmeshvertex ;in verlist2 |
||
344 | alone | 1937 | pop af ; 窠 |
113 | alone | 1938 | ld (curmeshvertex),a |
1939 | call linktoopenvertex |
||
1940 | |||
1941 | genmeshrow00 |
||
1942 | call func_rnd |
||
1943 | cp 128 |
||
344 | alone | 1944 | ; rnd>0.?, ᮧ ॡ 横 , 楯塞 ॡ |
1945 | ;TODO ⭮ ⠢ ᮮ⢥⢨ nvertices2 - ᨫ쭮 , 祬 , |
||
113 | alone | 1946 | ;. . . . |
1947 | ;|_\/ |
||
1948 | |||
1949 | ;. . . . |
||
1950 | ;|_\__| |
||
1951 | |||
1952 | ;. . . . |
||
1953 | ;|_\_.__\ |
||
344 | alone | 1954 | ; * ⥪ 楯塞 窠 |
1955 | ; ⠪ 窨 |
||
113 | alone | 1956 | jr c,genmesh_nextopenvert |
344 | alone | 1957 | call newedgeinlist2 ;楯塞 ॡ vertlist2 |
113 | alone | 1958 | ld a,(nvertices) |
1959 | ld hl,verticesneeded |
||
1960 | cp (hl) |
||
344 | alone | 1961 | jr nc,genmesh_finishlastvertex;jp nc,linktoopenvertex ;ᣥਫ 祪 ⮫쪮, 쪮 ᨫ |
1962 | ; ன ⭮ 楯塞 ⥪饩 ⮩ 窥 |
||
113 | alone | 1963 | call func_rnd |
1964 | cp 128 |
||
1965 | call c,linktoopenvertex |
||
1966 | jr genmeshrow00 |
||
1967 | genmesh_finishlastvertex |
||
344 | alone | 1968 | ;楯塞 ॡ ⥪饩 ⮩ 窥 ( ᥬ ! 2 鸞 墮 孥 ) 室 |
113 | alone | 1969 | genmesh_finishlastvertex0 |
344 | alone | 1970 | call linktoopenvertex ;楯塞 ॡ ⥪饩 ⮩ 窥 |
113 | alone | 1971 | ld de,curopenvertinlist1 |
1972 | ld a,(de) |
||
1973 | inc a |
||
1974 | ld hl,nvertices1 |
||
1975 | cp (hl) |
||
344 | alone | 1976 | ret nc ; 祪 - 稢 |
113 | alone | 1977 | ld (de),a |
1978 | jr genmesh_finishlastvertex0 |
||
1979 | |||
1980 | genmesh_nextopenvert |
||
344 | alone | 1981 | ;室 饩 ⮩ 窥, , 楯塞 ॡ |
113 | alone | 1982 | ld de,curopenvertinlist1 |
1983 | ld a,(de) |
||
1984 | inc a |
||
1985 | ld hl,nvertices1 |
||
1986 | cp (hl) |
||
344 | alone | 1987 | jr nc,genmesh_rowend ; 祪 - 稢 |
113 | alone | 1988 | ld (de),a |
344 | alone | 1989 | call linktoopenvertex ;楯塞 ॡ ⥪饩 ⮩ 窥 |
113 | alone | 1990 | jr genmeshrow00 |
1991 | genmesh_rowend |
||
344 | alone | 1992 | call linktoopenvertex ;楯塞 ॡ ⥪饩 () ⮩ 窥 |
1993 | ; 祪 |
||
113 | alone | 1994 | call copyvertlist2to1 |
1995 | jr genmeshrows0 |
||
1996 | |||
1997 | newedgeinlist2 |
||
344 | alone | 1998 | ;楯塞 ॡ vertlist2 |
113 | alone | 1999 | ld a,(nvertices) |
2000 | push af |
||
2001 | call genmeshvertex ;in verlist2 |
||
2002 | ld a,(curmeshvertex) |
||
344 | alone | 2003 | ld e,a ;⥪ 楯塞 窠 |
2004 | pop af ; 窠 |
||
113 | alone | 2005 | ld (curmeshvertex),a |
2006 | ld d,a |
||
2007 | jp genmeshedge |
||
2008 | |||
2009 | linktoopenvertex |
||
2010 | curmeshvertex=$+1 |
||
344 | alone | 2011 | ld d,0 ; 窨, 楯 |
113 | alone | 2012 | curopenvertinlist1=$+1 |
2013 | ld a,0 |
||
2014 | ld hl,vertlist1 |
||
2015 | add a,l |
||
2016 | ld l,a |
||
2017 | adc a,h |
||
2018 | sub l |
||
2019 | ld h,a |
||
344 | alone | 2020 | ld e,(hl) ;⥪ 窠 |
113 | alone | 2021 | jp genmeshedge |
2022 | |||
2023 | genmeshvertex |
||
2024 | ;in verlist2 |
||
2025 | genmeshx=$+1 |
||
2026 | ld bc,0 |
||
2027 | genmeshy=$+1 |
||
2028 | ld de,0 |
||
2029 | |||
564 | alone | 2030 | if 1==1 |
113 | alone | 2031 | ld c,160 |
2032 | call rnd |
||
2033 | add a,a |
||
2034 | ld c,a |
||
2035 | ld b,0 |
||
2036 | rl b |
||
2037 | push bc |
||
115 | alone | 2038 | ld c,200-8 |
113 | alone | 2039 | call rnd |
115 | alone | 2040 | add a,8 |
113 | alone | 2041 | ld e,a |
504 | alone | 2042 | ;ld d,0 |
113 | alone | 2043 | pop bc |
564 | alone | 2044 | endif |
113 | alone | 2045 | ;bc=x |
504 | alone | 2046 | ;e=y |
113 | alone | 2047 | ld a,(nvertices2) |
2048 | ld hl,vertlist2 |
||
2049 | add a,l |
||
2050 | ld l,a |
||
2051 | adc a,h |
||
2052 | sub l |
||
2053 | ld h,a |
||
2054 | ld a,(nvertices) |
||
2055 | ld (hl),a |
||
2056 | ld l,a |
||
2057 | ld h,0 |
||
2058 | add hl,hl |
||
2059 | add hl,hl |
||
2060 | push bc |
||
2061 | ld bc,vertices |
||
2062 | add hl,bc |
||
2063 | pop bc |
||
2064 | ld (hl),c |
||
2065 | inc hl |
||
2066 | ld (hl),b ;x |
||
2067 | inc hl |
||
2068 | ld (hl),e |
||
2069 | inc hl |
||
504 | alone | 2070 | ld (hl),0;d ;y |
113 | alone | 2071 | ld hl,nvertices |
2072 | inc (hl) |
||
2073 | ld hl,nvertices2 |
||
2074 | inc (hl) |
||
2075 | ld hl,(genmeshx) |
||
2076 | ld bc,24 |
||
2077 | add hl,bc |
||
2078 | ld (genmeshx),hl |
||
2079 | ret |
||
2080 | |||
2081 | copyvertlist2to1 |
||
2082 | ld hl,vertlist2 |
||
2083 | ld de,vertlist1 |
||
2084 | ld bc,MAXVERTICES |
||
2085 | ldir |
||
2086 | ld a,(nvertices2) |
||
2087 | ld (nvertices1),a |
||
2088 | ret |
||
2089 | |||
2090 | genmeshedge |
||
2091 | ;d=vertex1 |
||
2092 | ;e=vertex2 |
||
344 | alone | 2093 | ;ਬ, 㦥 楯 ॡ |
113 | alone | 2094 | genmeshedge_old=$+1 |
2095 | ld hl,0 |
||
2096 | or a |
||
2097 | sbc hl,de |
||
2098 | ld (genmeshedge_old),de |
||
2099 | ret z |
||
115 | alone | 2100 | ld bc,(nedges) |
113 | alone | 2101 | ld hl,edges |
2102 | add hl,bc |
||
2103 | add hl,bc |
||
2104 | add hl,bc |
||
564 | alone | 2105 | add hl,bc |
2106 | push hl |
||
113 | alone | 2107 | ld (hl),d |
2108 | inc hl |
||
2109 | ld (hl),e |
||
564 | alone | 2110 | inc hl |
2111 | ld (hl),0 ;crossed |
||
2112 | inc hl |
||
2113 | ld (hl),0 ;crossedHSB |
||
2114 | pop hl |
||
113 | alone | 2115 | ;check if this edge crossed with something, mark crossing here and there |
115 | alone | 2116 | ld bc,(nedges) |
113 | alone | 2117 | call checkcrossedwith_oldedges |
115 | alone | 2118 | ld hl,(nedges) |
2119 | inc hl |
||
2120 | ld (nedges),hl |
||
113 | alone | 2121 | ret |
2122 | |||
115 | alone | 2123 | if 1==0 |
113 | alone | 2124 | countcrossededges |
344 | alone | 2125 | ;塞 祭 ᥬ |
115 | alone | 2126 | ;ld hl,0 |
2127 | ;ld (ncrossededges),hl |
||
113 | alone | 2128 | ld hl,edges |
115 | alone | 2129 | ld bc,(nedges) |
2130 | initcrossededges0 |
||
2131 | inc hl |
||
2132 | inc hl |
||
2133 | ld (hl),0 ;uncrossed |
||
2134 | inc hl |
||
564 | alone | 2135 | ld (hl),0 ;crossedHSB |
2136 | inc hl |
||
115 | alone | 2137 | dec bc |
2138 | ld a,b |
||
2139 | or c |
||
2140 | jr nz,initcrossededges0 |
||
2141 | |||
2142 | ld hl,edges |
||
2143 | ld bc,(nedges) |
||
2144 | ld de,0 ;counter (+1) |
||
113 | alone | 2145 | countcrossededges0 |
2146 | push bc |
||
115 | alone | 2147 | push de |
113 | alone | 2148 | push hl |
115 | alone | 2149 | ld b,d |
2150 | ld c,e |
||
113 | alone | 2151 | call checkcrossedwith_oldedges |
2152 | pop hl |
||
2153 | inc hl |
||
2154 | inc hl |
||
2155 | inc hl |
||
564 | alone | 2156 | inc hl |
115 | alone | 2157 | pop de |
113 | alone | 2158 | pop bc |
115 | alone | 2159 | inc de |
2160 | dec bc |
||
2161 | ld a,b |
||
2162 | or c |
||
2163 | jr nz,countcrossededges0 |
||
113 | alone | 2164 | ret |
115 | alone | 2165 | endif |
113 | alone | 2166 | |
115 | alone | 2167 | inccrossededges |
2168 | ld (inccrossededges_proc),hl |
||
344 | alone | 2169 | ; 易 ६㥬/६㥬 祭 ( ) |
115 | alone | 2170 | ld hl,edges |
2171 | ld bc,(nedges) |
||
2172 | inccrossededges0 |
||
344 | alone | 2173 | ;饬 易 |
115 | alone | 2174 | ld e,(hl) |
2175 | inc hl |
||
2176 | ld d,(hl) |
||
2177 | dec hl |
||
2178 | ;e=vertex1 |
||
2179 | ;d=vertex2 |
||
2180 | ld a,(curvertex) |
||
2181 | cp d |
||
2182 | jr z,inccrossededgesok |
||
2183 | cp e |
||
2184 | jr nz,inccrossededgesno |
||
2185 | inccrossededgesok |
||
344 | alone | 2186 | ;諨 易 ॡ, 饬 祭 ( ᥬ ࠬ, ᠬ ᥡ) ६㥬 ( ᥡ ⮦) |
115 | alone | 2187 | push bc |
2188 | push hl |
||
2189 | ld (inccrossededges_selfaddr),hl |
||
2190 | ld hl,edges |
||
2191 | ld bc,(nedges) |
||
2192 | inccrossededges00 |
||
2193 | inccrossededges_selfaddr=$+1 |
||
2194 | ld de,0 |
||
2195 | or a |
||
2196 | sbc hl,de |
||
2197 | add hl,de |
||
2198 | jr z,inccrossededges00_skipself |
||
2199 | push bc |
||
2200 | ;hl=edge1addr |
||
2201 | ;de=edge2addr |
||
2202 | push hl |
||
2203 | call checkcrossed_edge ;out: CY=crossed |
||
2204 | pop hl |
||
2205 | inccrossededges_proc=$+1 |
||
2206 | call c,inccrossedandself |
||
2207 | pop bc |
||
2208 | inccrossededges00_skipself |
||
2209 | inc hl |
||
2210 | inc hl |
||
564 | alone | 2211 | inc hl |
504 | alone | 2212 | ;inc hl |
2213 | ;dec bc |
||
2214 | ;ld a,b |
||
2215 | ;or c |
||
2216 | ;jr nz,inccrossededges00 |
||
2217 | cpi |
||
2218 | jp pe,inccrossededges00 |
||
344 | alone | 2219 | ; ࠡ⪨ 易 ॡ |
115 | alone | 2220 | pop hl |
2221 | pop bc |
||
2222 | inccrossededgesno |
||
2223 | inc hl |
||
2224 | inc hl |
||
564 | alone | 2225 | inc hl |
504 | alone | 2226 | ;inc hl |
2227 | ;dec bc |
||
2228 | ;ld a,b |
||
2229 | ;or c |
||
2230 | ;jr nz,inccrossededges0 |
||
2231 | cpi |
||
2232 | jp pe,inccrossededges0 |
||
115 | alone | 2233 | ret |
2234 | inccrossedandself |
||
2235 | push hl |
||
2236 | inc hl |
||
2237 | inc hl |
||
2238 | inc (hl) |
||
564 | alone | 2239 | jr nz,$+4 |
2240 | inc hl |
||
2241 | inc (hl) |
||
115 | alone | 2242 | ld hl,(inccrossededges_selfaddr) |
2243 | inc hl |
||
2244 | inc hl |
||
2245 | inc (hl) |
||
564 | alone | 2246 | jr nz,$+4 |
2247 | inc hl |
||
2248 | inc (hl) |
||
115 | alone | 2249 | pop hl |
2250 | ret |
||
2251 | deccrossedandself |
||
2252 | push hl |
||
2253 | inc hl |
||
2254 | inc hl |
||
564 | alone | 2255 | inc (hl) |
2256 | dec (hl) |
||
2257 | jr nz,$+5 |
||
2258 | inc hl |
||
2259 | dec (hl) |
||
2260 | dec hl |
||
115 | alone | 2261 | dec (hl) |
2262 | ld hl,(inccrossededges_selfaddr) |
||
2263 | inc hl |
||
2264 | inc hl |
||
564 | alone | 2265 | inc (hl) |
2266 | dec (hl) |
||
2267 | jr nz,$+5 |
||
2268 | inc hl |
||
2269 | dec (hl) |
||
2270 | dec hl |
||
115 | alone | 2271 | dec (hl) |
2272 | pop hl |
||
2273 | ret |
||
2274 | |||
113 | alone | 2275 | checkcrossedwith_oldedges |
2276 | ;hl=edge to check |
||
115 | alone | 2277 | ;bc=nedges before current edge |
2278 | ;inc hl |
||
2279 | ;inc hl |
||
2280 | ;ld (hl),0 |
||
564 | alone | 2281 | ;inc hl |
2282 | ;ld (hl),0 |
||
2283 | ;dec hl |
||
115 | alone | 2284 | ;dec hl |
2285 | ;dec hl |
||
113 | alone | 2286 | ld de,edges |
115 | alone | 2287 | ld a,b |
2288 | or c |
||
2289 | ret z;jr z,genmeshedge_nocheckcrossed |
||
2290 | ;bc=was nedges |
||
113 | alone | 2291 | genmeshedge_checkcrossed0 |
2292 | push bc |
||
2293 | push de |
||
2294 | push hl |
||
2295 | call checkcrossed_edge |
||
2296 | pop hl |
||
2297 | pop de |
||
2298 | pop bc |
||
2299 | inc de |
||
2300 | inc de |
||
2301 | jr nc,genmeshedge_nocrossed |
||
564 | alone | 2302 | ex de,hl |
2303 | inc (hl) |
||
2304 | jr nz,$+5 |
||
2305 | inc hl |
||
2306 | inc (hl) |
||
2307 | dec hl |
||
2308 | ex de,hl |
||
113 | alone | 2309 | inc hl |
2310 | inc hl |
||
115 | alone | 2311 | inc (hl) |
564 | alone | 2312 | jr nz,$+5 |
2313 | inc hl |
||
2314 | inc (hl) |
||
2315 | dec hl |
||
113 | alone | 2316 | dec hl |
2317 | dec hl |
||
2318 | genmeshedge_nocrossed |
||
564 | alone | 2319 | inc de ;crossedHSB |
113 | alone | 2320 | inc de |
115 | alone | 2321 | dec bc |
2322 | ld a,b |
||
2323 | or c |
||
2324 | jr nz,genmeshedge_checkcrossed0 |
||
2325 | ;genmeshedge_nocheckcrossed |
||
113 | alone | 2326 | ret |
2327 | |||
508 | alone | 2328 | checkcrossedcoord |
2329 | ;ix<=bc: AB |
||
2330 | ;hl<=de: CD |
||
2331 | ;out: CY=crossed |
||
509 | lvd | 2332 | |
2333 | ; all possible configurations: |
||
2334 | ; |
||
2335 | ; 1. |
||
2336 | ; A===B |
||
2337 | ; C===D |
||
2338 | ; |
||
2339 | ; 2. |
||
2340 | ; C===D |
||
2341 | ; A===B |
||
2342 | ; |
||
2343 | ; 3. |
||
2344 | ; A======B |
||
2345 | ; C==D |
||
2346 | ; |
||
2347 | ; 4. |
||
2348 | ; C======D |
||
2349 | ; A==B |
||
2350 | ; |
||
2351 | ; 5. |
||
2352 | ; A===B |
||
2353 | ; C===D |
||
2354 | ; |
||
2355 | ; 6. |
||
2356 | ; C===D |
||
2357 | ; A===B |
||
2358 | |||
2359 | ; hence NON-crossed case is: |
||
2360 | ; |
||
2361 | ; if B(bc)<C(hl), otherwise if D(de)<A(ix) |
||
2362 | |||
2363 | or a |
||
2364 | sbc hl,bc ; C(hl)-B(bc): Z if B==C, cy if B>C, nc if B<C and not Z |
||
2365 | jr z,checkcrossedcoord_crossed |
||
2366 | ret nc |
||
2367 | |||
2368 | push ix |
||
2369 | pop hl |
||
2370 | or a |
||
2371 | sbc hl,de ;A(hl, was ix)-D(de) |
||
2372 | ret nz |
||
2373 | checkcrossedcoord_crossed: |
||
2374 | scf |
||
2375 | ret |
||
2376 | |||
2377 | |||
2378 | |||
2379 | if 1==0 |
||
508 | alone | 2380 | ;crossed case1: C(hl)<=B(bc), D(de)>=B(bc) |
2381 | or a |
||
2382 | sbc hl,bc |
||
2383 | add hl,bc |
||
2384 | jr z,checkcrossedcoord_maybecrossed1 |
||
2385 | ;jr c,checkcrossedcoord_maybecrossed1 |
||
2386 | jr nc,checkcrossedcoord_cross1q |
||
2387 | checkcrossedcoord_maybecrossed1 |
||
2388 | ex de,hl |
||
2389 | ;or a |
||
2390 | sbc hl,bc |
||
2391 | add hl,bc |
||
2392 | ;ex de,hl |
||
2393 | jr nc,checkcrossedcoord_crossed |
||
2394 | checkcrossedcoord_cross1q |
||
2395 | ;crossed case2: A(ix)<=C(hl), B(bc)>=C(hl) |
||
2396 | push ix |
||
2397 | pop de |
||
2398 | or a |
||
2399 | sbc hl,de |
||
2400 | add hl,de |
||
2401 | jr c,checkcrossedcoord_notcrossed |
||
2402 | ;or a |
||
2403 | sbc hl,bc |
||
2404 | add hl,bc |
||
2405 | jr z,checkcrossedcoord_crossed |
||
2406 | jr c,checkcrossedcoord_crossed |
||
2407 | checkcrossedcoord_notcrossed |
||
2408 | or a |
||
2409 | ret |
||
2410 | checkcrossedcoord_crossed |
||
2411 | scf |
||
2412 | ret |
||
509 | lvd | 2413 | endif |
508 | alone | 2414 | |
509 | lvd | 2415 | |
2416 | |||
2417 | |||
113 | alone | 2418 | checkcrossed_edge |
2419 | ;hl=edge1addr |
||
2420 | ;de=edge2addr |
||
2421 | ;out: CY=crossed |
||
344 | alone | 2422 | ; ᤥ hl>=de ᥣ (宦, ⨢ । ) |
115 | alone | 2423 | or a |
2424 | sbc hl,de |
||
2425 | add hl,de |
||
2426 | jr nc,$+3 |
||
2427 | ex de,hl |
||
2428 | |||
344 | alone | 2429 | ; A=C A=D B=C B=D, 祭 (ਬ몠) - न, 設!!! |
120 | alone | 2430 | ld a,(de) |
2431 | cp (hl) |
||
344 | alone | 2432 | ret z ;ਬ몠 |
120 | alone | 2433 | inc hl |
2434 | cp (hl) |
||
344 | alone | 2435 | ret z ;ਬ몠 |
120 | alone | 2436 | inc de |
2437 | ld a,(de) |
||
2438 | cp (hl) |
||
344 | alone | 2439 | ret z ;ਬ몠 |
120 | alone | 2440 | dec hl |
2441 | cp (hl) |
||
344 | alone | 2442 | ret z ;ਬ몠 |
120 | alone | 2443 | |
113 | alone | 2444 | ld c,(hl) ;edge1vertex1 |
2445 | inc hl |
||
2446 | ld a,(hl) ;edge1vertex2 |
||
2447 | ld b,0 |
||
2448 | ld hl,vertices |
||
2449 | add hl,bc |
||
2450 | add hl,bc |
||
2451 | add hl,bc |
||
2452 | add hl,bc |
||
2453 | ld c,(hl) |
||
2454 | inc hl |
||
2455 | ld b,(hl) |
||
2456 | ld (checkxA),bc |
||
2457 | inc hl |
||
2458 | ld c,(hl) |
||
2459 | inc hl |
||
2460 | ld b,(hl) |
||
2461 | ld (checkyA),bc |
||
504 | alone | 2462 | ld l,a ;edge1vertex2 |
2463 | ld h,0 |
||
2464 | ld bc,vertices |
||
2465 | add hl,hl |
||
2466 | add hl,hl |
||
113 | alone | 2467 | add hl,bc |
2468 | ld c,(hl) |
||
2469 | inc hl |
||
2470 | ld b,(hl) |
||
2471 | ld (checkxB),bc |
||
2472 | inc hl |
||
2473 | ld c,(hl) |
||
2474 | inc hl |
||
2475 | ld b,(hl) |
||
2476 | ld (checkyB),bc |
||
2477 | |||
2478 | ex de,hl |
||
2479 | |||
120 | alone | 2480 | ld a,(hl) ;edge2vertex2 |
2481 | dec hl |
||
113 | alone | 2482 | ld c,(hl) ;edge2vertex1 |
2483 | ld b,0 |
||
2484 | ld hl,vertices |
||
2485 | add hl,bc |
||
2486 | add hl,bc |
||
2487 | add hl,bc |
||
2488 | add hl,bc |
||
2489 | ld c,(hl) |
||
2490 | inc hl |
||
2491 | ld b,(hl) |
||
2492 | ld (checkxC),bc |
||
2493 | inc hl |
||
2494 | ld c,(hl) |
||
2495 | inc hl |
||
2496 | ld b,(hl) |
||
2497 | ld (checkyC),bc |
||
504 | alone | 2498 | ld l,a ;edge2vertex2 |
2499 | ld h,0 |
||
2500 | ld bc,vertices |
||
2501 | add hl,hl |
||
2502 | add hl,hl |
||
113 | alone | 2503 | add hl,bc |
2504 | ld c,(hl) |
||
2505 | inc hl |
||
2506 | ld b,(hl) |
||
2507 | ld (checkxD),bc |
||
2508 | inc hl |
||
2509 | ld c,(hl) |
||
2510 | inc hl |
||
2511 | ld b,(hl) |
||
2512 | ld (checkyD),bc |
||
508 | alone | 2513 | |
2514 | if 1==1 |
||
2515 | ;test xA..xB doesn't cross xC..xD: if cross, check y... |
||
2516 | ld hl,(checkxA) |
||
2517 | ld de,(checkxB) |
||
2518 | call maxhl_de_tode ;de>=hl |
||
2519 | push hl |
||
2520 | pop ix |
||
2521 | ld b,d |
||
2522 | ld c,e ;bc>=ix |
||
2523 | ld hl,(checkxC) |
||
2524 | ld de,(checkxD) |
||
2525 | call maxhl_de_tode ;de>=hl |
||
2526 | call checkcrossedcoord ;out: CY=crossed |
||
2527 | ret nc |
||
2528 | ;test yA..yB doesn't cross yC..yD |
||
2529 | ld hl,(checkyA) |
||
2530 | ld de,(checkyB) |
||
2531 | call maxhl_de_tode ;de>=hl |
||
2532 | push hl |
||
2533 | pop ix |
||
2534 | ld b,d |
||
2535 | ld c,e ;bc>=ix |
||
2536 | ld hl,(checkyC) |
||
2537 | ld de,(checkyD) |
||
2538 | call maxhl_de_tode ;de>=hl |
||
2539 | call checkcrossedcoord ;out: CY=crossed |
||
2540 | ret nc |
||
2541 | endif |
||
113 | alone | 2542 | |
344 | alone | 2543 | ;ઠ 祭 AB CD |
2544 | ; ( ୮ ந ) 㣮쭨 ABC BCD. , 祭. |
||
2545 | ; ࠡ뢠! ⮬ , DBA - ⠪ , 祭. |
||
2546 | ; ࠡ뢠 B,A CD ;塞 DCA |
||
2547 | ; ⮬ ࠭ [0..1]? |
||
2548 | ; (A=C B=D) (B=C A=D), 祭 (⮡ 먣뢠 ⮤ १) |
||
113 | alone | 2549 | if 1==1 |
2550 | ld hl,(checkxA) |
||
2551 | ld de,(checkxC) |
||
2552 | or a |
||
2553 | sbc hl,de |
||
2554 | jr nz,checkcrossed_noAC |
||
2555 | ld hl,(checkyA) |
||
2556 | ld de,(checkyC) |
||
2557 | or a |
||
2558 | sbc hl,de |
||
2559 | jr nz,checkcrossed_noAC |
||
2560 | ld hl,(checkxB) |
||
2561 | ld de,(checkxD) |
||
2562 | or a |
||
2563 | sbc hl,de |
||
2564 | jr nz,checkcrossed_noAC |
||
2565 | ld hl,(checkyB) |
||
2566 | ld de,(checkyD) |
||
2567 | or a |
||
2568 | sbc hl,de |
||
2569 | scf |
||
344 | alone | 2570 | ret z ;祭 |
113 | alone | 2571 | checkcrossed_noAC |
2572 | ld hl,(checkxB) |
||
2573 | ld de,(checkxC) |
||
2574 | or a |
||
2575 | sbc hl,de |
||
2576 | jr nz,checkcrossed_noBC |
||
2577 | ld hl,(checkyB) |
||
2578 | ld de,(checkyC) |
||
2579 | or a |
||
2580 | sbc hl,de |
||
2581 | jr nz,checkcrossed_noBC |
||
2582 | ld hl,(checkxA) |
||
2583 | ld de,(checkxD) |
||
2584 | or a |
||
2585 | sbc hl,de |
||
2586 | jr nz,checkcrossed_noBC |
||
2587 | ld hl,(checkyA) |
||
2588 | ld de,(checkyD) |
||
2589 | or a |
||
2590 | sbc hl,de |
||
2591 | scf |
||
344 | alone | 2592 | ret z ;祭 |
113 | alone | 2593 | checkcrossed_noBC |
2594 | endif |
||
2595 | |||
344 | alone | 2596 | ; A=C A=D B=C B=D, 祭 (ਬ몠) - न, 設!!! ⮬ ࠭ , . |
120 | alone | 2597 | if 1==0 |
113 | alone | 2598 | ld hl,(checkxA) |
2599 | ld de,(checkxC) |
||
2600 | or a |
||
2601 | sbc hl,de |
||
2602 | jr nz,checkcrossed_noACcommon |
||
2603 | ld hl,(checkyA) |
||
2604 | ld de,(checkyC) |
||
2605 | or a |
||
2606 | sbc hl,de |
||
344 | alone | 2607 | ret z ;ਬ몠 |
113 | alone | 2608 | checkcrossed_noACcommon |
2609 | ld hl,(checkxA) |
||
2610 | ld de,(checkxD) |
||
2611 | or a |
||
2612 | sbc hl,de |
||
2613 | jr nz,checkcrossed_noADcommon |
||
2614 | ld hl,(checkyA) |
||
2615 | ld de,(checkyD) |
||
2616 | or a |
||
2617 | sbc hl,de |
||
344 | alone | 2618 | ret z ;ਬ몠 |
113 | alone | 2619 | checkcrossed_noADcommon |
2620 | ld hl,(checkxB) |
||
2621 | ld de,(checkxC) |
||
2622 | or a |
||
2623 | sbc hl,de |
||
2624 | jr nz,checkcrossed_noBCcommon |
||
2625 | ld hl,(checkyB) |
||
2626 | ld de,(checkyC) |
||
2627 | or a |
||
2628 | sbc hl,de |
||
344 | alone | 2629 | ret z ;ਬ몠 |
113 | alone | 2630 | checkcrossed_noBCcommon |
2631 | ld hl,(checkxB) |
||
2632 | ld de,(checkxD) |
||
2633 | or a |
||
2634 | sbc hl,de |
||
2635 | jr nz,checkcrossed_noBDcommon |
||
2636 | ld hl,(checkyB) |
||
2637 | ld de,(checkyD) |
||
2638 | or a |
||
2639 | sbc hl,de |
||
344 | alone | 2640 | ret z ;ਬ몠 |
113 | alone | 2641 | checkcrossed_noBDcommon |
2642 | endif |
||
2643 | ;or a |
||
2644 | ;ret |
||
2645 | |||
344 | alone | 2646 | ; ⠥ ⥬⨪ |
113 | alone | 2647 | ld hl,(checkxA) |
2648 | ld (trix1),hl |
||
2649 | ld hl,(checkxB) |
||
2650 | ld (trix2),hl |
||
2651 | ld hl,(checkxC) |
||
2652 | ld (trix3),hl |
||
2653 | ld hl,(checkyA) |
||
2654 | ld (triy1),hl |
||
2655 | ld hl,(checkyB) |
||
2656 | ld (triy2),hl |
||
2657 | ld hl,(checkyC) |
||
2658 | ld (triy3),hl |
||
2659 | call checktriangle ;ABC |
||
120 | alone | 2660 | |
2661 | if 1==1 |
||
2662 | sbc a,a |
||
113 | alone | 2663 | push hl |
120 | alone | 2664 | push af |
113 | alone | 2665 | ld hl,(checkxD) |
2666 | ld (trix1),hl |
||
2667 | ld hl,(checkyD) |
||
2668 | ld (triy1),hl |
||
2669 | call checktriangle ;DBC |
||
120 | alone | 2670 | sbc a,a |
2671 | pop bc |
||
113 | alone | 2672 | pop de |
120 | alone | 2673 | xor b |
344 | alone | 2674 | ret nz ;ࠧ - 祭 |
113 | alone | 2675 | ld a,h |
120 | alone | 2676 | or l |
2677 | or d |
||
2678 | or e |
||
344 | alone | 2679 | jr z,checkcrossed_collinear ; 4 - ⤥쭠 ઠ |
120 | alone | 2680 | push bc |
2681 | ld hl,(checkxA) |
||
2682 | ld (trix3),hl |
||
2683 | ld hl,(checkyA) |
||
2684 | ld (triy3),hl |
||
2685 | call checktriangle ;DBA |
||
2686 | sbc a,a |
||
2687 | pop bc |
||
2688 | xor b |
||
344 | alone | 2689 | ret nz ;ࠧ - 祭 |
2690 | ; ࠡ뢠 B,A CD |
||
2691 | ;塞 DCA |
||
120 | alone | 2692 | push bc |
2693 | ld hl,(checkxC) |
||
2694 | ld (trix2),hl |
||
2695 | ld hl,(checkyC) |
||
2696 | ld (triy2),hl |
||
2697 | call checktriangle ;DCA |
||
2698 | sbc a,a |
||
2699 | pop bc |
||
2700 | xor b |
||
2701 | rla |
||
2702 | ccf |
||
344 | alone | 2703 | ret ; - 祭 |
120 | alone | 2704 | |
2705 | else |
||
2706 | |||
2707 | push hl |
||
2708 | ld hl,(checkxD) |
||
2709 | ld (trix1),hl |
||
2710 | ld hl,(checkyD) |
||
2711 | ld (triy1),hl |
||
2712 | call checktriangle ;DBC |
||
2713 | pop de |
||
2714 | ld a,h |
||
113 | alone | 2715 | xor d |
2716 | rla |
||
2717 | ccf |
||
344 | alone | 2718 | ret nc ;ࠧ - 祭 |
113 | alone | 2719 | push hl |
2720 | ld hl,(checkxA) |
||
2721 | ld (trix3),hl |
||
2722 | ld hl,(checkyA) |
||
2723 | ld (triy3),hl |
||
2724 | call checktriangle ;DBA |
||
2725 | pop bc |
||
2726 | ld a,h |
||
2727 | xor b |
||
2728 | rla |
||
2729 | ccf |
||
344 | alone | 2730 | ret nc ;ࠧ - 祭 |
113 | alone | 2731 | ld a,h |
2732 | or l |
||
2733 | or d |
||
2734 | or e |
||
344 | alone | 2735 | jr z,checkcrossed_collinear ;頤 DBC = 0 - ⤥쭠 ઠ |
2736 | ; ࠡ뢠 B,A CD |
||
2737 | ;塞 DCA |
||
113 | alone | 2738 | push hl |
2739 | ld hl,(checkxC) |
||
2740 | ld (trix2),hl |
||
2741 | ld hl,(checkyC) |
||
2742 | ld (triy2),hl |
||
2743 | call checktriangle ;DCA |
||
2744 | pop de |
||
2745 | ld a,h |
||
2746 | xor d |
||
2747 | rla |
||
2748 | ccf |
||
344 | alone | 2749 | ret ; - 祭 |
120 | alone | 2750 | endif |
2751 | |||
113 | alone | 2752 | checkcrossed_collinear |
344 | alone | 2753 | ;१ אַ |
2754 | ;⤥쭮 , १ 㣥 (࠭ 頤 0 ⠫ 祭) |
||
2755 | ; ᠬ (max-min) |
||
113 | alone | 2756 | ld hl,(checkxA) |
2757 | ld bc,(checkxB) |
||
2758 | call minhl_bc_tobc |
||
2759 | ld (checkxminAB),bc |
||
2760 | push bc |
||
2761 | ld hl,(checkxC) |
||
2762 | ld bc,(checkxD) |
||
2763 | call minhl_bc_tobc |
||
2764 | ld (checkxminCD),bc |
||
2765 | pop hl |
||
2766 | call minhl_bc_tobc |
||
2767 | ;bc=minx |
||
2768 | ld hl,(checkxA) |
||
2769 | ld de,(checkxB) |
||
2770 | call maxhl_de_tode |
||
2771 | ld (checkxmaxAB),de |
||
2772 | push de |
||
2773 | ld hl,(checkxC) |
||
2774 | ld de,(checkxD) |
||
2775 | call maxhl_de_tode |
||
2776 | ld (checkxmaxCD),de |
||
2777 | pop hl |
||
2778 | call maxhl_de_tode |
||
2779 | ;de=maxx |
||
2780 | ex de,hl |
||
2781 | or a |
||
2782 | sbc hl,bc |
||
2783 | push hl ;maxx-minx |
||
2784 | |||
2785 | ld hl,(checkyA) |
||
2786 | ld bc,(checkyB) |
||
2787 | call minhl_bc_tobc |
||
2788 | ld (checkyminAB),bc |
||
2789 | push bc |
||
2790 | ld hl,(checkyC) |
||
2791 | ld bc,(checkyD) |
||
2792 | call minhl_bc_tobc |
||
2793 | ld (checkyminCD),bc |
||
2794 | pop hl |
||
2795 | call minhl_bc_tobc |
||
2796 | ;bc=miny |
||
2797 | ld hl,(checkyA) |
||
2798 | ld de,(checkyB) |
||
2799 | call maxhl_de_tode |
||
2800 | ld (checkymaxAB),de |
||
2801 | push de |
||
2802 | ld hl,(checkyC) |
||
2803 | ld de,(checkyD) |
||
2804 | call maxhl_de_tode |
||
2805 | ld (checkymaxCD),de |
||
2806 | pop hl |
||
2807 | call maxhl_de_tode |
||
2808 | ;de=maxy |
||
2809 | ex de,hl |
||
2810 | or a |
||
2811 | sbc hl,bc ;maxy-miny |
||
2812 | |||
2813 | pop de ;maxx-minx |
||
2814 | |||
344 | alone | 2815 | ; 祭, max(A,B)<min(C,D) max(C,D)<min(A,B) |
113 | alone | 2816 | or a |
344 | alone | 2817 | sbc hl,de ;NC: ࠧ y >= ࠧ x, y |
113 | alone | 2818 | jr nc,checkcrossed_collinear_y |
344 | alone | 2819 | ;ࠧ y < ࠧ x, x |
113 | alone | 2820 | checkxmaxAB=$+1 |
2821 | ld hl,0 |
||
2822 | checkxminCD=$+1 |
||
2823 | ld de,0 |
||
2824 | or a |
||
2825 | sbc hl,de |
||
2826 | ccf |
||
344 | alone | 2827 | ret nc ; 祭 |
113 | alone | 2828 | checkxmaxCD=$+1 |
2829 | ld hl,0 |
||
2830 | checkxminAB=$+1 |
||
2831 | ld de,0 |
||
2832 | or a |
||
2833 | sbc hl,de |
||
2834 | ccf |
||
2835 | ret |
||
2836 | checkcrossed_collinear_y |
||
344 | alone | 2837 | ;ࠧ y >= ࠧ x, y |
113 | alone | 2838 | checkymaxAB=$+1 |
2839 | ld hl,0 |
||
2840 | checkyminCD=$+1 |
||
2841 | ld de,0 |
||
2842 | or a |
||
2843 | sbc hl,de |
||
2844 | ccf |
||
344 | alone | 2845 | ret nc ; 祭 |
113 | alone | 2846 | checkymaxCD=$+1 |
2847 | ld hl,0 |
||
2848 | checkyminAB=$+1 |
||
2849 | ld de,0 |
||
2850 | or a |
||
2851 | sbc hl,de |
||
2852 | ccf |
||
2853 | ret |
||
2854 | |||
2855 | minhl_bc_tobc |
||
2856 | or a |
||
2857 | sbc hl,bc |
||
2858 | add hl,bc |
||
2859 | ret nc ;bc<=hl |
||
2860 | ld b,h |
||
2861 | ld c,l |
||
2862 | ret |
||
2863 | |||
508 | alone | 2864 | maxhl_de_tode ;de>=hl |
113 | alone | 2865 | or a |
2866 | sbc hl,de |
||
2867 | add hl,de |
||
2868 | ret c ;de>hl |
||
2869 | ex de,hl |
||
508 | alone | 2870 | ret ;de>=hl |
113 | alone | 2871 | |
2872 | checkxA |
||
2873 | dw 0 |
||
2874 | checkyA |
||
2875 | dw 0 |
||
2876 | checkxB |
||
2877 | dw 0 |
||
2878 | checkyB |
||
2879 | dw 0 |
||
2880 | checkxC |
||
2881 | dw 0 |
||
2882 | checkyC |
||
2883 | dw 0 |
||
2884 | checkxD |
||
2885 | dw 0 |
||
2886 | checkyD |
||
2887 | dw 0 |
||
2888 | |||
2889 | checktriangle |
||
344 | alone | 2890 | ;out: CY=, hl==0 |
113 | alone | 2891 | ; x21:=vert[poly[i].v2].xscr-vert[poly[i].v1].xscr; |
2892 | ; x31:=vert[poly[i].v3].xscr-vert[poly[i].v1].xscr; |
||
2893 | ; y21:=vert[poly[i].v2].yscr-vert[poly[i].v1].yscr; |
||
2894 | ; y31:=vert[poly[i].v3].yscr-vert[poly[i].v1].yscr; |
||
120 | alone | 2895 | ld bc,tsqr/2 |
113 | alone | 2896 | triy2=$+1 |
2897 | ld hl,0 |
||
2898 | triy1=$+1 |
||
2899 | ld de,0 |
||
2900 | or a |
||
2901 | sbc hl,de |
||
2902 | ld (y21),hl |
||
2903 | triy3=$+1 |
||
2904 | ld hl,0 |
||
2905 | or a |
||
2906 | sbc hl,de |
||
2907 | ld (y31),hl |
||
2908 | trix2=$+1 |
||
2909 | ld hl,0 |
||
2910 | trix1=$+1 |
||
2911 | ld de,0 |
||
2912 | or a |
||
2913 | sbc hl,de |
||
120 | alone | 2914 | add hl,bc |
113 | alone | 2915 | ld (x21),hl |
2916 | trix3=$+1 |
||
2917 | ld hl,0 |
||
2918 | or a |
||
2919 | sbc hl,de |
||
120 | alone | 2920 | add hl,bc |
2921 | ;ld (x31),hl |
||
113 | alone | 2922 | ; poly[i].visible := ((x21*y31 - x31*y21) > 0); |
120 | alone | 2923 | ;x31=$+1 |
2924 | ;ld hl,0 |
||
2925 | ld bc,0 |
||
2926 | y21=$-2 |
||
2927 | call mul9 ;out: CYhl ;_MULLONG. ;out: hl(high), de(low) |
||
2928 | sbc a,a |
||
2929 | ld lx,a ;hsb |
||
2930 | ex de,hl |
||
113 | alone | 2931 | x21=$+1 |
120 | alone | 2932 | ld hl,0 |
2933 | ld bc,0 |
||
2934 | y31=$-2 |
||
2935 | call mul9 ;out: CYhl ;_MULLONG. ;out: hl(high), de(low) |
||
2936 | sbc a,a |
||
113 | alone | 2937 | or a |
120 | alone | 2938 | sbc hl,de ;lsw |
2939 | sbc a,lx ;hsb |
||
344 | alone | 2940 | rla ;CY=१ ࠢ (LVD) |
113 | alone | 2941 | ret |
2942 | |||
120 | alone | 2943 | mul9 |
2944 | ;9*9 -> 18 |
||
344 | alone | 2945 | ; ᯮ짮 +-319*+-192, ⮣ १ CY |
120 | alone | 2946 | ;hl=A+(tsqr/2) (A=+-319) |
2947 | ;bc=B = +-192 |
||
344 | alone | 2948 | ;A*B = ((A+B)^2)/4 - ((A-B)^2)/4 ;訥 2 । ࠢ, । ⭮ |
120 | alone | 2949 | push hl |
2950 | add hl,bc |
||
2951 | ;hl=A+B |
||
2952 | add hl,hl |
||
2953 | ;CY=0 |
||
2954 | ld (mulpatchadd),hl |
||
2955 | pop hl |
||
2956 | sbc hl,bc |
||
2957 | ;hl=A-B |
||
2958 | add hl,hl |
||
2959 | ;CY=0 |
||
2960 | ld (mulpatchsub),hl |
||
2961 | mulpatchadd=$+1 |
||
555 | alone | 2962 | ld hl,(0) ;ok |
120 | alone | 2963 | mulpatchsub=$+2 |
555 | alone | 2964 | ld bc,(0) ;ok |
120 | alone | 2965 | sbc hl,bc |
2966 | ;HL = %rrrrrrrr rrrrrrrr |
||
2967 | ret |
||
2968 | |||
2969 | align 2 |
||
2970 | tsqrsize=(320+200) |
||
2971 | _=tsqrsize |
||
2972 | dup tsqrsize |
||
2973 | _=_-1 |
||
2974 | dw ((_*_)/4)&0xffff |
||
2975 | edup |
||
2976 | tsqr |
||
2977 | _=0 |
||
2978 | dup tsqrsize |
||
2979 | dw ((_*_)/4)&0xffff |
||
2980 | _=_+1 |
||
2981 | edup |
||
2982 | |||
113 | alone | 2983 | |
2984 | if 1==0 |
||
2985 | ;hl * de (signed = unsigned) |
||
2986 | ;out: hl |
||
2987 | _MUL. |
||
2988 | ld a,h |
||
2989 | ld c,l |
||
2990 | ld hl,0 |
||
2991 | ld b,16 |
||
2992 | _MUL0. |
||
2993 | add hl,hl |
||
2994 | rl c |
||
2995 | rla |
||
2996 | jr nc,$+3 |
||
2997 | add hl,de |
||
2998 | djnz _MUL0. |
||
2999 | ret |
||
3000 | endif |
||
3001 | |||
120 | alone | 3002 | if 1==0 |
113 | alone | 3003 | ;hl, de * bc, ix |
3004 | ;out: hl(high), de(low) |
||
3005 | _MULLONG. |
||
3006 | ;EXPORT _MULLONG. |
||
3007 | ;signed mul is equal to unsigned mul |
||
3008 | ;hlde*bcix = hlde*b000 + hlde*c00 + hlde*i0 + hlde*x |
||
3009 | ld a,lx |
||
3010 | push af ;lx |
||
3011 | push ix ;hx |
||
3012 | ld a,c |
||
3013 | push af ;c |
||
3014 | ld a,b |
||
3015 | ;bcde <= hlde: |
||
3016 | ld b,h |
||
3017 | ld c,l |
||
3018 | ;hlix <= 0 |
||
3019 | ld hl,0 |
||
3020 | ;ld ix,0 |
||
3021 | push hl |
||
3022 | pop ix |
||
3023 | call _MULLONGP. ;hlix = (hlix<<8) + "b*hlde" |
||
3024 | pop af ;c |
||
3025 | call _MULLONGP. ;hlix = (hlix<<8) + "c*hlde" |
||
3026 | pop af ;hx |
||
3027 | call _MULLONGP. ;hlix = (hlix<<8) + "hx*hlde" |
||
3028 | pop af ;lx |
||
3029 | call _MULLONGP. ;hlix = (hlix<<8) + "lx*hlde" |
||
3030 | push ix |
||
3031 | pop de |
||
3032 | ret |
||
3033 | ;hlix = (hlix<<8) + a*bcde |
||
3034 | _MULLONGP. |
||
3035 | exx |
||
3036 | ld b,8 |
||
3037 | _MULLONG0. |
||
3038 | exx |
||
3039 | add ix,ix |
||
3040 | adc hl,hl |
||
3041 | rla |
||
3042 | jr nc,$+2+2+2 |
||
3043 | add ix,de |
||
3044 | adc hl,bc |
||
3045 | exx |
||
497 | alone | 3046 | djnz _MULLONG0. ; a==0 ( 室 scf:rla, add a,a) ; 横 |
113 | alone | 3047 | exx |
3048 | ret |
||
120 | alone | 3049 | endif |
113 | alone | 3050 | |
505 | alone | 3051 | setscrpgs |
555 | alone | 3052 | ld a,(user_scr0_low) ;ok |
505 | alone | 3053 | SETPG32KLOW |
555 | alone | 3054 | ld a,(user_scr0_high) ;ok |
505 | alone | 3055 | SETPG32KHIGH |
3056 | ret |
||
3057 | |||
497 | alone | 3058 | display $ |
120 | alone | 3059 | SAVEDATA |
3060 | level |
||
115 | alone | 3061 | db 0 |
3062 | verticesneeded |
||
3063 | db 10 |
||
120 | alone | 3064 | nvertices |
115 | alone | 3065 | db 0 |
113 | alone | 3066 | |
115 | alone | 3067 | nvertices1 |
3068 | db 0 |
||
3069 | nvertices2 |
||
3070 | db 0 |
||
3071 | |||
3072 | vertlinkflags |
||
113 | alone | 3073 | vertlist1 |
3074 | ds MAXVERTICES |
||
3075 | vertlist2 |
||
3076 | ds MAXVERTICES |
||
3077 | |||
3078 | vertices |
||
3079 | ;x,X,y,Y |
||
3080 | ds MAXVERTICES*4 |
||
3081 | edges |
||
564 | alone | 3082 | ;vertex1,vertex2,crossed,crossedHSB |
3083 | ds MAXEDGES*4 |
||
113 | alone | 3084 | nedges |
115 | alone | 3085 | dw 0 |
3086 | ;ncrossededges |
||
3087 | ; dw 0 |
||
120 | alone | 3088 | cur_h |
3089 | db 0 |
||
3090 | cur_m |
||
3091 | db 0 |
||
3092 | cur_s |
||
3093 | db 0 |
||
3094 | cur_f |
||
3095 | db 0 |
||
113 | alone | 3096 | |
120 | alone | 3097 | tlevel |
3098 | db "LEVEL 00" |
||
3099 | tleveldig1=$-2 |
||
3100 | tleveldig2=$-1 |
||
3101 | db " TIME 00:00:00" |
||
3102 | ttimeh1=$-8 |
||
3103 | ttimeh2=$-7 |
||
3104 | ttimem1=$-5 |
||
3105 | ttimem2=$-4 |
||
3106 | ttimes1=$-2 |
||
3107 | ttimes2=$-1 |
||
344 | alone | 3108 | nextlevelon=$ ; 䫠 ࠭ |
120 | alone | 3109 | db 0 |
3110 | db "NEXT LEVEL" |
||
3111 | db 0 |
||
3112 | |||
3113 | SAVEDATAsz=$-SAVEDATA |
||
3114 | |||
498 | alone | 3115 | pal ;DDp palette: %grbG11RB(low),%grbG11RB(high), inverted |
3116 | dw 0xffff,0xfefe,0xfdfd,0xfcfc,0xefef,0xeeee,0xeded,0xecec |
||
3117 | ;dw 0xffff,0xdede,0xbdbd,0x9c9c,0x6f6f,0x4e4e,0x2d2d,0x0c0c |
||
3118 | dw 0xffff,0x6f6f,0xbdbd,0x6f6f,0x6f6f,0x4e4e,0x2d2d,0x0c0c |
||
3119 | |||
113 | alone | 3120 | macro SHAPESPROC name |
3121 | name |
||
3122 | endm |
||
3123 | |||
504 | alone | 3124 | include "prarrow.asm" |
113 | alone | 3125 | |
3126 | include "control.asm" |
||
3127 | |||
3128 | end |
||
3129 | |||
504 | alone | 3130 | display "End=",end |
113 | alone | 3131 | ;display "Free after end=",/d,#c000-end |
289 | dimkam | 3132 | ;display "Size ",/d,end-begin," bytes" |
113 | alone | 3133 | |
3134 | savebin "untangle.com",begin,end-begin |
||
3135 | |||
564 | alone | 3136 | LABELSLIST "..\..\..\us\user.l" |