DonNews #07
23 апреля 1999 |
|
Coding - Definition of a page number of upper memory.
Snake \ OHG Coding. Coding, it's certainly loud skazano.Zdes will be just one small files of, which, I think anyone can useful. When I wrote a small prog for cache, whereby when you click on Magic could start the boot, or enter in the STS (first I wanted to in this section put it, but then changed his mind, but if someone wants, then the next number You can place and her). When entering the STS saved all the registers, the address of the interrupted program address stack, but the page number upper memory to take it nowhere. Therefore it was necessary to determine its software. That's listing of this program: FPG LD DE, (# C000) LD BC, # 7FFD LD # C000, BC LD A, # D7 FPG1 INC A BIT 3, A JR Z, FPG2 ADD A, # 38 FPG2 OUT A LD HL, (# C000) AND A SBC HL, BC JR NZ, FPG1 LD # C000, DE ... A little explanation: the register DE stored 2 bytes from address # C000, in Register A page number from which search begins, # D7 - to the first the addition of a # 10 (so the program takes up less than 2 bytes). At # C000 recorded two bytes # FD, # 7F, by which we shall seek the desired page. Then we begin in order to switch page and compare the two bytes at # C000 with the contents of register BC, as soon as all coincide, then the page is found. On output in register A will be in room page in which was launched this program. The program takes only 34 bytes and is designed to 512kb with an extension for two Senior bits port # 7FFD.Stroka ADD A, # 38 is designed to reset the third bit, and increase by 1 two bits of the Register A, which will switch additional memory. Naturally, the 128y car program be it the same work just fine. Disadvantages: All the same can be obtained so that bytes # FD, # 7F, which is search may be in another page. Then, if its number is smaller, the definition of going wrong, and in the page you had to find a spoiled 2 bytes. And of course, does not define what was included screen. P.S: OUT A = OUT (C), A LD # C000, BC = LD (# C000), BC XAS = RULEZ.
Other articles:
Similar articles:
В этот день... 21 November