Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;
  2. ;    Ok, this is the sceleton that MENUET 0.01 understands.
  3. ;    Do not change the header bits for now. Compile with nasm.
  4. ;
  5.  
  6. include 'lang.inc'
  7. include 'macros.inc'
  8.  
  9. use32
  10.  
  11.     org   0x0
  12.     db    'MENUET00'     ; 8 byte id
  13.     dd    38             ; required os
  14.     dd    START          ; program start
  15.     dd    I_END          ; program image size
  16.     dd    0x1000         ; reguired amount of memory
  17.     dd    0x1000
  18.     dd    0x00000000     ; reserved=no extended header
  19.  
  20.  
  21.  
  22. START:
  23.  
  24.     call  draw_window
  25.  
  26. still:
  27.  
  28.     mov       eax,10                 ; redraw ?
  29.     int       0x40
  30.  
  31.     cmp    eax,1
  32.     jz     red
  33.     cmp    eax,3
  34.     jz     button
  35.     jmp    still
  36.  
  37.   red:
  38.     call   draw_window
  39.     jmp    still
  40.  
  41.   button:
  42.     mov  eax,17
  43.     int  0x40
  44.  
  45.     cmp  al,byte 0
  46.     jnz  still
  47.  
  48.     cmp  ah,1
  49.     jnz  noexit
  50.  
  51.     mov  eax,0xffffffff
  52.     int  0x40
  53.  
  54.   noexit:
  55.  
  56.     cmp  ah,2
  57.     jz   note1
  58.  
  59.     mov  eax,20   ; reset midi device
  60.     mov  ebx,1
  61.     mov  ecx,0
  62.     int  0x40
  63.  
  64.     cmp  eax,0
  65.     jz   noe1
  66.  
  67.     call printerror
  68.  
  69.   noe1:
  70.  
  71.     jmp  still
  72.  
  73.   note1:
  74.  
  75.     mov  eax,50
  76.  
  77.   nn:
  78.  
  79.     mov  ebx,100
  80.     call noteout
  81.     pusha
  82.     mov  eax,5
  83.     mov  ebx,8
  84.     int  0x40
  85.     popa
  86.     mov  ebx,0
  87. ;    call noteout
  88.  
  89.     add  eax,3
  90.  
  91.     mov  ebx,100
  92.     call noteout
  93.     pusha
  94.     mov  eax,5
  95.     mov  ebx,8
  96.     int  0x40
  97.     popa
  98.     mov  ebx,0
  99. ;    call noteout
  100.  
  101.     add  eax,4
  102.  
  103.     inc  eax
  104.     cmp  eax,90
  105.     jbe  nn
  106.  
  107.     jmp  still
  108.  
  109.  
  110. draw_window:
  111.  
  112.     pusha
  113.  
  114.     mov       eax,12                    ; tell os about redraw
  115.     mov       ebx,1
  116.     int       0x40
  117.  
  118.     mov       eax,0                     ; define and draw window
  119.     mov       ebx,20*65536+250
  120.     mov       ecx,20*65536+120
  121.     mov       edx,0x02ffffff
  122.     mov       esi,0x805070d0;88ccee
  123.     mov       edi,0x005070d0;88ccee
  124.     int       0x40
  125.  
  126.                                         ; CLOSE BUTTON
  127.      mov       eax,8                     ; function 8 : define and draw
  128.      mov       ebx,(250-19)*65536+12     ; [x start] *65536 + [x size]
  129.     mov       ecx,5*65536+12            ; [y start] *65536 + [y size]
  130.     mov       edx,1                     ; button id
  131.     mov       esi,0x5577cc              ; button color RRGGBB
  132.     int       0x40
  133.  
  134.  
  135.     mov       eax,4                     ; 4 = write text
  136.     mov       ebx,8*65536+8
  137.     mov       ecx,dword 0x00ffffff      ; 8b window nro - RR GG BB color
  138.     mov       edx,labelt                ; pointer to text beginning
  139.     mov       esi,labellen-labelt       ; text length
  140.     int       0x40
  141.  
  142.     mov       eax,8
  143.     mov       ebx,10*65536+200          ; button start x & size
  144.     mov       ecx,40 *65536+17          ; button start y & size
  145.     mov       edx,2                     ; button number
  146.     mov       esi,0x4060b0              ; button color
  147.     int       0x40
  148.  
  149.     mov       eax,8
  150.     mov       ebx,10*65536+200          ; button start x & size
  151.     mov       ecx,60 *65536+17          ; button start y & size
  152.     mov       edx,3                     ; button number
  153.     mov       esi,0x4060b0              ; button color
  154.     int       0x40
  155.  
  156.     mov       eax,dword 4
  157.     mov       ebx,25*65536+45
  158.     mov       ecx,dword 0xffffff
  159.     mov       edx,buttont
  160.     mov       esi,buttontlen-buttont
  161.     int       0x40
  162.  
  163.     mov       eax,dword 4
  164.     mov       ebx,25*65536+65
  165.     mov       ecx,dword 0xffffff
  166.     mov       edx,buttont2
  167.     mov       esi,buttontlen2-buttont2
  168.     int       0x40
  169.  
  170.     mov       eax,12                    ; tell os about redraw end
  171.     mov       ebx,2
  172.     int       0x40
  173.  
  174.     popa
  175.     ret
  176.  
  177.  
  178. noteout:
  179.  
  180.     pusha
  181.  
  182.     push ebx
  183.     push eax
  184.  
  185.     mov  eax,20
  186.     mov  ebx,2
  187.     mov  ecx,0x9f
  188.     int  0x40
  189.     mov  eax,20
  190.     mov  ebx,2
  191.     pop  ecx
  192.     int  0x40
  193.     mov  eax,20
  194.     mov  ebx,2
  195.     pop  ecx
  196.     int  0x40
  197.  
  198.     cmp  eax,0
  199.     jz   noe2
  200.  
  201.     call printerror
  202.  
  203.   noe2:
  204.  
  205.     popa
  206.     ret
  207.  
  208. printerror:
  209.  
  210.     mov       eax,dword 4
  211.     mov       ebx,15*65536+85
  212.      mov       ecx,0x000000
  213.      mov       edx,error1
  214.     mov       esi,errorlen1-error1
  215.     int       0x40
  216.  
  217.     mov       eax,dword 4
  218.     mov       ebx,15*65536+95
  219.      mov       ecx,0x000000
  220.      mov       edx,error2
  221.     mov       esi,errorlen2-error2
  222.     int       0x40
  223.  
  224.     ret
  225.  
  226.  
  227. ; DATA AREA
  228.  
  229.  
  230. labelt:
  231.     db   'MIDI TEST'
  232. labellen:
  233.  
  234. buttont:
  235.     db   'PLAY A FEW NOTES'
  236. buttontlen:
  237. buttont2:
  238.     db   'RESET MIDI DEVICE'
  239. buttontlen2:
  240.  
  241. error1:
  242.     db   'NO BASE DEFINED FOR MPU-401'
  243. errorlen1:
  244.  
  245. error2:
  246.     db   'USE SETUP AND RESET MIDI DEVICE.'
  247. errorlen2:
  248.  
  249. base db 0x0
  250.  
  251.  
  252. I_END:
  253.  
  254.  
  255.  
  256.