Author Topic: Decoding IBM PC cassettes  (Read 2872 times)

0 Members and 1 Guest are viewing this topic.

Offline hamster_nzTopic starter

  • Super Contributor
  • ***
  • Posts: 2812
  • Country: nz
Decoding IBM PC cassettes
« on: October 14, 2020, 05:12:32 am »
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 at https://github.com/hamsternz/detape

It 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...

Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 
The following users thanked this post: edavid, Alex Eisenhut

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Decoding IBM PC cassettes
« Reply #1 on: October 14, 2020, 05:42:47 am »
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.
 

Offline bw2341

  • Regular Contributor
  • *
  • Posts: 163
  • Country: ca
Re: Decoding IBM PC cassettes
« Reply #2 on: October 14, 2020, 05:04:42 pm »
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.

 

Offline hamster_nzTopic starter

  • Super Contributor
  • ***
  • Posts: 2812
  • Country: nz
Re: Decoding IBM PC cassettes
« Reply #3 on: October 14, 2020, 08:27:45 pm »
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.


Oh, 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.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline bw2341

  • Regular Contributor
  • *
  • Posts: 163
  • Country: ca
Re: Decoding IBM PC cassettes
« Reply #4 on: October 14, 2020, 11:48:23 pm »
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.
 

Offline Leo Bodnar

  • Frequent Contributor
  • **
  • Posts: 812
  • Country: gb
Re: Decoding IBM PC cassettes
« Reply #5 on: December 12, 2020, 06:25:35 pm »
If this helps, here is cassette tape driver details from Multitech's (now Acer) MPF-I/88 i8088 trainer.
It can read and write IBM audio tape format.

Cheers
Leo

Offline Leo Bodnar

  • Frequent Contributor
  • **
  • Posts: 812
  • Country: gb
Re: Decoding IBM PC cassettes
« Reply #6 on: December 18, 2020, 01:11:55 pm »
Each block of 256 bytes is followed by a two byte CRC which is calculated as follows:

Code: [Select]
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

Offline Leo Bodnar

  • Frequent Contributor
  • **
  • Posts: 812
  • Country: gb
Re: Decoding IBM PC cassettes
« Reply #7 on: December 18, 2020, 02:19:59 pm »
Attached are the three sections of the IBM_PC_Diagnostics_Cassette.wav decoded into respective binary files.
Leo

Code: [Select]
Sync: 0x16

IBM_PC_Diagnostics_Cassette-header.bin

A5 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: 43E3
FF FF FF
LOL (Loss of lock)

Sync: 0x16

IBM_PC_Diagnostics_Cassette-BASIC.bin

6A 08 0A 00 3A 8F D9 20 20 20 54 68 65 20 66 6F     j...:..   The fo
6C 6C 6F 77 69 6E 67 20 42 41 53 49 43 20 70 72     llowing BASIC pr
6F 67 72 61 6D 20 70 6F 6B 65 73 20 61 20 6D 61     ogram pokes a ma
63 68 69 6E 65 20 6C 61 6E 67 75 61 67 65 20 70     chine language p
72 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 whi
63 68 20 77 69 6C 6C 20 6C 6F 61 64 20 61 6E 64     ch will load and
20 72 75 6E 20 20 20 44 49 41 47 4E 4F 53 54 49      run   DIAGNOSTI
43 53 2E 20 20 53 69 6D 70 6C 79 20 65 6E 74 65     CS.  Simply ente
72 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 copy
20 74 68 65 20 44 49 41 47 4E 4F 53 54 49 43 53      the DIAGNOSTICS
20 63 61 73 73 65 74 74 65 2C 20 73 61 76 65 20      cassette, save
74 68 69 73 20 70 72 6F 67 72 61 6D 20 6F 6E 20     this program on
79 6F 75 72 20 6E 65 77 20 63 61 73 73 65 74 74     your new cassett
Checksum. 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,&h
30 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: 8BCB
FF FF FF
LOL (Loss of lock)

Sync: 0x16

IBM_PC_Diagnostics_Cassette-binary_code.bin

B4 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     ...............X
3C 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     ...............G
00 E8 0C 31 E9 24 03 5D 00 54 68 65 20 49 42 4D     ...1.$.].The IBM
20 50 65 72 73 6F 6E 61 6C 20 43 6F 6D 70 75 74      Personal Comput
65 72 0D 41 44 56 41 4E 43 45 44 20 44 49 41 47     er.ADVANCED DIAG
4E 4F 53 54 49 43 53 0D 56 65 72 73 69 6F 6E 20     NOSTICS.Version
31 2E 30 32 20 28 43 29 43 6F 70 79 72 69 67 68     1.02 (C)Copyrigh
74 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: BE17
FF FF FF
LOL (Loss of lock)

Offline bobcat2000

  • Regular Contributor
  • *
  • Posts: 218
  • Country: us
Re: Decoding IBM PC cassettes
« Reply #8 on: December 29, 2020, 06:35:11 pm »
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 codes
start typing the codes.. It is only 113 bytes long.
E0
fa 33 db 8e c3 26 c6 06 05 cf
etc...

when you have finished typing, type 'U' and the offset address and enter to display the actual code
u0

« Last Edit: December 29, 2020, 06:48:49 pm by bobcat2000 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf