?login_element?

Subversion Repositories NedoOS

Rev

Rev 1988 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.     module History
  2. back:
  3.     ld a, (depth) : cp 1 : jp z, load
  4.     ld hl, historyBlock + HistoryRecord, de, historyBlock, bc, (total - 1) * HistoryRecord : ldir ; Move history up
  5.     ld hl, depth : dec (hl)
  6. ; Loads current resource
  7. load:
  8.     ld hl, .msg : call DialogBox.msgNoWait
  9.     xor a : ld hl, outputBuffer, de, outputBuffer + 1
  10.         IFDEF MSX
  11.         ld bc, (ramtop)
  12.         dec bc
  13.         ELSE
  14.         ld bc, #ffff - outputBuffer - 1
  15.         ENDIF
  16.  
  17.     ld (hl), a
  18.     ldir
  19.    
  20.     ld a, (historyBlock.isFile) : and a : jp nz, Fetcher.fetchFromFS
  21.     jp Fetcher.fetchFromNet
  22.  
  23. .msg db "    Loading resource! Please wait! It will be here soon!", 0
  24.  
  25. home:
  26.     ld hl, homePage
  27. ; HL - gopher row
  28. navigate:
  29.     ld de, hl
  30.     call UrlEncoder.isValidGopherRow
  31.     jr nc, load ; Not valid - reload last
  32.     ld hl, de
  33.     push hl
  34.  
  35.     push hl
  36.     ld hl, HistoryEnd - HistoryRecord, de, HistoryEnd, bc,  HistoryRecord * total : lddr
  37.  
  38.     ld de, (Render.position), (historyBlock.position + HistoryRecord), de
  39.     ; Clean up struct
  40.     xor a : ld hl, historyBlock, de, historyBlock + 1, bc, historyBlockSize - 1, (hl), a : ldir
  41.     pop hl
  42.  
  43.     ; Fill record
  44.     ld de, hl
  45.     call UrlEncoder.isFile
  46.     ex hl, de
  47.     ld de, historyBlock
  48.     ld (de), a : inc de
  49.     ld a, (hl) : push hl, de : call Render.getIcon : pop de, hl
  50.     ld (de), a : inc de
  51.     ld a, 9
  52.    
  53.     ld bc, #1ff
  54.    
  55.     cpir
  56. .locatorCopy
  57.     ld a, (hl) : cp 9 : jr z, 1f
  58.     ld (de), a : inc hl, de
  59.     jr .locatorCopy
  60. 1
  61.     inc hl : xor a : ld (de), a
  62.     ld de, historyBlock.host
  63. .hostCopy
  64.     ld a, (hl) : cp 9 : jr z, 1f
  65.     ld (de), a : inc hl, de
  66.     jr .hostCopy
  67. 1
  68.     inc hl : xor a : ld (de), a
  69.     ld de, historyBlock.port
  70. .portCopy
  71.     ld a, (hl)
  72.     cp 9 : jr z, 1f
  73.     cp 13 : jr z, 1f
  74.     cp 10 : jr z, 1f
  75.     cp 0  : jr z, 1f
  76.     ld (de), a : inc hl, de
  77.     jr .portCopy
  78. 1   xor a : ld (de), a
  79.     ld hl, DialogBox.inputBuffer, de, historyBlock.search, bc, #ff : ldir
  80.     ld de, 0, (historyBlock.position), de
  81.     pop hl
  82.     ld a, (depth) : cp total : jr nc, 1f
  83.     inc a : ld (depth), a
  84. 1
  85.     ld a,(historyBlock.mediaType) : cp MIME_DOWNLOAD : jp z, Gopher.download
  86.    
  87.     ifdef GS
  88.     cp MIME_MOD : jp z, Gopher.loadMod
  89.     endif
  90.  
  91.     jp load
  92.    
  93. homePage:    
  94.         IFDEF MSX
  95.         db "1Home", TAB, "index.gph"
  96.         db TAB, "file", TAB, "70", CR, LF, 0
  97.     ELSE
  98.         db "1Home", TAB, "browser/index.gph"
  99.         db TAB, "file", TAB, "70", CR, LF, 0
  100.     ENDIF  
  101.     endmodule