Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AX vs AL as Reason Code in FCB function #9

Closed
tsupplis opened this issue Apr 26, 2020 · 3 comments
Closed

AX vs AL as Reason Code in FCB function #9

tsupplis opened this issue Apr 26, 2020 · 3 comments

Comments

@tsupplis
Copy link
Collaborator

tsupplis commented Apr 26, 2020

Sorry, I closed: #8 by mistake

@tsupplis
Copy link
Collaborator Author

I hope I am not a nuisance going through all the legacy functions ...
Using the same legacy program hex2bin and asm, I found they rely on the stability of ha coming out of int 21h functions 14h, and 15h. They are supposed to give their return in AL, not AX.
Here is the proposed fix:

   case 0x14: // SEQUENTIAL READ USING FCB
        dos_show_fcb();
        cpuSetAX(0x1400|dos_read_record_fcb(dosDTA, 1));
        break;
    case 0x15: // SEQUENTIAL WRITE USING FCB
        dos_show_fcb();
        cpuSetAX(0x1500|dos_write_record_fcb(dosDTA, 1));
        break;
....
    case 0x21: // RANDOM READ USING FCB
        dos_show_fcb();
        cpuSetAX(0x2100|dos_read_record_fcb(dosDTA, 0));
        break;
    case 0x22: // RANDOM WRITE USING FCB
        dos_show_fcb();
        cpuSetAX(0x2200|dos_write_record_fcb(dosDTA, 0));
        break;

I noticed the problem is same with open, close who are overwriting ah. so 0x0F to 0x22 also rename/delete missing, I will give you a proposed implementation. I will create a different issue for those if you are ok.

The file below is a first pass at remediating AX vs AL:
dos.zip

I also fixed another small regression. close was setting/clearing CF which is ok for dos 2+ but not for FCB.

@dmsc dmsc closed this as completed in 5eff3e2 Apr 26, 2020
@dmsc
Copy link
Owner

dmsc commented Apr 27, 2020

Thanks for all the help!

I fixed it using a different implementation.

Regarding the dos_close_file, I think that modifying the C flag should not be a problem, so I simply overwrite the full AX value on the AH=10H function.

My reference (the "intlist", at http://www.ctyme.com/intr/int-21.htm ) does not specify if C flag is allowed to chante.

@dmsc
Copy link
Owner

dmsc commented Apr 27, 2020

I hope I am not a nuisance going through all the legacy functions ...

No, I really appreciate the help!

I noticed the problem is same with open, close who are overwriting ah. so 0x0F to 0x22 also rename/delete missing, I will give you a proposed implementation. I will create a different issue for those if you are ok.

Yes, please. I have implemented DOS functions as I found programs that used them, I started the emulator with the intention to execute some old DOS electronics programs in Linux (the PALASM and related), and grew it from there.

I also fixed another small regression. close was setting/clearing CF which is ok for dos 2+ but not for FCB.

Yes, I saw that, do you think that this is important? or, any program would be affected by this?

Have Fun!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants