SuperCPU Tutorial Listings - Part 5
Listing 5.1
; 65816
; absolute indexed indirect addressing
; written by Malte Mundt for GO64!
£ba $c000
cli ; keep it clear
ldx #$00
loop:
lda #$00 ; 0 chars
sta $c6 ; in keyboard buffer
key:
lda $c6 ; 1 char in?
beq key ; key pressed ?
; the jumpaddress is now taken from
; sprungtab + x
jsr (sprungtab,x)
inx ; inc x by 2
inx ; next entry
jmp loop
label1:
inc $d020
rts
label2:
inc $d021
rts
label3:
jmp $fce2 ; reset
sprungtab:
£wo label1,label2,label3
Listing 5.2
; 65816
; direct page indirect addressing
; written by Malte Mundt for GO64!
£ba $c000
sei
clc ; native mode
xce
rep #%00100000
£al ; akku 16 bit
lda #$d020 ; $fd becomes $20
sta $fd ; $fe becomes $d0
sep #%00100000
£as ; akku 8 bit
lda #$02 ; color red
sta ($fd) ; directly, no ,Y !
sec
xce ; emulation mode
cli
rts
Listing 5.3
; 65816
; trb und tsb-befehl
; written by Malte Mundt for GO64!
£ba $c000
stz $d020 ; switch to black screen
stz $d021
lda #testtext
jsr $ab1e
lda #$0f ; set extended backgr.
sta $d023 ; color
lda #$0b ; the ext.backgr.col.
sta $d024 ; modus is just for testing
lda #%01000000 ; bit 6 in $d011
tsb $d011 ; extended backgr.
; color-mode on!
stz $c6 ; 0 chars in buffer
key:
lda $c6 ; key ?
beq key
lda #%01000000 ; clear bit 6
trb $d011 ; vic back to normal
lda #$0e
sta $d020
lda #$06
sta $d021
rts
testtext:
£tx "{CLR-HOME}{BLACK}{RVS-ON}eXtEnDeD BaCkGrOuNd cOlOr"
£by 0
Assembler Code © by Malte Mundt
Partial translation and cosmetical changes by Count Zero/SCS*TRC
[ Listings Part 4 ][
Tutorial Part 5 ][ Index ][ Listings
Part 6 ]