home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / texts / boxes / jb_test.a49 < prev    next >
Text File  |  1993-06-05  |  1KB  |  58 lines

  1.  
  2. ;BEGIN OF PAGE $000
  3.  
  4. ;Resetroutine:
  5.     nop            ;    lo
  6.     nop            ;    hi-pointer to reset ($000)
  7.     nop            ;    lo
  8.     nop            ;    hi-pointer to nmi ($000)
  9.     nop
  10.     nop
  11.     nop
  12.     nop
  13.     nop
  14.  
  15. init:    sel    rb0        ; use old register
  16.     orl    p1,=%11111111    ; %11111111 all bits for output
  17.     orl    p2,=%11111111    ; %11111111 all bits for output
  18.  
  19. selftest:
  20.     clr    a
  21.     mov    r3,a
  22.     outl    p1,a
  23. testloop:
  24.     outl    p2,a        ;set tone
  25.     mov    r1,a        ;keep it
  26.     mov    a,=250        ;0.5 sec delay
  27.     call    wait    
  28.     mov    a,r1        ;get it back
  29.     add    a,=%00010000    ;next sample
  30.     mov    r1,a        ;keep it
  31.     call    silence        ;sound off
  32.     mov    a,=30    
  33.     call    wait        ;pause 60ms
  34.     mov    a,r3
  35.     outl    p1,a
  36.     mov    a,r1
  37.     jmp    testloop    ;loop
  38.  
  39. silence:mov    A,=%11111111
  40.     outl    p1,A
  41.     mov    A,=$f0
  42.     outl    p2,A
  43.     ret
  44.  
  45.  
  46. wait:    mov    r2,=166        ; set loop of 5+166*8 cycles
  47. wait1:    nop            ; delay 1 cycle
  48.     nop            ; delay 1 cycle
  49.     nop            ; delay 1 cycle
  50.     nop            ; delay 1 cycle
  51.     nop            ; delay 1 cycle
  52.     nop            ; delay 1 cycle
  53.     djnz    r2,wait1    ; delay 2 cycles
  54.     dec    a        ; after 1 #s, if a>0
  55.     jnz    wait        ; goto wait again
  56.     ret            ; end of wait
  57.  
  58.