home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_26_1988_Transactor_Publishing.d64
/
far.source
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
3KB
|
125 lines
1000 sys999
1010 ;
1020 ;power assembler (buddy)
1030 ;
1040 *= $c800
1050 ;
1060 .mem
1070 ;
1080 ;------------ far-sys ------------
1090 ;
1100 ;system routines
1110 ;
1120 chrget = $0073
1130 chr(NULL)t = $0079
1140 chkcom = $aefd
1150 frmnum = $ad8a
1160 getadr = $b7f7
1170 onebyt = $b79e
1180 ;
1190 ;---------------------------------
1200 ;
1210 farsys jmp setup
1220 farjsr jmp relay
1230 ;
1240 bank .byte 0 ;poke 0-5 here
1250 cnfg .byte 0 ;current config
1260 mask .byte 0 ;new config
1270 ;
1280 jumper jmp ($0014)
1290 ;
1300 ;table of values to 'and with 6510 port
1310 ;
1320 msktbl =*
1330 .byte 255 ;bank 0 - no change
1340 .byte 246 ;bank 1 - bas. out, kern & i/o in
1350 .byte 242 ;bank 2 - bas. out, kern & chr. in
1360 .byte 245 ;bank 3 - bas. & kern out, i/o in
1370 .byte 241 ;bank 4 - bas. & kern out, chr. in
1380 .byte 244 ;bank 5 - all ram
1390 ;
1400 ;
1410 setup jsr twobyt ;read address from basic text
1420 : ldx bank
1430 : cpx #$06
1440 : bcc ok
1450 bad jmp $a8e3 ;display 'undef statement' if bank>5
1460 ok lda $01
1470 : sta cnfg
1480 : and msktbl,x ;mask bits appropo.
1490 : sta mask
1500 ;
1510 : jsr getargs
1520 ;
1530 long jsr romsout
1540 : lda $030f ;get srreg
1550 : ora #$04 ;ensure no irq when plp
1560 : pha
1570 : lda $030c
1580 : ldx $030d
1590 : ldy $030e
1600 : plp ;as per above
1610 : jsr jumper ;goto target
1620 ;
1630 romsin php ;back here
1640 : pha ;save flags & acc.
1650 : lda cnfg
1660 : sta $01 ;roms in
1670 : pla
1680 : plp
1690 : cli
1700 : rts
1710 ;
1720 ;routine to allow 'hidden' code to call rom routines.
1730 ;assumes address in $14/15, a, x, y and sr in $030c - $030f.
1740 ;also assumes 'cnfg' restores roms and 'mask' is valid
1750 ;
1760 relay lda cnfg
1770 : sta $01 ;restore rom(s)
1780 : jsr $e136 ;part of "sys". loads regs, jmp ($0014)
1790 : jsr $e147 ;stores regs.
1800 ;
1810 romsout sei
1820 : lda mask
1830 : sta $01
1840 : rts
1850 ;
1860 ;look for comma, get expression 0 - 65535 from basic text
1870 ;
1880 twobyt jsr chkcom
1890 : jsr frmnum ;eval expression
1900 : jmp getadr ;two bytes in $14/15
1910 ;
1920 ;this routine returns with carry clear if end of statement or comma
1930 ;followed by comma, carry set and one byte in x if num. expression.
1940 ;
1950 ;
1960 combyt jsr chr(NULL)t ;current chr.
1970 : beq comexit ;end of statement
1980 : jsr chkcom ;look for comma and next chr.
1990 : cmp #$2c ;another comma"?
2000 : beq comexit ;yeah
2010 : jsr [145]ebyt ;no. [161] [197]ue
2020 : sec
2030 : rts
2040 comexit clc
2050 : rts
2060 ;
2070 ;routine [164] [135] a, x, y, [175] sr
2080 ;[197]ues from basic text.
2090 ;
2100 [161]args jsr combyt ;first param (.a)
2110 : bcc x[161] ;just a comma. [161] [130]
2120 : stx $030c ;sareg
2130 x[161] jsr combyt ;[130] param (.x)
2140 : bcc y[161]
2150 : stx $030d ;sxreg
2160 y[161] jsr combyt ;[161] .y
2170 : bcc s[161] ;a[168]her comma"?
2180 : stx $030e ;syreg
2190 sget jsr combyt ;get .sr
2200 : bcc exreg
2210 : stx $030f ;srreg
2220 exreg rts
2230 ;