2013-05-09 11:56:54 +00:00
|
|
|
.include "lynx.inc"
|
|
|
|
.include "extzp.inc"
|
|
|
|
.interruptor _UpLoaderIRQ
|
|
|
|
.export __UPLOADER__: absolute = 1
|
2011-04-06 19:54:55 +00:00
|
|
|
|
|
|
|
load_len=_FileDestAddr
|
|
|
|
load_ptr=_FileFileLen
|
|
|
|
load_ptr2=_FileCurrBlock
|
|
|
|
|
|
|
|
.segment "UPCODE"
|
|
|
|
|
|
|
|
ComLynxReadAndExec:
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #4
|
2011-04-06 19:54:55 +00:00
|
|
|
loop0:
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr read_byte
|
|
|
|
sta load_len-1,y
|
|
|
|
dey
|
|
|
|
bne loop0 ; get destination and length
|
2011-04-06 19:54:55 +00:00
|
|
|
tax ; lowbyte of length
|
|
|
|
|
|
|
|
lda load_ptr
|
|
|
|
sta load_ptr2
|
|
|
|
lda load_ptr+1
|
|
|
|
sta load_ptr2+1
|
|
|
|
|
|
|
|
loop1:
|
2013-05-09 11:56:54 +00:00
|
|
|
inx
|
2011-04-06 19:54:55 +00:00
|
|
|
bne cont1
|
|
|
|
inc load_len+1
|
|
|
|
bne cont1
|
|
|
|
jmp (load_ptr)
|
|
|
|
|
|
|
|
cont1:
|
2013-05-09 11:56:54 +00:00
|
|
|
jsr read_byte
|
2011-04-06 19:54:55 +00:00
|
|
|
sta (load_ptr2),y
|
|
|
|
sta PALETTE ; feedback ;-)
|
|
|
|
iny
|
2013-05-09 11:56:54 +00:00
|
|
|
bne loop1
|
|
|
|
inc load_ptr2+1
|
|
|
|
bra loop1
|
2011-04-06 19:54:55 +00:00
|
|
|
|
|
|
|
read_byte:
|
|
|
|
bit SERCTL
|
|
|
|
bvc read_byte
|
|
|
|
lda SERDAT
|
|
|
|
rts
|
|
|
|
|
|
|
|
_UpLoaderIRQ:
|
2013-05-09 11:56:54 +00:00
|
|
|
lda INTSET
|
|
|
|
and #$10
|
|
|
|
bne @L0
|
|
|
|
clc
|
|
|
|
rts
|
2011-04-06 19:54:55 +00:00
|
|
|
@L0:
|
|
|
|
lda SERDAT ; wait for the start sequence
|
|
|
|
bit flag ; already seen $81 ?
|
|
|
|
bpl again ; >= 0 => no
|
|
|
|
cmp #$50 ; "P" ?
|
|
|
|
bne again ; not correct, so clear flag
|
2013-05-09 11:56:54 +00:00
|
|
|
sei
|
2011-04-06 19:54:55 +00:00
|
|
|
jmp ComLynxReadAndExec
|
|
|
|
|
|
|
|
again:
|
2013-05-09 11:56:54 +00:00
|
|
|
stz flag
|
2011-04-06 19:54:55 +00:00
|
|
|
cmp #$81
|
|
|
|
bne exit
|
|
|
|
sta flag
|
|
|
|
;
|
|
|
|
; last action : clear interrupt
|
|
|
|
;
|
|
|
|
exit:
|
2013-05-09 11:56:54 +00:00
|
|
|
clc
|
2011-04-06 19:54:55 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
.segment "UPDATA"
|
|
|
|
|
|
|
|
flag:
|
2013-05-09 11:56:54 +00:00
|
|
|
.byte 0
|
2011-04-06 19:54:55 +00:00
|
|
|
|