Decoding IBM PC cassettes - Page 1
Forum section: electronics / general

author: hamster_nz
author_rank: Super Contributor
timestamp: October 14, 2020, 05:12:32 am
content: I had a little bit of spare time and wrote something to decode an audio file containing IBM PC diagnostics.If interested, you can find the source and an audio file athttps://github.com/hamsternz/detapeIt was more just for interest in decoding data sourced from an old 80s data cassette than anything else.Currently just writes data to the screen, but looks like it calls BIOS ROM routines which are most likely no longer exist...

author: james_s
author_rank: Super Contributor
timestamp: October 14, 2020, 05:42:47 am
content: The PC and later derivatives had BASIC in ROM, and most of the software stored on cassettes was likely written in BASIC so I'm not surprised if it appears to be calling routines in ROM.

author: bw2341
author_rank: Regular Contributor
timestamp: October 14, 2020, 05:04:42 pm
content: Here’s VWestlife’s recent video on using the cassette port on a IBM PC. You can see the IBM diagnostic software running on the actual hardware.

author: hamster_nz
author_rank: Super Contributor
timestamp: October 14, 2020, 08:27:45 pm
content: Quote from: bw2341 on October 14, 2020, 05:04:42 pmOh, I could most likely use a screen-grab of that program listing to decode the line numbers and some of the BASIC tokens...I think glancing in a tweet is what got me started looking at info on the IBM Cassette interface.

author: bw2341
author_rank: Regular Contributor
timestamp: October 14, 2020, 11:48:23 pm
content: It looks like a short stub of program acting as a bootloader. Apparently, running the BASIC program restarts the cassette drive to load more data, presumably a binary executable.

author: Leo Bodnar
author_rank: Frequent Contributor
timestamp: December 12, 2020, 06:25:35 pm
content: If this helps, here iscassette tape driver details from Multitech's (now Acer) MPF-I/88 i8088 trainer.It can read and write IBM audio tape format.CheersLeo

author: Leo Bodnar
author_rank: Frequent Contributor
timestamp: December 18, 2020, 01:11:55 pm
content: Each block of 256 bytes is followed by a two byte CRC which is calculated as follows:Code:uint_16 crc = 0xFFFF;for (...each byte in a 256 byte block ...){crc ^= byte << 8;for(int k = 0; k < 8; k++)crc = (crc & 0x8000) ? ((crc << 1) ^ 0x1021) : (crc << 1);}crc = ~crc;CRC is output on tape MSB first.Leo

