Mercurial > hg > Members > kono > nitros9-code
comparison level1/modules/ccio.asm @ 1583:2d73cd04596b
More comments
author | boisy |
---|---|
date | Fri, 21 May 2004 15:14:45 +0000 |
parents | e19a38f50c3a |
children | 0e3a28789196 |
comparison
equal
deleted
inserted
replaced
1582:e19a38f50c3a | 1583:2d73cd04596b |
---|---|
16 ttl OS-9 Level One V2 CoCo I/O driver | 16 ttl OS-9 Level One V2 CoCo I/O driver |
17 | 17 |
18 ifp1 | 18 ifp1 |
19 use defsfile | 19 use defsfile |
20 use scfdefs | 20 use scfdefs |
21 use cciodefs | |
21 endc | 22 endc |
22 | 23 |
23 tylg set Drivr+Objct | 24 tylg set Drivr+Objct |
24 atrv set ReEnt+rev | 25 atrv set ReEnt+rev |
25 rev set $01 | 26 rev set $01 |
104 * CC = carry set on error | 105 * CC = carry set on error |
105 * B = error code | 106 * B = error code |
106 * | 107 * |
107 Init stu >D.KbdSta store devmem ptr | 108 Init stu >D.KbdSta store devmem ptr |
108 clra clear A | 109 clra clear A |
109 leax V.SCF,u point to memory after V.SCF | 110 leax <V.SCF,u point to memory after V.SCF |
110 * leax <u001D,u | |
111 ldb #$5D get counter | 111 ldb #$5D get counter |
112 L002E sta ,x+ clear mem | 112 L002E sta ,x+ clear mem |
113 decb | 113 decb decrement counter |
114 bne L002E | 114 bne L002E continue if more |
115 coma A = $FF | 115 coma A = $FF |
116 comb B = $FF | 116 comb B = $FF |
117 stb <u0050,u | 117 stb <VD.Caps,u |
118 std <u005F,u | 118 std <u005F,u |
119 std <u0061,u | 119 std <u0061,u |
120 lda #$3C | 120 lda #60 |
121 sta <u0051,u | 121 sta <u0051,u |
122 leax >AltIRQ,pcr get IRQ routine ptr | 122 leax >AltIRQ,pcr get IRQ routine ptr |
123 stx >D.AltIRQ store in AltIRQ | 123 stx >D.AltIRQ store in AltIRQ |
124 leax >L03CC,pcr | 124 leax >L03CC,pcr |
125 stx <u005B,u | 125 stx <u005B,u |
152 * Exit: | 152 * Exit: |
153 * A = character read | 153 * A = character read |
154 * CC = carry set on error | 154 * CC = carry set on error |
155 * B = error code | 155 * B = error code |
156 * | 156 * |
157 Read leax <u007A,u | 157 Read leax <VD.InBuf,u point X to input buffer |
158 ldb <IBufTail,u get tail pointer | 158 ldb <VD.IBufT,u get tail pointer |
159 orcc #IRQMask mask IRQ | 159 orcc #IRQMask mask IRQ |
160 cmpb <IBufHead,u same as head pointer | 160 cmpb <VD.IBufH,u same as head pointer |
161 beq Put2Bed if so, buffer is empty, branch to sleep | 161 beq Put2Bed if so, buffer is empty, branch to sleep |
162 abx X now points to curr char | 162 abx X now points to curr char |
163 lda ,x get char | 163 lda ,x get char |
164 bsr L009D check for tail wrap | 164 bsr L009D check for tail wrap |
165 stb <IBufTail,u store updated tail | 165 stb <VD.IBufT,u store updated tail |
166 andcc #^(IRQMask+Carry) unmask IRQ | 166 andcc #^(IRQMask+Carry) unmask IRQ |
167 rts | 167 rts |
168 | 168 |
169 Put2Bed lda V.BUSY,u get calling process ID | 169 Put2Bed lda V.BUSY,u get calling process ID |
170 sta V.WAKE,u store in V.WAKE | 170 sta V.WAKE,u store in V.WAKE |
184 cmpb #$7F | 184 cmpb #$7F |
185 bls L00A3 | 185 bls L00A3 |
186 clrb | 186 clrb |
187 L00A3 rts | 187 L00A3 rts |
188 | 188 |
189 * | |
189 * IRQ routine for keyboard | 190 * IRQ routine for keyboard |
191 * | |
190 AltIRQ ldu >D.KbdSta get keyboard static | 192 AltIRQ ldu >D.KbdSta get keyboard static |
191 ldb <u0032,u | 193 ldb <u0032,u |
192 beq L00B7 | 194 beq L00B7 |
193 ldb <u002F,u | 195 ldb <u002F,u |
194 beq L00B7 | 196 beq L00B7 |
214 sta <u005F,u | 216 sta <u005F,u |
215 L00DA stb <u006D,u | 217 L00DA stb <u006D,u |
216 comb | 218 comb |
217 sta <u0060,u | 219 sta <u0060,u |
218 std <u0061,u | 220 std <u0061,u |
219 L00E4 jmp [>D.Clock] | 221 L00E4 jmp [>D.Clock] jump into clock module |
220 L00E8 comb | 222 L00E8 comb |
221 stb $02,x | 223 stb $02,x |
222 ldb ,x | 224 ldb ,x |
223 comb | 225 comb |
224 andb #$03 | 226 andb #$03 |
240 bra L011A | 242 bra L011A |
241 L010E sta <u006F,u | 243 L010E sta <u006F,u |
242 ldb #$05 | 244 ldb #$05 |
243 tst <u006B,u | 245 tst <u006B,u |
244 bne L0105 | 246 bne L0105 |
245 ldb #$3C | 247 ldb #60 |
246 L011A stb <u0051,u | 248 L011A stb <u0051,u |
247 ldb <IBufHead,u | 249 ldb <VD.IBufH,u |
248 leax <u007A,u | 250 leax <VD.InBuf,u |
249 abx | 251 abx |
250 lbsr L009D check for tail wrap | 252 lbsr L009D check for tail wrap |
251 cmpb <IBufTail,u | 253 cmpb <VD.IBufT,u |
252 beq L012F | 254 beq L012F |
253 stb <IBufHead,u | 255 stb <VD.IBufH,u |
254 L012F sta ,x | 256 L012F sta ,x |
255 beq L014F | 257 beq L014F |
256 cmpa V.PCHR,u | 258 cmpa V.PCHR,u |
257 bne L013F | 259 bne L013F |
258 ldx V.DEV2,u | 260 ldx V.DEV2,u |
310 adda #$1A | 312 adda #$1A |
311 ldb <u0067,u | 313 ldb <u0067,u |
312 bne L01E9 | 314 bne L01E9 |
313 adda #$40 | 315 adda #$40 |
314 ldb <u0066,u | 316 ldb <u0066,u |
315 eorb <u0050,u | 317 eorb <VD.Caps,u |
316 andb #$01 | 318 andb #$01 |
317 bne L01E9 | 319 bne L01E9 |
318 adda #$20 | 320 adda #$20 |
319 bra L01E9 | 321 bra L01E9 |
320 L01B9 ldb #$03 | 322 L01B9 ldb #$03 |
351 rts | 353 rts |
352 | 354 |
353 L01FD inc <u006D,u | 355 L01FD inc <u006D,u |
354 ldb <u006B,u | 356 ldb <u006B,u |
355 bne L0208 | 357 bne L0208 |
356 com <u0050,u | 358 com <VD.Caps,u |
357 L0208 orcc #Negative | 359 L0208 orcc #Negative |
358 L020A rts | 360 L020A rts |
359 L020B pshs b,a | 361 L020B pshs b,a |
360 clrb | 362 clrb |
361 orcc #Carry | 363 orcc #Carry |
530 * | 532 * |
531 * Exit: | 533 * Exit: |
532 * CC = carry set on error | 534 * CC = carry set on error |
533 * B = error code | 535 * B = error code |
534 * | 536 * |
535 Write ldb <u0025,u are we in the process of getting parameters? | 537 Write ldb <VD.NGChr,u are we in the process of getting parameters? |
536 bne L03A3 yes, go process | 538 bne PrmHandl yes, go process |
537 sta <WrChar,u save character to write | 539 sta <VD.WrChr,u save character to write |
538 cmpa #C$SPAC space or higher? | 540 cmpa #C$SPAC space or higher? |
539 bcc GoCo yes, normal write | 541 bcc GoCo yes, normal write |
540 cmpa #$1E escape sequence $1E or $1F? | 542 cmpa #$1E escape sequence $1E or $1F? |
541 bcc L03B8 yes, go process | 543 bcc Escape yes, go process |
542 cmpa #$0F ?? | 544 cmpa #$0F GFX codes? |
543 lbcc L063B branch if higher or same | 545 lbcc GfxDispatch branch if so |
544 cmpa #C$BELL bell? | 546 cmpa #C$BELL bell? |
545 lbeq Ding if so, ring bell | 547 lbeq Ding if so, ring bell |
546 * Here we call the Co-module to write the character | 548 * Here we call the CO-module to write the character |
547 GoCo lda <CoInUse,u get CO32/CO80 flag | 549 GoCo lda <VD.CurCo,u get CO32/CO80 flag |
548 CoWrite ldb #$03 we want to write | 550 CoWrite ldb #$03 we want to write |
549 CallCo leax <CoEnt,u get base pointer to CO-entries | 551 CallCO leax <CoEnt,u get base pointer to CO-entries |
550 ldx a,x get pointer to CO32/CO80 | 552 ldx a,x get pointer to CO32/CO80 |
551 beq NoIOMod branch if no module | 553 beq NoIOMod branch if no module |
552 lda <WrChar,u get character to write | 554 lda <VD.WrChr,u get character to write |
553 L039D jmp b,x call i/o subroutine | 555 L039D jmp b,x call i/o subroutine |
554 NoIOMod comb | 556 NoIOMod comb |
555 ldb #E$MNF | 557 ldb #E$MNF |
556 rts | 558 rts |
557 | 559 |
558 * Parameter handler | 560 * Parameter handler |
559 L03A3 cmpb #$02 two parameters left? | 561 PrmHandl cmpb #$02 two parameters left? |
560 beq L03B0 branch if so | 562 beq L03B0 branch if so |
561 sta <u0029,u else store in VD.NChar | 563 sta <VD.NChar,u else store in VD.NChar |
562 clr <u0025,u clear parameter counter (?) | 564 clr <VD.NGChr,u clear parameter counter |
563 jmp [<u0026,u] | 565 jmp [<VD.RTAdd,u] jump to return address |
564 L03B0 sta <u0028,u store in VD.NChr2 | 566 L03B0 sta <VD.NChr2,u store in VD.NChr2 |
565 dec <u0025,u decrement parameter counter (?) | 567 dec <VD.NGChr,u decrement parameter counter |
566 clrb | 568 clrb |
567 rts | 569 rts |
568 | 570 |
569 L03B8 beq L03C5 | 571 Escape beq L03C5 if $1E, we conveniently ignore it |
570 leax <L03C7,pcr | 572 leax <COEscape,pcr else it's $1F... set up to get next char |
571 L03BD ldb #$01 | 573 L03BD ldb #$01 |
572 L03BF stx <u0026,u | 574 L03BF stx <VD.RTAdd,u |
573 stb <u0025,u | 575 stb <VD.NGChr,u |
574 L03C5 clrb | 576 L03C5 clrb |
575 rts | 577 rts |
576 | 578 |
577 L03C7 ldb #$03 | 579 COEscape ldb #$03 write offset into CO-module |
578 lbra L055F | 580 lbra JmpCO |
579 | 581 |
580 L03CC pshs x,a | 582 L03CC pshs x,a |
581 stb <u002F,u | 583 stb <u002F,u |
582 lda >PIA1Base+2 | 584 lda >PIA1Base+2 |
583 anda #$07 | 585 anda #$07 |
584 ora ,s+ | 586 ora ,s+ |
585 tstb | 587 tstb |
586 bne L03DE | 588 bne L03DE |
587 ora <trulocas,u | 589 ora <VD.CFlag,u |
588 L03DE sta >PIA1Base+2 | 590 L03DE sta >PIA1Base+2 |
589 sta <u0030,u | 591 sta <u0030,u |
590 tstb | 592 tstb |
591 bne L03F5 | 593 bne L03F5 |
594 * Bang %00010101 to VDG | |
592 stb >$FFC0 | 595 stb >$FFC0 |
593 stb >$FFC2 | 596 stb >$FFC2 |
594 stb >$FFC4 | 597 stb >$FFC4 |
595 lda <u001D,u | 598 lda <u001D,u |
596 bra L0401 | 599 bra L0401 |
600 | |
601 * Bang %00101001 to VDG | |
597 L03F5 stb >$FFC0 | 602 L03F5 stb >$FFC0 |
598 stb >$FFC3 | 603 stb >$FFC3 |
599 stb >$FFC5 | 604 stb >$FFC5 |
600 lda <u0033,u | 605 lda <VD.CurBf,u |
601 L0401 ldb #$07 | 606 L0401 ldb #$07 |
602 ldx #$FFC6 | 607 ldx #$FFC6 |
603 lsra | 608 lsra |
604 L0407 lsra | 609 L0407 lsra |
605 bcs L0410 | 610 bcs L0410 |
626 * | 631 * |
627 * Exit: | 632 * Exit: |
628 * CC = carry set on error | 633 * CC = carry set on error |
629 * B = error code | 634 * B = error code |
630 * | 635 * |
631 GetStat sta <WrChar,u | 636 GetStat sta <VD.WrChr,u |
632 cmpa #SS.Ready | 637 cmpa #SS.Ready |
633 bne L0439 | 638 bne L0439 |
634 lda <IBufTail,u get buff tail ptr | 639 lda <VD.IBufT,u get buff tail ptr |
635 suba <IBufHead,u Num of chars ready in A | 640 suba <VD.IBufH,u Num of chars ready in A |
636 lbeq L0660 branch if empty | 641 lbeq NotReady branch if empty |
637 SSEOF clrb | 642 SSEOF clrb |
638 rts | 643 rts |
639 L0439 cmpa #SS.EOF | 644 L0439 cmpa #SS.EOF |
640 beq SSEOF | 645 beq SSEOF |
641 ldx PD.RGS,y | 646 ldx PD.RGS,y |
645 beq SSSCSIZ | 650 beq SSSCSIZ |
646 cmpa #SS.KySns | 651 cmpa #SS.KySns |
647 beq SSKYSNS | 652 beq SSKYSNS |
648 cmpa #SS.DStat | 653 cmpa #SS.DStat |
649 lbeq SSDSTAT | 654 lbeq SSDSTAT |
650 ldb #$06 | 655 ldb #$06 getstat entry into CO-module |
651 lbra L055F | 656 lbra JmpCO |
652 | 657 |
653 SSKYSNS ldb <u006A,u get key sense info | 658 SSKYSNS ldb <u006A,u get key sense info |
654 stb R$A,x put in caller's A | 659 stb R$A,x put in caller's A |
655 clrb | 660 clrb |
656 rts | 661 rts |
657 | 662 |
658 SSSCSIZ clra | 663 SSSCSIZ clra |
659 ldb <ScreenX,u | 664 ldb <VD.Col,u |
660 std R$X,x | 665 std R$X,x |
661 ldb <ScreenY,u | 666 ldb <VD.Row,u |
662 std R$Y,x | 667 std R$Y,x |
663 clrb | 668 clrb |
664 rts | 669 rts |
665 | 670 |
666 * Get joytsick values | 671 * Get joytsick values |
740 orb ,s+ | 745 orb ,s+ |
741 ldx $06,y | 746 ldx $06,y |
742 stb $01,x | 747 stb $01,x |
743 ldd <u0045,u | 748 ldd <u0045,u |
744 std $06,x | 749 std $06,x |
745 ldd <u0033,u | 750 ldd <VD.CurBf,u |
746 std $04,x | 751 std $04,x |
747 clrb | 752 clrb |
748 L050E rts | 753 L050E rts |
749 L050F pshs y,b,a | 754 L050F pshs y,b,a |
750 ldb <u0024,u | 755 ldb <u0024,u |
757 subb $02,s | 762 subb $02,s |
758 lda #$20 | 763 lda #$20 |
759 mul | 764 mul |
760 addb ,s+ | 765 addb ,s+ |
761 adca #$00 | 766 adca #$00 |
762 ldy <u0033,u | 767 ldy <VD.CurBf,u |
763 leay d,y | 768 leay d,y |
764 lda ,s | 769 lda ,s |
765 sty ,s | 770 sty ,s |
766 anda <u0044,u | 771 anda <u0044,u |
767 ldx <u0042,u | 772 ldx <u0042,u |
777 * | 782 * |
778 * Exit: | 783 * Exit: |
779 * CC = carry set on error | 784 * CC = carry set on error |
780 * B = error code | 785 * B = error code |
781 * | 786 * |
782 SetStat sta <WrChar,u | 787 SetStat sta <VD.WrChr,u save function code |
783 ldx PD.RGS,y | 788 ldx PD.RGS,y get caller's regs |
784 cmpa #SS.ComSt | 789 cmpa #SS.ComSt |
785 lbeq SSCOMST | 790 lbeq SSCOMST |
786 cmpa #SS.AAGBf | 791 cmpa #SS.AAGBf |
787 beq SSAAGBF | 792 beq SSAAGBF |
788 cmpa #SS.SLGBf | 793 cmpa #SS.SLGBf |
794 ldb #$FF | 799 ldb #$FF |
795 L0558 stb <u006C,u | 800 L0558 stb <u006C,u |
796 L055B clrb | 801 L055B clrb |
797 L055C rts | 802 L055C rts |
798 | 803 |
799 CoGetStt ldb #$09 co-module setstat | 804 CoGetStt ldb #$09 CO-module setstat |
800 L055F pshs b | 805 JmpCO pshs b |
801 lda <CoInUse,u get Co-module in use | 806 lda <VD.CurCo,u get CO-module in use |
802 lbsr CallCo | 807 lbsr CallCO |
803 puls a | 808 puls a |
804 bcc L055B | 809 bcc L055B |
805 tst <GRFOEnt,u GRFO linked? | 810 tst <VD.GRFOE,u GRFO linked? |
806 beq L055C | 811 beq L055C |
807 tfr a,b | 812 tfr a,b |
808 clra GRFO address offset in statics | 813 clra GRFO address offset in statics |
809 lbra CallCo call it | 814 lbra CallCO call it |
810 | 815 |
811 * Reserve an additional graphics buffer (up to 2) | 816 * Reserve an additional graphics buffer (up to 2) |
812 SSAAGBF ldb <u0031,u | 817 SSAAGBF ldb <VD.Rdy,u was initial buffer allocated with $0F? |
813 lbeq L0660 | 818 lbeq NotReady branch if not |
814 pshs b get buffer number | 819 pshs b save buffer number |
815 leay <u0037,u | 820 leay <VD.AGBuf,u point to additional graphics buffers |
816 ldd ,y | 821 ldd ,y first entry empty? |
817 beq L058E | 822 beq L058E branch if so |
818 leay $02,y | 823 leay $02,y else move to next entry |
819 inc ,s | 824 inc ,s increment B on stack |
820 ldd ,y | 825 ldd ,y second entry empty? |
821 bne L059E | 826 bne L059E if not, no room for more... error out |
822 L058E lbsr L0685 | 827 L058E lbsr GetMem allocate graphics buffer memory |
823 bcs L05A1 | 828 bcs L05A1 branch if error |
824 std ,y | 829 std ,y save new buffer pointer at ,Y |
825 std R$X,x | 830 std R$X,x and in caller's X |
826 puls b get buffer number off stack | 831 puls b get buffer number off stack |
827 clra clear hi byte of D | 832 clra clear hi byte of D |
828 std R$Y,x and put in caller's Y | 833 std R$Y,x and put in caller's Y (buffer number) |
829 clrb call is ok | 834 clrb call is ok |
830 rts and return | 835 rts and return |
831 L059E ldb #E$BMode | 836 L059E ldb #E$BMode |
832 coma | 837 coma |
833 L05A1 puls pc,a | 838 L05A1 puls pc,a |
834 | 839 |
835 * Select a graphics buffer | 840 * Select a graphics buffer |
836 SSSLGBF ldb <u0031,u | 841 SSSLGBF ldb <VD.Rdy,u was initial buffer allocated with $0F? |
837 lbeq L0660 | 842 lbeq NotReady branch if not |
838 ldd R$Y,x get buffer number from caller | 843 ldd R$Y,x else get buffer number from caller |
839 cmpd #$0002 compare against high | 844 cmpd #$0002 compare against high |
840 bhi BadMode branch if error | 845 bhi BadMode branch if error |
841 leay <u0035,u | 846 leay <VD.GBuff,u point to base graphics buffer address |
842 lslb multiply by 2 | 847 lslb multiply by 2 |
843 ldd b,y get pointer | 848 ldd b,y get pointer |
844 beq BadMode branch if error | 849 beq BadMode branch if error |
845 std <u0033,u else save in current | 850 std <VD.CurBf,u else save in current |
846 ldd R$X,x get select flag | 851 ldd R$X,x get select flag |
847 beq L05C3 if zero, do nothing | 852 beq L05C3 if zero, do nothing |
848 ldb #$01 else set display flag | 853 ldb #$01 else set display flag |
849 L05C3 stb <u0032,u save display flag | 854 L05C3 stb <u0032,u save display flag |
850 clrb | 855 clrb |
858 bne GoCO80 branch if so | 863 bne GoCO80 branch if so |
859 ldb #$10 assume true lower case TRUE | 864 ldb #$10 assume true lower case TRUE |
860 bita #$01 true lowercase bit set? | 865 bita #$01 true lowercase bit set? |
861 bne GoCO32 branch if so | 866 bne GoCO32 branch if so |
862 clrb true lower case FALSE | 867 clrb true lower case FALSE |
863 GoCO32 stb <trulocas,u save flag for later | 868 GoCO32 stb <VD.CFlag,u save flag for later |
864 lda #$02 CO32 is loaded bit | 869 lda #$02 CO32 is loaded bit |
865 ldx #$2010 32x16 | 870 ldx #$2010 32x16 |
866 pshs u,y,x,a | 871 pshs u,y,x,a |
867 leax >CO32,pcr | 872 leax >CO32,pcr |
868 bra L05F4 | 873 bra L05F4 |
869 GoCO80 lda #$04 'CO80 is loaded' bit | 874 GoCO80 lda #$04 'CO80 is loaded' bit |
870 ldx #$5018 80x24 | 875 ldx #$5018 80x24 |
871 pshs u,y,x,a | 876 pshs u,y,x,a |
872 leax >CO80,pcr | 877 leax >CO80,pcr |
873 L05F4 bsr L0601 load co-module if not already loaded | 878 L05F4 bsr L0601 load CO-module if not already loaded |
874 puls u,y,x,a | 879 puls u,y,x,a |
875 bcs L0600 | 880 bcs L0600 |
876 stx <ScreenX,u save screen size | 881 stx <VD.Col,u save screen size |
877 sta <CoInUse,u current module in use? ($02=CO32, $04=C080) | 882 sta <VD.CurCo,u current module in use? ($02=CO32, $04=C080) |
878 L0600 rts | 883 L0600 rts |
879 L0601 bita <u0070,u module loaded? | 884 L0601 bita <u0070,u module loaded? |
880 beq L0608 branch if not | 885 beq L0608 branch if not |
881 L0606 clrb else clear carry | 886 L0606 clrb else clear carry |
882 rts and return | 887 rts and return |
892 lbra NoIOMod | 897 lbra NoIOMod |
893 L061F leax <CoEnt,u get base pointer to CO-entries | 898 L061F leax <CoEnt,u get base pointer to CO-entries |
894 lda ,s get A off stack | 899 lda ,s get A off stack |
895 sty a,x save off CO32/CO80 entry point | 900 sty a,x save off CO32/CO80 entry point |
896 puls y,x,a | 901 puls y,x,a |
897 ldb #$00 co-module init offset | 902 ldb #$00 CO-module init offset |
898 lbra CallCo call it | 903 lbra CallCO call it |
899 | 904 |
900 * Link to subroutine | 905 * Link to subroutine |
901 LinkSub pshs u | 906 LinkSub pshs u |
902 lda #Systm+Objct | 907 lda #Systm+Objct |
903 os9 F$Link | 908 os9 F$Link |
904 puls pc,u | 909 puls pc,u |
905 | 910 |
906 L0637 fdb $0055,$aaff | 911 L0637 fdb $0055,$aaff |
907 | 912 |
908 L063B cmpa #$15 GRFO-handled code? | 913 GfxDispatch |
914 cmpa #$15 GRFO-handled code? | |
909 bcc GoGrfo branch if so | 915 bcc GoGrfo branch if so |
910 cmpa #$0F display graphics code? | 916 cmpa #$0F display graphics code? |
911 beq Do0F branch if so | 917 beq Do0F branch if so |
912 suba #$10 | 918 suba #$10 |
913 bsr L065B | 919 bsr L065B check if first gfx screen was alloc'ed |
914 bcs L0663 | 920 bcs L0663 if not, return with error |
915 leax <L0651,pcr | 921 leax <gfxtbl,pcr else point to jump table |
916 lsla | 922 lsla multiply by two |
917 ldd a,x | 923 ldd a,x get address of routine |
918 jmp d,x | 924 jmp d,x jump to it |
919 | 925 |
920 L0651 fdb $0140,$00fd,$0111,$0160,$016f | 926 * Jump table for graphics codes $10-$14 |
921 | 927 gfxtbl fdb Do10-gfxtbl $10 - Preset Screen |
922 L065B ldb <u0031,u | 928 fdb Do11-gfxtbl $11 - Set Color |
929 fdb Do12-gfxtbl $12 - End Graphics | |
930 fdb Do13-gfxtbl $13 - Erase Graphics | |
931 fdb Do14-gfxtbl $14 - Home Graphics Cursor | |
932 | |
933 L065B ldb <VD.Rdy,u ready? | |
923 bne L0606 | 934 bne L0606 |
924 L0660 comb | 935 NotReady comb |
925 ldb #E$NotRdy | 936 ldb #E$NotRdy |
926 L0663 rts | 937 L0663 rts |
927 | 938 |
928 GoGrfo bsr L065B | 939 GoGrfo bsr L065B |
929 bcs L0663 | 940 bcs L0663 |
930 ldx <GRFOEnt,u get GRFO entry point | 941 ldx <VD.GRFOE,u get GRFO entry point |
931 bne L0681 branch if not zero | 942 bne L0681 branch if not zero |
932 pshs y,a else preserve regs | 943 pshs y,a else preserve regs |
933 bne L067F | 944 bne L067F |
934 leax >GRFO,pcr get pointer to name string | 945 leax >GRFO,pcr get pointer to name string |
935 bsr LinkSub link to GRFO | 946 bsr LinkSub link to GRFO |
936 bcc L067B branch if ok | 947 bcc L067B branch if ok |
937 puls pc,y,a else exit with error | 948 puls pc,y,a else exit with error |
938 L067B sty <GRFOEnt,u save module entry pointer | 949 L067B sty <VD.GRFOE,u save module entry pointer |
939 L067F puls y,a restore regs | 950 L067F puls y,a restore regs |
940 L0681 clra A = GRFO address offset in statics | 951 L0681 clra A = GRFO address offset in statics |
941 lbra CoWrite | 952 lbra CoWrite |
942 | 953 |
943 L0685 pshs u | 954 * Allocate GFX mem -- we must allocate on a 512 byte page boundary |
944 ldd #6144+256 | 955 GetMem pshs u save static pointer |
945 os9 F$SRqMem | 956 ldd #6144+256 allocate graphics memory + 1 page |
946 bcc L0691 | 957 os9 F$SRqMem do it |
947 puls pc,u | 958 bcc L0691 branch if ok |
948 L0691 tfr u,d | 959 puls pc,u else return with error |
949 puls u | 960 L0691 tfr u,d move mem ptr to D |
950 tfr a,b | 961 puls u restore statics |
951 bita #$01 | 962 tfr a,b move high 8 bits to lower |
952 beq L069F | 963 bita #$01 odd page? |
964 beq L069F branch if not | |
953 adda #$01 | 965 adda #$01 |
954 bra L06A1 | 966 bra L06A1 |
955 L069F addb #$18 | 967 L069F addb #$18 |
956 L06A1 pshs u,a | 968 L06A1 pshs u,a |
957 tfr b,a | 969 tfr b,a |
958 clrb | 970 clrb |
959 tfr d,u | 971 tfr d,u |
960 ldd #256 | 972 ldd #256 |
961 os9 F$SRtMem | 973 os9 F$SRtMem return page |
962 puls u,a | 974 puls u,a |
963 bcs L06B3 | 975 bcs L06B3 branch if error |
964 clrb | 976 clrb |
965 L06B3 rts | 977 L06B3 rts |
966 | 978 |
979 * $0F - display graphics | |
967 Do0F leax <DispGfx,pcr | 980 Do0F leax <DispGfx,pcr |
968 ldb #$02 | 981 ldb #$02 |
969 lbra L03BF | 982 lbra L03BF |
970 | 983 |
971 DispGfx ldb <u0031,u | 984 DispGfx ldb <VD.Rdy,u already allocated initial buffer? |
972 bne L06D1 | 985 bne L06D1 branch if so |
973 bsr L0685 | 986 bsr GetMem else get graphics memory |
974 bcs L06EF | 987 bcs L06EF branch if error |
975 std <u0033,u | 988 std <VD.CurBf,u save memory |
976 std <u0035,u | 989 std <VD.GBuff,u and GBuff |
977 inc <u0031,u | 990 inc <VD.Rdy,u ok, we're ready |
978 lbsr L07B1 | 991 lbsr EraseGfx clear gfx mem |
979 L06D1 lda <u0029,u | 992 L06D1 lda <VD.NChar,u |
980 sta <u004B,u | 993 sta <u004B,u |
981 anda #$03 | 994 anda #$03 |
982 leax >L0637,pcr | 995 leax >L0637,pcr |
983 lda a,x | 996 lda a,x |
984 sta <u0047,u | 997 sta <u0047,u |
985 sta <u0048,u | 998 sta <u0048,u |
986 lda <u0028,u | 999 lda <VD.NChr2,u |
987 cmpa #$01 | 1000 cmpa #$01 |
988 bls L06F0 | 1001 bls L06F0 |
989 comb | 1002 comb |
990 ldb #E$BMode | 1003 ldb #E$BMode |
991 L06EF rts | 1004 L06EF rts |
995 ldd #$C003 | 1008 ldd #$C003 |
996 std <u0049,u | 1009 std <u0049,u |
997 lda #$01 | 1010 lda #$01 |
998 sta <u0024,u | 1011 sta <u0024,u |
999 lda #$E0 | 1012 lda #$E0 |
1000 ldb <u0029,u | 1013 ldb <VD.NChar,u |
1001 andb #$08 | 1014 andb #$08 |
1002 beq L0709 | 1015 beq L0709 |
1003 lda #$F0 | 1016 lda #$F0 |
1004 L0709 ldb #$03 | 1017 L0709 ldb #$03 |
1005 leax <L0742,pcr | 1018 leax <L0742,pcr |
1015 lda #$F0 | 1028 lda #$F0 |
1016 ldb #$07 | 1029 ldb #$07 |
1017 leax <L0746,pcr | 1030 leax <L0746,pcr |
1018 L072D stb <u0044,u | 1031 L072D stb <u0044,u |
1019 stx <u0042,u | 1032 stx <u0042,u |
1020 ldb <u0029,u | 1033 ldb <VD.NChar,u |
1021 andb #$04 | 1034 andb #$04 |
1022 lslb | 1035 lslb |
1023 pshs b | 1036 pshs b |
1024 ora ,s+ | 1037 ora ,s+ |
1025 ldb #$01 | 1038 ldb #$01 |
1026 lbra L03CC | 1039 lbra L03CC |
1027 | 1040 |
1028 L0742 fcb $c0,$30,$0c,$03 | 1041 L0742 fcb $c0,$30,$0c,$03 |
1029 L0746 fcb $80,$40,$20,$10,$08,$04,$02,$01 | 1042 L0746 fcb $80,$40,$20,$10,$08,$04,$02,$01 |
1030 | 1043 |
1031 * I Think this is code | 1044 * $11 - Set Color |
1032 fcb $30,$8C,$03,$16,$fC,$69,$6f,$C8,$28 | 1045 Do11 leax <SetColor,pcr set up return address |
1033 fcb $A6,$C8,$24,$2B,$03,$6C,$C8,$28,$16 | 1046 lbra L03BD |
1034 fcb $FF,$6F,$30,$C8,$35,$10,$8E,$00,$00 | 1047 |
1035 fcb $C6,$03,$34,$44 | 1048 SetColor clr <VD.NChr2,u |
1036 | 1049 lda <u0024,u |
1050 bmi L075F | |
1051 inc <VD.NChr2,u | |
1052 L075F lbra L06D1 | |
1053 | |
1054 * End graphics | |
1055 Do12 leax <VD.GBuff,u point to first buffer | |
1056 ldy #$0000 Y = 0 | |
1057 ldb #$03 free 3 gfx screens max | |
1058 pshs u,b | |
1037 L076D ldd #6144 size of graphics screen | 1059 L076D ldd #6144 size of graphics screen |
1038 ldu ,x++ | 1060 ldu ,x++ get address of graphics screen |
1039 beq L077A | 1061 beq L077A branch if zero |
1040 sty -$02,x | 1062 sty -$02,x else clear entry |
1041 os9 F$SRtMem | 1063 os9 F$SRtMem and return memory |
1042 L077A dec ,s | 1064 L077A dec ,s decrement counter |
1043 bgt L076D | 1065 bgt L076D keep going if not end |
1044 ldu ,x | 1066 ldu ,x flood fill buffer? |
1045 beq L0788 | 1067 beq L0788 branch if not allocated |
1046 ldd #512 | 1068 ldd #512 else get size |
1047 os9 F$SRtMem | 1069 os9 F$SRtMem and free memory |
1048 L0788 puls u,b | 1070 L0788 puls u,b restore regs |
1049 clra | 1071 clra |
1050 sta <u0031,u | 1072 sta <VD.Rdy,u gfx mem no longer alloced |
1051 lbra L03CC | 1073 lbra L03CC |
1052 leax <L0797,pcr | 1074 |
1075 Do10 leax <Preset,pcr set up return address | |
1053 lbra L03BD | 1076 lbra L03BD |
1054 L0797 lda <u0029,u | 1077 |
1078 Preset lda <VD.NChar,u | |
1055 tst <u0024,u | 1079 tst <u0024,u |
1056 bpl L07A7 | 1080 bpl L07A7 |
1057 ldb #$FF | 1081 ldb #$FF |
1058 anda #$01 | 1082 anda #$01 |
1059 beq L07B1 | 1083 beq EraseGfx |
1060 bra L07B2 | 1084 bra L07B2 |
1085 | |
1061 L07A7 anda #$03 | 1086 L07A7 anda #$03 |
1062 leax >L0637,pcr | 1087 leax >L0637,pcr |
1063 ldb a,x | 1088 ldb a,x |
1064 bra L07B2 | 1089 bra L07B2 |
1065 L07B1 clrb | 1090 |
1066 L07B2 ldx <u0033,u | 1091 * Erase graphics screen |
1067 leax >6144+1,x | 1092 Do13 |
1068 L07B9 stb ,-x | 1093 EraseGfx clrb value to clear screen with |
1069 cmpx <u0033,u | 1094 L07B2 ldx <VD.CurBf,u |
1070 bhi L07B9 | 1095 leax >6144+1,x point to end of gfx mem + 1 |
1071 clra | 1096 L07B9 stb ,-x clear |
1097 cmpx <VD.CurBf,u X = to start? | |
1098 bhi L07B9 if not, continue | |
1099 * Home Graphics cursor | |
1100 Do14 clra | |
1072 clrb | 1101 clrb |
1073 std <u0045,u | 1102 std <u0045,u |
1074 rts | 1103 rts |
1075 | 1104 |
1076 * | 1105 * |