home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / fish / code_examples / a68kex / request.asm < prev    next >
Assembly Source File  |  1991-01-17  |  10KB  |  340 lines

  1.  
  2. ***********************
  3. *
  4. * Send up a requester and wait until clicked
  5. *
  6. * === not reentrant, not multitasking simultaneous usable ===
  7. *
  8. * This implementation was written by:
  9. * E. Lenz
  10. * Johann-Fichte-Strasse 11
  11. * 8 Munich 40
  12. * Germany
  13. *
  14. ***********************
  15.  
  16. ; INPUT
  17. ;
  18. ; a0 = pointer to requester text 1st line
  19. ; a1 = pointer to requester text 2nd line (0 = no 2nd or 3rd line)
  20. ; a2 = pointer to requester text 3rd line (0 = no 3rd line)
  21. ; a3 = pointer to requester header
  22. ; a4 = pointer to gadget 1 text
  23. ; a5 = pointer to gadget 2 text (0 = no gadget 2)
  24. ; d0 = pointer to screen
  25. ; d1 = type of screen
  26.  
  27. ; INTERNAL
  28. ;
  29. ; d5 = Error flag
  30. ; a4 = IntuitionBase
  31. ; a5 = Window
  32.  
  33. ; OUTPUT
  34. ;
  35. ; d0 = the number of the selected gadget
  36. ; 0 = error occured  1 = 1st gadget selected  2 = 2nd gadget selected
  37.  
  38.        XDEF request
  39.  
  40. ; EXEC.library routines
  41.  
  42. _AbsExecBase       equ 4
  43. _LVOWait           equ -$13e
  44. _LVOGetMsg         equ -$174
  45. _LVOReplyMsg       equ -$17a
  46. _LVOWaitPort       equ -$180
  47. _LVOCloseLibrary   equ -$19e
  48. _LVOOpenLibrary    equ -$228
  49.  
  50. ; INTUITION.library routines
  51.  
  52. _LVOCloseWindow    equ -$48
  53. _LVOEndRequest     equ -$78
  54. _LVOOpenWindow     equ -$cc
  55. _LVORequest        equ -$f0
  56. _LVOWindowToFront  equ -$138
  57.  
  58. wd_UserPort equ $56
  59.  
  60. request      move.l  d0,Wscreen
  61.              move.w  d1,Stype
  62.              move.l  a0,Rtxt    set texts
  63.              move.l  a1,d0
  64.              lea     R2text(pc),a0
  65.              move.l  d0,R2txt
  66.              bne.s   is2
  67.              movea.l d0,a0
  68. is2          move.l  a0,next1
  69.              move.l  a2,d0
  70.              lea     R3text(pc),a0
  71.              move.l  d0,R3txt
  72.              bne.s   is3
  73.              movea.l d0,a0
  74. is3          move.l  a0,next2
  75.              move.l  a3,Wdname  set header
  76.              move.l  a4,Gag1
  77.              move.l  a5,d0
  78.              lea     Rgadg2(pc),a0
  79.              move.l  d0,Gag2
  80.              bne.s   endhead
  81.              movea.l d0,a0
  82. endhead      move.l  a0,Rgadget
  83.  
  84.              suba.l  a5,a5
  85.              movea.l _AbsExecBase,a6
  86.              lea     IntuitionName(pc),a1 Open intuition.library
  87.              moveq   #0,d0
  88.              jsr     _LVOOpenLibrary(a6)
  89.              movea.l d0,a4            Save intuition base address
  90.              tst.l   d0
  91.              beq.s   gexit
  92.  
  93. ; Open window
  94.  
  95.              movea.l d0,a6         Base address = IntuitionBase
  96.              lea     NewWindow(pc),a0
  97.              jsr     _LVOOpenWindow(a6)
  98.              movea.l d0,a5         Save pointer to window structure
  99.              tst.l   d0
  100. gexit        beq.s   exit
  101.  
  102.              lea     Request1(pc),a0   Send up requester
  103.              movea.l a5,a1
  104.              jsr     _LVORequest(a6)
  105.  
  106.              movea.l _AbsExecBase,a6
  107.  
  108. Reqwait      movea.l a5,a0
  109.              jsr     _LVOWindowToFront(a6)
  110.  
  111.              movea.l a5,a0
  112.              movea.l wd_UserPort(a0),a0  Load Window.UserPort
  113.              move.b  $f(a0),d1           Load signal bit
  114.              moveq   #1,d0
  115.              lsl.l   d1,d0
  116.              jsr     _LVOWait(a6)
  117.  
  118.              movea.l a5,a0
  119.              movea.l wd_UserPort(a0),a0  Reload Window.UserPort
  120.              jsr     _LVOGetMsg(a6)
  121.              tst.l   d0
  122.              beq.s   Reqwait       No message
  123.  
  124.              movea.l d0,a1
  125.              move.l  $14(a1),d7       Message in a7
  126.              jsr     _LVOReplyMsg(a6) Always reply
  127.  
  128.              movea.l a4,a6
  129.  
  130.              lea     Request1(pc),a0
  131.              movea.l a5,a1
  132.              jsr     _LVOEndRequest(a6)
  133.  
  134.              movea.l a5,a0            get gadget id
  135.              movea.l $5e(a0),a0
  136.              movea.l $1c(a0),a0
  137.              move.w  $26(a0),d5
  138.  
  139. exit         move.l  a5,d0              Close window
  140.              beq.s   No_Wind
  141.              movea.l d0,a0
  142.              jsr     _LVOCloseWindow(a6)
  143.  
  144.  
  145. ;Close library
  146.  
  147. No_Wind      movea.l _AbsExecBase,a6
  148.              move.l  a4,d0            Close intuition lib
  149.              beq.s   No_Intui
  150.              movea.l d0,a1
  151.              jsr     _LVOCloseLibrary(a6)
  152.  
  153. No_Intui     moveq   #0,d0
  154.              move.w  d5,d0
  155.              rts
  156.  
  157. IntuitionName dc.b 'intuition.library',0
  158.               even
  159.  
  160. ***** Window definition *****
  161.  
  162. NewWindow     dc.w 0,0           Position left,top
  163.               dc.w 319,72        Size width,height
  164.               dc.b 0,1           Colors detail-,block pen
  165.               dc.l $40           IDCMP-Flags
  166.               dc.l $1407         Window flags
  167.               dc.l 0             ^Gadget
  168.               dc.l 0             ^Menu check
  169. Wdname        dc.l 0             ^Window name
  170. Wscreen       dc.l 0             ^Screen structure,
  171.               dc.l 0             ^BitMap
  172.               dc.w 88            MinWidth
  173.               dc.w 24            MinHeight
  174.               dc.w 319           MaxWidth
  175.               dc.w 72            MaxHeight
  176. Stype         dc.w 1             Screen type
  177.  
  178.  
  179. *** Requester definition ***
  180.  
  181. Request1      dc.l 0       Older request
  182.               dc.w 0       Left edge
  183.               dc.w 0       Top edge
  184.               dc.w 303     Width
  185.               dc.w 60      Height
  186.               dc.w 0,0     Rel -left,-top
  187.               dc.l Rgadget Gadget
  188.               dc.l Rborder Requester border
  189.               dc.l Rtext   Requester text
  190.               dc.w 0       Flags
  191.               dc.b 1,0     Backplane fill pen
  192.               dc.l 0       Requester layer
  193.               dc.l 0       Image bit map
  194.               ds.l 8
  195.               ds.l 1       Points back to window structure
  196.               ds.l 8
  197.  
  198. Rborder       dc.w 0       Left edge
  199.               dc.w 0       Top edge
  200.               dc.b 0,2     Front pen,back pen
  201.               dc.b 1,5     Draw mode,number of coord pairs
  202.               dc.l RPairs  Vector coordinate pairs
  203.               dc.l 0       Next border
  204.  
  205. RPairs        dc.w 2,1     Lines surrounding the requester
  206.               dc.w 293,1
  207.               dc.w 293,57
  208.               dc.w 2,57
  209.               dc.w 2,1
  210.  
  211. Rtext         dc.b 0       Front pen  (blue)
  212.               dc.b 1       Back pen   (white)
  213.               dc.b 0,0     Draw mode
  214.               dc.w 10      Left edge
  215.               dc.w 10      Top edge
  216.               dc.l 0       Text font
  217. Rtxt          ds.l 1       Pointer to text
  218. next1         dc.l 0       Next text
  219.  
  220. R2text        dc.b 0       Front pen  (blue)
  221.               dc.b 1       Back pen   (white)
  222.               dc.b 0,0     Draw mode
  223.               dc.w 10      Left edge
  224.               dc.w 20      Top edge
  225.               dc.l 0       Text font
  226. R2txt         ds.l 1       Pointer to text
  227. next2         dc.l 0       Next text
  228.  
  229. R3text        dc.b 0       Front pen  (blue)
  230.               dc.b 1       Back pen   (white)
  231.               dc.b 0,0     Draw mode
  232.               dc.w 10      Left edge
  233.               dc.w 30      Top edge
  234.               dc.l 0       Text font
  235. R3txt         dc.l 0       Pointer to text
  236.               dc.l 0       Next text
  237.  
  238. Rgadget       dc.l 0        +0 Next gadget
  239.               dc.w 10       +4 Left edge
  240.               dc.w -20      +6 Top edge
  241.               dc.w 50       +8 Width
  242.               dc.w 14       +A Height
  243.               dc.w 8        +C Flags
  244.               dc.w 1        +E Activation
  245.               dc.w 1        +10 Gadget type
  246.               dc.l Rbord1   +12 Rendered as border or image
  247.               dc.l 0        +16 Select render
  248.               dc.l Gag1txt  +1A ^Gadget text
  249.               dc.l 0        +1E Mutual exclude
  250.               dc.l 0        +22 Special info
  251.               dc.w 1        +26 Gadget ID
  252.                            ;+28 User data
  253.  
  254. Rbord1        dc.w 0       Left edge
  255.               dc.w 0       Top edge
  256.               dc.b 3,0     Front pen,back pen
  257.               dc.b 1,5     Draw mode,number of coord pairs
  258.               dc.l RPairs1 Vector coordinate pairs
  259.               dc.l Rbord2  Next border
  260.  
  261. RPairs1       dc.w 0,0     Lines which constitute the gadget
  262.               dc.w 50,0
  263.               dc.w 50,14
  264.               dc.w 0,14
  265.               dc.w 0,0
  266.  
  267. Rbord2        dc.w 0,0
  268.               dc.b 0,0
  269.               dc.b 1,5
  270.               dc.l RPairs2
  271.               dc.l 0
  272.  
  273. RPairs2       dc.w 2,2
  274.               dc.w 48,2
  275.               dc.w 48,12
  276.               dc.w 2,12
  277.               dc.w 2,2
  278.  
  279. Gag1txt       dc.b 0       Front pen  (blue)
  280.               dc.b 1       Back pen   (white)
  281.               dc.b 1,0     Draw mode
  282.               dc.w 8       Left edge
  283.               dc.w 4       Top edge
  284.               dc.l 0       Text font
  285. Gag1          dc.l 0       Pointer to text
  286.               dc.l 0       Next text
  287.  
  288.  
  289. Rgadg2        dc.l 0        +0 Next gadget
  290.               dc.w -68      +4 Left edge
  291.               dc.w -20      +6 Top edge
  292.               dc.w 50       +8 Width
  293.               dc.w 14       +A Height
  294.               dc.w $18      +C Flags
  295.               dc.w 1        +E Activation
  296.               dc.w 1        +10 Gadget type
  297.               dc.l Rbord21  +12 Rendered as border or image
  298.               dc.l 0        +16 Select render
  299.               dc.l Gag2txt  +1A ^Gadget text
  300.               dc.l 0        +1E Mutual exclude
  301.               dc.l 0        +22 Special info
  302.               dc.w 2        +26 Gadget ID
  303.                            ;+28 User data
  304.  
  305. Rbord21       dc.w 0       Left edge
  306.               dc.w 0       Top edge
  307.               dc.b 3,0     Front pen,back pen
  308.               dc.b 1,5     Draw mode,number of coord pairs
  309.               dc.l RPair21 Vector coordinate pairs
  310.               dc.l Rbord22 Next border
  311.  
  312. RPair21       dc.w 0,0     Lines which constitute the gadget
  313.               dc.w 50,0
  314.               dc.w 50,14
  315.               dc.w 0,14
  316.               dc.w 0,0
  317.  
  318. Rbord22       dc.w 0,0
  319.               dc.b 0,0
  320.               dc.b 1,5
  321.               dc.l RPair22
  322.               dc.l 0
  323.  
  324. RPair22       dc.w 2,2
  325.               dc.w 48,2
  326.               dc.w 48,12
  327.               dc.w 2,12
  328.               dc.w 2,2
  329.  
  330. Gag2txt       dc.b 0       Front pen  (blue)
  331.               dc.b 1       Back pen   (white)
  332.               dc.b 1,0     Draw mode
  333.               dc.w 8       Left edge
  334.               dc.w 4       Top edge
  335.               dc.l 0       Text font
  336. Gag2          dc.l 0       Pointer to text
  337.               dc.l 0       Next text
  338.  
  339.               end
  340.