home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 4: Demo 1 / almathera_demo1.bin / commercial / asmonedemo / asm-one / examples / bootblock.s < prev    next >
Text File  |  1995-03-16  |  6KB  |  295 lines

  1. ;************************************************
  2. ;*     Non-system virus check bootblock    *
  3. ;*    An example of how to make Boot Blocks    *
  4. ;*                        *
  5. ;*   ASM-One example coded by Rune Gram-Madsen    *
  6. ;*                        *
  7. ;*   All rights reserved. Copyright (c) 1990    *
  8. ;************************************************
  9.  
  10. WriteFlag = 0    ; 1 to write bootblock
  11.  
  12. ;*****************
  13. ;*   Constants   *
  14. ;*****************
  15.  
  16.     IF    WriteFlag=1
  17.     AUTO    WS\BEGIN\0\2\CC\
  18.     ENDC
  19.  
  20. DMASET=        %1000000110000000
  21. ;         -----a-bcdefghij
  22.  
  23. ;        a: Blitter Nasty
  24. ;        b: Bitplane DMA (if this isn't set sprites disapear!)
  25. ;        c: Copper DMA
  26. ;        d: Blitter DMA
  27. ;        e: Sprite DMA
  28. ;        f: Disk DMA
  29. ;          g-j: Audio 3-0 DMA
  30.  
  31. OpenLibrary=    -408
  32. CloseLibrary=    -414
  33. OpenFont=    -72
  34. AllocRaster=    -492
  35. FreeRaster=    -498
  36.  
  37.     SECTION    FIRST,CODE_C
  38.  
  39. START    MOVE.W    #$4E75,EndAddr    ; Put RTS into code
  40.     BRA.B    GO
  41.  
  42. ;*******  Boot block  *******
  43.  
  44. BEGIN    DC.B    'DOS',0
  45.     DC.L    0
  46.     DC.L    880
  47.  
  48. ; A5 / FONTPTR
  49. ; D7 / MODULU
  50.  
  51.     RSRESET
  52.  
  53. OldCopper    RS.L    1
  54. ScreenPtr    RS.L    1
  55.  
  56. GO:    MOVEM.L    D0-D7/A0-A6,-(A7)
  57.     LEA.L    START(PC),A4
  58.     MOVE.L    $4.W,A6
  59.     LEA.L    GRAPNAME(PC),A1        ; Gfx Name
  60.     MOVEQ    #0,D0
  61.     JSR    OPENLIBRARY(A6)
  62.     MOVE.L    D0,A6            ; Gfx Base
  63.     MOVE.L    $26(A6),OldCopper(A4)    ; Get old Copper Ptr.
  64.  
  65. ;---  Get charset  ---
  66.  
  67.     LEA    TEXTATTR(PC),A0
  68.     LEA    FONTNAME(PC),A1
  69.     MOVE.L    A1,(A0)
  70.     JSR    OPENFONT(A6)
  71.     MOVE.L    D0,A0
  72.     MOVE.L    34(A0),A5        ; Bit ptr
  73.     MOVE.W    38(A0),D7        ; Modulo
  74.  
  75. ;---  Allocate Raster  ---
  76.  
  77.     MOVE.W    #320,D0            ; Width
  78.     MOVE.W    #260,D1            ; Higth
  79.     JSR    AllocRaster(A6)
  80.     MOVE.L    D0,ScreenPtr(A4)
  81.  
  82. ;--- Clear screen  ---
  83.  
  84.     MOVE.L    D0,A0
  85.     MOVE.W    #320/8*260/4-1,D1    ; Clear 320/8 bytes wide
  86.     MOVEQ    #0,D2            ; times 260 bytes high
  87. .LOOPC    MOVE.L    D2,(A0)+        ; in longwords / 4
  88.     DBF    D1,.LOOPC
  89.  
  90. ;---  Set BPL ptrs  ---
  91.  
  92.     LEA.L    BITPLANES+2(PC),A0
  93.     MOVEQ    #40,D1
  94.     ADD.L    D0,D1
  95.     SWAP    D0        ; High word of pointer
  96.     MOVE.W    D0,(A0)        ; Store high 1
  97.     ADDQ.W    #4,A0
  98.     SWAP    D0        ; Low word of pointer
  99.     MOVE.W    D0,(A0)        ; Store low 1
  100.     ADDQ.W    #4,A0
  101.     SWAP    D1        ; High word of pointer
  102.     MOVE.W    D1,(A0)        ; Store high 2
  103.     ADDQ.W    #4,A0
  104.     SWAP    D1        ; Low word of pointer
  105.     MOVE.W    D1,(A0)        ; Store low 2
  106.  
  107.     MOVE.L    A6,-(A7)    ; Store Graphics library base
  108.  
  109. ;---  Set DMA registers  ---
  110.  
  111.     MOVE.L    #$DFF000,A6
  112.     MOVE.W    $1C(A6),-(A7)        ; Store old inter data
  113.     MOVE.W    $02(A6),-(A7)        ; Store old DMA data
  114.     MOVE.L    #$7FFF7FFF,$9A(A6)    ; Disable interrupts
  115.     MOVE.W    #$7FFF,$96(A6)        ; Disable all DMA's
  116.  
  117.     LEA    COPLIST(PC),A0
  118.     MOVE.L    A0,$80(A6)        ; Copper1 start adress
  119.     MOVE.W    #DMASET!$8200,$96(A6)    ; Enable DMA's
  120.     CLR.W    $88(A6)            ; Start copper1
  121.  
  122. ; A5 = CHARSET
  123. ; D7 = CHARDIST
  124.  
  125. PRINTTEXT:
  126.     MOVE.L    ScreenPtr(A4),A1    ; Screenptr
  127.     LEA.L    TEXT(PC),A0
  128.     ADD.W    #40,A1
  129.     MOVEQ    #0,D1
  130. .LOOP0
  131.     MOVEQ    #0,D0
  132.     MOVE.B    (A0)+,D0        ; Get char
  133.     BEQ.S    .END            ; Last char ???
  134.  
  135.     CMP.B    #10,D0            ; A return char
  136.     BNE.S    .CONT
  137.     MOVEQ    #0,D1            ; first column
  138.     ADD.W    #40*8,A1        ; next line
  139.     BRA.S    .LOOP0            ; Get next char
  140.  
  141. .CONT    CMP.B    #1,D0            ; Space mark
  142.     BNE.S    .CONT2
  143.     MOVE.B    (A0)+,D0        ; Get spaces
  144.     ADD.W    D0,D1            ; Add spaces
  145.     BRA.S    .LOOP0
  146.  
  147. .CONT2    MOVE.L    A1,A2            ; a2 = screen ptr
  148.     ADD.W    D1,A2            ; a2 = screen char ptr
  149.     MOVE.L    A5,A3
  150.     SUB.W    #$20,D0
  151.     ADD.W    D0,A3            ; A3 = Char pointer
  152.  
  153.     MOVEQ    #8-1,D0            ; copy 8 bytes
  154. .LOOP1    MOVE.B    (A3),(A2)        ; Copy one byte from char
  155.     ADD.W    D7,A3            ; next byte in char
  156.     ADD.W    #40,A2            ; next raster line
  157.     DBF    D0,.LOOP1        ; Loop ^
  158.     ADDQ.W    #1,D1            ; move 1 right
  159.     BRA.S    .LOOP0            ; Loop ^^
  160.  
  161. .END    BTST    #6,$BFE001        ; Wait mouse
  162.     BNE.S    .END            ; Pressed ???
  163.  
  164. ;---  The End  ---
  165.  
  166.     MOVE.L    #$7FFF7FFF,$9A(A6)    ; Disable interrupts
  167.     OR.L    #$8000C000,(A7)        ; Set enable bits
  168.     MOVE.W    (A7)+,$96(A6)        ; Enable interruptr
  169.     MOVE.W    (A7)+,$9A(A6)        ; Restore old inter data
  170.     MOVE.L    OldCopper(A4),$80(A6)    ; Restore old copper ptr
  171.     CLR.W    $88(A6)            ; Start Copper
  172.  
  173. ;---  DeAllocate Raster  ---
  174.  
  175.     MOVE.L    (A7)+,A6
  176.     MOVE.L    ScreenPtr(A4),A0
  177.     MOVE.W    #320,D0            ; Width
  178.     MOVE.W    #260,D1            ; Higth
  179.     JSR    FreeRaster(A6)
  180.  
  181.     MOVE.L    A6,A1            ; Close graphics library
  182.     MOVE.L    $4.W,A6
  183.     JSR    CLOSELIBRARY(A6)
  184.  
  185.     MOVEM.L    (A7)+,D0-D7/A0-A6
  186.  
  187. EndAddr    MOVE.L    $0004.W,A6
  188.     LEA    DOSNAME(PC),A1
  189.     MOVE.W    #'do',(A1)
  190.     JSR    -96(A6)
  191.     MOVE.L    D0,A0
  192.     MOVE.L    22(A0),A0
  193.     MOVEQ    #0,D0
  194.     RTS
  195.  
  196. TEXTATTR:
  197.     DC.L    0
  198.     DC.W    8
  199.     DC.B    0
  200.     DC.B    0
  201.     DC.W    8
  202. FONTNAME:    DC.B    'topaz.font',0
  203. GRAPNAME:    DC.B    'graph'
  204. DOSNAME:    DC.B    'ics.library',0
  205.  
  206. ;*****************************
  207. ;*                 *
  208. ;*      COPPER1 PROGRAM      *
  209. ;*                 *
  210. ;*****************************
  211.  
  212. COPLIST:
  213.     DC.L    $0182057C
  214.     DC.L    $01840D85
  215.     DC.L    $01860FA7
  216.     DC.L    $01A20AAA
  217.     DC.L    $01A40666
  218.     DC.L    $01A60FFF
  219. BITPLANES:
  220.     DC.L    $00E00000
  221.     DC.L    $00E20000
  222.     DC.L    $00E40000
  223.     DC.L    $00E60000
  224.     DC.L    $01002200
  225.     DC.L    $01020001
  226.     DC.L    $01040000
  227.     DC.L    $01080000
  228.     DC.L    $010A0000
  229.     DC.L    $008E2C78
  230.     DC.L    $00902CC8
  231.     DC.L    $00920038
  232.     DC.L    $009400D0
  233.     DC.L    $01800000
  234.     DC.L    $3007FFFE
  235.     DC.L    $01800220
  236.     DC.L    $4007FFFE
  237.     DC.L    $01800330
  238.     DC.L    $5007FFFE
  239.     DC.L    $01800440
  240.     DC.L    $6007FFFE
  241.     DC.L    $01800550
  242.     DC.L    $7007FFFE
  243.     DC.L    $01800660
  244.     DC.L    $8007FFFE
  245.     DC.L    $01800770
  246.     DC.L    $9007FFFE
  247.     DC.L    $01800880
  248.     DC.L    $A007FFFE
  249.     DC.L    $01800990
  250.     DC.L    $B007FFFE
  251.     DC.L    $01800880
  252.     DC.L    $C007FFFE
  253.     DC.L    $01800770
  254.     DC.L    $D007FFFE
  255.     DC.L    $01800660
  256.     DC.L    $E007FFFE
  257.     DC.L    $01800550
  258.     DC.L    $F007FFFE
  259.     DC.L    $01800440
  260.     DC.L    $FFDFFFFE
  261.     DC.L    $0007FFFE
  262.     DC.L    $01800330
  263.     DC.L    $1007FFFE
  264.     DC.L    $01800220
  265.     DC.L    $2007FFFE
  266.     DC.L    $01800110
  267.     DC.L    $FFFFFFFE
  268.  
  269. TEXT:
  270.  DC.B    10
  271.  DC.B    10
  272.  DC.B    10
  273.  DC.B    10
  274.  DC.B    10
  275.  DC.B    10
  276.  DC.B    10
  277.  DC.B    1,8,'This disk was installed',10
  278.  DC.B    10
  279.  DC.B    1,15,'using the',10
  280.  DC.B    10
  281.  DC.B    1,9,'AsmOne Macro Assembler',10
  282.  DC.B    10
  283.  DC.B    10
  284.  DC.B    10
  285.  DC.B    1,2,'---  NO VIRUS ON THIS BOOTBLOCK  ---',10
  286.  DC.B    10
  287.  DC.B    10
  288.  DC.B    10
  289.  DC.B    1,8,'! Press mouse to boot !',0
  290.  
  291. END:
  292.     IF    END-BEGIN>1024
  293.     FAIL
  294.     ENDC
  295.