SuperCPU Tutorial Listings - Part 1



Listing 1.1

; All of this is still Turbo Assembler Source Code 
  which you can use on non-scpu programs aswell!





         *= $1000

         sei
         sed
         lda #$99
         clc
         adc #$01
         bmi no65816
         cld

         lda #<found
         ldy #>found
         jsr $ab1e

         cli
         rts

no65816  cld

         lda #<notfound
         ldy #>notfound
         jsr $ab1e

         cli
         rts


found    .text "65816 detected!"
         .byte 0

notfound .text "6510 detected!"
         .byte 0




Listing 1.2

         *= $1000

         lda $d0bc
         asl a
         bcs nocpu

         lda #<found
         ldy #>found
         jsr $ab1e
         rts

nocpu    lda #<notfound
         ldy #>notfound
         jsr $ab1e
         rts



found    .text "super-cpu detected!"
         .byte 0

notfound .text "normal c64 detected!"
         .byte 0





Listing 1.3




         *= $1000

         lda $d0b8
         asl a
         asl a
         bcc turbo

         lda #<slow
         ldy #>slow
         jsr $ab1e
         rts

turbo    lda #<fast
         ldy #>fast
         jsr $ab1e
         rts



slow     .text "1 mhz mode"
         .byte 0

fast     .text "20 mhz mode"
         .byte 0





Listing 1.4



         *= $1000
start
         sei
         lda #$00
         sta $d020
         sta $d021

w0       lda #$33
         cmp $d012
         bne *-3

         lda $d011
         asl a
         bcs w0

         sta $d07a       ; Switch to 1 MHZ
         jsr testloop

         sta $d07b       ; Switch to 20 MHZ
         jsr testloop

         sta $d07e       ; scpu-registers on
         sta $d075       ; optimization mode
                         ; mirror only $4000-$8000
         sta $d07f       ; scpu-registers off
         jsr testloop

         sta $d07e       ; scpu-registers on
         sta $d077       ; optimization off
         sta $d07f       ; scpu-registers off
         jmp start


testloop dec $d020

         ldx #$00        ; copy
transfer lda $3000,x     ; $3000-$3300
         sta $2000,x     ; to $2000 for
         lda $3100,x     ; testing
         sta $2100,x
         lda $3200,x
         sta $2200,x
         inx
         bne transfer
         rts


Assembler Code by Malte Mundt

Partial translation and cosmetical changes by Count Zero/SCS*TRC

[ Tutorial Part 1 ][ Index ][ Listings Part 2 ]