implemented asm for lsr array values

This commit is contained in:
Irmen de Jong 2020-04-02 23:33:07 +02:00
parent 2c59cbdece
commit 15e8e0bf6d
2 changed files with 169 additions and 24 deletions

View File

@ -1810,19 +1810,81 @@ lsl_array_w .proc
.pend .pend
lsr_array_ub .proc lsr_array_ub .proc
.warn "lsr_array_ub" ; TODO ; -- lsr a ubyte in an array (index and array address on stack)
inx
ldy c64.ESTACK_LO,x
inx
lda c64.ESTACK_LO,x
sta c64.SCRATCH_ZPWORD1
lda c64.ESTACK_HI,x
sta c64.SCRATCH_ZPWORD1+1
lda (c64.SCRATCH_ZPWORD1),y
lsr a
sta (c64.SCRATCH_ZPWORD1),y
rts
.pend .pend
lsr_array_b .proc lsr_array_b .proc
.warn "lsr_array_b" ; TODO ; -- lsr a byte in an array (index and array address on stack)
inx
ldy c64.ESTACK_LO,x
inx
lda c64.ESTACK_LO,x
sta c64.SCRATCH_ZPWORD1
lda c64.ESTACK_HI,x
sta c64.SCRATCH_ZPWORD1+1
lda (c64.SCRATCH_ZPWORD1),y
asl a
lda (c64.SCRATCH_ZPWORD1),y
ror a
sta (c64.SCRATCH_ZPWORD1),y
rts
.pend .pend
lsr_array_uw .proc lsr_array_uw .proc
.warn "lsr_array_uw" ; TODO ; -- lsr a uword in an array (index and array address on stack)
inx
lda c64.ESTACK_LO,x
asl a
tay
inx
lda c64.ESTACK_LO,x
sta c64.SCRATCH_ZPWORD1
lda c64.ESTACK_HI,x
sta c64.SCRATCH_ZPWORD1+1
iny
lda (c64.SCRATCH_ZPWORD1),y
lsr a
sta (c64.SCRATCH_ZPWORD1),y
dey
lda (c64.SCRATCH_ZPWORD1),y
ror a
sta (c64.SCRATCH_ZPWORD1),y
rts
.pend .pend
lsr_array_w .proc lsr_array_w .proc
.warn "lsr_array_w" ; TODO ; -- lsr a uword in an array (index and array address on stack)
inx
lda c64.ESTACK_LO,x
asl a
tay
inx
lda c64.ESTACK_LO,x
sta c64.SCRATCH_ZPWORD1
lda c64.ESTACK_HI,x
sta c64.SCRATCH_ZPWORD1+1
iny
lda (c64.SCRATCH_ZPWORD1),y
asl a
lda (c64.SCRATCH_ZPWORD1),y
ror a
sta (c64.SCRATCH_ZPWORD1),y
dey
lda (c64.SCRATCH_ZPWORD1),y
ror a
sta (c64.SCRATCH_ZPWORD1),y
rts
.pend .pend
rol_array_ub .proc rol_array_ub .proc

View File

