From 23a7a34813eb81dbd708537a230c7b26ee4af498 Mon Sep 17 00:00:00 2001 From: Tobias Girstmair Date: Thu, 4 Mar 2021 17:53:23 +0100 Subject: [PATCH] new version --- bsv.c | 16 +++++++--------- fakeasm.h | 1 + 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/bsv.c b/bsv.c index a784857..a0e6226 100644 --- a/bsv.c +++ b/bsv.c @@ -40,9 +40,8 @@ void mod3(void) { ADD (acc, mod3lo) SUB (acc,3) - if (flag_c){ // T0SN FLAG.C (0x00.1) -- skip if carry clear - ADD (acc,3) - } + /*T0SN FLAG.C (0x00.1)*/ if (flag_c){ // skip if carry clear + ADD (acc,3) } } void g(void){ @@ -53,10 +52,9 @@ void g(void){ // test i2 & 3: MOV (acc, i2) AND (acc, 3) - if(3&i2) {// T0SN FLAG.Z (0x00.0) -- skip if !(3&i0) - notes_ix |= 8; // SET1 MEM.n - } - acc = notes[notes_ix]; // IDXM acc, notes_ix + /*T0SN FLAG.Z (0x00.0)*/ if(3&i2) {// skip if !(3&i0) + SET1 (notes_ix, 3) } + /*IDXM acc, notes_ix*/ acc = notes[notes_ix]; u8 result = ((i1<<8|i0)*acc)>>8; // keep hi byte acc = result; } @@ -209,8 +207,8 @@ void main(void){ putchar(acc); INC (i0) - i1 += !i0; // ADDC i1 - i2 += !i1 && !i0; // ADDC i2 + /*ADDC i1*/ i1 += !i0; + /*ADDC i2*/ i2 += !i1 && !i0; if(i2 == 0x78) break; } diff --git a/fakeasm.h b/fakeasm.h index 16a342c..54c5cb3 100644 --- a/fakeasm.h +++ b/fakeasm.h @@ -17,3 +17,4 @@ int flag_c = 0; #define XCH(dst) acc ^= dst; dst ^= acc; acc ^= dst; #define DEC(dst) dst -= 1; flag_c = flag_z = (dst==0); #define NEG(dst) dst *= -1; flag_z = (dst==0); +#define SET1(dst, n) dst |= 1<