home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / develop / beermon / installbus.s < prev    next >
Text File  |  1995-02-27  |  3KB  |  186 lines

  1. ; This bootblock installer is no virus...
  2. ; it is designed to patch the buserror vector while booting
  3. ; if you have the magic button and beermon is located on module
  4. ; or at $c00000, this is a good deal.
  5.  
  6. FindResident    = -96
  7. AllocMem        =-198
  8. FreeMem         =-210
  9. FindTask        =-294
  10. OldOpenLibrary  =-408
  11. CloseLibrary    =-414
  12. OpenDevice      =-444
  13. CloseDevice     =-450
  14. DoIO            =-456
  15.  
  16. Write           = -48
  17. Output          = -60
  18.  
  19. run:    move.l 4.w,a6
  20.     sub.l a4,a4        ;pointer to memory buffer
  21.     lea DiskIOReq(pc),a3
  22.     moveq #0,d6        ;errorflag
  23.     move.l a7,d5
  24.     moveq #1,d4        ;disk open flag 0=ok
  25.  
  26.     moveq #0,d0
  27.     lea dosname(pc),a1
  28.     jsr OldOpenLibrary(a6)
  29.     move.l d0,a5
  30.     tst.l d0
  31.     beq.l error
  32.     move.l #$10003,d1
  33.     move.l #1024,d0        ;2 blocks: 2*512 byte
  34.     jsr AllocMem(a6)
  35.     tst.l d0
  36.     beq.s shit
  37.     move.l d0,a4
  38.  
  39.     moveq #0,d2        ;chksum
  40.     moveq #bootsize/4-1,d0
  41.     move.l a4,a1        ;the sick buffer
  42.     lea bootstart(pc),a0
  43. l0:    move.l (a0)+,d1
  44.     move.l d1,(a1)+        ;move the gore
  45.     add.l d1,d2        ;calc a bit
  46.     bcc.s l1        ;no jesus here
  47.     addq.l #1,d2
  48. l1:    dbf d0,l0
  49.  
  50.     not.l d2
  51.     move.l d2,4(a4)        ;chksum to buf
  52.     sub.l a1,a1        ;trackdiskport init
  53.     jsr FindTask(a6)
  54.     lea DiskPort(pc),a0
  55.     move.l d0,16(a0)
  56.  
  57.     moveq #device,d0    ;trackdiskdevice (df1)
  58.     moveq #0,d1
  59.     move.l a3,a1
  60.     lea diskname(pc),a0
  61.     jsr OpenDevice(a6)
  62.     move.l d0,d4        ;some error
  63.     bne.s shit
  64.  
  65.     move.l a3,a1
  66.     move.l a4,40(a1)    ;diskbuf
  67.     jsr DoIO(a6)
  68.     tst.l d0
  69.     bne.s shit
  70.  
  71.     move.l a3,a1
  72.     move.w #4,28(a1)    ;write the gore
  73.     jsr DoIO(a6)
  74.     tst.l d0
  75.     bne.s shit
  76.  
  77.     move.l a3,a1
  78.     move.w #9,28(a1)    ;motor off
  79.     clr.l 36(a1)
  80.     jsr DoIO(a6)
  81.     tst.l d0
  82.     beq.s allesok
  83.  
  84. shit:    move.l d0,d6        ;sick errors?
  85.     lea fehler(pc),a0
  86.     move.l a0,a1
  87.     move.l a0,d3
  88. l2:    tst.b (a0)+
  89.     bne.s l2
  90.     sub.l d3,a0
  91.     move.l a0,d3
  92.     subq.l #1,d3        ;length
  93.     move.l a1,d2        ;text
  94.     jsr Output(a5)
  95.     move.l d0,d1        ;filehandle
  96.     jsr Write(a5)
  97.  
  98. allesok:move.l a5,a1
  99.     jsr CloseLibrary(a6)
  100.  
  101.     move.l a4,d0
  102.     beq.s l3
  103.     move.l d0,a1
  104.     move.l #1024,d0
  105.     jsr FreeMem(a6)
  106.  
  107. l3:    tst.l d4
  108.     bne.s l4
  109.     move.l a3,a1
  110.     jsr CloseDevice(a6)
  111. l4:    move.l d6,d0
  112.     move.l d5,a7
  113. error:    rts
  114.  
  115. device = 1
  116. bootstart:
  117.     dc.b "DOS",0
  118.     dc.l 0            ;chksum
  119.     dc.l 880        ;root block
  120.  
  121.     lea $f00000,a1
  122.     cmp.w #$1111,(a1)+    ;any module with beermon?
  123.     beq.s modf0
  124.     lea $c00000,a1        ;if not, he shall be here...
  125. modf0:    move.l a1,$8.w
  126.     
  127.     lea $dff180,a1
  128.     moveq #-1,d0
  129. blink:    move.w d0,(a1)        ;blinkabit
  130.     dbf d0,blink
  131.     clr.w (a1)
  132.  
  133.     lea dosname(pc),a1    ;the reek of putrefaction
  134.     jsr FindResident(a6)    ;any dos at home?
  135.     tst.l d0
  136.     beq.s lb
  137.     move.l d0,a0
  138.     move.l 22(a0),a0
  139.     moveq #0,d0
  140. la:    rts
  141. lb:    moveq #-1,d0
  142.     bra.s la
  143.  
  144. DosName:dc.b "dos.library",0
  145.     dc.b "this bootblock has been installed with  "
  146.     dc.b "vomit and gore by BeerMacht "
  147.     dc.w 0
  148. bootend:
  149. bootsize = bootend-bootstart
  150.  
  151. diskname:    dc.b "trackdisk.device",0
  152. fehler:        dc.b "Disk in DF1: was NOT installed",$A,0
  153. even
  154.  
  155. DiskPort:    dc.l 0        ;0
  156.         dc.l 0        ;4
  157.         dc.w $0400    ;8
  158.         dc.l 0        ;10
  159.         dc.b 0        ;14
  160.         dc.b 31        ;15
  161.         dc.l 0        ;16    task ptr.
  162. LH1:        dc.l LH2    ;20
  163. LH2:        dc.l 0        ;24
  164.         dc.l LH1    ;28
  165.         dc.b 0        ;32
  166.         dc.b 0        ;33
  167.  
  168. DiskIOReq:    dc.l 0        ;0
  169.         dc.l 0        ;4
  170.         dc.b 5        ;8
  171.         dc.b 0        ;9
  172.         dc.l 0        ;10
  173.         dc.l DiskPort    ;14
  174.         dc.w 48        ;18
  175.         dc.l 0        ;20
  176.         dc.l 0        ;24
  177.         dc.w 3        ;28 IO_CMD
  178.         dc.w 0        ;30
  179.         dc.l 0        ;32
  180.         dc.l 1024    ;36 IO_LENGTH
  181.         dc.l 0        ;40 IO_DATA
  182.         dc.l 0        ;44 IO_OFFSET
  183.         dc.l 0
  184.         dc.l 0
  185.  
  186.