Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1126 | savelij | 1 | ifndef radix50inc |
| 2 | radix50inc equ 1 |
||
| 3 | |||
| 4 | save ; no listing over this file |
||
| 5 | listing off |
||
| 6 | |||
| 7 | ; this translates the ASCII characters 0...127 to their RADIX50 |
||
| 8 | ; (PDP-11/VAX) representation, as far as possible: |
||
| 9 | |||
| 10 | ; NOTE: The save/restore mechanism will assure that after inclusion |
||
| 11 | ; of this file, you still use the same character mapping as you |
||
| 12 | ; did before. To activate this mapping, place a 'codepage radix50' |
||
| 13 | ; in your code! |
||
| 14 | |||
| 15 | codepage radix50 |
||
| 16 | |||
| 17 | charset |
||
| 18 | charset 0, 31, |
||
| 19 | charset ' ', 0 |
||
| 20 | charset '!', '#', |
||
| 21 | charset '$', 27 |
||
| 22 | charset '%', 29 |
||
| 23 | charset '&', '-', |
||
| 24 | charset '.', 28 |
||
| 25 | charset '/', |
||
| 26 | charset '0', '9', 30 |
||
| 27 | charset ':', '@', |
||
| 28 | charset 'A', 'Z', 1 |
||
| 29 | charset '[', '`', |
||
| 30 | charset 'a', 'z', |
||
| 31 | charset '{', '~', |
||
| 32 | charset 127,255, |
||
| 33 | |||
| 34 | ; This macro stores the given string in (packed) RADIX 50 |
||
| 35 | ; encoding. The 'radix50' code page does not need to be |
||
| 36 | ; selected before usage. |
||
| 37 | |||
| 38 | radix50 macro arg |
||
| 39 | __rad50_acc set 0 |
||
| 40 | __rad50_pos set 0 |
||
| 41 | rept strlen(arg) |
||
| 42 | __rad50_ch set CODEPAGE_VAL(CHARFROMSTR(arg, __rad50_pos), "radix50") |
||
| 43 | if __rad50_ch == -1 |
||
| 44 | error "string contains characters not representable in RADIX 50" |
||
| 45 | __rad50_acc set __rad50_acc * 40 |
||
| 46 | elseif |
||
| 47 | __rad50_acc set __rad50_acc * 40 + __rad50_ch |
||
| 48 | endif |
||
| 49 | __rad50_pos set __rad50_pos + 1 |
||
| 50 | if (__rad50_pos # 3) == 0 |
||
| 51 | word __rad50_acc |
||
| 52 | __rad50_acc set 0 |
||
| 53 | endif |
||
| 54 | endm |
||
| 55 | switch strlen(arg) # 3 |
||
| 56 | case 1 |
||
| 57 | word __rad50_acc * 40 * 40 |
||
| 58 | case 2 |
||
| 59 | word __rad50_acc * 40 |
||
| 60 | elsecase |
||
| 61 | endcase |
||
| 62 | endm |
||
| 63 | |||
| 64 | restore ; restore previous listing state and code page |
||
| 65 | |||
| 66 | endif ; radix50inc |