diff --git a/compiler/res/prog8lib/prog8lib.asm b/compiler/res/prog8lib/prog8lib.asm index 283ba4212..1285d3c6a 100644 --- a/compiler/res/prog8lib/prog8lib.asm +++ b/compiler/res/prog8lib/prog8lib.asm @@ -1801,14 +1801,6 @@ rol2_mem_ub .proc rts .pend -lsl_array_b .proc - .warn "lsl_array_b" ; TODO - .pend - -lsl_array_w .proc - .warn "lsl_array_w" ; TODO - .pend - lsr_array_ub .proc ; -- lsr a ubyte in an array (index and array address on stack) inx @@ -1919,6 +1911,22 @@ ror2_array_ub .proc rts .pend +rol2_array_ub .proc + ; -- rol2 (8-bit rol) 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 + cmp #$80 + rol a + sta (c64.SCRATCH_ZPWORD1),y + rts + .pend + ror_array_uw .proc ; -- ror a uword in an array (index and array address on stack) php @@ -1943,6 +1951,32 @@ ror_array_uw .proc rts .pend +rol2_array_uw .proc + ; -- rol2 (16-bit rol) 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 + lda (c64.SCRATCH_ZPWORD1),y + asl a + sta (c64.SCRATCH_ZPWORD1),y + iny + lda (c64.SCRATCH_ZPWORD1),y + rol a + sta (c64.SCRATCH_ZPWORD1),y + bcc + + dey + lda (c64.SCRATCH_ZPWORD1),y + adc #0 + sta (c64.SCRATCH_ZPWORD1),y ++ rts + .pend + ror2_array_uw .proc ; -- ror2 (16-bit ror) a uword in an array (index and array address on stack) inx @@ -1970,6 +2004,14 @@ ror2_array_uw .proc + rts .pend +lsl_array_b .proc + .warn "lsl_array_b" ; TODO + .pend + +lsl_array_w .proc + .warn "lsl_array_w" ; TODO + .pend + rol_array_ub .proc .warn "rol_array_ub" ; TODO .pend @@ -1977,12 +2019,3 @@ rol_array_ub .proc rol_array_uw .proc .warn "rol_array_uw" ; TODO .pend - -rol2_array_ub .proc - .warn "rol2_array_ub" ; TODO - .pend - -rol2_array_uw .proc - .warn "rol2_array_uw" ; TODO - .pend - diff --git a/examples/arithmetic/bitshift.p8 b/examples/arithmetic/bitshift.p8 index ac6c2baa8..91770065c 100644 --- a/examples/arithmetic/bitshift.p8 +++ b/examples/arithmetic/bitshift.p8 @@ -17,27 +17,27 @@ main { sub unimplemented() { ubyte xx uword xxx - ror2(xx) - ror2(xxx) + rol(xx) + rol(xxx) c64scr.print_ubbin(ubarray[1], false) c64.CHROUT('\n') - ror2(ubarray[1]) + rol(ubarray[1]) c64scr.print_ubbin(ubarray[1], false) c64.CHROUT('\n') - ror2(ubarray[1]) + rol(ubarray[1]) c64scr.print_ubbin(ubarray[1], false) c64.CHROUT('\n') - ror2(ubarray[1]) + rol(ubarray[1]) c64scr.print_ubbin(ubarray[1], false) c64.CHROUT('\n') - ror2(ubarray[1]) + rol(ubarray[1]) c64scr.print_ubbin(ubarray[1], false) c64.CHROUT('\n') - ror2(ubarray[1]) + rol(ubarray[1]) c64scr.print_ubbin(ubarray[1], false) c64.CHROUT('\n') - ror2(ubarray[1]) + rol(ubarray[1]) c64scr.print_ubbin(ubarray[1], false) c64.CHROUT('\n') c64.CHROUT('\n') @@ -66,22 +66,22 @@ main { c64scr.print_uwbin(uwarray[1] as uword, false) c64.CHROUT('\n') - ror2(uwarray[1]) + rol(uwarray[1]) c64scr.print_uwbin(uwarray[1] as uword, false) c64.CHROUT('\n') - ror2(uwarray[1]) + rol(uwarray[1]) c64scr.print_uwbin(uwarray[1] as uword, false) c64.CHROUT('\n') - ror2(uwarray[1]) + rol(uwarray[1]) c64scr.print_uwbin(uwarray[1] as uword, false) c64.CHROUT('\n') - ror2(uwarray[1]) + rol(uwarray[1]) c64scr.print_uwbin(uwarray[1] as uword, false) c64.CHROUT('\n') - ror2(uwarray[1]) + rol(uwarray[1]) c64scr.print_uwbin(uwarray[1] as uword, false) c64.CHROUT('\n') - ror2(uwarray[1]) + rol(uwarray[1]) c64scr.print_uwbin(uwarray[1] as uword, false) c64.CHROUT('\n') c64.CHROUT('\n') @@ -110,12 +110,10 @@ main { ; lsl(ubarray[1]) ; rol(ubarray[1]) -; rol2(ubarray[1]) ; lsl(bbarray[1]) ; ; lsl(uwarray[1]) ; rol(uwarray[1]) -; rol2(uwarray[1]) ; lsl(wwarray[1]) }