Home » CEEFAX disks » telesoftware5.adl » 30-01-88/B\OSB12
30-01-88/B\OSB12
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 » telesoftware5.adl |
Filename: | 30-01-88/B\OSB12 |
Read OK: | ✔ |
File size: | 21D2 bytes |
Load address: | 0800 |
Exec address: | 8023 |
File contents
10REM OSbits Module B/osb12 20REM ASCII to binary 30REM Decimal only 40REM Including input routine from osb11 50REM Version 2.3 12.4.87 60 70*KEY1OLD|MMODE3|M|NLIST|M 80*KEY2-2147483647|M2147483647|M 90 100REM : Set routine addresses 110osbyte = &FFF4 120osrdch = &FFE0 130oswrch = &FFEE 140osnewl = &FFE7 150input_buffer_size=11 160 170DIM code% &250 180 190FOR pass% = 0 TO 2 STEP 2 200P% = code% 210 220[OPT pass% 230 240\\\\\\\\\\\\\\\\\\\\ 250 260.input_string 270 280\ This is the main body of the program 290\ It prints a ? prompt on a new line, takes validated input, 300\ checking for ESCAPE or a zero length string and then converts 310 320JSR osnewl 330LDA #ASC"?" 340JSR oswrch \ Prompt with a question mark 350 360JSR input_character 370BCS error_ESCAPE 380BEQ input_string \ Zero flag set if length is zero 390JSR convert_ASCII_to_binary 400RTS 410 420.error_ESCAPE 430 440\ An error during OSRDCH in this routine has to be an ESCAPE 450\ So we acknowledge the ESCAPE with OSBYTE 126 460\ and enter the default error routine 470 480LDA #126 490JSR osbyte 500 510BRK 520OPT FNEQUB(17) 530OPT FNEQUS("Program terminated by ESCAPE"+CHR$0) 540 550\\\\\\\\\\\\\\\\\\\\ 560 570.input_character 580 590\ This subroutine, slightly modified from module 11, takes input 600\ from the keyboard, vets it, and puts into a buffer 610 620LDY #0 \ We use Y as a counter along the string 630 640.input_character_loop 650 660JSR osrdch 670BCS input_error \ If C set after OSRDCH then an error 680CMP #13 \ Check for carriage return 690BEQ input_character_exit 700CMP #127 \ Check for delete 710BEQ delete 720CPY buffer_size \ Check that we have room in the buffer 730BEQ buffer_full 740JSR check_character \ See if character is valid 750CMP #0 \ A is null if character is invalid 760BEQ input_character_loop 770JSR oswrch 780STA input_buffer, Y \ Add to the input buffer 790INY 800JMP input_character_loop 810 820.input_character_exit 830 840\ We come here after a carriage return, which terminates the string 850\ The CR is tagged onto the end of the string, we store the string 860\ length and then exit 870 880STA input_buffer, Y 890STY string_length 900CLC \ Clear carry on exit 910LDY string_length \ Set zero flag if null string 920RTS 930 940.input_error 950 960\ We come here if an error is detected during OSRDCH. 970\ We exit the routine with Carry set. 980 990RTS 1000 1010.buffer_full 1020 1030\ If the buffer is full send a beep and wait for the next character 1040\ which could be a carriage return or a delete, so it could be valid 1050 1060LDA #7 1070JSR oswrch 1080JMP input_character_loop 1090 1100.delete 1110 1120CPY #0 \ Don't delete past start of string 1130BEQ input_character_loop 1140JSR oswrch 1150DEY \ Character deleted so decrease Y 1160JMP input_character_loop 1170 1180.check_character 1190 1200\ This routine takes a new character in A and checks it against 1210\ the valid list. Invalid characters are replaced by a null (0) 1220\ in A at the routine's exit 1230\ Y is not affected but X is destroyed 1240 1250LDX #0 \ Set index to zero for start of string 1260 1270.check_loop 1280 1290PHA 1300LDA valid_list, X \ If Xth character is 0 check is finished 1310BEQ invalid 1320PLA 1330CMP valid_list, X \ Compare A with Xth character in valid list 1340BEQ valid 1350INX 1360JMP check_loop 1370 1380.invalid 1390 1400PLA 1410LDA #0 \ If character was invalid replace by 0 1420 1430.valid 1440 1450RTS 1460 1470.valid_list OPT FNEQUS("+-0123456789") 1480 OPT FNEQUB(0) 1490.input_buffer OPT FNEQUM(input_buffer_size+1,255) 1500.buffer_size OPT FNEQUB(input_buffer_size) 1510.string_length OPT FNEQUB(0) 1520 1530\\\\\\\\\\\\\\\\\\\\ 1540 1550.convert_ASCII_to_binary 1560 1570\ This subroutine takes the ASCII in the input buffer 1580\ and converts it into a four byte binary number which 1590\ it leaves in 'digit_ws'. Numbers over 4 bytes in size 1600\ are trapped during the conversion. 1610 1620LDA #0 \ Clear various buffers & flags 1630STA sign_flag 1640STA digit_ws 1650STA digit_ws+1 1660STA digit_ws+2 1670STA digit_ws+3 1680LDX #255 \ Reset counter to -1 (255) 1690 1700\ Take each digit off input line in turn and check it is between 1710\ 0 and 9. If not check for a sign (+ or -) or generate an error. 1720 1730.input_loop 1740 1750INX 1760LDA input_buffer, X 1770CMP #ASC"0" 1780BCC not_number 1790CMP #ASC"9"+1 1800BCS not_number 1810SEC 1820SBC #ASC"0" 1830JSR process_number 1840JMP input_loop 1850 1860 1870\ If first digit is not a number check to see if it is a sign. 1880\ If a plus then do nothing. 1890\ If a minus then set the sign flag 1900 1910.not_number 1920 1930CPX #0 1940BNE exit_number_conversion 1950CMP #ASC"+" 1960BEQ input_loop 1970CMP #ASC"-" 1980BNE error_N \ This branch is actually redundant 1990LDA #1 2000STA sign_flag 2010JMP input_loop 2020 2030.error_N 2040 2050BRK 2060OPT FNEQUB(255) 2070OPT FNEQUS("Number entered is invalid"+CHR$0) 2080 2090\ On your way out check the sign flag. If set make 2100\ digit_ws negative by subtracting the number in it from zero 2110 2120.exit_number_conversion 2130 2140LDA sign_flag 2150BEQ positive 2160SEC 2170LDA #0 2180SBC digit_ws 2190STA digit_ws 2200LDA #0 2210SBC digit_ws+1 2220STA digit_ws+1 2230LDA #0 2240SBC digit_ws+2 2250STA digit_ws+2 2260LDA #0 2270SBC digit_ws+3 2280STA digit_ws+3 2290 2300.positive 2310 2320RTS 2330 2340.number OPT FNEQUD(0) 2350.base OPT FNEQUB(10) \ We'll stick with base 10 for now 2360.digit_ws OPT FNEQUD(0) 2370.ppws OPT FNEQUD(0) 2380.sign_flag OPT FNEQUB(0) 2390.accustore OPT FNEQUB(0) 2400 2410\ For each new digit entered multiply the 'number so far' held 2420\ in digit_ws, by the numeric base and add next number to digit_ws 2430 2440.process_number 2450 2460STA accustore 2470TXA 2480PHA 2490JSR mult_by_base 2500LDA accustore 2510CLC 2520ADC digit_ws 2530STA digit_ws 2540LDA #0 2550ADC digit_ws+1 2560STA digit_ws+1 2570LDA #0 2580ADC digit_ws+2 2590STA digit_ws+2 2600LDA #0 2610ADC digit_ws+3 2620STA digit_ws+3 2630BMI error_L_add \ If no becomes negative it is too big 2640 2650PLA 2660TAX 2670RTS 2680 2690.error_L_add 2700 2710BRK 2720OPT FNEQUB(254) 2730OPT FNEQUS("The number entered is too large"+CHR$13+CHR$10+"Trap in addition"+CHR$0) 2740 2750\ Take the number held in digit_ws, mult by the numeric base (10) 2760\ and return it to digit_ws 2770 2780.mult_by_base 2790 2800LDA #0 \ Clear partial product workspace 2810STA ppws 2820STA ppws+1 2830STA ppws+2 2840STA ppws+3 2850 2860LDA base 2870 2880.mult_by_base_loop 2890 2900LSR A 2910PHA 2920BCC no_add 2930CLC \ If current bit of multiplier set then 2940LDA ppws \ add rotated multiplicand to ppws 2950ADC digit_ws 2960STA ppws 2970LDA ppws+1 2980ADC digit_ws+1 2990STA ppws+1 3000LDA ppws+2 3010ADC digit_ws+2 3020STA ppws+2 3030LDA ppws+3 3040ADC digit_ws+3 3050STA ppws+3 3060BMI error_L_add \ If no becomes negative it is too big 3070 3080.no_add 3090 3100PLA 3110CMP #0 3120BEQ exit_base_loop 3130ASL digit_ws \ Rotate multiplicand 3140ROL digit_ws+1 3150ROL digit_ws+2 3160ROL digit_ws+3 3170BMI error_L_rot \ If no becomes negative it is too big 3180JMP mult_by_base_loop 3190 3200.error_L_rot 3210 3220BRK 3230OPT FNEQUB(253) 3240OPT FNEQUS("The number entered is too large"+CHR$13+CHR$10+"Trap in rotation"+CHR$0) 3250 3260.exit_base_loop 3270 3280LDA ppws \ Put result back into digit_ws 3290STA digit_ws 3300LDA ppws+1 3310STA digit_ws+1 3320LDA ppws+2 3330STA digit_ws+2 3340LDA ppws+3 3350STA digit_ws+3 3360 3370RTS 3380 3390] 3400NEXT 3410 3420ON ERROR GOTO 3480 3430@%=&A0A 3440REPEAT 3450CALL code% 3460PRINT'"CHECK: digit_ws = ";!digit_ws;" / &";~!digit_ws 3470UNTIL0 3480REPORT 3490PRINT 3500IF ERR<253 THEN END 3510GOTO3440 3520 3530**** EQUate a Byte **** 3540DEF FNEQUB(N%) 3550?P%=N% MOD 256 3560IF (pass% AND 3) = 3 THEN PRINT ~?P% 3570P%=P%+1 3580=pass% 3590 3600**** EQUate a Double word (4 bytes) **** 3610DEF FNEQUD(N%) 3620LOCAL X% 3630!P%=N% 3640FOR X%=0 TO 3 3650IF (pass% AND 3) = 3 THEN PRINT ~P%?X%; 3660NEXT 3670IF (pass% AND 3) = 3 THEN PRINT 3680P%=P%+4 3690=pass% 3700 3710**** EQUate a String **** 3720DEF FNEQUS(N$) 3730LOCAL N% 3740WIDTH 40 3750FOR N%=1 TO LEN(N$) 3760K%=ASC(MID$(N$,N%,1)) 3770P%?(N%-1)=K% 3780IF (pass% AND 3) = 3 THEN PRINT ~P%?(N%-1); 3790NEXT 3800IF (pass% AND 3) = 3 THEN PRINT 3810P%=P%+LEN(N$) 3820WIDTH 0 3830=pass% 3840 3850**** EQUate a section of Memory **** 3860DEF FNEQUM(number%,byte%) 3870LOCAL N% 3880WIDTH 40 3890FOR N%=0 TO number%-1 3900P%?N%=byte% 3910IF (pass% AND 3) = 3 THEN PRINT ~P%?N%; 3920NEXT 3930IF (pass% AND 3) = 3 THEN PRINT 3940P%=P%+number% 3950WIDTH 0 3960=pass%
� OSbits Module B/osb12 � ASCII to binary � Decimal only ((� Including input routine from osb11 2� Version 2.3 12.4.87 < F*KEY1OLD|MMODE3|M|NLIST|M P"*KEY2-2147483647|M2147483647|M Z d� : Set routine addresses nosbyte = &FFF4 xosrdch = &FFE0 �oswrch = &FFEE �osnewl = &FFE7 �input_buffer_size=11 � �� code% &250 � �� pass% = 0 � 2 � 2 �P% = code% � �[OPT pass% � �\\\\\\\\\\\\\\\\\\\\ � .input_string +\ This is the main body of the program "A\ It prints a ? prompt on a new line, takes validated input, ,D\ checking for ESCAPE or a zero length string and then converts 6 @JSR osnewl J LDA #�"?" T=JSR oswrch \ Prompt with a question mark ^ hJSR input_character rBCS error_ESCAPE |ABEQ input_string \ Zero flag set if length is zero �JSR convert_ASCII_to_binary �RTS � �.error_ESCAPE � �A\ An error during OSRDCH in this routine has to be an ESCAPE �3\ So we acknowledge the ESCAPE with OSBYTE 126 �*\ and enter the default error routine � �LDA #126 �JSR osbyte � �BRK OPT �EQUB(17) 0OPT �EQUS("Program terminated by ESCAPE"+�0) &\\\\\\\\\\\\\\\\\\\\ 0 :.input_character D NE\ This subroutine, slightly modified from module 11, takes input X9\ from the keyboard, vets it, and puts into a buffer b lHLDY #0 \ We use Y as a counter along the string v �.input_character_loop � �JSR osrdch �EBCS input_error \ If C set after OSRDCH then an error �;CMP #13 \ Check for carriage return �BEQ input_character_exit �2CMP #127 \ Check for delete �BEQ delete �GCPY buffer_size \ Check that we have room in the buffer �BEQ buffer_full �;JSR check_character \ See if character is valid �CCMP #0 \ A is null if character is invalid �BEQ input_character_loop JSR oswrch 9STA input_buffer, Y \ Add to the input buffer INY JMP input_character_loop * 4.input_character_exit > HH\ We come here after a carriage return, which terminates the string RG\ The CR is tagged onto the end of the string, we store the string \\ length and then exit f pSTA input_buffer, Y zSTY string_length �5CLC \ Clear carry on exit �>LDY string_length \ Set zero flag if null string �RTS � �.input_error � �:\ We come here if an error is detected during OSRDCH. �*\ We exit the routine with Carry set. � �RTS � �.buffer_full � H\ If the buffer is full send a beep and wait for the next character I\ which could be a carriage return or a delete, so it could be valid $ LDA #7 .JSR oswrch 8JMP input_character_loop B L.delete V `CCPY #0 \ Don't delete past start of string jBEQ input_character_loop tJSR oswrch ~ADEY \ Character deleted so decrease Y �JMP input_character_loop � �.check_character � �D\ This routine takes a new character in A and checks it against �E\ the valid list. Invalid characters are replaced by a null (0) �!\ in A at the routine's exit �+\ Y is not affected but X is destroyed � �GLDX #0 \ Set index to zero for start of string � �.check_loop PHA ILDA valid_list, X \ If Xth character is 0 check is finished BEQ invalid (PLA 2LCMP valid_list, X \ Compare A with Xth character in valid list < BEQ valid FINX PJMP check_loop Z d.invalid n xPLA �GLDA #0 \ If character was invalid replace by 0 � � .valid � �RTS � �,.valid_list OPT �EQUS("+-0123456789") � OPT �EQUB(0) �5.input_buffer OPT �EQUM(input_buffer_size+1,255) �/.buffer_size OPT �EQUB(input_buffer_size) �.string_length OPT �EQUB(0) � �\\\\\\\\\\\\\\\\\\\\ .convert_ASCII_to_binary "8\ This subroutine takes the �II in the input buffer ,;\ and converts it into a four byte binary number which 6<\ it leaves in 'digit_ws'. Numbers over 4 bytes in size @)\ are trapped during the conversion. J T?LDA #0 \ Clear various buffers & flags ^STA sign_flag hSTA digit_ws rSTA digit_ws+1 |STA digit_ws+2 �STA digit_ws+3 �;LDX #255 \ Reset counter to -1 (255) � �D\ Take each digit off input line in turn and check it is between �F\ 0 and 9. If not check for a sign (+ or -) or generate an error. � �.input_loop � �INX �LDA input_buffer, X � CMP #�"0" �BCC not_number �CMP #�"9"+1 BCS not_number SEC SBC #�"0" &JSR process_number 0JMP input_loop : D NB\ If first digit is not a number check to see if it is a sign. X \ If a plus then do nothing. b'\ If a minus then set the sign flag l v.not_number � � CPX #0 �BNE exit_number_conversion � CMP #�"+" �BEQ input_loop � CMP #�"-" �CBNE error_N \ This branch is actually redundant � LDA #1 �STA sign_flag �JMP input_loop � �.error_N � BRK OPT �EQUB(255) -OPT �EQUS("Number entered is invalid"+�0) *6\ On your way out check the sign flag. If set make 4A\ digit_ws negative by subtracting the number in it from zero > H.exit_number_conversion R \LDA sign_flag fBEQ positive pSEC z LDA #0 �SBC digit_ws �STA digit_ws � LDA #0 �SBC digit_ws+1 �STA digit_ws+1 � LDA #0 �SBC digit_ws+2 �STA digit_ws+2 � LDA #0 �SBC digit_ws+3 �STA digit_ws+3 � � .positive RTS $.number OPT �EQUD(0) .A.base OPT �EQUB(10) \ We'll stick with base 10 for now 8.digit_ws OPT �EQUD(0) B.ppws OPT �EQUD(0) L.sign_flag OPT �EQUB(0) V.accustore OPT �EQUB(0) ` jB\ For each new digit entered multiply the 'number so far' held tF\ in digit_ws, by the numeric base and add next number to digit_ws ~ �.process_number � �STA accustore �TXA �PHA �JSR mult_by_base �LDA accustore �CLC �ADC digit_ws �STA digit_ws � LDA #0 �ADC digit_ws+1 STA digit_ws+1 LDA #0 ADC digit_ws+2 STA digit_ws+2 ( LDA #0 2ADC digit_ws+3 <STA digit_ws+3 FFBMI error_L_add \ If no becomes negative it is too big P ZPLA dTAX nRTS x �.error_L_add � �BRK �OPT �EQUB(254) �NOPT �EQUS("The number entered is too large"+�13+�10+"Trap in addition"+�0) � �E\ Take the number held in digit_ws, mult by the numeric base (10) �\ and return it to digit_ws � �.mult_by_base � �ALDA #0 \ Clear partial product workspace �STA ppws STA ppws+1 STA ppws+2 STA ppws+3 " ,LDA base 6 @.mult_by_base_loop J T LSR A ^PHA hBCC no_add rGCLC \ If current bit of multiplier set then |BLDA ppws \ add rotated multiplicand to ppws �ADC digit_ws �STA ppws �LDA ppws+1 �ADC digit_ws+1 �STA ppws+1 �LDA ppws+2 �ADC digit_ws+2 �STA ppws+2 �LDA ppws+3 �ADC digit_ws+3 �STA ppws+3 �FBMI error_L_add \ If no becomes negative it is too big � .no_add PLA & CMP #0 0BEQ exit_base_loop :5ASL digit_ws \ Rotate multiplicand DROL digit_ws+1 NROL digit_ws+2 XROL digit_ws+3 bFBMI error_L_rot \ If no becomes negative it is too big lJMP mult_by_base_loop v �.error_L_rot � �BRK �OPT �EQUB(253) �NOPT �EQUS("The number entered is too large"+�13+�10+"Trap in rotation"+�0) � �.exit_base_loop � �?LDA ppws \ Put result back into digit_ws �STA digit_ws �LDA ppws+1 �STA digit_ws+1 �LDA ppws+2 STA digit_ws+2 LDA ppws+3 STA digit_ws+3 *RTS 4 >] H� R \� � � �tXM f@%=&A0A p� z� code% �6�'"CHECK: digit_ws = ";!digit_ws;" / &";~!digit_ws ��0 �� �� �� �<253 � � � �DpM � �**** EQUate a Byte **** �� �EQUB(N%) �?P%=N% � 256 �� (pass% � 3) = 3 � � ~?P% �P%=P%+1 � =pass% ,**** EQUate a Double word (4 bytes) **** � �EQUD(N%) $� X% . !P%=N% 8� X%=0 � 3 B!� (pass% � 3) = 3 � � ~P%?X%; L� V� (pass% � 3) = 3 � � `P%=P%+4 j =pass% t ~**** EQUate a String **** �� �EQUS(N$) �� N% �� 40 �� N%=1 � �(N$) �K%=�(�N$,N%,1)) �P%?(N%-1)=K% �%� (pass% � 3) = 3 � � ~P%?(N%-1); �� �� (pass% � 3) = 3 � � �P%=P%+�(N$) �� 0 � =pass% (**** EQUate a section of Memory **** � �EQUM(number%,byte%) � N% (� 40 2� N%=0 � number%-1 <P%?N%=byte% F!� (pass% � 3) = 3 � � ~P%?N%; P� Z� (pass% � 3) = 3 � � dP%=P%+number% n� 0 x =pass% �
00000000 0d 00 0a 1b f4 20 4f 53 62 69 74 73 20 4d 6f 64 |..... OSbits Mod| 00000010 75 6c 65 20 42 2f 6f 73 62 31 32 0d 00 14 15 f4 |ule B/osb12.....| 00000020 20 41 53 43 49 49 20 74 6f 20 62 69 6e 61 72 79 | ASCII to binary| 00000030 0d 00 1e 12 f4 20 44 65 63 69 6d 61 6c 20 6f 6e |..... Decimal on| 00000040 6c 79 0d 00 28 28 f4 20 49 6e 63 6c 75 64 69 6e |ly..((. Includin| 00000050 67 20 69 6e 70 75 74 20 72 6f 75 74 69 6e 65 20 |g input routine | 00000060 66 72 6f 6d 20 6f 73 62 31 31 0d 00 32 19 f4 20 |from osb11..2.. | 00000070 56 65 72 73 69 6f 6e 20 32 2e 33 20 31 32 2e 34 |Version 2.3 12.4| 00000080 2e 38 37 0d 00 3c 05 20 0d 00 46 1d 2a 4b 45 59 |.87..<. ..F.*KEY| 00000090 31 4f 4c 44 7c 4d 4d 4f 44 45 33 7c 4d 7c 4e 4c |1OLD|MMODE3|M|NL| 000000a0 49 53 54 7c 4d 0d 00 50 22 2a 4b 45 59 32 2d 32 |IST|M..P"*KEY2-2| 000000b0 31 34 37 34 38 33 36 34 37 7c 4d 32 31 34 37 34 |147483647|M21474| 000000c0 38 33 36 34 37 7c 4d 0d 00 5a 05 20 0d 00 64 1d |83647|M..Z. ..d.| 000000d0 f4 20 3a 20 53 65 74 20 72 6f 75 74 69 6e 65 20 |. : Set routine | 000000e0 61 64 64 72 65 73 73 65 73 0d 00 6e 12 6f 73 62 |addresses..n.osb| 000000f0 79 74 65 20 3d 20 26 46 46 46 34 0d 00 78 12 6f |yte = &FFF4..x.o| 00000100 73 72 64 63 68 20 3d 20 26 46 46 45 30 0d 00 82 |srdch = &FFE0...| 00000110 12 6f 73 77 72 63 68 20 3d 20 26 46 46 45 45 0d |.oswrch = &FFEE.| 00000120 00 8c 12 6f 73 6e 65 77 6c 20 3d 20 26 46 46 45 |...osnewl = &FFE| 00000130 37 0d 00 96 18 69 6e 70 75 74 5f 62 75 66 66 65 |7....input_buffe| 00000140 72 5f 73 69 7a 65 3d 31 31 0d 00 a0 05 20 0d 00 |r_size=11.... ..| 00000150 aa 10 de 20 63 6f 64 65 25 20 26 32 35 30 0d 00 |... code% &250..| 00000160 b4 05 20 0d 00 be 17 e3 20 70 61 73 73 25 20 3d |.. ..... pass% =| 00000170 20 30 20 b8 20 32 20 88 20 32 0d 00 c8 0e 50 25 | 0 . 2 . 2....P%| 00000180 20 3d 20 63 6f 64 65 25 0d 00 d2 05 20 0d 00 dc | = code%.... ...| 00000190 0e 5b 4f 50 54 20 70 61 73 73 25 0d 00 e6 05 20 |.[OPT pass%.... | 000001a0 0d 00 f0 18 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c |....\\\\\\\\\\\\| 000001b0 5c 5c 5c 5c 5c 5c 5c 5c 0d 00 fa 05 20 0d 01 04 |\\\\\\\\.... ...| 000001c0 11 2e 69 6e 70 75 74 5f 73 74 72 69 6e 67 0d 01 |..input_string..| 000001d0 0e 05 20 0d 01 18 2b 5c 20 20 54 68 69 73 20 69 |.. ...+\ This i| 000001e0 73 20 74 68 65 20 6d 61 69 6e 20 62 6f 64 79 20 |s the main body | 000001f0 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d 0d 01 |of the program..| 00000200 22 41 5c 20 20 49 74 20 70 72 69 6e 74 73 20 61 |"A\ It prints a| 00000210 20 3f 20 70 72 6f 6d 70 74 20 6f 6e 20 61 20 6e | ? prompt on a n| 00000220 65 77 20 6c 69 6e 65 2c 20 74 61 6b 65 73 20 76 |ew line, takes v| 00000230 61 6c 69 64 61 74 65 64 20 69 6e 70 75 74 2c 0d |alidated input,.| 00000240 01 2c 44 5c 20 20 63 68 65 63 6b 69 6e 67 20 66 |.,D\ checking f| 00000250 6f 72 20 45 53 43 41 50 45 20 6f 72 20 61 20 7a |or ESCAPE or a z| 00000260 65 72 6f 20 6c 65 6e 67 74 68 20 73 74 72 69 6e |ero length strin| 00000270 67 20 61 6e 64 20 74 68 65 6e 20 63 6f 6e 76 65 |g and then conve| 00000280 72 74 73 0d 01 36 05 20 0d 01 40 0e 4a 53 52 20 |rts..6. ..@.JSR | 00000290 6f 73 6e 65 77 6c 0d 01 4a 0d 4c 44 41 20 23 97 |osnewl..J.LDA #.| 000002a0 22 3f 22 0d 01 54 3d 4a 53 52 20 6f 73 77 72 63 |"?"..T=JSR oswrc| 000002b0 68 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |h | 000002c0 20 20 20 5c 20 50 72 6f 6d 70 74 20 77 69 74 68 | \ Prompt with| 000002d0 20 61 20 71 75 65 73 74 69 6f 6e 20 6d 61 72 6b | a question mark| 000002e0 0d 01 5e 05 20 0d 01 68 17 4a 53 52 20 69 6e 70 |..^. ..h.JSR inp| 000002f0 75 74 5f 63 68 61 72 61 63 74 65 72 0d 01 72 14 |ut_character..r.| 00000300 42 43 53 20 65 72 72 6f 72 5f 45 53 43 41 50 45 |BCS error_ESCAPE| 00000310 0d 01 7c 41 42 45 51 20 69 6e 70 75 74 5f 73 74 |..|ABEQ input_st| 00000320 72 69 6e 67 20 20 20 20 20 20 20 20 20 20 20 20 |ring | 00000330 5c 20 5a 65 72 6f 20 66 6c 61 67 20 73 65 74 20 |\ Zero flag set | 00000340 69 66 20 6c 65 6e 67 74 68 20 69 73 20 7a 65 72 |if length is zer| 00000350 6f 0d 01 86 1f 4a 53 52 20 63 6f 6e 76 65 72 74 |o....JSR convert| 00000360 5f 41 53 43 49 49 5f 74 6f 5f 62 69 6e 61 72 79 |_ASCII_to_binary| 00000370 0d 01 90 07 52 54 53 0d 01 9a 05 20 0d 01 a4 11 |....RTS.... ....| 00000380 2e 65 72 72 6f 72 5f 45 53 43 41 50 45 0d 01 ae |.error_ESCAPE...| 00000390 05 20 0d 01 b8 41 5c 20 20 41 6e 20 65 72 72 6f |. ...A\ An erro| 000003a0 72 20 64 75 72 69 6e 67 20 4f 53 52 44 43 48 20 |r during OSRDCH | 000003b0 69 6e 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 |in this routine | 000003c0 68 61 73 20 74 6f 20 62 65 20 61 6e 20 45 53 43 |has to be an ESC| 000003d0 41 50 45 0d 01 c2 33 5c 20 20 53 6f 20 77 65 20 |APE...3\ So we | 000003e0 61 63 6b 6e 6f 77 6c 65 64 67 65 20 74 68 65 20 |acknowledge the | 000003f0 45 53 43 41 50 45 20 77 69 74 68 20 4f 53 42 59 |ESCAPE with OSBY| 00000400 54 45 20 31 32 36 0d 01 cc 2a 5c 20 20 61 6e 64 |TE 126...*\ and| 00000410 20 65 6e 74 65 72 20 74 68 65 20 64 65 66 61 75 | enter the defau| 00000420 6c 74 20 65 72 72 6f 72 20 72 6f 75 74 69 6e 65 |lt error routine| 00000430 0d 01 d6 05 20 0d 01 e0 0c 4c 44 41 20 23 31 32 |.... ....LDA #12| 00000440 36 0d 01 ea 0e 4a 53 52 20 6f 73 62 79 74 65 0d |6....JSR osbyte.| 00000450 01 f4 05 20 0d 01 fe 07 42 52 4b 0d 02 08 11 4f |... ....BRK....O| 00000460 50 54 20 a4 45 51 55 42 28 31 37 29 0d 02 12 30 |PT .EQUB(17)...0| 00000470 4f 50 54 20 a4 45 51 55 53 28 22 50 72 6f 67 72 |OPT .EQUS("Progr| 00000480 61 6d 20 74 65 72 6d 69 6e 61 74 65 64 20 62 79 |am terminated by| 00000490 20 45 53 43 41 50 45 22 2b bd 30 29 0d 02 1c 05 | ESCAPE"+.0)....| 000004a0 20 0d 02 26 18 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c | ..&.\\\\\\\\\\\| 000004b0 5c 5c 5c 5c 5c 5c 5c 5c 5c 0d 02 30 05 20 0d 02 |\\\\\\\\\..0. ..| 000004c0 3a 14 2e 69 6e 70 75 74 5f 63 68 61 72 61 63 74 |:..input_charact| 000004d0 65 72 0d 02 44 05 20 0d 02 4e 45 5c 20 20 54 68 |er..D. ..NE\ Th| 000004e0 69 73 20 73 75 62 72 6f 75 74 69 6e 65 2c 20 73 |is subroutine, s| 000004f0 6c 69 67 68 74 6c 79 20 6d 6f 64 69 66 69 65 64 |lightly modified| 00000500 20 66 72 6f 6d 20 6d 6f 64 75 6c 65 20 31 31 2c | from module 11,| 00000510 20 74 61 6b 65 73 20 69 6e 70 75 74 0d 02 58 39 | takes input..X9| 00000520 5c 20 20 66 72 6f 6d 20 74 68 65 20 6b 65 79 62 |\ from the keyb| 00000530 6f 61 72 64 2c 20 76 65 74 73 20 69 74 2c 20 61 |oard, vets it, a| 00000540 6e 64 20 70 75 74 73 20 69 6e 74 6f 20 61 20 62 |nd puts into a b| 00000550 75 66 66 65 72 0d 02 62 05 20 0d 02 6c 48 4c 44 |uffer..b. ..lHLD| 00000560 59 20 23 30 20 20 20 20 20 20 20 20 20 20 20 20 |Y #0 | 00000570 20 20 20 20 20 20 20 20 20 20 5c 20 57 65 20 75 | \ We u| 00000580 73 65 20 59 20 61 73 20 61 20 63 6f 75 6e 74 65 |se Y as a counte| 00000590 72 20 61 6c 6f 6e 67 20 74 68 65 20 73 74 72 69 |r along the stri| 000005a0 6e 67 0d 02 76 05 20 0d 02 80 19 2e 69 6e 70 75 |ng..v. .....inpu| 000005b0 74 5f 63 68 61 72 61 63 74 65 72 5f 6c 6f 6f 70 |t_character_loop| 000005c0 0d 02 8a 05 20 0d 02 94 0e 4a 53 52 20 6f 73 72 |.... ....JSR osr| 000005d0 64 63 68 0d 02 9e 45 42 43 53 20 69 6e 70 75 74 |dch...EBCS input| 000005e0 5f 65 72 72 6f 72 20 20 20 20 20 20 20 20 20 20 |_error | 000005f0 20 20 20 5c 20 49 66 20 43 20 73 65 74 20 61 66 | \ If C set af| 00000600 74 65 72 20 4f 53 52 44 43 48 20 74 68 65 6e 20 |ter OSRDCH then | 00000610 61 6e 20 65 72 72 6f 72 0d 02 a8 3b 43 4d 50 20 |an error...;CMP | 00000620 23 31 33 20 20 20 20 20 20 20 20 20 20 20 20 20 |#13 | 00000630 20 20 20 20 20 20 20 20 5c 20 43 68 65 63 6b 20 | \ Check | 00000640 66 6f 72 20 63 61 72 72 69 61 67 65 20 72 65 74 |for carriage ret| 00000650 75 72 6e 0d 02 b2 1c 42 45 51 20 69 6e 70 75 74 |urn....BEQ input| 00000660 5f 63 68 61 72 61 63 74 65 72 5f 65 78 69 74 0d |_character_exit.| 00000670 02 bc 32 43 4d 50 20 23 31 32 37 20 20 20 20 20 |..2CMP #127 | 00000680 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c | \| 00000690 20 43 68 65 63 6b 20 66 6f 72 20 64 65 6c 65 74 | Check for delet| 000006a0 65 0d 02 c6 0e 42 45 51 20 64 65 6c 65 74 65 0d |e....BEQ delete.| 000006b0 02 d0 47 43 50 59 20 62 75 66 66 65 72 5f 73 69 |..GCPY buffer_si| 000006c0 7a 65 20 20 20 20 20 20 20 20 20 20 20 20 20 5c |ze \| 000006d0 20 43 68 65 63 6b 20 74 68 61 74 20 77 65 20 68 | Check that we h| 000006e0 61 76 65 20 72 6f 6f 6d 20 69 6e 20 74 68 65 20 |ave room in the | 000006f0 62 75 66 66 65 72 0d 02 da 13 42 45 51 20 62 75 |buffer....BEQ bu| 00000700 66 66 65 72 5f 66 75 6c 6c 0d 02 e4 3b 4a 53 52 |ffer_full...;JSR| 00000710 20 63 68 65 63 6b 5f 63 68 61 72 61 63 74 65 72 | check_character| 00000720 20 20 20 20 20 20 20 20 20 5c 20 53 65 65 20 69 | \ See i| 00000730 66 20 63 68 61 72 61 63 74 65 72 20 69 73 20 76 |f character is v| 00000740 61 6c 69 64 0d 02 ee 43 43 4d 50 20 23 30 20 20 |alid...CCMP #0 | 00000750 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000760 20 20 20 20 5c 20 41 20 69 73 20 6e 75 6c 6c 20 | \ A is null | 00000770 69 66 20 63 68 61 72 61 63 74 65 72 20 69 73 20 |if character is | 00000780 69 6e 76 61 6c 69 64 0d 02 f8 1c 42 45 51 20 69 |invalid....BEQ i| 00000790 6e 70 75 74 5f 63 68 61 72 61 63 74 65 72 5f 6c |nput_character_l| 000007a0 6f 6f 70 0d 03 02 0e 4a 53 52 20 6f 73 77 72 63 |oop....JSR oswrc| 000007b0 68 0d 03 0c 39 53 54 41 20 69 6e 70 75 74 5f 62 |h...9STA input_b| 000007c0 75 66 66 65 72 2c 20 59 20 20 20 20 20 20 20 20 |uffer, Y | 000007d0 20 5c 20 41 64 64 20 74 6f 20 74 68 65 20 69 6e | \ Add to the in| 000007e0 70 75 74 20 62 75 66 66 65 72 0d 03 16 07 49 4e |put buffer....IN| 000007f0 59 0d 03 20 1c 4a 4d 50 20 69 6e 70 75 74 5f 63 |Y.. .JMP input_c| 00000800 68 61 72 61 63 74 65 72 5f 6c 6f 6f 70 0d 03 2a |haracter_loop..*| 00000810 05 20 0d 03 34 19 2e 69 6e 70 75 74 5f 63 68 61 |. ..4..input_cha| 00000820 72 61 63 74 65 72 5f 65 78 69 74 0d 03 3e 05 20 |racter_exit..>. | 00000830 0d 03 48 48 5c 20 20 57 65 20 63 6f 6d 65 20 68 |..HH\ We come h| 00000840 65 72 65 20 61 66 74 65 72 20 61 20 63 61 72 72 |ere after a carr| 00000850 69 61 67 65 20 72 65 74 75 72 6e 2c 20 77 68 69 |iage return, whi| 00000860 63 68 20 74 65 72 6d 69 6e 61 74 65 73 20 74 68 |ch terminates th| 00000870 65 20 73 74 72 69 6e 67 0d 03 52 47 5c 20 20 54 |e string..RG\ T| 00000880 68 65 20 43 52 20 69 73 20 74 61 67 67 65 64 20 |he CR is tagged | 00000890 6f 6e 74 6f 20 74 68 65 20 65 6e 64 20 6f 66 20 |onto the end of | 000008a0 74 68 65 20 73 74 72 69 6e 67 2c 20 77 65 20 73 |the string, we s| 000008b0 74 6f 72 65 20 74 68 65 20 73 74 72 69 6e 67 0d |tore the string.| 000008c0 03 5c 1b 5c 20 20 6c 65 6e 67 74 68 20 61 6e 64 |.\.\ length and| 000008d0 20 74 68 65 6e 20 65 78 69 74 0d 03 66 05 20 0d | then exit..f. .| 000008e0 03 70 17 53 54 41 20 69 6e 70 75 74 5f 62 75 66 |.p.STA input_buf| 000008f0 66 65 72 2c 20 59 0d 03 7a 15 53 54 59 20 73 74 |fer, Y..z.STY st| 00000900 72 69 6e 67 5f 6c 65 6e 67 74 68 0d 03 84 35 43 |ring_length...5C| 00000910 4c 43 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |LC | 00000920 20 20 20 20 20 20 20 20 20 20 20 5c 20 43 6c 65 | \ Cle| 00000930 61 72 20 63 61 72 72 79 20 6f 6e 20 65 78 69 74 |ar carry on exit| 00000940 0d 03 8e 3e 4c 44 59 20 73 74 72 69 6e 67 5f 6c |...>LDY string_l| 00000950 65 6e 67 74 68 20 20 20 20 20 20 20 20 20 20 20 |ength | 00000960 5c 20 53 65 74 20 7a 65 72 6f 20 66 6c 61 67 20 |\ Set zero flag | 00000970 69 66 20 6e 75 6c 6c 20 73 74 72 69 6e 67 0d 03 |if null string..| 00000980 98 07 52 54 53 0d 03 a2 05 20 0d 03 ac 10 2e 69 |..RTS.... .....i| 00000990 6e 70 75 74 5f 65 72 72 6f 72 0d 03 b6 05 20 0d |nput_error.... .| 000009a0 03 c0 3a 5c 20 20 57 65 20 63 6f 6d 65 20 68 65 |..:\ We come he| 000009b0 72 65 20 69 66 20 61 6e 20 65 72 72 6f 72 20 69 |re if an error i| 000009c0 73 20 64 65 74 65 63 74 65 64 20 64 75 72 69 6e |s detected durin| 000009d0 67 20 4f 53 52 44 43 48 2e 0d 03 ca 2a 5c 20 20 |g OSRDCH....*\ | 000009e0 57 65 20 65 78 69 74 20 74 68 65 20 72 6f 75 74 |We exit the rout| 000009f0 69 6e 65 20 77 69 74 68 20 43 61 72 72 79 20 73 |ine with Carry s| 00000a00 65 74 2e 0d 03 d4 05 20 0d 03 de 07 52 54 53 0d |et..... ....RTS.| 00000a10 03 e8 05 20 0d 03 f2 10 2e 62 75 66 66 65 72 5f |... .....buffer_| 00000a20 66 75 6c 6c 0d 03 fc 05 20 0d 04 06 48 5c 20 20 |full.... ...H\ | 00000a30 49 66 20 74 68 65 20 62 75 66 66 65 72 20 69 73 |If the buffer is| 00000a40 20 66 75 6c 6c 20 73 65 6e 64 20 61 20 62 65 65 | full send a bee| 00000a50 70 20 61 6e 64 20 77 61 69 74 20 66 6f 72 20 74 |p and wait for t| 00000a60 68 65 20 6e 65 78 74 20 63 68 61 72 61 63 74 65 |he next characte| 00000a70 72 0d 04 10 49 5c 20 20 77 68 69 63 68 20 63 6f |r...I\ which co| 00000a80 75 6c 64 20 62 65 20 61 20 63 61 72 72 69 61 67 |uld be a carriag| 00000a90 65 20 72 65 74 75 72 6e 20 6f 72 20 61 20 64 65 |e return or a de| 00000aa0 6c 65 74 65 2c 20 73 6f 20 69 74 20 63 6f 75 6c |lete, so it coul| 00000ab0 64 20 62 65 20 76 61 6c 69 64 0d 04 1a 05 20 0d |d be valid.... .| 00000ac0 04 24 0a 4c 44 41 20 23 37 0d 04 2e 0e 4a 53 52 |.$.LDA #7....JSR| 00000ad0 20 6f 73 77 72 63 68 0d 04 38 1c 4a 4d 50 20 69 | oswrch..8.JMP i| 00000ae0 6e 70 75 74 5f 63 68 61 72 61 63 74 65 72 5f 6c |nput_character_l| 00000af0 6f 6f 70 0d 04 42 05 20 0d 04 4c 0b 2e 64 65 6c |oop..B. ..L..del| 00000b00 65 74 65 0d 04 56 05 20 0d 04 60 43 43 50 59 20 |ete..V. ..`CCPY | 00000b10 23 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |#0 | 00000b20 20 20 20 20 20 20 20 20 5c 20 44 6f 6e 27 74 20 | \ Don't | 00000b30 64 65 6c 65 74 65 20 70 61 73 74 20 73 74 61 72 |delete past star| 00000b40 74 20 6f 66 20 73 74 72 69 6e 67 0d 04 6a 1c 42 |t of string..j.B| 00000b50 45 51 20 69 6e 70 75 74 5f 63 68 61 72 61 63 74 |EQ input_charact| 00000b60 65 72 5f 6c 6f 6f 70 0d 04 74 0e 4a 53 52 20 6f |er_loop..t.JSR o| 00000b70 73 77 72 63 68 0d 04 7e 41 44 45 59 20 20 20 20 |swrch..~ADEY | 00000b80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000b90 20 20 20 20 20 5c 20 43 68 61 72 61 63 74 65 72 | \ Character| 00000ba0 20 64 65 6c 65 74 65 64 20 73 6f 20 64 65 63 72 | deleted so decr| 00000bb0 65 61 73 65 20 59 0d 04 88 1c 4a 4d 50 20 69 6e |ease Y....JMP in| 00000bc0 70 75 74 5f 63 68 61 72 61 63 74 65 72 5f 6c 6f |put_character_lo| 00000bd0 6f 70 0d 04 92 05 20 0d 04 9c 14 2e 63 68 65 63 |op.... .....chec| 00000be0 6b 5f 63 68 61 72 61 63 74 65 72 0d 04 a6 05 20 |k_character.... | 00000bf0 0d 04 b0 44 5c 20 20 54 68 69 73 20 72 6f 75 74 |...D\ This rout| 00000c00 69 6e 65 20 74 61 6b 65 73 20 61 20 6e 65 77 20 |ine takes a new | 00000c10 63 68 61 72 61 63 74 65 72 20 69 6e 20 41 20 61 |character in A a| 00000c20 6e 64 20 63 68 65 63 6b 73 20 69 74 20 61 67 61 |nd checks it aga| 00000c30 69 6e 73 74 0d 04 ba 45 5c 20 20 74 68 65 20 76 |inst...E\ the v| 00000c40 61 6c 69 64 20 6c 69 73 74 2e 20 20 49 6e 76 61 |alid list. Inva| 00000c50 6c 69 64 20 63 68 61 72 61 63 74 65 72 73 20 61 |lid characters a| 00000c60 72 65 20 72 65 70 6c 61 63 65 64 20 62 79 20 61 |re replaced by a| 00000c70 20 6e 75 6c 6c 20 28 30 29 0d 04 c4 21 5c 20 20 | null (0)...!\ | 00000c80 69 6e 20 41 20 61 74 20 74 68 65 20 72 6f 75 74 |in A at the rout| 00000c90 69 6e 65 27 73 20 65 78 69 74 0d 04 ce 2b 5c 20 |ine's exit...+\ | 00000ca0 20 59 20 69 73 20 6e 6f 74 20 61 66 66 65 63 74 | Y is not affect| 00000cb0 65 64 20 62 75 74 20 58 20 69 73 20 64 65 73 74 |ed but X is dest| 00000cc0 72 6f 79 65 64 0d 04 d8 05 20 0d 04 e2 47 4c 44 |royed.... ...GLD| 00000cd0 58 20 23 30 20 20 20 20 20 20 20 20 20 20 20 20 |X #0 | 00000ce0 20 20 20 20 20 20 20 20 20 20 5c 20 53 65 74 20 | \ Set | 00000cf0 69 6e 64 65 78 20 74 6f 20 7a 65 72 6f 20 66 6f |index to zero fo| 00000d00 72 20 73 74 61 72 74 20 6f 66 20 73 74 72 69 6e |r start of strin| 00000d10 67 0d 04 ec 05 20 0d 04 f6 0f 2e 63 68 65 63 6b |g.... .....check| 00000d20 5f 6c 6f 6f 70 0d 05 00 05 20 0d 05 0a 07 50 48 |_loop.... ....PH| 00000d30 41 0d 05 14 49 4c 44 41 20 76 61 6c 69 64 5f 6c |A...ILDA valid_l| 00000d40 69 73 74 2c 20 58 20 20 20 20 20 20 20 20 20 20 |ist, X | 00000d50 20 5c 20 49 66 20 58 74 68 20 63 68 61 72 61 63 | \ If Xth charac| 00000d60 74 65 72 20 69 73 20 30 20 63 68 65 63 6b 20 69 |ter is 0 check i| 00000d70 73 20 66 69 6e 69 73 68 65 64 0d 05 1e 0f 42 45 |s finished....BE| 00000d80 51 20 69 6e 76 61 6c 69 64 0d 05 28 07 50 4c 41 |Q invalid..(.PLA| 00000d90 0d 05 32 4c 43 4d 50 20 76 61 6c 69 64 5f 6c 69 |..2LCMP valid_li| 00000da0 73 74 2c 20 58 20 20 20 20 20 20 20 20 20 20 20 |st, X | 00000db0 5c 20 43 6f 6d 70 61 72 65 20 41 20 77 69 74 68 |\ Compare A with| 00000dc0 20 58 74 68 20 63 68 61 72 61 63 74 65 72 20 69 | Xth character i| 00000dd0 6e 20 76 61 6c 69 64 20 6c 69 73 74 0d 05 3c 0d |n valid list..<.| 00000de0 42 45 51 20 76 61 6c 69 64 0d 05 46 07 49 4e 58 |BEQ valid..F.INX| 00000df0 0d 05 50 12 4a 4d 50 20 63 68 65 63 6b 5f 6c 6f |..P.JMP check_lo| 00000e00 6f 70 0d 05 5a 05 20 0d 05 64 0c 2e 69 6e 76 61 |op..Z. ..d..inva| 00000e10 6c 69 64 0d 05 6e 05 20 0d 05 78 07 50 4c 41 0d |lid..n. ..x.PLA.| 00000e20 05 82 47 4c 44 41 20 23 30 20 20 20 20 20 20 20 |..GLDA #0 | 00000e30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c | \| 00000e40 20 49 66 20 63 68 61 72 61 63 74 65 72 20 77 61 | If character wa| 00000e50 73 20 69 6e 76 61 6c 69 64 20 72 65 70 6c 61 63 |s invalid replac| 00000e60 65 20 62 79 20 30 0d 05 8c 05 20 0d 05 96 0a 2e |e by 0.... .....| 00000e70 76 61 6c 69 64 0d 05 a0 05 20 0d 05 aa 07 52 54 |valid.... ....RT| 00000e80 53 0d 05 b4 05 20 0d 05 be 2c 2e 76 61 6c 69 64 |S.... ...,.valid| 00000e90 5f 6c 69 73 74 20 20 20 20 4f 50 54 20 a4 45 51 |_list OPT .EQ| 00000ea0 55 53 28 22 2b 2d 30 31 32 33 34 35 36 37 38 39 |US("+-0123456789| 00000eb0 22 29 0d 05 c8 1f 20 20 20 20 20 20 20 20 20 20 |").... | 00000ec0 20 20 20 20 20 4f 50 54 20 a4 45 51 55 42 28 30 | OPT .EQUB(0| 00000ed0 29 0d 05 d2 35 2e 69 6e 70 75 74 5f 62 75 66 66 |)...5.input_buff| 00000ee0 65 72 20 20 4f 50 54 20 a4 45 51 55 4d 28 69 6e |er OPT .EQUM(in| 00000ef0 70 75 74 5f 62 75 66 66 65 72 5f 73 69 7a 65 2b |put_buffer_size+| 00000f00 31 2c 32 35 35 29 0d 05 dc 2f 2e 62 75 66 66 65 |1,255).../.buffe| 00000f10 72 5f 73 69 7a 65 20 20 20 4f 50 54 20 a4 45 51 |r_size OPT .EQ| 00000f20 55 42 28 69 6e 70 75 74 5f 62 75 66 66 65 72 5f |UB(input_buffer_| 00000f30 73 69 7a 65 29 0d 05 e6 1f 2e 73 74 72 69 6e 67 |size).....string| 00000f40 5f 6c 65 6e 67 74 68 20 4f 50 54 20 a4 45 51 55 |_length OPT .EQU| 00000f50 42 28 30 29 0d 05 f0 05 20 0d 05 fa 18 5c 5c 5c |B(0).... ....\\\| 00000f60 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c 5c |\\\\\\\\\\\\\\\\| 00000f70 5c 0d 06 04 05 20 0d 06 0e 1c 2e 63 6f 6e 76 65 |\.... .....conve| 00000f80 72 74 5f 41 53 43 49 49 5f 74 6f 5f 62 69 6e 61 |rt_ASCII_to_bina| 00000f90 72 79 0d 06 18 05 20 0d 06 22 38 5c 20 20 54 68 |ry.... .."8\ Th| 00000fa0 69 73 20 73 75 62 72 6f 75 74 69 6e 65 20 74 61 |is subroutine ta| 00000fb0 6b 65 73 20 74 68 65 20 97 49 49 20 69 6e 20 74 |kes the .II in t| 00000fc0 68 65 20 69 6e 70 75 74 20 62 75 66 66 65 72 0d |he input buffer.| 00000fd0 06 2c 3b 5c 20 20 61 6e 64 20 63 6f 6e 76 65 72 |.,;\ and conver| 00000fe0 74 73 20 69 74 20 69 6e 74 6f 20 61 20 66 6f 75 |ts it into a fou| 00000ff0 72 20 62 79 74 65 20 62 69 6e 61 72 79 20 6e 75 |r byte binary nu| 00001000 6d 62 65 72 20 77 68 69 63 68 0d 06 36 3c 5c 20 |mber which..6<\ | 00001010 20 69 74 20 6c 65 61 76 65 73 20 69 6e 20 27 64 | it leaves in 'd| 00001020 69 67 69 74 5f 77 73 27 2e 20 4e 75 6d 62 65 72 |igit_ws'. Number| 00001030 73 20 6f 76 65 72 20 34 20 62 79 74 65 73 20 69 |s over 4 bytes i| 00001040 6e 20 73 69 7a 65 0d 06 40 29 5c 20 20 61 72 65 |n size..@)\ are| 00001050 20 74 72 61 70 70 65 64 20 64 75 72 69 6e 67 20 | trapped during | 00001060 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e 2e 0d |the conversion..| 00001070 06 4a 05 20 0d 06 54 3f 4c 44 41 20 23 30 20 20 |.J. ..T?LDA #0 | 00001080 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00001090 20 20 20 20 5c 20 43 6c 65 61 72 20 76 61 72 69 | \ Clear vari| 000010a0 6f 75 73 20 62 75 66 66 65 72 73 20 26 20 66 6c |ous buffers & fl| 000010b0 61 67 73 0d 06 5e 11 53 54 41 20 73 69 67 6e 5f |ags..^.STA sign_| 000010c0 66 6c 61 67 0d 06 68 10 53 54 41 20 64 69 67 69 |flag..h.STA digi| 000010d0 74 5f 77 73 0d 06 72 12 53 54 41 20 64 69 67 69 |t_ws..r.STA digi| 000010e0 74 5f 77 73 2b 31 0d 06 7c 12 53 54 41 20 64 69 |t_ws+1..|.STA di| 000010f0 67 69 74 5f 77 73 2b 32 0d 06 86 12 53 54 41 20 |git_ws+2....STA | 00001100 64 69 67 69 74 5f 77 73 2b 33 0d 06 90 3b 4c 44 |digit_ws+3...;LD| 00001110 58 20 23 32 35 35 20 20 20 20 20 20 20 20 20 20 |X #255 | 00001120 20 20 20 20 20 20 20 20 20 20 5c 20 52 65 73 65 | \ Rese| 00001130 74 20 63 6f 75 6e 74 65 72 20 74 6f 20 2d 31 20 |t counter to -1 | 00001140 28 32 35 35 29 0d 06 9a 05 20 0d 06 a4 44 5c 20 |(255).... ...D\ | 00001150 54 61 6b 65 20 65 61 63 68 20 64 69 67 69 74 20 |Take each digit | 00001160 6f 66 66 20 69 6e 70 75 74 20 6c 69 6e 65 20 69 |off input line i| 00001170 6e 20 74 75 72 6e 20 61 6e 64 20 63 68 65 63 6b |n turn and check| 00001180 20 69 74 20 69 73 20 62 65 74 77 65 65 6e 0d 06 | it is between..| 00001190 ae 46 5c 20 30 20 61 6e 64 20 39 2e 20 20 49 66 |.F\ 0 and 9. If| 000011a0 20 6e 6f 74 20 63 68 65 63 6b 20 66 6f 72 20 61 | not check for a| 000011b0 20 73 69 67 6e 20 28 2b 20 6f 72 20 2d 29 20 6f | sign (+ or -) o| 000011c0 72 20 67 65 6e 65 72 61 74 65 20 61 6e 20 65 72 |r generate an er| 000011d0 72 6f 72 2e 0d 06 b8 05 20 0d 06 c2 0f 2e 69 6e |ror..... .....in| 000011e0 70 75 74 5f 6c 6f 6f 70 0d 06 cc 05 20 0d 06 d6 |put_loop.... ...| 000011f0 07 49 4e 58 0d 06 e0 17 4c 44 41 20 69 6e 70 75 |.INX....LDA inpu| 00001200 74 5f 62 75 66 66 65 72 2c 20 58 0d 06 ea 0d 43 |t_buffer, X....C| 00001210 4d 50 20 23 97 22 30 22 0d 06 f4 12 42 43 43 20 |MP #."0"....BCC | 00001220 6e 6f 74 5f 6e 75 6d 62 65 72 0d 06 fe 0f 43 4d |not_number....CM| 00001230 50 20 23 97 22 39 22 2b 31 0d 07 08 12 42 43 53 |P #."9"+1....BCS| 00001240 20 6e 6f 74 5f 6e 75 6d 62 65 72 0d 07 12 07 53 | not_number....S| 00001250 45 43 0d 07 1c 0d 53 42 43 20 23 97 22 30 22 0d |EC....SBC #."0".| 00001260 07 26 16 4a 53 52 20 70 72 6f 63 65 73 73 5f 6e |.&.JSR process_n| 00001270 75 6d 62 65 72 0d 07 30 12 4a 4d 50 20 69 6e 70 |umber..0.JMP inp| 00001280 75 74 5f 6c 6f 6f 70 0d 07 3a 05 20 0d 07 44 05 |ut_loop..:. ..D.| 00001290 20 0d 07 4e 42 5c 20 49 66 20 66 69 72 73 74 20 | ..NB\ If first | 000012a0 64 69 67 69 74 20 69 73 20 6e 6f 74 20 61 20 6e |digit is not a n| 000012b0 75 6d 62 65 72 20 63 68 65 63 6b 20 74 6f 20 73 |umber check to s| 000012c0 65 65 20 69 66 20 69 74 20 69 73 20 61 20 73 69 |ee if it is a si| 000012d0 67 6e 2e 0d 07 58 20 5c 20 49 66 20 61 20 70 6c |gn...X \ If a pl| 000012e0 75 73 20 74 68 65 6e 20 64 6f 20 6e 6f 74 68 69 |us then do nothi| 000012f0 6e 67 2e 0d 07 62 27 5c 20 49 66 20 61 20 6d 69 |ng...b'\ If a mi| 00001300 6e 75 73 20 74 68 65 6e 20 73 65 74 20 74 68 65 |nus then set the| 00001310 20 73 69 67 6e 20 66 6c 61 67 0d 07 6c 05 20 0d | sign flag..l. .| 00001320 07 76 0f 2e 6e 6f 74 5f 6e 75 6d 62 65 72 0d 07 |.v..not_number..| 00001330 80 05 20 0d 07 8a 0a 43 50 58 20 23 30 0d 07 94 |.. ....CPX #0...| 00001340 1e 42 4e 45 20 65 78 69 74 5f 6e 75 6d 62 65 72 |.BNE exit_number| 00001350 5f 63 6f 6e 76 65 72 73 69 6f 6e 0d 07 9e 0d 43 |_conversion....C| 00001360 4d 50 20 23 97 22 2b 22 0d 07 a8 12 42 45 51 20 |MP #."+"....BEQ | 00001370 69 6e 70 75 74 5f 6c 6f 6f 70 0d 07 b2 0d 43 4d |input_loop....CM| 00001380 50 20 23 97 22 2d 22 0d 07 bc 43 42 4e 45 20 65 |P #."-"...CBNE e| 00001390 72 72 6f 72 5f 4e 20 20 20 20 20 20 20 20 20 20 |rror_N | 000013a0 20 20 20 20 20 20 20 5c 20 54 68 69 73 20 62 72 | \ This br| 000013b0 61 6e 63 68 20 69 73 20 61 63 74 75 61 6c 6c 79 |anch is actually| 000013c0 20 72 65 64 75 6e 64 61 6e 74 0d 07 c6 0a 4c 44 | redundant....LD| 000013d0 41 20 23 31 0d 07 d0 11 53 54 41 20 73 69 67 6e |A #1....STA sign| 000013e0 5f 66 6c 61 67 0d 07 da 12 4a 4d 50 20 69 6e 70 |_flag....JMP inp| 000013f0 75 74 5f 6c 6f 6f 70 0d 07 e4 05 20 0d 07 ee 0c |ut_loop.... ....| 00001400 2e 65 72 72 6f 72 5f 4e 0d 07 f8 05 20 0d 08 02 |.error_N.... ...| 00001410 07 42 52 4b 0d 08 0c 12 4f 50 54 20 a4 45 51 55 |.BRK....OPT .EQU| 00001420 42 28 32 35 35 29 0d 08 16 2d 4f 50 54 20 a4 45 |B(255)...-OPT .E| 00001430 51 55 53 28 22 4e 75 6d 62 65 72 20 65 6e 74 65 |QUS("Number ente| 00001440 72 65 64 20 69 73 20 69 6e 76 61 6c 69 64 22 2b |red is invalid"+| 00001450 bd 30 29 0d 08 20 05 20 0d 08 2a 36 5c 20 4f 6e |.0).. . ..*6\ On| 00001460 20 79 6f 75 72 20 77 61 79 20 6f 75 74 20 63 68 | your way out ch| 00001470 65 63 6b 20 74 68 65 20 73 69 67 6e 20 66 6c 61 |eck the sign fla| 00001480 67 2e 20 49 66 20 73 65 74 20 6d 61 6b 65 0d 08 |g. If set make..| 00001490 34 41 5c 20 64 69 67 69 74 5f 77 73 20 6e 65 67 |4A\ digit_ws neg| 000014a0 61 74 69 76 65 20 62 79 20 73 75 62 74 72 61 63 |ative by subtrac| 000014b0 74 69 6e 67 20 74 68 65 20 6e 75 6d 62 65 72 20 |ting the number | 000014c0 69 6e 20 69 74 20 66 72 6f 6d 20 7a 65 72 6f 0d |in it from zero.| 000014d0 08 3e 05 20 0d 08 48 1b 2e 65 78 69 74 5f 6e 75 |.>. ..H..exit_nu| 000014e0 6d 62 65 72 5f 63 6f 6e 76 65 72 73 69 6f 6e 0d |mber_conversion.| 000014f0 08 52 05 20 0d 08 5c 11 4c 44 41 20 73 69 67 6e |.R. ..\.LDA sign| 00001500 5f 66 6c 61 67 0d 08 66 10 42 45 51 20 70 6f 73 |_flag..f.BEQ pos| 00001510 69 74 69 76 65 0d 08 70 07 53 45 43 0d 08 7a 0a |itive..p.SEC..z.| 00001520 4c 44 41 20 23 30 0d 08 84 10 53 42 43 20 64 69 |LDA #0....SBC di| 00001530 67 69 74 5f 77 73 0d 08 8e 10 53 54 41 20 64 69 |git_ws....STA di| 00001540 67 69 74 5f 77 73 0d 08 98 0a 4c 44 41 20 23 30 |git_ws....LDA #0| 00001550 0d 08 a2 12 53 42 43 20 64 69 67 69 74 5f 77 73 |....SBC digit_ws| 00001560 2b 31 0d 08 ac 12 53 54 41 20 64 69 67 69 74 5f |+1....STA digit_| 00001570 77 73 2b 31 0d 08 b6 0a 4c 44 41 20 23 30 0d 08 |ws+1....LDA #0..| 00001580 c0 12 53 42 43 20 64 69 67 69 74 5f 77 73 2b 32 |..SBC digit_ws+2| 00001590 0d 08 ca 12 53 54 41 20 64 69 67 69 74 5f 77 73 |....STA digit_ws| 000015a0 2b 32 0d 08 d4 0a 4c 44 41 20 23 30 0d 08 de 12 |+2....LDA #0....| 000015b0 53 42 43 20 64 69 67 69 74 5f 77 73 2b 33 0d 08 |SBC digit_ws+3..| 000015c0 e8 12 53 54 41 20 64 69 67 69 74 5f 77 73 2b 33 |..STA digit_ws+3| 000015d0 0d 08 f2 05 20 0d 08 fc 0d 2e 70 6f 73 69 74 69 |.... .....positi| 000015e0 76 65 0d 09 06 05 20 0d 09 10 07 52 54 53 0d 09 |ve.... ....RTS..| 000015f0 1a 05 20 0d 09 24 1b 2e 6e 75 6d 62 65 72 20 20 |.. ..$..number | 00001600 20 20 4f 50 54 20 a4 45 51 55 44 28 30 29 0d 09 | OPT .EQUD(0)..| 00001610 2e 41 2e 62 61 73 65 20 20 20 20 20 20 4f 50 54 |.A.base OPT| 00001620 20 a4 45 51 55 42 28 31 30 29 20 20 20 5c 20 57 | .EQUB(10) \ W| 00001630 65 27 6c 6c 20 73 74 69 63 6b 20 77 69 74 68 20 |e'll stick with | 00001640 62 61 73 65 20 31 30 20 66 6f 72 20 6e 6f 77 0d |base 10 for now.| 00001650 09 38 1b 2e 64 69 67 69 74 5f 77 73 20 20 4f 50 |.8..digit_ws OP| 00001660 54 20 a4 45 51 55 44 28 30 29 0d 09 42 1b 2e 70 |T .EQUD(0)..B..p| 00001670 70 77 73 20 20 20 20 20 20 4f 50 54 20 a4 45 51 |pws OPT .EQ| 00001680 55 44 28 30 29 0d 09 4c 1b 2e 73 69 67 6e 5f 66 |UD(0)..L..sign_f| 00001690 6c 61 67 20 4f 50 54 20 a4 45 51 55 42 28 30 29 |lag OPT .EQUB(0)| 000016a0 0d 09 56 1b 2e 61 63 63 75 73 74 6f 72 65 20 4f |..V..accustore O| 000016b0 50 54 20 a4 45 51 55 42 28 30 29 0d 09 60 05 20 |PT .EQUB(0)..`. | 000016c0 0d 09 6a 42 5c 20 46 6f 72 20 65 61 63 68 20 6e |..jB\ For each n| 000016d0 65 77 20 64 69 67 69 74 20 65 6e 74 65 72 65 64 |ew digit entered| 000016e0 20 6d 75 6c 74 69 70 6c 79 20 74 68 65 20 27 6e | multiply the 'n| 000016f0 75 6d 62 65 72 20 73 6f 20 66 61 72 27 20 68 65 |umber so far' he| 00001700 6c 64 0d 09 74 46 5c 20 69 6e 20 64 69 67 69 74 |ld..tF\ in digit| 00001710 5f 77 73 2c 20 62 79 20 74 68 65 20 6e 75 6d 65 |_ws, by the nume| 00001720 72 69 63 20 62 61 73 65 20 61 6e 64 20 61 64 64 |ric base and add| 00001730 20 6e 65 78 74 20 6e 75 6d 62 65 72 20 74 6f 20 | next number to | 00001740 64 69 67 69 74 5f 77 73 0d 09 7e 05 20 0d 09 88 |digit_ws..~. ...| 00001750 13 2e 70 72 6f 63 65 73 73 5f 6e 75 6d 62 65 72 |..process_number| 00001760 0d 09 92 05 20 0d 09 9c 11 53 54 41 20 61 63 63 |.... ....STA acc| 00001770 75 73 74 6f 72 65 0d 09 a6 07 54 58 41 0d 09 b0 |ustore....TXA...| 00001780 07 50 48 41 0d 09 ba 14 4a 53 52 20 6d 75 6c 74 |.PHA....JSR mult| 00001790 5f 62 79 5f 62 61 73 65 0d 09 c4 11 4c 44 41 20 |_by_base....LDA | 000017a0 61 63 63 75 73 74 6f 72 65 0d 09 ce 07 43 4c 43 |accustore....CLC| 000017b0 0d 09 d8 10 41 44 43 20 64 69 67 69 74 5f 77 73 |....ADC digit_ws| 000017c0 0d 09 e2 10 53 54 41 20 64 69 67 69 74 5f 77 73 |....STA digit_ws| 000017d0 0d 09 ec 0a 4c 44 41 20 23 30 0d 09 f6 12 41 44 |....LDA #0....AD| 000017e0 43 20 64 69 67 69 74 5f 77 73 2b 31 0d 0a 00 12 |C digit_ws+1....| 000017f0 53 54 41 20 64 69 67 69 74 5f 77 73 2b 31 0d 0a |STA digit_ws+1..| 00001800 0a 0a 4c 44 41 20 23 30 0d 0a 14 12 41 44 43 20 |..LDA #0....ADC | 00001810 64 69 67 69 74 5f 77 73 2b 32 0d 0a 1e 12 53 54 |digit_ws+2....ST| 00001820 41 20 64 69 67 69 74 5f 77 73 2b 32 0d 0a 28 0a |A digit_ws+2..(.| 00001830 4c 44 41 20 23 30 0d 0a 32 12 41 44 43 20 64 69 |LDA #0..2.ADC di| 00001840 67 69 74 5f 77 73 2b 33 0d 0a 3c 12 53 54 41 20 |git_ws+3..<.STA | 00001850 64 69 67 69 74 5f 77 73 2b 33 0d 0a 46 46 42 4d |digit_ws+3..FFBM| 00001860 49 20 65 72 72 6f 72 5f 4c 5f 61 64 64 20 20 20 |I error_L_add | 00001870 20 20 20 20 20 20 20 20 20 20 5c 20 49 66 20 6e | \ If n| 00001880 6f 20 62 65 63 6f 6d 65 73 20 6e 65 67 61 74 69 |o becomes negati| 00001890 76 65 20 69 74 20 69 73 20 74 6f 6f 20 62 69 67 |ve it is too big| 000018a0 0d 0a 50 05 20 0d 0a 5a 07 50 4c 41 0d 0a 64 07 |..P. ..Z.PLA..d.| 000018b0 54 41 58 0d 0a 6e 07 52 54 53 0d 0a 78 05 20 0d |TAX..n.RTS..x. .| 000018c0 0a 82 10 2e 65 72 72 6f 72 5f 4c 5f 61 64 64 0d |....error_L_add.| 000018d0 0a 8c 05 20 0d 0a 96 07 42 52 4b 0d 0a a0 12 4f |... ....BRK....O| 000018e0 50 54 20 a4 45 51 55 42 28 32 35 34 29 0d 0a aa |PT .EQUB(254)...| 000018f0 4e 4f 50 54 20 a4 45 51 55 53 28 22 54 68 65 20 |NOPT .EQUS("The | 00001900 6e 75 6d 62 65 72 20 65 6e 74 65 72 65 64 20 69 |number entered i| 00001910 73 20 74 6f 6f 20 6c 61 72 67 65 22 2b bd 31 33 |s too large"+.13| 00001920 2b bd 31 30 2b 22 54 72 61 70 20 69 6e 20 61 64 |+.10+"Trap in ad| 00001930 64 69 74 69 6f 6e 22 2b bd 30 29 0d 0a b4 05 20 |dition"+.0).... | 00001940 0d 0a be 45 5c 20 54 61 6b 65 20 74 68 65 20 6e |...E\ Take the n| 00001950 75 6d 62 65 72 20 68 65 6c 64 20 69 6e 20 64 69 |umber held in di| 00001960 67 69 74 5f 77 73 2c 20 6d 75 6c 74 20 62 79 20 |git_ws, mult by | 00001970 74 68 65 20 6e 75 6d 65 72 69 63 20 62 61 73 65 |the numeric base| 00001980 20 28 31 30 29 0d 0a c8 1f 5c 20 61 6e 64 20 72 | (10)....\ and r| 00001990 65 74 75 72 6e 20 69 74 20 74 6f 20 64 69 67 69 |eturn it to digi| 000019a0 74 5f 77 73 0d 0a d2 05 20 0d 0a dc 11 2e 6d 75 |t_ws.... .....mu| 000019b0 6c 74 5f 62 79 5f 62 61 73 65 0d 0a e6 05 20 0d |lt_by_base.... .| 000019c0 0a f0 41 4c 44 41 20 23 30 20 20 20 20 20 20 20 |..ALDA #0 | 000019d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c | \| 000019e0 20 43 6c 65 61 72 20 70 61 72 74 69 61 6c 20 70 | Clear partial p| 000019f0 72 6f 64 75 63 74 20 77 6f 72 6b 73 70 61 63 65 |roduct workspace| 00001a00 0d 0a fa 0c 53 54 41 20 70 70 77 73 0d 0b 04 0e |....STA ppws....| 00001a10 53 54 41 20 70 70 77 73 2b 31 0d 0b 0e 0e 53 54 |STA ppws+1....ST| 00001a20 41 20 70 70 77 73 2b 32 0d 0b 18 0e 53 54 41 20 |A ppws+2....STA | 00001a30 70 70 77 73 2b 33 0d 0b 22 05 20 0d 0b 2c 0c 4c |ppws+3..". ..,.L| 00001a40 44 41 20 62 61 73 65 0d 0b 36 05 20 0d 0b 40 16 |DA base..6. ..@.| 00001a50 2e 6d 75 6c 74 5f 62 79 5f 62 61 73 65 5f 6c 6f |.mult_by_base_lo| 00001a60 6f 70 0d 0b 4a 05 20 0d 0b 54 09 4c 53 52 20 41 |op..J. ..T.LSR A| 00001a70 0d 0b 5e 07 50 48 41 0d 0b 68 0e 42 43 43 20 6e |..^.PHA..h.BCC n| 00001a80 6f 5f 61 64 64 0d 0b 72 47 43 4c 43 20 20 20 20 |o_add..rGCLC | 00001a90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00001aa0 20 20 20 20 20 5c 20 49 66 20 63 75 72 72 65 6e | \ If curren| 00001ab0 74 20 62 69 74 20 6f 66 20 6d 75 6c 74 69 70 6c |t bit of multipl| 00001ac0 69 65 72 20 73 65 74 20 74 68 65 6e 0d 0b 7c 42 |ier set then..|B| 00001ad0 4c 44 41 20 70 70 77 73 20 20 20 20 20 20 20 20 |LDA ppws | 00001ae0 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 61 64 | \ ad| 00001af0 64 20 72 6f 74 61 74 65 64 20 6d 75 6c 74 69 70 |d rotated multip| 00001b00 6c 69 63 61 6e 64 20 74 6f 20 70 70 77 73 0d 0b |licand to ppws..| 00001b10 86 10 41 44 43 20 64 69 67 69 74 5f 77 73 0d 0b |..ADC digit_ws..| 00001b20 90 0c 53 54 41 20 70 70 77 73 0d 0b 9a 0e 4c 44 |..STA ppws....LD| 00001b30 41 20 70 70 77 73 2b 31 0d 0b a4 12 41 44 43 20 |A ppws+1....ADC | 00001b40 64 69 67 69 74 5f 77 73 2b 31 0d 0b ae 0e 53 54 |digit_ws+1....ST| 00001b50 41 20 70 70 77 73 2b 31 0d 0b b8 0e 4c 44 41 20 |A ppws+1....LDA | 00001b60 70 70 77 73 2b 32 0d 0b c2 12 41 44 43 20 64 69 |ppws+2....ADC di| 00001b70 67 69 74 5f 77 73 2b 32 0d 0b cc 0e 53 54 41 20 |git_ws+2....STA | 00001b80 70 70 77 73 2b 32 0d 0b d6 0e 4c 44 41 20 70 70 |ppws+2....LDA pp| 00001b90 77 73 2b 33 0d 0b e0 12 41 44 43 20 64 69 67 69 |ws+3....ADC digi| 00001ba0 74 5f 77 73 2b 33 0d 0b ea 0e 53 54 41 20 70 70 |t_ws+3....STA pp| 00001bb0 77 73 2b 33 0d 0b f4 46 42 4d 49 20 65 72 72 6f |ws+3...FBMI erro| 00001bc0 72 5f 4c 5f 61 64 64 20 20 20 20 20 20 20 20 20 |r_L_add | 00001bd0 20 20 20 20 5c 20 49 66 20 6e 6f 20 62 65 63 6f | \ If no beco| 00001be0 6d 65 73 20 6e 65 67 61 74 69 76 65 20 69 74 20 |mes negative it | 00001bf0 69 73 20 74 6f 6f 20 62 69 67 0d 0b fe 05 20 0d |is too big.... .| 00001c00 0c 08 0b 2e 6e 6f 5f 61 64 64 0d 0c 12 05 20 0d |....no_add.... .| 00001c10 0c 1c 07 50 4c 41 0d 0c 26 0a 43 4d 50 20 23 30 |...PLA..&.CMP #0| 00001c20 0d 0c 30 16 42 45 51 20 65 78 69 74 5f 62 61 73 |..0.BEQ exit_bas| 00001c30 65 5f 6c 6f 6f 70 0d 0c 3a 35 41 53 4c 20 64 69 |e_loop..:5ASL di| 00001c40 67 69 74 5f 77 73 20 20 20 20 20 20 20 20 20 20 |git_ws | 00001c50 20 20 20 20 20 20 5c 20 52 6f 74 61 74 65 20 6d | \ Rotate m| 00001c60 75 6c 74 69 70 6c 69 63 61 6e 64 0d 0c 44 12 52 |ultiplicand..D.R| 00001c70 4f 4c 20 64 69 67 69 74 5f 77 73 2b 31 0d 0c 4e |OL digit_ws+1..N| 00001c80 12 52 4f 4c 20 64 69 67 69 74 5f 77 73 2b 32 0d |.ROL digit_ws+2.| 00001c90 0c 58 12 52 4f 4c 20 64 69 67 69 74 5f 77 73 2b |.X.ROL digit_ws+| 00001ca0 33 0d 0c 62 46 42 4d 49 20 65 72 72 6f 72 5f 4c |3..bFBMI error_L| 00001cb0 5f 72 6f 74 20 20 20 20 20 20 20 20 20 20 20 20 |_rot | 00001cc0 20 5c 20 49 66 20 6e 6f 20 62 65 63 6f 6d 65 73 | \ If no becomes| 00001cd0 20 6e 65 67 61 74 69 76 65 20 69 74 20 69 73 20 | negative it is | 00001ce0 74 6f 6f 20 62 69 67 0d 0c 6c 19 4a 4d 50 20 6d |too big..l.JMP m| 00001cf0 75 6c 74 5f 62 79 5f 62 61 73 65 5f 6c 6f 6f 70 |ult_by_base_loop| 00001d00 0d 0c 76 05 20 0d 0c 80 10 2e 65 72 72 6f 72 5f |..v. .....error_| 00001d10 4c 5f 72 6f 74 0d 0c 8a 05 20 0d 0c 94 07 42 52 |L_rot.... ....BR| 00001d20 4b 0d 0c 9e 12 4f 50 54 20 a4 45 51 55 42 28 32 |K....OPT .EQUB(2| 00001d30 35 33 29 0d 0c a8 4e 4f 50 54 20 a4 45 51 55 53 |53)...NOPT .EQUS| 00001d40 28 22 54 68 65 20 6e 75 6d 62 65 72 20 65 6e 74 |("The number ent| 00001d50 65 72 65 64 20 69 73 20 74 6f 6f 20 6c 61 72 67 |ered is too larg| 00001d60 65 22 2b bd 31 33 2b bd 31 30 2b 22 54 72 61 70 |e"+.13+.10+"Trap| 00001d70 20 69 6e 20 72 6f 74 61 74 69 6f 6e 22 2b bd 30 | in rotation"+.0| 00001d80 29 0d 0c b2 05 20 0d 0c bc 13 2e 65 78 69 74 5f |).... .....exit_| 00001d90 62 61 73 65 5f 6c 6f 6f 70 0d 0c c6 05 20 0d 0c |base_loop.... ..| 00001da0 d0 3f 4c 44 41 20 70 70 77 73 20 20 20 20 20 20 |.?LDA ppws | 00001db0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 00001dc0 50 75 74 20 72 65 73 75 6c 74 20 62 61 63 6b 20 |Put result back | 00001dd0 69 6e 74 6f 20 64 69 67 69 74 5f 77 73 0d 0c da |into digit_ws...| 00001de0 10 53 54 41 20 64 69 67 69 74 5f 77 73 0d 0c e4 |.STA digit_ws...| 00001df0 0e 4c 44 41 20 70 70 77 73 2b 31 0d 0c ee 12 53 |.LDA ppws+1....S| 00001e00 54 41 20 64 69 67 69 74 5f 77 73 2b 31 0d 0c f8 |TA digit_ws+1...| 00001e10 0e 4c 44 41 20 70 70 77 73 2b 32 0d 0d 02 12 53 |.LDA ppws+2....S| 00001e20 54 41 20 64 69 67 69 74 5f 77 73 2b 32 0d 0d 0c |TA digit_ws+2...| 00001e30 0e 4c 44 41 20 70 70 77 73 2b 33 0d 0d 16 12 53 |.LDA ppws+3....S| 00001e40 54 41 20 64 69 67 69 74 5f 77 73 2b 33 0d 0d 20 |TA digit_ws+3.. | 00001e50 05 20 0d 0d 2a 07 52 54 53 0d 0d 34 05 20 0d 0d |. ..*.RTS..4. ..| 00001e60 3e 05 5d 0d 0d 48 05 ed 0d 0d 52 05 20 0d 0d 5c |>.]..H....R. ..\| 00001e70 0e ee 20 85 20 e5 20 8d 74 58 4d 0d 0d 66 0b 40 |.. . . .tXM..f.@| 00001e80 25 3d 26 41 30 41 0d 0d 70 05 f5 0d 0d 7a 0b d6 |%=&A0A..p....z..| 00001e90 20 63 6f 64 65 25 0d 0d 84 36 f1 27 22 43 48 45 | code%...6.'"CHE| 00001ea0 43 4b 3a 20 64 69 67 69 74 5f 77 73 20 3d 20 22 |CK: digit_ws = "| 00001eb0 3b 21 64 69 67 69 74 5f 77 73 3b 22 20 2f 20 26 |;!digit_ws;" / &| 00001ec0 22 3b 7e 21 64 69 67 69 74 5f 77 73 0d 0d 8e 06 |";~!digit_ws....| 00001ed0 fd 30 0d 0d 98 05 f6 0d 0d a2 05 f1 0d 0d ac 0f |.0..............| 00001ee0 e7 20 9f 3c 32 35 33 20 8c 20 e0 0d 0d b6 09 e5 |. .<253 . ......| 00001ef0 8d 44 70 4d 0d 0d c0 05 20 0d 0d ca 1b 2a 2a 2a |.DpM.... ....***| 00001f00 2a 20 45 51 55 61 74 65 20 61 20 42 79 74 65 20 |* EQUate a Byte | 00001f10 2a 2a 2a 2a 0d 0d d4 0f dd 20 a4 45 51 55 42 28 |****..... .EQUB(| 00001f20 4e 25 29 0d 0d de 10 3f 50 25 3d 4e 25 20 83 20 |N%)....?P%=N% . | 00001f30 32 35 36 0d 0d e8 1e e7 20 28 70 61 73 73 25 20 |256..... (pass% | 00001f40 80 20 33 29 20 3d 20 33 20 8c 20 f1 20 7e 3f 50 |. 3) = 3 . . ~?P| 00001f50 25 0d 0d f2 0b 50 25 3d 50 25 2b 31 0d 0d fc 0a |%....P%=P%+1....| 00001f60 3d 70 61 73 73 25 0d 0e 06 05 20 0d 0e 10 2c 2a |=pass%.... ...,*| 00001f70 2a 2a 2a 20 45 51 55 61 74 65 20 61 20 44 6f 75 |*** EQUate a Dou| 00001f80 62 6c 65 20 77 6f 72 64 20 28 34 20 62 79 74 65 |ble word (4 byte| 00001f90 73 29 20 2a 2a 2a 2a 0d 0e 1a 0f dd 20 a4 45 51 |s) ****..... .EQ| 00001fa0 55 44 28 4e 25 29 0d 0e 24 08 ea 20 58 25 0d 0e |UD(N%)..$.. X%..| 00001fb0 2e 0a 21 50 25 3d 4e 25 0d 0e 38 0e e3 20 58 25 |..!P%=N%..8.. X%| 00001fc0 3d 30 20 b8 20 33 0d 0e 42 21 e7 20 28 70 61 73 |=0 . 3..B!. (pas| 00001fd0 73 25 20 80 20 33 29 20 3d 20 33 20 8c 20 f1 20 |s% . 3) = 3 . . | 00001fe0 7e 50 25 3f 58 25 3b 0d 0e 4c 05 ed 0d 0e 56 19 |~P%?X%;..L....V.| 00001ff0 e7 20 28 70 61 73 73 25 20 80 20 33 29 20 3d 20 |. (pass% . 3) = | 00002000 33 20 8c 20 f1 0d 0e 60 0b 50 25 3d 50 25 2b 34 |3 . ...`.P%=P%+4| 00002010 0d 0e 6a 0a 3d 70 61 73 73 25 0d 0e 74 05 20 0d |..j.=pass%..t. .| 00002020 0e 7e 1d 2a 2a 2a 2a 20 45 51 55 61 74 65 20 61 |.~.**** EQUate a| 00002030 20 53 74 72 69 6e 67 20 2a 2a 2a 2a 0d 0e 88 0f | String ****....| 00002040 dd 20 a4 45 51 55 53 28 4e 24 29 0d 0e 92 08 ea |. .EQUS(N$).....| 00002050 20 4e 25 0d 0e 9c 08 fe 20 34 30 0d 0e a6 12 e3 | N%..... 40.....| 00002060 20 4e 25 3d 31 20 b8 20 a9 28 4e 24 29 0d 0e b0 | N%=1 . .(N$)...| 00002070 13 4b 25 3d 97 28 c1 4e 24 2c 4e 25 2c 31 29 29 |.K%=.(.N$,N%,1))| 00002080 0d 0e ba 10 50 25 3f 28 4e 25 2d 31 29 3d 4b 25 |....P%?(N%-1)=K%| 00002090 0d 0e c4 25 e7 20 28 70 61 73 73 25 20 80 20 33 |...%. (pass% . 3| 000020a0 29 20 3d 20 33 20 8c 20 f1 20 7e 50 25 3f 28 4e |) = 3 . . ~P%?(N| 000020b0 25 2d 31 29 3b 0d 0e ce 05 ed 0d 0e d8 19 e7 20 |%-1);.......... | 000020c0 28 70 61 73 73 25 20 80 20 33 29 20 3d 20 33 20 |(pass% . 3) = 3 | 000020d0 8c 20 f1 0d 0e e2 0f 50 25 3d 50 25 2b a9 28 4e |. .....P%=P%+.(N| 000020e0 24 29 0d 0e ec 07 fe 20 30 0d 0e f6 0a 3d 70 61 |$)..... 0....=pa| 000020f0 73 73 25 0d 0f 00 05 20 0d 0f 0a 28 2a 2a 2a 2a |ss%.... ...(****| 00002100 20 45 51 55 61 74 65 20 61 20 73 65 63 74 69 6f | EQUate a sectio| 00002110 6e 20 6f 66 20 4d 65 6d 6f 72 79 20 2a 2a 2a 2a |n of Memory ****| 00002120 0d 0f 14 1a dd 20 a4 45 51 55 4d 28 6e 75 6d 62 |..... .EQUM(numb| 00002130 65 72 25 2c 62 79 74 65 25 29 0d 0f 1e 08 ea 20 |er%,byte%)..... | 00002140 4e 25 0d 0f 28 08 fe 20 34 30 0d 0f 32 16 e3 20 |N%..(.. 40..2.. | 00002150 4e 25 3d 30 20 b8 20 6e 75 6d 62 65 72 25 2d 31 |N%=0 . number%-1| 00002160 0d 0f 3c 0f 50 25 3f 4e 25 3d 62 79 74 65 25 0d |..<.P%?N%=byte%.| 00002170 0f 46 21 e7 20 28 70 61 73 73 25 20 80 20 33 29 |.F!. (pass% . 3)| 00002180 20 3d 20 33 20 8c 20 f1 20 7e 50 25 3f 4e 25 3b | = 3 . . ~P%?N%;| 00002190 0d 0f 50 05 ed 0d 0f 5a 19 e7 20 28 70 61 73 73 |..P....Z.. (pass| 000021a0 25 20 80 20 33 29 20 3d 20 33 20 8c 20 f1 0d 0f |% . 3) = 3 . ...| 000021b0 64 11 50 25 3d 50 25 2b 6e 75 6d 62 65 72 25 0d |d.P%=P%+number%.| 000021c0 0f 6e 07 fe 20 30 0d 0f 78 0a 3d 70 61 73 73 25 |.n.. 0..x.=pass%| 000021d0 0d ff |..| 000021d2