home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / hf / dsp / source / load.asm < prev    next >
Encoding:
Assembly Source File  |  1991-05-05  |  1.5 KB  |  82 lines

  1.     page    132,63,3,3
  2.     opt    rc
  3. ;
  4. ;  LOAD.ASM -- Memory Image Loader
  5. ;
  6. ;  Copyright (C) 1990, 1991 by Alef Null. All rights reserved.
  7. ;  Author(s): Jarkko Vuori, OH2LNS
  8. ;  Modification(s):
  9. ;
  10.  
  11. ; after HF0 is set, host must send commandword as
  12. ;   0 - end of loading
  13. ;   1 - next block to P memory
  14. ;   2 - next block to X memory
  15. ;   3 - next block to Y memory
  16.  
  17.  
  18.     nolist
  19.     include 'intequlc.asm'
  20.     include 'ioequlc.asm'
  21.     list
  22.  
  23.  
  24. ; Reset vector
  25.     org    p:i_reset
  26.  
  27. ; mask interrupts
  28.     ori    #$03,mr
  29.  
  30. ; copy loader code to upper memory
  31.     clr    b    #<codesrc,r0
  32.     move        #codedest,r1
  33.     do    #codelen,endcopy
  34.     move        p:(r0)+,x0
  35.     move        x0,p:(r1)+
  36. endcopy
  37.     jmp    codedest
  38.  
  39.  
  40. ; actually in the load image, loader code resides here
  41. codesrc
  42.  
  43.  
  44. ; and it must be copied to here
  45.     org    p:$11e0
  46. codedest
  47.  
  48.  
  49. ; check host flag
  50. loop    jclr    #m_hf0,x:m_hsr,cont
  51.  
  52. ; host flag set, check what the host wants to do
  53.     jclr    #m_hrdf,x:m_hsr,*            ; wait for cmd word
  54.     movep        x:m_hrx,a            ; read it
  55.     tst    a    #0,r0
  56.     jeq    boot
  57.     jmp    loop
  58.  
  59. ; read and store given databyte
  60. cont    jclr    #m_hrdf,x:m_hsr,loop            ; wait for cmd word
  61.     move        #1,b1                ; check what to do for it
  62.     cmp    b,a    #2,b1
  63.     jeq    toP
  64.     cmp    b,a
  65.     jeq    toX
  66.     movep        x:m_hrx,y:(r0)+
  67.     jmp    loop
  68. toX    movep        x:m_hrx,x:(r0)+
  69.     jmp    loop
  70. toP    movep        x:m_hrx,p:(r0)+
  71.     jmp    loop
  72.  
  73. ; exit from the loader
  74. boot    movec        #2,omr                ; set operating mode to 2
  75.     andi    #$0,ccr                 ; clear SR as if RESET
  76.     jmp    i_reset                 ; start fetching from P:$0000
  77.  
  78. codelen equ    *-codedest
  79.  
  80.  
  81.     end
  82.