home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
_
/
6502xass
/
!6502-XAss
/
Scrap
/
Source
< prev
next >
Wrap
Text File
|
1996-01-07
|
9KB
|
618 lines
!base = &c900
.install_fastload_jmp
jmp install_fastload
.decrunch_jmp
jmp decrunch
.load_jmp
jmp load
.init_disk_jmp
jmp init_disk
.reset_floppy_jmp
jmp fast_load_off
.motor_off_jmp
jmp motor_off
; -----------------------------------
.install_fastload
!ti_listen = &ffb1
!ti_unlisten = &ffae
!ti_send_sec = &ff93
!ti_iec_out = &ffa8
!d_print = &ffd2
!d_set_fls = &ffba
!d_set_nam = &ffbd
!d_open = &ffc0
!d_chkout = &ffc9
!d_clrch = &ffcc
!d_close = &ffc3
!d_input = &ffcf
!d_chkin = &ffc6
ldy #0
.tist_0
lda #8
ldx #0
jsr ti_listen
lda #&6f
jsr ti_send_sec
lda #77
jsr ti_iec_out
lda #45
jsr ti_iec_out
lda #87 ; "m-w"
jsr ti_iec_out
tya
jsr ti_iec_out ; Lowbyte der Adresse
lda #&04
jsr ti_iec_out ; Hibyte
lda #&1e
jsr ti_iec_out ; Menge
.tist_1
lda floppy_code,y
jsr ti_iec_out
iny
inx
cpx #&1e
bne tist_1
jsr ti_unlisten
cpy #230
bcc tist_0
lda #1
ldx #8
ldy #15
jsr d_set_fls
lda #4
ldx #<ts_bef
ldy #>ts_bef
jsr d_set_nam
jsr d_open
jsr d_clrch
ldx #50
.ti_wait
jsr &eeb3
dex
bne ti_wait
rts
.ts_bef
/tx "m-e"
/by 0,4
; -----------------------------------
; - Floppy - Routinen -
; -----------------------------------
.floppy_code
!block_mem = &0300
sei
lda &1c00
and #&ff - &08
sta &1c00 ; LED aus
lda #&1a
sta &1c07 ; fast stepper
jsr &0400 + input - floppy_code
cmp #0
bne fl_0
jmp &eaa0 ; b == 0 => reset
.fl_0
bpl fl_1 ; b < 128 => tr/sec
;cmp #129
;beq fl_repeat
cmp #&ff
bne i_disk
lda #&fb ; b == 255 => Motor aus
and &1c00
sta &1c00
ldx #0
stx z,&20
dex
stx z,&3e
jmp &0400
.i_disk
lda #2 ; disk init
sta &1800
cli
jsr &d042
lda #0
sta &1800
jmp &0400
.fl_1
sta z,&06 ; tr/sec
jsr &0400 + input - floppy_code
sta z,&07
.fl_repeat
lda #0
sta &1800
.fl_read_again
lda #&80
sta z,&00
cli
.fl_2
lda z,&00
bmi fl_2 ; gelesen?
cmp #1 ; Fehler?
bne fl_read_again ; ja => nochmal
sei
;lda #0
;tay
;clc
.fl_4
;adc &0300,y
;iny
;bne fl_4
;sta &0401 + fl_sum - floppy_code
lda &1c00
ora #8
sta &1c00 ; LED an
lda #0
sta &0401 + fl_3 - floppy_code
lda #2
sta &1800
.fl_3
ldy #0
lda block_mem,y
jsr &0400 + output - floppy_code
inc &0401 + fl_3 - floppy_code
bne fl_3
.fl_sum
;lda #0
;jsr &0400 + output - floppy_code
lda #0
sta &1800
jmp &0400
; -----------------------------------
!bank_bits = &02 ; VIC bank
.output
sta &0401 + byte - floppy_code
ldx #4
.ou_1
rol &0401 + byte - floppy_code
rol
rol &0401 + byte - floppy_code
rol
and #&03
tay
lda &0400 + s_tab - floppy_code,y
.ou_2
ldy &1800
bpl ou_2
sta &1800
.ou_3
ldy &1800
bmi ou_3
dex
bne ou_1
rts
.s_tab
/by &0a, &08, &02, &00
; -----------------------------------
.input
ldx #4
.in_1
lda &1800
bpl in_1
.in_2
lda &1800
bmi in_2
lda &1800
lsr
rol &0401 + byte - floppy_code
lsr
lsr
rol &0401 + byte - floppy_code
dex
bne in_1
.byte
lda #0
rts
; -----------------------------------
.read_block
.rb_0
lda &dd00
bmi rb_0
ldy #8
.rb_1
dey
bne rb_1
.rb_2
jsr read_byte ; block lesen
sta &0400,y ; in puffer puffen
iny
bne rb_2 ; 256 Bytes
;jsr read_byte
;sta summe + 1
;lda #0
;tay
;clc
.rb_3
;adc &0400,y
;iny
;bne rb_3
.summe
;cmp #0
;beq rb_end
;lda #129
;jsr send_byte
;jmp read_block
.rb_end
;ldx #0
.r
;jsr &eeb3
;dex
;bne r
rts
; -----------------------------------
/align
.send_byte
sta s_byte
ldx #4
.sb_1
asl s_byte
rol
asl s_byte
rol
and #&03
tay
nop
nop
nop
nop ;
lda send_tab,y
sta &dd00
and #255 - 8
bit z,0
nop
nop ;
sta &dd00
dex
bne sb_1
rts
.s_byte
/by 0
.send_tab
/by &08 + bank_bits
/by &18 + bank_bits
/by &28 + bank_bits
/by &38 + bank_bits
; -----------------------------------
.read_byte
ldx #4
.ry_1
lda #&08 + bank_bits
sta &dd00
nop
nop
bit z,0
lda #&00 + bank_bits
sta &dd00
nop
nop
nop
lda &dd00
asl
rol
rol r_byte + 1
lsr
rol r_byte + 1
dex
bne ry_1
.r_byte
lda #0
rts
; -----------------------------------
.calc_addy
clc
lda &03a1
adc #252
sta &03a3
bcs add_end
ldx &03a2
dex
stx &03a4
jmp ca_2
.add_end
lda &03a2
sta &03a4
.ca_2
clc
lda &03a1
adc #250
sta &03a7
bcc add_end_2
inc &03a8
rts
.add_end_2
lda &03a2
sta &03a8
rts
; -----------------------------------
.fast_load_off
lda #0
jmp send_byte
; -----------------------------------
.motor_off
lda #255
jmp send_byte
; -----------------------------------
.init_disk
lda #254
jsr send_byte
ldx #0
.di_2
dex
bne di_2
lda &dd00
and #3
sta &dd00
.di_1
lda &dd00
bpl di_1
rts
; -----------------------------------
.set_tr_se
sty set_ts_1 + 1 ; x = trc, y = sec
txa
jsr send_byte
nop
nop
nop
nop
.set_ts_1
lda #0
jsr send_byte
lda &dd00
and #3
sta &dd00
rts
; -----------------------------------
.load
jsr calc_addy
ldx &03a5 ; start track
ldy &03a6 ; start sector
jsr set_tr_se
jsr read_block
lda &03a3
sta z,&fa
lda &03a4
sta z,&fb
ldx &0400
ldy &0401
jsr set_tr_se
ldy #4
.ld_1
lda &0400,y
sta (&fa),y
iny
bne ld_1
jsr read_block
lda &03a7
sta z,&fa
lda &03a8
sta z,&fb
.ld_2
ldx &0400
beq ld_4
ldy &0401
jsr set_tr_se
.ld_4
ldy #2
.ld_3
lda &0400,y
sta (&fa),y
iny
bne ld_3
clc
lda #254
adc z,&fa
sta z,&fa
bcc ld_5
inc z,&fb
.ld_5
ldx &0400
beq ld_end
jsr read_block
jmp ld_2
.ld_end
jsr motor_off
rts
; -------------------------------------------------------------------------
; - decruncher -
; -------------------------------------------------------------------------
; entpackt Level-crusher v1.0 speed 4 Dateien (mem => mem)
;
; Benutzung:
;
; Zieladresse: &fb / &fc pck_dest_lo / pck_dest_hi
; Start des gepackten Files: &f7 / &f8 pck_file_lo / pck_file_hi
; Ende des gepackten Files: pck_end_lo + 1 / pck_end_hi + 1
; jsr decrunch
;
; vom Packer benutzte Zeropage: &f6...&fe
!pck_dest_lo = &fb
!pck_dest_hi = &fc
!pck_file_lo = &f7
!pck_file_hi = &f8
.decrunch
lda z,&f9
sta pck_end_lo + 1
lda z,&fa
sta pck_end_hi + 1
php
tsx
stx pck_1 + 1
ldx #0
stx z,&f9
.pck_22
stx z,&fe
lda #1
jsr pck_3
bcs pck_5
.pck_7
jsr pck_3
bcs pck_6
jsr pck_3
rol
rol z,&fe
bpl pck_7
.pck_6
tax
beq pck_8
.pck_10
jsr pck_get_byte
ldy #0
sta (&fb),y
inc z,&fb
bne pck_9
inc z,&fc
.pck_9
dex
bne pck_10
.pck_8
cpx z,&fe
dec z,&fe
bcc pck_10
stx z,&fe
.pck_5
lda #1
jsr pck_3
bcc pck_11
.pck_13
jsr pck_3
bcs pck_12
jsr pck_3
rol
bcc pck_13 ; bei einem File unbedingt
.pck_11
inx
.pck_12
adc #1
sta z,&fa
txa
jsr pck_3
rol
jsr pck_3
rol
tay
lda #0
.pck_18
ldx pck_tab,y
.pck_15
jsr pck_3
rol
rol z,&fe
dex
bne pck_15
dey
bmi pck_16
cpy #3
beq pck_17
clc
adc #1
bcc pck_18
inc z,&fe
bcs pck_18
.pck_17
clc
.pck_16
adc z,&fa
bcc pck_19
inc z,&fe
.pck_19
clc