Home » CEEFAX disks » telesoftware5.adl » 20-02-88/B\OSB14
20-02-88/B\OSB14
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: | 20-02-88/B\OSB14 |
Read OK: | ✔ |
File size: | 0FA7 bytes |
Load address: | 0800 |
Exec address: | 8023 |
File contents
10REM OSbits Module B/osb14 20REM Binary to ASCII 30REM Decimal only 40REM Version 1.2 8.3.87 50 60*KEY1MODE3|M|NLIST|M 70 80REM : Set routine addresses 90oswrch = &FFEE 100osnewl = &FFE7 110output_buffer_size=11 120 130DIM code% &100 140 150FOR pass% = 0 TO 2 STEP 2 160P% = code% 170 180[OPT pass% 190 200JSR output_sign \ Check sign of number and set flag 210 220LDY #(output_buffer_size+1) 230LDA #0 240STA output_buffer, Y \ Put a zero at end of buffer 250DEY \ Set Y to last space in buffer 260 270.output_character_loop 280 290LDA dividend 300ORA dividend+1 310ORA dividend+2 320ORA dividend+3 \ Zero if dividend is now empty 330BEQ add_sign \ If so no leading zeros 340 350JSR div_by_base 360 370CLC 380ADC #&30 390STA output_buffer, Y \ Add &30 and put in buffer 400DEY \ Move buffer pointer closer to front 410BNE output_character_loop \ Unlikely to reach front of buffer 420 430.add_sign 440 450LDA op_sign_flag 460BEQ print_characters \ If sign flag is zero no is +ve 470LDA #ASC"-" 480STA output_buffer, Y \ If -ve put minus in buffer 490DEY \ Move pointer to balance INY later 500 510.print_characters 520 530INY 540LDA output_buffer, Y 550BEQ output_character_exit \ Null (zero) is end of buffer 560JSR oswrch 570JMP print_characters 580 590.output_character_exit 600 610JSR osnewl \ New line for neatness 620RTS 630 640.output_sign 650 660\ Checks sign of number in dividend. If -ve sets flag and makes no +ve. 670 680LDA #0 690STA op_sign_flag \ Assume +ve unless otherwise 700LDA dividend+3 710BPL op_sign_pos \ If dividend+3 is +ve then no is +ve 720SEC 730LDA #0 \ Subtract from zero 740SBC dividend 750STA dividend 760LDA #0 770SBC dividend+1 780STA dividend+1 790LDA #0 800SBC dividend+2 810STA dividend+2 820LDA #0 830SBC dividend+3 840STA dividend+3 \ Subtract no from zero 850LDA #1 860STA op_sign_flag \ Set sign flag 870 880.op_sign_pos 890 900RTS 910 920.div_by_base 930 940\ Dividend is in 'dividend', divisor in 'base', result in 'result' 950\ On exit DIV is in 'dividend', MOD in A, X is destroyed. 960 970LDA #0 \ Set A and result workspace to zero 980STA result 990STA result+1 1000STA result+2 1010STA result+3 1020 1030LDX #32 \ 32 bit dividend 1040 1050.div_by_base_loop 1060 1070ASL result \ Rotate result left 1080ROL result+1 1090ROL result+2 1100ROL result+3 1110ASL dividend \ Rotate dividend left into A 1120ROL dividend+1 1130ROL dividend+2 1140ROL dividend+3 1150ROL A \ msb into A 1160CMP base 1170BCC no_subtract_dbb 1180INC result \ Increase result if we can subtract 1190SBC base 1200 1210.no_subtract_dbb 1220 1230DEX \ Next bit 1240BNE div_by_base_loop 1250 1260.div_by_base_out 1270 1280LDX result \ Move result into dividend 1290STX dividend 1300LDX result+1 1310STX dividend+1 1320LDX result+2 1330STX dividend+2 1340LDX result+3 1350STX dividend+3 1360RTS 1370 1380.dividend OPT FNEQUD(0) 1390.result OPT FNEQUD(0) 1410.base OPT FNEQUB(10) 1420.op_sign_flag OPT FNEQUB(0) 1430.output_buffer OPT FNEQUM(output_buffer_size+1,0) 1440 1450] 1460NEXT 1470REPEAT 1480INPUT "Number to be printed out? "!dividend 1490PRINT "Result is "; 1500CALL code% 1510PRINT 1520UNTIL0 1530 1540**** EQUate a Byte **** 1550DEF FNEQUB(N%) 1560?P%=N% MOD 256 1570IF (pass% AND 3) = 3 THEN PRINT ~?P% 1580P%=P%+1 1590=pass% 1600 1610**** EQUate a Double word (4 bytes) **** 1620DEF FNEQUD(N%) 1630LOCAL X% 1640!P%=N% 1650FOR X%=0 TO 3 1660IF (pass% AND 3) = 3 THEN PRINT ~P%?X%; 1670NEXT 1680IF (pass% AND 3) = 3 THEN PRINT 1690P%=P%+4 1700=pass% 1710 1720**** EQUate a section of Memory **** 1730DEF FNEQUM(number%,byte%) 1740LOCAL N% 1750WIDTH 40 1760FOR N%=0 TO number%-1 1770P%?N%=byte% 1780IF (pass% AND 3) = 3 THEN PRINT ~P%?N%; 1790NEXT 1800IF (pass% AND 3) = 3 THEN PRINT 1810P%=P%+number% 1820WIDTH 0 1830=pass%
� OSbits Module B/osb14 � Binary to ASCII � Decimal only (� Version 1.2 8.3.87 2 <*KEY1MODE3|M|NLIST|M F P� : Set routine addresses Zoswrch = &FFEE dosnewl = &FFE7 noutput_buffer_size=11 x �� code% &100 � �� pass% = 0 � 2 � 2 �P% = code% � �[OPT pass% � �DJSR output_sign \ Check sign of number and set flag � �LDY #(output_buffer_size+1) � LDA #0 �>STA output_buffer, Y \ Put a zero at end of buffer �@DEY \ Set Y to last space in buffer .output_character_loop "LDA dividend ,�A dividend+1 6�A dividend+2 @?�A dividend+3 \ Zero if dividend is now empty J9BEQ add_sign \ If so no leading zeros T ^JSR div_by_base h rCLC |ADC #&30 �<STA output_buffer, Y \ Add &30 and put in buffer �FDEY \ Move buffer pointer closer to front �DBNE output_character_loop \ Unlikely to reach front of buffer � � .add_sign � �LDA op_sign_flag �ABEQ print_characters \ If sign flag is zero no is +ve � LDA #�"-" �=STA output_buffer, Y \ If -ve put minus in buffer �DDEY \ Move pointer to balance INY later � �.print_characters INY LDA output_buffer, Y &?BEQ output_character_exit \ Null (zero) is end of buffer 0JSR oswrch :JMP print_characters D N.output_character_exit X b8JSR osnewl \ New line for neatness lRTS v �.output_sign � �M\ Checks sign of number in dividend. If -ve sets flag and makes no +ve. � � LDA #0 �>STA op_sign_flag \ Assume +ve unless otherwise �LDA dividend+3 �FBPL op_sign_pos \ If dividend+3 is +ve then no is +ve �SEC �5LDA #0 \ Subtract from zero �SBC dividend �STA dividend � LDA #0 SBC dividend+1 STA dividend+1 LDA #0 SBC dividend+2 *STA dividend+2 4 LDA #0 >SBC dividend+3 H8STA dividend+3 \ Subtract no from zero R LDA #1 \0STA op_sign_flag \ Set sign flag f p.op_sign_pos z �RTS � �.div_by_base � �G\ Dividend is in 'dividend', divisor in 'base', result in 'result' �:\ On exit � is in 'dividend', � in A, X is destroyed. � �ELDA #0 \ Set A and result workspace to zero �STA result �STA result+1 �STA result+2 �STA result+3 � 2LDX #32 \ 32 bit dividend .div_by_base_loop $ .5ASL result \ Rotate result left 8ROL result+1 BROL result+2 LROL result+3 V>ASL dividend \ Rotate dividend left into A `ROL dividend+1 jROL dividend+2 tROL dividend+3 ~-ROL A \ msb into A �CMP base �BCC no_subtract_dbb �EINC result \ Increase result if we can subtract �SBC base � �.no_subtract_dbb � �+DEX \ Next bit �BNE div_by_base_loop � �.div_by_base_out � <LDX result \ Move result into dividend STX dividend LDX result+1 STX dividend+1 (LDX result+2 2STX dividend+2 <LDX result+3 FSTX dividend+3 PRTS Z d .dividend OPT �EQUD(0) n .result OPT �EQUD(0) �!.base OPT �EQUB(10) � .op_sign_flag OPT �EQUB(0) �5.output_buffer OPT �EQUM(output_buffer_size+1,0) � �] �� �� �+� "Number to be printed out? "!dividend �� "Result is "; �� code% �� ��0 � **** EQUate a Byte **** � �EQUB(N%) ?P%=N% � 256 "� (pass% � 3) = 3 � � ~?P% ,P%=P%+1 6 =pass% @ J,**** EQUate a Double word (4 bytes) **** T� �EQUD(N%) ^� X% h !P%=N% r� X%=0 � 3 |!� (pass% � 3) = 3 � � ~P%?X%; �� �� (pass% � 3) = 3 � � �P%=P%+4 � =pass% � �(**** EQUate a section of Memory **** �� �EQUM(number%,byte%) �� N% �� 40 �� N%=0 � number%-1 �P%?N%=byte% �!� (pass% � 3) = 3 � � ~P%?N%; �� � (pass% � 3) = 3 � � P%=P%+number% � 0 & =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 34 0d 00 14 15 f4 |ule B/osb14.....| 00000020 20 42 69 6e 61 72 79 20 74 6f 20 41 53 43 49 49 | Binary to ASCII| 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 18 f4 20 56 65 72 73 69 6f 6e 20 |ly..(.. Version | 00000050 31 2e 32 20 38 2e 33 2e 38 37 0d 00 32 05 20 0d |1.2 8.3.87..2. .| 00000060 00 3c 18 2a 4b 45 59 31 4d 4f 44 45 33 7c 4d 7c |.<.*KEY1MODE3|M|| 00000070 4e 4c 49 53 54 7c 4d 0d 00 46 05 20 0d 00 50 1d |NLIST|M..F. ..P.| 00000080 f4 20 3a 20 53 65 74 20 72 6f 75 74 69 6e 65 20 |. : Set routine | 00000090 61 64 64 72 65 73 73 65 73 0d 00 5a 12 6f 73 77 |addresses..Z.osw| 000000a0 72 63 68 20 3d 20 26 46 46 45 45 0d 00 64 12 6f |rch = &FFEE..d.o| 000000b0 73 6e 65 77 6c 20 3d 20 26 46 46 45 37 0d 00 6e |snewl = &FFE7..n| 000000c0 19 6f 75 74 70 75 74 5f 62 75 66 66 65 72 5f 73 |.output_buffer_s| 000000d0 69 7a 65 3d 31 31 0d 00 78 05 20 0d 00 82 10 de |ize=11..x. .....| 000000e0 20 63 6f 64 65 25 20 26 31 30 30 0d 00 8c 05 20 | code% &100.... | 000000f0 0d 00 96 17 e3 20 70 61 73 73 25 20 3d 20 30 20 |..... pass% = 0 | 00000100 b8 20 32 20 88 20 32 0d 00 a0 0e 50 25 20 3d 20 |. 2 . 2....P% = | 00000110 63 6f 64 65 25 0d 00 aa 05 20 0d 00 b4 0e 5b 4f |code%.... ....[O| 00000120 50 54 20 70 61 73 73 25 0d 00 be 05 20 0d 00 c8 |PT pass%.... ...| 00000130 44 4a 53 52 20 6f 75 74 70 75 74 5f 73 69 67 6e |DJSR output_sign| 00000140 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 00000150 43 68 65 63 6b 20 73 69 67 6e 20 6f 66 20 6e 75 |Check sign of nu| 00000160 6d 62 65 72 20 61 6e 64 20 73 65 74 20 66 6c 61 |mber and set fla| 00000170 67 0d 00 d2 05 20 0d 00 dc 1f 4c 44 59 20 23 28 |g.... ....LDY #(| 00000180 6f 75 74 70 75 74 5f 62 75 66 66 65 72 5f 73 69 |output_buffer_si| 00000190 7a 65 2b 31 29 0d 00 e6 0a 4c 44 41 20 23 30 0d |ze+1)....LDA #0.| 000001a0 00 f0 3e 53 54 41 20 6f 75 74 70 75 74 5f 62 75 |..>STA output_bu| 000001b0 66 66 65 72 2c 20 59 20 20 20 20 20 20 20 20 20 |ffer, Y | 000001c0 5c 20 50 75 74 20 61 20 7a 65 72 6f 20 61 74 20 |\ Put a zero at | 000001d0 65 6e 64 20 6f 66 20 62 75 66 66 65 72 0d 00 fa |end of buffer...| 000001e0 40 44 45 59 20 20 20 20 20 20 20 20 20 20 20 20 |@DEY | 000001f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 00000200 53 65 74 20 59 20 74 6f 20 6c 61 73 74 20 73 70 |Set Y to last sp| 00000210 61 63 65 20 69 6e 20 62 75 66 66 65 72 0d 01 04 |ace in buffer...| 00000220 05 20 0d 01 0e 1a 2e 6f 75 74 70 75 74 5f 63 68 |. .....output_ch| 00000230 61 72 61 63 74 65 72 5f 6c 6f 6f 70 0d 01 18 05 |aracter_loop....| 00000240 20 0d 01 22 10 4c 44 41 20 64 69 76 69 64 65 6e | ..".LDA dividen| 00000250 64 0d 01 2c 11 84 41 20 64 69 76 69 64 65 6e 64 |d..,..A dividend| 00000260 2b 31 0d 01 36 11 84 41 20 64 69 76 69 64 65 6e |+1..6..A dividen| 00000270 64 2b 32 0d 01 40 3f 84 41 20 64 69 76 69 64 65 |d+2..@?.A divide| 00000280 6e 64 2b 33 20 20 20 20 20 20 20 20 20 20 20 20 |nd+3 | 00000290 20 20 20 5c 20 5a 65 72 6f 20 69 66 20 64 69 76 | \ Zero if div| 000002a0 69 64 65 6e 64 20 69 73 20 6e 6f 77 20 65 6d 70 |idend is now emp| 000002b0 74 79 0d 01 4a 39 42 45 51 20 61 64 64 5f 73 69 |ty..J9BEQ add_si| 000002c0 67 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |gn | 000002d0 20 20 20 5c 20 49 66 20 73 6f 20 6e 6f 20 6c 65 | \ If so no le| 000002e0 61 64 69 6e 67 20 7a 65 72 6f 73 0d 01 54 05 20 |ading zeros..T. | 000002f0 0d 01 5e 13 4a 53 52 20 64 69 76 5f 62 79 5f 62 |..^.JSR div_by_b| 00000300 61 73 65 0d 01 68 05 20 0d 01 72 07 43 4c 43 0d |ase..h. ..r.CLC.| 00000310 01 7c 0c 41 44 43 20 23 26 33 30 0d 01 86 3c 53 |.|.ADC #&30...<S| 00000320 54 41 20 6f 75 74 70 75 74 5f 62 75 66 66 65 72 |TA output_buffer| 00000330 2c 20 59 20 20 20 20 20 20 20 20 20 5c 20 41 64 |, Y \ Ad| 00000340 64 20 26 33 30 20 61 6e 64 20 70 75 74 20 69 6e |d &30 and put in| 00000350 20 62 75 66 66 65 72 0d 01 90 46 44 45 59 20 20 | buffer...FDEY | 00000360 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000370 20 20 20 20 20 20 20 20 5c 20 4d 6f 76 65 20 62 | \ Move b| 00000380 75 66 66 65 72 20 70 6f 69 6e 74 65 72 20 63 6c |uffer pointer cl| 00000390 6f 73 65 72 20 74 6f 20 66 72 6f 6e 74 0d 01 9a |oser to front...| 000003a0 44 42 4e 45 20 6f 75 74 70 75 74 5f 63 68 61 72 |DBNE output_char| 000003b0 61 63 74 65 72 5f 6c 6f 6f 70 20 20 20 20 5c 20 |acter_loop \ | 000003c0 55 6e 6c 69 6b 65 6c 79 20 74 6f 20 72 65 61 63 |Unlikely to reac| 000003d0 68 20 66 72 6f 6e 74 20 6f 66 20 62 75 66 66 65 |h front of buffe| 000003e0 72 0d 01 a4 05 20 0d 01 ae 0d 2e 61 64 64 5f 73 |r.... .....add_s| 000003f0 69 67 6e 0d 01 b8 05 20 0d 01 c2 14 4c 44 41 20 |ign.... ....LDA | 00000400 6f 70 5f 73 69 67 6e 5f 66 6c 61 67 0d 01 cc 41 |op_sign_flag...A| 00000410 42 45 51 20 70 72 69 6e 74 5f 63 68 61 72 61 63 |BEQ print_charac| 00000420 74 65 72 73 20 20 20 20 20 20 20 20 20 5c 20 49 |ters \ I| 00000430 66 20 73 69 67 6e 20 66 6c 61 67 20 69 73 20 7a |f sign flag is z| 00000440 65 72 6f 20 6e 6f 20 69 73 20 2b 76 65 0d 01 d6 |ero no is +ve...| 00000450 0d 4c 44 41 20 23 97 22 2d 22 0d 01 e0 3d 53 54 |.LDA #."-"...=ST| 00000460 41 20 6f 75 74 70 75 74 5f 62 75 66 66 65 72 2c |A output_buffer,| 00000470 20 59 20 20 20 20 20 20 20 20 20 5c 20 49 66 20 | Y \ If | 00000480 2d 76 65 20 70 75 74 20 6d 69 6e 75 73 20 69 6e |-ve put minus in| 00000490 20 62 75 66 66 65 72 0d 01 ea 44 44 45 59 20 20 | buffer...DDEY | 000004a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000004b0 20 20 20 20 20 20 20 20 5c 20 4d 6f 76 65 20 70 | \ Move p| 000004c0 6f 69 6e 74 65 72 20 74 6f 20 62 61 6c 61 6e 63 |ointer to balanc| 000004d0 65 20 49 4e 59 20 6c 61 74 65 72 0d 01 f4 05 20 |e INY later.... | 000004e0 0d 01 fe 15 2e 70 72 69 6e 74 5f 63 68 61 72 61 |.....print_chara| 000004f0 63 74 65 72 73 0d 02 08 05 20 0d 02 12 07 49 4e |cters.... ....IN| 00000500 59 0d 02 1c 18 4c 44 41 20 6f 75 74 70 75 74 5f |Y....LDA output_| 00000510 62 75 66 66 65 72 2c 20 59 0d 02 26 3f 42 45 51 |buffer, Y..&?BEQ| 00000520 20 6f 75 74 70 75 74 5f 63 68 61 72 61 63 74 65 | output_characte| 00000530 72 5f 65 78 69 74 20 20 20 20 5c 20 4e 75 6c 6c |r_exit \ Null| 00000540 20 28 7a 65 72 6f 29 20 69 73 20 65 6e 64 20 6f | (zero) is end o| 00000550 66 20 62 75 66 66 65 72 0d 02 30 0e 4a 53 52 20 |f buffer..0.JSR | 00000560 6f 73 77 72 63 68 0d 02 3a 18 4a 4d 50 20 70 72 |oswrch..:.JMP pr| 00000570 69 6e 74 5f 63 68 61 72 61 63 74 65 72 73 0d 02 |int_characters..| 00000580 44 05 20 0d 02 4e 1a 2e 6f 75 74 70 75 74 5f 63 |D. ..N..output_c| 00000590 68 61 72 61 63 74 65 72 5f 65 78 69 74 0d 02 58 |haracter_exit..X| 000005a0 05 20 0d 02 62 38 4a 53 52 20 6f 73 6e 65 77 6c |. ..b8JSR osnewl| 000005b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000005c0 20 20 20 5c 20 4e 65 77 20 6c 69 6e 65 20 66 6f | \ New line fo| 000005d0 72 20 6e 65 61 74 6e 65 73 73 0d 02 6c 07 52 54 |r neatness..l.RT| 000005e0 53 0d 02 76 05 20 0d 02 80 10 2e 6f 75 74 70 75 |S..v. .....outpu| 000005f0 74 5f 73 69 67 6e 0d 02 8a 05 20 0d 02 94 4d 5c |t_sign.... ...M\| 00000600 20 20 43 68 65 63 6b 73 20 73 69 67 6e 20 6f 66 | Checks sign of| 00000610 20 6e 75 6d 62 65 72 20 69 6e 20 64 69 76 69 64 | number in divid| 00000620 65 6e 64 2e 20 20 49 66 20 2d 76 65 20 73 65 74 |end. If -ve set| 00000630 73 20 66 6c 61 67 20 61 6e 64 20 6d 61 6b 65 73 |s flag and makes| 00000640 20 6e 6f 20 2b 76 65 2e 0d 02 9e 05 20 0d 02 a8 | no +ve..... ...| 00000650 0a 4c 44 41 20 23 30 0d 02 b2 3e 53 54 41 20 6f |.LDA #0...>STA o| 00000660 70 5f 73 69 67 6e 5f 66 6c 61 67 20 20 20 20 20 |p_sign_flag | 00000670 20 20 20 20 20 20 20 20 5c 20 41 73 73 75 6d 65 | \ Assume| 00000680 20 2b 76 65 20 75 6e 6c 65 73 73 20 6f 74 68 65 | +ve unless othe| 00000690 72 77 69 73 65 0d 02 bc 12 4c 44 41 20 64 69 76 |rwise....LDA div| 000006a0 69 64 65 6e 64 2b 33 0d 02 c6 46 42 50 4c 20 6f |idend+3...FBPL o| 000006b0 70 5f 73 69 67 6e 5f 70 6f 73 20 20 20 20 20 20 |p_sign_pos | 000006c0 20 20 20 20 20 20 20 20 5c 20 49 66 20 64 69 76 | \ If div| 000006d0 69 64 65 6e 64 2b 33 20 69 73 20 2b 76 65 20 74 |idend+3 is +ve t| 000006e0 68 65 6e 20 6e 6f 20 69 73 20 2b 76 65 0d 02 d0 |hen no is +ve...| 000006f0 07 53 45 43 0d 02 da 35 4c 44 41 20 23 30 20 20 |.SEC...5LDA #0 | 00000700 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000710 20 20 20 20 20 5c 20 53 75 62 74 72 61 63 74 20 | \ Subtract | 00000720 66 72 6f 6d 20 7a 65 72 6f 0d 02 e4 10 53 42 43 |from zero....SBC| 00000730 20 64 69 76 69 64 65 6e 64 0d 02 ee 10 53 54 41 | dividend....STA| 00000740 20 64 69 76 69 64 65 6e 64 0d 02 f8 0a 4c 44 41 | dividend....LDA| 00000750 20 23 30 0d 03 02 12 53 42 43 20 64 69 76 69 64 | #0....SBC divid| 00000760 65 6e 64 2b 31 0d 03 0c 12 53 54 41 20 64 69 76 |end+1....STA div| 00000770 69 64 65 6e 64 2b 31 0d 03 16 0a 4c 44 41 20 23 |idend+1....LDA #| 00000780 30 0d 03 20 12 53 42 43 20 64 69 76 69 64 65 6e |0.. .SBC dividen| 00000790 64 2b 32 0d 03 2a 12 53 54 41 20 64 69 76 69 64 |d+2..*.STA divid| 000007a0 65 6e 64 2b 32 0d 03 34 0a 4c 44 41 20 23 30 0d |end+2..4.LDA #0.| 000007b0 03 3e 12 53 42 43 20 64 69 76 69 64 65 6e 64 2b |.>.SBC dividend+| 000007c0 33 0d 03 48 38 53 54 41 20 64 69 76 69 64 65 6e |3..H8STA dividen| 000007d0 64 2b 33 20 20 20 20 20 20 20 20 20 20 20 20 20 |d+3 | 000007e0 20 20 5c 20 53 75 62 74 72 61 63 74 20 6e 6f 20 | \ Subtract no | 000007f0 66 72 6f 6d 20 7a 65 72 6f 0d 03 52 0a 4c 44 41 |from zero..R.LDA| 00000800 20 23 31 0d 03 5c 30 53 54 41 20 6f 70 5f 73 69 | #1..\0STA op_si| 00000810 67 6e 5f 66 6c 61 67 20 20 20 20 20 20 20 20 20 |gn_flag | 00000820 20 20 20 20 5c 20 53 65 74 20 73 69 67 6e 20 66 | \ Set sign f| 00000830 6c 61 67 0d 03 66 05 20 0d 03 70 10 2e 6f 70 5f |lag..f. ..p..op_| 00000840 73 69 67 6e 5f 70 6f 73 0d 03 7a 05 20 0d 03 84 |sign_pos..z. ...| 00000850 07 52 54 53 0d 03 8e 05 20 0d 03 98 10 2e 64 69 |.RTS.... .....di| 00000860 76 5f 62 79 5f 62 61 73 65 0d 03 a2 05 20 0d 03 |v_by_base.... ..| 00000870 ac 47 5c 20 20 44 69 76 69 64 65 6e 64 20 69 73 |.G\ Dividend is| 00000880 20 69 6e 20 27 64 69 76 69 64 65 6e 64 27 2c 20 | in 'dividend', | 00000890 64 69 76 69 73 6f 72 20 69 6e 20 27 62 61 73 65 |divisor in 'base| 000008a0 27 2c 20 72 65 73 75 6c 74 20 69 6e 20 27 72 65 |', result in 're| 000008b0 73 75 6c 74 27 0d 03 b6 3a 5c 20 20 4f 6e 20 65 |sult'...:\ On e| 000008c0 78 69 74 20 81 20 69 73 20 69 6e 20 27 64 69 76 |xit . is in 'div| 000008d0 69 64 65 6e 64 27 2c 20 83 20 69 6e 20 41 2c 20 |idend', . in A, | 000008e0 58 20 69 73 20 64 65 73 74 72 6f 79 65 64 2e 0d |X is destroyed..| 000008f0 03 c0 05 20 0d 03 ca 45 4c 44 41 20 23 30 20 20 |... ...ELDA #0 | 00000900 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000910 20 20 20 20 20 5c 20 53 65 74 20 41 20 61 6e 64 | \ Set A and| 00000920 20 72 65 73 75 6c 74 20 77 6f 72 6b 73 70 61 63 | result workspac| 00000930 65 20 74 6f 20 7a 65 72 6f 0d 03 d4 0e 53 54 41 |e to zero....STA| 00000940 20 72 65 73 75 6c 74 0d 03 de 10 53 54 41 20 72 | result....STA r| 00000950 65 73 75 6c 74 2b 31 0d 03 e8 10 53 54 41 20 72 |esult+1....STA r| 00000960 65 73 75 6c 74 2b 32 0d 03 f2 10 53 54 41 20 72 |esult+2....STA r| 00000970 65 73 75 6c 74 2b 33 0d 03 fc 05 20 0d 04 06 32 |esult+3.... ...2| 00000980 4c 44 58 20 23 33 32 20 20 20 20 20 20 20 20 20 |LDX #32 | 00000990 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 33 | \ 3| 000009a0 32 20 62 69 74 20 64 69 76 69 64 65 6e 64 0d 04 |2 bit dividend..| 000009b0 10 05 20 0d 04 1a 15 2e 64 69 76 5f 62 79 5f 62 |.. .....div_by_b| 000009c0 61 73 65 5f 6c 6f 6f 70 0d 04 24 05 20 0d 04 2e |ase_loop..$. ...| 000009d0 35 41 53 4c 20 72 65 73 75 6c 74 20 20 20 20 20 |5ASL result | 000009e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 000009f0 52 6f 74 61 74 65 20 72 65 73 75 6c 74 20 6c 65 |Rotate result le| 00000a00 66 74 0d 04 38 10 52 4f 4c 20 72 65 73 75 6c 74 |ft..8.ROL result| 00000a10 2b 31 0d 04 42 10 52 4f 4c 20 72 65 73 75 6c 74 |+1..B.ROL result| 00000a20 2b 32 0d 04 4c 10 52 4f 4c 20 72 65 73 75 6c 74 |+2..L.ROL result| 00000a30 2b 33 0d 04 56 3e 41 53 4c 20 64 69 76 69 64 65 |+3..V>ASL divide| 00000a40 6e 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |nd | 00000a50 20 20 20 5c 20 52 6f 74 61 74 65 20 64 69 76 69 | \ Rotate divi| 00000a60 64 65 6e 64 20 6c 65 66 74 20 69 6e 74 6f 20 41 |dend left into A| 00000a70 0d 04 60 12 52 4f 4c 20 64 69 76 69 64 65 6e 64 |..`.ROL dividend| 00000a80 2b 31 0d 04 6a 12 52 4f 4c 20 64 69 76 69 64 65 |+1..j.ROL divide| 00000a90 6e 64 2b 32 0d 04 74 12 52 4f 4c 20 64 69 76 69 |nd+2..t.ROL divi| 00000aa0 64 65 6e 64 2b 33 0d 04 7e 2d 52 4f 4c 20 41 20 |dend+3..~-ROL A | 00000ab0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000ac0 20 20 20 20 20 20 20 5c 20 6d 73 62 20 69 6e 74 | \ msb int| 00000ad0 6f 20 41 0d 04 88 0c 43 4d 50 20 62 61 73 65 0d |o A....CMP base.| 00000ae0 04 92 17 42 43 43 20 6e 6f 5f 73 75 62 74 72 61 |...BCC no_subtra| 00000af0 63 74 5f 64 62 62 0d 04 9c 45 49 4e 43 20 72 65 |ct_dbb...EINC re| 00000b00 73 75 6c 74 20 20 20 20 20 20 20 20 20 20 20 20 |sult | 00000b10 20 20 20 20 20 20 20 5c 20 49 6e 63 72 65 61 73 | \ Increas| 00000b20 65 20 72 65 73 75 6c 74 20 69 66 20 77 65 20 63 |e result if we c| 00000b30 61 6e 20 73 75 62 74 72 61 63 74 0d 04 a6 0c 53 |an subtract....S| 00000b40 42 43 20 62 61 73 65 0d 04 b0 05 20 0d 04 ba 14 |BC base.... ....| 00000b50 2e 6e 6f 5f 73 75 62 74 72 61 63 74 5f 64 62 62 |.no_subtract_dbb| 00000b60 0d 04 c4 05 20 0d 04 ce 2b 44 45 58 20 20 20 20 |.... ...+DEX | 00000b70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000b80 20 20 20 20 20 20 5c 20 4e 65 78 74 20 62 69 74 | \ Next bit| 00000b90 0d 04 d8 18 42 4e 45 20 64 69 76 5f 62 79 5f 62 |....BNE div_by_b| 00000ba0 61 73 65 5f 6c 6f 6f 70 0d 04 e2 05 20 0d 04 ec |ase_loop.... ...| 00000bb0 14 2e 64 69 76 5f 62 79 5f 62 61 73 65 5f 6f 75 |..div_by_base_ou| 00000bc0 74 0d 04 f6 05 20 0d 05 00 3c 4c 44 58 20 72 65 |t.... ...<LDX re| 00000bd0 73 75 6c 74 20 20 20 20 20 20 20 20 20 20 20 20 |sult | 00000be0 20 20 20 20 20 20 20 5c 20 4d 6f 76 65 20 72 65 | \ Move re| 00000bf0 73 75 6c 74 20 69 6e 74 6f 20 64 69 76 69 64 65 |sult into divide| 00000c00 6e 64 0d 05 0a 10 53 54 58 20 64 69 76 69 64 65 |nd....STX divide| 00000c10 6e 64 0d 05 14 10 4c 44 58 20 72 65 73 75 6c 74 |nd....LDX result| 00000c20 2b 31 0d 05 1e 12 53 54 58 20 64 69 76 69 64 65 |+1....STX divide| 00000c30 6e 64 2b 31 0d 05 28 10 4c 44 58 20 72 65 73 75 |nd+1..(.LDX resu| 00000c40 6c 74 2b 32 0d 05 32 12 53 54 58 20 64 69 76 69 |lt+2..2.STX divi| 00000c50 64 65 6e 64 2b 32 0d 05 3c 10 4c 44 58 20 72 65 |dend+2..<.LDX re| 00000c60 73 75 6c 74 2b 33 0d 05 46 12 53 54 58 20 64 69 |sult+3..F.STX di| 00000c70 76 69 64 65 6e 64 2b 33 0d 05 50 07 52 54 53 0d |vidend+3..P.RTS.| 00000c80 05 5a 05 20 0d 05 64 20 2e 64 69 76 69 64 65 6e |.Z. ..d .dividen| 00000c90 64 20 20 20 20 20 20 20 4f 50 54 20 a4 45 51 55 |d OPT .EQU| 00000ca0 44 28 30 29 0d 05 6e 20 2e 72 65 73 75 6c 74 20 |D(0)..n .result | 00000cb0 20 20 20 20 20 20 20 20 4f 50 54 20 a4 45 51 55 | OPT .EQU| 00000cc0 44 28 30 29 0d 05 82 21 2e 62 61 73 65 20 20 20 |D(0)...!.base | 00000cd0 20 20 20 20 20 20 20 20 4f 50 54 20 a4 45 51 55 | OPT .EQU| 00000ce0 42 28 31 30 29 0d 05 8c 20 2e 6f 70 5f 73 69 67 |B(10)... .op_sig| 00000cf0 6e 5f 66 6c 61 67 20 20 20 4f 50 54 20 a4 45 51 |n_flag OPT .EQ| 00000d00 55 42 28 30 29 0d 05 96 35 2e 6f 75 74 70 75 74 |UB(0)...5.output| 00000d10 5f 62 75 66 66 65 72 20 20 4f 50 54 20 a4 45 51 |_buffer OPT .EQ| 00000d20 55 4d 28 6f 75 74 70 75 74 5f 62 75 66 66 65 72 |UM(output_buffer| 00000d30 5f 73 69 7a 65 2b 31 2c 30 29 0d 05 a0 05 20 0d |_size+1,0).... .| 00000d40 05 aa 05 5d 0d 05 b4 05 ed 0d 05 be 05 f5 0d 05 |...]............| 00000d50 c8 2b e8 20 22 4e 75 6d 62 65 72 20 74 6f 20 62 |.+. "Number to b| 00000d60 65 20 70 72 69 6e 74 65 64 20 6f 75 74 3f 20 22 |e printed out? "| 00000d70 21 64 69 76 69 64 65 6e 64 0d 05 d2 13 f1 20 22 |!dividend..... "| 00000d80 52 65 73 75 6c 74 20 69 73 20 22 3b 0d 05 dc 0b |Result is ";....| 00000d90 d6 20 63 6f 64 65 25 0d 05 e6 05 f1 0d 05 f0 06 |. code%.........| 00000da0 fd 30 0d 05 fa 05 20 0d 06 04 1b 2a 2a 2a 2a 20 |.0.... ....**** | 00000db0 45 51 55 61 74 65 20 61 20 42 79 74 65 20 2a 2a |EQUate a Byte **| 00000dc0 2a 2a 0d 06 0e 0f dd 20 a4 45 51 55 42 28 4e 25 |**..... .EQUB(N%| 00000dd0 29 0d 06 18 10 3f 50 25 3d 4e 25 20 83 20 32 35 |)....?P%=N% . 25| 00000de0 36 0d 06 22 1e e7 20 28 70 61 73 73 25 20 80 20 |6..".. (pass% . | 00000df0 33 29 20 3d 20 33 20 8c 20 f1 20 7e 3f 50 25 0d |3) = 3 . . ~?P%.| 00000e00 06 2c 0b 50 25 3d 50 25 2b 31 0d 06 36 0a 3d 70 |.,.P%=P%+1..6.=p| 00000e10 61 73 73 25 0d 06 40 05 20 0d 06 4a 2c 2a 2a 2a |ass%..@. ..J,***| 00000e20 2a 20 45 51 55 61 74 65 20 61 20 44 6f 75 62 6c |* EQUate a Doubl| 00000e30 65 20 77 6f 72 64 20 28 34 20 62 79 74 65 73 29 |e word (4 bytes)| 00000e40 20 2a 2a 2a 2a 0d 06 54 0f dd 20 a4 45 51 55 44 | ****..T.. .EQUD| 00000e50 28 4e 25 29 0d 06 5e 08 ea 20 58 25 0d 06 68 0a |(N%)..^.. X%..h.| 00000e60 21 50 25 3d 4e 25 0d 06 72 0e e3 20 58 25 3d 30 |!P%=N%..r.. X%=0| 00000e70 20 b8 20 33 0d 06 7c 21 e7 20 28 70 61 73 73 25 | . 3..|!. (pass%| 00000e80 20 80 20 33 29 20 3d 20 33 20 8c 20 f1 20 7e 50 | . 3) = 3 . . ~P| 00000e90 25 3f 58 25 3b 0d 06 86 05 ed 0d 06 90 19 e7 20 |%?X%;.......... | 00000ea0 28 70 61 73 73 25 20 80 20 33 29 20 3d 20 33 20 |(pass% . 3) = 3 | 00000eb0 8c 20 f1 0d 06 9a 0b 50 25 3d 50 25 2b 34 0d 06 |. .....P%=P%+4..| 00000ec0 a4 0a 3d 70 61 73 73 25 0d 06 ae 05 20 0d 06 b8 |..=pass%.... ...| 00000ed0 28 2a 2a 2a 2a 20 45 51 55 61 74 65 20 61 20 73 |(**** EQUate a s| 00000ee0 65 63 74 69 6f 6e 20 6f 66 20 4d 65 6d 6f 72 79 |ection of Memory| 00000ef0 20 2a 2a 2a 2a 0d 06 c2 1a dd 20 a4 45 51 55 4d | ****..... .EQUM| 00000f00 28 6e 75 6d 62 65 72 25 2c 62 79 74 65 25 29 0d |(number%,byte%).| 00000f10 06 cc 08 ea 20 4e 25 0d 06 d6 08 fe 20 34 30 0d |.... N%..... 40.| 00000f20 06 e0 16 e3 20 4e 25 3d 30 20 b8 20 6e 75 6d 62 |.... N%=0 . numb| 00000f30 65 72 25 2d 31 0d 06 ea 0f 50 25 3f 4e 25 3d 62 |er%-1....P%?N%=b| 00000f40 79 74 65 25 0d 06 f4 21 e7 20 28 70 61 73 73 25 |yte%...!. (pass%| 00000f50 20 80 20 33 29 20 3d 20 33 20 8c 20 f1 20 7e 50 | . 3) = 3 . . ~P| 00000f60 25 3f 4e 25 3b 0d 06 fe 05 ed 0d 07 08 19 e7 20 |%?N%;.......... | 00000f70 28 70 61 73 73 25 20 80 20 33 29 20 3d 20 33 20 |(pass% . 3) = 3 | 00000f80 8c 20 f1 0d 07 12 11 50 25 3d 50 25 2b 6e 75 6d |. .....P%=P%+num| 00000f90 62 65 72 25 0d 07 1c 07 fe 20 30 0d 07 26 0a 3d |ber%..... 0..&.=| 00000fa0 70 61 73 73 25 0d ff |pass%..| 00000fa7