home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_22_1988_Transactor_Publishing.d64 / xmit.mae < prev    next >
Text File  |  2023-02-26  |  5KB  |  101 lines

  1. 0020 ; copyright 1986 jack bedard
  2. 0030 .
  3. 0040 ; output assembled code to serial data port
  4. 0050 .
  5. 0060 ; there are 2 separate routines here:
  6. 0070 ; the 1st (code.swap) modifies mae to transmit assembled code
  7. 0080 ; to a 2nd c-64 via s.r. port.
  8. 0090 ; it is activated with this command from mae 'ru $8500'
  9. 0100 .
  10. 0110 ; the 2nd sends the address to store (low/high)
  11. 0120 ; in the other c64 and the byte to store there.
  12. 0130 .
  13. 0140 mae.table  .de $51       ;store address is in this table
  14. 0150 mod.adr    .de $5feb     ;my patch goes here
  15. 0160 u2.tima.lo .de $dd04
  16. 0170 u2.tima.hi .de $dd05
  17. 0180 u2.out     .de $dd0c     ;serial data port
  18. 0190 u2.icr     .de $dd0d     ;interrupt control register
  19. 0200 u2.cra     .de $dd0e     ;timer a control register
  20. 0210 output     .de %01000000 ;bit 6 in $dd0e
  21. 0220 shift.reg  .de %00001000 ;bit 3 in $dd0d
  22. 0230 disabl.all .de %01111111 ;0 in 7 causes the 1's to disable those bits
  23. 0240 timer.a    .de %00000001 ;bit 0 in $dd0e
  24. 0250 .
  25. 0260 baud       .de $04       ;the baud rate prescaler
  26. 0270 .
  27. 0280  .os
  28. 0290  .ba $8500
  29. 0300  .ce
  30. 0310 .
  31. 0320 code.swap                ;patch 'jsr sendtodsp' into mae           
  32. 0330  ldx #2                                                            
  33. 0340 mod.loop                                                           
  34. 0350  lda mod.adr,x                                                     
  35. 0360  pha                                                               
  36. 0370  lda mae.code.mod,x                                                
  37. 0380  sta mod.adr,x                                                     
  38. 0390  pla                                                               
  39. 0400  sta mae.code.mod,x                                                
  40. 0410  dex                                                               
  41. 0420  bpl mod.loop                                                      
  42. 0430  rts                                                               
  43. 0440 .                                                                  
  44. 0450 mae.code.mod             ;patch to our output routine              
  45. 0460  jsr send.to.sdp                                                   
  46. 0470 .                                                                  
  47. 0480 send.to.sdp              ;send byte from stack (under return addr) 
  48. 0490  sty save.y              ;to other 64.                             
  49. 0500  stx save.x                                                        
  50. 0510  pla                                                               
  51. 0520  sta ret.adr             ;save return address from stack           
  52. 0530  pla                                                               
  53. 0540  sta ret.adr+1                                                     
  54. 0550 .                                                                  
  55. 0560  lda mae.table,x         ;find address for byte to be sent         
  56. 0570  sta data.out+2                                                    
  57. 0580  lda mae.table+1,x                                                 
  58. 0590  sta data.out+1                                                    
  59. 0600  pla                                                               
  60. 0610  sta data.out            ;byte to send (after address)             
  61. 0620 .                                                                  
  62. 0630  lda #disabl.all         ;set up interrupt control reg             
  63. 0640  sta u2.icr                                                        
  64. 0650 .                                                                  
  65. 0660  lda #baud               ;set up timer                             
  66. 0670  sta u2.tima.lo                                                    
  67. 0680  lda #0                                                            
  68. 0690  sta u2.tima.hi                                                    
  69. 0700 .                                                                  
  70. 0710  lda #output+timer.a     ;set up timer control register            
  71. 0720  sta u2.cra                                                        
  72. 0730 .                                                                  
  73. 0740  ldx #2                  ;send the three bytes starting at dataout 
  74. 0750  sei                     ;no interrupts, please                    
  75. 0760 out.data                                                           
  76. 0770  lda data.out,x                                                    
  77. 0780  sta u2.out              ;put the byte on the output port          
  78. 0790 .                                                                  
  79. 0800 still.sending                                                      
  80. 0810  lda u2.icr              ;wait until it has been sent              
  81. 0820  and #shift.reg                                                    
  82. 0830  beq still.sending                                                 
  83. 0840  dex                     ;send the next one                        
  84. 0850  bpl out.data                                                      
  85. 0860  cli                     ;all sent                                 
  86. 0870 .                                                                  
  87. 0880  lda ret.adr+1           ;put return address back on the stack     
  88. 0890  pha
  89. 0900  lda ret.adr
  90. 0910  pha
  91. 0920  ldx save.x
  92. 0930  ldy save.y
  93. 0940  rts
  94. 0950 .
  95. 0960 save.x .ds 1
  96. 0970 save.y .ds 1
  97. 0980 ret.adr .ds 2
  98. 0990 data.out .ds 3
  99. 1000 .
  100. 1010  .en
  101.