home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 39 / af039a.adf / system.s < prev    next >
Text File  |  1992-09-17  |  3KB  |  139 lines

  1. ******************************************************************************
  2. ;    include    dos_lib.i
  3. ;LIB_OPEN    =    -408
  4.     xdef    _set_up_disc
  5. _set_up_disc
  6.     move.l  4,a6                        exec base
  7.     lea         DOS_Name,a1                     library to open
  8.     jsr         LIB_OPEN(a6)
  9.     move.l  d0,_mydosbase
  10.  
  11.     move.l    _mydosbase,a6                 get standard output handle
  12.     jsr        _LVOOutput(a6)
  13.     move.l    d0,_clihandle
  14.     rts
  15. *****************************************************************************
  16.     xdef    _myload_file
  17. _myload_file
  18.     movem.l    d1-d7/a0-a6,-(sp)
  19.     lea     filestuff,a6
  20.     mulu    #12,d0
  21.     adda.w    d0,a6
  22.     move.l    0(a6),d5        read  screenfile
  23.     move.l    4(a6),d6
  24.     move.l    8(a6),d7
  25.     move.l    _mydosbase,a6
  26.     move.l    d5,d1                            read map_file
  27.     move.l  #1005,d2                    mode oldfile
  28.     jsr     _LVOOpen(a6)                open
  29.     move.l    d0,d5                        is now the file handle
  30.     beq.s    .fail
  31.  
  32.     move.l  d5,d1                       handle
  33.     move.l  d6,d2                        buffer
  34.     move.l  d7,d3                         length
  35.     jsr     _LVORead(a6)                   read the file
  36.  
  37.     move.l    d5,d1                        handle
  38.     jsr        _LVOClose(a6)                close the file
  39.     bra.s    .end
  40. .fail
  41.     move.l    #'FAIL',d0
  42. .end
  43.     movem.l    (sp)+,d1-d7/a0-a6
  44.     rts
  45. *****************************************************************************
  46.     xdef    _mysave_file
  47. _mysave_file
  48.     movem.l    d1-d7/a0-a6,-(sp)
  49.     lea     filestuff,a6
  50.     mulu    #12,d0
  51.     adda.w    d0,a6
  52.     move.l    0(a6),d5        write screenfile
  53.     move.l    4(a6),d6
  54.     move.l    8(a6),d7
  55.     move.l    _mydosbase,a6
  56.     move.l    d5,d1                            read map_file
  57.     move.l  #1006,d2                    mode newfile
  58.     jsr     _LVOOpen(a6)                open
  59.     move.l    d0,d5                        is now the file handle
  60.     beq.s    .fail
  61.  
  62.     move.l  d5,d1                       handle
  63.     move.l  d6,d2                        buffer
  64.     move.l  d7,d3                         length
  65.     jsr     _LVOWrite(a6)                  read the file
  66.  
  67.     move.l    d5,d1                        handle
  68.     jsr        _LVOClose(a6)                close the file
  69.     bra.s    .end
  70. .fail
  71.     move.l    #'FAIL',d0
  72. .end
  73.     movem.l    (sp)+,d1-d7/a0-a6
  74.     rts
  75. *****************************************************************************
  76. ;DOS_Name    dc.b    'dos.library',0
  77.     even
  78. _mydosbase    dc.l    0
  79. _clihandle    dc.l    1
  80. ******************************************************************************
  81. filestuff
  82.  
  83.     dc.l    _backscreen
  84.     dc.l    backscreen
  85.     dc.l    32000
  86.     
  87. _backscreen
  88.     dc.b    "DATA/QAZ.DAT",0
  89.     even
  90. ******************************************************************************
  91. *              convert long to alpha Tue Mar 27 10:36:17 1990                *
  92. ******************************************************************************
  93. ; a0-> destination string d0.l = number to convert, d1.l = no digits
  94.     xdef    _to_alpha
  95. _to_alpha
  96.     move.w    d1,d2
  97.     add.w    d2,d2                        ;*2
  98.     add.w    d2,d2                        ;*4
  99.     neg.w    d2
  100.     lea        decsize(pc,d2.w),a1            ;a1-> list of neggers
  101.     subq.w    #1,d1                        ;for dbra
  102. ;    move.w    #1,d4
  103. .loop
  104.     move.l    (a1)+,d2                    ;get negger
  105.     moveq    #'0',d3                        ;this digit
  106. .iloop
  107.     sub.l    d2,d0
  108.     bmi.s    .digdun
  109.     addq.b    #1,d3                        ;build digit
  110.     bra.s    .iloop
  111. .digdun
  112.         add.l    d2,d0
  113.  
  114.     tst.w    d4                        ;leading spaces. or not
  115.     beq.s    .not_leading
  116.     cmp.b    #'0',d3
  117.     beq.s    .still_leading
  118.         moveq    #0,d4
  119.         bra.s    .not_leading
  120. .still_leading
  121.     moveq    #' ',d3
  122. .not_leading
  123.  
  124.     move.b    d3,(a0)+
  125.     dbra    d1,.loop
  126. ;    clr.b    (a0)
  127.     rts
  128.  
  129.     dc.l    10000000
  130.     dc.l     1000000
  131.     dc.l      100000
  132.     dc.l       10000
  133.     dc.l        1000
  134.     dc.l         100
  135.     dc.l          10
  136.     dc.l           1
  137. decsize                                 ;label at end of table
  138. ******************************************************************************
  139.