home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_22_1988_Transactor_Publishing.d64 / sendcode.pal (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  2KB  |  112 lines

  1. 1000 open1,8,1,"0:sendcode.obj"
  2. 1010 sys 700  ;activate pal assembler
  3. 1020 *= $9f92 ;top of memory (40850)
  4. 1030 .opt o1  ;output object file
  5. 1031 ;
  6. 1040 ; output code to serial data port
  7. 1050 ;
  8. 1060 ;this routine can be used to send
  9. 1070 ;your code to the target computer
  10. 1080 ;after it has been assembled.
  11. 1090 ;call it from your assembler
  12. 1100 ;environment and pass it the start
  13. 1110 ;and end addresses of the object
  14. 1120 ;code, e.g.  sys 40850,49152,50261
  15. 1130 ;
  16. 1140 ;the routine 'sendtosdp' sends the
  17. 1150 ;address to store (low/high)
  18. 1160 ;in the other c64 and the byte to
  19. 1170 ;store there.
  20. 1180 ;
  21. 1190 u2timalo  = $dd04
  22. 1200 u2timahi  = $dd05
  23. 1210 u2out     = $dd0c ;ser data port
  24. 1220 u2icr     = $dd0d ;interrupt ctrl
  25. 1230 u2cra     = $dd0e ;timer a ctrl
  26. 1240 output    = %01000000 ;$dd0e bit 6
  27. 1250 shiftreg  = %00001000 ;$dd0d bit 3
  28. 1260 disablall = %01111111 ;clr ints
  29. 1270 timera    = %00000001 ;$dd0e bit 0
  30. 1280 ;
  31. 1290 codeptr = $fb ;ptr to byte to send
  32. 1300 endcode = $fd ;last byte to send
  33. 1310 ;
  34. 1320 baud    = $04 ;baud rate prescaler
  35. 1330 ;
  36. 1340 ;
  37. 1360 sendcode =*
  38. 1370 jsr getparam   ;start addr in y,a
  39. 1380 sta codeptr+1
  40. 1390 sty codeptr
  41. 1400 jsr getparam   ;get end address
  42. 1410 sta endcode+1
  43. 1420 sty endcode
  44. 1430 ;
  45. 1440 sc1 =*         ;send all bytes
  46. 1450 ldy #0
  47. 1460 lda (codeptr),y;get next byte
  48. 1470 jsr sendtosdp  ;send it to port
  49. 1480 inc codeptr    ;point to next byte
  50. 1490 bne sc2
  51. 1500 inc codeptr+1
  52. 1510 sc2 =* ;end when codeptr = endcode
  53. 1520 lda codeptr
  54. 1530 cmp endcode
  55. 1540 bne sc1
  56. 1550 lda codeptr+1
  57. 1560 cmp endcode+1
  58. 1570 bne sc1
  59. 1580 rts
  60. 1590 ;
  61. 1600 ;
  62. 1610 sendtosdp =*
  63. 1620 ;send 'codeptr' pointer user port,
  64. 1630 ;followed by byte in .a
  65. 1640 sta dataout  ;byte of code to send
  66. 1650 lda codeptr  ;addr of byte to send
  67. 1660 sta dataout+2
  68. 1670 lda codeptr+1
  69. 1680 sta dataout+1
  70. 1690 ;
  71. 1700 lda #disablall
  72. 1710 sta u2icr   ;clear all interrupts
  73. 1720 ;
  74. 1730 lda #baud   ;set up timer
  75. 1740 sta u2timalo
  76. 1750 lda #0
  77. 1760 sta u2timahi
  78. 1770 ;
  79. 1780 lda #output+timera
  80. 1790 ;set up timer control register
  81. 1800 sta u2cra
  82. 1810 ;
  83. 1820 ldx #2
  84. 1830 ;send 3 bytes starting at dataout
  85. 1840 sei        ;no interrupts, please
  86. 1850 outdata =*
  87. 1860 lda dataout,x
  88. 1870 sta u2out  ;put byte on the port
  89. 1880 ;
  90. 1890 lda #shiftreg
  91. 1900 stillsdg =*
  92. 1910 ;wait until it has been sent
  93. 1920 bit u2icr
  94. 1930 beq stillsdg
  95. 1940 dex        ;send the next one
  96. 1950 bpl outdata
  97. 1960 cli        ;all 3 bytes sent
  98. 1970 ;
  99. 1980 rts
  100. 1990 ;
  101. 2020 ;
  102. 2030 getparam =*
  103. 2040 ;skip comma, get argument and put
  104. 2050 ;in y (low) and a (high)
  105. 2060 jsr $aefd
  106. 2070 jsr $ad8a
  107. 2080 jmp $b7f7
  108. 2090 ;
  109. 2091 ;
  110. 3000 dataout *=*+3
  111. 3010 ;buffer for addr and byte to send
  112.