STAR TIP 12 (Custom Loader) by Graham Mason from Your Sinclair #33 (September 1988) Graham has been programming since the good old days, back in the ZX81 century. He's worked for a majority of major companies including Lothorien, PSS, and CRL. He's also a pretty deadly hacker, so check out some of his work in Practical POKEs. His all time fave rave games are Exolon and Gothik, and music-wise he likes a good bout of Genesis to un-curdle his muscles. And as a grand finale this month, we have for you a grand, great, supa, smashing, ace Star Tip for you to slaver over. This thrilling star tip is from Graham Mason. His speciality is loading and protection systems, and he has developed the indomitable - to all but him - Injectaload system, used on recent CRL games. So this month I asked him to write us a snazzy, glow-in-da-dark, hyper-fast, loading system. Check it out. Loader Specs This is probably the most comprehensive, compact and down-right crucial loading routine I've ever come across.Within it's 400 byte size (1), there's facilities for loading and saving a program of any length, with any colour in the border, at any baud rate. And what's more - and listen now! - it's possible to have the loader program scrunched down to an amazing 52 - yes, 52! - bytes! Method First of all, type in the main basic initialiser program and save it with SAVE "name" LINE 10. Then type in the 400 bytes code block using the hex loader (from Circles), and save that with SAVE "name" CODE 60000,400. After you've managed that, RUN the basic program and re-load the code. Initialising The program allows you to set up all the variables you need to get your loader working. Here's a quick resume of them: TO LOAD: POKE 60003,length HI 60004,length LO POKE 60007,start HI 60008,start LO POKE 60015,n 60027,n 60085,n 60177,n Where n is the border colour (2) POKE 60090,x 60116,x 60124,x 60129,x 60144,x Where x is the baud rate (3) RANDOMIZE USR 60000 TO SAVE: POKE 60208,length HI 60209,length LO POKE 60205,start HI (4) 60206,start LO (4) POKE 60223,n 60274,n 60302,n Where n is the border colour (2) POKE 60257,x 60290,x 60296,x 60312,x Where x is the baud rate (3) RANDOMIZE USR 60201 The format for typing in the variable marked HI or LO (be it "length" or "start") is: POKE address,value-256*INT(value/256) POKE address+1,INT(value/256) If the variable is marked with an "x" or an "n" then just POKE in the value as per normal. Using the initialise program is easier than typing in all these variables, but do have a pencil and pad handy to write down any values you might have to POKE, such as the length number for example. Once you're satisfied with the variables, the program will exit to basic and expect you to POKE the colour, length and start variables into the address previously given. You don't have to bother with the baud rate, they're POKEd in for you. The baud rate can be any value between 1200 (snail speed), and 60000 (Boris Becker serve) (5). Then once you've POKEd them all, type either RANDOMIZE USR 60000 to load or RANDOMIZE USR 60201 to save (have your tape running). Both routines are fully error-trapped, crash-less and fool-proof, so thank your lucky hyphens. Mega-Loader (6) This is an assembly listing of the 52 byte mega-loader, which will load any code saved by the previous routine with a little trial-and-error. Unfortunately - this is the price you have to pay for such a small loader - you'll have to experiment to get the correct value for the timing constant, but c'est la vie as les frogs say. This little loader will load any length of program and as soon as you stop the tape, or when the program that's loading ends, it will return to basic. notes: (1) It's actually 350 bytes - that's all the basic program bothers to save, and it seems to work just fine. (2) No real explanation is given of this, but it's just a cosmetic detail, so it doesn't really matter. (3) No real explanation of this either! This would be important, but fortunately the basic program does it all for you. (4) These values are not the same as the ones given in the listing - these are correct, the listing is wrong. Had I noticed when I typed it in I would have corrected it. (5) Yes, it really does say 60000 baud! Must be a typo for 6000 though. (6) see seperate text file [TurboLoad.asm].