Geekboy

Untitled

Jan 29th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dbfCn2BASICGet:             ;INCOMPLETE
  2. ; Check to see if there is a frame.
  3. ; if there is parse the frame and write out
  4. ; id gets copied into the String
  5. ; List gets copied into the list
  6.  
  7.  
  8. ; we are sending raw variable data in the frames
  9. ; So if it is a list add it to a list if it is a string add it to a string
  10. ; MAKE SURE WE HAVE ENOUGH Ram for this
  11.  
  12. ;Order of routine.
  13. ;   Check for pending frame  [x]
  14. ;   MTROC ID string8    
  15. ;   Copy ID over
  16. ;   Check Data Type
  17. ;   MTROC Appropriate variable  (LCn2,Str9)
  18. ;   Copy Data over
  19. ;   Clear Frame Pending
  20. ;   Ret
  21.  
  22.  ld a,($86f8) ; load a with the incoming flag byte
  23.  bit 7,a             ; if the msb is set we have a frame
  24.  jp z,xLIBEndNoOut               ; if its not quit
  25.  ld hl,IDrealName
  26.  ld a,1                  ;delete and create theta.
  27.  ld (RVarLength),a
  28.  call DeleteAndCreate
  29.  push de                ; save data pointer so we can write the id to it later
  30.   ld a,(rdat)          ; load a with frame id
  31.   or a    ;if 0 we have a string if one we have a list.
  32.   jp nz,ldlist          ; if list div length by nine
  33.   ld a,(Rword)
  34.   sub 1                 ; if string calculate length
  35.   ld (RVarLength),a
  36.   ld hl,DataStringName
  37.   jr Copydata
  38.  
  39.  
  40. ldlist:
  41.   ld a,(rword)
  42.   sub 1
  43.   ld b,0
  44. Div9Loop:
  45.   inc b
  46.   sub 9
  47.   jr z,Div9Done
  48.   jr nc,div9loop
  49. Div9Done:
  50.   ld a,b
  51.   ld (RVarLEngth),a
  52.   ld hl,DataListName
  53.  
  54.  
  55. CopyData:
  56.   Call DeleteAndCreate
  57.   ;get data length -1 -> bc
  58.   ld a,(rword)      ; get length from frame and store into bc
  59.   sub 1
  60.   ld c,a
  61.   ld b,0
  62.   ld hl,(rdat+1)    ; load hl with pointer to frame+1 for variable data
  63.   ldir
  64.  pop de
  65. ;here i handle the real this should be rather easy
  66. ;we are interested in just the first 5 values in the mantessa
  67. ; the mantessa is de+2
  68. ; so lets initialise our variable
  69.  ld hl,$0080     ;standard exponent and no negative? i think we will see
  70.  inc de \ inc de
  71. ;Now the next 5 bytes are our id.
  72.  ld bc,5
  73.  ld hl,($86F3)   ; recieve id
  74.  ldir
  75. ;theta now has the user id in it
  76.  ld hl,RWord+1
  77.  res 7,(hl)
  78.  ; aknowledge we got a frame and quit
  79.  jp XlibEndNoOut
  80. DeleteAndCreate
  81. ;expects pointer to variable name in hl
  82. ;destroys all
  83. ;returns pointer to variable data in de
  84.  push hl
  85.   rst 20h  ;load op1 with variable name
  86.   bcall(_chkfindsym)
  87.   jr c,create
  88.   bcall(_DelVarArc)   ;delete if since it exists
  89. Create:
  90.  pop hl
  91.  ld a,(hl)
  92.  ld hl,(RVarLength)
  93.  bcall(_createvar)
  94.  ret
  95.  
  96.  
  97.  
  98.  
  99.  
  100. DataStringName:
  101.  .db strngOBJ,tVarStrng,tstr9,$0
  102. IDRealName:
  103.  .db $0,tTheta,$0,$0
  104. DataListName:
  105.  .db $01,tVarLst,tC,tN,t2,$0
Advertisement
Add Comment
Please, Sign In to add comment