home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_22_1988_Transactor_Publishing.d64
/
sendcode.pal
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
2KB
|
112 lines
1000 open1,8,1,"0:sendcode.obj"
1010 sys 700 ;activate pal assembler
1020 *= $9f92 ;top of memory (40850)
1030 .opt o1 ;output object file
1031 ;
1040 ; output code to serial data port
1050 ;
1060 ;this routine can be used to send
1070 ;your code to the target computer
1080 ;after it has been assembled.
1090 ;call it from your assembler
1100 ;environment and pass it the start
1110 ;and end addresses of the object
1120 ;code, e.g. sys 40850,49152,50261
1130 ;
1140 ;the routine 'sendtosdp' sends the
1150 ;address to store (low/high)
1160 ;in the other c64 and the byte to
1170 ;store there.
1180 ;
1190 u2timalo = $dd04
1200 u2timahi = $dd05
1210 u2out = $dd0c ;ser data port
1220 u2icr = $dd0d ;interrupt ctrl
1230 u2cra = $dd0e ;timer a ctrl
1240 output = %01000000 ;$dd0e bit 6
1250 shiftreg = %00001000 ;$dd0d bit 3
1260 disablall = %01111111 ;clr ints
1270 timera = %00000001 ;$dd0e bit 0
1280 ;
1290 codeptr = $fb ;ptr to byte to send
1300 endcode = $fd ;last byte to send
1310 ;
1320 baud = $04 ;baud rate prescaler
1330 ;
1340 ;
1360 sendcode =*
1370 jsr getparam ;start addr in y,a
1380 sta codeptr+1
1390 sty codeptr
1400 jsr getparam ;get end address
1410 sta endcode+1
1420 sty endcode
1430 ;
1440 sc1 =* ;send all bytes
1450 ldy #0
1460 lda (codeptr),y;get next byte
1470 jsr sendtosdp ;send it to port
1480 inc codeptr ;point to next byte
1490 bne sc2
1500 inc codeptr+1
1510 sc2 =* ;end when codeptr = endcode
1520 lda codeptr
1530 cmp endcode
1540 bne sc1
1550 lda codeptr+1
1560 cmp endcode+1
1570 bne sc1
1580 rts
1590 ;
1600 ;
1610 sendtosdp =*
1620 ;send 'codeptr' pointer user port,
1630 ;followed by byte in .a
1640 sta dataout ;byte of code to send
1650 lda codeptr ;addr of byte to send
1660 sta dataout+2
1670 lda codeptr+1
1680 sta dataout+1
1690 ;
1700 lda #disablall
1710 sta u2icr ;clear all interrupts
1720 ;
1730 lda #baud ;set up timer
1740 sta u2timalo
1750 lda #0
1760 sta u2timahi
1770 ;
1780 lda #output+timera
1790 ;set up timer control register
1800 sta u2cra
1810 ;
1820 ldx #2
1830 ;send 3 bytes starting at dataout
1840 sei ;no interrupts, please
1850 outdata =*
1860 lda dataout,x
1870 sta u2out ;put byte on the port
1880 ;
1890 lda #shiftreg
1900 stillsdg =*
1910 ;wait until it has been sent
1920 bit u2icr
1930 beq stillsdg
1940 dex ;send the next one
1950 bpl outdata
1960 cli ;all 3 bytes sent
1970 ;
1980 rts
1990 ;
2020 ;
2030 getparam =*
2040 ;skip comma, get argument and put
2050 ;in y (low) and a (high)
2060 jsr $aefd
2070 jsr $ad8a
2080 jmp $b7f7
2090 ;
2091 ;
3000 dataout *=*+3
3010 ;buffer for addr and byte to send