home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / a68kex_431.lzh / A68Kex / GetReal.asm < prev    next >
Assembly Source File  |  1991-01-17  |  6KB  |  198 lines

  1. *
  2. * ENTRY: d0 pointer to screen structure
  3. *        d1 screen type
  4. *        a0 pointer to output text (one line)
  5. *        a1 pointer to window title
  6. *        a2 value to display
  7. *
  8. * Opens window , writes text
  9. * inputs a real number and converts it to
  10. * floating point format
  11. *
  12. * EXIT:
  13. * If d1 = 0 all is well and the number is in d0
  14. * If d1 <> 0 something went wrong
  15. *
  16. * written by E. Lenz
  17. *            Johann-Fichte-Strasse 11
  18. *            8 Munich 40
  19. *            Germany
  20.  
  21.  XDEF GetReal
  22.  XREF RealIn
  23.  
  24. _AbsExecBase     equ 4
  25.  
  26. ***** exec ****
  27.  
  28. _LVOWait         equ -$13e
  29. _LVOGetMsg       equ -$174
  30. _LVOReplyMsg     equ -$17a
  31. _LVOCloseLibrary equ -$19e
  32. _LVOOpenLibrary  equ -$228
  33.  
  34. **** intuition *****
  35.  
  36. _LVOCloseWindow  equ -$48
  37. _LVOEndRequest   equ -$78
  38. _LVOOpenWindow   equ -$cc
  39. _LVORequest      equ -$f0
  40.  
  41. wd_UserPort equ $56
  42.  
  43. GetReal      movem.l d2-d7/a3-a6,-(a7)
  44.              move.l  d0,nws
  45.              move.w  d1,stype
  46.              move.l  a0,Rtxt
  47.              move.l  a1,title
  48.              lea     Buffer(pc),a0
  49.              moveq   #0,d1
  50. trans        move.b  (a2)+,d0
  51.              move.b  d0,(a0)+
  52.              addq.l  #1,d1
  53.              cmpi.b  #$a,d0
  54.              bne.s   trans
  55.              move.w  d1,pos
  56.              moveq   #1,d1
  57.              move.l  _AbsExecBase,a6
  58.              lea     IntName(pc),a1        Open intuition.library
  59.              moveq   #0,d0
  60.              jsr     _LVOOpenLibrary(a6)
  61.              move.l  d0,d4
  62.              beq.s   exit
  63.  
  64.              movea.l d0,a6
  65.              movea.l d0,a5
  66.              lea     nw(pc),a0              open window
  67.              jsr     _LVOOpenWindow(a6)
  68.              move.l  d0,window
  69. Gexit        beq     exit
  70.  
  71.              movea.l d0,a4
  72.              lea     Request1(pc),a0   Send up requester
  73.              movea.l a4,a1
  74.              jsr     _LVORequest(a6)
  75.  
  76. Reqwait      movea.l _AbsExecBase,a6
  77.              movea.l a4,a0
  78.              movea.l wd_UserPort(a0),a0  Load Window.UserPort
  79.              move.b  $f(a0),d1           Load signal bit
  80.              moveq   #1,d0
  81.              lsl.l   d1,d0
  82.              jsr     _LVOWait(a6)
  83.  
  84.              movea.l a4,a0
  85.              movea.l wd_UserPort(a0),a0  Reload Window.UserPort
  86.              jsr     _LVOGetMsg(a6)
  87.              tst.l   d0
  88.              beq.s   Reqwait       No message
  89.  
  90.              movea.l d0,a1
  91.              move.l  $14(a1),d7       Message in a7
  92.              jsr     _LVOReplyMsg(a6) Always reply
  93.  
  94.              movea.l a5,a6
  95.              lea     Request1(pc),a0
  96.              movea.l a4,a1
  97.              jsr     _LVOEndRequest(a6)
  98.  
  99.              lea     Buffer(pc),a0
  100.              jsr     RealIn
  101.  
  102. exit         movem.l d0-d1,-(a7)
  103.              movea.l a5,a6           close window
  104.              move.l  window(pc),d0
  105.              beq.s   noWin
  106.              movea.l d0,a0
  107.              jsr     _LVOCloseWindow(a6)
  108.  
  109. noWin        movea.l _AbsExecBase,a6
  110.              tst.l   d4
  111.              beq.s   NoInt
  112.              movea.l d4,a1        Close intuition lib
  113.              jsr     _LVOCloseLibrary(a6)
  114.  
  115. NoInt        movem.l (a7)+,d0-d1
  116.              movem.l (a7)+,d2-d7/a3-a6
  117.              rts
  118.  
  119. window       ds.l 1
  120. Buffer       ds.b 80
  121.  
  122. IntName      dc.b 'intuition.library',0
  123.              even
  124.  
  125. ***** Window definition *****
  126.  
  127. nw          dc.w 100,100     Position left,top
  128.             dc.w 200,100     Size width,height
  129.             dc.b 0,1         Colors detail-,block pen
  130.             dc.l $344        IDCMP-Flags
  131.             dc.l $140f       Window flags
  132.             dc.l 0           ^Gadget
  133.             dc.l 0           ^Menu check
  134. title       dc.l 0           ^Window name
  135. nws         dc.l 0           ^Screen structure,
  136.             dc.l 0           ^BitMap
  137.             dc.w 100         MinWidth
  138.             dc.w 40          MinHeight
  139.             dc.w -1          MaxWidth
  140.             dc.w -1          MaxHeight
  141. stype       dc.w 1           Screen type
  142.  
  143. *** Requester definition ***
  144.  
  145. Request1      dc.l 0       Older request
  146.               dc.w 0       Left edge
  147.               dc.w 0       Top edge
  148.               dc.w 200     Width
  149.               dc.w 100     Height
  150.               dc.w 0,0     Rel -left,-top
  151.               dc.l Rgadget Gadget
  152.               dc.l 0       Requester border
  153.               dc.l Rtext   Requester text
  154.               dc.w 0       Flags
  155.               dc.b 1,0     Backplane fill pen
  156.               dc.l 0       Requester layer
  157.               dc.l 0       Image bit map
  158.               ds.l 8
  159.               ds.l 1       Points back to window structure
  160.               ds.l 8
  161.  
  162. Rtext         dc.b 0       Front pen  (blue)
  163.               dc.b 1       Back pen   (white)
  164.               dc.b 0,0     Draw mode
  165.               dc.w 10      Left edge
  166.               dc.w 10      Top edge
  167.               dc.l 0       Text font
  168. Rtxt          ds.l 1       Pointer to text
  169. next1         dc.l 0       Next text
  170.  
  171. Rgadget       dc.l 0        +0 Next gadget
  172.               dc.w 10       +4 Left edge
  173.               dc.w -50      +6 Top edge
  174.               dc.w 150      +8 Width
  175.               dc.w 14       +A Height
  176.               dc.w 8        +C Flags
  177.               dc.w 1        +E Activation
  178.               dc.w 4        +10 Gadget type
  179.               dc.l 0        +12 Rendered as border or image
  180.               dc.l 0        +16 Select render
  181.               dc.l 0        +1A ^Gadget text
  182.               dc.l 0        +1E Mutual exclude
  183.               dc.l strinfo  +22 Special info
  184.               dc.w 1        +26 Gadget ID
  185.                             ;+28 User data
  186.  
  187. strinfo       dc.l Buffer  text buffer
  188.               dc.l 0       undo buffer
  189. pos           dc.w 0       cursor position
  190.               dc.w 33      max no of char
  191.               dc.w 0       pos of first char
  192.               dc.w 0,0,0,0,0  intuition variables
  193.               dc.l 0       RastPort of gadget
  194.               dc.l 0       longint value
  195.               dc.l 0       altkeymap
  196.               end
  197.  
  198.