home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / ZAURUS / PILIAPPS / MESS.ASM < prev    next >
Assembly Source File  |  1997-02-07  |  4KB  |  176 lines

  1. ;
  2. ; MESS DEMO
  3. ; Copyright (C) 1996 Model Systems
  4. ; All rights reserved
  5. ;
  6. ; H I S T O R Y
  7. ; =============
  8. ; 16/11/96 Initial coding (V1.00).
  9. ;
  10. ; ======================================================================
  11. ;
  12. pili_header:
  13.     JR      Start              ; jump to start of prog
  14.     DL pili_bottom-pili_header ; /* size of binary image */
  15.     DB "PILI BINARY MAIN "     ; header for beta, main application
  16.     DB 0                       ; null terminate
  17.  
  18.  include fncall.inc
  19.  
  20. ;-----------------------------------------------------------------------------
  21. ;
  22. ; PROGRAM START
  23. ;
  24.  
  25. Start:
  26.     FNCALL      clearscreen,0           ; Clear the screen
  27.     FNCALL16    InfoBox,welcome,sto0    ; Display an intro box
  28.     FNCALL08    EventRead, 0, a         ; Clear any events
  29.  
  30. ; Init starting position
  31.     RLD32       sto0,8                  ; X coord of one end of the line
  32.     RLD32       sto1,6                  ; Y coord of one end of the line
  33.     RLD32       sto2,66                 ; X coord of the other end
  34.     RLD32       sto3,12                 ; X coord of the other end
  35.     RLD32       sto4,GP_SOLID_LINE      ; Draw solid lines
  36.  
  37. ; Init starting directions
  38.     RLD32       sto5,2                  ; X direction of one end of the line
  39.     RLD32       sto6,2                  ; Y direction of one end of the line
  40.     RLD32       sto7,-2                 ; X direction of the other end
  41.     RLD32       sto8,-2                 ; Y direction of the other end
  42.  
  43. Draw:
  44. ; Move the line ends
  45.     ADD32       sto0,sto5
  46.     ADD32       sto1,sto6
  47.     ADD32       sto2,sto7
  48.     ADD32       sto3,sto8
  49.     FNCALL08    LineDraw, sto0, GP_SET  ; Draw the line
  50.     RLD08       a, 5
  51.     RGMOVE      20h, sto0, a
  52.     INC         20h
  53.     INC         22h
  54.     FNCALL08    LineDraw, 20h, GP_SET  ; Draw another line
  55.  
  56. ; Remember coords
  57.     RLD08       a, 5
  58.     RGMOVE      20h, sto0, a
  59.  
  60. ; Check for hitting the edges of the screen
  61. comp1:
  62.     CMP         sto0,320
  63.     JPNZ        comp2
  64.     RLD32       sto5,-2
  65.     CALL        RBounce
  66.     RMV32       sto6, a
  67.  
  68. comp2:
  69.     CMP         sto1,240
  70.     JPNZ        comp3
  71.     RLD32       sto6,-2
  72.     CALL        RBounce
  73.     RMV32       sto5, a
  74.  
  75. comp3:
  76.     CMP         sto2,320
  77.     JPNZ        comp4
  78.     RLD32       sto7,-2
  79.     CALL        RBounce
  80.     RMV32       sto8, a
  81.  
  82. comp4:
  83.     CMP         sto3,240
  84.     JPNZ        comp5
  85.     RLD32       sto8,-2
  86.     CALL        RBounce
  87.     RMV32       sto7, a
  88.  
  89. comp5:
  90.     CMP         sto0,0
  91.     JPNZ        comp6
  92.     RLD32       sto5,2
  93.     CALL        RBounce
  94.     RMV32       sto6, a
  95.  
  96. comp6:
  97.     CMP         sto1,0
  98.     JPNZ        comp7
  99.     RLD32       sto6,2
  100.     CALL        RBounce
  101.     RMV32       sto5, a
  102.  
  103. comp7:
  104.     CMP         sto2,0
  105.     JPNZ        comp8
  106.     RLD32       sto7,2
  107.     CALL        RBounce
  108.     RMV32       sto8, a
  109.  
  110. comp8:
  111.     CMP         sto3,0
  112.     JPNZ        comp9
  113.     RLD32       sto8,2
  114.     CALL        RBounce
  115.     RMV32       sto7, a
  116.  
  117. comp9:
  118.     FNCALL08    LineDraw, 20h ,GP_XOR   ; Rub the line out
  119.     INC         20h
  120.     INC         22h
  121.     FNCALL08    LineDraw, 20h, GP_XOR   ; Rub out the other line
  122.  
  123.     FNCALL08    EventRead, 0, a         ; Check for key press
  124.     CMP08       a, 4                    ; Anything?
  125.     JPNZ        draw                    ; Go back and start again
  126.     EXIT
  127.  
  128. ;=======================================================================
  129. ;
  130. ; S U B R O U T I N E S
  131.  
  132. ; Randomly choose a direction to bounce the line
  133. RBounce:
  134.     FNCALL      GetRandom, 0, a         ; 16-bit random number in a
  135.     CMP         a, 7FFFh
  136.     JPC         Pos
  137.  
  138. Neg:
  139.     RLD32       a, -2
  140.     RLD08       b, 1
  141.     FNCALL      PlaySound, b
  142.     JP          RBExit
  143.  
  144. Pos:
  145.     RLD32       a, 2
  146.     RLD08       b, 0
  147.     FNCALL      PlaySound, b
  148.  
  149. RBExit:
  150.     RET
  151.  
  152. ;=======================================================================
  153. ;
  154. ; D A T A
  155. ;
  156. welcome:
  157.      DB 1
  158.      DB "               -= MESS DEMO =-"
  159.      DB 0Dh
  160.      DB "Written by Murray Moffatt (100240,1477)"
  161.      DB 0Dh
  162.      DB "This is just a little demo that makes a"
  163.      DB 0Dh
  164.      DB "mess of your screen (looks pretty though!)"
  165.      DB 0Dh
  166.      DB "Press any key to exit the demo."
  167.      DB 0Dh
  168.      $DATE_TIME
  169.  
  170. ;-------------------------------------------------------------------------
  171.  
  172. pili_bottom: ; NEED TO BE THERE FOR HEADER
  173.  
  174.     END
  175.