The list of the winners of the contest which ended 03/28/99:
This ZIP contains all the solutions sent in. Be aware of the fact that some may not work!
These were the problems to be solved:
Optimization: Size
Abbreviations:
Z-string = null-terminated string
ZF = zero flag set
NZ = zero flag cleared
CF = carry flag set
NC = carry flag cleared
Unless otherwise specified, all strings are Z-strings.
Reverse the bits in a string of bytes
Input: | HL ® string of bits, A = length of substring (0 < A < 256) |
Output: | The bits in the string should be reversed |
Special: | You may use 256 bytes of temporary storage, starting at TEMP |
Example:
Input: | HL = $C000, A = 5 ($C000)=%10010111 ($C001)=%00011011 ($C002)=%10101111 ($C003)=%00011001 ($C004)=%11010010 |
Output: | ($C000)=%01001011 ($C001)=%10011000 ($C002)=%11110101 ($C003)=%11011000 ($C004)=%11101001 |
Decide whether a Z-string is a palindrome or not (A palindrome is a number, word or phrase that reads the same backwards as forwards).
Input: | HL ® string |
Output: | Return with zeroflag set if the string is a palindrome, else the flag should be cleared |
Special: | You mayy assume that the string will only contain the lowercase letters a-z and word spacing. Note that white spaces should be discarded!!! |
Examples:
Input: | HL ® "rise to vote sir",0 |
Output: | ZF |
Input: | HL ® "abcdcb",0 |
Output: | NZ |
Don't forget to check special cases, like a string of size 0 (which should be considered as a palindrome).
Search for a substring in a string (case-sensitive).
Input: | HL ® string, DE ® substring |
Output: | If the substring exists, the carry flag should be cleared, and HL point to the first position in the string where the substring occurs. If the substring doesn't exist, the carry flag should be set, and HL may be anything. |
Special: | You may assume that the substring has at least 1 byte. The string itself can be of length 0 though. |
Examples:
Input: | HL ® "This is a string!!",0 DE ® "ring",0 |
Output: | NC, HL ® "ring!!",0 |
Input: | HL ® "Another string!!",0 DE ® "another",0 |
Output: | CF |