Micro­power

  

Volume 2, Number 1 – February 1982

Page 12 of 37

XTAL BASIC EXTRA

by David Elliott

Here are six more commands tor Crystal Basic 2.2. OLD recovers a program which has been ‘exterminated’ by a NEW or a cold start. STRING$(nn,​cc) creates a string of nn characters with ASCII code cc. LOWER$(..) and UPPER$(..) convert a given string to lower and upper case respectively, while REVERSE$(..) changes the case of the characters in a string. Finally, EVAL(…) returns the value of a given string. The assembler listing of the commands is followed by the code to be entered using the loader program described in the last issue.

2D000090ORG £2D00
0100;
0110; @@@@@@@@@@@
0120; @@         O L D         @@
0130; @@@@@@@@@@@
0140;
0150; OLD RECOVERS A PROGRAM PREVIOUSLY
0160; ERASED BY A ‘NEW’ COMMAND
0170;
2D00FD2A83120180OLDLD IY, (1283H); GET TEXT START
2D04FDE50190PUSH IY; SET IX TO START
2D06DDE10200POP IX
2D08AF0210XOR A
2D0906000220LD B, 0; DOING FIRST LINE
2D0B1104000230LD DE, 4; SKIP LINE NUMBER
2D0EFD190240ADD IY, DE; AND LINK ADDRESS
2D10FDBE000250OLD1CP (IY); END OF LINE?
2D1328040260JR Z, OLD3; IF SO, JUMP
2D15FD230270OLD2INC IY; NO, TRY NEXT BYTE
2D1718F70280JR OLD1
0290;
2D19780300OLD3LD A,B; END OF 1ST LINE?
2D1AB70310OR A
2D1B200D0320JR NZ, OLD4
2D1D06010330LD B,1; IF SO, RESET FLAG
2D1FFD230340INC IY; RESTORE LINK
2D21FDE50350PUSH IY; TO SECOND LINE
2D23D10360POP DE
2D24DD73000370LD (IX),E
2D27DD72010380LD (IX+1),D
0390;
2D2AAF0400OLD4XOR A
2D2BFDBE010410CP (IY+1); END OF PROGRAM?
2D2E20E50420JR NZ,OLD2; NO, TRY AGAIN
2D30FDBE020430CP (IY+2); END OF PROGRAM?
2D3320E00440JR NZ, OLD2; NO, TRY AGAIN
0450;
0460; END OF PROGRAM FOUND
0470;
2D351103000480LD DE, 3; RESTORE POINTERS
2D38FD190490ADD IY, DE

Page 12 of 37