home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / 551-575 / apd565 / jc / amos_system / _dump.s next >
Text File  |  1990-11-28  |  25KB  |  1,115 lines

  1. ;---------------------------------------------------------------------
  2. ;    **   **   **  ***   ***   ****     **    ***  **  ****
  3. ;   ****  *** *** ** ** **     ** **   ****  **    ** **  **
  4. ;  **  ** ** * ** ** **  ***   *****  **  **  ***  ** **
  5. ;  ****** **   ** ** **    **  **  ** ******    ** ** **
  6. ;  **  ** **   ** ** ** *  **  **  ** **  ** *  ** ** **  **
  7. ;  **  ** **   **  ***   ***   *****  **  **  ***  **  ****
  8. ;---------------------------------------------------------------------
  9. ; AMOS Screen dump extension, V1.1
  10. ; By Alex J.Grant & F.Lionet
  11. ; AMOS and AMOS Compiler (c) Europress Software 1991
  12. ; To be used with AMOS1.3 and over
  13. ;--------------------------------------------------------------------- 
  14. ; This file is public domain
  15. ;---------------------------------------------------------------------
  16. ; Please refer to the _Music.s file for more informations
  17. ;---------------------------------------------------------------------
  18. ; Trackdisk.device commands added by Alex J Grant
  19. ;---------------------------------------------------------------------
  20. *
  21. ExtNb        equ    20-1
  22. TRUE        equ    -1
  23. FALSE        equ    0
  24. AllocSignal    equ    -$014a
  25. FreeSignal    equ    -$0150
  26. *
  27.         INCDIR    "dh1:amos_system/amos_include_files/"
  28.         Include    "_Equ.s"
  29.         RsSet    DataLong
  30.         Include "_Pointe.s"
  31.         Include    "_WEqu.s"
  32.         Include "_CEqu.s"
  33.         Include    "_LEqu.s"
  34. *
  35. DLea        MACRO
  36.         move.l    ExtAdr+ExtNb*16(a5),\2
  37.         add.w    #\1-MB,\2
  38.         ENDM
  39. DLoad        MACRO
  40.         move.l    ExtAdr+ExtNb*16(a5),\1
  41.         ENDM
  42. *
  43. Start        dc.l    C_Tk-C_Off
  44.         dc.l    C_Lib-C_Tk
  45.         dc.l    C_Title-C_Lib
  46.         dc.l    C_End-C_Title
  47.         dc.w    0
  48.  
  49. ***********************************************************
  50. *         OFFSETS TO FUNCTIONS
  51. C_Off   dc.w (L1-L0)/2,(L2-L1)/2,(L3-L2)/2,(L4-L3)/2
  52.         dc.w (L5-L4)/2,(L6-L5)/2,(L7-L6)/2,(L8-L7)/2
  53.         dc.w (L9-L8)/2,(L10-L9)/2,(L11-L10)/2,(L12-L11)/2
  54.         dc.w (L13-L12)/2,(L14-L13)/2,(L15-L14)/2,(L16-L15)/2
  55.         dc.w (L17-L16)/2,(L18-L17)/2,(L19-L18)/2,(L20-L19)/2
  56.         dc.w (L21-L20)/2,(L22-L21)/2,(L23-L22)/2,(L24-L23)/2
  57.         dc.w (L25-L24)/2,(L26-L25)/2,(L27-L26)/2,(L28-L27)/2
  58.         dc.w (L29-L28)/2,(L30-L29)/2,(L31-L30)/2,(L32-L31)/2
  59.         dc.w (L33-L32)/2,(L34-L33)/2,(L35-L34)/2,(L36-L35)/2
  60.         dc.w (L37-L36)/2,(L38-L37)/2,(L39-L38)/2,(L40-L39)/2
  61.         dc.w (L41-L40)/2,(L42-L41)/2,(L43-L42)/2,(L44-L43)/2
  62.         dc.w (L45-L44)/2,(L46-L45)/2,(L47-L46)/2,(L48-L47)/2
  63.         dc.w (L49-L48)/2,(L50-L49)/2,(L51-L50)/2
  64.  
  65. ***********************************************************
  66. *         DUMP TOKENS
  67. C_Tk        dc.w    1,0
  68.         dc.b    $80,-1
  69.         dc.w    -1,L_Perr
  70.         dc.b    "dump err","$"+$80,"2",-1
  71.         dc.w    -1,L_Dump1
  72.         dc.b    "!dum","p"+$80,"0",-2    ; just screen#
  73.         dc.w    -1,L_Dump2
  74.         dc.b    $80,"00,0t0,0",-2    ; srcx,srcy,x,y 
  75.         dc.w    -1,L_Dump3
  76.         dc.b    $80,"00,0t0,0,0,0,0",-1 ; srcx,srcy to x,y,destx,desty,special    
  77.         dc.w    -1,L_DiskIn
  78.         dc.b    "diski","n"+$80,"00",-1    ; unit number
  79.         dc.w    -1,L_WProtect
  80.         dc.b    "writeenabl","e"+$80,"00",-1 ; unit number
  81.         dc.w    -1,L_ReadTrack
  82.         dc.b    "secrea","d"+$80,"20,0,0",-1 ; unit,track,sector
  83.         dc.w    -1,L_WriteTrack
  84.         dc.b    "secwrit","e"+$80,"00,0,0,2",-1 ; unit,track,sector,a$
  85.         dc.w    -1,L_FormatTrack
  86.         dc.b    "trackforma","t"+$80,"00,0",-1  ; unti,track,sector
  87.         dc.w    -1,L_Derr
  88.         dc.b    "disk err","$"+$80,"0",-1
  89.         
  90.         dc.w    0
  91.  
  92. ******************************************************************
  93. *        Start of library
  94. C_Lib
  95.  
  96. ******************************************************************
  97. *        COLD START
  98.  
  99. L0:    lea    MB(pc),a0
  100.     move.l    a0,ExtAdr+ExtNb*16(a5)
  101.  
  102.     lea    dumpend(pc),a0
  103.     move.l    a0,ExtAdr+ExtNb*16+8(a5)
  104.  
  105.     Rbsr    L_ReserveTrack        ; this reserves some memory for
  106.     tst.l    d0            ; a sector buffer.
  107.     beq    openOK            ; it is messy because it is not
  108.     moveq    #-1,d0            ; required by every command
  109.     rts                ; but it's only 514 bytes
  110.  
  111. openOK    moveq    #ExtNb,d0
  112.     rts
  113.  
  114. dumpend:
  115.     Rbsr    L_FreeTrack        ; Deallocate this messy memory
  116.     rts
  117.  
  118. *************** Datazone
  119. MB:
  120. width:        dc.w    0
  121. height:        dc.w    0
  122. viewModes    dc.w    0
  123. depth:        dc.w    0
  124. screen        dc.l    0
  125. vPort        dc.l    0
  126. rPort        dc.l    0
  127. colourMap    dc.l    0
  128. oldCtable    dc.l    0
  129. special        dc.w    $84
  130. srcX        dc.w    0
  131. srcY        dc.w    0
  132. pwidth        dc.w    0
  133. pheight        dc.w    0
  134. temp1        dc.w    0
  135. temp2        dc.w    0
  136. destCols    dc.l    0
  137. destRows    dc.l    0
  138.  
  139. error        dc.l    0
  140.  
  141. JT:        dc.l 0
  142.  
  143. IntuitionBase   dc.l 0
  144. GfxBase        dc.l 0
  145.       
  146. ioRequest:    dc.l 0
  147. msgPort:    dc.l 0
  148. ScreenBase:    dc.l 0
  149. newScreen    dc.l 0
  150. bitMap        dc.l 0
  151. sigTask        dc.l 0
  152. sigBit        dc.b 0        
  153.  
  154.         dc.l 0
  155. ; Dump string data segment
  156. PrinterName:    dc.b    "printer.device",0
  157. ScTitle:    dc.b    "Screen",0
  158. Pname:        dc.b    "MyPrtPort",0
  159.         even
  160.  
  161. ; Trackdisk.device variables
  162.  
  163. tsk        dc.l 0
  164. pk        dc.l 0
  165. onflag        dc.l 0
  166. diskreq        dc.l 0
  167. diskport    dc.l 0
  168. monoff        dc.l 0
  169. drivenum    dc.l 0
  170. tracknumber    dc.l 0
  171. secnumber    dc.l 0
  172. DBase        dc.l 0
  173. diskop        dc.l 0
  174. vartype        dc.l 0
  175. TDerror        dc.l 0 
  176. TDreturn        dc.l 0 
  177. TDbuffer    dc.l 0
  178. string        dc.l 0
  179. Trackbuffer    dc.l 0
  180. drive        dc.b 0
  181.  
  182.         dc.l 0
  183.  
  184. ; Trackdisk string data seqment
  185. Dname:        dc.b    "MyDiskPort",0
  186. DiskName:    dc.b    "trackdisk.device",0
  187. DosName:    dc.b    "dos.library",0
  188.         even
  189.  
  190. L1
  191. L2
  192.  
  193. ********************************************************************
  194. * Dump - a function to dump an amos screen to the printer.
  195. *        the error is returned  eg. e = Dump(0)
  196. ***********************************************************
  197. * This version does a straight full-screen dump.
  198. *************************************************
  199. L_Dump1        equ    3  
  200. L3:    movem.l    a4-a6,-(sp)
  201.     DLea    MB,a2
  202.     Rbsr    L_GetScr
  203.     move.w    width-MB(a2),pwidth-MB(a2)
  204.     move.w    height-MB(a2),pheight-MB(a2)
  205.     move.l    #0,destCols-MB(a2)
  206.     move.l    #0,destRows-MB(a2)
  207.     move.w    #$8c,special-MB(a2)    ; ASPECT | FULLROWS | FULLCOLS
  208.     Rbra    L_Dump
  209.  
  210. **************************************************************
  211. * This version does a partial dump, retaining the proportions
  212. * of the page to printer.
  213. * ie. 1/2 screen fills 1/2 page
  214. **************************************************************
  215. L_Dump2        equ    4
  216. L4:    movem.l    a4-a6,-(sp)
  217.     DLoad    a2
  218.  
  219.     Rbsr    L_Dump2a
  220.     
  221. ; Calculate proportional DestX, DestY
  222.     clr.l    d0
  223.     clr.l    d1
  224.     move.w    pwidth-MB(a2),d0
  225.     tst.w    d0
  226.     Rbeq    L_BadDim    
  227.     move.w    width-MB(a2),d1
  228.     divu.w    d0,d1
  229.     tst.w    d1
  230.     Rbeq    L_BadDim    
  231.     lea    destCols-MB(a2),a0
  232.     move.l    #$ffff,d0
  233.     divu.w    d1,d0
  234.     move.l    d0,(a0)
  235.     andi.l    #$ffff,(a0)
  236.     move.l    #$10,d1
  237.     move.l    (a0),d0
  238.     rol.l    d1,d0
  239.     move.l    d0,(a0)
  240.  
  241.     clr.l    d0
  242.     clr.l    d1
  243.     move.w    pheight-MB(a2),d0
  244.     tst.w    d0
  245.     Rbeq    L_BadDim
  246.     move.w    height-MB(a2),d1
  247.     divu.w    d0,d1
  248.     tst.w    d1
  249.     Rbeq    L_BadDim
  250.     lea    destRows-MB(a2),a0
  251.     move.l    #$ffff,d0
  252.     divu.w    d1,d0
  253.     move.l    d0,(a0)
  254.     andi.l    #$ffff,(a0)
  255.     move.l    #$10,d1
  256.     move.l    (a0),d0
  257.     rol.l    d1,d0
  258.     move.l    d0,(a0)
  259.  
  260.     lea    special-MB(a2),a0
  261.     move.w    #$b0,(a0)
  262.     Rbra     L_Dump
  263.  
  264. *****************************************************************
  265. * This version is the most powerful
  266. * it allows you to pass screen dimensions AND printer dimensions
  267. * as well as the 'special' parameter to allow for any
  268. * sort of printing.
  269. *****************************************************************
  270. L_Dump3:    equ    5
  271. L5:    movem.l    a4-a6,-(sp)
  272.     DLoad    a2
  273.     Rbsr    L_Dump3a
  274.     Rbra    L_Dump
  275.  
  276. ******* Routine
  277. L_Dump3a:    equ    6
  278. L6:    lea    special-MB(a2),a0
  279.     lea    2(a3),a3
  280.     move.w    (a3)+,(a0)        ; special
  281.     lea    destRows-MB(a2),a0
  282.     move.l    (a3)+,(a0)        ; destY
  283.     lea    destCols-MB(a2),a0
  284.     move.l    (a3)+,(a0)        ; destY
  285.     Rbra    L_Dump2a
  286.  
  287. ******* Routine
  288. L_Dump2a:    equ    7
  289. L7:    lea    pheight-MB(a2),a0
  290.     lea    2(a3),a3
  291.     move.w    (a3)+,(a0)        ; bottom y
  292.     lea    pwidth-MB(a2),a0
  293.     lea    2(a3),a3
  294.     move.w    (a3)+,(a0)        ; bottom x
  295.     lea    srcY-MB(a2),a0
  296.     lea    2(a3),a3
  297.     move.w    (a3)+,(a0)        ; srcy
  298.     lea    srcX-MB(a2),a0
  299.     lea    2(a3),a3
  300.     move.w    (a3)+,(a0)        ; srcx
  301.     Rbsr    L_GetScr
  302.  
  303. ; get srcX,Y back
  304.  
  305.     move.w    srcX-MB(a2),d0
  306.     move.w    srcY-MB(a2),d1
  307.  
  308. ; calculate width, height
  309.  
  310.     neg.w    d0
  311.     neg.w    d1
  312.  
  313.     lea    pwidth-MB(a2),a0
  314.     add.w    d0,(a0)            ; width = -srcX+bottomX
  315.     lea    pheight-MB(a2),a0
  316.     add.w    d1,(a0)            ; height = -srcY+bottomY
  317.     
  318.     rts
  319.  
  320. ********************************************************************
  321. * A couple of little routines that are used
  322. ********************************************
  323. L_BadDim:    equ    8
  324. L8:    lea    error-MB(a2),a0        ; we were given some zeros
  325.     move.l    #4,(a0)            ; to divide by!!!
  326.     Rbra    L_exit
  327.  
  328. L_GetScr:    equ    9
  329. L9:    move.l    ScOnAd(a5),d0    
  330.     Rbeq    L_JScnop        ; get the address of the screen 
  331.     move.l    d0,a0
  332.     move.l     a0,ScreenBase-MB(a2)
  333. ; Now we need to extract all the information about the screen
  334.     move.w    EcTx(a0),width-MB(a2)        ; width
  335.     move.w    EcTy(a0),height-MB(a2)        ; height
  336.     move.w    EcCon0(a0),d0
  337.     and.w    #%1000100010000100,d0        ; Hires / HAM / DualPF / Halfbrite
  338.     move.w    d0,viewModes-MB(a2)        ; View Modes
  339.     move.w    EcNPlan(a0),depth-MB(a2)    ; depth
  340.     rts
  341.  
  342. ********************************************************************
  343. * Do the screen dump
  344. *********************
  345. L_Dump        equ    10
  346. L10
  347.  
  348. ; Initialise colour map
  349.     move.l    T_GfxBase(a5),a6
  350.     moveq    #32,d0
  351.     jsr    -570(a6)
  352.     tst.l    d0
  353.     beq    cl5
  354.     move.l    d0,colourMap-MB(a2)
  355.     move.l    d0,a0
  356.     moveq    #0,d0
  357.     move.l    ScreenBase-MB(a2),a1
  358.     lea    EcPal(a1),a1
  359. .loop    move.w    (a1)+,d1
  360.     move.w    d1,d3
  361.     and.w    #$f,d3
  362.     lsr.w    #4,d1
  363.     move.w    d1,d2
  364.     and.w    #$f,d2
  365.     lsr.w    #4,d1
  366.     movem.l    d0/a0-a1,-(sp)
  367.     jsr    -$276(a6)
  368.     movem.l    (sp)+,d0/a0-a1
  369.     addq.w    #1,d0
  370.     cmp.w    #32,d0
  371.     bne.s    .loop
  372.  
  373. ; Create port
  374.     move.l    $4,a6
  375.     move.l    #-1,d0
  376.     jsr    -330(a6)        ; AllocSignal(a6)        
  377.     lea    sigBit-MB(a2),a0
  378.     move.b    d0,(a0)
  379.     
  380.     move.l    #40,d0
  381.     move.l    #65537,d1
  382.     jsr    AllocMem(a6)        ; Allocate msgPort memory
  383.     tst.l    d0
  384.     beq    cl5
  385.     lea    msgPort-MB(a2),a0
  386.     move.l    d0,(a0)
  387.     
  388.     move.l    d0,a0            ; a0 = msgPort
  389.     move.b    #4,8(a0)        ; Type = NT_MSGPORT
  390.     move.b    #0,9(a0)        ; Priority = 0
  391.     lea    Pname-MB(a2),a1
  392.     move.l    a1,10(a0)        ; name of port
  393.     move.b    #0,14(a0)        ; flags
  394.     move.b    sigBit-MB(a2),15(a0)    
  395.  
  396.     move.l    #0,a1
  397.     jsr    FindTask(a6)
  398.     lea     sigTask-MB(a2),a1
  399.     move.l    d0,(a1)
  400.     move.l    msgPort-MB(a2),a0
  401.     move.l    d0,16(a0)
  402.  
  403.     move.l    a0,a1
  404.     jsr    AddPort(a6)
  405.     
  406. ; CreatExtIO
  407.  
  408.     move.l    #64,d0
  409.     move.l    #65537,d1
  410.     jsr    AllocMem(a6)        ; Allocate ioRequest memory
  411.     tst.l    d0
  412.     beq    cl6
  413.     lea    ioRequest-MB(a2),a0
  414.     move.l    d0,(a0)
  415.  
  416.     move.l    d0,a0
  417.     move.b    #5,8(a0)        ; type = NT_MESSAGE
  418.     move.b    #0,9(a0)        ; priority 0    
  419.     move.l    msgPort-MB(a2),14(a0)
  420.     
  421. ; Open printer device.
  422.  
  423.     move.l    $4,a6
  424.     lea    PrinterName-MB(a2),a0
  425.     move.l    #0,d0
  426.     move.l    ioRequest-MB(a2),a1
  427.     move.l    #0,d1
  428.     jsr    OpenDev(a6)
  429.     tst.l    d0
  430.     bne    cl7
  431.     
  432. ; Dump the rast port!!!
  433.  
  434.     move.l    ioRequest-MB(a2),a1
  435.     move.w    #11,28(a1)        ; command
  436.     move.l    T_RastPort(a5),32(a1)    ; rastPort
  437.     move.l    colourMap-MB(a2),36(a1)    ; colourmap
  438.     move.w    viewModes-MB(a2),40+2(a1)    ; viewmodes
  439.     move.w    srcX-MB(a2),44(a1)    ; srcX
  440.     move.w    srcY-MB(a2),46(a1)    ; srcY
  441.     move.w    pwidth-MB(a2),48(a1)    ; srcWidth
  442.     move.w    pheight-MB(a2),50(a1)    ; srcHeight
  443.     move.l    destCols-MB(a2),52(a1)    ; destCols
  444.     move.l    destRows-MB(a2),56(a1)    ; destRows
  445.     move.w    special-MB(a2),60(a1)    ; special
  446.  
  447.     jsr    DoIO(a6)        ; do it!!!! (at last)
  448.     lea    error-MB(a2),a0
  449.     move.l    d0,(a0)
  450.  
  451. ; What follows is the several stages of cleaning up required
  452.  
  453. cl8:    move.l    $4,a6
  454.     move.l    ioRequest-MB(a2),a1
  455.     jsr    CloseDev(a6)
  456.     
  457. cl7:    move.l    ioRequest-MB(a2),a1
  458.     move.b    #$ff,8(a1)
  459.     move.l    #-1,20(a1)
  460.     move.l    #-1,24(a1)
  461.  
  462.     move.l    $4,a6
  463.     move.l    #64,d0
  464.     move.l    ioRequest-MB(a2),a1
  465.     jsr    FreeMem(a6)        : de-allocate ioRequest mem.
  466.  
  467. cl6:    move.l    $4,a6
  468.     move.l    msgPort-MB(a2),a1
  469.     jsr    RemPort(a6)        ; Remove port
  470.  
  471.     move.l    msgPort-MB(a2),a0
  472.     move.b    #$ff,8(a0)
  473.     move.l    #-1,20(a0)
  474.  
  475.     move.b    sigBit,d0
  476.     jsr    -336(a6)        ;FreeSignal(a6)
  477.  
  478.     move.l    #40,d0
  479.     move.l    msgPort-MB(a2),a1
  480.     jsr    FreeMem(a6)        ; de-allocate msgPort memory
  481.  
  482. cl5:    move.l    colourMap-MB(a2),a0
  483.     move.l    T_GfxBase(a5),a6
  484.     jsr    -576(a6)        ; Free colourmap
  485.  
  486.     Rbra    L_exit
  487.  
  488. ******* Return to user
  489. L_exit:        equ    11
  490. L11    move.l    error-MB(a2),d3        ; return the error number
  491.     movem.l    (sp)+,a4-a6
  492.     moveq    #0,d2
  493.       rts
  494.  
  495. ********************************************************************
  496. * Perr: This reserved variable returns descriptions of
  497. *        errors, either the last error - Perr$
  498. *     or any error - Perr$(n)
  499. ********************************************************
  500. L_Perr        equ    12
  501. L12    movem.l    a4-a6,-(sp)    ; parameter specifies error
  502.     DLoad    a2
  503.     move.l    error-MB(a2),d0
  504.     lea    PDERR(pc),a0
  505. .lop    tst.l    d0
  506.     beq    pe1
  507.     clr.l    d1
  508.     move.w    (a0),d1
  509.     andi    #1,d1        ; d1 contains alignment correction
  510.     adda.w    (a0),a0        ; allow for the text
  511.     lea    2(a0),a0    ; allow for the length word    
  512.     adda.w    d1,a0        ; align to word boundary
  513.     subq    #1,d0
  514.     bra.s    .lop
  515. pe1:    move.l    a0,d3
  516.     moveq    #2,d2
  517.     movem.l    (sp)+,a4-a6
  518.     rts
  519. ; Error messages list - Accessed via Perr
  520. PDERR    dc.w    3
  521.     dc.b    "Ok.",0
  522.     dc.w    20
  523.     dc.b    "User cancelled dump."
  524.     dc.w    23
  525.     dc.b    "Not a graphics printer.",0
  526.     dc.w    1
  527.     dc.b    " ",0
  528.     dc.w    19
  529.     dc.b    "Illegal dimensions.",0
  530.     dc.w    1
  531.     dc.b    " ",0
  532.     dc.w    24
  533.     dc.b    "No memory for variables."
  534.     dc.w    21
  535.     dc.b    "No memory for buffer.",0
  536.     dc.w    14
  537.     dc.b    "Unknown error."
  538.     even
  539.  
  540. L13
  541. L14
  542. L15
  543.  
  544. ***********************************************************
  545. *        JUMP TO ERROR MESSAGES
  546. L_JScnop    equ    16
  547. L16    moveq    #47,d0
  548.     Rjmp    L_Error
  549. ***********************************************************
  550. *        ERROR MESSAGES
  551. L17
  552. L18
  553. L19
  554.  
  555. ***********************************************************
  556. * Trackdisk.device commands 
  557. * by Alex J. Grant Apr 1991
  558. * converted to Amos1.3/Compiler Oct 1991
  559. ***********************************************************
  560.  
  561.  
  562. ********************************************************************
  563.  
  564. ********************************************************************
  565.  
  566.  
  567.  
  568. * First, the general routines
  569. ******************************
  570.  
  571. * The functions CreatePort & CreatExtIo follow,
  572. * to be  used by all the trackdisk routines 
  573. *****************************************************
  574.  
  575. * Open dos.library
  576. *******************
  577.  
  578. L_OpenDos    equ 20
  579. L20    DLoad    a2
  580.     lea    DosName-MB(a2),a1    ; library name
  581.     move.l    #33,d0            ; revision number
  582.     move.l    $4,a6            ; exec base
  583.     jsr    -$228(a6)        ; OpenLibrary
  584.     tst.l    d0
  585.     beq    ODerr
  586.     lea    DBase-MB(a2),a0        ; store library base
  587.     move.l    d0,(a0)
  588.     move.l    #0,d0
  589.     rts
  590.  
  591. ODerr:    move.l    #1,d0
  592.     rts
  593.  
  594. * CreatePort
  595. *
  596. * a0-> msgport
  597. * a1-> name
  598. *
  599. * returns error in d0, if <>0 then error!
  600. ******************************************
  601.  
  602. L_CreateDiskPort    equ 21
  603. L21    DLoad    a2
  604.     move.l    a0,a3    ; port
  605.     move.l    a1,a4    ; name
  606.     move.l    $4,a6
  607.     move.l    #-1,d0
  608.     jsr    -330(a6)        
  609.     lea    sigBit-MB(a2),a0
  610.     move.b    d0,(a0)
  611.  
  612.     move.l    #40,d0
  613.     move.l    #65537,d1
  614.     jsr    AllocMem(a6)        ; Allocate msgPort memory
  615.     tst.l    d0
  616.     beq    CPerr
  617.     lea    (a3),a0
  618.     move.l    d0,(a0)
  619.     
  620.     move.l    d0,a0            ; a0 = msgPort
  621.     move.b    #4,8(a0)        ; Type = NT_MSGPORT
  622.     move.b    #0,9(a0)        ; Priority = 0
  623.     lea    (a4),a1
  624.     move.l    a1,10(a0)        ; name of port
  625.     move.b    #0,14(a0)        ; flags
  626.     move.b    sigBit-MB(a2),15(a0)    
  627.  
  628.     move.l    #0,a1
  629.     jsr    FindTask(a6)
  630.     lea     sigTask-MB(a2),a1
  631.     move.l    d0,(a1)
  632.     move.l    (a3),a0
  633.     move.l    d0,16(a0)
  634.  
  635.     move.l    a0,a1
  636.     jsr    AddPort(a6)
  637.  
  638.     move.l    #0,d0
  639.     rts
  640.  
  641. CPerr:    move.l    #1,d0
  642.     rts
  643.  
  644. * CreateExtIO
  645. *
  646. * d0->size
  647. * a0->IOreq
  648. * a1->msgport
  649. *
  650. * error returned in d0
  651. ***********************
  652.  
  653. L_CreateExtIO    equ 22
  654. L22    move.l    a0,a3            ; save IOExtTD
  655.     move.l     a1,a4            ; save msgport
  656.  
  657.     move.l    #56,d0
  658.     move.l    #65537,d1
  659.     jsr    AllocMem(a6)        ; Allocate diskreq memory
  660.     tst.l    d0
  661.     beq    CEXerr
  662.     move.l    a3,a0
  663.     move.l    d0,(a0)
  664.  
  665.     move.l    d0,a0
  666.     move.b    #5,8(a0)        ; type = NT_MESSAGE
  667.     move.b    #0,9(a0)        ; priority 0    
  668.     move.l    (a4),14(a0)        ; msgport
  669.  
  670.     move.l    #0,d0
  671.     rts
  672.  
  673. CEXerr:    move.l    #1,d0
  674.     rts
  675.  
  676.  
  677. L_MotorOnOff    equ 23
  678. *
  679. * a0-> struct IOExtTD
  680. * d0-> On Off flag ... 0=off, 1=on
  681. ***********************************
  682.  
  683. L23    lea    36(a0),a1
  684.     move.l    d0,(a1)
  685.     lea    28(a0),a1
  686.     move.w    #9,(a1)        ; TD_MOTOR
  687.  
  688.     move.l    $4,a6
  689.     move.l    a0,a1
  690.     jsr    DoIO(a6)
  691.  
  692.     rts
  693.  
  694. L_RW_Track    equ 24
  695. *
  696. * Read or Write a track, putting error number into TDerror
  697. * a0-> struct IOExtTD
  698. * a1-> buffer
  699. * d0.l-> track number
  700. * d3.l-> sector number
  701. * d1.w-> TD_Command 2=Read, 3=Write
  702. **************************************************
  703.  
  704. L24    lea    36(a0),a0
  705.     move.l    #512,(a0)+        ; iotd_Req.io_Length
  706.     move.l    a1,(a0)+        ; iotd_Req.io_Data
  707.     
  708.     move.l    #5632,d2
  709.     mulu.w    d0,d2            ; track * TRACK_SIZE
  710.     move.l    d2,(a0)            ; io_Offset
  711.  
  712.     move.l    #512,d2            ; sector * TD_SECTOR
  713.     mulu.w    d3,d2            ; 
  714.     add.l    d2,(a0)            ; add it to io_Offset
  715.  
  716.     lea    -16(a0),a0        ; io_Command
  717.     move.w    d1,(a0)            ; d1=command
  718.  
  719.     move.l    $4,a6
  720.     lea    -28(a0),a1        ; a1=address of IOExtTD
  721.     pea    0(a1)
  722.  
  723.     jsr    DoIO(a6)
  724.  
  725.     move.l    (sp)+,a0
  726.     DLoad    a2
  727.     lea    TDerror-MB(a2),a1
  728.     move.b    31(a0),(a1)
  729.     move.b    31(a0),d0
  730.  
  731.     rts
  732.  
  733. L_F_Track    equ 25
  734. *
  735. * Format a track, putting error number into TDerror
  736. * a0-> struct IOExtTD
  737. * a1-> buffer
  738. * d0.l-> track number
  739. **************************************************
  740.  
  741. L25    lea    36(a0),a0
  742.     move.l    #5632,(a0)+        ; iotd_Req.io_Length
  743.     move.l    a1,(a0)+        ; iotd_Req.io_Data
  744.     
  745.     move.l    #5632,d2
  746.     mulu.w    d0,d2            ; track * TRACK_SIZE
  747.     move.l    d2,(a0)            ; io_Offset
  748.  
  749.     lea    -16(a0),a0        ; io_Command
  750.     move.w    #11,(a0)        ; d1=command
  751.  
  752.     move.l    $4,a6
  753.     lea    -28(a0),a1        ; a1=address of IOExtTD
  754.     pea    0(a1)
  755.  
  756.     jsr    DoIO(a6)
  757.  
  758.     move.l    (sp)+,a0
  759.     DLoad    a2
  760.     lea    TDerror-MB(a2),a1
  761.     move.b    31(a0),(a1)
  762.     move.b    31(a0),d0
  763.  
  764.     rts
  765.     
  766.         
  767. L26:
  768.  
  769. L_ChangeState    equ 27
  770. *
  771. * Returns the disk in drive status
  772. * a0->IOExtTD
  773. ***********************************    
  774.  
  775. L27    pea    0(a0)
  776.     lea    28(a0),a0
  777.     move.w    #$e,(a0)    ; TD_CHANGESTATE
  778.     
  779.     move.l    $4,a6
  780.     jsr    DoIO(a6)
  781.  
  782.     move.l    (sp)+,a0
  783.     move.l    32(a0),d0    ; io_Actual
  784.  
  785.     rts
  786.  
  787. L_ProStatus    equ 28
  788. *
  789. * Returns the write protect status
  790. * a0->IOExtTD
  791. ***********************************    
  792.  
  793. L28    pea    0(a0)
  794.     lea    28(a0),a0
  795.     move.w    #$f,(a0)    ; TD_PROSTATUS
  796.     
  797.     move.l    $4,a6
  798.     jsr    DoIO(a6)
  799.  
  800.     move.l    (sp)+,a0
  801.     move.l    32(a0),d0    ; io_Actual
  802.  
  803.     rts
  804.  
  805. *******************************************************
  806. *
  807. * Ok, here are the commands, starting with 
  808. * one to see if the disk is inserted
  809. *
  810. *******************************************************
  811.  
  812. L_DiskIn    equ 29
  813. L29    movem.l    a4-a6,-(sp)
  814.     DLoad     a2
  815.     lea    drivenum-MB(a2),a0
  816.     move.l    (a3)+,(a0)
  817.  
  818.     lea    diskop-MB(a2),a0
  819.     move.l    #0,(a0)
  820.     lea    vartype-MB(a2),a0        ; returns integer
  821.     move.l    #0,(a0)
  822.     Rbra    L_Gen
  823.  
  824. L_WProtect    equ 30
  825. L30    movem.l    a4-a6,-(sp)
  826.     DLoad    a2
  827.     lea    drivenum-MB(a2),a0
  828.     move.l    (a3)+,(a0)
  829.  
  830.     lea    diskop-MB(a2),a0
  831.     move.l    #4,(a0)
  832.     lea    vartype-MB(a2),a0
  833.     move.l    #0,(a0)            ; returns integer
  834.     Rbra    L_Gen
  835.  
  836. L_ReadTrack    equ 31
  837. L31    movem.l    a4-a6,-(sp)
  838.  
  839.     DLoad    a2
  840.     lea    secnumber-MB(a2),a0
  841.     move.l    (a3)+,(a0)
  842.     lea    tracknumber-MB(a2),a0
  843.     move.l    (a3)+,(a0)
  844.     lea    drivenum-MB(a2),a0
  845.     move.l    (a3)+,(a0)
  846.  
  847.     lea    diskop-MB(a2),a0
  848.     move.l    #8,(a0)
  849.     lea    vartype-MB(a2),a0
  850.     move.l    #2,(a0)            ; returns a string
  851.  
  852.     Rbra     L_Gen
  853.  
  854.                     
  855. L_WriteTrack    equ 32
  856. L32    movem.l    a4-a6,-(sp)
  857.     
  858.     DLoad    a2
  859.     lea    string-MB(a2),a0
  860.     move.l    (a3)+,(a0)        ; data to be written
  861.     lea    secnumber-MB(a2),a0
  862.     move.l    (a3)+,(a0)
  863.     lea    tracknumber-MB(a2),a0
  864.     move.l    (a3)+,(a0)
  865.     lea    drivenum-MB(a2),a0
  866.     move.l    (a3)+,(a0)
  867.  
  868. ; now we need to copy the data from the string to the buffer
  869.  
  870.     move.l    #512,d0            ; length to be copied
  871.     move.l    #0,d1            ; index register
  872.     move.l    string-MB(a2),a0
  873.     move.l    TDbuffer-MB(a2),a1
  874.     cmpi.w    #512,(a0)        ; check length of string
  875.     bgt    copy1
  876.     move.w    (a0),d0            ; length = len(string)
  877. copy1:    lea    2(a0),a0
  878. cloop:    cmp.l    d1,d0
  879.     beq    cdone            ; finished
  880.     move.b    (a0)+,(a1)+        ; do the copy
  881.     addq    #1,d1
  882.     bra    cloop
  883.                     
  884. cdone:    cmpi.l    #512,d1
  885.     beq    calldone        ; completely finished
  886.     clr.b    (a1)+
  887.     addq    #1,d1
  888.     bra    cdone
  889.     
  890. calldone:
  891.     lea    diskop-MB(a2),a0
  892.     move.l    #12,(a0)
  893.     lea    vartype-MB(a2),a0
  894.     move.l    #0,(a0)            ; returns an integer
  895.     Rbra     L_Gen
  896.  
  897. L_FormatTrack    equ 33
  898. L33    movem.l    a4-a6,-(sp)
  899.  
  900.     DLoad    a2
  901.     lea    tracknumber-MB(a2),a0
  902.     move.l    (a3)+,(a0)
  903.     lea    drivenum-MB(a2),a0
  904.     move.l    (a3)+,(a0)
  905.  
  906.     move.l    #5632,d0    ; allocate a track size buffer
  907.     move.l    #3,d1        ; MEMF_CHIP | MEMF_PUBLIC
  908.     move.l    $4,a6
  909.     jsr    AllocMem(a6)
  910.     lea    Trackbuffer-MB(a2),a0        
  911.     tst.l    d0
  912.     beq    Ferr1
  913.     move.l     d0,(a0)    
  914.  
  915.     lea    diskop-MB(a2),a0
  916.     move.l    #16,(a0)
  917.     lea    vartype-MB(a2),a0
  918.     move.l    #0,(a0)            ; returns an integer
  919.     Rbra     L_Gen
  920.     
  921. Ferr1:    lea    TDerror-MB(a2),a0
  922.     move.l    #-1,(a0)
  923.     Rbra    L_TDcl0            ; error!!    
  924.  
  925. L_Derr    equ 34
  926. L34    movem.l    a4-a6,-(sp)
  927.  
  928.     DLoad     a2
  929.     move.l    TDerror-MB(a2),d3
  930.     move.l    #0,d2
  931.  
  932.     movem.l    (sp)+,a4-a6
  933.     rts
  934.  
  935.     
  936. ***********************************************
  937. * Now the general skeleton  to set up all the
  938. * things required by trackdisk.
  939. * It branches off in the middle to do whatever
  940. ***********************************************
  941.  
  942. L_Gen    equ 35
  943. L35    Rbsr    L_OpenDos
  944.     tst.l    d0
  945.     Rbne     L_TDcl0
  946.  
  947.     DLoad    a2
  948.     lea    diskport-MB(a2),a0
  949.     lea    Dname-MB(a2),a1
  950.     
  951.     Rbsr    L_CreateDiskPort
  952.     tst.l    d0
  953.     Rbne    L_TDcl1
  954.  
  955.     lea    diskreq-MB(a2),a0
  956.     lea    diskport-MB(a2),a1
  957.     move.l    #68,d0
  958.     Rbsr    L_CreateExtIO
  959.     tst.l    d0
  960.     Rbne    L_TDcl2
  961.  
  962. ; Open the device
  963.  
  964.     move.l    $4,a6
  965.  
  966.     lea    DiskName-MB(a2),a0
  967.     move.l    drivenum-MB(a2),d0
  968.     move.l    diskreq-MB(a2),a1
  969.     move.l    #0,d1
  970.     
  971.     jsr    OpenDev(a6)
  972.     lea    TDerror-MB(a2),a0
  973.     move.l    d0,(a0)
  974.     tst.l    d0
  975.     Rbne    L_TDcl3
  976.  
  977. ; now jump to individual routines for each different
  978. ; operation
  979.  
  980.     move.l    diskop-MB(a2),d0
  981.     lea    DJT(pc),a0
  982.     jmp    (a0,d0.l)
  983.  
  984. ; this is the disk operation jump table
  985.  
  986. DJT:    Rbra    L_DiskIn2
  987.     Rbra    L_WProtect2
  988.     Rbra    L_ReadTrack2
  989.     Rbra    L_WriteTrack2
  990.     Rbra    L_Formattrack2
  991.     even
  992.     
  993. ********************
  994. * Clean up and exit
  995. ********************
  996.  
  997. L_TDcl4    equ 36
  998. L36    move.l    $4,a6
  999.     DLoad    a2
  1000.     move.l    diskreq-MB(a2),a1
  1001.     jsr    CloseDev(a6)
  1002.     Rbra    L_TDcl3
  1003.  
  1004. L_TDcl3    equ 37
  1005. L37    DLoad    a2
  1006.     move.l    diskreq-MB(a2),a1
  1007.     move.b    #$ff,8(a1)
  1008.     move.l    #-1,20(a1)
  1009.     move.l    #-1,24(a1)
  1010.  
  1011.     move.l    $4,a6
  1012.     move.l    #56,d0
  1013.     move.l    diskreq-MB(a2),a1
  1014.     jsr    FreeMem(a6)        : de-allocate ioRequest mem.
  1015.     Rbra    L_TDcl2
  1016.  
  1017. L_TDcl2    equ 38
  1018. L38    move.l    $4,a6
  1019.     DLoad    a2
  1020.     move.l    diskport-MB(a2),a1
  1021.     jsr    RemPort(a6)        ; Remove port
  1022.  
  1023.     move.l    diskport-MB(a2),a0
  1024.     move.b    #$ff,8(a0)
  1025.     move.l    #-1,20(a0)
  1026.  
  1027.     move.b    sigBit-MB(a2),d0
  1028.     jsr    -336(a6)        ; free signal
  1029.  
  1030.     move.l    #40,d0
  1031.     move.l    diskport-MB(a2),a1
  1032.     jsr    FreeMem(a6)        ; de-allocate msgPort memory
  1033.     Rbra    L_TDcl1
  1034.  
  1035. L_TDcl1    equ 39
  1036. L39    move.l    $4,a6
  1037.     DLoad    a2
  1038.     move.l    DBase-MB(a2),a1        ; Close dos.library
  1039.     jsr     -$19e(a6)
  1040.     Rbra    L_TDcl0
  1041.  
  1042. L_TDcl0    equ 40
  1043. L40    DLoad    a2
  1044.     lea    diskop-MB(a2),a0
  1045.     cmpi.l    #8,(a0)
  1046.     bne     notread
  1047.  
  1048.     move.l    TDbuffer-MB(a2),d3    ; here we need to return the
  1049.     move.l    TDbuffer-MB(a2),a0    ; string, not a number!
  1050.     move.w    #512,(a0)        ; this is the length of the buffer
  1051.     move.l    #2,d2
  1052.  
  1053.     bra    byebye
  1054.  
  1055. notread:
  1056.     Rbsr    L_NiceErrors
  1057.     DLoad    a2
  1058.     move.l    TDreturn-MB(a2),d3
  1059.     move.l    vartype-MB(a2),d2
  1060.  
  1061. byebye:    movem.l    (sp)+,a4-a6
  1062.     rts
  1063.  
  1064. *
  1065. * Create nice error numbers to return with
  1066. * ie. TRUE or FALSE
  1067. *******************************************
  1068.  
  1069. L_NiceErrors    equ 41
  1070. L41    DLoad    a2
  1071.     lea    TDreturn-MB(a2),a0
  1072.     move.l    TDerror-MB(a2),d0
  1073.     tst.l    d0
  1074.     bne    Ferr
  1075.     move.l    #TRUE,(a0)     
  1076.     rts
  1077. Ferr    move.l    #FALSE,(a0)
  1078.     rts
  1079.  
  1080. * Find the disk in/out status
  1081. ******************************
  1082.  
  1083. L_DiskIn2    equ 42
  1084. L42    DLoad    a2
  1085.     move.l    diskreq-MB(a2),a0
  1086.     Rbsr    L_ChangeState
  1087.     lea    TDerror-MB(a2),a0
  1088.     move.l    d0,(a0)        ; Save actural error number
  1089.     Rbra    L_TDcl4
  1090.  
  1091. *
  1092. * See if disk is write protected
  1093. *********************************
  1094. L_WProtect2    equ 43
  1095. L43    DLoad    a2
  1096.     move.l    diskreq-MB(a2),a0
  1097.     Rbsr    L_ProStatus
  1098.     lea    TDerror-MB(a2),a0
  1099.     move.l    d0,(a0)
  1100.     Rbra    L_TDcl4
  1101.  
  1102. *
  1103. * Read a track
  1104. ***************
  1105.  
  1106. L_ReadTrack2    equ 44
  1107. L44    DLoad    a2
  1108.     move.l    diskreq-MB(a2),a0
  1109.     move.l    #1,d0
  1110.     Rbsr    L_MotorOnOff        ; turn the mCèD!I!|&üÿÿˆ!|ÿÿNuŒ"HLßNùAú>0¼Ž1|2CúBN®þh"@pEúGø€(K&ÚQÈÿü!éÿ6œ#Lÿ6`þÌ-xœÿ61|€1|!| NùHallonSoft 1990!’ ŽD¡˜’P”xà ÿÿÿÿþHallonBoot v1.4F1. Remove fastmemF2. Remove extra-drives    (F3. Reset1F4. Small CLI:F5. Large CLICF6. Normal CLIR© Mahoney & Kaktus 1990disk.resourcedos.libraryintuition.libraryDOS¼ÕCú6pN®ýØ,@"zºN®ÿ: z¶p"<@tN®þz z "z !I |ï#H0<PB˜QÈÿü"z€p7rN®ÿ"ztAúòpN®ÿÄ |î€$HCúfp ÙQÈÿüAùßð!J€Bhˆ1|ƒ–r NqQÈÿüQÉÿø!n&€Bhˆ,xCúN®ÿ J€g
  1111.  @ hpNupÿNudos.libraryîîP ÿþŽ@Á’8”Ð$
  1112. àâïÿþ€ù‚ù€ÿþ€Œÿþ”ÿþ ÿþ€ù¡ÿþ€ÿÿÿþgraphics.libraryÿNO VIRUS ON BOOTBLOCK!ÿa(W)XCOPY NEITHER BOOT OR VIRUS ON THIS DISK ...DOSpCú N®ÿ J€g @ hp3üÿßñ€NupÿNudos.libraryDOSpCúN®ÿ J€g
  1113.  @ hpNupÿNudos.library€€¤DISK MASTER V3.0                     Coded by GULLYˆDÝ  @ü–ôÁ€Á€Á€ll8<<<~~<<ÿþ<|ü<øþþ<f~æð‚Æ8ü8ü<~fÃÆÃÃþÀþààà8rÌ~ BÃ<f~0>~~<ðð~0p  À0 qÃ<<`0f0 føq0 qÃ=0 fð|0 q3<0 f0 f`q0 qfÃÀÁ€Á€f<ll>Æløff8ff<`0fff`fÆ<fflfffff`ÆælflffZfÃÆfÃÆ``8`6``øœ3f>6<f@H3f0ôpˆÌcc#$Žf<f H$lŽ$Ž<cf$`f$Žf$$üŽ$ŽÇàÁ€Á€<þ`Ìh08< nl|`ffnÿvÞ<fÀf``Àfl`îöÆfÆfpffÆ<fŒ`0l <l<6<0;l8ff|<Ü=ì>>ffccf~8Ìfl0f<<ˆf~¹<~00Æô0ˆf&&f<<<<<<<Àþþþþ~~~~fÆ<<<<f6ÏffffÃ~f<<<<<<~<<<<<8888|<<<<<>ÏðÁ€ßøfl<v`ÿ~~~Ì| <>gæ Þf|ÀfxxÎ~x`þÞÆ|Æ|8ffÖ<`Fvfnfxfvlwffffv`ffk6fLcã3flx<f±øÌ~¹`Æt0p3,,,0ffffffoÀ````öæffffÃÛfffffclfffff|ffffff~gßøÁ€Ïðfþ0Ü@<0v0þffnÿvÞ~fÀf``ÆfflbÖÎÆ`Ælf<þ<2` f`f~0ffxkfffff<ffkfGñÌf<>0B<<±f±øðÆ0fÙ`~~~~~~|fxxxxfÖÃÃÃÃÃ6óffff<cf`~~~~ÆffffffkÁ€Á€Çàfl|fÌ`f`fff fff `ÀÃfflf`fffffÆÆl`lfff<îff`ffff`0<flcff|>`f<66<2cã3f< 0ü3©îøÌ313fÃÃÃÃÃÃÌ<````lÎfffffcfffff~fffffffØf````ÆffffffsÁ€Á€ÃÀ<lÆv8À<~~<<<<8ÿþxÃü<øþð>f~<æþÆÆ8ð<ã<<>ÆÃ<þþ;<<;<xÆæ<fæ<cf<`ð| ;6c~8Ì~~<<~úgbg<ÃÃÃÃÃÃÏþþþþ~~~~øÆ<<<<<¼>>>><`l;;;;;;w<<<<<<<<<|f<<<<<>Á€Á€Á€ø00þ|<