mirror of
https://github.com/irmen/prog8.git
synced 2025-01-12 19:29:50 +00:00
7de665d1e4
optimized rol and ror codegen optimize/fix ror/ror2/rol/rol2 on word arrays
88 lines
1.8 KiB
Lua
88 lines
1.8 KiB
Lua
%import textio
|
|
%zeropage basicsafe
|
|
%option no_sysinit
|
|
|
|
main {
|
|
sub start() {
|
|
/*
|
|
mem()
|
|
bytes()
|
|
*/
|
|
words()
|
|
}
|
|
|
|
sub mem() {
|
|
@($2000) = $7a
|
|
rol(@($2000))
|
|
txt.print_ubbin(@($2000), true)
|
|
txt.nl()
|
|
rol2(@($2000))
|
|
txt.print_ubbin(@($2000), true)
|
|
txt.nl()
|
|
ror(@($2000))
|
|
txt.print_ubbin(@($2000), true)
|
|
txt.nl()
|
|
ror2(@($2000))
|
|
txt.print_ubbin(@($2000), true)
|
|
txt.nl()
|
|
txt.nl()
|
|
}
|
|
|
|
sub bytes() {
|
|
ubyte[] wa = [$1a, $2b, $3c]
|
|
|
|
txt.print_ubbin(wa[2], true)
|
|
txt.nl()
|
|
rol(wa[2])
|
|
txt.print_ubbin(wa[2], true)
|
|
txt.nl()
|
|
rol2(wa[2])
|
|
txt.print_ubbin(wa[2], true)
|
|
txt.nl()
|
|
ror(wa[2])
|
|
txt.print_ubbin(wa[2], true)
|
|
txt.nl()
|
|
ror2(wa[2])
|
|
txt.print_ubbin(wa[2], true)
|
|
txt.nl()
|
|
txt.nl()
|
|
}
|
|
|
|
sub words() {
|
|
uword[] wa = [$11aa, $22bb, $33cc]
|
|
uword[] @split swa = [$11aa, $22bb, $33cc]
|
|
|
|
txt.print_uwbin(wa[2], true)
|
|
txt.nl()
|
|
rol(wa[2])
|
|
txt.print_uwbin(wa[2], true)
|
|
txt.nl()
|
|
rol2(wa[2])
|
|
txt.print_uwbin(wa[2], true)
|
|
txt.nl()
|
|
ror(wa[2])
|
|
txt.print_uwbin(wa[2], true)
|
|
txt.nl()
|
|
ror2(wa[2])
|
|
txt.print_uwbin(wa[2], true)
|
|
txt.nl()
|
|
txt.nl()
|
|
|
|
txt.print_uwbin(swa[2], true)
|
|
txt.nl()
|
|
rol(swa[2])
|
|
txt.print_uwbin(swa[2], true)
|
|
txt.nl()
|
|
rol2(swa[2])
|
|
txt.print_uwbin(swa[2], true)
|
|
txt.nl()
|
|
ror(swa[2])
|
|
txt.print_uwbin(swa[2], true)
|
|
txt.nl()
|
|
ror2(swa[2])
|
|
txt.print_uwbin(swa[2], true)
|
|
txt.nl()
|
|
txt.nl()
|
|
}
|
|
}
|