;------------------------------------------ ; ; 1551USB Function-ROM Lo ; ; 20.02.2017 ; ; version 0.1 ; ; replacement for the 3plus1 Lo-ROM ; ; Compiler: ACME ; ;----------------------------------------- ; ; zeropage storage ; ;-------------------------------------- p_lo = $d0 ; pointer lo p_hi = $d1 ; pointer hi blocks = $d2 t_lo = $d4 t_hi = $d5 s_lo = $d6 s_hi = $d7 ;----------------------------------------- ; ; I/O addresses ; ;-------------------------------------- ; drive 9 ; TIA 6523 porta = $fec0 ; data port portb = $fec1 ; pb0: st0 ; pb1: st1 portc = $fec2 ; pc6: ack ; pc7: dav ddra = $fec3 ddrb = $fec4 ddrc = $fec5 !to"funcrom_l.crt",plain ; ,cbm for prg-file *=$8000 JMP init modstart: JMP start !by $0c,$43,$42,$4d ; module-nr., "CBM" !scr "SYS1525: 1551USB" !by $00,$20,$20,$20 !scr "1551USB ON KEY F" !by $00,$20 ;----------------------------------------- ; ; Cartridge Jump-in for sysline ; ;-------------------------------------- copybytes: ldx #$05 lda #$80 ; cart_start hi sta $05F1 lda #$03 ; cart_start lo ; $8003 sta $05F0 sta $05F4 lda $FB jmp $FCFA ; ->$fc89 longjump ;----------------------------------------- ; ; Setup Banking, Sys-Line and F-Key ; ;-------------------------------------- init: ldy #$00 sty $D9 lda #$01 ; $01 internal function rom, $02 for extern sta $7FFF and #$03 tax sta $FDD0,X ; banking cmp #$01 beq + iny lda $055F sta $D9 + sty $D8 tya beq + ldy #$35 + ldx #$00 ; copy jump in - lda copybytes,X sta $05F5,Y iny inx cpx #$14 bcc - L_8072: ldx $D8 lda #$12 cmp $055F,X beq L_80A1 bcc L_8090 ldy #$7E - lda $0567,Y sta $0568,Y dey cpy $D9 bpl - inc $055F,X jmp L_8072 L_8090: ldy $D9 - lda $0568,Y sta $0567,Y iny bpl - dec $055F,X jmp L_8072 L_80A1: ldx $D9 ldy #$00 - lda $800A,Y ; get "SYS1525: 1551USB " sta $0567,X inx iny cpy #$12 bcc - ldx $D8 beq + ldy $D9 lda #$37 sta $056C,Y lda #$38 sta $056D,Y lda $FB sta $062B + ldx #$00 - lda $801D,X ; get "1551USB ON KEY F " beq + jsr $FFD2 inx bne - + lda $D8 clc adc #$31 jsr $FFD2 ; print 1 lda #$0D jmp $FFD2 ; cr rts ;----------------------------------------- ; ; New IRQ to cartridge ; ;-------------------------------------- start: sei lda #$01 ; $01 internal function rom, $02 for extern pha and #$03 tax sta $FDD0,x jsr $FF84 ; Initialize I/O devices jsr $FF87 ; RAM Test pla sta $FB jsr $FF8A ; Restore vectors to initial values jsr $FF81 ; Initialize screen editor lda #<cartridge ; cartridge jump in sta $02FE lda #>cartridge sta $02FF lda #$F1 ; irq -> banking-routines sta $0314 lda #$FC sta $0315 cli jmp * ;----------------------------------------- ; ; Program for the rom ; ;-------------------------------------- cartridge: lda #$ff sta $FF0C sta $FF0D ; hide cursor ldx #$00 lda #$73 - sta $0800,x sta $0900,x sta $0a00,x sta $0b00,x inx bne - lda #$a3 sta $ff15 sta $ff19 lda #$00 tax tay sta ddrb sta t_lo lda #<mainscreen sta s_lo lda #>mainscreen sta s_hi lda #$0c sta t_hi -- ldy #$00 - lda (s_lo),y sta (t_lo),y iny bne - inc s_hi inc t_hi inx cpx #$04 bne -- ldx #$00 lda portb cmp #$03 bne notfound ldx #$00 - lda interface+4,x ; interface found sta $0c00+222,x inx cpx #$07 bne - beq + notfound: lda interface,x ; interface not found sta $0c00+222,x inx cpx #$0b bne notfound + key: lda #$7f ; keyboard scanner sta $fd30 sta $ff08 lda $ff08 cmp #$fe ; "1" 32k+ loader beq _32kloader cmp #$f7 ; "2" exit beq exit bne key exit: jmp cart_exit ;----------------------------------------- ; ; copy trampoline-code ; ;-------------------------------------- _32kloader: sei ldx #$00 - lda $9000,x ; copy loader sta $0333,x inx cpx #$ba bne - cart_exit: ldx #$00 ; cart off -- lda $9100,x sta $7f00,x inx cpx #$63 bne -- jmp $7f00 ;----------------------------------------- ; ; Mainscreen and text ; ;-------------------------------------- mainscreen: !scr " CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC " !scr " 1551-usb " !scr " FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF " !scr " " !scr " " !scr " usb-interface: " !scr " " !scr " CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC " !scr " " !scr " " !scr " (1) 32k+ loader (sys819) " !scr " " !scr " (2) exit " !scr " " !scr " " !scr " " !scr " " !scr " " !scr " " !scr " " !scr " " !scr " " !scr " CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC " !scr " " !scr " version 0.1 http://www.cbmhardware.de " interface: !scr "not found !" ;----------------------------------------- ; ; Loader for Tapebuffer ; ;-------------------------------------- *=$9000 ; start sys819 ;*=$0333 sei lda #%01000000 sta ddrc and #$00 sta portc sta ddra sta ddrb tay tax lda portb cmp #$03 beq idler jmp eot ; interface not found and quit idler: ldx #$00 idle: lda portc cmp #$80 bne idle load: lda porta ; get pointer lo sta p_lo lda #$40 sta portc ; set ack (pc6) lda #$00 sta portc ; and delete ack - lda portc cmp #$80 ; wait for dav (pc7) bne - lda porta ; get pointer hi sta p_hi lda #$40 sta portc ; set ack (pc6) asl sta portc ; and delete ack - lda portc cmp #$80 ; wait for dav (pc7) bne - lda porta ; get blocks sta blocks lda #$40 sta portc ; set ack (pc6) asl sta portc ; and delete ack - lda portc cmp #$80 ; wait for dav (pc7) bne - lda porta ; get load-addr lo sta t_lo lda #$40 sta portc ; set ack (pc6) asl sta portc ; and delete ack - lda portc cmp #$80 ; wait for dav (pc7) bne - lda porta ; get load-addr hi sta t_hi lda #$40 sta portc ; set ack (pc6) asl sta portc ; and delete ack - lda portc cmp #$80 ; wait for dav (pc7) bne - ; load prg ldy #$00 loadprg: -- lda porta ; get byte sta (t_lo),y ; save lda #$40 sta portc ; set ack (pc6) asl sta portc ; and delete ack - lda portc cmp #$80 ; wait for dav (pc7) bne - iny bne -- inx cpx blocks beq eot inc t_hi bne -- eot: jmp end end: cli rts ;----------------------------------------- ; ; Trampoline Code for ROM:off and restart Basic ; ; Tapebuffer will not be erased ; ;-------------------------------------- *=$9100 cart_off: sei lda #$00 sta $02FE sta $02FF lda #$b3 ; nativ irq sta $0314 lda #$fc sta $0315 ldx #$00 ; basic , kernal sta $FDD0,x ; function rom off stx $fb lda $fb jsr $FF84 ; Initialize I/O devices jsr $FF8A ; Restore vectors to initial values jsr $FF81 ; Initialize screen editor jsr $8117 ; restore vectors ! jsr $8000 ; start basic cli rts ;endmarker *=$bffe !by $00, $01 ; rom version
Letzte Änderung: 2019-01-04 10:09:12