home *** CD-ROM | disk | FTP | other *** search
/ Syzygy Magazine 7 / Syzygy_Magazine_7_1999___pl_Disk_2_of_2_Side_B.atr / xasm22.zip / doc / xbootstd.asx < prev    next >
Text File  |  1999-09-10  |  2KB  |  63 lines

  1. * Boot executable file loader coded by Fox/Taquart
  2. * Reads file from ATR prepared with X-BOOT.
  3. * Standard loader - ROM and interrupts enabled.
  4.  
  5.     opt    h-
  6.     org    $780
  7.  
  8. bufr    equ    $700        128-byte buffer
  9.  
  10. tp    equ    $43        Temporary byte
  11. vc    equ    $44        Start and end vectors (4 bytes)
  12.  
  13. * Boot code
  14. boot    dta    b(0,1),a(boot,$e477)    Boot header
  15. txtpos    equ    215
  16.     ldy    #txtpos        Print text
  17. print    mva    text-txtpos,y    ($58),y+
  18.     cpy    #txtpos+txtlen
  19.     bcc    print
  20.     mwa    #rts    $2e0    Set default run vector
  21.     mva    >bufr    $305    Set buffer address
  22.     mva    #$ff    ^31    Turn BASIC off
  23.     dta    b({lda a:0})    Skip two bytes
  24. secrts    sec            Return with error
  25. rts    rts
  26.     mva:pha    >rts    $2e3    Set init address...
  27.     mva:pha    <rts    $2e2    ... and put return address on stack
  28.     ldx    #-5        Load header
  29. hput    sta    vc+4,x+        Store byte of header
  30.     stx    tp
  31. next    inc    bufx        Increment buffer index
  32.     bpl    getx        Branch if within buffer
  33.     inw    $30a        Increment sector number
  34.     jsr    $e453        Read sector
  35.     bmi    secrts        Exit on error
  36.     asl    bufx        Change $80 to $00
  37. getx    lda    bufr+$7f    Get byte from buffer
  38. bufx    equ    *-2        Buffer index
  39.     ldx    tp        Check if header or block data
  40.     bne    hput        Branch to store header
  41.     sta    (vc,x)        Store block data
  42.     inw    vc        Increment vector
  43.     lda    vc+2        Check if end of block reached
  44.     cmp    vc
  45.     lda    vc+3
  46.     sbc    vc+1
  47.     bcs    next        No: read next byte
  48.     mva    #3    ^2f    Yes: Reset POKEY...
  49. init    jmp    ($2e2)        ... and call init routine
  50.  
  51. text    dta    d'Loading... '
  52. txtlen    equ    *-text
  53.  
  54.     dta    c'4.0'        Unused boot sector space
  55.     ert    *<>boot+$80    Exactly 128 bytes should be used
  56.  
  57. * X-BOOT adds this block at the end of loaded file
  58. * It changes jmp ($2e2) to jmp ($2e0)
  59.     opt    h+
  60.     org    init+1
  61.     dta    l($2e0)
  62.  
  63.     end