›››› TEST PROGRAMS› › The two programs TEST1.C and TEST2.C were used to debug the XE Bank› routines during their development. They serve as a good example of› how to use the routines.› › The program files assume that they and the CC65 files STDIO.H,› C0F1.OLB and RUNTIME.OBJ are all in the current drive and/or› directory. In SpartaDOS X, I used the commands:› › X CC65 TEST1.C› X RA65 TEST1.M65› X LINK65 -O TEST1.COM @TEST1.LNK› › The files are written using the ASCII curly brace characters instead› of the $( $) pairs.› › Each program presents you with the prompt› › TEST>› › at which you may enter the listed commands. The first word is the› command, of which only the first character is significant. The› commands are not case sensitive. The remaining words are arguments;› supply data in these positions. Arguments listed inside [ and ]› characters are optional.› › › TEST1.C› › This program tests each of the XE Bank access routines. The arguments› must be given in signed decimal integer format, except for "fvalue",› "file" and "str" arguments.› › QUIT Quit the program.› › TRANSFER [file]› If "file" is given, use main2x() to read a file into XE› memory, starting at 0x0000. Be sure to specify the complete› filespec. Then, x2main() is used to copy the contents of XE› memory back to E:, starting from 0x0000 to the first zero› byte.› › INT addr [value]› Prints the 16-bit integer at "addr". Then, if "value" is› given, sets the 16-bit integer at "addr" to "value".› › CHAR addr [value]› Prints the character at "addr". Then, if "value" is given,› sets the character at "addr" to "value".› › FLOAT addr [fvalue]› Prints the 6-byte float at "addr". Then, if "fvalue" is› given, sets the 6-byte float at "addr" to "fvalue".› ››››› 1››››››› 2NDFLOAT addr fvalue› Sets the 6-byte float at "addr" to "fvalue" without reading› the old value.› › READ addr len file› Reads "len" bytes from "file" directly to "addr".› › WRITE addr len file› Writes "len" bytes from directly from "addr" to "file".› › ZERO addr len› Stores "len" zeros starting at "addr".› › LENGTH addr› Prints the length of the C string starting at "addr".› › EQUAL addr str› Compares the C string at "addr" to the string "str". Due to› the command parsing algorithm, "str" may not contain› whitespace.› › ADDRESS Prints the starting address and the ending address of the› XE-Bank routines in main memory. The routines may not extend› into the memory access window.› › › TEST2.C› › This program tests the dynamic memory allocation routines. The› arguments must be given in unsigned decimal integer format.› › QUIT Quit the program.› › ALLOCATE len› Requests allocation of "len" bytes. Either prints the address› of the block or 0x0000 if the request could not be fulfilled.› › FREE addr› Returns memory block starting at "addr" to the free memory› list.› › TRAVERSE› Traverses the free memory list, printing the address of each› free block.› › INITIALIZE› Re-initializes the XE-Memory bank for dynamic access.› › END Prints the last address of main memory used by the XE-Bank› routines.› ››››››››› 2›››