home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_26_1988_Transactor_Publishing.d64 / far.source (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  3KB  |  125 lines

  1. 1000 sys999
  2. 1010 ;
  3. 1020 ;power assembler (buddy)
  4. 1030 ;
  5. 1040 *= $c800
  6. 1050 ;
  7. 1060 .mem
  8. 1070 ;
  9. 1080 ;------------ far-sys ------------
  10. 1090 ;
  11. 1100 ;system routines
  12. 1110 ;
  13. 1120 chrget = $0073
  14. 1130 chr(NULL)t = $0079
  15. 1140 chkcom = $aefd
  16. 1150 frmnum = $ad8a
  17. 1160 getadr = $b7f7
  18. 1170 onebyt = $b79e
  19. 1180 ;
  20. 1190 ;---------------------------------
  21. 1200 ;
  22. 1210 farsys  jmp setup
  23. 1220 farjsr  jmp relay
  24. 1230 ;
  25. 1240 bank   .byte 0 ;poke 0-5 here
  26. 1250 cnfg   .byte 0 ;current config
  27. 1260 mask   .byte 0 ;new config
  28. 1270 ;
  29. 1280 jumper  jmp ($0014)
  30. 1290 ;
  31. 1300 ;table of values to 'and with 6510 port
  32. 1310 ;
  33. 1320 msktbl =*
  34. 1330 .byte 255 ;bank 0 - no change
  35. 1340 .byte 246 ;bank 1 - bas. out, kern & i/o in
  36. 1350 .byte 242 ;bank 2 - bas. out, kern & chr. in
  37. 1360 .byte 245 ;bank 3 - bas. & kern out, i/o in
  38. 1370 .byte 241 ;bank 4 - bas. & kern out, chr. in
  39. 1380 .byte 244 ;bank 5 - all ram
  40. 1390 ;
  41. 1400 ;
  42. 1410 setup   jsr twobyt   ;read address from basic text
  43. 1420 :       ldx bank
  44. 1430 :       cpx #$06
  45. 1440 :       bcc ok
  46. 1450 bad     jmp $a8e3    ;display 'undef statement' if bank>5
  47. 1460 ok      lda $01
  48. 1470 :       sta cnfg
  49. 1480 :       and msktbl,x ;mask bits appropo.
  50. 1490 :       sta mask
  51. 1500 ;
  52. 1510 :       jsr getargs
  53. 1520 ;
  54. 1530 long    jsr romsout
  55. 1540 :       lda $030f    ;get srreg
  56. 1550 :       ora #$04     ;ensure no irq when plp
  57. 1560 :       pha
  58. 1570 :       lda $030c
  59. 1580 :       ldx $030d
  60. 1590 :       ldy $030e
  61. 1600 :       plp          ;as per above
  62. 1610 :       jsr jumper   ;goto target
  63. 1620 ;
  64. 1630 romsin  php          ;back here
  65. 1640 :       pha          ;save flags & acc.
  66. 1650 :       lda cnfg
  67. 1660 :       sta $01      ;roms in
  68. 1670 :       pla
  69. 1680 :       plp
  70. 1690 :       cli
  71. 1700 :       rts
  72. 1710 ;
  73. 1720 ;routine to allow 'hidden' code to call rom routines.
  74. 1730 ;assumes address in $14/15, a, x, y and sr in $030c - $030f.
  75. 1740 ;also assumes 'cnfg' restores roms and 'mask' is valid
  76. 1750 ;
  77. 1760 relay   lda cnfg
  78. 1770 :       sta $01   ;restore rom(s)
  79. 1780 :       jsr $e136 ;part of "sys". loads regs, jmp ($0014)
  80. 1790 :       jsr $e147 ;stores regs.
  81. 1800 ;
  82. 1810 romsout sei
  83. 1820 :       lda mask
  84. 1830 :       sta $01
  85. 1840 :       rts
  86. 1850 ;
  87. 1860 ;look for comma, get expression 0 - 65535 from basic text
  88. 1870 ;
  89. 1880 twobyt  jsr chkcom
  90. 1890 :       jsr frmnum ;eval expression
  91. 1900 :       jmp getadr ;two bytes in $14/15
  92. 1910 ;
  93. 1920 ;this routine returns with carry clear if end of statement or comma
  94. 1930 ;followed by comma, carry set and one byte in x if num. expression.
  95. 1940 ;
  96. 1950 ;
  97. 1960 combyt  jsr chr(NULL)t  ;current chr.
  98. 1970 :       beq comexit ;end of statement
  99. 1980 :       jsr chkcom  ;look for comma and next chr.
  100. 1990 :       cmp #$2c    ;another comma"?
  101. 2000 :       beq comexit ;yeah
  102. 2010 :       jsr [145]ebyt  ;no. [161] [197]ue
  103. 2020 :       sec
  104. 2030 :       rts
  105. 2040 comexit clc
  106. 2050 :       rts
  107. 2060 ;
  108. 2070 ;routine [164] [135] a, x, y, [175] sr
  109. 2080 ;[197]ues from basic text.
  110. 2090 ;
  111. 2100 [161]args jsr combyt ;first param (.a)
  112. 2110 :       bcc x[161]   ;just a comma. [161] [130]
  113. 2120 :       stx $030c  ;sareg
  114. 2130 x[161]    jsr combyt ;[130] param (.x)
  115. 2140 :       bcc y[161]
  116. 2150 :       stx $030d  ;sxreg
  117. 2160 y[161]    jsr combyt ;[161] .y
  118. 2170 :       bcc s[161]   ;a[168]her comma"?
  119. 2180 :       stx $030e  ;syreg
  120. 2190 sget    jsr combyt ;get .sr
  121. 2200 :       bcc exreg
  122. 2210 :       stx $030f  ;srreg
  123. 2220 exreg   rts
  124. 2230 ;
  125.