home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Sound / DeliTrackerII / Bonus / PlayAY100.lha / PlayAY / dev / src / ZXAYEMUL.S < prev    next >
Text File  |  1996-02-29  |  12KB  |  613 lines

  1. ;---------------T
  2.  
  3. ******** Z80 Emul AY Player, (C) 1994-2000 Patrik Rak - Raxoft ********
  4. ******************** Part of PlayAY distribution **********************
  5.  
  6. * 1.0    original release
  7. * 1.1    added support for AMSTRAD (I think)
  8. * 1.2    first 256 bytes are filled with 201 (so JP 56 and like is possible)
  9. *    (except the launch sequence, of course)
  10. * 1.2a    fixed behavior of AMSTRAD CPC port handling
  11. * 1.3    CPC frequencies were an octave higher!
  12. * 1.4    Process changed to Task (RemTask()ing a process leaked memory)
  13.  
  14. AMSTRAD    equ    1    ;emulate also AMSTRAD CPC peripherals
  15.  
  16. COLOROUT    equ    0    ;map border (out 254) as $dff180
  17. DEBUG    equ    0
  18.  
  19.     ifne    DEBUG
  20.     bsr.w    initplayer
  21.     tst.l    d0
  22.     bne.b    error
  23.     lea    test(pc),a0
  24.     bsr.w    initsound
  25.     bsr.w    interrupt
  26.     bsr.w    endsound
  27.     bsr.w    endplayer
  28. error    rts
  29.  
  30. test    dc.b    0,1,2,3
  31.     dc.w    1000
  32.     dc.w    100
  33.     dc.w    $1234
  34.     dc.w    testl-*
  35.     dc.w    testb-*
  36. testl    dc.w    40000    ;stack
  37.     dc.w    0    ;init
  38.     dc.w    49152    ;interrupt
  39. testb    dc.w    32768
  40.     dc.w    1
  41.     dc.w    testc1-*
  42.     dc.w    49152
  43.     dc.w    9
  44.     dc.w    testc2-*
  45.     dc.w    0
  46. testc2    dc.b    62,0        ;ld a,0
  47.     dc.b    61        ;dec a
  48.     dc.b    50,1,$c0    ;ld ($c001),a
  49.     dc.b    211,254        ;out (254),a
  50. testc1    dc.b    $ed,0,201        ;bug,rts
  51.     even
  52.     endc
  53.  
  54. **** Include stuff ****
  55.  
  56.     incdir    include:
  57. ;    include exec/funcdef.i
  58.     include    exec/exec_lib.i
  59.     include    exec/execbase.i
  60.     include    exec/memory.i
  61.     include    exec/tasks.i
  62.     include    dos/dos_lib.i
  63.     include    dos/dos.i
  64.     include    dos/var.i
  65.     include    dos/dostags.i
  66.     incdir     deliay:dist/dev/src/include40/
  67.     include    misc/AYPlayer.i
  68.     include    misc/mine.i
  69.     incdir    deliay:
  70.     include    z80.i
  71.     incdir    ''
  72.  
  73. ***** How single EMUL_Song looks like ******
  74.  
  75.     STRUCTURE    EMUL_Song,0
  76.     UBYTE    ems_assignA    ;0-3 specifies, what amiga channel will be
  77.     UBYTE    ems_assignB    ;assigned to each ay channel (A-C, noise)
  78.     UBYTE    ems_assignC
  79.     UBYTE    ems_assignN
  80.     UWORD    ems_songlen    ;how long the song is in VBIs
  81.     UWORD    ems_fadelen    ;how many VBIs to fade
  82.     UWORD    ems_initnumber    ;this will be stored to HL,DE,BC,IX,IY,A (MSB)
  83.                 ;and all ' registers before calling ems_init
  84.     RPTR    ems_launch    ;Allows same Launch with different initnumbers
  85.     RPTR    ems_firstblock    ;which block(s) install to z80 RAM.
  86.     LABEL    ems_sizeof
  87.  
  88.     STRUCTURE EMUL_Launch,0
  89.     UWORD    eml_stack    ;what will be loaded into SP register
  90.     UWORD    eml_init    ;Routine which set ups the player.
  91.                 ;if zero, use ems_firstblock->emd_address
  92.                 ;or use $1b just for calling ret instruction
  93.     UWORD    eml_interrupt    ;to what address jump to do one VBI play
  94.                 ;if zero, (I*$100+$FF) will be used
  95.     LABEL    eml_sizeof
  96.  
  97.     STRUCTURE EMUL_Block,0
  98.     UWORD    emd_address    ;or null for last block in table
  99.     UWORD    emd_length    ;simply said: take block at emd_binary
  100.     RPTR    emd_binary    ;emd_length bytes long and install it in Z80
  101.     LABEL    emd_sizeof    ;RAM at emd_address
  102.  
  103. **** Real start **********
  104.  
  105. dd    AYPLAYERHEADER    EMUL
  106.     dc.b    0        ;no transpose + terminator for GetVar
  107. AYbase    ds.l    1        ;where ay registers should be "outed"
  108. AYass    ds.l    1        ;where ay channel assignment should be copied
  109. AYfreq    ds.l    1        ;we ignore this anyway
  110.     dc.w    initplayer-*
  111.     dc.w    endplayer-*
  112.     dc.w    initsound-*
  113.     dc.w    endsound-*
  114.     dc.w    interrupt-*
  115.     dc.w    0,0        ;no patterns
  116. name    dc.b    'Z80 Emul Player 1.4',0
  117.     dc.b    'Unknown - original Z80 code is running',0
  118.     dc.b    '(C) 1994-2000 Patrik Rak - Raxoft',0
  119.  
  120. dosn    dc.b    'dos.library',0
  121.     even
  122.  
  123. ;Allocate memory for RAM and Emulator, and install both. Report failure
  124. ;in d0 (0=OK)
  125.  
  126. initplayer
  127.  
  128.     exec    a6
  129.     lea    b(pc),a5
  130.     moveq    #37,d0
  131.     lea    dosn(pc),a1
  132.     jsrlib    OpenLibrary
  133.     move.l    d0,dosb-b(a5)
  134.     beq.b    endplayer
  135.  
  136.     moveq    #-8,d4    ;8 byte pod romkou jako rezerva na stack
  137.     swap    d4    ;jeden staci, ale nejaky potize s allocabs...
  138.     move.l    #zxsize,d2
  139.     bsr.w    Alloc64k
  140.     beq.b    endplayer
  141.     addq.l    #8,d0
  142.     move.l    d0,zxbase-b(a5)
  143.  
  144.     moveq    #0,d4
  145.     move.l    #emullen,d2
  146.     bsr.w    Alloc64k
  147.     beq.b    endplayer
  148.     move.l    d0,emulbase-b(a5)
  149.  
  150.     move.l    d0,a4
  151.     move.l    d0,a1
  152.     lea    emulator(pc),a0
  153.     move.l    #emullen,d0
  154.     jsrlib    CopyMem
  155.     jsrlib    CacheClearU        ;Flush the Caches
  156.  
  157.     btst    #AFB_68010,AttnFlags+1(a6)
  158.     beq.b    .keepmovesrdx
  159.     jsr    z80_MODE68010(a4)
  160.     jsrlib    CacheClearU        ;flush caches
  161. .keepmovesrdx
  162.     lea    z80_out(a4),a1
  163.     lea    out(pc),a0
  164.     move.l    a0,(a1)+    ;out
  165.     lea    return(pc),a0
  166.     move.l    a0,(a1)+    ;in
  167.     move.l    a0,(a1)+    ;ldir delay
  168.     move.l    a0,(a1)        ;lddr delay
  169.  
  170.     moveq    #0,d0
  171. return    rts
  172.  
  173. ;Free the memory.
  174.  
  175. endplayer
  176.     exec    a6
  177.     lea    b(pc),a5
  178.  
  179.     move.l    zxbase(pc),d0
  180.     beq.b    .nozx
  181.     subq.l    #8,d0
  182.     move.l    d0,a1
  183.     move.l    #zxsize,d0
  184.     jsrlib    FreeMem
  185.     clr.l    zxbase-b(a5)
  186. .nozx
  187.     move.l    emulbase(pc),d0
  188.     beq.b    .noz80
  189.     move.l    d0,a1
  190.     move.l    #emullen,d0
  191.     jsrlib    FreeMem
  192.     clr.l    emulbase-b(a5)
  193. .noz80
  194.     move.l    dosb(pc),d0
  195.     beq.b    .nodos
  196.     move.l    d0,a1
  197.     jsrlib    CloseLibrary
  198.     clr.l    dosb-b(a5)
  199. .nodos    moveq    #-1,d0
  200.     rts
  201.  
  202. ;Install channel asignement
  203. ;Install data to the RAM
  204. ;then run the emulator
  205.  
  206. initsound
  207.     exec    a6
  208.     lea    b(pc),a5
  209.  
  210.     move.l    AYass,a1
  211.     move.l    (a0)+,(a1)    ;assignement
  212.     
  213.     move.l    (a0)+,(a5)+    ;songlen+fadelen
  214.     
  215.     clr.l    (a5)+    ;ay_selected(2)+ay_regs(14)=16 bytes
  216.     clr.l    (a5)+
  217.     clr.l    (a5)+
  218.     clr.l    (a5)+
  219.  
  220.     move.l    (a5),a1        ;zxbase
  221.     move.l    #$c9c9c9c9,d1
  222.     move.w    #256/4-1,d0    ;fill begin of rom with ret (201)
  223. .rom0    move.l    d1,(a1)+
  224.     dbra    d0,.rom0
  225.     moveq    #-1,d1
  226.     move.w    #$3f00/4-1,d0    ;fill rom with 255
  227. .rom    move.l    d1,(a1)+
  228.     dbra    d0,.rom
  229.     moveq    #0,d1
  230.     move.w    #$c000/4-1,d0    ;fill ram with 0
  231. .ram    move.l    d1,(a1)+
  232.     dbra    d0,.ram
  233.     move.b    #243,(a1)    ;di
  234.     
  235.     move.l    (a5)+,a3    ;zxbase
  236.     move.l    (a5)+,a4    ;emulbase
  237.     move.l    (a0),d1        ;ems_initnumber<<16!ems_initnumber
  238.     move.w    (a0)+,d1
  239.     move.l    a0,a1        ;launch
  240.     add.w    (a0)+,a1
  241.     move.l    a0,a2        ;block
  242.     add.w    (a0),a2
  243.  
  244.     lea    z80_pc(a4),a0
  245.     clr.w    (a0)+        ;reset pc to zero
  246.     move.w    (a1)+,(a0)+    ;set sp to eml_stack
  247.     move.l    d1,(a0)+    ;af,af'
  248.     move.l    d1,(a0)+    ;bc,bc' to ems_initnumber
  249.     move.l    d1,(a0)        ;ix,iy
  250.     move.l    d1,z80_d(a4)    ;de,hl
  251.     move.l    d1,z80_d_(a4)    ;de',hl'
  252.  
  253.     move.b    #$cd,(a3)+    ;call        install z80 startup code
  254.     move.w    (a1)+,d0    ;eml_init
  255.     bne.b    .useit
  256.     move.w    (a2),d0        ;emb_address
  257. .useit
  258.     move.b    d0,(a3)+    ;lsb
  259.     move.w    d0,(a3)+    ;msb
  260.     move.b    #$21,-1(a3)    ;ld    hl,
  261.     move.b    1(a1),(a3)+    ;eml_interrupt lsb
  262.     move.b    (a1),(a3)+    ;msb
  263.     moveq    #z80launchlen-1,d0
  264. .launch    move.b    (a5)+,(a3)+
  265.     dbra    d0,.launch
  266.     
  267. .copy    move.l    a3,d1        ;zxbase+something
  268.     move.w    (a2)+,d1    ;emb_address
  269.     beq.b    .copydone
  270.     move.l    d1,a1        ;zxbase+emb_address
  271.     moveq    #0,d0
  272.     move.w    (a2)+,d0
  273.     move.l    a2,a0
  274.     add.w    (a2)+,a0
  275.     add.w    d1,d0        ;if address+len > 65536
  276.     bcc.b    .ok
  277.     moveq    #0,d0        ;protect the innocent
  278. .ok    sub.w    d1,d0
  279.     jsrlib    CopyMem
  280.     bra.b    .copy
  281. .copydone
  282.     move.l    (a5)+,a6    ;dosbase
  283.     lea    var(pc),a0
  284.     move.l    a0,d1
  285.     lea    priority(pc),a4
  286.     move.b    #127,(a4)    ;set pri to maximum
  287.     move.l    a4,d2
  288.     moveq    #2,d3        ;because of bug in V37 (nullterm)
  289.     move.l    #GVF_BINARY_VAR,d4
  290.     jsrlib    GetVar
  291.  
  292.     exec    a6
  293.  
  294.     lea    memlist(pc),a0
  295.     jsrlib    AllocEntry
  296.     bclr.l    #31,d0
  297.     bne.b    .nomem
  298.  
  299.     move.l    d0,a1
  300.     move.l    taskmem-memlist(a1),a3
  301.  
  302.     move.l    stackmem-memlist(a1),d1
  303.     move.l    d1,TC_SPLOWER(a3)
  304.     add.l    stacksize-memlist(a1),d1
  305.     move.l    d1,TC_SPUPPER(a3)
  306.     move.l    d1,TC_SPREG(a3)
  307.  
  308.     move.b    #NT_TASK,LN_TYPE(a3)
  309.     move.b    (a4),LN_PRI(a3)
  310.     lea    name(pc),a0
  311.     move.l    a0,LN_NAME(a3)
  312.  
  313.     lea    TC_MEMENTRY(a3),a0
  314.     NEWLIST    a0
  315.     jsrlib    AddHead
  316.  
  317.     move.l    a3,a1
  318.     lea    entry(pc),a2
  319.     sub.l    a3,a3
  320.     jsrlib    AddTask
  321.     move.l    d0,(a5)        ;task (or NULL in case of failure)
  322.  
  323. .nomem    rts
  324.     
  325. ;stop the emulator and dump the regs if error was encountered
  326.  
  327. endsound    exec    a6
  328.     move.l    task(pc),d0
  329.     beq.b    .none
  330.     move.l    d0,a1
  331.     jsrlib    RemTask
  332. .none
  333.     lea    dosb(pc),a0
  334.     move.l    (a0)+,a6        ;dosbase
  335.     clr.l    (a0)+            ;task
  336.     move.l    (a0),d7            ;emulator exit code
  337.     beq.b    .exit            ;no error
  338.     clr.l    (a0)+
  339.     
  340.     move.l    a0,d1            ;debugname
  341.     move.l    #MODE_NEWFILE,d2
  342.     jsrlib    Open
  343.     move.l    d0,d6
  344.     beq.b    .exit        ;nochance
  345.     move.l    emulbase(pc),a5
  346.     move.l    a7,a2
  347.     lea    z80_i(a5),a4
  348.     move.l    (a4),d0
  349.     lsr.l    #8,d0
  350.     and.w    #$ff,d0
  351.     push    d0        ;r,i
  352.     move.l    -(a4),-(sp)    ;ix,iy
  353.     lea    z80_which(a5),a3
  354.     add.w    (a3),a3        ;correct exx set
  355.     move.w    2(a3),d0    ;other set
  356.     move.w    (a3,d0),-(sp)    ;hl'
  357.     move.w    (a3),-(sp)    ;hl
  358.     move.w    -2(a3,d0),-(sp)    ;de'
  359.     move.w    -(a3),-(sp)    ;de
  360.     move.l    -(a4),-(sp)    ;bc,bc'
  361.     move.l    -(a4),-(sp)    ;af,af'
  362.     move.l    -(a4),-(sp)    ;pc,sp'
  363.     lea    zxbase(pc),a0
  364.     push    (a0)+        ;zxbase
  365.     push    (a0)        ;emulbase
  366.     push    d7        ;return code from emulator
  367.     lea    format(pc),a0
  368.     move.l    d6,d1
  369.     move.l    a0,d2
  370.     move.l    a7,d3
  371.     jsrlib    VFPrintf
  372.     move.l    a2,a7
  373.     move.l    d6,d1
  374.     jsrlib    Close
  375. .exit    rts
  376.  
  377. ;Copy AY registers to AY, then signal Interrupt received to the emulator.
  378. ;(Freqs multiplied by 8 (or 16 for CPC)).
  379. ;Return fadelen or 0 in d0.
  380.  
  381. interrupt
  382.     exec    a6
  383.     lea    ay_regs(pc),a0
  384.     move.l    AYbase(pc),a1
  385.     moveq    #3-1,d1
  386.     ifne    AMSTRAD
  387.     move.b  multiplyshift(pc),d2
  388. .freqs    move.w    (a0)+,d0
  389.     ror.w    d2,d0        ;swap bytes & multiple word appropriatelly
  390.     else
  391. .freqs    move.w    (a0)+,d0
  392.     ror.w    #8-3,d0        ;swap bytes & multiple word by 8
  393.     endc
  394.  
  395.     move.w    d0,(a1)+    ;copy first six bytes
  396.     dbra    d1,.freqs
  397.     move.l    (a0)+,(a1)+    ;+4
  398.     move.l    (a0),(a1)    ;+4 = 14 registers
  399.  
  400.     move.l    task(pc),d0    ;if no task then exit
  401.     beq.b    .exit
  402.     move.l    d0,a1
  403.     move.l    #SIGBREAKF_CTRL_C,d0
  404.     jsrlib    Signal
  405.     lea    songlen(pc),a0
  406.     moveq    #0,d0
  407.     tst.w    (a0)
  408.     beq.b    .exit
  409.     subq.w    #1,(a0)+
  410.     bne.b    .exit
  411.     move.w    (a0),d0
  412. .exit    rts
  413.  
  414. ************************* Support routines *********************
  415.  
  416. Alloc64k    moveq    #MEMF_FAST!MEMF_PUBLIC,d3
  417.     bsr.b    .main
  418.     bne.b    .exit
  419.     moveq    #MEMF_CHIP!MEMF_PUBLIC,d3
  420.  
  421. ;d2 size, d3 type of mem, d4 word allignment (eg. -1 will allocate $xxxxffff)
  422. ;            in upper word
  423.  
  424.  
  425. .main    lea    MemList(a6),a2
  426. .loop    move.l    (a2),a2
  427.     move.l    (a2),d0
  428.     beq.b    .exit
  429.     move    MH_ATTRIBUTES(a2),d0
  430.     and    d3,d0
  431.     cmp    d3,d0
  432.     bne.b    .loop
  433.     move.l    d4,d0
  434.     move.w    MH_LOWER(a2),d0
  435.     bra.b    .in
  436. .loop2    swap    d0
  437.     addq    #1,d0
  438. .in    swap    d0
  439.     cmp.l    MH_UPPER(a2),d0
  440.     bcc.b    .loop
  441.     move.l    d0,a1
  442.     push    d0
  443.     move.l    d2,d0
  444.     jsrlib    AllocAbs
  445.     tst.l    d0
  446.     popm    d0
  447.     beq.b    .loop2
  448. .exit    rts
  449.  
  450. ****************************** Z80 out routine ***********************
  451.  
  452. out    
  453.     ifne    COLOROUT
  454.     btst    #0,d1
  455.     bne.b    .nofe
  456.     and    #7,d0
  457.     add.w    d0,d0
  458.     lea    .tab(pc,d0.w),a0
  459.     move.w    (a0),$dff180
  460.     rts
  461. .tab    dc.w    $000
  462.     dc.w    $00f
  463.     dc.w    $f00
  464.     dc.w    $f0f
  465.     dc.w    $0f0
  466.     dc.w    $0ff
  467.     dc.w    $ff0
  468.     dc.w    $fff
  469.     endc
  470. .nofe    
  471.     cmp.w    #$fffd,d1
  472.     bne.b    .notselect
  473.     cmp.b    #14,d0
  474.     bcc.b    .exit
  475. .outregamstrad    move.b    d0,ay_selected+1
  476. .exit    rts
  477. .notselect
  478.     cmp.w    #$bffd,d1
  479.     bne.b    .notdata
  480.     lea    ay_regs(pc),a0
  481.     add.w    ay_selected(pc),a0
  482.     move.b    d0,(a0)
  483.  
  484.     ifne    AMSTRAD
  485.  
  486.     move.b    #8-3,multiplyshift
  487.     rts
  488. .notdata    
  489.     clr.b    d1
  490.     cmp.w    #$f600,d1
  491.     bne.b    .notcontrolport
  492.     move.b    d0,d1
  493.     move.b    porta(pc),d0
  494.     add.b    d1,d1
  495.     bcc.b    .exit
  496.     bmi.b    .outregamstrad
  497.     lea    ay_regs(pc),a0
  498.     move.w    ay_selected(pc),d1
  499.     cmp.b    #14,d1
  500.     bcc.b    .exit
  501.     add.w    d1,a0
  502.     move.b    d0,(a0)
  503.     move.b  #8-4,multiplyshift
  504.     rts
  505. .notcontrolport
  506.     cmp.w    #$f400,d1
  507.     bne.b    .notdataport
  508.     move.b    d0,porta
  509. .notdataport
  510.     rts
  511.  
  512.     else
  513.  
  514. .notdata
  515.     rts
  516.  
  517.     endc
  518.  
  519. ************************** variables ************************
  520.  
  521.     ifne    AMSTRAD
  522. porta    dc.b    0
  523. multiplyshift    dc.b    8-3    ; 8-3 for ZX, 8-4 for CPC
  524.     endc
  525.  
  526. ;warning - do not change the order of variables!!! used in initsound!
  527.  
  528. b
  529. songlen    dc.w    0
  530. fadelen    dc.w    0
  531.     
  532. ay_selected    dc.w    0    ;to which ay register we are going to "out"
  533.  
  534. ay_regs    dc.w    0,0,0    ;freqs
  535.     dc.b    0    ;noise
  536.     dc.b    0    ;strobe
  537.     dc.b    0,0,0    ;volumes
  538.     dc.b    0    ;envtype
  539.     dc.b    0,0    ;envfreq
  540.  
  541. zxbase    dc.l    0
  542. emulbase    dc.l    0
  543.  
  544. *************************** Z80 launch code ***********************
  545.  
  546. z80launch
  547. ;    dc.b    $cd    ;call    xx
  548. ;init    dc.b    0,0
  549. ;    dc.b    $21    ;ld    hl,xx
  550. ;rupt    dc.b    0,0
  551.     dc.b    $7c    ;ld    a,h
  552.     dc.b    $b5    ;or    l
  553.     dc.b    $20,$08    ;jr    nz,ok
  554.     dc.b    $ed,$57    ;ld    a,i
  555.     dc.b    $67    ;ld    h,a
  556.     dc.b    $2d    ;dec    l
  557.     dc.b    $5e    ;ld    e,(hl)
  558.     dc.b    $23    ;inc    hl
  559.     dc.b    $56    ;ld    d,(hl)
  560.     dc.b    $eb    ;ex    de,hl
  561.     dc.b    $22,$17,0;ok ld    (here+1),hl
  562.     dc.b    $76    ;loop    halt
  563.     dc.b    $cd,0,0    ;here    call    xx
  564.     dc.b    $18,$fa    ;jr    loop
  565.     dc.b    201    ;ret
  566. z80launchlen    equ    *-z80launch
  567.  
  568. ********************* Emulator Task Data *********************
  569.  
  570. dosb    dc.l    0
  571. task    dc.l    0
  572. exitcode    dc.l    0
  573.     dc.b    'RAM:'
  574. var    dc.b    'Z80debug',0
  575. format    dc.b    'Error: %08lx Emulator: %08lx RAM: %08lx',10,10
  576.     dc.b    'PC:%04x SP :%04x',10
  577.     dc.b    'AF:%04x AF'':%04x',10
  578.     dc.b    'BC:%04x BC'':%04x',10
  579.     dc.b    'DE:%04x DE'':%04x',10
  580.     dc.b    'HL:%04x HL'':%04x',10
  581.     dc.b    'IX:%04x IY :%04x',10
  582.     dc.b    'I :  %02x R  :  %02x',10
  583.     dc.b    0
  584.  
  585. priority    dc.b    127,0    ; extra 0 because of nullterm bug in v37
  586.  
  587.     even
  588.  
  589. memlist    ds.b    LN_SIZE
  590.     dc.w    2
  591. taskmem    dc.l    MEMF_PUBLIC!MEMF_CLEAR
  592.     dc.l    TC_SIZE
  593. stackmem    dc.l    MEMF_PUBLIC!MEMF_CLEAR
  594. stacksize    dc.l    4096
  595.  
  596. entry    lea    zxbase(pc),a0
  597.     move.l    (a0)+,d7        ;zxbase
  598.     move.l    (a0),a0            ;emulbase
  599.     jsr    z80_RUN(a0)
  600.     lea    exitcode(pc),a0        ;hopefully, this never gets executed
  601.     move.l    d7,(a0)            ;return code from emulator
  602.     exec    a6
  603. .loop    moveq    #0,d0
  604.     jsrlib    Wait
  605.     bra.b    .loop            ;never reached
  606.     
  607. *********************** z80 emulator *************************
  608.  
  609. emulator    incbin    'deliay:Z80'    ;sorry, not distributed :-)
  610. emullen    equ    *-emulator
  611. zxsize    equ    8+65536+8
  612.  
  613.