author: Leo Bodnar
author_rank: Frequent Contributor
timestamp: December 18, 2020, 02:19:59 pm
content: Attached are the three sections of the IBM_PC_Diagnostics_Cassette.wav decoded into respective binary files.LeoCode:Sync: 0x16IBM_PC_Diagnostics_Cassette-header.binA5 6C 64 63 61 73 73 20 20 80 4C 05 60 00 1E 08 .ldcass .L.`...00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................Checksum. Tape: 43E3 / Calculated: 43E3FF FF FFLOL (Loss of lock)Sync: 0x16IBM_PC_Diagnostics_Cassette-BASIC.bin6A 08 0A 00 3A 8F D9 20 20 20 54 68 65 20 66 6F j...:.. The fo6C 6C 6F 77 69 6E 67 20 42 41 53 49 43 20 70 72 llowing BASIC pr6F 67 72 61 6D 20 70 6F 6B 65 73 20 61 20 6D 61 ogram pokes a ma63 68 69 6E 65 20 6C 61 6E 67 75 61 67 65 20 70 chine language p72 6F 67 72 61 6D 20 69 6E 74 6F 00 B9 08 14 00 rogram into.....3A 8F D9 20 20 20 6D 65 6D 6F 72 79 20 77 68 69 :.. memory whi63 68 20 77 69 6C 6C 20 6C 6F 61 64 20 61 6E 64 ch will load and20 72 75 6E 20 20 20 44 49 41 47 4E 4F 53 54 49 run DIAGNOSTI43 53 2E 20 20 53 69 6D 70 6C 79 20 65 6E 74 65 CS. Simply ente72 20 27 52 55 4E 27 20 74 6F 00 CD 08 1E 00 3A r 'RUN' to.....:8F D9 20 20 20 63 6F 6E 74 69 6E 75 65 2E 00 20 .. continue..09 28 00 3A 8F D9 20 20 20 54 6F 20 63 6F 70 79 .(.:.. To copy20 74 68 65 20 44 49 41 47 4E 4F 53 54 49 43 53 the DIAGNOSTICS20 63 61 73 73 65 74 74 65 2C 20 73 61 76 65 20 cassette, save74 68 69 73 20 70 72 6F 67 72 61 6D 20 6F 6E 20 this program on79 6F 75 72 20 6E 65 77 20 63 61 73 73 65 74 74 your new cassettChecksum. Tape: 2AF8 / Calculated: 2AF8… snip…2C 26 68 35 39 2C 26 68 32 30 00 61 0D 18 01 84 ,&h59,&h20.a....20 26 68 34 33 2C 26 68 34 31 2C 26 68 35 33 2C &h43,&h41,&h53,26 68 35 33 2C 26 68 34 35 2C 26 68 35 34 2C 26 &h53,&h45,&h54,&68 35 34 2C 26 68 34 35 2C 26 68 30 64 2C 26 68 h54,&h45,&h0d,&h30 61 00 67 0D 22 01 81 00 00 00 7F 00 00 00 00 0a.g.".........00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................Checksum. Tape: 8BCB / Calculated: 8BCBFF FF FFLOL (Loss of lock)Sync: 0x16IBM_PC_Diagnostics_Cassette-binary_code.binB4 0F CD 10 50 FE CC 8A D4 B6 18 B4 06 B0 00 B9 ....P...........00 00 B7 07 CD 10 BA 00 00 B7 00 B4 02 CD 10 58 ...............X3C 07 74 05 B9 07 06 EB 03 B9 0C 0B B4 01 CD 10 <.t.............8C C8 8E D8 8E C0 8E D0 BC E3 0E B4 00 8D 1E 47 ...............G00 E8 0C 31 E9 24 03 5D 00 54 68 65 20 49 42 4D ...1.$.].The IBM20 50 65 72 73 6F 6E 61 6C 20 43 6F 6D 70 75 74 Personal Comput65 72 0D 41 44 56 41 4E 43 45 44 20 44 49 41 47 er.ADVANCED DIAG4E 4F 53 54 49 43 53 0D 56 65 72 73 69 6F 6E 20 NOSTICS.Version31 2E 30 32 20 28 43 29 43 6F 70 79 72 69 67 68 1.02 (C)Copyrigh74 20 49 42 4D 20 43 6F 72 70 20 31 39 38 31 2C t IBM Corp 1981,20 31 39 38 32 0D 00 00 00 00 00 00 00 00 00 00 1982...........00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................33 DB 8C C8 8E C0 B9 4F 39 B4 03 CD 15 CC 00 00 3......O9.......Checksum. Tape: 2245 / Calculated: 2245… snip…00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................Checksum. Tape: BE17 / Calculated: BE17FF FF FFLOL (Loss of lock)

author: bobcat2000
author_rank: Regular Contributor
timestamp: December 29, 2020, 06:35:11 pm
content: You can try this to see the actual assembly code.If you have Windows 7 or older, you can go to DOS and type "debug". And then type the source code in the Monitor. Depend on the current memory segment location you are in, type the memory offset location and "U" to display the actual x86 assembly code.type "debug" to go to the Monitor and use the "E" command to type the codesstart typing the codes.. It is only 113 bytes long.E0fa 33 db 8e c3 26 c6 06 05 cfetc...when you have finished typing, type 'U' and the offset address and enter to display the actual codeu0