home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
_
/
6502xass
/
!6502-XAss
/
Docs
/
Sources
/
Trans-Run
< prev
Wrap
Text File
|
1995-12-23
|
4KB
|
144 lines
;**************************************
;* Trans-Run *
;* *
;* press <restore> on C-64 to receive *
;* and start a program from *
;* 6502/6510 XAss *
;* *
;* ©1995 by Skoe of Expression *
;**************************************
!base = $cf00 ; first run this program with "SYS xxxxx",
; now you can press <restore> if you want to test a program
!start = $c000 ; transfered program will be started with "JMP start"
!bsout = $ffd2 ; print char
!vic_init = $e5a0 ; reset vic
!sound_vol = $d418 ; to avoid noise
; Format of transfered data:
; --------------------------
;
; byte meaning
; 0 always 0 \
; 1 always 255 / mark for start
; 4 start address low
; 5 start address high
; 6 end address low
; 7 end address high
; 8 start address low \
; 9 start address high \ to be
; 10 end address low / sure...
; 11 end address high /
; 12... datas
!DDRB = $dd03
!PRB = $dd01
!PRA = $dd00
!wait1ms=$eeb3
lda #<nmi
sta $0318
lda #>nmi
sta $0319
rts
.nmi
lda #0
sta DDRB ; all pins input
sta sound_vol ; silence
lda PRA
and #252
ora #3
sta PRA ; video bank
jsr vic_init
.waitstart_a
dec $d020
jsr getbyte
cmp #0
bne waitstart_a
.waitstart_b
dec $d020
jsr getbyte
cmp #$ff
bne waitstart_b
jsr getbyte
sta startaddress+1
jsr getbyte
sta startaddress+2
jsr getbyte
sta endlo+1
jsr getbyte
sta endhi+1
jsr getbyte
cmp startaddress+1
bne error
jsr getbyte
cmp startaddress+2
bne error
jsr getbyte
cmp endlo+1
bne error
jsr getbyte
cmp endhi+1
bne error
ldx #0
.mainloop
jsr getbyte
sta $d020
stx $d020
.startaddress
sta $ffff
inc startaddress+1
bne nohiinc
inc startaddress+2
.nohiinc
lda startaddress+2
.endhi
cmp #0
bne nocmplo
lda startaddress+1
.endlo
cmp #0
beq endtransfer
.nocmplo
jmp mainloop
.endtransfer
lda #$37 ; use your $01 value here
sta z,1
lda #15
sta $d020
jmp start ; it's ugly to "leave" an nmi
; by using jmp...
; ------------------------------
.error
ldx #0
.err_1
lda err_text,x
beq err_end
jsr bsout
inx
jmp err_1
.err_end
lda PRB ; empty port buffer
jmp err_end
.err_text
/tx "?transfer error_try again!_°" ; '°' is #0, '_' is #13
; ------------------------------
.getbyte
jsr wait1ms ; C64 must be slower than Archi
; (one way handshaking)
; you can try to use a DEX-loop
; instead of "wait1ms"
; this version is about 1 kB/sec.
; fast
lda PRB
rts