snq
Experienced Member
I have an AST 486 that is bugging me about the serial and asset tag no longer being valid, and no matter what I try I just get errors where I try to set it using the tools I found.
So I decided to investigate...
I disassembled one of the tools that at least seems to read an empty asset tag but errors out when trying to set a new tag.
Found out it's calling some seemingly custom AST BIOS function to read/set it, so I dumped the F000h segment and started disassembling that.
So now I'm at the point where I can follow the entire process of how it's trying to set the new tag.
Basically it should be as simple as writing a 16 byte string to SRAM, maybe update a checksum somewhere afterwards but it never gets that far.
To write a byte to SRAM it uses this function:
This function takes the location in DX and the value in AL. Divides DX by 256 to get the page number (256 byte pages), selects that page by outputting it to IO port 0C00h.
Now that page should be mapped to 0800h-08FFh, and it outputs AL to 0800h+remainder.
The problem is, this doesn't seem to work on my machine...
So I replicated the BIOS code and tried writing something to the address of the asset tag.
Now here's my problem.. No matter what I write, it always reads back as 255.
And this is where I'm stuck, I don't know why it's behaving like this. I have a couple of guesses but not sure how to test.
I think either the SRAM is bad, or it simply doesn't exist, or 255 is the default content after power/memory loss and it's write protected.
Or maybe there's just something wrong with my code
Any ideas?
This is the code I use, so pretty much a C version of the above asm code.
So I decided to investigate...
I disassembled one of the tools that at least seems to read an empty asset tag but errors out when trying to set a new tag.
Found out it's calling some seemingly custom AST BIOS function to read/set it, so I dumped the F000h segment and started disassembling that.
So now I'm at the point where I can follow the entire process of how it's trying to set the new tag.
Basically it should be as simple as writing a 16 byte string to SRAM, maybe update a checksum somewhere afterwards but it never gets that far.
To write a byte to SRAM it uses this function:
Code:
BIOS_F:33A8 _writeSRAM proc near ; Select SRAM page and write AL at offset DX
BIOS_F:33A8 pushf
BIOS_F:33A9 cli
BIOS_F:33AA push bx
BIOS_F:33AB push ax
BIOS_F:33AC mov ax, dx
BIOS_F:33AE xor dx, dx
BIOS_F:33B0 mov bx, 100h
BIOS_F:33B3 div bx
BIOS_F:33B5 push dx
BIOS_F:33B6 mov dx, 0C00h ; Select SRAM page
BIOS_F:33B9 out dx, al
BIOS_F:33BA pop dx
BIOS_F:33BB add dx, 800h
BIOS_F:33BF pop ax
BIOS_F:33C0 out dx, al ; Write SRAM byte
BIOS_F:33C1 pop bx
BIOS_F:33C2 popf
BIOS_F:33C3 retn
BIOS_F:33C3 _writeSRAM endp
Now that page should be mapped to 0800h-08FFh, and it outputs AL to 0800h+remainder.
The problem is, this doesn't seem to work on my machine...
So I replicated the BIOS code and tried writing something to the address of the asset tag.
Now here's my problem.. No matter what I write, it always reads back as 255.
And this is where I'm stuck, I don't know why it's behaving like this. I have a couple of guesses but not sure how to test.
I think either the SRAM is bad, or it simply doesn't exist, or 255 is the default content after power/memory loss and it's write protected.
Or maybe there's just something wrong with my code
Any ideas?
This is the code I use, so pretty much a C version of the above asm code.
Code:
BYTE readSRAM(WORD ofs)
{
BYTE page = (ofs>>8);
ofs &= 255;
_disable();
outp(0xC00, page);
BYTE data = inp(0x800 + ofs);
_enable();
return data;
}
BYTE writeSRAM(WORD ofs, BYTE value)
{
BYTE page = (ofs>>8);
ofs &= 255;
_disable();
outp(0xC00, page);
outp(0x800 + ofs, value);
_enable();
return readSRAM(ofs);
}