
From: Guy Cousineau <COUSINEAUG@EM.AGR.CA>

Subject: TDOS/80 columns -Reply

Hi Marcel,

Geee that is a tough question.  We never thought that address
would be required so there is no direct link to the buffer 
address.  I tried to find a sure path to the buffer but the 
162 versions of TDOS all put the buffer in a different place.  
However, I know the buffer is above the 1K read block buffer 
and that is just above the allocation vector for the RAM drive.
The following technique should work:

--extract address at 01ch past BIOS start (select drive)
--subtract 14 from that address and extract the DPH for the ram
  drive
--add 15 to that address to extract get the ALV pointer
--add 64 to that  to get end of ALV
--add 1024 to get to the end of the 1K buffer
----phew!!

so in z80 (unless my code is rusty)

ld   hl,biosstart
ld   de,01ch
add hl,de      ;pointer to select drive
ld   e,(hl)
inc hl
ld   d,(hl)      ;get routine address
ld   hl,-14
add hl,de      ;take 14 away to get DPH
ld   e,(hl)
inc hl
ld   d,(hl)      ;get address of DPH
ld   hl,15
add hl,de      ;pointer to ALV ram drive
ld   e,(hl)
inc hl
ld   d,(hl)
ld   hl,1024+64  ;skip ALV length and 1k buffer
add hl,de       ;hl=start of 24x80  (780h) screen buffer

From what I can see of the code, this should work with any ver-
sion of TDOS.  I have a shorter version but I am not sure if 
this will work consistently.  This one looks for the address of 
the READ BLOCK BUFFER in the write block routine:

ld   hl,biosstart
ld   de,06dh      ;write block routine
add hl,de
ld   e,(hl)
inc hl
ld   d,(hl)          ;extract address of routine******
ld   hl,10           ;offset to LD DE,BUFFERADDRESS
add hl,de
ld   e,(hl)          ;get address of buffer
inc hl
ld   d,(hl)
ld   hl,1024       ;add 1K
add hl,de          ;hl=start of screen buffer

*****at that address you should see the pattern

F5
C5
D5
CD xx xx
30 xx
E1
11 xx xx        +++++
01 00 40
ED B0

++++ this is the address you want to get and add 1k to it.


Good luck.......If neither of these techniques work, let me know
and I'll go back to the code again.

You've done a great job with the emulator.  I've looked at it a
couple of times and it does the job.  I ran it on a 386x40 and 
it ran about the same speed as on the ADAM.  I'd like to see it 
running on a pentium II   :-)

Guy