@ -9,35 +9,118 @@ main {
uword uw uword uw
&ubyte membyte=9999 &ubyte membyte=9999
&uword memword=9999 &uword memword=9999
ubyte[] ubarray = [8,8,8] ubyte[] ubarray = [8,%10011100,8]
uword[] uwarray = [8200, 8200, 8200] uword[] uwarray = [8200, %1001110011110001, 8200]
byte[] bbarray = [8,8,8] byte[] bbarray = [8,-%01011100,8]
word[] wwarray = [8200, 8200, 8200] word[] wwarray = [8200, -%0101110011110001, 8200]
sub unimplemented() { sub unimplemented() {
; TODO implement these asm routines c64scr.print_ubbin(ubarray[1], false)
c64.CHROUT('\n')
lsr(ubarray[1]) lsr(ubarray[1])
lsl(ubarray[1]) c64scr.print_ubbin(ubarray[1], false)
ror(ubarray[1]) c64.CHROUT('\n')
rol(ubarray[1]) lsr(ubarray[1])
ror2(ubarray[1]) c64scr.print_ubbin(ubarray[1], false)
rol2(ubarray[1]) c64.CHROUT('\n')
lsr(bbarray[1]) lsr(ubarray[1])
lsl(bbarray[1]) c64scr.print_ubbin(ubarray[1], false)
c64.CHROUT('\n')
lsr(ubarray[1])
c64scr.print_ubbin(ubarray[1], false)
c64.CHROUT('\n')
lsr(ubarray[1])
c64scr.print_ubbin(ubarray[1], false)
c64.CHROUT('\n')
lsr(ubarray[1])
c64scr.print_ubbin(ubarray[1], false)
c64.CHROUT('\n')
c64.CHROUT('\n')
c64scr.print_ubbin(bbarray[1] as ubyte, false)
c64.CHROUT('\n')
lsr(bbarray[1])
c64scr.print_ubbin(bbarray[1] as ubyte, false)
c64.CHROUT('\n')
lsr(bbarray[1])
c64scr.print_ubbin(bbarray[1] as ubyte, false)
c64.CHROUT('\n')
lsr(bbarray[1])
c64scr.print_ubbin(bbarray[1] as ubyte, false)
c64.CHROUT('\n')
lsr(bbarray[1])
c64scr.print_ubbin(bbarray[1] as ubyte, false)
c64.CHROUT('\n')
lsr(bbarray[1])
c64scr.print_ubbin(bbarray[1] as ubyte, false)
c64.CHROUT('\n')
lsr(bbarray[1])
c64scr.print_ubbin(bbarray[1] as ubyte, false)
c64.CHROUT('\n')
c64.CHROUT('\n')
c64scr.print_uwbin(uwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(uwarray[1]) lsr(uwarray[1])
lsl(uwarray[1]) c64scr.print_uwbin(uwarray[1] as uword, false)
ror(uwarray[1]) c64.CHROUT('\n')
rol(uwarray[1]) lsr(uwarray[1])
ror2(uwarray[1]) c64scr.print_uwbin(uwarray[1] as uword, false)
rol2(uwarray[1]) c64.CHROUT('\n')
lsr(uwarray[1])
c64scr.print_uwbin(uwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(uwarray[1])
c64scr.print_uwbin(uwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(uwarray[1])
c64scr.print_uwbin(uwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(uwarray[1])
c64scr.print_uwbin(uwarray[1] as uword, false)
c64.CHROUT('\n')
c64.CHROUT('\n')
c64scr.print_uwbin(wwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(wwarray[1]) lsr(wwarray[1])
lsl(wwarray[1]) c64scr.print_uwbin(wwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(wwarray[1])
c64scr.print_uwbin(wwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(wwarray[1])
c64scr.print_uwbin(wwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(wwarray[1])
c64scr.print_uwbin(wwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(wwarray[1])
c64scr.print_uwbin(wwarray[1] as uword, false)
c64.CHROUT('\n')
lsr(wwarray[1])
c64scr.print_uwbin(wwarray[1] as uword, false)
c64.CHROUT('\n')
c64.CHROUT('\n')
; lsl(ubarray[1])
; ror(ubarray[1])
; rol(ubarray[1])
; ror2(ubarray[1])
; rol2(ubarray[1])
; lsl(bbarray[1])
;
; lsl(uwarray[1])
; ror(uwarray[1])
; rol(uwarray[1])
; ror2(uwarray[1])
; rol2(uwarray[1])
; lsr(wwarray[1])
; lsl(wwarray[1])
} }
sub start() { sub start() {
; TODO call this once implemented: unimplemented()
; unimplemented()
lsr(A) lsr(A)
lsl(A) lsl(A)