Rev 1601 | Details | Compare with Previous | Last modification | View Log
Rev | Author | Line No. | Line |
---|---|---|---|
1601 | kulich | 1 | MODULE UrlEncoder |
2 | ; HL - pointer to line in gopher page |
||
3 | ; C - flag set when it's file |
||
4 | isFile: |
||
5 | .findServerLoop |
||
6 | ld a, (hl) : and a : jr z, .notFile : inc hl |
||
7 | cp 13 : jr z, .notFile |
||
8 | cp 9 : jr z, .skipPath |
||
9 | jr .findServerLoop |
||
10 | .skipPath |
||
11 | ld a, (hl) : and a : jr z, .notFile : inc hl |
||
12 | cp 13 : jr z, .notFile |
||
13 | cp 9 : jr z, .compareServer |
||
14 | jr .skipPath |
||
15 | .compareServer |
||
16 | ld a, (hl) : cp "f" : jr nz, .notFile : inc hl |
||
17 | ld a, (hl) : cp "i" : jr nz, .notFile : inc hl |
||
18 | ld a, (hl) : cp "l" : jr nz, .notFile : inc hl |
||
19 | ld a, (hl) : cp "e" : jr nz, .notFile : inc hl |
||
20 | ld a, (hl) : cp 9 : jr nz, .notFile : inc hl |
||
21 | ld a, 1 |
||
22 | ret |
||
23 | .notFile |
||
24 | xor a |
||
25 | ret |
||
26 | |||
27 | ; Is enough fields to encode |
||
28 | ; HL - pointer to line in gopher page |
||
29 | ; C - flag set when there is enough fields |
||
30 | isValidGopherRow: |
||
31 | ld a, (hl) : and a : jr z, isFile.notFile : inc hl |
||
32 | cp 13 : jr z, isFile.notFile |
||
33 | cp 9 : jr z, .skipPath |
||
34 | jr isValidGopherRow |
||
35 | .skipPath |
||
36 | ld a, (hl) : and a : jr z, isFile.notFile : inc hl |
||
37 | cp 13 : jr z, isFile.notFile |
||
38 | cp 9 : jr z, .skipHost |
||
39 | jr .skipPath |
||
40 | .skipHost |
||
41 | ld a, (hl) : and a : jr z, isFile.notFile : inc hl |
||
42 | cp 13 : jr z, isFile.notFile |
||
43 | cp 9 : jr z, .isValid |
||
44 | jr .skipHost |
||
45 | .isValid: |
||
46 | scf |
||
47 | ret |
||
48 | |||
49 | extractPath: |
||
1990 | kulich | 50 | ld hl, historyBlock.locator, de, Gopher.requestbuffer, bc, #ff : ldir |
1601 | kulich | 51 | ret |
52 | |||
53 | extractHostName: |
||
54 | ld hl, historyBlock.host, de, hostName, bc, 64 : ldir |
||
55 | ret |
||
56 | |||
57 | ENDMODULE |
||
58 | |||
1990 | kulich | 59 | ;nameBuffer ds #ff, 0 |
1601 | kulich | 60 | |
61 | db 0 |
||
62 | hostName ds 64 |