SuperCPU Tutorial Listings - Part 3
Listing 3.1
; Example Transfer between two registers
; of different size.
; 16 Bit accu to 8 Bit index
£ba $c000
sei
clc ; clear carry
xce ; native mode
rep #$20 ; akku to 16 bit
£al ; tell assembler
sep #$10 ; index-reg. to 8 bit
£rs
lda data ;hole 16bit-wert
tay ; transfer to y
rep #$10 ;index-reg. auf 16 bit
sty data2 ;16bit-wert speichern
sec ; set carry
xce ; emulation-mode
cli
rts
data:
£wo $ff33
data2:
£wo $0000
Listing 3.2
; Example Accu-Mode-Switching
; and Consequences
£ba $c000
sei
clc ; clear carry
xce ; native mode
rep #$20 ; accu to 16 bit
£al ; tell assembler
lda data16 ; get 16 bit-value
sep #$20 ; accu to 8 bit
£as ; tell assembler
lda data8 ; get 8 bit-value
rep #$20 ; accu back to 16 bit
£al ; tell assembler
sta result ; store 16 bit
sec ; set carry
xce ; emulation mode
cli
rts
data16:
£wo $7fff
data8:
£by $33
result:
£wo $0000
Listing 3.3
; Example Transfer
; 16 Bit index-register to 8 Bit accu
£ba $c000
sei
clc ; clear carry
xce ; go native
rep #$30 ; a&x/y to 16 bit
£al ; tell assembler
£rl
ldy data16 ; get 16 bit-value
lda data2
sep #$20 ; accu to 8 bit
tya ; y->a
rep #$20 ; akku back to 16 bit
sta result
sec ; set carry
xce ; emulation-mode
cli
rts
data16:
£wo $7fff
data2:
£wo $3344
result:
£wo $0000
Listing 3.4
; Example Transfer
; 8 Bit Accu to 16 Bit Index-Register
£ba $c000
sei
clc ; clear carry
xce ; native mode
rep #$30 ; a&x/y to 16 bit
£al ; tell assembler
£rl
lda data16 ; get 16bit-value
ldy data2
sep #$20 ; accu to 8 bit
tay ; a->y
sty result
sec ; set carry
xce ; emulation-mode
cli
rts
data16:
£wo $7fff
data2:
£wo $3344
result:
£wo $0000
Listing 3.5
; Example Transfer
; 8 Bit Index-Register to 16 Bit Accu
£ba $c000
sei
clc ; clear carry
xce ; native mode
sep #$10 ; index-reg. to 8 bit
£rs
rep #$20 ; accu to 16 bit
£al
lda data16 ; get 16bit-value
ldy data8
tya ; y->a , 8 -> 16
sta result ; store 16 bit result
sec ; set carry
xce ; emulation-mode
cli
rts
data16:
£wo $7fff
data8:
£by $33
result:
£wo $0000
Assembler Code © by Malte Mundt
Partial translation and cosmetical changes by Count Zero/SCS*TRC
[ Listings Part 2 ][
Tutorial Part 3 ][ Index ][ Listings
Part 4 ]