Home » CEEFAX disks » telesoftware4.adl » 04-01-88/T\SWR10
04-01-88/T\SWR10
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » CEEFAX disks » telesoftware4.adl |
Filename: | 04-01-88/T\SWR10 |
Read OK: | ✔ |
File size: | 3E6E bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
Mastering Sideways ROM & RAM - Module 10 - Extended vectors ----------------------------------------------------------- The BBC microcomputer makes extensive use of vectors. The MOS vectors can be found in page two of memory from &200 to &235. There is also an area of memory in page &0D known as the extended vector space which has a further three bytes, called an extended vector, available to each vector. The first two bytes of an extended vector store the address of a vectored routine if it is in a sideways rom and the third byte stores the number of that rom. In this module I will show you how the vectored operating system routines can be re-vectored to point to an address in your SWR software. To do this it is necessary to store the address and rom number of your new routine in the extended vector space and then change the address contained in a vector to point to an extended vector entry point in page &FF. There are two strategies for returning from vectored code, these are: 1. If the routine completely replaces the standard code it exits with an RTS instruction. 2. If routine does not completely replace the standard code it returns with JMP (oldvec) after restoring the registers. oldvec is the original vector contents. The example used in this module deals with the first strategy but the extended vector technique demonstrated can be used to deal with either strategy or a combination of both strategies. Each of the twenty seven MOS vectors has a vector number, n, such that the vector can be found at location &200+(2*n). The extended vector entry point for each vector can be found at &FF00+(3*n). The start of the extended vector space should be found using Osbyte &A8 with X=&00 and Y=&FF. This returns the address of the first byte of the extended vector space, V, in X and Y. In a BBC B with MOS 1.20 V=&0D9F. The address and rom number of your new routine must be stored in the extended vector space starting at V+(3*n). The number 3*n can be thought of as an offset on the first byte of the extended vector space for vector number n. This information has been summarised in figure 10.1 in which the number, name, location, extended vector entry point (EVEP) and offset on the extended vector space (EVS) has been listed for all the MOS vectors. No. Name Location EVEP EVS offset n &200+2*n &FF00+3*n 3*n ------------------------------------------ 0 USERV &200 &FF00 &00 1 BRKV &202 &FF03 &03 2 IRQ1V &204 &FF06 &06 3 IRQ2V &206 &FF09 &09 4 CLIV &208 &FF0C &0C 5 BYTEV &20A &FF0F &0F 6 WORDV &20C &FF12 &12 7 WRCHV &20E &FF15 &15 8 RDCHV &20E &FF18 &18 9 FILEV &212 &FF1B &1B 10 ARGSV &214 &FF1E &1E 11 BGETV &216 &FF21 &21 12 BPUTV &218 &FF24 &24 13 GBPBV &21A &FF27 &27 14 FINDV &21C &FF2A &2A 15 FSCV &21E &FF2D &2D 16 EVENTV &220 &FF30 &30 17 UPTV &222 &FF33 &33 18 NETV &224 &FF36 &36 19 VDUV &226 &FF39 &39 20 KEYV &228 &FF3C &3C 21 INSV &22A &FF3F &3F 22 REMV &22C &FF42 &42 23 CNPV &22E &FF45 &45 24 IND1V &230 &FF48 &48 25 IND2V &232 &FF4B &4B 26 IND3V &234 &FF4E &4E Figure 10.1 The extended vector entry points and offsets -------------------------------------------------------- You can use figure 10.1 to find the addresses that need to be altered to point any vector into SWR software. If, for example, you want to alter vector number 16, the event vector, to point to your own SWR routine you first need to use Osbyte &A8 to find the start of the extended vector space and store the start address in two consecutive zero page bytes. Then, using post-indexed indirect addressing with the EVS address stored in these two bytes and the EVS offset in the Y register, store the address of your new routine and the rom number of your SWR program in the extended vector space. Lastly point the event vector into your SWR program by storing the extended vector entry point for vector 16 (&FF30) in the event vector (&220 and &221). The coding in figure 10.2 could be used within your SWR program to re-vector EVENTV to point to a new routine within the same rom image. LDA #&A8 \ Osbyte &A8 LDX #&00 LDY #&FF JSR &FFF4 \ find start of EVS STX &70 \ store least sig. byte of EVS STY &71 \ store most sig. byte of EVS LDY #&30 \ offset on EVS for EVENTV LDA #new MOD 256 \ least sig. byte of new routine STA (&70),Y \ least sig. byte in EVS INY \ increment offset for most sig. byte LDA #new DIV 256 \ most sig. byte of new routine STA (&70),Y \ most sig. byte in EVS INY \ increment offset for rom number LDA &F4 \ find rom number of new routine STA (&70),Y \ store in EVS LDX #&30 \ least sig. byte of EVEP for EVENTV LDY #&FF \ most sig. byte of EVEP for EVENTV SEI \ set interupt disable flag STX &220 \ store EVEP in least sig. byte of EVENTV STY &221 \ store EVEP in most sig. byte of EVENTV CLI \ clear interupt disable flag Figure 10.2 Re-vectoring the event vector. ------------------------------------------- This rather elaborate system of extended vectors has been used to convert the program LOCK into sideways ram format in the program VECTOR. The program LOCK was written for use with a cassette based BBC B computer. It is used to create "Locked" cassette files which can be *RUN but not *LOADed. This is one of the simplest cassette file protection systems. The program works by using the event vector to point to a routine which sets the least significant bit of the cassette block flag byte at &3CA fifty times a second. This overcomes the cassette filing system routine which clears the bit before saving each block. The program uses the start of vertical sync event which is generated fifty times a second coincident with the vertical sync on the video signal. LOCK has been written to run at &C00 but, if you want to use the program, you could assemble it to run in any available part of user memory. 10 REM: LOCK 20 DIM save 40 30 address=&70 40 eventv=&220 50 osargs=&FFDA 60 osbyte=&FFF4 70 oscli=&FFF7 80 FOR pass = 0 TO 2 STEP 2 90 P%=&C00 100 [ OPT pass 110 LDA #0 120 TAX 130 TAY 140 JSR osargs 150 CMP #3 160 BCC tape 170 BRK 180 BRK 190 OPT FNequs("Type *TAPE and try again") 200 BRK 210 .tape 220 LDA #13 230 LDX #4 240 LDY #0 250 JSR osbyte \ Disable vert sync event 260 LDX #lock MOD 256 270 LDY #lock DIV 256 280 SEI 290 STX eventv 300 STY eventv+1 310 CLI 320 LDA #14 330 LDX #4 340 JSR osbyte \ Enable vert sync event 350 RTS 360 .lock 370 PHP 380 CMP #4 390 BNE notfour 400 PHA 410 LDA &3CA 420 ORA #1 \ AND #&FE to unlock 430 STA &3CA 440 PLA 450 .notfour 460 PLP 470 RTS 480 ] 490 NEXT 500 INPUT'"Save filename? = "filename$ 510 IF filename$="" END 520 $save="SAVE "+filename$+" FFFF0C00+100" 530 X%=save MOD 256 540 Y%=save DIV 256 550 *OPT1,2 560 CALL oscli 570 *OPT1,0 580 END 590 DEFFNequs(string$) 600 $P%=string$ 610 P%=P%+LEN(string$) 620 =pass The object code generated by LOCK first checks to see if the casstte filing system is active (lines 110-160). If it is not the error routine (lines 170-200) halts the program and generates an error message. The conversion of this type of error trapping into SWR format has been explained in Module 8. The program disables the start of vertical sync event (lines 220-250). EVENTV is re-vectored to point to the cassette locking routine (lines 260-310) and event number 4, the start of vertical sync event, is enabled (lines 320-340) before returning (line 350). After pointing EVENTV to the routine starting in line 360 and enabling the start of vertical sync event, the locking routine (lines 360-470) will be executed fifty times a second ensuring that the least significant bit of the cassette block flag byte is always set. When you *SAVE a file with least significant bit of &3CA set that file will be locked. After *SAVEing the file be sure to press the Break key to reset all the vectors or type *FX13,4 to disable the start of vertical sync event. If you don't you will lock every file you save and you will be unable to load any further cassette files. To convert LOCK into sideways ram format you need to add a suitable header, interpreter, and error routine all of which can be taken from the earlier modules of this course. You must also replace the re-vectoring of EVENTV with an extended vector routine similar to the one illustrated in figure 10.2. These modifications have been made in the program VECTOR. To use VECTOR load the object code it generates into SWR and press the Break key. The routine is selected by typing *LOCK ON and disabled by typing *LOCK OFF. VECTOR uses the familiar one-command interpreter from Module 3 (lines 320-600), argument reading routine from Module 5 (lines 620-760) and error handler from Module 8 (lines 1610-1740). If the command *LOCK OFF is recognised by the interpreter contol is passed to the label ".lockoff" (line 810) and the start of vertical sync event is disabled by the subroutine eventoff (line 820 and lines 1300-1340) before returning to the MOS (line 830). If the command *LOCK ON is recognised by the interpreter control passes to the label ".lockit" (line 840). The program first makes sure that the cassette filing system is active (lines 850-900). If the CFS is active it disables the start of vertical sync event (line 950 and lines 1300-1340) and finds the start of the extended vector space (lines 960-990), the address of which is stored in two consecutive zero page bytes (lines 1000-1010). The Y register is loaded with the event vector space offset (line 1020) and the address of the new routine and the rom number are stored in the extended vector space (lines 1020-1100). EVENTV is re-vectored to point to the extended vector entry point (lines 1110-1160). Event number 4, the start of vertical sync event, is enabled (lines 1170-1190) before restoring the zero page memory locations (lines 1210-1240), balancing the stack (lines 1250-1270) and returning to the MOS with the accumulator reset to zero (lines 1280-1290). One of the most important things to notice from this conversion is that the vectored routine which sets the least significant bit of the cassette block flag byte in the program LOCK (lines 360-470) has not been altered at all in the program VECTOR (lines 1350-1460). All the modifications needed to re-vector the routine to work from SWR are done to the extended vector space, the extended vector entry point and the vector. 10 REM: VECTOR 20 MODE7 30 HIMEM=&3C00 40 DIM save 50 50 diff=&8000-HIMEM 60 address=&70 70 comvec=&F2 80 romnumber=&F4 90 errstack=&100 100 eventv=&220 110 gsinit=&FFC2 120 gsread=&FFC5 130 osargs=&FFDA 140 osbyte=&FFF4 150 oscli=&FFF7 160 FOR pass = 0 TO 2 STEP 2 170 P%=HIMEM 180 [ OPT pass 190 BRK 200 BRK 210 BRK 220 JMP service+diff 230 OPT FNequb(&82) 240 OPT FNequb((copyright+diff) MOD 256) 250 BRK 260 .title 270 OPT FNequs("LOCK") 280 .copyright 290 BRK 300 OPT FNequs("(C) Gordon Horsington 1987") 310 BRK 320 .service 330 CMP #4 340 BEQ unrecognised 350 .exit 360 RTS 370 .unrecognised 380 PHA 390 TXA 400 PHA 410 TYA 420 PHA 430 LDX #&FF 440 .comloop 450 INX 460 LDA title+diff,X 470 BEQ found 480 LDA (comvec),Y 490 INY 500 CMP #ASC(".") 510 BEQ found 520 AND #&DF 530 CMP title+diff,X 540 BEQ comloop 550 PLA 560 TAY 570 PLA 580 TAX 590 PLA 600 RTS 610 .found 620 SEC 630 JSR gsinit 640 LDA address 650 PHA 660 LDA address+1 670 PHA 680 JSR gsread 690 BCS mistake 700 JSR gsread 710 BCS mistake 720 AND #&DF 730 CMP #ASC("F") 740 BEQ lockoff 750 CMP #ASC("N") 760 BEQ lockit 770 .mistake 780 LDX #(syntax+diff) MOD 256 790 LDY #(syntax+diff) DIV 256 800 JMP error+diff 810 .lockoff 820 JSR eventoff+diff 830 JMP quit+diff 840 .lockit 850 LDA #0 860 TAX 870 TAY 880 JSR osargs 890 CMP #3 900 BCC tape 910 LDX #(cfs+diff) MOD 256 920 LDY #(cfs+diff) DIV 256 930 JMP error+diff 940 .tape 950 JSR eventoff+diff 960 LDA #&A8 970 LDX #0 980 LDY #&FF 990 JSR osbyte 1000 STX address 1010 STY address+1 1020 LDY #&30 1030 LDA #(lock+diff) MOD 256 1040 STA (address),Y 1050 INY 1060 LDA #(lock+diff) DIV 256 1070 STA (address),Y 1080 INY 1090 LDA romnumber 1100 STA (address),Y 1110 LDX #&30 1120 LDY #&FF 1130 SEI 1140 STX eventv 1150 STY eventv+1 1160 CLI 1170 LDA #14 1180 LDX #4 1190 JSR osbyte 1200 .quit 1210 PLA 1220 STA address+1 1230 PLA 1240 STA address 1250 PLA 1260 PLA 1270 PLA 1280 LDA #0 1290 RTS 1300 .eventoff 1310 LDA #13 1320 LDX #4 1330 LDY #0 1340 JMP osbyte 1350 .lock 1360 PHP 1370 CMP #4 1380 BNE notfour 1390 PHA 1400 LDA &3CA 1410 ORA #1 \ AND #&FE to unlock 1420 STA &3CA 1430 PLA 1440 .notfour 1450 PLP 1460 RTS 1470 .syntax 1480 BRK 1490 BRK 1500 OPT FNequs("Syntax") 1510 OPT FNequb(&3A) 1520 OPT FNequs(" *LOCK ON/OFF") 1530 BRK 1540 OPT FNequb(&FF) 1550 .cfs 1560 BRK 1570 BRK 1580 OPT FNequs("Type *TAPE and try again") 1590 BRK 1600 OPT FNequb(&FF) 1610 .error 1620 STX address 1630 STY address+1 1640 LDY #&FF 1650 .errorloop 1660 INY 1670 LDA (address),Y 1680 STA errstack,Y 1690 BPL errorloop 1700 PLA 1710 STA address+1 1720 PLA 1730 STA address 1740 JMP errstack 1750 .lastbyte 1760 ] 1770 NEXT 1780 INPUT'"Save filename = "filename$ 1790 IF filename$="" END 1800 $save="SAVE "+filename$+" "+STR$~(HIMEM)+" "+STR$~(las tbyte)+" FFFF8000 FFFF8000" 1810 X%=save MOD 256 1820 Y%=save DIV 256 1830 *OPT1,2 1840 CALL oscli 1850 *OPT1,0 1860 END 1870 DEFFNequb(byte) 1880 ?P%=byte 1890 P%=P%+1 1900 =pass 1910 DEFFNequw(word) 1920 ?P%=word MOD 256 1930 P%?1=word DIV 256 1940 P%=P%+2 1950 =pass 1960 DEFFNequd(double) 1970 !P%=double 1980 P%=P%+4 1990 =pass 2000 DEFFNequs(string$) 2010 $P%=string$ 2020 P%=P%+LEN(string$) 2030 =pass
00000000 4d 61 73 74 65 72 69 6e 67 20 53 69 64 65 77 61 |Mastering Sidewa| 00000010 79 73 20 52 4f 4d 20 26 20 52 41 4d 20 2d 20 4d |ys ROM & RAM - M| 00000020 6f 64 75 6c 65 20 31 30 20 2d 20 45 78 74 65 6e |odule 10 - Exten| 00000030 64 65 64 20 76 65 63 74 6f 72 73 0d 2d 2d 2d 2d |ded vectors.----| 00000040 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000070 2d 2d 2d 2d 2d 2d 2d 0d 0d 20 20 54 68 65 20 42 |-------.. The B| 00000080 42 43 20 6d 69 63 72 6f 63 6f 6d 70 75 74 65 72 |BC microcomputer| 00000090 20 6d 61 6b 65 73 20 65 78 74 65 6e 73 69 76 65 | makes extensive| 000000a0 20 75 73 65 20 6f 66 20 76 65 63 74 6f 72 73 2e | use of vectors.| 000000b0 20 54 68 65 20 4d 4f 53 0d 76 65 63 74 6f 72 73 | The MOS.vectors| 000000c0 20 63 61 6e 20 62 65 20 66 6f 75 6e 64 20 69 6e | can be found in| 000000d0 20 70 61 67 65 20 74 77 6f 20 6f 66 20 6d 65 6d | page two of mem| 000000e0 6f 72 79 20 66 72 6f 6d 20 26 32 30 30 20 74 6f |ory from &200 to| 000000f0 20 26 32 33 35 2e 20 54 68 65 72 65 20 69 73 0d | &235. There is.| 00000100 61 6c 73 6f 20 61 6e 20 61 72 65 61 20 6f 66 20 |also an area of | 00000110 6d 65 6d 6f 72 79 20 69 6e 20 70 61 67 65 20 26 |memory in page &| 00000120 30 44 20 6b 6e 6f 77 6e 20 61 73 20 74 68 65 20 |0D known as the | 00000130 65 78 74 65 6e 64 65 64 20 76 65 63 74 6f 72 20 |extended vector | 00000140 73 70 61 63 65 0d 77 68 69 63 68 20 68 61 73 20 |space.which has | 00000150 61 20 66 75 72 74 68 65 72 20 74 68 72 65 65 20 |a further three | 00000160 62 79 74 65 73 2c 20 63 61 6c 6c 65 64 20 61 6e |bytes, called an| 00000170 20 65 78 74 65 6e 64 65 64 20 76 65 63 74 6f 72 | extended vector| 00000180 2c 20 61 76 61 69 6c 61 62 6c 65 0d 74 6f 20 65 |, available.to e| 00000190 61 63 68 20 76 65 63 74 6f 72 2e 20 54 68 65 20 |ach vector. The | 000001a0 66 69 72 73 74 20 74 77 6f 20 62 79 74 65 73 20 |first two bytes | 000001b0 6f 66 20 61 6e 20 65 78 74 65 6e 64 65 64 20 76 |of an extended v| 000001c0 65 63 74 6f 72 20 73 74 6f 72 65 20 74 68 65 0d |ector store the.| 000001d0 61 64 64 72 65 73 73 20 6f 66 20 61 20 76 65 63 |address of a vec| 000001e0 74 6f 72 65 64 20 72 6f 75 74 69 6e 65 20 69 66 |tored routine if| 000001f0 20 69 74 20 69 73 20 69 6e 20 61 20 73 69 64 65 | it is in a side| 00000200 77 61 79 73 20 72 6f 6d 20 61 6e 64 20 74 68 65 |ways rom and the| 00000210 20 74 68 69 72 64 0d 62 79 74 65 20 73 74 6f 72 | third.byte stor| 00000220 65 73 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 |es the number of| 00000230 20 74 68 61 74 20 72 6f 6d 2e 0d 0d 20 20 49 6e | that rom... In| 00000240 20 74 68 69 73 20 6d 6f 64 75 6c 65 20 49 20 77 | this module I w| 00000250 69 6c 6c 20 73 68 6f 77 20 79 6f 75 20 68 6f 77 |ill show you how| 00000260 20 74 68 65 20 76 65 63 74 6f 72 65 64 20 6f 70 | the vectored op| 00000270 65 72 61 74 69 6e 67 20 73 79 73 74 65 6d 0d 72 |erating system.r| 00000280 6f 75 74 69 6e 65 73 20 63 61 6e 20 62 65 20 72 |outines can be r| 00000290 65 2d 76 65 63 74 6f 72 65 64 20 74 6f 20 70 6f |e-vectored to po| 000002a0 69 6e 74 20 74 6f 20 61 6e 20 61 64 64 72 65 73 |int to an addres| 000002b0 73 20 69 6e 20 79 6f 75 72 20 53 57 52 0d 73 6f |s in your SWR.so| 000002c0 66 74 77 61 72 65 2e 20 54 6f 20 64 6f 20 74 68 |ftware. To do th| 000002d0 69 73 20 69 74 20 69 73 20 6e 65 63 65 73 73 61 |is it is necessa| 000002e0 72 79 20 74 6f 20 73 74 6f 72 65 20 74 68 65 20 |ry to store the | 000002f0 61 64 64 72 65 73 73 20 61 6e 64 20 72 6f 6d 0d |address and rom.| 00000300 6e 75 6d 62 65 72 20 6f 66 20 79 6f 75 72 20 6e |number of your n| 00000310 65 77 20 72 6f 75 74 69 6e 65 20 69 6e 20 74 68 |ew routine in th| 00000320 65 20 65 78 74 65 6e 64 65 64 20 76 65 63 74 6f |e extended vecto| 00000330 72 20 73 70 61 63 65 20 61 6e 64 20 74 68 65 6e |r space and then| 00000340 0d 63 68 61 6e 67 65 20 74 68 65 20 61 64 64 72 |.change the addr| 00000350 65 73 73 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e |ess contained in| 00000360 20 61 20 76 65 63 74 6f 72 20 74 6f 20 70 6f 69 | a vector to poi| 00000370 6e 74 20 74 6f 20 61 6e 20 65 78 74 65 6e 64 65 |nt to an extende| 00000380 64 0d 76 65 63 74 6f 72 20 65 6e 74 72 79 20 70 |d.vector entry p| 00000390 6f 69 6e 74 20 69 6e 20 70 61 67 65 20 26 46 46 |oint in page &FF| 000003a0 2e 0d 0d 20 20 54 68 65 72 65 20 61 72 65 20 74 |... There are t| 000003b0 77 6f 20 73 74 72 61 74 65 67 69 65 73 20 66 6f |wo strategies fo| 000003c0 72 20 72 65 74 75 72 6e 69 6e 67 20 66 72 6f 6d |r returning from| 000003d0 20 76 65 63 74 6f 72 65 64 20 63 6f 64 65 2c 20 | vectored code, | 000003e0 74 68 65 73 65 0d 61 72 65 3a 0d 0d 31 2e 20 49 |these.are:..1. I| 000003f0 66 20 74 68 65 20 72 6f 75 74 69 6e 65 20 63 6f |f the routine co| 00000400 6d 70 6c 65 74 65 6c 79 20 72 65 70 6c 61 63 65 |mpletely replace| 00000410 73 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 63 |s the standard c| 00000420 6f 64 65 20 69 74 20 65 78 69 74 73 20 77 69 74 |ode it exits wit| 00000430 68 0d 61 6e 20 52 54 53 20 69 6e 73 74 72 75 63 |h.an RTS instruc| 00000440 74 69 6f 6e 2e 0d 0d 32 2e 20 49 66 20 72 6f 75 |tion...2. If rou| 00000450 74 69 6e 65 20 64 6f 65 73 20 6e 6f 74 20 63 6f |tine does not co| 00000460 6d 70 6c 65 74 65 6c 79 20 72 65 70 6c 61 63 65 |mpletely replace| 00000470 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 63 6f | the standard co| 00000480 64 65 20 69 74 20 72 65 74 75 72 6e 73 0d 77 69 |de it returns.wi| 00000490 74 68 20 4a 4d 50 20 28 6f 6c 64 76 65 63 29 20 |th JMP (oldvec) | 000004a0 61 66 74 65 72 20 72 65 73 74 6f 72 69 6e 67 20 |after restoring | 000004b0 74 68 65 20 72 65 67 69 73 74 65 72 73 2e 20 6f |the registers. o| 000004c0 6c 64 76 65 63 20 69 73 20 74 68 65 0d 6f 72 69 |ldvec is the.ori| 000004d0 67 69 6e 61 6c 20 76 65 63 74 6f 72 20 63 6f 6e |ginal vector con| 000004e0 74 65 6e 74 73 2e 0d 0d 20 20 54 68 65 20 65 78 |tents... The ex| 000004f0 61 6d 70 6c 65 20 75 73 65 64 20 69 6e 20 74 68 |ample used in th| 00000500 69 73 20 6d 6f 64 75 6c 65 20 64 65 61 6c 73 20 |is module deals | 00000510 77 69 74 68 20 74 68 65 20 66 69 72 73 74 20 73 |with the first s| 00000520 74 72 61 74 65 67 79 20 62 75 74 0d 74 68 65 20 |trategy but.the | 00000530 65 78 74 65 6e 64 65 64 20 76 65 63 74 6f 72 20 |extended vector | 00000540 74 65 63 68 6e 69 71 75 65 20 64 65 6d 6f 6e 73 |technique demons| 00000550 74 72 61 74 65 64 20 63 61 6e 20 62 65 20 75 73 |trated can be us| 00000560 65 64 20 74 6f 20 64 65 61 6c 20 77 69 74 68 0d |ed to deal with.| 00000570 65 69 74 68 65 72 20 73 74 72 61 74 65 67 79 20 |either strategy | 00000580 6f 72 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e |or a combination| 00000590 20 6f 66 20 62 6f 74 68 20 73 74 72 61 74 65 67 | of both strateg| 000005a0 69 65 73 2e 0d 0d 20 20 45 61 63 68 20 6f 66 20 |ies... Each of | 000005b0 74 68 65 20 74 77 65 6e 74 79 20 73 65 76 65 6e |the twenty seven| 000005c0 20 4d 4f 53 20 76 65 63 74 6f 72 73 20 68 61 73 | MOS vectors has| 000005d0 20 61 20 76 65 63 74 6f 72 20 6e 75 6d 62 65 72 | a vector number| 000005e0 2c 20 6e 2c 20 73 75 63 68 0d 74 68 61 74 20 74 |, n, such.that t| 000005f0 68 65 20 76 65 63 74 6f 72 20 63 61 6e 20 62 65 |he vector can be| 00000600 20 66 6f 75 6e 64 20 61 74 20 6c 6f 63 61 74 69 | found at locati| 00000610 6f 6e 20 26 32 30 30 2b 28 32 2a 6e 29 2e 20 54 |on &200+(2*n). T| 00000620 68 65 20 65 78 74 65 6e 64 65 64 0d 76 65 63 74 |he extended.vect| 00000630 6f 72 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 66 |or entry point f| 00000640 6f 72 20 65 61 63 68 20 76 65 63 74 6f 72 20 63 |or each vector c| 00000650 61 6e 20 62 65 20 66 6f 75 6e 64 20 61 74 20 26 |an be found at &| 00000660 46 46 30 30 2b 28 33 2a 6e 29 2e 0d 0d 20 20 54 |FF00+(3*n)... T| 00000670 68 65 20 73 74 61 72 74 20 6f 66 20 74 68 65 20 |he start of the | 00000680 65 78 74 65 6e 64 65 64 20 76 65 63 74 6f 72 20 |extended vector | 00000690 73 70 61 63 65 20 73 68 6f 75 6c 64 20 62 65 20 |space should be | 000006a0 66 6f 75 6e 64 20 75 73 69 6e 67 20 4f 73 62 79 |found using Osby| 000006b0 74 65 0d 26 41 38 20 77 69 74 68 20 58 3d 26 30 |te.&A8 with X=&0| 000006c0 30 20 61 6e 64 20 59 3d 26 46 46 2e 20 54 68 69 |0 and Y=&FF. Thi| 000006d0 73 20 72 65 74 75 72 6e 73 20 74 68 65 20 61 64 |s returns the ad| 000006e0 64 72 65 73 73 20 6f 66 20 74 68 65 20 66 69 72 |dress of the fir| 000006f0 73 74 20 62 79 74 65 0d 6f 66 20 74 68 65 20 65 |st byte.of the e| 00000700 78 74 65 6e 64 65 64 20 76 65 63 74 6f 72 20 73 |xtended vector s| 00000710 70 61 63 65 2c 20 56 2c 20 69 6e 20 58 20 61 6e |pace, V, in X an| 00000720 64 20 59 2e 20 49 6e 20 61 20 42 42 43 20 42 20 |d Y. In a BBC B | 00000730 77 69 74 68 20 4d 4f 53 20 31 2e 32 30 0d 56 3d |with MOS 1.20.V=| 00000740 26 30 44 39 46 2e 20 54 68 65 20 61 64 64 72 65 |&0D9F. The addre| 00000750 73 73 20 61 6e 64 20 72 6f 6d 20 6e 75 6d 62 65 |ss and rom numbe| 00000760 72 20 6f 66 20 79 6f 75 72 20 6e 65 77 20 72 6f |r of your new ro| 00000770 75 74 69 6e 65 20 6d 75 73 74 20 62 65 20 73 74 |utine must be st| 00000780 6f 72 65 64 0d 69 6e 20 74 68 65 20 65 78 74 65 |ored.in the exte| 00000790 6e 64 65 64 20 76 65 63 74 6f 72 20 73 70 61 63 |nded vector spac| 000007a0 65 20 73 74 61 72 74 69 6e 67 20 61 74 20 56 2b |e starting at V+| 000007b0 28 33 2a 6e 29 2e 20 54 68 65 20 6e 75 6d 62 65 |(3*n). The numbe| 000007c0 72 20 33 2a 6e 20 63 61 6e 0d 62 65 20 74 68 6f |r 3*n can.be tho| 000007d0 75 67 68 74 20 6f 66 20 61 73 20 61 6e 20 6f 66 |ught of as an of| 000007e0 66 73 65 74 20 6f 6e 20 74 68 65 20 66 69 72 73 |fset on the firs| 000007f0 74 20 62 79 74 65 20 6f 66 20 74 68 65 20 65 78 |t byte of the ex| 00000800 74 65 6e 64 65 64 20 76 65 63 74 6f 72 0d 73 70 |tended vector.sp| 00000810 61 63 65 20 66 6f 72 20 76 65 63 74 6f 72 20 6e |ace for vector n| 00000820 75 6d 62 65 72 20 6e 2e 0d 0d 20 20 54 68 69 73 |umber n... This| 00000830 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 68 61 73 | information has| 00000840 20 62 65 65 6e 20 73 75 6d 6d 61 72 69 73 65 64 | been summarised| 00000850 20 69 6e 20 66 69 67 75 72 65 20 31 30 2e 31 20 | in figure 10.1 | 00000860 69 6e 20 77 68 69 63 68 20 74 68 65 0d 6e 75 6d |in which the.num| 00000870 62 65 72 2c 20 6e 61 6d 65 2c 20 6c 6f 63 61 74 |ber, name, locat| 00000880 69 6f 6e 2c 20 65 78 74 65 6e 64 65 64 20 76 65 |ion, extended ve| 00000890 63 74 6f 72 20 65 6e 74 72 79 20 70 6f 69 6e 74 |ctor entry point| 000008a0 20 28 45 56 45 50 29 20 61 6e 64 20 6f 66 66 73 | (EVEP) and offs| 000008b0 65 74 0d 6f 6e 20 74 68 65 20 65 78 74 65 6e 64 |et.on the extend| 000008c0 65 64 20 76 65 63 74 6f 72 20 73 70 61 63 65 20 |ed vector space | 000008d0 28 45 56 53 29 20 68 61 73 20 62 65 65 6e 20 6c |(EVS) has been l| 000008e0 69 73 74 65 64 20 66 6f 72 20 61 6c 6c 20 74 68 |isted for all th| 000008f0 65 20 4d 4f 53 0d 76 65 63 74 6f 72 73 2e 0d 0d |e MOS.vectors...| 00000900 0d 0d 0d 4e 6f 2e 20 4e 61 6d 65 20 20 20 4c 6f |...No. Name Lo| 00000910 63 61 74 69 6f 6e 20 20 45 56 45 50 20 20 20 20 |cation EVEP | 00000920 20 20 20 45 56 53 20 6f 66 66 73 65 74 0d 20 6e | EVS offset. n| 00000930 20 20 20 20 20 20 20 20 20 26 32 30 30 2b 32 2a | &200+2*| 00000940 6e 20 20 26 46 46 30 30 2b 33 2a 6e 20 20 33 2a |n &FF00+3*n 3*| 00000950 6e 0d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |n.--------------| 00000960 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 00000970 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 20 30 20 |------------. 0 | 00000980 20 55 53 45 52 56 20 20 26 32 30 30 20 20 20 20 | USERV &200 | 00000990 20 20 26 46 46 30 30 20 20 20 20 20 20 26 30 30 | &FF00 &00| 000009a0 0d 20 31 20 20 42 52 4b 56 20 20 20 26 32 30 32 |. 1 BRKV &202| 000009b0 20 20 20 20 20 20 26 46 46 30 33 20 20 20 20 20 | &FF03 | 000009c0 20 26 30 33 0d 20 32 20 20 49 52 51 31 56 20 20 | &03. 2 IRQ1V | 000009d0 26 32 30 34 20 20 20 20 20 20 26 46 46 30 36 20 |&204 &FF06 | 000009e0 20 20 20 20 20 26 30 36 0d 20 33 20 20 49 52 51 | &06. 3 IRQ| 000009f0 32 56 20 20 26 32 30 36 20 20 20 20 20 20 26 46 |2V &206 &F| 00000a00 46 30 39 20 20 20 20 20 20 26 30 39 0d 20 34 20 |F09 &09. 4 | 00000a10 20 43 4c 49 56 20 20 20 26 32 30 38 20 20 20 20 | CLIV &208 | 00000a20 20 20 26 46 46 30 43 20 20 20 20 20 20 26 30 43 | &FF0C &0C| 00000a30 0d 20 35 20 20 42 59 54 45 56 20 20 26 32 30 41 |. 5 BYTEV &20A| 00000a40 20 20 20 20 20 20 26 46 46 30 46 20 20 20 20 20 | &FF0F | 00000a50 20 26 30 46 0d 20 36 20 20 57 4f 52 44 56 20 20 | &0F. 6 WORDV | 00000a60 26 32 30 43 20 20 20 20 20 20 26 46 46 31 32 20 |&20C &FF12 | 00000a70 20 20 20 20 20 26 31 32 0d 20 37 20 20 57 52 43 | &12. 7 WRC| 00000a80 48 56 20 20 26 32 30 45 20 20 20 20 20 20 26 46 |HV &20E &F| 00000a90 46 31 35 20 20 20 20 20 20 26 31 35 0d 20 38 20 |F15 &15. 8 | 00000aa0 20 52 44 43 48 56 20 20 26 32 30 45 20 20 20 20 | RDCHV &20E | 00000ab0 20 20 26 46 46 31 38 20 20 20 20 20 20 26 31 38 | &FF18 &18| 00000ac0 0d 20 39 20 20 46 49 4c 45 56 20 20 26 32 31 32 |. 9 FILEV &212| 00000ad0 20 20 20 20 20 20 26 46 46 31 42 20 20 20 20 20 | &FF1B | 00000ae0 20 26 31 42 0d 31 30 20 20 41 52 47 53 56 20 20 | &1B.10 ARGSV | 00000af0 26 32 31 34 20 20 20 20 20 20 26 46 46 31 45 20 |&214 &FF1E | 00000b00 20 20 20 20 20 26 31 45 0d 31 31 20 20 42 47 45 | &1E.11 BGE| 00000b10 54 56 20 20 26 32 31 36 20 20 20 20 20 20 26 46 |TV &216 &F| 00000b20 46 32 31 20 20 20 20 20 20 26 32 31 0d 31 32 20 |F21 &21.12 | 00000b30 20 42 50 55 54 56 20 20 26 32 31 38 20 20 20 20 | BPUTV &218 | 00000b40 20 20 26 46 46 32 34 20 20 20 20 20 20 26 32 34 | &FF24 &24| 00000b50 0d 31 33 20 20 47 42 50 42 56 20 20 26 32 31 41 |.13 GBPBV &21A| 00000b60 20 20 20 20 20 20 26 46 46 32 37 20 20 20 20 20 | &FF27 | 00000b70 20 26 32 37 0d 31 34 20 20 46 49 4e 44 56 20 20 | &27.14 FINDV | 00000b80 26 32 31 43 20 20 20 20 20 20 26 46 46 32 41 20 |&21C &FF2A | 00000b90 20 20 20 20 20 26 32 41 0d 31 35 20 20 46 53 43 | &2A.15 FSC| 00000ba0 56 20 20 20 26 32 31 45 20 20 20 20 20 20 26 46 |V &21E &F| 00000bb0 46 32 44 20 20 20 20 20 20 26 32 44 0d 31 36 20 |F2D &2D.16 | 00000bc0 20 45 56 45 4e 54 56 20 26 32 32 30 20 20 20 20 | EVENTV &220 | 00000bd0 20 20 26 46 46 33 30 20 20 20 20 20 20 26 33 30 | &FF30 &30| 00000be0 0d 31 37 20 20 55 50 54 56 20 20 20 26 32 32 32 |.17 UPTV &222| 00000bf0 20 20 20 20 20 20 26 46 46 33 33 20 20 20 20 20 | &FF33 | 00000c00 20 26 33 33 0d 31 38 20 20 4e 45 54 56 20 20 20 | &33.18 NETV | 00000c10 26 32 32 34 20 20 20 20 20 20 26 46 46 33 36 20 |&224 &FF36 | 00000c20 20 20 20 20 20 26 33 36 0d 31 39 20 20 56 44 55 | &36.19 VDU| 00000c30 56 20 20 20 26 32 32 36 20 20 20 20 20 20 26 46 |V &226 &F| 00000c40 46 33 39 20 20 20 20 20 20 26 33 39 0d 32 30 20 |F39 &39.20 | 00000c50 20 4b 45 59 56 20 20 20 26 32 32 38 20 20 20 20 | KEYV &228 | 00000c60 20 20 26 46 46 33 43 20 20 20 20 20 20 26 33 43 | &FF3C &3C| 00000c70 0d 32 31 20 20 49 4e 53 56 20 20 20 26 32 32 41 |.21 INSV &22A| 00000c80 20 20 20 20 20 20 26 46 46 33 46 20 20 20 20 20 | &FF3F | 00000c90 20 26 33 46 0d 32 32 20 20 52 45 4d 56 20 20 20 | &3F.22 REMV | 00000ca0 26 32 32 43 20 20 20 20 20 20 26 46 46 34 32 20 |&22C &FF42 | 00000cb0 20 20 20 20 20 26 34 32 0d 32 33 20 20 43 4e 50 | &42.23 CNP| 00000cc0 56 20 20 20 26 32 32 45 20 20 20 20 20 20 26 46 |V &22E &F| 00000cd0 46 34 35 20 20 20 20 20 20 26 34 35 0d 32 34 20 |F45 &45.24 | 00000ce0 20 49 4e 44 31 56 20 20 26 32 33 30 20 20 20 20 | IND1V &230 | 00000cf0 20 20 26 46 46 34 38 20 20 20 20 20 20 26 34 38 | &FF48 &48| 00000d00 0d 32 35 20 20 49 4e 44 32 56 20 20 26 32 33 32 |.25 IND2V &232| 00000d10 20 20 20 20 20 20 26 46 46 34 42 20 20 20 20 20 | &FF4B | 00000d20 20 26 34 42 0d 32 36 20 20 49 4e 44 33 56 20 20 | &4B.26 IND3V | 00000d30 26 32 33 34 20 20 20 20 20 20 26 46 46 34 45 20 |&234 &FF4E | 00000d40 20 20 20 20 20 26 34 45 0d 0d 46 69 67 75 72 65 | &4E..Figure| 00000d50 20 31 30 2e 31 20 54 68 65 20 65 78 74 65 6e 64 | 10.1 The extend| 00000d60 65 64 20 76 65 63 74 6f 72 20 65 6e 74 72 79 20 |ed vector entry | 00000d70 70 6f 69 6e 74 73 20 61 6e 64 20 6f 66 66 73 65 |points and offse| 00000d80 74 73 0d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |ts.-------------| 00000d90 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000db0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0d 0d 0d 0d |-----------.....| 00000dc0 20 20 59 6f 75 20 63 61 6e 20 75 73 65 20 66 69 | You can use fi| 00000dd0 67 75 72 65 20 31 30 2e 31 20 74 6f 20 66 69 6e |gure 10.1 to fin| 00000de0 64 20 74 68 65 20 61 64 64 72 65 73 73 65 73 20 |d the addresses | 00000df0 74 68 61 74 20 6e 65 65 64 20 74 6f 20 62 65 0d |that need to be.| 00000e00 61 6c 74 65 72 65 64 20 74 6f 20 70 6f 69 6e 74 |altered to point| 00000e10 20 61 6e 79 20 76 65 63 74 6f 72 20 69 6e 74 6f | any vector into| 00000e20 20 53 57 52 20 73 6f 66 74 77 61 72 65 2e 0d 0d | SWR software...| 00000e30 20 20 49 66 2c 20 66 6f 72 20 65 78 61 6d 70 6c | If, for exampl| 00000e40 65 2c 20 79 6f 75 20 77 61 6e 74 20 74 6f 20 61 |e, you want to a| 00000e50 6c 74 65 72 20 76 65 63 74 6f 72 20 6e 75 6d 62 |lter vector numb| 00000e60 65 72 20 31 36 2c 20 74 68 65 20 65 76 65 6e 74 |er 16, the event| 00000e70 0d 76 65 63 74 6f 72 2c 20 74 6f 20 70 6f 69 6e |.vector, to poin| 00000e80 74 20 74 6f 20 79 6f 75 72 20 6f 77 6e 20 53 57 |t to your own SW| 00000e90 52 20 72 6f 75 74 69 6e 65 20 79 6f 75 20 66 69 |R routine you fi| 00000ea0 72 73 74 20 6e 65 65 64 20 74 6f 20 75 73 65 20 |rst need to use | 00000eb0 4f 73 62 79 74 65 0d 26 41 38 20 74 6f 20 66 69 |Osbyte.&A8 to fi| 00000ec0 6e 64 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 |nd the start of | 00000ed0 74 68 65 20 65 78 74 65 6e 64 65 64 20 76 65 63 |the extended vec| 00000ee0 74 6f 72 20 73 70 61 63 65 20 61 6e 64 20 73 74 |tor space and st| 00000ef0 6f 72 65 20 74 68 65 20 73 74 61 72 74 0d 61 64 |ore the start.ad| 00000f00 64 72 65 73 73 20 69 6e 20 74 77 6f 20 63 6f 6e |dress in two con| 00000f10 73 65 63 75 74 69 76 65 20 7a 65 72 6f 20 70 61 |secutive zero pa| 00000f20 67 65 20 62 79 74 65 73 2e 20 54 68 65 6e 2c 20 |ge bytes. Then, | 00000f30 75 73 69 6e 67 20 70 6f 73 74 2d 69 6e 64 65 78 |using post-index| 00000f40 65 64 0d 69 6e 64 69 72 65 63 74 20 61 64 64 72 |ed.indirect addr| 00000f50 65 73 73 69 6e 67 20 77 69 74 68 20 74 68 65 20 |essing with the | 00000f60 45 56 53 20 61 64 64 72 65 73 73 20 73 74 6f 72 |EVS address stor| 00000f70 65 64 20 69 6e 20 74 68 65 73 65 20 74 77 6f 20 |ed in these two | 00000f80 62 79 74 65 73 20 61 6e 64 0d 74 68 65 20 45 56 |bytes and.the EV| 00000f90 53 20 6f 66 66 73 65 74 20 69 6e 20 74 68 65 20 |S offset in the | 00000fa0 59 20 72 65 67 69 73 74 65 72 2c 20 73 74 6f 72 |Y register, stor| 00000fb0 65 20 74 68 65 20 61 64 64 72 65 73 73 20 6f 66 |e the address of| 00000fc0 20 79 6f 75 72 20 6e 65 77 0d 72 6f 75 74 69 6e | your new.routin| 00000fd0 65 20 61 6e 64 20 74 68 65 20 72 6f 6d 20 6e 75 |e and the rom nu| 00000fe0 6d 62 65 72 20 6f 66 20 79 6f 75 72 20 53 57 52 |mber of your SWR| 00000ff0 20 70 72 6f 67 72 61 6d 20 69 6e 20 74 68 65 20 | program in the | 00001000 65 78 74 65 6e 64 65 64 20 76 65 63 74 6f 72 0d |extended vector.| 00001010 73 70 61 63 65 2e 20 4c 61 73 74 6c 79 20 70 6f |space. Lastly po| 00001020 69 6e 74 20 74 68 65 20 65 76 65 6e 74 20 76 65 |int the event ve| 00001030 63 74 6f 72 20 69 6e 74 6f 20 79 6f 75 72 20 53 |ctor into your S| 00001040 57 52 20 70 72 6f 67 72 61 6d 20 62 79 20 73 74 |WR program by st| 00001050 6f 72 69 6e 67 0d 74 68 65 20 65 78 74 65 6e 64 |oring.the extend| 00001060 65 64 20 76 65 63 74 6f 72 20 65 6e 74 72 79 20 |ed vector entry | 00001070 70 6f 69 6e 74 20 66 6f 72 20 76 65 63 74 6f 72 |point for vector| 00001080 20 31 36 20 28 26 46 46 33 30 29 20 69 6e 20 74 | 16 (&FF30) in t| 00001090 68 65 20 65 76 65 6e 74 0d 76 65 63 74 6f 72 20 |he event.vector | 000010a0 28 26 32 32 30 20 61 6e 64 20 26 32 32 31 29 2e |(&220 and &221).| 000010b0 0d 0d 20 20 54 68 65 20 63 6f 64 69 6e 67 20 69 |.. The coding i| 000010c0 6e 20 66 69 67 75 72 65 20 31 30 2e 32 20 63 6f |n figure 10.2 co| 000010d0 75 6c 64 20 62 65 20 75 73 65 64 20 77 69 74 68 |uld be used with| 000010e0 69 6e 20 79 6f 75 72 20 53 57 52 20 70 72 6f 67 |in your SWR prog| 000010f0 72 61 6d 20 74 6f 0d 72 65 2d 76 65 63 74 6f 72 |ram to.re-vector| 00001100 20 45 56 45 4e 54 56 20 74 6f 20 70 6f 69 6e 74 | EVENTV to point| 00001110 20 74 6f 20 61 20 6e 65 77 20 72 6f 75 74 69 6e | to a new routin| 00001120 65 20 77 69 74 68 69 6e 20 74 68 65 20 73 61 6d |e within the sam| 00001130 65 20 72 6f 6d 20 69 6d 61 67 65 2e 0d 0d 0d 0d |e rom image.....| 00001140 0d 20 20 4c 44 41 20 23 26 41 38 20 20 20 20 20 |. LDA #&A8 | 00001150 20 20 20 20 20 5c 20 4f 73 62 79 74 65 20 26 41 | \ Osbyte &A| 00001160 38 0d 20 20 4c 44 58 20 23 26 30 30 0d 20 20 4c |8. LDX #&00. L| 00001170 44 59 20 23 26 46 46 0d 20 20 4a 53 52 20 26 46 |DY #&FF. JSR &F| 00001180 46 46 34 20 20 20 20 20 20 20 20 20 5c 20 66 69 |FF4 \ fi| 00001190 6e 64 20 73 74 61 72 74 20 6f 66 20 45 56 53 0d |nd start of EVS.| 000011a0 20 20 53 54 58 20 26 37 30 20 20 20 20 20 20 20 | STX &70 | 000011b0 20 20 20 20 5c 20 73 74 6f 72 65 20 6c 65 61 73 | \ store leas| 000011c0 74 20 73 69 67 2e 20 62 79 74 65 20 6f 66 20 45 |t sig. byte of E| 000011d0 56 53 0d 20 20 53 54 59 20 26 37 31 20 20 20 20 |VS. STY &71 | 000011e0 20 20 20 20 20 20 20 5c 20 73 74 6f 72 65 20 6d | \ store m| 000011f0 6f 73 74 20 73 69 67 2e 20 62 79 74 65 20 6f 66 |ost sig. byte of| 00001200 20 45 56 53 0d 20 20 4c 44 59 20 23 26 33 30 20 | EVS. LDY #&30 | 00001210 20 20 20 20 20 20 20 20 20 5c 20 6f 66 66 73 65 | \ offse| 00001220 74 20 6f 6e 20 45 56 53 20 66 6f 72 20 45 56 45 |t on EVS for EVE| 00001230 4e 54 56 0d 20 20 4c 44 41 20 23 6e 65 77 20 4d |NTV. LDA #new M| 00001240 4f 44 20 32 35 36 20 20 5c 20 6c 65 61 73 74 20 |OD 256 \ least | 00001250 73 69 67 2e 20 62 79 74 65 20 6f 66 20 6e 65 77 |sig. byte of new| 00001260 20 72 6f 75 74 69 6e 65 0d 20 20 53 54 41 20 28 | routine. STA (| 00001270 26 37 30 29 2c 59 20 20 20 20 20 20 20 5c 20 6c |&70),Y \ l| 00001280 65 61 73 74 20 73 69 67 2e 20 62 79 74 65 20 69 |east sig. byte i| 00001290 6e 20 45 56 53 0d 20 20 49 4e 59 20 20 20 20 20 |n EVS. INY | 000012a0 20 20 20 20 20 20 20 20 20 20 5c 20 69 6e 63 72 | \ incr| 000012b0 65 6d 65 6e 74 20 6f 66 66 73 65 74 20 66 6f 72 |ement offset for| 000012c0 20 6d 6f 73 74 20 73 69 67 2e 20 62 79 74 65 0d | most sig. byte.| 000012d0 20 20 4c 44 41 20 23 6e 65 77 20 44 49 56 20 32 | LDA #new DIV 2| 000012e0 35 36 20 20 5c 20 6d 6f 73 74 20 73 69 67 2e 20 |56 \ most sig. | 000012f0 62 79 74 65 20 6f 66 20 6e 65 77 20 72 6f 75 74 |byte of new rout| 00001300 69 6e 65 0d 20 20 53 54 41 20 28 26 37 30 29 2c |ine. STA (&70),| 00001310 59 20 20 20 20 20 20 20 5c 20 6d 6f 73 74 20 73 |Y \ most s| 00001320 69 67 2e 20 62 79 74 65 20 69 6e 20 45 56 53 0d |ig. byte in EVS.| 00001330 20 20 49 4e 59 20 20 20 20 20 20 20 20 20 20 20 | INY | 00001340 20 20 20 20 5c 20 69 6e 63 72 65 6d 65 6e 74 20 | \ increment | 00001350 6f 66 66 73 65 74 20 66 6f 72 20 72 6f 6d 20 6e |offset for rom n| 00001360 75 6d 62 65 72 0d 20 20 4c 44 41 20 26 46 34 20 |umber. LDA &F4 | 00001370 20 20 20 20 20 20 20 20 20 20 5c 20 66 69 6e 64 | \ find| 00001380 20 72 6f 6d 20 6e 75 6d 62 65 72 20 6f 66 20 6e | rom number of n| 00001390 65 77 20 72 6f 75 74 69 6e 65 0d 20 20 53 54 41 |ew routine. STA| 000013a0 20 28 26 37 30 29 2c 59 20 20 20 20 20 20 20 5c | (&70),Y \| 000013b0 20 73 74 6f 72 65 20 69 6e 20 45 56 53 0d 20 20 | store in EVS. | 000013c0 4c 44 58 20 23 26 33 30 20 20 20 20 20 20 20 20 |LDX #&30 | 000013d0 20 20 5c 20 6c 65 61 73 74 20 73 69 67 2e 20 62 | \ least sig. b| 000013e0 79 74 65 20 6f 66 20 45 56 45 50 20 66 6f 72 20 |yte of EVEP for | 000013f0 45 56 45 4e 54 56 0d 20 20 4c 44 59 20 23 26 46 |EVENTV. LDY #&F| 00001400 46 20 20 20 20 20 20 20 20 20 20 5c 20 6d 6f 73 |F \ mos| 00001410 74 20 73 69 67 2e 20 62 79 74 65 20 6f 66 20 45 |t sig. byte of E| 00001420 56 45 50 20 66 6f 72 20 45 56 45 4e 54 56 0d 20 |VEP for EVENTV. | 00001430 20 53 45 49 20 20 20 20 20 20 20 20 20 20 20 20 | SEI | 00001440 20 20 20 5c 20 73 65 74 20 69 6e 74 65 72 75 70 | \ set interup| 00001450 74 20 64 69 73 61 62 6c 65 20 66 6c 61 67 0d 20 |t disable flag. | 00001460 20 53 54 58 20 26 32 32 30 20 20 20 20 20 20 20 | STX &220 | 00001470 20 20 20 5c 20 73 74 6f 72 65 20 45 56 45 50 20 | \ store EVEP | 00001480 69 6e 20 6c 65 61 73 74 20 73 69 67 2e 20 62 79 |in least sig. by| 00001490 74 65 20 6f 66 20 45 56 45 4e 54 56 0d 20 20 53 |te of EVENTV. S| 000014a0 54 59 20 26 32 32 31 20 20 20 20 20 20 20 20 20 |TY &221 | 000014b0 20 5c 20 73 74 6f 72 65 20 45 56 45 50 20 69 6e | \ store EVEP in| 000014c0 20 6d 6f 73 74 20 73 69 67 2e 20 62 79 74 65 20 | most sig. byte | 000014d0 6f 66 20 45 56 45 4e 54 56 0d 20 20 43 4c 49 20 |of EVENTV. CLI | 000014e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 000014f0 63 6c 65 61 72 20 69 6e 74 65 72 75 70 74 20 64 |clear interupt d| 00001500 69 73 61 62 6c 65 20 66 6c 61 67 0d 0d 46 69 67 |isable flag..Fig| 00001510 75 72 65 20 31 30 2e 32 20 20 52 65 2d 76 65 63 |ure 10.2 Re-vec| 00001520 74 6f 72 69 6e 67 20 74 68 65 20 65 76 65 6e 74 |toring the event| 00001530 20 76 65 63 74 6f 72 2e 0d 2d 2d 2d 2d 2d 2d 2d | vector..-------| 00001540 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00001560 2d 2d 2d 2d 0d 0d 0d 0d 0d 20 20 54 68 69 73 20 |----..... This | 00001570 72 61 74 68 65 72 20 65 6c 61 62 6f 72 61 74 65 |rather elaborate| 00001580 20 73 79 73 74 65 6d 20 6f 66 20 65 78 74 65 6e | system of exten| 00001590 64 65 64 20 76 65 63 74 6f 72 73 20 68 61 73 20 |ded vectors has | 000015a0 62 65 65 6e 20 75 73 65 64 20 74 6f 0d 63 6f 6e |been used to.con| 000015b0 76 65 72 74 20 74 68 65 20 70 72 6f 67 72 61 6d |vert the program| 000015c0 20 4c 4f 43 4b 20 69 6e 74 6f 20 73 69 64 65 77 | LOCK into sidew| 000015d0 61 79 73 20 72 61 6d 20 66 6f 72 6d 61 74 20 69 |ays ram format i| 000015e0 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 0d 56 45 |n the program.VE| 000015f0 43 54 4f 52 2e 0d 0d 20 20 54 68 65 20 70 72 6f |CTOR... The pro| 00001600 67 72 61 6d 20 4c 4f 43 4b 20 77 61 73 20 77 72 |gram LOCK was wr| 00001610 69 74 74 65 6e 20 66 6f 72 20 75 73 65 20 77 69 |itten for use wi| 00001620 74 68 20 61 20 63 61 73 73 65 74 74 65 20 62 61 |th a cassette ba| 00001630 73 65 64 20 42 42 43 20 42 0d 63 6f 6d 70 75 74 |sed BBC B.comput| 00001640 65 72 2e 20 49 74 20 69 73 20 75 73 65 64 20 74 |er. It is used t| 00001650 6f 20 63 72 65 61 74 65 20 22 4c 6f 63 6b 65 64 |o create "Locked| 00001660 22 20 63 61 73 73 65 74 74 65 20 66 69 6c 65 73 |" cassette files| 00001670 20 77 68 69 63 68 20 63 61 6e 20 62 65 0d 2a 52 | which can be.*R| 00001680 55 4e 20 62 75 74 20 6e 6f 74 20 2a 4c 4f 41 44 |UN but not *LOAD| 00001690 65 64 2e 20 54 68 69 73 20 69 73 20 6f 6e 65 20 |ed. This is one | 000016a0 6f 66 20 74 68 65 20 73 69 6d 70 6c 65 73 74 20 |of the simplest | 000016b0 63 61 73 73 65 74 74 65 20 66 69 6c 65 0d 70 72 |cassette file.pr| 000016c0 6f 74 65 63 74 69 6f 6e 20 73 79 73 74 65 6d 73 |otection systems| 000016d0 2e 20 54 68 65 20 70 72 6f 67 72 61 6d 20 77 6f |. The program wo| 000016e0 72 6b 73 20 62 79 20 75 73 69 6e 67 20 74 68 65 |rks by using the| 000016f0 20 65 76 65 6e 74 20 76 65 63 74 6f 72 20 74 6f | event vector to| 00001700 0d 70 6f 69 6e 74 20 74 6f 20 61 20 72 6f 75 74 |.point to a rout| 00001710 69 6e 65 20 77 68 69 63 68 20 73 65 74 73 20 74 |ine which sets t| 00001720 68 65 20 6c 65 61 73 74 20 73 69 67 6e 69 66 69 |he least signifi| 00001730 63 61 6e 74 20 62 69 74 20 6f 66 20 74 68 65 0d |cant bit of the.| 00001740 63 61 73 73 65 74 74 65 20 62 6c 6f 63 6b 20 66 |cassette block f| 00001750 6c 61 67 20 62 79 74 65 20 61 74 20 26 33 43 41 |lag byte at &3CA| 00001760 20 66 69 66 74 79 20 74 69 6d 65 73 20 61 20 73 | fifty times a s| 00001770 65 63 6f 6e 64 2e 20 54 68 69 73 20 6f 76 65 72 |econd. This over| 00001780 63 6f 6d 65 73 0d 74 68 65 20 63 61 73 73 65 74 |comes.the casset| 00001790 74 65 20 66 69 6c 69 6e 67 20 73 79 73 74 65 6d |te filing system| 000017a0 20 72 6f 75 74 69 6e 65 20 77 68 69 63 68 20 63 | routine which c| 000017b0 6c 65 61 72 73 20 74 68 65 20 62 69 74 20 62 65 |lears the bit be| 000017c0 66 6f 72 65 20 73 61 76 69 6e 67 0d 65 61 63 68 |fore saving.each| 000017d0 20 62 6c 6f 63 6b 2e 20 54 68 65 20 70 72 6f 67 | block. The prog| 000017e0 72 61 6d 20 75 73 65 73 20 74 68 65 20 73 74 61 |ram uses the sta| 000017f0 72 74 20 6f 66 20 76 65 72 74 69 63 61 6c 20 73 |rt of vertical s| 00001800 79 6e 63 20 65 76 65 6e 74 20 77 68 69 63 68 20 |ync event which | 00001810 69 73 0d 67 65 6e 65 72 61 74 65 64 20 66 69 66 |is.generated fif| 00001820 74 79 20 74 69 6d 65 73 20 61 20 73 65 63 6f 6e |ty times a secon| 00001830 64 20 63 6f 69 6e 63 69 64 65 6e 74 20 77 69 74 |d coincident wit| 00001840 68 20 74 68 65 20 76 65 72 74 69 63 61 6c 20 73 |h the vertical s| 00001850 79 6e 63 20 6f 6e 0d 74 68 65 20 76 69 64 65 6f |ync on.the video| 00001860 20 73 69 67 6e 61 6c 2e 20 4c 4f 43 4b 20 68 61 | signal. LOCK ha| 00001870 73 20 62 65 65 6e 20 77 72 69 74 74 65 6e 20 74 |s been written t| 00001880 6f 20 72 75 6e 20 61 74 20 26 43 30 30 20 62 75 |o run at &C00 bu| 00001890 74 2c 20 69 66 20 79 6f 75 0d 77 61 6e 74 20 74 |t, if you.want t| 000018a0 6f 20 75 73 65 20 74 68 65 20 70 72 6f 67 72 61 |o use the progra| 000018b0 6d 2c 20 79 6f 75 20 63 6f 75 6c 64 20 61 73 73 |m, you could ass| 000018c0 65 6d 62 6c 65 20 69 74 20 74 6f 20 72 75 6e 20 |emble it to run | 000018d0 69 6e 20 61 6e 79 20 61 76 61 69 6c 61 62 6c 65 |in any available| 000018e0 0d 70 61 72 74 20 6f 66 20 75 73 65 72 20 6d 65 |.part of user me| 000018f0 6d 6f 72 79 2e 0d 0d 0d 0d 0d 0d 20 20 20 31 30 |mory....... 10| 00001900 20 52 45 4d 3a 20 4c 4f 43 4b 0d 20 20 20 32 30 | REM: LOCK. 20| 00001910 20 44 49 4d 20 73 61 76 65 20 34 30 0d 20 20 20 | DIM save 40. | 00001920 33 30 20 61 64 64 72 65 73 73 3d 26 37 30 0d 20 |30 address=&70. | 00001930 20 20 34 30 20 65 76 65 6e 74 76 3d 26 32 32 30 | 40 eventv=&220| 00001940 0d 20 20 20 35 30 20 6f 73 61 72 67 73 3d 26 46 |. 50 osargs=&F| 00001950 46 44 41 0d 20 20 20 36 30 20 6f 73 62 79 74 65 |FDA. 60 osbyte| 00001960 3d 26 46 46 46 34 0d 20 20 20 37 30 20 6f 73 63 |=&FFF4. 70 osc| 00001970 6c 69 3d 26 46 46 46 37 0d 20 20 20 38 30 20 46 |li=&FFF7. 80 F| 00001980 4f 52 20 70 61 73 73 20 3d 20 30 20 54 4f 20 32 |OR pass = 0 TO 2| 00001990 20 53 54 45 50 20 32 0d 20 20 20 39 30 20 50 25 | STEP 2. 90 P%| 000019a0 3d 26 43 30 30 0d 20 20 31 30 30 20 5b 20 20 20 |=&C00. 100 [ | 000019b0 20 20 20 20 4f 50 54 20 70 61 73 73 0d 20 20 31 | OPT pass. 1| 000019c0 31 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 23 |10 LDA #| 000019d0 30 20 0d 20 20 31 32 30 20 20 20 20 20 20 20 20 |0 . 120 | 000019e0 20 54 41 58 20 0d 20 20 31 33 30 20 20 20 20 20 | TAX . 130 | 000019f0 20 20 20 20 54 41 59 20 0d 20 20 31 34 30 20 20 | TAY . 140 | 00001a00 20 20 20 20 20 20 20 4a 53 52 20 6f 73 61 72 67 | JSR osarg| 00001a10 73 0d 20 20 31 35 30 20 20 20 20 20 20 20 20 20 |s. 150 | 00001a20 43 4d 50 20 23 33 20 0d 20 20 31 36 30 20 20 20 |CMP #3 . 160 | 00001a30 20 20 20 20 20 20 42 43 43 20 74 61 70 65 0d 20 | BCC tape. | 00001a40 20 31 37 30 20 20 20 20 20 20 20 20 20 42 52 4b | 170 BRK| 00001a50 0d 20 20 31 38 30 20 20 20 20 20 20 20 20 20 42 |. 180 B| 00001a60 52 4b 0d 20 20 31 39 30 20 20 20 20 20 20 20 20 |RK. 190 | 00001a70 20 4f 50 54 20 46 4e 65 71 75 73 28 22 54 79 70 | OPT FNequs("Typ| 00001a80 65 20 2a 54 41 50 45 20 61 6e 64 20 74 72 79 20 |e *TAPE and try | 00001a90 61 67 61 69 6e 22 29 0d 20 20 32 30 30 20 20 20 |again"). 200 | 00001aa0 20 20 20 20 20 20 42 52 4b 0d 20 20 32 31 30 20 | BRK. 210 | 00001ab0 2e 74 61 70 65 0d 20 20 32 32 30 20 20 20 20 20 |.tape. 220 | 00001ac0 20 20 20 20 4c 44 41 20 23 31 33 0d 20 20 32 33 | LDA #13. 23| 00001ad0 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 23 34 |0 LDX #4| 00001ae0 0d 20 20 32 34 30 20 20 20 20 20 20 20 20 20 4c |. 240 L| 00001af0 44 59 20 23 30 0d 20 20 32 35 30 20 20 20 20 20 |DY #0. 250 | 00001b00 20 20 20 20 4a 53 52 20 6f 73 62 79 74 65 20 20 | JSR osbyte | 00001b10 20 20 5c 20 44 69 73 61 62 6c 65 20 76 65 72 74 | \ Disable vert| 00001b20 20 73 79 6e 63 20 65 76 65 6e 74 0d 20 20 32 36 | sync event. 26| 00001b30 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 23 6c |0 LDX #l| 00001b40 6f 63 6b 20 4d 4f 44 20 32 35 36 0d 20 20 32 37 |ock MOD 256. 27| 00001b50 30 20 20 20 20 20 20 20 20 20 4c 44 59 20 23 6c |0 LDY #l| 00001b60 6f 63 6b 20 44 49 56 20 32 35 36 0d 20 20 32 38 |ock DIV 256. 28| 00001b70 30 20 20 20 20 20 20 20 20 20 53 45 49 0d 20 20 |0 SEI. | 00001b80 32 39 30 20 20 20 20 20 20 20 20 20 53 54 58 20 |290 STX | 00001b90 65 76 65 6e 74 76 0d 20 20 33 30 30 20 20 20 20 |eventv. 300 | 00001ba0 20 20 20 20 20 53 54 59 20 65 76 65 6e 74 76 2b | STY eventv+| 00001bb0 31 0d 20 20 33 31 30 20 20 20 20 20 20 20 20 20 |1. 310 | 00001bc0 43 4c 49 0d 20 20 33 32 30 20 20 20 20 20 20 20 |CLI. 320 | 00001bd0 20 20 4c 44 41 20 23 31 34 0d 20 20 33 33 30 20 | LDA #14. 330 | 00001be0 20 20 20 20 20 20 20 20 4c 44 58 20 23 34 0d 20 | LDX #4. | 00001bf0 20 33 34 30 20 20 20 20 20 20 20 20 20 4a 53 52 | 340 JSR| 00001c00 20 6f 73 62 79 74 65 20 20 20 20 5c 20 45 6e 61 | osbyte \ Ena| 00001c10 62 6c 65 20 76 65 72 74 20 73 79 6e 63 20 65 76 |ble vert sync ev| 00001c20 65 6e 74 0d 20 20 33 35 30 20 20 20 20 20 20 20 |ent. 350 | 00001c30 20 20 52 54 53 0d 20 20 33 36 30 20 2e 6c 6f 63 | RTS. 360 .loc| 00001c40 6b 20 20 20 0d 20 20 33 37 30 20 20 20 20 20 20 |k . 370 | 00001c50 20 20 20 50 48 50 0d 20 20 33 38 30 20 20 20 20 | PHP. 380 | 00001c60 20 20 20 20 20 43 4d 50 20 23 34 0d 20 20 33 39 | CMP #4. 39| 00001c70 30 20 20 20 20 20 20 20 20 20 42 4e 45 20 6e 6f |0 BNE no| 00001c80 74 66 6f 75 72 0d 20 20 34 30 30 20 20 20 20 20 |tfour. 400 | 00001c90 20 20 20 20 50 48 41 20 0d 20 20 34 31 30 20 20 | PHA . 410 | 00001ca0 20 20 20 20 20 20 20 4c 44 41 20 26 33 43 41 20 | LDA &3CA | 00001cb0 0d 20 20 34 32 30 20 20 20 20 20 20 20 20 20 4f |. 420 O| 00001cc0 52 41 20 23 31 20 20 20 20 20 20 20 20 5c 20 41 |RA #1 \ A| 00001cd0 4e 44 20 23 26 46 45 20 74 6f 20 75 6e 6c 6f 63 |ND #&FE to unloc| 00001ce0 6b 0d 20 20 34 33 30 20 20 20 20 20 20 20 20 20 |k. 430 | 00001cf0 53 54 41 20 26 33 43 41 20 0d 20 20 34 34 30 20 |STA &3CA . 440 | 00001d00 20 20 20 20 20 20 20 20 50 4c 41 20 0d 20 20 34 | PLA . 4| 00001d10 35 30 20 2e 6e 6f 74 66 6f 75 72 0d 20 20 34 36 |50 .notfour. 46| 00001d20 30 20 20 20 20 20 20 20 20 20 50 4c 50 0d 20 20 |0 PLP. | 00001d30 34 37 30 20 20 20 20 20 20 20 20 20 52 54 53 20 |470 RTS | 00001d40 0d 20 20 34 38 30 20 5d 0d 20 20 34 39 30 20 4e |. 480 ]. 490 N| 00001d50 45 58 54 0d 20 20 35 30 30 20 49 4e 50 55 54 27 |EXT. 500 INPUT'| 00001d60 22 53 61 76 65 20 66 69 6c 65 6e 61 6d 65 3f 20 |"Save filename? | 00001d70 3d 20 22 66 69 6c 65 6e 61 6d 65 24 0d 20 20 35 |= "filename$. 5| 00001d80 31 30 20 49 46 20 66 69 6c 65 6e 61 6d 65 24 3d |10 IF filename$=| 00001d90 22 22 20 45 4e 44 0d 20 20 35 32 30 20 24 73 61 |"" END. 520 $sa| 00001da0 76 65 3d 22 53 41 56 45 20 22 2b 66 69 6c 65 6e |ve="SAVE "+filen| 00001db0 61 6d 65 24 2b 22 20 46 46 46 46 30 43 30 30 2b |ame$+" FFFF0C00+| 00001dc0 31 30 30 22 0d 20 20 35 33 30 20 58 25 3d 73 61 |100". 530 X%=sa| 00001dd0 76 65 20 4d 4f 44 20 32 35 36 0d 20 20 35 34 30 |ve MOD 256. 540| 00001de0 20 59 25 3d 73 61 76 65 20 44 49 56 20 32 35 36 | Y%=save DIV 256| 00001df0 0d 20 20 35 35 30 20 2a 4f 50 54 31 2c 32 0d 20 |. 550 *OPT1,2. | 00001e00 20 35 36 30 20 43 41 4c 4c 20 6f 73 63 6c 69 0d | 560 CALL oscli.| 00001e10 20 20 35 37 30 20 2a 4f 50 54 31 2c 30 0d 20 20 | 570 *OPT1,0. | 00001e20 35 38 30 20 45 4e 44 0d 20 20 35 39 30 20 44 45 |580 END. 590 DE| 00001e30 46 46 4e 65 71 75 73 28 73 74 72 69 6e 67 24 29 |FFNequs(string$)| 00001e40 0d 20 20 36 30 30 20 24 50 25 3d 73 74 72 69 6e |. 600 $P%=strin| 00001e50 67 24 0d 20 20 36 31 30 20 50 25 3d 50 25 2b 4c |g$. 610 P%=P%+L| 00001e60 45 4e 28 73 74 72 69 6e 67 24 29 0d 20 20 36 32 |EN(string$). 62| 00001e70 30 20 3d 70 61 73 73 0d 0d 0d 0d 0d 0d 20 20 54 |0 =pass...... T| 00001e80 68 65 20 6f 62 6a 65 63 74 20 63 6f 64 65 20 67 |he object code g| 00001e90 65 6e 65 72 61 74 65 64 20 62 79 20 4c 4f 43 4b |enerated by LOCK| 00001ea0 20 66 69 72 73 74 20 63 68 65 63 6b 73 20 74 6f | first checks to| 00001eb0 20 73 65 65 20 69 66 20 74 68 65 20 63 61 73 73 | see if the cass| 00001ec0 74 74 65 0d 66 69 6c 69 6e 67 20 73 79 73 74 65 |tte.filing syste| 00001ed0 6d 20 69 73 20 61 63 74 69 76 65 20 28 6c 69 6e |m is active (lin| 00001ee0 65 73 20 31 31 30 2d 31 36 30 29 2e 20 49 66 20 |es 110-160). If | 00001ef0 69 74 20 69 73 20 6e 6f 74 20 74 68 65 20 65 72 |it is not the er| 00001f00 72 6f 72 0d 72 6f 75 74 69 6e 65 20 28 6c 69 6e |ror.routine (lin| 00001f10 65 73 20 31 37 30 2d 32 30 30 29 20 68 61 6c 74 |es 170-200) halt| 00001f20 73 20 74 68 65 20 70 72 6f 67 72 61 6d 20 61 6e |s the program an| 00001f30 64 20 67 65 6e 65 72 61 74 65 73 20 61 6e 20 65 |d generates an e| 00001f40 72 72 6f 72 0d 6d 65 73 73 61 67 65 2e 20 54 68 |rror.message. Th| 00001f50 65 20 63 6f 6e 76 65 72 73 69 6f 6e 20 6f 66 20 |e conversion of | 00001f60 74 68 69 73 20 74 79 70 65 20 6f 66 20 65 72 72 |this type of err| 00001f70 6f 72 20 74 72 61 70 70 69 6e 67 20 69 6e 74 6f |or trapping into| 00001f80 20 53 57 52 20 66 6f 72 6d 61 74 0d 68 61 73 20 | SWR format.has | 00001f90 62 65 65 6e 20 65 78 70 6c 61 69 6e 65 64 20 69 |been explained i| 00001fa0 6e 20 4d 6f 64 75 6c 65 20 38 2e 0d 0d 20 20 54 |n Module 8... T| 00001fb0 68 65 20 70 72 6f 67 72 61 6d 20 64 69 73 61 62 |he program disab| 00001fc0 6c 65 73 20 74 68 65 20 73 74 61 72 74 20 6f 66 |les the start of| 00001fd0 20 76 65 72 74 69 63 61 6c 20 73 79 6e 63 20 65 | vertical sync e| 00001fe0 76 65 6e 74 20 28 6c 69 6e 65 73 0d 32 32 30 2d |vent (lines.220-| 00001ff0 32 35 30 29 2e 20 45 56 45 4e 54 56 20 69 73 20 |250). EVENTV is | 00002000 72 65 2d 76 65 63 74 6f 72 65 64 20 74 6f 20 70 |re-vectored to p| 00002010 6f 69 6e 74 20 74 6f 20 74 68 65 20 63 61 73 73 |oint to the cass| 00002020 65 74 74 65 20 6c 6f 63 6b 69 6e 67 0d 72 6f 75 |ette locking.rou| 00002030 74 69 6e 65 20 28 6c 69 6e 65 73 20 32 36 30 2d |tine (lines 260-| 00002040 33 31 30 29 20 61 6e 64 20 65 76 65 6e 74 20 6e |310) and event n| 00002050 75 6d 62 65 72 20 34 2c 20 74 68 65 20 73 74 61 |umber 4, the sta| 00002060 72 74 20 6f 66 20 76 65 72 74 69 63 61 6c 20 73 |rt of vertical s| 00002070 79 6e 63 0d 65 76 65 6e 74 2c 20 69 73 20 65 6e |ync.event, is en| 00002080 61 62 6c 65 64 20 28 6c 69 6e 65 73 20 33 32 30 |abled (lines 320| 00002090 2d 33 34 30 29 20 62 65 66 6f 72 65 20 72 65 74 |-340) before ret| 000020a0 75 72 6e 69 6e 67 20 28 6c 69 6e 65 20 33 35 30 |urning (line 350| 000020b0 29 2e 20 41 66 74 65 72 0d 70 6f 69 6e 74 69 6e |). After.pointin| 000020c0 67 20 45 56 45 4e 54 56 20 74 6f 20 74 68 65 20 |g EVENTV to the | 000020d0 72 6f 75 74 69 6e 65 20 73 74 61 72 74 69 6e 67 |routine starting| 000020e0 20 69 6e 20 6c 69 6e 65 20 33 36 30 20 61 6e 64 | in line 360 and| 000020f0 20 65 6e 61 62 6c 69 6e 67 20 74 68 65 0d 73 74 | enabling the.st| 00002100 61 72 74 20 6f 66 20 76 65 72 74 69 63 61 6c 20 |art of vertical | 00002110 73 79 6e 63 20 65 76 65 6e 74 2c 20 74 68 65 20 |sync event, the | 00002120 6c 6f 63 6b 69 6e 67 20 72 6f 75 74 69 6e 65 20 |locking routine | 00002130 28 6c 69 6e 65 73 20 33 36 30 2d 34 37 30 29 20 |(lines 360-470) | 00002140 77 69 6c 6c 0d 62 65 20 65 78 65 63 75 74 65 64 |will.be executed| 00002150 20 66 69 66 74 79 20 74 69 6d 65 73 20 61 20 73 | fifty times a s| 00002160 65 63 6f 6e 64 20 65 6e 73 75 72 69 6e 67 20 74 |econd ensuring t| 00002170 68 61 74 20 74 68 65 20 6c 65 61 73 74 20 73 69 |hat the least si| 00002180 67 6e 69 66 69 63 61 6e 74 0d 62 69 74 20 6f 66 |gnificant.bit of| 00002190 20 74 68 65 20 63 61 73 73 65 74 74 65 20 62 6c | the cassette bl| 000021a0 6f 63 6b 20 66 6c 61 67 20 62 79 74 65 20 69 73 |ock flag byte is| 000021b0 20 61 6c 77 61 79 73 20 73 65 74 2e 0d 0d 20 20 | always set... | 000021c0 57 68 65 6e 20 79 6f 75 20 2a 53 41 56 45 20 61 |When you *SAVE a| 000021d0 20 66 69 6c 65 20 77 69 74 68 20 6c 65 61 73 74 | file with least| 000021e0 20 73 69 67 6e 69 66 69 63 61 6e 74 20 62 69 74 | significant bit| 000021f0 20 6f 66 20 26 33 43 41 20 73 65 74 20 74 68 61 | of &3CA set tha| 00002200 74 0d 66 69 6c 65 20 77 69 6c 6c 20 62 65 20 6c |t.file will be l| 00002210 6f 63 6b 65 64 2e 20 41 66 74 65 72 20 2a 53 41 |ocked. After *SA| 00002220 56 45 69 6e 67 20 74 68 65 20 66 69 6c 65 20 62 |VEing the file b| 00002230 65 20 73 75 72 65 20 74 6f 20 70 72 65 73 73 20 |e sure to press | 00002240 74 68 65 0d 42 72 65 61 6b 20 6b 65 79 20 74 6f |the.Break key to| 00002250 20 72 65 73 65 74 20 61 6c 6c 20 74 68 65 20 76 | reset all the v| 00002260 65 63 74 6f 72 73 20 6f 72 20 74 79 70 65 20 2a |ectors or type *| 00002270 46 58 31 33 2c 34 20 74 6f 20 64 69 73 61 62 6c |FX13,4 to disabl| 00002280 65 20 74 68 65 0d 73 74 61 72 74 20 6f 66 20 76 |e the.start of v| 00002290 65 72 74 69 63 61 6c 20 73 79 6e 63 20 65 76 65 |ertical sync eve| 000022a0 6e 74 2e 20 49 66 20 79 6f 75 20 64 6f 6e 27 74 |nt. If you don't| 000022b0 20 79 6f 75 20 77 69 6c 6c 20 6c 6f 63 6b 20 65 | you will lock e| 000022c0 76 65 72 79 20 66 69 6c 65 0d 79 6f 75 20 73 61 |very file.you sa| 000022d0 76 65 20 61 6e 64 20 79 6f 75 20 77 69 6c 6c 20 |ve and you will | 000022e0 62 65 20 75 6e 61 62 6c 65 20 74 6f 20 6c 6f 61 |be unable to loa| 000022f0 64 20 61 6e 79 20 66 75 72 74 68 65 72 20 63 61 |d any further ca| 00002300 73 73 65 74 74 65 20 66 69 6c 65 73 2e 0d 0d 20 |ssette files... | 00002310 20 54 6f 20 63 6f 6e 76 65 72 74 20 4c 4f 43 4b | To convert LOCK| 00002320 20 69 6e 74 6f 20 73 69 64 65 77 61 79 73 20 72 | into sideways r| 00002330 61 6d 20 66 6f 72 6d 61 74 20 79 6f 75 20 6e 65 |am format you ne| 00002340 65 64 20 74 6f 20 61 64 64 20 61 20 73 75 69 74 |ed to add a suit| 00002350 61 62 6c 65 0d 68 65 61 64 65 72 2c 20 69 6e 74 |able.header, int| 00002360 65 72 70 72 65 74 65 72 2c 20 61 6e 64 20 65 72 |erpreter, and er| 00002370 72 6f 72 20 72 6f 75 74 69 6e 65 20 61 6c 6c 20 |ror routine all | 00002380 6f 66 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 |of which can be | 00002390 74 61 6b 65 6e 20 66 72 6f 6d 0d 74 68 65 20 65 |taken from.the e| 000023a0 61 72 6c 69 65 72 20 6d 6f 64 75 6c 65 73 20 6f |arlier modules o| 000023b0 66 20 74 68 69 73 20 63 6f 75 72 73 65 2e 20 59 |f this course. Y| 000023c0 6f 75 20 6d 75 73 74 20 61 6c 73 6f 20 72 65 70 |ou must also rep| 000023d0 6c 61 63 65 20 74 68 65 0d 72 65 2d 76 65 63 74 |lace the.re-vect| 000023e0 6f 72 69 6e 67 20 6f 66 20 45 56 45 4e 54 56 20 |oring of EVENTV | 000023f0 77 69 74 68 20 61 6e 20 65 78 74 65 6e 64 65 64 |with an extended| 00002400 20 76 65 63 74 6f 72 20 72 6f 75 74 69 6e 65 20 | vector routine | 00002410 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 0d 6f |similar to the.o| 00002420 6e 65 20 69 6c 6c 75 73 74 72 61 74 65 64 20 69 |ne illustrated i| 00002430 6e 20 66 69 67 75 72 65 20 31 30 2e 32 2e 20 54 |n figure 10.2. T| 00002440 68 65 73 65 20 6d 6f 64 69 66 69 63 61 74 69 6f |hese modificatio| 00002450 6e 73 20 68 61 76 65 20 62 65 65 6e 20 6d 61 64 |ns have been mad| 00002460 65 20 69 6e 0d 74 68 65 20 70 72 6f 67 72 61 6d |e in.the program| 00002470 20 56 45 43 54 4f 52 2e 20 54 6f 20 75 73 65 20 | VECTOR. To use | 00002480 56 45 43 54 4f 52 20 6c 6f 61 64 20 74 68 65 20 |VECTOR load the | 00002490 6f 62 6a 65 63 74 20 63 6f 64 65 20 69 74 20 67 |object code it g| 000024a0 65 6e 65 72 61 74 65 73 0d 69 6e 74 6f 20 53 57 |enerates.into SW| 000024b0 52 20 61 6e 64 20 70 72 65 73 73 20 74 68 65 20 |R and press the | 000024c0 42 72 65 61 6b 20 6b 65 79 2e 20 54 68 65 20 72 |Break key. The r| 000024d0 6f 75 74 69 6e 65 20 69 73 20 73 65 6c 65 63 74 |outine is select| 000024e0 65 64 20 62 79 20 74 79 70 69 6e 67 0d 2a 4c 4f |ed by typing.*LO| 000024f0 43 4b 20 4f 4e 20 61 6e 64 20 64 69 73 61 62 6c |CK ON and disabl| 00002500 65 64 20 62 79 20 74 79 70 69 6e 67 20 2a 4c 4f |ed by typing *LO| 00002510 43 4b 20 4f 46 46 2e 0d 0d 20 20 56 45 43 54 4f |CK OFF... VECTO| 00002520 52 20 75 73 65 73 20 74 68 65 20 66 61 6d 69 6c |R uses the famil| 00002530 69 61 72 20 6f 6e 65 2d 63 6f 6d 6d 61 6e 64 20 |iar one-command | 00002540 69 6e 74 65 72 70 72 65 74 65 72 20 66 72 6f 6d |interpreter from| 00002550 20 4d 6f 64 75 6c 65 20 33 0d 28 6c 69 6e 65 73 | Module 3.(lines| 00002560 20 33 32 30 2d 36 30 30 29 2c 20 61 72 67 75 6d | 320-600), argum| 00002570 65 6e 74 20 72 65 61 64 69 6e 67 20 72 6f 75 74 |ent reading rout| 00002580 69 6e 65 20 66 72 6f 6d 20 4d 6f 64 75 6c 65 20 |ine from Module | 00002590 35 20 28 6c 69 6e 65 73 0d 36 32 30 2d 37 36 30 |5 (lines.620-760| 000025a0 29 20 61 6e 64 20 65 72 72 6f 72 20 68 61 6e 64 |) and error hand| 000025b0 6c 65 72 20 66 72 6f 6d 20 4d 6f 64 75 6c 65 20 |ler from Module | 000025c0 38 20 28 6c 69 6e 65 73 20 31 36 31 30 2d 31 37 |8 (lines 1610-17| 000025d0 34 30 29 2e 20 0d 0d 20 20 49 66 20 74 68 65 20 |40). .. If the | 000025e0 63 6f 6d 6d 61 6e 64 20 2a 4c 4f 43 4b 20 4f 46 |command *LOCK OF| 000025f0 46 20 69 73 20 72 65 63 6f 67 6e 69 73 65 64 20 |F is recognised | 00002600 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 |by the interpret| 00002610 65 72 20 63 6f 6e 74 6f 6c 20 69 73 0d 70 61 73 |er contol is.pas| 00002620 73 65 64 20 74 6f 20 74 68 65 20 6c 61 62 65 6c |sed to the label| 00002630 20 22 2e 6c 6f 63 6b 6f 66 66 22 20 28 6c 69 6e | ".lockoff" (lin| 00002640 65 20 38 31 30 29 20 61 6e 64 20 74 68 65 20 73 |e 810) and the s| 00002650 74 61 72 74 20 6f 66 20 76 65 72 74 69 63 61 6c |tart of vertical| 00002660 0d 73 79 6e 63 20 65 76 65 6e 74 20 69 73 20 64 |.sync event is d| 00002670 69 73 61 62 6c 65 64 20 62 79 20 74 68 65 20 73 |isabled by the s| 00002680 75 62 72 6f 75 74 69 6e 65 20 65 76 65 6e 74 6f |ubroutine evento| 00002690 66 66 20 28 6c 69 6e 65 20 38 32 30 20 61 6e 64 |ff (line 820 and| 000026a0 20 6c 69 6e 65 73 0d 31 33 30 30 2d 31 33 34 30 | lines.1300-1340| 000026b0 29 20 62 65 66 6f 72 65 20 72 65 74 75 72 6e 69 |) before returni| 000026c0 6e 67 20 74 6f 20 74 68 65 20 4d 4f 53 20 28 6c |ng to the MOS (l| 000026d0 69 6e 65 20 38 33 30 29 2e 20 49 66 20 74 68 65 |ine 830). If the| 000026e0 20 63 6f 6d 6d 61 6e 64 0d 2a 4c 4f 43 4b 20 4f | command.*LOCK O| 000026f0 4e 20 69 73 20 72 65 63 6f 67 6e 69 73 65 64 20 |N is recognised | 00002700 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 |by the interpret| 00002710 65 72 20 63 6f 6e 74 72 6f 6c 20 70 61 73 73 65 |er control passe| 00002720 73 20 74 6f 20 74 68 65 20 6c 61 62 65 6c 0d 22 |s to the label."| 00002730 2e 6c 6f 63 6b 69 74 22 20 28 6c 69 6e 65 20 38 |.lockit" (line 8| 00002740 34 30 29 2e 0d 0d 20 20 54 68 65 20 70 72 6f 67 |40)... The prog| 00002750 72 61 6d 20 66 69 72 73 74 20 6d 61 6b 65 73 20 |ram first makes | 00002760 73 75 72 65 20 74 68 61 74 20 74 68 65 20 63 61 |sure that the ca| 00002770 73 73 65 74 74 65 20 66 69 6c 69 6e 67 20 73 79 |ssette filing sy| 00002780 73 74 65 6d 20 69 73 0d 61 63 74 69 76 65 20 28 |stem is.active (| 00002790 6c 69 6e 65 73 20 38 35 30 2d 39 30 30 29 2e 20 |lines 850-900). | 000027a0 49 66 20 74 68 65 20 43 46 53 20 69 73 20 61 63 |If the CFS is ac| 000027b0 74 69 76 65 20 69 74 20 64 69 73 61 62 6c 65 73 |tive it disables| 000027c0 20 74 68 65 20 73 74 61 72 74 20 6f 66 0d 76 65 | the start of.ve| 000027d0 72 74 69 63 61 6c 20 73 79 6e 63 20 65 76 65 6e |rtical sync even| 000027e0 74 20 28 6c 69 6e 65 20 39 35 30 20 61 6e 64 20 |t (line 950 and | 000027f0 6c 69 6e 65 73 20 31 33 30 30 2d 31 33 34 30 29 |lines 1300-1340)| 00002800 20 61 6e 64 20 66 69 6e 64 73 20 74 68 65 20 73 | and finds the s| 00002810 74 61 72 74 0d 6f 66 20 74 68 65 20 65 78 74 65 |tart.of the exte| 00002820 6e 64 65 64 20 76 65 63 74 6f 72 20 73 70 61 63 |nded vector spac| 00002830 65 20 28 6c 69 6e 65 73 20 39 36 30 2d 39 39 30 |e (lines 960-990| 00002840 29 2c 20 74 68 65 20 61 64 64 72 65 73 73 20 6f |), the address o| 00002850 66 20 77 68 69 63 68 20 69 73 0d 73 74 6f 72 65 |f which is.store| 00002860 64 20 69 6e 20 74 77 6f 20 63 6f 6e 73 65 63 75 |d in two consecu| 00002870 74 69 76 65 20 7a 65 72 6f 20 70 61 67 65 20 62 |tive zero page b| 00002880 79 74 65 73 20 28 6c 69 6e 65 73 20 31 30 30 30 |ytes (lines 1000| 00002890 2d 31 30 31 30 29 2e 20 54 68 65 20 59 0d 72 65 |-1010). The Y.re| 000028a0 67 69 73 74 65 72 20 69 73 20 6c 6f 61 64 65 64 |gister is loaded| 000028b0 20 77 69 74 68 20 74 68 65 20 65 76 65 6e 74 20 | with the event | 000028c0 76 65 63 74 6f 72 20 73 70 61 63 65 20 6f 66 66 |vector space off| 000028d0 73 65 74 20 28 6c 69 6e 65 20 31 30 32 30 29 20 |set (line 1020) | 000028e0 61 6e 64 0d 74 68 65 20 61 64 64 72 65 73 73 20 |and.the address | 000028f0 6f 66 20 74 68 65 20 6e 65 77 20 72 6f 75 74 69 |of the new routi| 00002900 6e 65 20 61 6e 64 20 74 68 65 20 72 6f 6d 20 6e |ne and the rom n| 00002910 75 6d 62 65 72 20 61 72 65 20 73 74 6f 72 65 64 |umber are stored| 00002920 20 69 6e 20 74 68 65 0d 65 78 74 65 6e 64 65 64 | in the.extended| 00002930 20 76 65 63 74 6f 72 20 73 70 61 63 65 20 28 6c | vector space (l| 00002940 69 6e 65 73 20 31 30 32 30 2d 31 31 30 30 29 2e |ines 1020-1100).| 00002950 20 45 56 45 4e 54 56 20 69 73 20 72 65 2d 76 65 | EVENTV is re-ve| 00002960 63 74 6f 72 65 64 20 74 6f 0d 70 6f 69 6e 74 20 |ctored to.point | 00002970 74 6f 20 74 68 65 20 65 78 74 65 6e 64 65 64 20 |to the extended | 00002980 76 65 63 74 6f 72 20 65 6e 74 72 79 20 70 6f 69 |vector entry poi| 00002990 6e 74 20 28 6c 69 6e 65 73 20 31 31 31 30 2d 31 |nt (lines 1110-1| 000029a0 31 36 30 29 2e 20 45 76 65 6e 74 0d 6e 75 6d 62 |160). Event.numb| 000029b0 65 72 20 34 2c 20 74 68 65 20 73 74 61 72 74 20 |er 4, the start | 000029c0 6f 66 20 76 65 72 74 69 63 61 6c 20 73 79 6e 63 |of vertical sync| 000029d0 20 65 76 65 6e 74 2c 20 69 73 20 65 6e 61 62 6c | event, is enabl| 000029e0 65 64 20 28 6c 69 6e 65 73 0d 31 31 37 30 2d 31 |ed (lines.1170-1| 000029f0 31 39 30 29 20 62 65 66 6f 72 65 20 72 65 73 74 |190) before rest| 00002a00 6f 72 69 6e 67 20 74 68 65 20 7a 65 72 6f 20 70 |oring the zero p| 00002a10 61 67 65 20 6d 65 6d 6f 72 79 20 6c 6f 63 61 74 |age memory locat| 00002a20 69 6f 6e 73 20 28 6c 69 6e 65 73 0d 31 32 31 30 |ions (lines.1210| 00002a30 2d 31 32 34 30 29 2c 20 62 61 6c 61 6e 63 69 6e |-1240), balancin| 00002a40 67 20 74 68 65 20 73 74 61 63 6b 20 28 6c 69 6e |g the stack (lin| 00002a50 65 73 20 31 32 35 30 2d 31 32 37 30 29 20 61 6e |es 1250-1270) an| 00002a60 64 20 72 65 74 75 72 6e 69 6e 67 20 74 6f 20 74 |d returning to t| 00002a70 68 65 0d 4d 4f 53 20 77 69 74 68 20 74 68 65 20 |he.MOS with the | 00002a80 61 63 63 75 6d 75 6c 61 74 6f 72 20 72 65 73 65 |accumulator rese| 00002a90 74 20 74 6f 20 7a 65 72 6f 20 28 6c 69 6e 65 73 |t to zero (lines| 00002aa0 20 31 32 38 30 2d 31 32 39 30 29 2e 0d 0d 20 20 | 1280-1290)... | 00002ab0 4f 6e 65 20 6f 66 20 74 68 65 20 6d 6f 73 74 20 |One of the most | 00002ac0 69 6d 70 6f 72 74 61 6e 74 20 74 68 69 6e 67 73 |important things| 00002ad0 20 74 6f 20 6e 6f 74 69 63 65 20 66 72 6f 6d 20 | to notice from | 00002ae0 74 68 69 73 20 63 6f 6e 76 65 72 73 69 6f 6e 20 |this conversion | 00002af0 69 73 0d 74 68 61 74 20 74 68 65 20 76 65 63 74 |is.that the vect| 00002b00 6f 72 65 64 20 72 6f 75 74 69 6e 65 20 77 68 69 |ored routine whi| 00002b10 63 68 20 73 65 74 73 20 74 68 65 20 6c 65 61 73 |ch sets the leas| 00002b20 74 20 73 69 67 6e 69 66 69 63 61 6e 74 20 62 69 |t significant bi| 00002b30 74 20 6f 66 20 74 68 65 0d 63 61 73 73 65 74 74 |t of the.cassett| 00002b40 65 20 62 6c 6f 63 6b 20 66 6c 61 67 20 62 79 74 |e block flag byt| 00002b50 65 20 69 6e 20 74 68 65 20 70 72 6f 67 72 61 6d |e in the program| 00002b60 20 4c 4f 43 4b 20 28 6c 69 6e 65 73 20 33 36 30 | LOCK (lines 360| 00002b70 2d 34 37 30 29 20 68 61 73 20 6e 6f 74 0d 62 65 |-470) has not.be| 00002b80 65 6e 20 61 6c 74 65 72 65 64 20 61 74 20 61 6c |en altered at al| 00002b90 6c 20 69 6e 20 74 68 65 20 70 72 6f 67 72 61 6d |l in the program| 00002ba0 20 56 45 43 54 4f 52 20 28 6c 69 6e 65 73 20 31 | VECTOR (lines 1| 00002bb0 33 35 30 2d 31 34 36 30 29 2e 20 41 6c 6c 20 74 |350-1460). All t| 00002bc0 68 65 0d 6d 6f 64 69 66 69 63 61 74 69 6f 6e 73 |he.modifications| 00002bd0 20 6e 65 65 64 65 64 20 74 6f 20 72 65 2d 76 65 | needed to re-ve| 00002be0 63 74 6f 72 20 74 68 65 20 72 6f 75 74 69 6e 65 |ctor the routine| 00002bf0 20 74 6f 20 77 6f 72 6b 20 66 72 6f 6d 20 53 57 | to work from SW| 00002c00 52 20 61 72 65 0d 64 6f 6e 65 20 74 6f 20 74 68 |R are.done to th| 00002c10 65 20 65 78 74 65 6e 64 65 64 20 76 65 63 74 6f |e extended vecto| 00002c20 72 20 73 70 61 63 65 2c 20 74 68 65 20 65 78 74 |r space, the ext| 00002c30 65 6e 64 65 64 20 76 65 63 74 6f 72 20 65 6e 74 |ended vector ent| 00002c40 72 79 20 70 6f 69 6e 74 20 61 6e 64 0d 74 68 65 |ry point and.the| 00002c50 20 76 65 63 74 6f 72 2e 0d 0d 0d 0d 0d 0d 0d 20 | vector........ | 00002c60 20 20 31 30 20 52 45 4d 3a 20 56 45 43 54 4f 52 | 10 REM: VECTOR| 00002c70 0d 20 20 20 32 30 20 4d 4f 44 45 37 0d 20 20 20 |. 20 MODE7. | 00002c80 33 30 20 48 49 4d 45 4d 3d 26 33 43 30 30 0d 20 |30 HIMEM=&3C00. | 00002c90 20 20 34 30 20 44 49 4d 20 73 61 76 65 20 35 30 | 40 DIM save 50| 00002ca0 0d 20 20 20 35 30 20 64 69 66 66 3d 26 38 30 30 |. 50 diff=&800| 00002cb0 30 2d 48 49 4d 45 4d 0d 20 20 20 36 30 20 61 64 |0-HIMEM. 60 ad| 00002cc0 64 72 65 73 73 3d 26 37 30 0d 20 20 20 37 30 20 |dress=&70. 70 | 00002cd0 63 6f 6d 76 65 63 3d 26 46 32 0d 20 20 20 38 30 |comvec=&F2. 80| 00002ce0 20 72 6f 6d 6e 75 6d 62 65 72 3d 26 46 34 0d 20 | romnumber=&F4. | 00002cf0 20 20 39 30 20 65 72 72 73 74 61 63 6b 3d 26 31 | 90 errstack=&1| 00002d00 30 30 0d 20 20 31 30 30 20 65 76 65 6e 74 76 3d |00. 100 eventv=| 00002d10 26 32 32 30 0d 20 20 31 31 30 20 67 73 69 6e 69 |&220. 110 gsini| 00002d20 74 3d 26 46 46 43 32 0d 20 20 31 32 30 20 67 73 |t=&FFC2. 120 gs| 00002d30 72 65 61 64 3d 26 46 46 43 35 0d 20 20 31 33 30 |read=&FFC5. 130| 00002d40 20 6f 73 61 72 67 73 3d 26 46 46 44 41 0d 20 20 | osargs=&FFDA. | 00002d50 31 34 30 20 6f 73 62 79 74 65 3d 26 46 46 46 34 |140 osbyte=&FFF4| 00002d60 0d 20 20 31 35 30 20 6f 73 63 6c 69 3d 26 46 46 |. 150 oscli=&FF| 00002d70 46 37 0d 20 20 31 36 30 20 46 4f 52 20 70 61 73 |F7. 160 FOR pas| 00002d80 73 20 3d 20 30 20 54 4f 20 32 20 53 54 45 50 20 |s = 0 TO 2 STEP | 00002d90 32 0d 20 20 31 37 30 20 50 25 3d 48 49 4d 45 4d |2. 170 P%=HIMEM| 00002da0 0d 20 20 31 38 30 20 5b 20 20 20 20 20 20 20 4f |. 180 [ O| 00002db0 50 54 20 70 61 73 73 0d 20 20 31 39 30 20 20 20 |PT pass. 190 | 00002dc0 20 20 20 20 20 20 42 52 4b 0d 20 20 32 30 30 20 | BRK. 200 | 00002dd0 20 20 20 20 20 20 20 20 42 52 4b 0d 20 20 32 31 | BRK. 21| 00002de0 30 20 20 20 20 20 20 20 20 20 42 52 4b 0d 20 20 |0 BRK. | 00002df0 32 32 30 20 20 20 20 20 20 20 20 20 4a 4d 50 20 |220 JMP | 00002e00 73 65 72 76 69 63 65 2b 64 69 66 66 0d 20 20 32 |service+diff. 2| 00002e10 33 30 20 20 20 20 20 20 20 20 20 4f 50 54 20 46 |30 OPT F| 00002e20 4e 65 71 75 62 28 26 38 32 29 0d 20 20 32 34 30 |Nequb(&82). 240| 00002e30 20 20 20 20 20 20 20 20 20 4f 50 54 20 46 4e 65 | OPT FNe| 00002e40 71 75 62 28 28 63 6f 70 79 72 69 67 68 74 2b 64 |qub((copyright+d| 00002e50 69 66 66 29 20 4d 4f 44 20 32 35 36 29 0d 20 20 |iff) MOD 256). | 00002e60 32 35 30 20 20 20 20 20 20 20 20 20 42 52 4b 0d |250 BRK.| 00002e70 20 20 32 36 30 20 2e 74 69 74 6c 65 0d 20 20 32 | 260 .title. 2| 00002e80 37 30 20 20 20 20 20 20 20 20 20 4f 50 54 20 46 |70 OPT F| 00002e90 4e 65 71 75 73 28 22 4c 4f 43 4b 22 29 0d 20 20 |Nequs("LOCK"). | 00002ea0 32 38 30 20 2e 63 6f 70 79 72 69 67 68 74 0d 20 |280 .copyright. | 00002eb0 20 32 39 30 20 20 20 20 20 20 20 20 20 42 52 4b | 290 BRK| 00002ec0 0d 20 20 33 30 30 20 20 20 20 20 20 20 20 20 4f |. 300 O| 00002ed0 50 54 20 46 4e 65 71 75 73 28 22 28 43 29 20 47 |PT FNequs("(C) G| 00002ee0 6f 72 64 6f 6e 20 48 6f 72 73 69 6e 67 74 6f 6e |ordon Horsington| 00002ef0 20 31 39 38 37 22 29 0d 20 20 33 31 30 20 20 20 | 1987"). 310 | 00002f00 20 20 20 20 20 20 42 52 4b 0d 20 20 33 32 30 20 | BRK. 320 | 00002f10 2e 73 65 72 76 69 63 65 0d 20 20 33 33 30 20 20 |.service. 330 | 00002f20 20 20 20 20 20 20 20 43 4d 50 20 23 34 0d 20 20 | CMP #4. | 00002f30 33 34 30 20 20 20 20 20 20 20 20 20 42 45 51 20 |340 BEQ | 00002f40 75 6e 72 65 63 6f 67 6e 69 73 65 64 0d 20 20 33 |unrecognised. 3| 00002f50 35 30 20 2e 65 78 69 74 0d 20 20 33 36 30 20 20 |50 .exit. 360 | 00002f60 20 20 20 20 20 20 20 52 54 53 0d 20 20 33 37 30 | RTS. 370| 00002f70 20 2e 75 6e 72 65 63 6f 67 6e 69 73 65 64 0d 20 | .unrecognised. | 00002f80 20 33 38 30 20 20 20 20 20 20 20 20 20 50 48 41 | 380 PHA| 00002f90 0d 20 20 33 39 30 20 20 20 20 20 20 20 20 20 54 |. 390 T| 00002fa0 58 41 0d 20 20 34 30 30 20 20 20 20 20 20 20 20 |XA. 400 | 00002fb0 20 50 48 41 0d 20 20 34 31 30 20 20 20 20 20 20 | PHA. 410 | 00002fc0 20 20 20 54 59 41 0d 20 20 34 32 30 20 20 20 20 | TYA. 420 | 00002fd0 20 20 20 20 20 50 48 41 0d 20 20 34 33 30 20 20 | PHA. 430 | 00002fe0 20 20 20 20 20 20 20 4c 44 58 20 23 26 46 46 0d | LDX #&FF.| 00002ff0 20 20 34 34 30 20 2e 63 6f 6d 6c 6f 6f 70 0d 20 | 440 .comloop. | 00003000 20 34 35 30 20 20 20 20 20 20 20 20 20 49 4e 58 | 450 INX| 00003010 0d 20 20 34 36 30 20 20 20 20 20 20 20 20 20 4c |. 460 L| 00003020 44 41 20 74 69 74 6c 65 2b 64 69 66 66 2c 58 0d |DA title+diff,X.| 00003030 20 20 34 37 30 20 20 20 20 20 20 20 20 20 42 45 | 470 BE| 00003040 51 20 66 6f 75 6e 64 0d 20 20 34 38 30 20 20 20 |Q found. 480 | 00003050 20 20 20 20 20 20 4c 44 41 20 28 63 6f 6d 76 65 | LDA (comve| 00003060 63 29 2c 59 0d 20 20 34 39 30 20 20 20 20 20 20 |c),Y. 490 | 00003070 20 20 20 49 4e 59 0d 20 20 35 30 30 20 20 20 20 | INY. 500 | 00003080 20 20 20 20 20 43 4d 50 20 23 41 53 43 28 22 2e | CMP #ASC(".| 00003090 22 29 0d 20 20 35 31 30 20 20 20 20 20 20 20 20 |"). 510 | 000030a0 20 42 45 51 20 66 6f 75 6e 64 0d 20 20 35 32 30 | BEQ found. 520| 000030b0 20 20 20 20 20 20 20 20 20 41 4e 44 20 23 26 44 | AND #&D| 000030c0 46 0d 20 20 35 33 30 20 20 20 20 20 20 20 20 20 |F. 530 | 000030d0 43 4d 50 20 74 69 74 6c 65 2b 64 69 66 66 2c 58 |CMP title+diff,X| 000030e0 0d 20 20 35 34 30 20 20 20 20 20 20 20 20 20 42 |. 540 B| 000030f0 45 51 20 63 6f 6d 6c 6f 6f 70 0d 20 20 35 35 30 |EQ comloop. 550| 00003100 20 20 20 20 20 20 20 20 20 50 4c 41 0d 20 20 35 | PLA. 5| 00003110 36 30 20 20 20 20 20 20 20 20 20 54 41 59 0d 20 |60 TAY. | 00003120 20 35 37 30 20 20 20 20 20 20 20 20 20 50 4c 41 | 570 PLA| 00003130 0d 20 20 35 38 30 20 20 20 20 20 20 20 20 20 54 |. 580 T| 00003140 41 58 0d 20 20 35 39 30 20 20 20 20 20 20 20 20 |AX. 590 | 00003150 20 50 4c 41 0d 20 20 36 30 30 20 20 20 20 20 20 | PLA. 600 | 00003160 20 20 20 52 54 53 0d 20 20 36 31 30 20 2e 66 6f | RTS. 610 .fo| 00003170 75 6e 64 0d 20 20 36 32 30 20 20 20 20 20 20 20 |und. 620 | 00003180 20 20 53 45 43 0d 20 20 36 33 30 20 20 20 20 20 | SEC. 630 | 00003190 20 20 20 20 4a 53 52 20 67 73 69 6e 69 74 0d 20 | JSR gsinit. | 000031a0 20 36 34 30 20 20 20 20 20 20 20 20 20 4c 44 41 | 640 LDA| 000031b0 20 61 64 64 72 65 73 73 0d 20 20 36 35 30 20 20 | address. 650 | 000031c0 20 20 20 20 20 20 20 50 48 41 0d 20 20 36 36 30 | PHA. 660| 000031d0 20 20 20 20 20 20 20 20 20 4c 44 41 20 61 64 64 | LDA add| 000031e0 72 65 73 73 2b 31 0d 20 20 36 37 30 20 20 20 20 |ress+1. 670 | 000031f0 20 20 20 20 20 50 48 41 0d 20 20 36 38 30 20 20 | PHA. 680 | 00003200 20 20 20 20 20 20 20 4a 53 52 20 67 73 72 65 61 | JSR gsrea| 00003210 64 0d 20 20 36 39 30 20 20 20 20 20 20 20 20 20 |d. 690 | 00003220 42 43 53 20 6d 69 73 74 61 6b 65 0d 20 20 37 30 |BCS mistake. 70| 00003230 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 67 73 |0 JSR gs| 00003240 72 65 61 64 0d 20 20 37 31 30 20 20 20 20 20 20 |read. 710 | 00003250 20 20 20 42 43 53 20 6d 69 73 74 61 6b 65 0d 20 | BCS mistake. | 00003260 20 37 32 30 20 20 20 20 20 20 20 20 20 41 4e 44 | 720 AND| 00003270 20 23 26 44 46 20 0d 20 20 37 33 30 20 20 20 20 | #&DF . 730 | 00003280 20 20 20 20 20 43 4d 50 20 23 41 53 43 28 22 46 | CMP #ASC("F| 00003290 22 29 0d 20 20 37 34 30 20 20 20 20 20 20 20 20 |"). 740 | 000032a0 20 42 45 51 20 6c 6f 63 6b 6f 66 66 0d 20 20 37 | BEQ lockoff. 7| 000032b0 35 30 20 20 20 20 20 20 20 20 20 43 4d 50 20 23 |50 CMP #| 000032c0 41 53 43 28 22 4e 22 29 0d 20 20 37 36 30 20 20 |ASC("N"). 760 | 000032d0 20 20 20 20 20 20 20 42 45 51 20 6c 6f 63 6b 69 | BEQ locki| 000032e0 74 0d 20 20 37 37 30 20 2e 6d 69 73 74 61 6b 65 |t. 770 .mistake| 000032f0 0d 20 20 37 38 30 20 20 20 20 20 20 20 20 20 4c |. 780 L| 00003300 44 58 20 23 28 73 79 6e 74 61 78 2b 64 69 66 66 |DX #(syntax+diff| 00003310 29 20 4d 4f 44 20 32 35 36 0d 20 20 37 39 30 20 |) MOD 256. 790 | 00003320 20 20 20 20 20 20 20 20 4c 44 59 20 23 28 73 79 | LDY #(sy| 00003330 6e 74 61 78 2b 64 69 66 66 29 20 44 49 56 20 32 |ntax+diff) DIV 2| 00003340 35 36 0d 20 20 38 30 30 20 20 20 20 20 20 20 20 |56. 800 | 00003350 20 4a 4d 50 20 65 72 72 6f 72 2b 64 69 66 66 0d | JMP error+diff.| 00003360 20 20 38 31 30 20 2e 6c 6f 63 6b 6f 66 66 0d 20 | 810 .lockoff. | 00003370 20 38 32 30 20 20 20 20 20 20 20 20 20 4a 53 52 | 820 JSR| 00003380 20 65 76 65 6e 74 6f 66 66 2b 64 69 66 66 0d 20 | eventoff+diff. | 00003390 20 38 33 30 20 20 20 20 20 20 20 20 20 4a 4d 50 | 830 JMP| 000033a0 20 71 75 69 74 2b 64 69 66 66 0d 20 20 38 34 30 | quit+diff. 840| 000033b0 20 2e 6c 6f 63 6b 69 74 20 0d 20 20 38 35 30 20 | .lockit . 850 | 000033c0 20 20 20 20 20 20 20 20 4c 44 41 20 23 30 20 0d | LDA #0 .| 000033d0 20 20 38 36 30 20 20 20 20 20 20 20 20 20 54 41 | 860 TA| 000033e0 58 20 0d 20 20 38 37 30 20 20 20 20 20 20 20 20 |X . 870 | 000033f0 20 54 41 59 20 0d 20 20 38 38 30 20 20 20 20 20 | TAY . 880 | 00003400 20 20 20 20 4a 53 52 20 6f 73 61 72 67 73 0d 20 | JSR osargs. | 00003410 20 38 39 30 20 20 20 20 20 20 20 20 20 43 4d 50 | 890 CMP| 00003420 20 23 33 20 0d 20 20 39 30 30 20 20 20 20 20 20 | #3 . 900 | 00003430 20 20 20 42 43 43 20 74 61 70 65 0d 20 20 39 31 | BCC tape. 91| 00003440 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 23 28 |0 LDX #(| 00003450 63 66 73 2b 64 69 66 66 29 20 4d 4f 44 20 32 35 |cfs+diff) MOD 25| 00003460 36 0d 20 20 39 32 30 20 20 20 20 20 20 20 20 20 |6. 920 | 00003470 4c 44 59 20 23 28 63 66 73 2b 64 69 66 66 29 20 |LDY #(cfs+diff) | 00003480 44 49 56 20 32 35 36 0d 20 20 39 33 30 20 20 20 |DIV 256. 930 | 00003490 20 20 20 20 20 20 4a 4d 50 20 65 72 72 6f 72 2b | JMP error+| 000034a0 64 69 66 66 0d 20 20 39 34 30 20 2e 74 61 70 65 |diff. 940 .tape| 000034b0 0d 20 20 39 35 30 20 20 20 20 20 20 20 20 20 4a |. 950 J| 000034c0 53 52 20 65 76 65 6e 74 6f 66 66 2b 64 69 66 66 |SR eventoff+diff| 000034d0 0d 20 20 39 36 30 20 20 20 20 20 20 20 20 20 4c |. 960 L| 000034e0 44 41 20 23 26 41 38 0d 20 20 39 37 30 20 20 20 |DA #&A8. 970 | 000034f0 20 20 20 20 20 20 4c 44 58 20 23 30 20 0d 20 20 | LDX #0 . | 00003500 39 38 30 20 20 20 20 20 20 20 20 20 4c 44 59 20 |980 LDY | 00003510 23 26 46 46 20 0d 20 20 39 39 30 20 20 20 20 20 |#&FF . 990 | 00003520 20 20 20 20 4a 53 52 20 6f 73 62 79 74 65 0d 20 | JSR osbyte. | 00003530 31 30 30 30 20 20 20 20 20 20 20 20 20 53 54 58 |1000 STX| 00003540 20 61 64 64 72 65 73 73 0d 20 31 30 31 30 20 20 | address. 1010 | 00003550 20 20 20 20 20 20 20 53 54 59 20 61 64 64 72 65 | STY addre| 00003560 73 73 2b 31 0d 20 31 30 32 30 20 20 20 20 20 20 |ss+1. 1020 | 00003570 20 20 20 4c 44 59 20 23 26 33 30 20 0d 20 31 30 | LDY #&30 . 10| 00003580 33 30 20 20 20 20 20 20 20 20 20 4c 44 41 20 23 |30 LDA #| 00003590 28 6c 6f 63 6b 2b 64 69 66 66 29 20 4d 4f 44 20 |(lock+diff) MOD | 000035a0 32 35 36 20 0d 20 31 30 34 30 20 20 20 20 20 20 |256 . 1040 | 000035b0 20 20 20 53 54 41 20 28 61 64 64 72 65 73 73 29 | STA (address)| 000035c0 2c 59 0d 20 31 30 35 30 20 20 20 20 20 20 20 20 |,Y. 1050 | 000035d0 20 49 4e 59 20 0d 20 31 30 36 30 20 20 20 20 20 | INY . 1060 | 000035e0 20 20 20 20 4c 44 41 20 23 28 6c 6f 63 6b 2b 64 | LDA #(lock+d| 000035f0 69 66 66 29 20 44 49 56 20 32 35 36 20 0d 20 31 |iff) DIV 256 . 1| 00003600 30 37 30 20 20 20 20 20 20 20 20 20 53 54 41 20 |070 STA | 00003610 28 61 64 64 72 65 73 73 29 2c 59 0d 20 31 30 38 |(address),Y. 108| 00003620 30 20 20 20 20 20 20 20 20 20 49 4e 59 20 0d 20 |0 INY . | 00003630 31 30 39 30 20 20 20 20 20 20 20 20 20 4c 44 41 |1090 LDA| 00003640 20 72 6f 6d 6e 75 6d 62 65 72 0d 20 31 31 30 30 | romnumber. 1100| 00003650 20 20 20 20 20 20 20 20 20 53 54 41 20 28 61 64 | STA (ad| 00003660 64 72 65 73 73 29 2c 59 0d 20 31 31 31 30 20 20 |dress),Y. 1110 | 00003670 20 20 20 20 20 20 20 4c 44 58 20 23 26 33 30 0d | LDX #&30.| 00003680 20 31 31 32 30 20 20 20 20 20 20 20 20 20 4c 44 | 1120 LD| 00003690 59 20 23 26 46 46 0d 20 31 31 33 30 20 20 20 20 |Y #&FF. 1130 | 000036a0 20 20 20 20 20 53 45 49 0d 20 31 31 34 30 20 20 | SEI. 1140 | 000036b0 20 20 20 20 20 20 20 53 54 58 20 65 76 65 6e 74 | STX event| 000036c0 76 0d 20 31 31 35 30 20 20 20 20 20 20 20 20 20 |v. 1150 | 000036d0 53 54 59 20 65 76 65 6e 74 76 2b 31 0d 20 31 31 |STY eventv+1. 11| 000036e0 36 30 20 20 20 20 20 20 20 20 20 43 4c 49 0d 20 |60 CLI. | 000036f0 31 31 37 30 20 20 20 20 20 20 20 20 20 4c 44 41 |1170 LDA| 00003700 20 23 31 34 20 0d 20 31 31 38 30 20 20 20 20 20 | #14 . 1180 | 00003710 20 20 20 20 4c 44 58 20 23 34 20 0d 20 31 31 39 | LDX #4 . 119| 00003720 30 20 20 20 20 20 20 20 20 20 4a 53 52 20 6f 73 |0 JSR os| 00003730 62 79 74 65 0d 20 31 32 30 30 20 2e 71 75 69 74 |byte. 1200 .quit| 00003740 0d 20 31 32 31 30 20 20 20 20 20 20 20 20 20 50 |. 1210 P| 00003750 4c 41 0d 20 31 32 32 30 20 20 20 20 20 20 20 20 |LA. 1220 | 00003760 20 53 54 41 20 61 64 64 72 65 73 73 2b 31 0d 20 | STA address+1. | 00003770 31 32 33 30 20 20 20 20 20 20 20 20 20 50 4c 41 |1230 PLA| 00003780 0d 20 31 32 34 30 20 20 20 20 20 20 20 20 20 53 |. 1240 S| 00003790 54 41 20 61 64 64 72 65 73 73 0d 20 31 32 35 30 |TA address. 1250| 000037a0 20 20 20 20 20 20 20 20 20 50 4c 41 0d 20 31 32 | PLA. 12| 000037b0 36 30 20 20 20 20 20 20 20 20 20 50 4c 41 0d 20 |60 PLA. | 000037c0 31 32 37 30 20 20 20 20 20 20 20 20 20 50 4c 41 |1270 PLA| 000037d0 0d 20 31 32 38 30 20 20 20 20 20 20 20 20 20 4c |. 1280 L| 000037e0 44 41 20 23 30 0d 20 31 32 39 30 20 20 20 20 20 |DA #0. 1290 | 000037f0 20 20 20 20 52 54 53 0d 20 31 33 30 30 20 2e 65 | RTS. 1300 .e| 00003800 76 65 6e 74 6f 66 66 0d 20 31 33 31 30 20 20 20 |ventoff. 1310 | 00003810 20 20 20 20 20 20 4c 44 41 20 23 31 33 0d 20 31 | LDA #13. 1| 00003820 33 32 30 20 20 20 20 20 20 20 20 20 4c 44 58 20 |320 LDX | 00003830 23 34 0d 20 31 33 33 30 20 20 20 20 20 20 20 20 |#4. 1330 | 00003840 20 4c 44 59 20 23 30 0d 20 31 33 34 30 20 20 20 | LDY #0. 1340 | 00003850 20 20 20 20 20 20 4a 4d 50 20 6f 73 62 79 74 65 | JMP osbyte| 00003860 0d 20 31 33 35 30 20 2e 6c 6f 63 6b 20 20 20 0d |. 1350 .lock .| 00003870 20 31 33 36 30 20 20 20 20 20 20 20 20 20 50 48 | 1360 PH| 00003880 50 0d 20 31 33 37 30 20 20 20 20 20 20 20 20 20 |P. 1370 | 00003890 43 4d 50 20 23 34 0d 20 31 33 38 30 20 20 20 20 |CMP #4. 1380 | 000038a0 20 20 20 20 20 42 4e 45 20 6e 6f 74 66 6f 75 72 | BNE notfour| 000038b0 0d 20 31 33 39 30 20 20 20 20 20 20 20 20 20 50 |. 1390 P| 000038c0 48 41 20 0d 20 31 34 30 30 20 20 20 20 20 20 20 |HA . 1400 | 000038d0 20 20 4c 44 41 20 26 33 43 41 20 0d 20 31 34 31 | LDA &3CA . 141| 000038e0 30 20 20 20 20 20 20 20 20 20 4f 52 41 20 23 31 |0 ORA #1| 000038f0 20 20 20 20 20 20 20 20 5c 20 41 4e 44 20 23 26 | \ AND #&| 00003900 46 45 20 74 6f 20 75 6e 6c 6f 63 6b 0d 20 31 34 |FE to unlock. 14| 00003910 32 30 20 20 20 20 20 20 20 20 20 53 54 41 20 26 |20 STA &| 00003920 33 43 41 20 0d 20 31 34 33 30 20 20 20 20 20 20 |3CA . 1430 | 00003930 20 20 20 50 4c 41 20 0d 20 31 34 34 30 20 2e 6e | PLA . 1440 .n| 00003940 6f 74 66 6f 75 72 0d 20 31 34 35 30 20 20 20 20 |otfour. 1450 | 00003950 20 20 20 20 20 50 4c 50 0d 20 31 34 36 30 20 20 | PLP. 1460 | 00003960 20 20 20 20 20 20 20 52 54 53 20 0d 20 31 34 37 | RTS . 147| 00003970 30 20 2e 73 79 6e 74 61 78 0d 20 31 34 38 30 20 |0 .syntax. 1480 | 00003980 20 20 20 20 20 20 20 20 42 52 4b 0d 20 31 34 39 | BRK. 149| 00003990 30 20 20 20 20 20 20 20 20 20 42 52 4b 0d 20 31 |0 BRK. 1| 000039a0 35 30 30 20 20 20 20 20 20 20 20 20 4f 50 54 20 |500 OPT | 000039b0 46 4e 65 71 75 73 28 22 53 79 6e 74 61 78 22 29 |FNequs("Syntax")| 000039c0 0d 20 31 35 31 30 20 20 20 20 20 20 20 20 20 4f |. 1510 O| 000039d0 50 54 20 46 4e 65 71 75 62 28 26 33 41 29 0d 20 |PT FNequb(&3A). | 000039e0 31 35 32 30 20 20 20 20 20 20 20 20 20 4f 50 54 |1520 OPT| 000039f0 20 46 4e 65 71 75 73 28 22 20 2a 4c 4f 43 4b 20 | FNequs(" *LOCK | 00003a00 4f 4e 2f 4f 46 46 22 29 0d 20 31 35 33 30 20 20 |ON/OFF"). 1530 | 00003a10 20 20 20 20 20 20 20 42 52 4b 0d 20 31 35 34 30 | BRK. 1540| 00003a20 20 20 20 20 20 20 20 20 20 4f 50 54 20 46 4e 65 | OPT FNe| 00003a30 71 75 62 28 26 46 46 29 0d 20 31 35 35 30 20 2e |qub(&FF). 1550 .| 00003a40 63 66 73 0d 20 31 35 36 30 20 20 20 20 20 20 20 |cfs. 1560 | 00003a50 20 20 42 52 4b 0d 20 31 35 37 30 20 20 20 20 20 | BRK. 1570 | 00003a60 20 20 20 20 42 52 4b 0d 20 31 35 38 30 20 20 20 | BRK. 1580 | 00003a70 20 20 20 20 20 20 4f 50 54 20 46 4e 65 71 75 73 | OPT FNequs| 00003a80 28 22 54 79 70 65 20 2a 54 41 50 45 20 61 6e 64 |("Type *TAPE and| 00003a90 20 74 72 79 20 61 67 61 69 6e 22 29 0d 20 31 35 | try again"). 15| 00003aa0 39 30 20 20 20 20 20 20 20 20 20 42 52 4b 0d 20 |90 BRK. | 00003ab0 31 36 30 30 20 20 20 20 20 20 20 20 20 4f 50 54 |1600 OPT| 00003ac0 20 46 4e 65 71 75 62 28 26 46 46 29 0d 20 31 36 | FNequb(&FF). 16| 00003ad0 31 30 20 2e 65 72 72 6f 72 0d 20 31 36 32 30 20 |10 .error. 1620 | 00003ae0 20 20 20 20 20 20 20 20 53 54 58 20 61 64 64 72 | STX addr| 00003af0 65 73 73 0d 20 31 36 33 30 20 20 20 20 20 20 20 |ess. 1630 | 00003b00 20 20 53 54 59 20 61 64 64 72 65 73 73 2b 31 0d | STY address+1.| 00003b10 20 31 36 34 30 20 20 20 20 20 20 20 20 20 4c 44 | 1640 LD| 00003b20 59 20 23 26 46 46 0d 20 31 36 35 30 20 2e 65 72 |Y #&FF. 1650 .er| 00003b30 72 6f 72 6c 6f 6f 70 0d 20 31 36 36 30 20 20 20 |rorloop. 1660 | 00003b40 20 20 20 20 20 20 49 4e 59 0d 20 31 36 37 30 20 | INY. 1670 | 00003b50 20 20 20 20 20 20 20 20 4c 44 41 20 28 61 64 64 | LDA (add| 00003b60 72 65 73 73 29 2c 59 0d 20 31 36 38 30 20 20 20 |ress),Y. 1680 | 00003b70 20 20 20 20 20 20 53 54 41 20 65 72 72 73 74 61 | STA errsta| 00003b80 63 6b 2c 59 0d 20 31 36 39 30 20 20 20 20 20 20 |ck,Y. 1690 | 00003b90 20 20 20 42 50 4c 20 65 72 72 6f 72 6c 6f 6f 70 | BPL errorloop| 00003ba0 0d 20 31 37 30 30 20 20 20 20 20 20 20 20 20 50 |. 1700 P| 00003bb0 4c 41 0d 20 31 37 31 30 20 20 20 20 20 20 20 20 |LA. 1710 | 00003bc0 20 53 54 41 20 61 64 64 72 65 73 73 2b 31 0d 20 | STA address+1. | 00003bd0 31 37 32 30 20 20 20 20 20 20 20 20 20 50 4c 41 |1720 PLA| 00003be0 0d 20 31 37 33 30 20 20 20 20 20 20 20 20 20 53 |. 1730 S| 00003bf0 54 41 20 61 64 64 72 65 73 73 0d 20 31 37 34 30 |TA address. 1740| 00003c00 20 20 20 20 20 20 20 20 20 4a 4d 50 20 65 72 72 | JMP err| 00003c10 73 74 61 63 6b 0d 20 31 37 35 30 20 2e 6c 61 73 |stack. 1750 .las| 00003c20 74 62 79 74 65 0d 20 31 37 36 30 20 5d 0d 20 31 |tbyte. 1760 ]. 1| 00003c30 37 37 30 20 4e 45 58 54 0d 20 31 37 38 30 20 49 |770 NEXT. 1780 I| 00003c40 4e 50 55 54 27 22 53 61 76 65 20 66 69 6c 65 6e |NPUT'"Save filen| 00003c50 61 6d 65 20 3d 20 22 66 69 6c 65 6e 61 6d 65 24 |ame = "filename$| 00003c60 0d 20 31 37 39 30 20 49 46 20 66 69 6c 65 6e 61 |. 1790 IF filena| 00003c70 6d 65 24 3d 22 22 20 45 4e 44 0d 20 31 38 30 30 |me$="" END. 1800| 00003c80 20 24 73 61 76 65 3d 22 53 41 56 45 20 22 2b 66 | $save="SAVE "+f| 00003c90 69 6c 65 6e 61 6d 65 24 2b 22 20 22 2b 53 54 52 |ilename$+" "+STR| 00003ca0 24 7e 28 48 49 4d 45 4d 29 2b 22 20 22 2b 53 54 |$~(HIMEM)+" "+ST| 00003cb0 52 24 7e 28 6c 61 73 0d 20 20 20 20 20 20 74 62 |R$~(las. tb| 00003cc0 79 74 65 29 2b 22 20 46 46 46 46 38 30 30 30 20 |yte)+" FFFF8000 | 00003cd0 46 46 46 46 38 30 30 30 22 0d 20 31 38 31 30 20 |FFFF8000". 1810 | 00003ce0 58 25 3d 73 61 76 65 20 4d 4f 44 20 32 35 36 0d |X%=save MOD 256.| 00003cf0 20 31 38 32 30 20 59 25 3d 73 61 76 65 20 44 49 | 1820 Y%=save DI| 00003d00 56 20 32 35 36 0d 20 31 38 33 30 20 2a 4f 50 54 |V 256. 1830 *OPT| 00003d10 31 2c 32 0d 20 31 38 34 30 20 43 41 4c 4c 20 6f |1,2. 1840 CALL o| 00003d20 73 63 6c 69 0d 20 31 38 35 30 20 2a 4f 50 54 31 |scli. 1850 *OPT1| 00003d30 2c 30 0d 20 31 38 36 30 20 45 4e 44 0d 20 31 38 |,0. 1860 END. 18| 00003d40 37 30 20 44 45 46 46 4e 65 71 75 62 28 62 79 74 |70 DEFFNequb(byt| 00003d50 65 29 0d 20 31 38 38 30 20 3f 50 25 3d 62 79 74 |e). 1880 ?P%=byt| 00003d60 65 0d 20 31 38 39 30 20 50 25 3d 50 25 2b 31 0d |e. 1890 P%=P%+1.| 00003d70 20 31 39 30 30 20 3d 70 61 73 73 0d 20 31 39 31 | 1900 =pass. 191| 00003d80 30 20 44 45 46 46 4e 65 71 75 77 28 77 6f 72 64 |0 DEFFNequw(word| 00003d90 29 0d 20 31 39 32 30 20 3f 50 25 3d 77 6f 72 64 |). 1920 ?P%=word| 00003da0 20 4d 4f 44 20 32 35 36 0d 20 31 39 33 30 20 50 | MOD 256. 1930 P| 00003db0 25 3f 31 3d 77 6f 72 64 20 44 49 56 20 32 35 36 |%?1=word DIV 256| 00003dc0 0d 20 31 39 34 30 20 50 25 3d 50 25 2b 32 0d 20 |. 1940 P%=P%+2. | 00003dd0 31 39 35 30 20 3d 70 61 73 73 0d 20 31 39 36 30 |1950 =pass. 1960| 00003de0 20 44 45 46 46 4e 65 71 75 64 28 64 6f 75 62 6c | DEFFNequd(doubl| 00003df0 65 29 0d 20 31 39 37 30 20 21 50 25 3d 64 6f 75 |e). 1970 !P%=dou| 00003e00 62 6c 65 0d 20 31 39 38 30 20 50 25 3d 50 25 2b |ble. 1980 P%=P%+| 00003e10 34 0d 20 31 39 39 30 20 3d 70 61 73 73 0d 20 32 |4. 1990 =pass. 2| 00003e20 30 30 30 20 44 45 46 46 4e 65 71 75 73 28 73 74 |000 DEFFNequs(st| 00003e30 72 69 6e 67 24 29 0d 20 32 30 31 30 20 24 50 25 |ring$). 2010 $P%| 00003e40 3d 73 74 72 69 6e 67 24 0d 20 32 30 32 30 20 50 |=string$. 2020 P| 00003e50 25 3d 50 25 2b 4c 45 4e 28 73 74 72 69 6e 67 24 |%=P%+LEN(string$| 00003e60 29 0d 20 32 30 33 30 20 3d 70 61 73 73 0d |). 2030 =pass.| 00003e6e