Now I'm looking at sectrn. Its job is to use the value of [BC] as an index into the tranTable. It does a lookup into the tranTable and returns the value that is [BC] elements into the array. That is used to translate the logical sector provided by BDOS into the physical sector required by the hardware layer. So let's see how the sectrn function in the modular code compares to the sectrn function in the Douglas code.
The current CPM3.SYS file is from the modular BIOS, so we'll test that first:
A>sid cpmldr.com
CP/M 3 SID - Version 3.0
NEXT MSZE PC END
2500 2500 0100 CBFF
#I$B
#G
CP/M V3.0 Loader
Copyright (C) 1982, Digital Research
BIOS3 SPR 8E00 1C00
BDOS3 SPR 6F00 1F00
27K TPA
*01A9
#PA914
#G8E00
CP/M Plus v3.0hd
01 PASS A914
-Z-EI A=00 B=0000 D=930F H=0000 S=6FD0 P=A914 MOV L,C
*A915
##T
-Z-EI A=00 B=0000 D=930F H=0000 S=6FD0 P=A915 MOV H,B
*A916
#T
-Z-EI A=00 B=0000 D=930F H=0000 S=6FD0 P=A916 MOV A,D
*A917
#T
-Z-EI A=93 B=0000 D=930F H=0000 S=6FD0 P=A917 ORA E
*A918
#T
--ME- A=9F B=0000 D=930F H=0000 S=6FD0 P=A918 RZ
*A919
#T
--ME- A=9F B=0000 D=930F H=0000 S=6FD0 P=A919 XCHG
*A91A
#T
--ME- A=9F B=0000 D=0000 H=930F S=6FD0 P=A91A DAD B
*A91B
#T
--ME- A=9F B=0000 D=0000 H=930F S=6FD0 P=A91B MOV L,M
*A91C
#T
--ME- A=9F B=0000 D=0000 H=9301 S=6FD0 P=A91C MVI H,00
*A91E
#T
--ME- A=9F B=0000 D=0000 H=0001 S=6FD0 P=A91E RET
*784B
The first value is 01.
I'll set a passpoint at the RET instruction, which is where we should examine [HL] for the return value. And I'll remove the passpoint at the beginning of sectrn.
#PA91E
#-PA914
#G
01 PASS A91E
--ME- A=9F B=0001 D=0001 H=0009 S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=0002 D=0002 H=0011 S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=0003 D=0003 H=0019 S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=0004 D=0004 H=0003 S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=0005 D=0005 H=000B S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=0006 D=0006 H=0013 S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=0007 D=0007 H=001B S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=0008 D=0008 H=0005 S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=0009 D=0009 H=000D S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=000A D=000A H=0015 S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=000B D=000B H=001D S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=000C D=000C H=0007 S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=000D D=000D H=000F S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=000E D=000E H=0017 S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=000F D=000F H=001F S=6FD0 P=A91E RET
*784B
#G
01 PASS A91E
--ME- A=9F B=0000 D=0000 H=0001 S=6FD2 P=A91E RET
*784B
This accurately reflects the entries in the tranTable:
01,09,11,19,03,0B,13,1B,05,0D,15,1D,07,0F,17,1F,01,09 (in hex)
-or-
01,09,17,25,03,11,19,27,05,13,21,29,07,15,23,31,01,09 (in decimal)
Let's look at the Douglas code and see what it does. Setsec is at 90EB in his code.
A>sid cpmldr.com
CP/M 3 SID - Version 3.0
NEXT MSZE PC END
2500 2500 0100 CBFF
#I$B
#G
CP/M V3.0 Loader
Copyright (C) 1982, Digital Research
BIOS3 SPR 8E00 1A00
BDOS3 SPR 6F00 1F00
27K TPA
*01A9
#P90EB
#G8E00
CP/M 3 BIOS v1.0 for Altair 8" Floppy
01 PASS 90EB
-Z-EI A=00 B=0000 D=950E H=0000 S=6FD0 P=90EB XCHG
*90EC
#T
-Z-EI A=00 B=0000 D=0000 H=950E S=6FD0 P=90EC MVI B,00
*90EE
#T
-Z-EI A=00 B=0000 D=0000 H=950E S=6FD0 P=90EE DAD B
*90EF
#T
-Z-EI A=00 B=0000 D=0000 H=950E S=6FD0 P=90EF MOV L,M
*90F0
#T
-Z-EI A=00 B=0000 D=0000 H=9501 S=6FD0 P=90F0 MOV H,B
*90F1
#T
-Z-EI A=00 B=0000 D=0000 H=0001 S=6FD0 P=90F1 RET
*784B
Here we see the RET is at 90F1, so let's set a passpoint there and remove the one at 90EB, beginning of sectrn. Run the code 'til the end of the sequence - where it starts to repeat - and see what we've got:
#P90F1
#-P90EB
#G
01 PASS 90F1
-Z-EI A=00 B=0001 D=0000 H=0009 S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=0002 D=0000 H=0011 S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=0003 D=0000 H=0019 S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=0004 D=0000 H=0003 S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=0005 D=0000 H=000B S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=0006 D=0000 H=0013 S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=0007 D=0000 H=001B S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=0008 D=0000 H=0005 S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=0009 D=0000 H=000D S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=000A D=0000 H=0015 S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=000B D=0000 H=001D S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=000C D=0000 H=0007 S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=000D D=0000 H=000F S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=000E D=0000 H=0017 S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=000F D=0000 H=001F S=6FD0 P=90F1 RET
*784B
#G
01 PASS 90F1
-Z-EI A=00 B=0000 D=0000 H=0001 S=6FD2 P=90F1 RET
*784B
Same sequence. So the two versions of the code are in agreement in sectrn.
01,09,11,19,03,0B,13,1B,05,0D,15,1D,07,0F,17,1F,01,09 (in hex)
-or-
01,09,17,25,03,11,19,27,05,13,21,29,07,15,23,31,01,09 (in decimal)
Now I need to learn how that is used to translate the logical sectors to physical sectors. This is the sequence of sectors we expect to see when reading the directory on track 2:
00,10,18,02,0A,12,1A,04,0C,14,1C,06,0E,16,1E (in hex)
-or-
00,16,24,02,10,18,26,04,12,20,28,06,14,22,30 (in decimal)
The Douglas code takes the logical sectors from BDOS, and combines them with the values it gobbled up from sectrn and spits out the proper physical sector values. But not the modular code. It parrots the values from the tranTable, as if it were adding zero to the entries instead of doing the right math. Not a translation at all. My task is to find where the actual translation occurs and fix it.