home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / system / speedramsey / speedramsey.asm < prev    next >
Assembly Source File  |  1995-02-27  |  4KB  |  171 lines

  1. *** SpeedRamsey.asm - A fifteen minutes hack - © 1993 Holger Lubitz
  2. ***
  3. ***                   Started  Thursday 12-Aug-93 20:24:02 CES
  4. *** Version 1.0       Finished Thursday 12-Aug-93 20:36:21 CES
  5. *** Version 1.1          Finished Friday   13-Aug-93 10:16:53 CES
  6. *** Version 1.2       Finished Monday   16-Aug-93 23:14:10 CES
  7. ***
  8. *** Sets the skip mode bit in the Rev G Ramsey
  9. ***
  10. *** Done due to popular demand on comp.sys.amiga.hardware
  11. *** Use with care! This may crash your Amiga if your RAM is too slow.
  12. *** (60 ns or faster required)
  13. ***
  14. *** Messages were now put in, even though I didn't really have time for this
  15. *** There goes another valuable half of an hour :)
  16. ***
  17. *** Contact me at hal@caty.north.de if you have got comments on this
  18. *** or if you have improved it
  19. ***
  20. *** Free for non-commercial distribution, not for sale
  21.  
  22.     XREF    _LVOClose
  23.     XREF    _LVOCloseLibrary
  24.     XREF    _LVODelay
  25.     XREF    _LVOForbid
  26.     XREF    _LVOGetMsg
  27.     XREF    _LVOOldOpenLibrary
  28.     XREF    _LVOOpen
  29.     XREF    _LVOOutput
  30.     XREF    _LVOReplyMsg
  31.     XREF    _LVOSupervisor
  32.     XREF    _LVOWaitPort
  33.     XREF    _LVOWrite
  34.  
  35. _AbsExecBase    = 4
  36. ThisTask    = 276
  37. pr_CLI        = $ac
  38. pr_MsgPort    = $5c
  39. MODE_OLDFILE    = 1005
  40.  
  41.    SECTION "",CODE
  42.  
  43.     move.l    _AbsExecBase,a6 ; get Exec
  44.     move.l    ThisTask(a6),a5 ; FindTask(0)
  45.  
  46. *** Since we now have error messages, we need the DOS-Base, too
  47.  
  48.         lea    dosname(pc),a1    ; Pointer to 'dos.library'
  49.         jsr    _LVOOldOpenLibrary(a6) ; Version doesn't matter
  50.     move.l    d0,a4        ; store in a4
  51.  
  52. *** Have we been started from Workbench or Shell ?
  53.  
  54.     tst.l    pr_CLI(a5)    ; Shell ?
  55.     beq.s    WB        ; if not, go to WB startup
  56.  
  57. *** CLI-Startup
  58.     
  59.     exg    a4,a6        ; get DOS-Base
  60.     jsr    _LVOOutput(a6)  ; get Filehandle of Window
  61.     bra.s    main        ; to main program
  62.  
  63. *** WB-Startup
  64.  
  65. WB:    lea.l    pr_MsgPort(a5),a0 ; wait for
  66.     jsr    _LVOWaitPort(a6) ; WB-Message
  67.     jsr    _LVOGetMsg(a6)    ; there it is, get it
  68.     move.l    d0,-(a7)    ; save pointer to msg
  69.     lea    fenster(pc),a0  ; window title
  70.     move.l    a0,d1        ; to d1
  71.     move.l    #MODE_OLDFILE,d2 ; CON: should exist
  72.     exg    a4,a6        ; we need dos now
  73.     jsr    _LVOOpen(a6)    ; open window
  74.     tst.l    d0        ; check if it worked
  75.     beq.s    wbexit        ; we can't proceed if not
  76.  
  77. main:    
  78.     move.l    d0,d6        ; save handle in d6
  79.     lea    text0(pc),a0    ; init text
  80.     move.l    a0,d2
  81.     moveq    #text0e-text0,d3
  82.     bsr.s    write
  83.  
  84.     lea    $de0003,a0    ; ramsey configuration register
  85.     move.l    a5,-(a7)    ; save a5
  86.     lea    ramsey(pc),a5   ; start of our ramsey routine
  87.     exg    a4,a6        ; exec again
  88.     jsr    _LVOSupervisor(a6) ; to be done in Supervisor mode
  89.     exg    a4,a6        ; dos again
  90.     cmp.b    #5,d5        ; return code 5 ? 
  91.     blt.s    settext        ; load settext
  92.     beq.s    resettext    ; load resettext
  93. errtxt:    lea    text3(pc),a0    ; load errtext
  94.     move.l    a0,d2
  95.     moveq    #text3e-text3,d3
  96. wrtext:    bsr.s    write
  97.  
  98. cleanup
  99.     move.l    (a7)+,a5    ; restore a5
  100.     tst.l    pr_CLI(a5)    ; was it the CLI
  101.     bne.s    closedos1    ; quit
  102.  
  103.     moveq    #127,d1        ; 127/50 seconds
  104.     jsr    _LVODelay(a6)    ; wait
  105.     move.l    d6,d1        ; window
  106.     jsr    _LVOClose(a6)     ; close
  107. wbexit:
  108.     bsr.s    closedos2    ; close dos-lib
  109.     jsr    _LVOForbid(a6)    ; don't let WB kick us out early
  110.     move.l    (a7)+,a1    ; saved msg to a1
  111.     jmp    _LVOReplyMsg(a6) ; and finally answer
  112.  
  113. closedos1
  114.     move.l    d5,d0        ; copy returncode (from CLI only)
  115. closedos2
  116.     move.l    a6,a1                   ; Dos-Base to A1
  117.     move.l  a4,a6            ; Exec-Base to A6
  118.     jmp    _LVOCloseLibrary(a6)    ; close it
  119.  
  120. write
  121.     move.l    d6,d1
  122.     jmp    _LVOWrite(a6)   
  123.  
  124. settext
  125.     lea    text1(pc),a0
  126.     move.l    a0,d2
  127.     moveq    #text1e-text1,d3
  128.     bra.s    wrtext
  129.  
  130. resettext
  131.     lea    text2(pc),a0
  132.     move.l    a0,d2
  133.     moveq    #text2e-text2,d3
  134.     bra.s    wrtext
  135.  
  136. ramsey:    moveq    #$0F,d5        ; Version G of Ramsey
  137.     cmp.b   $40(a0),d5    ; check for it (version reg @ $DE0043)
  138.     bne.s    exit        ; because this is only possible with Rev G
  139.     moveq    #0,d5        ; clear error code
  140.     btst    #4,(a0)     ; test the fast mode bit
  141.     beq.s    chg        ; if it's 0, then just set it
  142.     moveq    #5,d5        ; else set warn code and
  143. chg:    bchg    #4,(a0)        ; change it
  144. exit:    rte            ; return from Supervisor mode
  145.  
  146. *** This is the text section
  147.  
  148. dosname
  149.    dc.b     "dos.library",0
  150. fenster
  151.    dc.b     "CON:0/0/320/80/SpeedRamsey",0
  152.  
  153.     dc.b    "$VER: "
  154. text0
  155.     dc.b    "SpeedRamsey 1.2a",10,"by Holger Lubitz <hal@caty.north.de>",10,"Rev G Ramsey "
  156. text0e
  157.  
  158. text1
  159.     dc.b    "set to skip mode.",10
  160. text1e
  161.     
  162. text2
  163.     dc.b    "set to normal mode.",10
  164. text2e
  165.  
  166. text3
  167.     dc.b    "not found.",10
  168. text3e
  169.  
  170.     END
  171.