?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;
  3. pnmask: defb    0       ;Property number mask
  4. psmask: defb    0       ;Property size mask
  5. ;
  6. ;A lot of the code in this file has been hand-crafted from the C
  7. ;routines in jzip 2.0.1g.
  8. ;
  9. ;Find the property list for object DE
  10. ;
  11. propadd:                ;get_property_addr()
  12.         push    af
  13.         push    bc
  14.         push    de
  15.         call    objadd
  16.         ld      a,(zver)
  17.         ld      bc,7
  18.         cp      4
  19.         jr      c,propad3
  20.         ld      c,12
  21. propad3:
  22.         add     hl,bc
  23.         ld      e,0
  24.         call    ZXPKWI  ;BC = property pointer
  25.         ld      h,b
  26.         ld      l,c     ;HL = property pointer
  27.         call    ipeek   ;Read length of text
  28.         ld      c,a
  29.         ld      b,0
  30.         add     hl,bc
  31.         add     hl,bc   ;Skip over text
  32.         pop     de
  33.         pop     bc
  34.         pop     af
  35.         ret
  36. ;
  37. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  38. ;
  39. ;HL->property, make it point at the next property
  40. ;
  41. propnxt:                ;get_next_property()
  42.         push    bc
  43.         push    af
  44.         call    ZXPK64  ;Get property ID
  45.         inc     hl
  46.         ld      c,a
  47.         ld      a,(zver)
  48.         cp      4
  49.         jr      c,pnv3  ;v1-3 property has size in top 3 bits
  50.         bit     7,c
  51.         jr      nz,pnv4
  52.         bit     6,c
  53.         jr      z,pnv7
  54.         inc     hl
  55.         jr      pnv7
  56.  
  57. pnv4:   call    ZXPK64  ;Read property size
  58.         and     03Fh    ;Size
  59.         jr      pnv5
  60. ;
  61. pnv3:   ld      a,c
  62.         and     0E0h
  63.         rlca
  64.         rlca
  65.         rlca            ;A = length of property - 1
  66. pnv5:   ld      c,a
  67.         ld      b,0
  68.         add     hl,bc
  69. pnv7:   inc     hl
  70.         pop     af
  71.         pop     bc
  72.         ret
  73. ;
  74. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  75. ;
  76. ;For object DE, property BC return next property
  77. ;
  78. gnprop: call    propadd ;HL := address of property list
  79.         ld      a,(pnmask)
  80.         ld      b,a
  81.         ld      a,c
  82.         or      a
  83.         jr      z,gnpret
  84. gnprop1:
  85.         call    peek64
  86.         and     b       ;A = next property ID. Get next if A > C
  87.         cp      c
  88.         jr      c,gnprop2
  89.         jr      z,gnprop3       ;Found!
  90.         call    propnxt
  91.         jr      gnprop1
  92. ;
  93. gnprop2:
  94.         call    ilprint
  95.         defb    13,10,'Warning: Property not found!$'
  96. gnprop3:
  97.         call    propnxt
  98. gnpret: call    peek64
  99.         and     b
  100.         ld      l,a
  101.         ld      h,0
  102.         ret
  103. ;
  104. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  105. ;
  106. ;Get object DE, property C into HL
  107. ;
  108. gprop:          ;load_property()
  109.  
  110.         call    propadd ;HL = Address of property list
  111.         ld      a,(pnmask)
  112.         ld      b,a
  113. gpr3:   call    peek64  ;Get property ID
  114.         and     b
  115.         cp      c
  116.         jr      c,dprop ;Not found!
  117.         jr      z,gpr4 ;Found!
  118.         call    propnxt ;Next property
  119.         jr      gpr3
  120. ;
  121. gpr4:   ld      a,(psmask)
  122.         ld      b,a     ;Property size mask
  123.         call    peek64
  124.         inc     hl
  125.         and     b       ;Size = 0 (ie one byte)?
  126.         jr      nz,rword
  127.         call    peek64  ;Read the byte
  128.         ld      l,a
  129.         ld      h,0
  130.         ret
  131.  
  132. dprop:  ld      hl,(obj_addr)   ;Default properties
  133.         ld      e,c
  134.         ld      d,0
  135.         dec     de
  136.         add     hl,de
  137.         add     hl,de
  138. rword:  ld      e,0
  139.         call    ZXPKWI          ;Read word
  140.         ld      h,b
  141.         ld      l,c
  142.         ret
  143. ;
  144. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  145. ;
  146. ;Get address of object DE, property C
  147. ;
  148. ;                       ;load_property_address()
  149. gpaddr: call    propadd ;HL = Address of property list
  150.         ld      a,(pnmask)
  151.         ld      b,a
  152. gpad3:  call    peek64  ;Get property ID
  153.         and     b
  154.         cp      c
  155.         jr      c,gpnot ;Not found!
  156.         jr      z,gpad4 ;Found!
  157.         call    propnxt ;Next property
  158.         jr      gpad3
  159. ;
  160. gpnot:  ld      hl,0
  161.         ret
  162. ;
  163. gpad4:  ld      a,(zver)
  164.         cp      4
  165.         jr      c,gpad5
  166.         call    peek64
  167.         bit     7,a
  168.         jr      z,gpad5
  169.         inc     hl
  170. gpad5:  inc     hl
  171.         ret
  172. ;
  173. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  174. ;
  175. ;SET object DE property C to HL
  176. ;
  177. putprop:                ;store_property()
  178.         push    hl
  179.         call    propadd ;HL = Address of property list
  180.         ld      a,(pnmask)
  181.         ld      b,a
  182. ppr3:   call    peek64  ;Get property ID
  183.         and     b
  184.         cp      c
  185.         jp      c,proper1
  186.         jr      z,ppr4 ;Found!
  187.         call    propnxt ;Next property
  188.         jr      ppr3
  189. ;
  190. ppr4:   ld      a,(psmask)
  191.         ld      b,a     ;Property size mask
  192.         call    peek64
  193.         inc     hl
  194.         and     b       ;Size = 0 (ie one byte)?
  195.         jr      nz,wword
  196.         pop     de
  197.         ld      a,e
  198.         call    ZXPOKE  ;Read the byte
  199.         scf
  200.         ret
  201.  
  202. wword:  pop     de
  203.         ld      a,d
  204.         call    ZXPOKE
  205.         inc     hl
  206.         ld      a,e
  207.         call    ZXPOKE
  208.         scf
  209.         ret
  210. ;
  211. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  212. ;
  213. gplen:  ld      a,(psmask)      ;from jzip, load_property_length()
  214.         ld      d,a
  215.         dec     hl      ;HL -> property ID
  216.         ld      a,(zver)
  217.         cp      4
  218.         jr      c,gplen3
  219.         call    peek64
  220.         ld      e,a
  221.         bit     7,a
  222.         jr      z,gplen1
  223.         ld      a,e
  224.         and     d
  225.         jr      rprop
  226. ;
  227. gplen1: ld      hl,2
  228.         bit     6,a
  229.         scf
  230.         ret     nz
  231.         dec     hl
  232.         scf
  233.         ret
  234.  
  235. gplen3: call    peek64  ;Get property length in v1-v3
  236.         and     d       ;from the 3 high bits of the byte
  237.         rlca
  238.         rlca
  239.         rlca
  240.         inc     a
  241. rprop:  ld      l,a
  242.         ld      h,0
  243.         ret
  244.