]> git.sur5r.net Git - cc65/commitdiff
Added support for the CBM510
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 13 Sep 2001 21:47:10 +0000 (21:47 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 13 Sep 2001 21:47:10 +0000 (21:47 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@915 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/Makefile
libsrc/cbm510/Makefile
libsrc/cbm510/break.s [new file with mode: 0644]
libsrc/cbm510/io.inc [new file with mode: 0644]
libsrc/cbm510/kplot.s [new file with mode: 0644]

index ead19fc06b039665ef676ab36b8382b816e1d5ac..a9864613e453bf707bc99a3100e0eb4bac3e3dd7 100644 (file)
@@ -15,6 +15,7 @@ ALLTARGETS =  apple2lib       \
                atarilib        \
                c64lib          \
                c128lib         \
+               cbm510lib       \
                cbm610lib       \
                geoslib         \
                petlib          \
@@ -107,6 +108,22 @@ cbm610lib:
            $(AR) a cbm610.lib $$i/*.o;\
        done
 
+#-----------------------------------------------------------------------------
+# Commdore P500 / CBM 5x0
+
+cbm510lib:
+       for i in cbm510 cbm common runtime conio dbg; do \
+           CC=$(CC) \
+           AS=$(AS) \
+           CFLAGS="-Osir -g -t cbm510 -I../../include" \
+           AFLAGS="-t cbm510" \
+           $(MAKE) -C $$i || exit 1; \
+       done
+       mv cbm510/crt0.o cbm510.o
+       for i in cbm510 cbm common runtime conio dbg; do \
+           $(AR) a cbm510.lib $$i/*.o;\
+       done
+  
 #-----------------------------------------------------------------------------
 # GEOS on the C64/128
 
index ea51689c802c939fd8527dad1355a502405b2d27..aceeffcac3fbf0a9dc115bfc0d94a5546025cd51 100644 (file)
@@ -15,18 +15,14 @@ OBJS =      _scrsize.o      \
        banking.o       \
                break.o         \
                cgetc.o         \
-       clrscr.o        \
-               color.o         \
-               cputc.o         \
-               crt0.o          \
-               crtc.o          \
-               kbhit.o         \
-               kirq.o          \
-               kplot.o         \
+               color.o         \
+               crt0.o          \
+               kbhit.o         \
+               kirq.o          \
+               kplot.o         \
        kscnkey.o       \
-       kudtim.o        \
-       pokesys.o       \
-       rs232.o
+       kudtim.o        \
+       pokesys.o
 
 all:   $(OBJS)
 
diff --git a/libsrc/cbm510/break.s b/libsrc/cbm510/break.s
new file mode 100644 (file)
index 0000000..cf5332a
--- /dev/null
@@ -0,0 +1,117 @@
+;
+; Ullrich von Bassewitz, 27.09.1998
+;
+; void set_brk (unsigned Addr);
+; void reset_brk (void);
+;
+
+               .export         _set_brk, _reset_brk
+               .export         _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
+       .import         _atexit
+
+       .include        "zeropage.inc"
+       .include        "page3.inc"
+
+
+.bss
+_brk_a:                .res    1
+_brk_x:                .res    1
+_brk_y:                .res    1
+_brk_sr:       .res    1
+_brk_pc:       .res    2
+_brk_01:       .res    1
+
+oldvec:        .res    2               ; Old vector
+
+
+.data
+uservec:       jmp     $FFFF           ; Patched at runtime
+
+
+.code
+
+; Set the break vector
+.proc  _set_brk
+
+       sta     uservec+1
+       stx     uservec+2       ; Set the user vector
+
+       lda     oldvec
+       ora     oldvec+1        ; Did we save the vector already?
+               bne     L1              ; Jump if we installed the handler already
+
+       lda     BRKVec
+       sta     oldvec
+       lda     BRKVec+1
+       sta     oldvec+1        ; Save the old vector
+
+L1:    lda     #<brk_handler   ; Set the break vector to our routine
+       ldx     #>brk_handler
+       sta     BRKVec
+       stx     BRKVec+1
+       rts
+
+.endproc
+
+
+; Reset the break vector
+.proc  _reset_brk
+
+       lda     oldvec
+       ldx     oldvec+1
+       beq     @L9             ; Jump if vector not installed
+       sta     BRKVec
+       stx     BRKVec+1
+       lda     #$00
+       sta     oldvec          ; Clear the old vector
+       stx     oldvec+1
+@L9:   rts
+
+.endproc
+
+
+
+; Break handler, called if a break occurs
+
+.proc  brk_handler
+
+       pla
+       sta     _brk_y
+       pla
+       sta     _brk_x
+       pla
+       sta     _brk_a
+       pla
+       and     #$EF            ; Clear break bit
+       sta     _brk_sr
+       pla                     ; PC low
+       sec
+       sbc     #2              ; Point to start of brk
+       sta     _brk_pc
+       pla                     ; PC high
+       sbc     #0
+       sta     _brk_pc+1
+       lda     IndReg
+       sta     _brk_01
+       lda     ExecReg
+       sta     IndReg
+
+       jsr     uservec         ; Call the user's routine
+
+       lda     _brk_01
+       sta     IndReg
+
+       lda     _brk_pc+1
+       pha
+       lda     _brk_pc
+       pha
+       lda     _brk_sr
+       pha
+       ldx     _brk_x
+       ldy     _brk_y
+       lda     _brk_a
+       rti                     ; Jump back...
+
+.endproc
+
+
diff --git a/libsrc/cbm510/io.inc b/libsrc/cbm510/io.inc
new file mode 100644 (file)
index 0000000..fcd6829
--- /dev/null
@@ -0,0 +1,154 @@
+;
+; I/O definitions for the CBM 510
+;
+; Taken from a kernal disassembly done by myself in 2000/2001.
+;
+; Ullrich von Bassewitz, 13.09.2001
+
+
+; I/O  $d800: VIC
+
+VIC_SPR0_X             = $00
+VIC_SPR0_Y             = $01
+VIC_SPR1_X             = $02
+VIC_SPR1_Y             = $03
+VIC_SPR2_X             = $04
+VIC_SPR2_Y             = $05
+VIC_SPR3_X             = $06
+VIC_SPR3_Y             = $07
+VIC_SPR4_X             = $08
+VIC_SPR4_Y             = $09
+VIC_SPR5_X             = $0A
+VIC_SPR5_Y             = $0B
+VIC_SPR6_X             = $0C
+VIC_SPR6_Y             = $0D
+VIC_SPR7_X             = $0E
+VIC_SPR7_Y             = $0F
+VIC_SPR_HI_X           = $10
+VIC_SPR_ENA            = $15
+VIC_SPR_EXP_X          = $17
+VIC_SPR_EXP_Y          = $1D
+VIC_SPR_MCOLOR         = $1C
+VIC_SPR_BG_PRIO = $1B
+
+VIC_SPR_MCOLOR0 = $25
+VIC_SPR_MCOLOR1 = $26
+
+VIC_SPR0_COLOR         = $27
+VIC_SPR1_COLOR         = $28
+VIC_SPR2_COLOR         = $29
+VIC_SPR3_COLOR         = $2A
+VIC_SPR4_COLOR         = $2B
+VIC_SPR5_COLOR         = $2C
+VIC_SPR6_COLOR         = $2D
+VIC_SPR7_COLOR         = $2E
+
+VIC_CTRL1              = $11
+VIC_CTRL2              = $16
+
+VIC_HLINE              = $12
+
+VIC_VIDEO_ADR          = $18
+
+VIC_IRR                = $19           ; Interrupt request register
+VIC_IMR                = $1A           ; Interrupt mask register
+
+VIC_BORDERCOLOR = $20
+VIC_BG_COLOR0          = $21
+VIC_BG_COLOR1          = $22
+VIC_BG_COLOR2          = $23
+VIC_BG_COLOR3          = $24
+
+
+
+; I/O  $da00: SID 6581
+
+;      sid             =       $da00
+
+       Osc1            =       $00
+       Osc2            =       $07
+       Osc3            =       $0e
+
+       FreqLo          =       $00
+       FreqHi          =       $01
+       PulseF          =       $02
+       PulseC          =       $03
+       OscCtl          =       $04
+       AtkDcy          =       $05
+       SusRel          =       $06
+
+       FiCtlLo         =       $15
+       FiCtlHi         =       $16
+       Resonance       =       $17
+       Volume          =       $18
+       PotX            =       $19
+       PotY            =       $1A
+       Random          =       $1B
+       Env3            =       $1C
+
+
+
+; I/O  $db00: CIA 6526 Inter Process Communication
+
+;      IPCcia          =       $db00
+
+       PortA           =       $00
+       PortB           =       $01
+       DDRA            =       $02
+       DDRB            =       $03
+       TimALo          =       $04
+       TimAHi          =       $05
+       TimBLo          =       $06
+       TimBHi          =       $07
+       TOD10           =       $08
+       TODsec          =       $09
+       TODmin          =       $0A
+       TODhour         =       $0B
+       SerDataReg      =       $0C
+       IntCtrReg       =       $0D
+       CtrlA           =       $0E
+       CtrlB           =       $0F
+
+
+
+; I/O  $dc00: CIA 6526
+
+;      cia             =       $dc00
+
+
+
+; I/O  $dd00: ACIA 6551
+
+;      acia            =       $dd00
+
+       ADataReg        =       $00
+       AStatusReg      =       $01
+       ACmdReg         =       $02
+       ACtrlReg        =       $03
+
+
+
+; I/O  $de00: Triport #1 6525
+
+;      tpi1            =       $de00
+
+       tpiPortA        =       $00
+       tpiPortB        =       $01
+       tpiPortC        =       $02
+       tpiIntLatch     =       $02
+       tpiDDRA         =       $03
+       tpiDDRB         =       $04
+       tpiDDRC         =       $05
+       tpiIntMask      =       $05
+       tpiCtrlReg      =       $06
+       tpiActIntReg    =       $07
+
+
+
+; I/O  $df00: Triport #2 6525
+
+;      tpi2            =       $df00
+
+
+
+
diff --git a/libsrc/cbm510/kplot.s b/libsrc/cbm510/kplot.s
new file mode 100644 (file)
index 0000000..552759f
--- /dev/null
@@ -0,0 +1,79 @@
+;
+; Ullrich von Bassewitz, 13.09.2001
+;
+; PLOT routine for the 510.
+;
+
+       .export         k_plot
+       .importzp       crtc
+
+       .include        "zeropage.inc"
+
+
+.proc  k_plot
+
+       bcc     set
+       ldx     CURS_Y
+       ldy     CURS_X
+       rts
+
+set:           stx     CURS_Y
+       sty     CURS_X
+       
+.if    0
+       lda     LineLSBTab,x
+       sta     CharPtr
+       lda     LineMSBTab,x
+       sta     CharPtr+1
+
+       lda     IndReg
+       pha
+       lda     #$0F
+       sta     IndReg
+
+       ldy     #$00
+       clc
+       sei
+       sta     (crtc),y
+       lda     CharPtr
+       adc     CURS_X
+       iny
+       sta     (crtc),y
+       dey
+       lda     #$0E
+       sta     (crtc),y
+       iny
+       lda     (crtc),y
+       and     #$F8
+       sta     sedt1
+       lda     CharPtr+1
+       adc     #$00
+       and     #$07
+       ora     sedt1
+       sta     (crtc),y
+       cli
+
+       pla
+       sta     IndReg
+.endif 
+       rts
+.endproc
+
+; -------------------------------------------------------------------------
+; Low bytes of the start address of the screen lines
+
+.rodata
+
+LineLSBTab:
+        .byte   $00,$50,$A0,$F0,$40,$90,$E0,$30
+        .byte   $80,$D0,$20,$70,$C0,$10,$60,$B0
+        .byte   $00,$50,$A0,$F0,$40,$90,$E0,$30
+        .byte   $80
+; -------------------------------------------------------------------------
+; High bytes of the start address of the screen lines
+
+LineMSBTab:
+        .byte   $D0,$D0,$D0,$D0,$D1,$D1,$D1,$D2
+        .byte   $D2,$D2,$D3,$D3,$D3,$D4,$D4,$D4
+        .byte   $D5,$D5,$D5,$D5,$D6,$D6,$D6,$D7
+        .byte   $D7