Skip to content

Commit

Permalink
Use bitrange operators
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekkio committed Nov 21, 2022
1 parent 5320193 commit 28147ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions data/languages/sm83.sinc
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ macro aluDec(op8) {
macro aluRlc(op8) {
# TODO: double-check flags
local x:1 = op8;
local co:1 = (x >> 7);
local co:1 = x[7,1];
local tmp:1 = (x << 1) | co;
$(Z_flag) = (tmp == 0);
$(N_flag) = 0;
Expand All @@ -248,8 +248,8 @@ macro aluRlc(op8) {
macro aluRrc(op8) {
# TODO: double-check flags
local x:1 = op8;
local co:1 = x & 1;
local tmp:1 = (x >> 1) | (co << 7);
local co:1 = x[0,1];
local tmp:1 = (co << 7) | (x >> 1);
$(Z_flag) = (tmp == 0);
$(N_flag) = 0;
$(H_flag) = 0;
Expand All @@ -260,7 +260,7 @@ macro aluRrc(op8) {
macro aluRl(op8) {
# TODO: double-check flags
local x:1 = op8;
local co:1 = (x >> 7);
local co:1 = x[7,1];
local tmp:1 = (x << 1) | $(C_flag);
$(Z_flag) = (tmp == 0);
$(N_flag) = 0;
Expand All @@ -272,8 +272,8 @@ macro aluRl(op8) {
macro aluRr(op8) {
# TODO: double-check flags
local x:1 = op8;
local co:1 = x & 1;
local tmp:1 = (x >> 1) | ($(C_flag) << 7);
local co:1 = x[0,1];
local tmp:1 = ($(C_flag) << 7) | (x >> 1);
$(Z_flag) = (tmp == 0);
$(N_flag) = 0;
$(H_flag) = 0;
Expand All @@ -284,7 +284,7 @@ macro aluRr(op8) {
macro aluSla(op8) {
# TODO: double-check flags
local x:1 = op8;
local co:1 = x >> 7;
local co:1 = x[7,1];
local tmp:1 = x << 1;
$(Z_flag) = (tmp == 0);
$(N_flag) = 0;
Expand All @@ -296,7 +296,7 @@ macro aluSla(op8) {
macro aluSra(op8) {
# TODO: double-check flags
local x:1 = op8;
local co:1 = x & 1;
local co:1 = x[0,1];
local tmp:1 = x s>> 1;
$(Z_flag) = (tmp == 0);
$(N_flag) = 0;
Expand All @@ -308,7 +308,7 @@ macro aluSra(op8) {
macro aluSwap(op8) {
# TODO: double-check flags
local x:1 = op8;
local tmp:1 = (x >> 4) | (x << 4);
local tmp:1 = (x[0,4] << 4) | x[4,4];
$(Z_flag) = (tmp == 0);
$(N_flag) = 0;
$(H_flag) = 0;
Expand All @@ -319,7 +319,7 @@ macro aluSwap(op8) {
macro aluSrl(op8) {
# TODO: double-check flags
local x:1 = op8;
local co:1 = x & 1;
local co:1 = x[0,1];
local tmp:1 = x >> 1;
$(Z_flag) = (tmp == 0);
$(N_flag) = 0;
Expand Down
12 changes: 6 additions & 6 deletions data/languages/sm83_instructions.sinc
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@

:RLCA is op0_8=0x07 {
# TODO: double-check flags
local co:1 = (A >> 7);
local co:1 = A[7,1];
A = (A << 1) | co;
$(Z_flag) = 0;
$(N_flag) = 0;
Expand All @@ -228,7 +228,7 @@

:RLA is op0_8=0x17 {
# TODO: double-check flags
local co:1 = (A >> 7);
local co:1 = A[7,1];
A = (A << 1) | $(C_flag);
$(Z_flag) = 0;
$(N_flag) = 0;
Expand All @@ -238,8 +238,8 @@

:RRCA is op0_8=0x0f {
# TODO: double-check flags
local co:1 = A & 1;
A = (A >> 1) | (co << 7);
local co:1 = A[0,1];
A = (co << 7) | (A >> 1);
$(Z_flag) = 0;
$(N_flag) = 0;
$(H_flag) = 0;
Expand All @@ -248,8 +248,8 @@

:RRA is op0_8=0x1f {
# TODO: double-check flags
local co:1 = A & 1;
A = (A >> 1) | ($(C_flag) << 7);
local co:1 = A[0,1];
A = ($(C_flag) << 7) | (A >> 1);
$(Z_flag) = 0;
$(N_flag) = 0;
$(H_flag) = 0;
Expand Down

0 comments on commit 28147ad

Please sign in to comment.