home *** CD-ROM | disk | FTP | other *** search
/ The AGA Experience 2 / agavol2.iso / software / utilities / emulation / st / st.s < prev   
Text File  |  1995-11-26  |  2KB  |  138 lines

  1. ; © Stefan Haubenthal 1992-95
  2. *    opt    o+
  3. *    include    prog:asm/include/wb.i
  4. *    incdir    prog:asm/include
  5. *    include    easystart.i
  6.     incdir    1.02
  7. *    incdir    2.06
  8.  
  9. version=    "2.20"
  10. *allocabs=    -$0cc
  11. freemem=    -$0d2
  12. oldopenlibrary=    -$198
  13. closelibrary=    -$19e
  14. open=        -$01e
  15. read=        -$02a
  16. datestamp=    -$0c0
  17. copymemquick=    -$276
  18. mode_oldfile=    1005
  19.  
  20. io=        $18000;  32K
  21. emu=        $20000
  22. temp=        $23100;  8 bytes
  23. buffer=        $24000
  24. scr=        $30000
  25. scrsize=    $8000; ± 32K
  26. dsk=        $38004
  27. dsksize=    $4000;   16K
  28. rom=        $40000
  29. romsize=    $40000; 256K/192K
  30.  
  31.     move.l    4.w,a6
  32.     IFD    allocabs
  33.     move.l    #romsize,d0
  34.     lea    rom,a1
  35.     jsr    allocabs(a6)
  36.     tst.l    d0
  37.     beq    exit
  38.     move.l    #emusize,d0
  39.     lea    emu,a1
  40.     jsr    allocabs(a6)
  41.     tst.l    d0
  42.     beq.s    exit
  43.     ENDC
  44.     lea    dosname(pc),a1
  45.     jsr    oldopenlibrary(a6)
  46.     move.l    d0,a6
  47.     move.l    #romname,d1
  48.     move.l    #mode_oldfile,d2
  49.     jsr    open(a6)
  50.     beq.s    exit2
  51.     move.l    d0,d1
  52.     move.l    #rom,d2
  53.     move.l    #romsize,d3
  54.     jsr    read(a6)
  55.     bsr.s    patch
  56.     bsr.s    time
  57.     move.l    4.w,a6
  58.     lea    start_emu,a0
  59.     lea    emu,a1
  60.     move.l    #emusize,d0
  61.     jsr    copymemquick(a6)
  62.     jmp    emu+4
  63. ; goodbye AmigaDOS!
  64. exit2    move.l    a6,a1
  65.     move.l    4.w,a6
  66.     jsr    closelibrary(a6)
  67.     IFD    allocabs
  68.     move.l    #emusize,d0
  69.     lea    emu,a1
  70.     jsr    freemem(a6)
  71.     ENDC
  72. exit    moveq    #20,d0
  73.     rts
  74.  
  75. patch    lea    reloc,a0
  76.     sub.l    a1,a1
  77.     move.b    rom+5,d3
  78.     sub.b    #rom>>16,d3
  79. next_reloc    moveq    #0,d0
  80.     cmp    #0,(a0)
  81.     add    (a0)+,a1
  82.     bne.s    not_packed
  83.     move.b    (a0)+,d0
  84.     move.b    (a0)+,d1
  85. next_packed    add    d1,a1
  86. not_packed    sub.b    d3,(a1,d2.l)
  87.     dbra    d0,next_packed
  88.     cmp.l    #diff,a0
  89.     blo.s    next_reloc
  90. next_diff    move.l    (a0)+,a1
  91.     move    (a0)+,d0
  92.     move.b    d0,(a1,d2.l)
  93.     cmp.l    #end_diff,a0
  94.     blo.s    next_diff
  95.     rts
  96.  
  97. DIGITS    macro
  98.     move.b    d0,d2
  99.     and.b    #$f,d2
  100.     move.b    d2,\1
  101.     lsr.b    #4,d0
  102.     move.b    d0,\2
  103.     endm
  104. time    move.l    #vector,d1
  105.     jsr    datestamp(a6)
  106.     move.l    vector+4(pc),d0
  107.     divu    #60,d0    ; hours
  108.     DIGITS    start_emu+$57,start_emu+$5f
  109.     swap    d0    ; minutes
  110.     DIGITS    start_emu+$47,start_emu+$4f
  111.     move.l    vector+8(pc),d0
  112.     divu    #50,d0    ; seconds
  113.     DIGITS    start_emu+$37,start_emu+$3f
  114.     rts
  115.  
  116.     dc.b    "$VER: ST4Amiga V"
  117.     dc.l    version
  118.     dc.b    0
  119. dosname    dc.b    "dos.library",0
  120. romname    dc.b    "TOS.IMG",0
  121. vector    ds.l    3
  122.  
  123.     data
  124. ; { delta_offset.w
  125. ; | 0.w number-1.b delta_offset.b }
  126. reloc    include    reloc.asm
  127. ; { offset.l data.w }
  128. diff    include    diff.asm
  129. end_diff
  130.  
  131.     code
  132. temp1    EQU    temp
  133. temp2    EQU    temp1+2
  134. temp3    EQU    temp2+2
  135. temp4    EQU    temp3+2
  136. start_emu    include    emu.asm
  137. emusize=    *-emu
  138.