home *** CD-ROM | disk | FTP | other *** search
/ The Grim Reaper 8 / Grim_Reaper_The_Issue_08_1993___BASIC.atr / bet.doc < prev    next >
Text File  |  2023-02-26  |  3KB  |  1 lines

  1. Better Programming¢------------------¢¢At last it returns! Sorry about the¢delay but I didn't really have many¢ideas on what to write about, but I¢think this issues could be of help to¢a lot of people.¢*¢There's nothing worst when running a¢BASIC program and having to wait an¢absolute age whilst data is being¢loaded from disk. The reason it is¢usually so slow is because the program¢has used the GET command to retrieve¢data from the disk drive. This is¢totally unnecessary because a small¢crash course on using locations 850,¢852-853 and 856-857 will allow you to¢load data from disk at the same speed¢as a normal load.¢ Using the aforementioned locations is¢really quite easy, you just need¢someone to point out what each location¢does and then you should have no¢problems at all. You must first open¢your file before the necessary POKEs¢that are shown here.¢*¢loc 850¢¢This is the read/write location. If you¢are reading data from the disk then the¢value 7 should be stored in here. If,¢on the other hand, you are writing to¢disk you should store 11 here. By store¢I simply mean POKE 850,7.¢*¢locs 852-853¢¢These two locations are the start of¢memory to load into. A problem is they¢are in hi/lo format and so your¢start address must be converted before¢being stored in these locations. For¢example, say you have to load your data¢starting at memory address 11734. To¢convert this number into hi/lo use the¢following...¢¢ LOC=11734:HI=LOC-(INT(LOC/256)*256):¢ LO=INT(LOC/256)¢¢This will give you the value of 214 in¢HI and 45 in LO thus store 214 in loc¢852 and 45 in 853.¢*¢locs 856-857¢¢These two locations are for the number¢of bytes to be loaded. Again they're in¢hi/lo format and you can use the above¢program to convert the number. If you¢are unsure about how many bytes to load¢then simply storing 255 in both locs¢will do the trick most of the time.¢This is only if the data you are to¢load has nothing after it. For example¢if you are to load a font into memory¢then chances are the file will contain¢the font data and nothing else. So¢storing 255 in both locs should be¢fine.¢¢The next bit you have to do is call the¢disk drive into operation. This is done¢via a small machine language routine¢that you have probably come across¢before. Because this doc can't deal¢with special characters you will have¢to load the file 'D:BET.BAS' from this¢disk to see an example. The only snag¢with using all the information here is¢that it will only work with IOCB 1.¢Although it is possible to change it¢to work with any IOCB number (by this I¢mean the number following the hash when¢you OPEN a file) it could be hard for¢some of you to follow and would make¢the BASIC listing rather harder to¢understand. Just remember to always¢leave IOCB 1 free at all times for any¢disk I/O that is needed.¢*¢That about wraps this up. I hope this¢has helped someone, somewhere¢understand this subject a bit more.¢¢John E. (TEBSF)¢