TSR Program to change case of characters on screen in windows/dos

99封情书 提交于 2019-12-02 05:51:34

问题


I would like to know how can we change the letters of the characters on screen using C. It is a TSR program using dos.h header file.


回答1:


I might be able to help partially from what i remember of my early undergrad.

In DOS, the address 0xB8000000 (0xB800:0 as segment:offset rightly pointed out in comments) is the starting address of text mode video memory (0xA8000000 being that for graphics). Any thing written into this area is copied directly to vga card. Now every character on the screen is made up of two bytes. First byte was the ascii character and second was the color.

So effectively you take a far pointer in 16 bit c (since a normal near pointer won't do) and assign it the above address. Then assuming your screen size (25*80) or whatever * 2 is the total number of single byte addresses filling your screen.

I remember having written the equivalent of a trivial printf function using above.

Getting back to your problem, you have to write code which loops through all even addresses starting from above address till screen size. Even address because odd one represents color. There it checks if the assigned character is valid ascii and add or subtract according to needs e.g. 'A' + 32 would get you 'a' and so on.

Question remains about when your above program does this. I believe you can have some interrupt or similar thing in dos.h which triggers every time any screen character is changed. But this part is not very clear in my memory.

See if that works for you.



来源:https://stackoverflow.com/questions/12825511/tsr-program-to-change-case-of-characters-on-screen-in-windows-dos

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!