10REM (C) Edinburgh Software Products (ESP) / Graham Toal 1986 20 30IF PAGE<>&800 THEN PRINT"ERROR: Not running on 6502 2nd proc":END 40IF HIMEM<>&B800 THEN PRINT"ERROR: Not using HIBASIC":END 50 60REM Loc% is the base of where variables are allocated from. 70Loc% = &7380 80 90REM All these variable will be shuffled for optimum fit once the 100REM program has been finished & debugged. 110 120RamAddress = &2000 130 140DIM AssembleSpace (&3000-RamAddress)+&100 : REM Allow spillage for execute-once code 150 160PROCDeclarations 170 180RunAddress = RamAddress 190 FOR Pass = 4 TO 6 STEP 2 200 P% = RunAddress: O%=AssembleSpace 210 [OPT Pass 220 OPT FNtables 230 OPT FNIntRt 240 OPT FNprocs 250 OPT FNMainBody \ Change the macro for any other programme you may 260 \ wish to write using this relocation scheme... 270 OPT FNInitScr 280 OPT FNStartIntRt 290 OPT FNActive 300 OPT FNWindUp 310 OPT FNInitVars \ This code is execute-once - space is reclaimed for buffers 320 ] 330 NEXT Pass 340 OSCLI("SAVE CATTY "+STR$~(AssembleSpace)+" +"+STR$~(P%-RunAddress)+" FFFF"+STR$~(MainProg)+" FFFF"+STR$~(RunAddress)) 350END 360 370REM ######################## TELETEXT STUFF NOW ######################### 380 390DEFPROCDeclarations :REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Declarations 400 410REM Zero page workspace in utility area 420 430intzp0=&A8 440intzp1=&A9 450 460intdest0=&AA 470intdest1=&AB 480 490usrzp0=&AC 500usrzp1=&AD 510 520usrptr0=&AE 530usrptr1=&AF 540 550REM Device registers 560 570ctrlstatus = &FC10 580setrow = &FC11 590datareg = &FC12 600clrtxt = &FC13 610 620REM hardware command constants 630 640ttxtenable = &1C 650ttxtdisable = &00 660 670REM MOS vectors 680 690brkv = &202 700irq2v = &206 710osLine = &F2 : REM Mos Zero-page two-byte pointer to commandline 720 REM used as Lda &F2,Y - Y is the index to the param 730 REM - after use, may be stolen as an extra pointer! 740 750REM MOS entry points 760 770osascii = &FFE3 780oswrch = &FFEE 790osfile = &FFDD 800oscli = &FFF7 810osbyte = &FFF4 820OSRDCH = &FFE0 :REM Local routine called 'osrdch' does top/bot page stuff 830osword = &FFF1 840 850REM Working storage 860 870usrtmp = FNrmb(1) : REM General foreground temp 880inttmp = FNrmb(1) : REM General int. rt. temp 890inttmp2 = FNrmb(1) : REM General int. rt. temp 900OldBRKv = FNrmb(2) : REM For BRK interception 910 920pagno = FNrmb(3) 930pagno100 = pagno 940pagno10 = pagno+1 950pagno1 = pagno+2 960oldirq2v = FNrmb(2) 970ActiveBuff = FNrmb(1) : REM No. of buffer to be displayed or &FF if none 980TvChan = FNrmb(1) : REM Current TV channel (0..3) 990SearchBy = FNrmb(1) 1000SearchByText = 0: SearchByPage = &FF 1010ShowHeaders = FNrmb(1) : REM Display textual part of rolling headers 1020 REM <0 => Yes 1030 REM (not shown when searching by text) 1040ShowTime = FNrmb(1) : REM Display time continuously 1050 REM <0 => YES 1060 REM (not shown when HELD) 1070DoneFlag = FNrmb(1) : REM Exit when < 0 1080DispMode = FNrmb(1) : REM Top/Bottom half/normal 1090TopMode=0:BotMode=1:WholeMode=2 1100 1110LineLen = FNrmb(1) 1120RamBuff64 = FNrmb(64) : REM General command-line etc. buffer 1130SearchText = FNrmb(23) : REM search text - 0 terminated 1140rowno = FNrmb(1): magno = FNrmb(1) : REM Int. rt. variables 1150intheadbuff = FNrmb(40) : REM all headers through here 1160usrheadbuff = FNrmb(40) 1170HeadBuff = usrheadbuff+8 : REM for display 1180TimeBuff = HeadBuff+24 1190PagePresent = FNrmb(10) : REM &FF if absent, 0 if present 1200BuffSlot = FNrmb(1) : REM Where to start looking to put next arrival 1210PBuff = FNrmb(40) 1220PBuffChanged = FNrmb(1) 1230touched = FNrmb(8) : REM &FF means never any lines received on this mag 1240GrabMe = FNrmb(8) : REM Set to 0 If page has text in it - pass back 1250 1260ILLEGALCHAR = 27 : REM Not a teletext control code (in 1st char pos) 1270CONCEAL=24 1280DOUBLEHEIGHT=13 1290ENDPROC 1300 1310DEFFNrmb(N) :REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! RMB 1320Loc%=Loc%+N 1330IF Loc% > &7C00 THEN PRINT "*** Shuffle needed - no rom for data" 1340=Loc%-N 1350 1360 1370DEFFNtables :REM ************************************************** Tables 1380[OPT Pass 1390.hamtab 1400 EQUD &4101FF41 \ 1 1410 EQUD &FF4140FF 1420 EQUD &FF4142FF 1430 EQUD &47FFFF4A 1440 EQUD &FF4140FF 1450 EQUD &40FF0040 \ 0 1460 EQUD &4BFFFF46 1470 EQUD &FF4340FF 1480 EQUD &FF414CFF 1490 EQUD &47FFFF44 1500 EQUD &47FFFF46 1510 EQUD &074747FF \ 7 1520 EQUD &45FFFF46 1530 EQUD &FF4D40FF 1540 EQUD &FF464606 \ 6 1550 EQUD &47FFFF46 1560 EQUD &FF4142FF 1570 EQUD &49FFFF44 1580 EQUD &42FF0242 \ 2 1590 EQUD &FF4342FF 1600 EQUD &45FFFF48 1610 EQUD &FF4340FF 1620 EQUD &FF4342FF 1630 EQUD &4303FF43 \ 3 1640 EQUD &45FFFF44 1650 EQUD &FF444404 \ 4 1660 EQUD &FF4F42FF 1670 EQUD &47FFFF44 1680 EQUD &054545FF \ 5 1690 EQUD &45FFFF44 1700 EQUD &45FFFF46 1710 EQUD &FF434EFF 1720 EQUD &FF414CFF 1730 EQUD &49FFFF4A 1740 EQUD &4BFFFF4A 1750 EQUD &FF4A4A0A \ 10 1760 EQUD &4BFFFF48 1770 EQUD &FF4D40FF 1780 EQUD &0B4B4BFF \ 11 1790 EQUD &4BFFFF4A 1800 EQUD &4CFF0C4C \ 12 1810 EQUD &FF4D4CFF 1820 EQUD &FF4F4CFF 1830 EQUD &47FFFF4A 1840 EQUD &FF4D4CFF 1850 EQUD &4D0DFF4D \ 13 1860 EQUD &4BFFFF46 1870 EQUD &FF4D4EFF 1880 EQUD &49FFFF48 1890 EQUD &094949FF \ 9 1900 EQUD &FF4F42FF 1910 EQUD &49FFFF4A 1920 EQUD &FF484808 \ 8 1930 EQUD &49FFFF48 1940 EQUD &4BFFFF48 1950 EQUD &FF434EFF 1960 EQUD &FF4F4CFF 1970 EQUD &49FFFF44 1980 EQUD &4F0FFF4F \ 15 1990 EQUD &FF4F4EFF 2000 EQUD &45FFFF48 2010 EQUD &FF4D4EFF 2020 EQUD &FF4F4EFF 2030 EQUD &4EFF0E4E \ 14 2040 2050\ Table of buffer addresses 2060.IntBuff 2070 EQUW &3000 2080 EQUW &3000+24*40 2090 EQUW &3000+24*40*2 2100 EQUW &3000+24*40*3 2110 EQUW &3000+24*40*4 2120 EQUW &3000+24*40*5 2130 EQUW &3000+24*40*6 2140 EQUW &3000+24*40*7 2150.UsrBuff 2160 EQUW &3000+24*40*8 2170 EQUW &3000+24*40*9 2180 EQUW &3000+24*40*10 2190 EQUW &3000+24*40*11 2200 EQUW &3000+24*40*12 2210 EQUW &3000+24*40*13 2220 EQUW &3000+24*40*14 2230 EQUW &3000+24*40*15 2240 EQUW &3000+24*40*16 2250 EQUW &3000+24*40*17 2260.Times40 2270EQUW 0: EQUW 40: EQUW 80: EQUW 120 2280EQUW 160: EQUW 200: EQUW 240: EQUW 280 2290EQUW 320: EQUW 360: EQUW 400: EQUW 440 2300EQUW 480: EQUW 520: EQUW 560: EQUW 600 2310EQUW 640: EQUW 680: EQUW 720: EQUW 760 2320EQUW 800: EQUW 840: EQUW 880: EQUW 920 2330EQUW 960 \ Rows 0 - 24? 2340.PageMask EQUB 15:EQUB 15:EQUB 15:EQUB 7:EQUB 15:EQUB 3 2350 \ Page-no. widths in header... 2360.Pbuff EQUS "..1 ..2 ..3 ..4 ..5 ..6 ..7 ..8 ..9 .10" 2370] 2380=Pass 2390 2400DEFFNMainBody :REM ********************************************** MainBody 2410[OPT Pass 2420 2430.MainProg 2440 Jsr Init \ Initialise variables 2450 \ and Mode 7 display 2460 Jsr StartIntRt \ Insert interrupt routine & enable it 2470 Jsr Active \ And start running 2480 Jsr WindUp 2490 2500 Rts \ Return to caller... 2510] 2520=Pass 2530 2540DEFFNInitVars :REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! InitVars 2550[OPT Pass 2560\ 2570.Init 2580 Lda #19: Jsr osbyte 2590 PHP:SEI:Ldx #0:Ldy #&A0:.del1 Dex:Bne del1:Dey:Bne del1 2600 Lda #22:Jsr oswrch:Lda #7:Jsr oswrch:PLP 2610 Lda #&30:Sta usrzp1:Lda #0:Sta usrzp0 2620 Tay 2630.clrmem 2640 Tya:Sta (usrzp0),Y 2650 Inc usrzp0:Bne inc2:Inc usrzp1:.inc2 2660 Lda usrzp1:Cmp #&80:Bne clrmem 2670 Lda #0:Sta BuffSlot 2680 Ldy #9: Lda #&FF 2690.initBf 2700 Sta PagePresent,Y 2710 Dey 2720 Bpl initBf 2730 Ldy #39 2740.initpbf 2750 Lda Pbuff,Y 2760 Sta PBuff,Y 2770 Dey 2780 Bpl initpbf 2790 Ldy #7: Lda #&FF 2800.inittouch 2810 Sta GrabMe,Y 2820 Sta touched,Y 2830 Dey:Bpl inittouch 2840 Lda #WholeMode:Sta DispMode 2850 Lda #SearchByPage: Sta SearchBy 2860 Lda #0:Sta PBuffChanged \ Set to &FF when changed 2870 Lda #1:Sta pagno100 2880 Lda #0:Sta pagno10:Sta pagno1 \ Initially C1/P100 2890 Lda #226:Ldx #&80:Ldy #0: Jsr osbyte \ shift-soft keys normal 2900 Lda #225:Ldx #&1:Ldy #0: Jsr osbyte \ soft keys normal 2910 Lda #&FF: Sta ActiveBuff \ - no display wanted until CR typed 2920 Lda #0: Sta LineLen \ length of search text/command lines etc. 2930 Lda #0: Sta TvChan \ BBC1 we hope 2940 Lda #0: Sta DoneFlag \ <0 => Done 2950 Lda #&FF: Sta ShowHeaders \DONT 2960 Lda #&0: Sta ShowTime \ DO 2970 Lda #4:Ldx #2:Jsr osbyte \ Cursor keys soft - cursor editing causes havok! 2980 PHP:SEI \ <<<<<<<<<<<<< PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 2990 Lda irq2v: Sta oldirq2v 3000 Lda irq2v+1: Sta oldirq2v+1 3010 Lda #irq_entry MOD 256: Sta irq2v 3020 Lda #irq_entry DIV 256: Sta irq2v+1 3030 PLP \ <<<<<<<<<<<<<<<<< VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 3040 Ldx #11:Ldy #31:Jsr Vdu23 \ was 31 3050 Ldx #10:Ldy #0:Jsr Vdu23 \ Solid cursor, no blink \ was 2 3060 Jmp InitScr \Jsr + Rts 3070] 3080=Pass 3090 3100DEFFNStartIntRt :REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! StartIntRt 3110[OPT Pass 3120\ 3130.StartIntRt 3140 Lda #ttxtenable 3150 Sta ctrlstatus \ Initial channel = 0 - BBC1 3160 Rts 3170] 3180=Pass 3190 3200DEFFNActive :REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Active 3210[OPT Pass 3220 3230.ShowBuffs 3240 Ldx #0:Ldy #24:Jsr SetXY 3250 Ldx #PBuff MOD 256:Ldy #PBuff DIV 256:Lda #39 3260 Jsr OutStr 3270 \ Drop through to restore cursor 3280.SetCursor \(ActiveBuff) 3290 Lda ActiveBuff: Bmi activefrig 3300 ASL A: ASL A \ Buff number * 4 3310 \Clc:\Adc #3 - if using small cursor 3320 Bne active3 \JMP 3330.activefrig 3340 Lda #0 3350.active3 3360 PHA 3370 Lda #31:Jsr oswrch 3380 PLA: Jsr oswrch 3390 Lda #24:Jsr oswrch 3400 Lda #154:Ldx #227:Jsr osbyte \ Set large cursor in video ula! 3410 Rts 3420\ 3430.EndActive 3440 PLP \ All exits through here to clean up stack... 3450 Rts 3460 3470Jmp Active1 3480.Active 3490 PHP:CLI:CLD \ Initial entry cleaned up just in case... 3500 Jsr ShowBuffs 3510.Active1 3520 Jsr UpdateHeaders 3530 Lda PBuffChanged 3540 Bpl NoChange 3550\ Update bottom row 3560 Bit ActiveBuff:Bmi NoChange\ was LeaveDisp 3570 Inc PBuffChanged 3580 Jsr ThisPage \ Code shared with nextpage 3590.LeaveDisp 3600 Jsr ShowBuffs 3610.NoChange 3620 Jsr CheckKeys 3630 Bit DoneFlag: Bmi EndActive 3640 Bit &FF 3650 Bpl Active1 3660 Lda #126: Jsr osbyte 3670 Jsr BothHalves \ In case of confusion when entering text 3680 Clc:Bcc Active1 \JMP 3690 3700.chan 3710 Txa:Sec:Sbc #129 3720 Sta TvChan 3730 Clc:Adc #ASC("1"):Pha 3740 Lda #31:Jsr oswrch 3750 Lda #1:Jsr oswrch 3760 Lda #0:Jsr oswrch 3770 Pla:Jsr oswrch 3780 Jsr SetCursor 3790 Lda #ttxtenable 3800 Ora TvChan 3810 Sta ctrlstatus 3820 Rts 3830 3840.PageESC 3850 Ldx #4:Ldy #0: Jsr SetXY 3860 Lda pagno100:Clc:Adc #ASC("0"): Jsr oswrch 3870 Lda pagno10:Clc:Adc #ASC("0"): Jsr oswrch 3880 Lda pagno1:Clc:Adc #ASC("0"): Jsr oswrch 3890 Jsr SetCursor 3900 Rts 3910 3920.GoTochan2 Beq chan 3930.GoToPageESC Bcs PageESC 3940 3950.SetPage 3960 Lda DispMode:Cmp #BotMode:Bne noflip1:Jsr BothHalves:.noflip1 3970 Lda ActiveBuff:Bpl setp1 3980 Lda #0:Sta ActiveBuff 3990.setp1 4000 Lda #SearchByPage: Sta SearchBy 4010PHP:SEI \<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 4020 Lda ActiveBuff:Sta BuffSlot 4030 Ldy #9:LDA #&FF 4040.makeroom2 4050 Sta PagePresent,Y 4060 Dey:Bpl makeroom2 4070PLP\<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 4080 Lda #0:Sta ShowHeaders \ Headers on 4090 Lda #31: Jsr oswrch 4100 Lda #4: Jsr oswrch 4110 Lda #0: Jsr oswrch 4120.badnum1 4130 Jsr osrdch 4140 Bcs PageESC 4150 Cmp #ASC("0"):Bcc badnum1 4160 Cmp #ASC("9")+1:Bcs badnum1 4170 Jsr oswrch 4180 Sec:Sbc #ASC("0"):Sta pagno100 4190.badnum2 4200 Jsr osrdch 4210 Bcc ppp1:Jmp PageESC:.ppp1 4220 Cmp #ASC("0"):Bcc badnum2 4230 Cmp #ASC("9")+1:Bcs badnum2 4240 Jsr oswrch 4250 Sec:Sbc #ASC("0"):Sta pagno10 4260 Clc:Bcc badnum3 \JMP 4270.GoTochan Beq GoTochan2 4280.badnum3 4290 Jsr osrdch 4300 Bcs GoToPageESC 4310 Cmp #ASC("0"):Bcc badnum3 4320 Cmp #ASC("9")+1:Bcs badnum3 4330 Jsr oswrch 4340 Sec:Sbc #ASC("0"):Sta pagno1 4350 Jsr SetCursor 4360PHP:SEI \<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 4370 Lda ActiveBuff:Sta BuffSlot 4380 Ldy #9:LDA #&FF 4390.makeroom 4400 Sta PagePresent,Y 4410Dey:Bpl makeroom 4420PLP\<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 4430 Rts 4440 4450.GoToSetPage Jmp SetPage 4460 4470.CheckKeys1 4480 Rts 4490.CheckKeys3 4500 Cpy #&1B:Beq CheckKeys1 4510 Rts 4520.CheckKeys 4530 Jsr inkey: Cpy #0: Bne CheckKeys3 4540 Cpx #13: Bne CheckKeys2 4550 Jsr NextBuffer 4560 Jsr SetCursor \(ActiveBuff) 4570 Rts 4580 4590.WindUp 4600 Dec DoneFlag 4610 Rts 4620 4630.CheckKeys2 4640 \ ... *key 11 |!|? 4650 Cpx #255:Bne notfrig2:Jsr frigpage:.notfrig2 4660 Cpx #128: Beq GoToSetPage 4670 Cpx #129:Beq GoTochan 4680 Cpx #130:Beq GoTochan 4690 Cpx #131:Beq GoTochan 4700 Cpx #132:Beq GoTochan 4710 Cpx #136: Beq GoToFakePage1 4720 Cpx #137:Beq WindUp 4730 Cpx #&8C:Beq goleft 4740 Cpx #&8D:Beq goright 4750 Cpx #32: Bcc checkkeys3 4760 Cpx #127: Bcs checkkeys3 4770 Jsr ReadCommand 4780.checkkeys3 4790 Rts 4800 4810.goleft 4820 Jmp leftcode 4830.goright 4840 Jmp rightcode 4850 4860.GoToFakePage1 Beq GoToFakePage 4870.frigpage 4880 \Lda ActiveBuff:\Bpl fp01:\Lda #0:\Sta ActiveBuff 4890\.fp01 Commented out to stop loosing help page! 4900 \ Tweak cheat buffer to put appropriate page in correct space 4910 Lda BuffSlot:Asl A:Tay 4920 Lda UsrBuff,Y:Sta usrzp0 4930 Iny:Lda UsrBuff,Y:Sta usrzp1 4940 Jsr PatchHex 4950 Lda BuffSlot 4960 Clc:Adc #ASC("0"):Sta cheatno 4970 Ldx #cheat MOD 256:Ldy #cheat DIV 256 4980 Jsr SafeOscli 4990 Lda #&FF: Sta PBuffChanged 5000 Ldy BuffSlot: Lda #0:Sta PagePresent,Y 5010 Lda BuffSlot:Asl A:Asl A:Tay 5020 Lda #ASC("1"):Sta PBuff,Y 5030 Lda #ASC("0"):Iny:Sta PBuff,Y 5040 Lda BuffSlot:Clc:Adc #ASC("0"):Iny:Sta PBuff,Y 5050 Lda BuffSlot:Clc:Adc #1:Sta BuffSlot 5060 Lda BuffSlot:Cmp #10:Bne fp02:Lda #0:Sta BuffSlot:.fp02 5070 Rts 5080 5090.GoToFakePage Beq FakePage 5100.cheat EQUS "LOAD P10" 5110.cheatno EQUS "0" 5120 EQUS " FFFF" 5130.HexAddr EQUS "4E00" \ buff0, assuming 25 rows/buff 5140 EQUB 13 5150.endCheat 5160 5170.PatchHex \ usrzp0,1 => HexAddr as ascii 5180 Lda #HexAddr MOD 256:Sta usrptr0 5190 Lda #HexAddr DIV 256:Sta usrptr1 5200 Ldy #0 5210 Lda usrzp1 \ High 5220 Jsr tohex \ High => A, low => X 5230 Sta (usrptr0),Y: Iny:Txa:Sta (usrptr0),Y:Iny 5240 Lda usrzp0 \ Low 5250 Jsr tohex \ High => A, low => X 5260 Sta (usrptr0),Y: Iny:Txa:Sta (usrptr0),Y 5270 Rts 5280 5290.tohex \ A => a.x 5300 Pha 5310 Jsr hexnib 5320 Tax 5330 Pla 5340 Ror A:Ror A:Ror A:Ror A 5350.hexnib 5360 And #15 5370 Clc:Adc #ASC("0") 5380 Cmp #ASC("9")+1 5390 Bcc nofrig4 5400 Adc #6 5410.nofrig4 5420 Rts 5430 5440.FakePage 5450 Ldx #LdPage MOD 256:Ldy #LdPage DIV 256: Jsr SafeOscli 5460 Lda #&FF:Sta ActiveBuff \ Stop receiving during help info 5470 Rts 5480 5490.GetScrAddr 5500 Lda #&A0 5510 Ldx #&50 5520 Jsr osbyte 5530 Stx usrzp0 5540 Sty usrzp1 5550 Rts 5560 5570 5580.TopHalf 5590 Lda #TopMode:Sta DispMode 5600 Jsr GetScrAddr \ to usrzp0,1 5610 Lda usrzp1:Sec:Sbc #&74:Eor #&20:Sta usrzp1 5620 Lda #12:Sta usrtmp 5630 Clc:Bcc Set6845 \JMP 5640.BotHalf 5650 Lda #BotMode:Sta DispMode 5660 Jsr GetScrAddr \ to usrzp0,1 5670 Lda usrzp1:Sec:Sbc #&74:Eor #&20:Sta usrzp1 5680 Lda usrzp0:Clc:Adc #(12*40) MOD 256:Sta usrzp0 5690 Lda usrzp1:Adc #(12*40) DIV 256:Sta usrzp1 5700 Lda #13:Sta usrtmp 5710 5720.Set6845 5730 Ldx #12:Ldy usrzp1: Jsr Vdu23 5740 Ldx #13:Ldy usrzp0: Jsr Vdu23 5750 Lda #19:Jsr osbyte 5760 PHP:SEI \ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 5770 Ldx #5: Ldy #8: Jsr Vdu23 5780 Ldx #6: Ldy usrtmp: Jsr Vdu23 5790 Ldx #4: Ldy usrtmp: Iny: Jsr Vdu23 5800 Ldx #0: Ldy #127: Jsr Vdu23 5810 Ldx #7: Ldy usrtmp: Jsr Vdu23 5820 PLP \ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 5830 Rts 5840 5850.BothHalves 5860 Lda #WholeMode:Sta DispMode 5870 Jsr GetScrAddr \ to usrzp0,1 5880 Lda usrzp1:Sec:Sbc #&74:Eor #&20:Sta usrzp1 5890 Ldx #12:Ldy usrzp1: Jsr Vdu23 5900 Ldx #13:Ldy usrzp0: Jsr Vdu23 5910 Lda #19:Jsr osbyte 5920 PHP:SEI \ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 5930 Ldx #5: Ldy #0: Jsr Vdu23 5940 Ldx #6: Ldy #25: Jsr Vdu23 5950 Ldx #4: Ldy #30: Jsr Vdu23 5960 Ldx #0: Ldy #63: Jsr Vdu23 5970 Ldx #7: Ldy #27: Jsr Vdu23 5980 PLP \ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 5990 Rts 6000 6010.Vdu23 6020 Lda #23:Jsr oswrch 6030 Lda #0:Jsr oswrch 6040 Txa:Jsr oswrch 6050 Tya:Jsr oswrch 6060 Lda #0:Jsr oswrch 6070Jsr oswrch:Jsr oswrch:Jsr oswrch:Jsr oswrch:Jsr oswrch 6080 Rts 6090 6100.RdlineCAN 6110.RdlineESC 6120 Jsr ShowBuffs 6130 Rts 6140 6150.RdlineNoRoom 6160 Lda #7: Jsr oswrch 6170 Clc:Bcc RdlineIgnore \JMP 6180 6190.RdlineDEL 6200 \ Dec pointer 6210 \ if not 0 & echo 6220 Lda LineLen:Cmp #0:Beq RdlineCAN 6230 Lda #127 6240 Jsr oswrch 6250 \ If 0, return & cancel 6260 Dec LineLen 6270 Clc:Bcc RdlineIgnore \JMP 6280 6290.ReadCommand 6300 Txa:Pha 6310 Lda #0:Sta LineLen 6320 Jsr ClrCline 6330 Ldx #TextMess MOD 256:Ldy #TextMess DIV 256 6340 Lda #endTextMess-TextMess 6350 Jsr OutStr 6360 Pla:Jsr oswrch 6370 Pha:Lda DispMode:Cmp #TopMode:Bne noflip2:Jsr BothHalves:.noflip2 :Pla 6380.readcommand1 6390 \ Store A in array 6400 Ldy LineLen: Sta RamBuff64,Y 6410 Inc LineLen 6420.RdlineIgnore 6430 Jsr osrdch 6440 Bcs RdlineESC 6450 Cmp #13:Beq GotIt 6460 Cmp #127:Beq RdlineDEL 6470 Cmp #ASC("U") AND 31:Beq RdlineCAN 6480 Cmp #32:Bcc RdlineIgnore 6490 Cmp #128:Bcs RdlineIgnore 6500 Ldy LineLen 6510 Cpy #23: Beq RdlineNoRoom \WAS 22 but now Cn:\Pnnn 6520 \ Leave a space on either side 6530 \ Save in line & inc pointer 6540 jsr oswrch 6550 Clc:Bcc readcommand1 \JMP 6560.GotIt 6570 \ Save & echo in top line 6580 Jsr SetSearchText 6590PHP:SEI \<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 6600 Lda ActiveBuff:Sta BuffSlot 6610 Ldy #9:LDA #&FF 6620.makeroom3 6630 Sta PagePresent,Y 6640 Dey:Bpl makeroom3 6650PLP\<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 6660 Jsr ShowBuffs 6670 Rts 6680 6690.SetSearchText 6700 \ LineLen + RamBuff64 => SearchText 6710 Ldy LineLen 6720 Lda LineLen 6730 Bne notRdlineCAN:Jmp RdlineCAN:.notRdlineCAN \ Don't allow 6740 Lda #0:Sta SearchText,Y:Dey 6750.stloop 6760 Lda RamBuff64,Y 6770 Sta SearchText,Y 6780 Dey 6790 Bpl stloop 6800 \ Now display 6810 Ldx #WipeHdr MOD 256:Ldy #WipeHdr DIV 256 6820 Lda #endWipeHdr-WipeHdr 6830 Jsr OutStr 6840 Ldx #1:Ldy #0:Jsr SetXY 6850 Lda TvChan:SEC:Adc #ASC("0") 6860 Jsr oswrch 6870 Lda #23 \Was 22 - is this now correct? 6880 Sec:Sbc LineLen 6890 Clc: Ror A 6900 PHA 6910 Ldy #0:Ldx #7: Jsr SetXY \ Place in last char of Ch/Page. 6920 Lda #130:Jsr oswrch \ Green for search text 6930 PLA 6940 Tay 6950 Lda #32 6960.padlp 6970 Cpy #0:Beq enoughpad 6980 Jsr oswrch 6990 Dey 7000 Clc:Bcc padlp \JMP 7010.enoughpad 7020 Ldy #0 7030.stlp2 7040 Lda SearchText,Y 7050 Jsr oswrch 7060 Iny 7070 Cpy LineLen 7080 Bne stlp2 7090 Lda #135:Jsr oswrch \ White again 7100 Lda #&FF:Sta ShowHeaders \ DONT! 7110 Lda #SearchByText: Sta SearchBy 7120 Lda ActiveBuff:Bpl stext1 7130 Lda #&FF:Sta ActiveBuff \ or not as the field trial will show... 7140.stext1 7150 Rts 7160 7170.WipeHdr 7180 EQUB 31:EQUB 0:EQUB 0 7190 EQUS "C.:P...":EQUB &82 \ Alpha green 7200 EQUS " " 7210.endWipeHdr 7220 7230.TextMess EQUS "Keyword:":EQUB &82 \ Alpha green 7240.endTextMess 7250 7260.DoTopHalf 7270 Jsr TopHalf 7280 Clc:Bcc osrdch \JMP 7290.DoBotHalf 7300 Jsr BotHalf 7310 Clc:Bcc osrdch \JMP 7320.DoBothHalves 7330 Jsr BothHalves 7340 \\\\\Jmp osrdch DROP THROUGH 7350 7360.osrdch 7370 Lda #154:Ldx #75:Jsr osbyte \ restore cursor size when reading! 7380 Jsr OSRDCH:Php:Tax:Pla:Sta usrtmp 7390 Cpx #133:Beq DoTopHalf 7400 Cpx #134:Beq DoBotHalf 7410 Cpx #135:Beq DoBothHalves 7420 Lda usrtmp:Pha:Plp:Txa 7430 Rts 7440 7450.DoTopHalf2 7460 Jsr TopHalf 7470 Clc:Bcc inkey \JMP 7480.DoBotHalf2 7490 Jsr BotHalf 7500 Clc:Bcc inkey \JMP 7510.DoBothHalves2 7520 Jsr BothHalves 7530 Clc:Bcc inkey \JMP 7540.inkey 7550 Lda #&81: Ldx #0: Ldy #0: Jsr osbyte \ Y => OK? 7560 Cpx #133:Beq DoTopHalf2 7570 Cpx #134:Beq DoBotHalf2 7580 Cpx #135:Beq DoBothHalves2 7590 Rts 7600.DoHead 7610 Lda #19:Jsr osbyte 7620 Jsr CurseOff 7630 Lda #31:Jsr oswrch 7640 Lda #8:Jsr oswrch 7650 Lda #0:Jsr oswrch 7660 Lda #HeadBuff MOD 256:Sta usrptr0 7670 Lda #HeadBuff DIV 256:Sta usrptr1 7680 Ldx #24 7690 Jmp ShowEither 7700 7710.DoTime 7720 Lda #19:Jsr osbyte 7730 Jsr CurseOff 7740 Lda #31:Jsr oswrch 7750 Lda #32:Jsr oswrch 7760 Lda #0:Jsr oswrch 7770 Lda #TimeBuff MOD 256:Sta usrptr0 7780 Lda #TimeBuff DIV 256:Sta usrptr1 7790 Ldx #8 7800.ShowEither 7810 Ldy #0 7820.timlp 7830 Lda (usrptr0),Y 7840 Ora #128 \ Force teletext char set - no control chars 7850 Jsr oswrch 7860 Iny 7870 Dex 7880 Bne timlp 7890 Jsr SetCursor:Jsr CurseOn 7900 Rts 7910 7920.DoHead2 Jsr DoHead: Jmp UH2 7930.DoTime2 Jsr DoTime: Jmp UH3 7940 7950.UpdateHeaders 7960 Bit ShowHeaders 7970 Bpl DoHead2 7980.UH2 7990 Bit ShowTime 8000 Bpl DoTime2 8010.UH3 8020 Rts 8030 8040.CurseOff 8050 Lda #0:Pha 8060 Clc:Bcc Curse \JMP 8070.CurseOn 8080 Lda #1:Pha 8090.Curse 8100 Lda #23:Jsr oswrch 8110 Lda #1:Jsr oswrch 8120 Pla:Jsr oswrch 8130 Lda #0 8140 Jsr oswrch:Jsr oswrch:Jsr oswrch:Jsr oswrch:Jsr oswrch:Jsr oswrch:Jsr oswrch 8150 Rts 8160 8170.leftcode 8180 Dec ActiveBuff 8190 Bpl kdhfkfh:Lda #9:Sta ActiveBuff:.kdhfkfh 8200 Jmp ThisPage 8210.rightcode 8220 Inc ActiveBuff 8230 Cmp #10:Bne skjgfkg:Lda #0:Sta ActiveBuff:.skjgfkg 8240 Jmp ThisPage 8250 8260.ThisPage 8270 Dec ActiveBuff 8280\ And drop through REALLY SNEAKILY! 8290Jmp DisplayBuff 8300.NextBuffer 8310 Ldy ActiveBuff \ Free page last looked at for update 8320 Bmi DisplayBuff 8330 Lda #&FF:Sta PagePresent,Y 8340.DisplayBuff 8350 Jsr CurseOff 8360\ Jsr BothHalves Possibly better without this? 8370 Lda ActiveBuff 8380 Bpl NextB1 8390 Lda #0: Sta ActiveBuff \ Allow display if present 8400 Lda SearchBy: Cmp #SearchByPage:Bne NextB2 8410 Lda #0: Sta ShowHeaders 8420.NextB2 8430 Clc:Bcc NextB4 8440.NextB1 8450 Lda ActiveBuff:Clc:Adc #1:Sta ActiveBuff 8460 Lda ActiveBuff:Cmp #10:Bne NextB3:Lda #0:Sta ActiveBuff:.NextB3 8470.NextB4 8480\ display ActiveBuff - even if empty! 8490\**** Should pick up Channel No. and Page no. from page buffer 8500\ Via (usrzp0),Y 8510 Lda SearchBy:Cmp #SearchByPage:Beq noputnr 8520 Ldx #4:Ldy #0:Jsr SetXY 8530 Lda ActiveBuff:Asl A:Asl A:Tay 8540 Lda PBuff,Y: Jsr oswrch 8550 Iny:Lda PBuff,Y: Jsr oswrch 8560 Iny:Lda PBuff,Y: Jsr oswrch 8570.noputnr 8580 Ldx #0:Ldy #1:Jsr SetXY 8590 Lda ActiveBuff:Asl A 8600 Tay:Lda UsrBuff,Y:Sta usrptr0 8610 Iny:Lda UsrBuff,Y:Sta usrptr1 8620 Lda usrptr0:Clc:Adc #40:Sta usrptr0 8630 Lda usrptr1:Adc #0:Sta usrptr1 \ index to first data row 8640 Ldx #23 8650.Vert 8660 Ldy #0 8670.chkh2 8680 Lda (usrptr0),Y:Cmp #DOUBLEHEIGHT:Beq duplic8 8690 Iny: Cpy #40:Bne chkh2 8700 Jmp noh2 8710.duplic8 8720 Ldy #0 8730.duploop 8740 Lda (usrptr0),Y 8750 Cmp #DOUBLEHEIGHT:Bne nosilly 8760 Eor #128 8770.nosilly 8780 PHA 8790 Tya:Clc:Adc #40:Tay 8800 PLA 8810 Sta (usrptr0),Y \ DAMN! Follow through error! 8820 Tya:Sec:Sbc #40:Tay 8830 Iny:Cpy #40:Bne duploop 8840.noh2 8850 Ldy #0 8860 Lda (usrptr0),Y:Cmp #ILLEGALCHAR:Bne Horiz 8870 Ldy #39:Lda #32:.jkhkj Sta (usrptr0),Y:Dey:Bne jkhkj 8880.Horiz 8890 Lda (usrptr0),Y 8900 And #127:Cmp #CONCEAL:Bne jhkjh:Lda #32:.jhkjh 8910 Ora #&80:Jsr oswrch 8920 Iny:Cpy #40:Bne Horiz 8930 Lda usrptr0:Clc:Adc #40:Sta usrptr0 8940 Lda usrptr1:Adc #0:Sta usrptr1 8950 Dex:Bne Vert 8960 Jsr CurseOn 8970 Rts 8980 8990.LdPage \ This shouldn't really be in ROM... 9000EQUS "*LOAD CATHELP FFFF7C28":EQUB 13 9010] 9020=Pass 9030 9040DEFFNWindUp :REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WindUp 9050[OPT Pass 9060.WindUp 9070 Lda #ttxtdisable 9080 Sta ctrlstatus 9090 PHP:SEI \ <<<<<<<<<<<<<<<< PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP 9100 Lda oldirq2v: Sta irq2v 9110 Lda oldirq2v+1: Sta irq2v+1 9120 PLP \ <<<<<<<<<<<<<<<<<<<< VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 9130 Jsr BothHalves 9140 Ldx #10:Ldy #&72:Jsr Vdu23 \ cursor 18-19 small blinking 9150 Ldx #11:Ldy #19:Jsr Vdu23 9160 Ldx #termMess MOD 256:Ldy #termMess DIV 256:Lda #endtermMess-termMess 9170 Jsr OutStr 9180 Jsr ClrCline 9190 Lda #4:Ldx #0:Jsr osbyte 9200 Lda #154:Ldx #75:Jsr osbyte 9210 Rts 9220 9230.termMess 9240 EQUB 31: EQUB 32:EQUB 0 9250 EQUS " Exited" 9260 EQUB 31: EQUB 0:EQUB 24 9270.endtermMess 9280] 9290=Pass 9300 9310DEFFNIntRt :REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IntRt 9320[OPT Pass 9330.irq_entry 9340PHP 9350 Bit ctrlstatus 9360 Bmi ourint 9370PLP 9380 Jmp (oldirq2v) 9390.ourint 9400 Pha:Lda &FC:Pha:Txa:Pha:Tya:Pha 9410 Jsr HandleInt 9420 Sta clrtxt 9430 Pla:Tay:Pla:Tax:Pla:Sta &FC:Pla 9440PLP 9450rti\JMP (oldirq2v) \ Can RTI if our int ? 9460] 9470=Pass 9480 9490DEFFNInitScr : REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! InitScr 9500[OPT Pass 9510.InitScr 9520 Ldx #initMess MOD 256: Ldy #initMess DIV 256: Lda #endinitMess-initMess 9530 Jsr OutStr 9540 Ldx #initMess2 MOD 256: Ldy #initMess2 DIV 256: Lda #endinitMess2-initMess2 9550 Jsr OutStr 9560 Ldx #initMess3 MOD 256: Ldy #initMess3 DIV 256: Lda #endinitMess3-initMess3 9570 Jsr OutStr 9580 Rts 9590.initMess 9600 EQUB ASC("Z") AND 31 \ Reset & Home 9610 EQUS "C1:P100":EQUB 130 \ Green 9620 EQUB 31: EQUB 8: EQUB 0 9630 EQUS " Press RETURN to begin ":EQUB 135 \White:EQUS "(C) Toal" 9640 EQUB 31: EQUB 2: EQUB 2 9650 EQUS "Shift-F0 Find page by number" 9660 EQUB 31: EQUB 2: EQUB 3 9670 EQUS "Any text Search for page by keyword" 9680 EQUB 31: EQUB 2: EQUB 5 9690 EQUS "Shift-F1 Select channel 1" 9700 EQUB 31: EQUB 2: EQUB 6 9710 EQUS "Shift-F2 Select channel 2" 9720 EQUB 31: EQUB 2: EQUB 7 9730 EQUS "Shift-F3 Select channel 3" 9740 EQUB 31: EQUB 2: EQUB 8 9750 EQUS "Shift-F4 Select channel 4" 9760.endinitMess 9770.initMess2 9780 EQUB 31: EQUB 2: EQUB 13 9790 EQUS "Shift-F5 View UPPER half of page" 9800 EQUB 31: EQUB 2: EQUB 10 9810 EQUS "Shift-F6 View LOWER half of page" 9820 EQUB 31: EQUB 2: EQUB 14 9830 EQUS "Shift-F7 View full page" 9840 EQUB 31: EQUB 2: EQUB 11 9850 EQUS "Shift-F7 View full page" 9860 EQUB 31: EQUB 2: EQUB 16 9870 EQUS "Shift-F8 Load HELP screen" 9880 EQUB 31: EQUB 2: EQUB 17 9890 EQUS "Shift-F9 Exit" 9900.endinitMess2 9910.initMess3 9920 EQUB 31: EQUB 2:EQUB 19 9930EQUS "Type a keyword, then " 9940 EQUB 31: EQUB 2:EQUB 20 9950EQUS "or press SHIFT-F0 and 3 digits" 9960 EQUB 31: EQUB 0:EQUB 22 9970 EQUB 131:EQUS "(Press RETURN to search for more pages" 9980 EQUB 31: EQUB 0:EQUB 23 9990 EQUB 131:EQUS " as pages are held when displayed)" 10000.clrTxt 10010 EQUB 31: EQUB 0:EQUB 24 10020 EQUS " " 10030 EQUB 31: EQUB 0:EQUB 24 10040.endclrTxt \ Note double usage of string above! 10050.endinitMess3 10060] 10070=Pass 10080 10090DEFFNprocs :REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! procs 10100[OPT Pass 10110.OutStr2 10120 Rts 10130.OutStr \ X,Y => String; A => length 10140 Stx usrzp0:Sty usrzp1:Tax:Ldy #0 10150.OutStr1 10160 Cpx #0:Beq OutStr2 10170 Lda (usrzp0),Y 10180 Jsr oswrch 10190 Dex:Iny 10200 Bne OutStr1 10210 10220.ClrCline 10230 Ldx #clrTxt MOD 256: Ldy #clrTxt DIV 256: Lda #endclrTxt-clrTxt 10240 Jsr OutStr 10250 Rts 10260 10270.SetXY 10280 PHA 10290 Lda #31:Jsr oswrch 10300 Txa:Jsr oswrch 10310 Tya:Jsr oswrch 10320 PLA 10330 Rts 10340 10350.SafeOscli 10360 Txa 10370 Tsx:Stx usrtmp 10380 Tax 10390 \ Intercept BRK to point to RetOscli 10400 Lda brkv:Sta OldBRKv 10410 Lda brkv+1:Sta OldBRKv+1 10420 Lda #RetOsc MOD 256:Sta brkv 10430 Lda #RetOsc DIV 256:Sta brkv+1 10440 Jsr oscli 10450.RetOsc 10460 Ldx usrtmp:Txs 10470 \ Resore BRK vector 10480 Lda OldBRKv: Sta brkv 10490 Lda OldBRKv+1: Sta brkv+1 10500 Rts 10510 10520.transfer40 \ from hardware to (intdest0) 10530 Ldy #0 10540.read40 10550 Lda datareg 10560 Sta (intdest0),Y 10570 Iny 10580 Cpy #40 10590 Bne read40 10600 Rts 10610 10620.HandleInt 10630 Lda #0 10640 Sta setrow 10650 Tay 10660.readttxt 10670 Sty setrow 10680 Lda datareg 10690 Beq norow 10700 Lda #0 10710 Sty setrow 10720 Sta datareg 10730 Tya:Pha 10740 Jsr readrow 10750 Pla:Tay 10760.norow 10770 Iny 10780 Cpy #16 10790 Bne readttxt 10800 Rts 10810.readrow 10820 Lda datareg \ Mag 10830 Tay:Lda hamtab,Y 10840 Bmi badhamm 10850 And #15 10860 Sta magno 10870 Lda datareg 10880 Tay: Lda hamtab,Y 10890 Bmi badhamm 10900 And #15 10910 Sta rowno 10920 Lda magno 10930 Cmp #8 10940 Rol rowno 10950 And #7 10960 Sta magno 10970\ Select destination 10980 Lda rowno 10990 Cmp #0 11000 Bne nothdr 11010\ Hdr 11020 Lda #intheadbuff MOD 256:Sta intdest0 11030 Lda #intheadbuff DIV 256:Sta intdest1 11040 Jsr transfer40 11050 Jsr HandleHeader 11060.badhamm \ Place this lable before any RTS 11070.unwanted \ before an RTS 11080 Rts 11090.nothdr 11100 Cmp #24:Bcs unwanted 11110 Lda magno:Asl A:Tay 11120 Lda IntBuff,Y:Sta intdest0 11130 Iny:Lda IntBuff,Y:Sta intdest1 \ (intdest),0 => Row 0 for page 11140 \ Add row offset (rowno * 40) 11150 Lda rowno:Asl A:Tay 11160 Lda Times40,Y:Clc:Adc intdest0:Sta intdest0 11170 Iny:Lda Times40,Y:Adc intdest1:Sta intdest1 11180 Jsr transfer40 11190 Jsr TEXTCHECK 11200 Rts 11210 11220.HandleHeader \ header is in intheadbuff. 11230 \ but first - copy to display 11240 Lda intheadbuff+6:Tay:Lda hamtab,Y:And #15 11250 Lsr A:Bcs nohddisp \ no display 11260 Lsr A:Lsr A:Bcs nohddisp \ out-of-seq 11270 Lda intheadbuff+7:Tay:Lda hamtab,Y:And #15 11280 Lsr A:Bcs hddisp \ but serial 11290 Lda magno:Cmp pagno100:Bne nohddisp \ not serial - but mag matches 11300.hddisp 11310 Ldy #39 11320.hdcp 11330 Lda intheadbuff,Y 11340 Sta usrheadbuff,Y 11350 Dey 11360 Bpl hdcp 11370.nohddisp 11380 \ Header arrival means 11390 \ 1) Terminate current page if page started. 11400 \ 2) Init nbew page - wipe all rows to 0's 11410 \ 3) If page number asked for, ou rext found, forward the page to user. 11420 \ 4) If first header ever on this mag, allow the above to happen... 11430 \ Array Touched[0..7] must be init to &FF 11440 \ at start-up & channel change ******* 11450 Lda magno:Asl A:Tay 11460 Lda IntBuff,Y:Sta intdest0 11470 Iny:Lda IntBuff,Y:Sta intdest1 \ Set up ptr to header of this mag 11480 Ldy magno:Lda touched,Y 11490 Bpl NotFirstHeader:Jmp FirstHeader:.NotFirstHeader 11500 \ If on second or subsequent page, check for page termination 11510\ Compare intheadbuff to (intdest) 11520\ If same, return, else... 11530 Ldy #0 11540.testnexthdr \ **** Should ignore control bits etc.!!! 11550 \ Check next byte of header 11560 Lda intheadbuff,Y:Tax 11570 Lda hamtab,X 11580 Bpl NoHdrErr 11590\ hamm error on header - kill this mag. 11600.TEMPKILL \ debug code label 11610Ldy magno:Lda #&FF:Sta touched,Y:Sta GrabMe,Y 11620Rts 11630.NoHdrErr 11640 And PageMask,Y:Sta intzp0 11650 Lda (intdest0),Y:Tax 11660 Lda hamtab,X 11670 And PageMask,Y:Cmp intzp0 11680 Bne NewPageIn 11690 Iny 11700 Cpy #6:Bne testnexthdr 11710 \ Headers are same - so return 11720 Rts 11730 .NewPageIn 11740\ Terminate page at intheadbuff 11750\ and send if marked. 11760 11770\ Return page if contained text 11780 Lda SearchBy:Cmp #SearchByText:Bne TryByNo 11790 Ldy magno:Lda GrabMe,Y:Bne TryByNo 11800 Lda #&FF:Sta GrabMe,Y 11810 Jmp takeit 11820.TryByNo 11830 11840 Lda SearchBy:Cmp #SearchByPage:Bne TEMPKILL 11850Lda magno:Cmp pagno100:Bne TEMPKILL 11860Ldy #1:Lda (intdest0),Y:Tax:Lda hamtab,X:And #15 11870Cmp pagno10:Bne TEMPKILL 11880 Ldy #0:Lda (intdest0),Y:Tax:Lda hamtab,X:And #15 11890 Cmp pagno1:Bne TEMPKILL 11900.takeit 11910 Jsr TransferBuff 11920 \ Although it would seem sensible to drop through, you MUSt not... 11930Lda magno:Tay:Lda #&FF:Sta touched,Y 11940Rts 11950 11960\ Now initialise the new page 11970.FirstHeader 11980 Ldy magno:Lda #0:Sta touched,Y 11990\ Store intheadbuff at intdest. 12000 Ldy #0 12010.initpghdr 12020 Lda intheadbuff,Y 12030 Sta (intdest0),Y 12040 Iny 12050 Cpy #40: Bne initpghdr 12060\ Wipe 1st char of each row to 12070 Ldx #23 \ 23 data rows not counting the header 12080 Ldy #0 \ through-out loop below 12090.wiperows 12100 Lda intdest0:Clc:Adc #40:Sta intdest0 12110 Lda intdest1:Adc #0:Sta intdest1 12120 Lda #ILLEGALCHAR:Sta (intdest0),Y 12130 Dex:Bne wiperows 12140 12150 12160 12170 Rts 12180 12190.TransferBuff \ intdest0 -> page buff on entry 12200 12210 \ Jmp to ThisllDo with y=buffer no. if page already in a buffer 12220\ X = usr-slot no. Loop from 0 to 9 12230 Ldx #0 12240.FindUsrBloop 12250 \ Intdest0 => this header, so intzp0 => usrhdr 12260 Txa:PHA:Asl A:Tax \<<<<<<<<<<<<<<<<<<<<<<<<<<< 12270 Lda UsrBuff,X:Sta intzp0 12280 Inx:Lda UsrBuff,X:Sta intzp1 12290 PLA:TAX:Ldy #0 \>>>>>>>>>>>>>>>>>>>>>>>>>>> 12300\debug 12310Cpx #0:Bne dontrecord\debug 12320.kjhge Lda (intzp0),Y:Sta &70,Y 12330Lda (intdest0),Y:Sta &78,Y 12340Iny:Cpy #8:Bne kjhge 12350.dontrecord 12360Ldy #0 12370 \ NOTE also doesn't check mag. no - stick in somewhere? 12380Lda intzp0:Sta &80:Lda intzp1:Sta &81 12390Lda intdest0:Sta &82:Lda intdest1:Sta &83 12400.comparelp 12410 TXA:PHA \<<<<<<<<<<<<<<<< 12420 Lda (intzp0),Y:Tax:Lda hamtab,X:And PageMask,Y:Sta inttmp 12430 Lda (intdest0),Y:Tax:Lda hamtab,X:And PageMask,Y:Sta inttmp2 12440 PLA:TAX \>>>>>>>>>>>>>>>> 12450 Lda inttmp:Cmp inttmp2 12460 Bne notthisun 12470 Iny:Cpy #8 12480 Bne comparelp 12490 Jmp foundpag 12500.notthisun 12510 Inx: Cpx #10:Bne FindUsrBloop 12520 Jmp aintgotit 12530.foundpag 12540 Stx BuffSlot 12550 Ldy BuffSlot:Jmp ThisllDo 12560.aintgotit 12570 Ldy BuffSlot 12580.findfree 12590 Lda PagePresent,Y 12600 Bmi ThisllDo 12610 Iny 12620 CPY #10:BNE KJHDF:LDY #0:.KJHDF 12630 Cpy BuffSlot 12640 Bne findfree 12650 Rts \ NO SLOTS FREE!!! 12660.ThisllDo 12670 Sty BuffSlot 12680 Lda #0:Sta PagePresent,Y 12690\ Copy in page number dirtily! 12700 Lda BuffSlot:Asl A:Asl A:Tax 12710 Lda magno:Clc:Adc #ASC("0"):Sta PBuff,X:Inx 12720 Ldy #1:Lda (intdest0),Y:Tay:Lda hamtab,Y:And #15:Clc:Adc #ASC("0"):Sta PBuff,X:Inx 12730 Ldy #0:Lda (intdest0),Y:Tay:Lda hamtab,Y:And #15:Clc:Adc #ASC("0"):Sta PBuff,X 12740 Lda BuffSlot:Asl A:Tay 12750 Lda UsrBuff,Y:Sta intzp0:Iny:Lda UsrBuff,Y:Sta intzp1 12760 Ldx #24 12770.rowloop 12780 Ldy #39 12790.colloop 12800 Lda (intdest0),Y:Sta (intzp0),Y 12810 Dey:Bpl colloop 12820 Lda intdest0:Clc:Adc #40:Sta intdest0 12830 Lda intdest1:Adc #0:Sta intdest1 12840 Lda intzp0:Clc:Adc #40:Sta intzp0 12850 Lda intzp1:Adc #0:Sta intzp1 12860 Dex:Bne rowloop 12870 12880 Dec PBuffChanged \ Of course, 128 decs before a display would cause havoc 12890 12900 Lda BuffSlot:Clc:Adc #1:Sta BuffSlot 12910 Cmp #10:Bne nowrp 12920 Lda #0:Sta BuffSlot 12930.nowrp \ move on to next buff slot - no deposit if full... 12940 12950 Rts 12960 12970.TEXTCHECK \ (intdest0) -> Text line. magno set up. 12980 Lda SearchBy:Cmp #SearchByText:Beq TryTxt:Rts:.TryTxt 12990 Lda #0:Tax:Tay:Sta inttmp 13000.nextcomp 13010 Lda (intdest0),Y:And #127 13020 Cmp #32:Bcs tt1:Lda #32:.tt1 13030 Cmp #ASC("A"):Bcc tt2:Cmp #ASC("Z")+1:Bcs tt2:Ora #32:.tt2 \ To LC 13040 Sta inttmp2 13050 Lda SearchText,X 13060 Beq FoundStr 13070 Cmp #ASC("A"):Bcc tt3:Cmp #ASC("Z")+1:Bcs tt3:Ora #32:.tt3 \ To LC 13080 Cmp inttmp2 13090 Bne notfoundstr 13100 Inx:Iny 13110 Jmp nextcomp 13120.notfoundstr 13130 Ldx #0: Ldy inttmp 13140 Iny:Cpy #40 13150 Beq notfoundatall 13160 Sty inttmp 13170 Jmp nextcomp 13180.notfoundatall 13190 Rts 13200.FoundStr 13210 Lda #0 13220 Ldy magno 13230 Sta GrabMe,Y 13240 Rts 13250] 13260=Pass 13270