0 Members and 2 Guests are viewing this topic.
That's a cleaver trick! But wouldn't something like this be simpler?or asbc hl,deadd hl,dejr nc,$+3ex de,hlBut I'm trying to convert all of my math commands to signed operations anyway, so I would need to tweak it a bit.
Does anyone know any good sin/cos routines that are under 128 bytes? The entire circle should be 256 brads (binary radians) so each quadrant is 64. It doesn't need to be 100% accurate, but it should be pretty close. It doesn't need to be that fast either, but I would prefer using a method that doesn't need multiplication such as a look up table or CORDIC.
DispGraphRR: di ld a,$80 out ($10),a ld (save_sp),sp ld l,plotSScreen&$ff - 1 ld de,appbackupscreen - plotSScreen ld sp,plotSScreen - appbackupscreen + 12 ld c,$1f dec (iy+asmflags2) jr nz,gray4skip ld (iy+asmflags2),3 jr gray4entry3gray4skip: ld a,(flags+asmflags2) dec a jr z,gray4entry2gray4entry1: ld h,plotSScreen >> 8 inc l ld b,64 inc c ld a,c cp $2c jr z,gray4end out ($10),a gray4loop1: ld a,(hl) add hl,de xor (hl) and %11011011 xor (hl) add hl,sp out ($11),a djnz gray4loop2 gray4entry2: ld h,plotSScreen >> 8 inc l ld b,64 inc c ld a,c cp $2c jr z,gray4end out ($10),a gray4loop2: ld a,(hl) add hl,de xor (hl) and %01101101 xor (hl) add hl,sp out ($11),a djnz gray4loop3gray4entry3: ld h,plotSScreen >> 8 inc l ld b,64 inc c ld a,c cp $2c jr z,gray4end out ($10),a gray4loop3: ld a,(hl) add hl,de xor (hl) and %10110110 xor (hl) add hl,sp out ($11),a djnz gray4loop1 jr gray4entry1gray4end: ld sp,(save_sp) ei ret
ld a,c cp $2c jr z,__Disp4LvlDone ld h,plotSScreen >> 8 inc l ld b,64 inc c out ($10),a
inc (iy+asm_flag2) jr z,__Disp4Lvlentry3 ld a,(flags+asm_flag2) inc a jr z,__Disp4Lvlentry2 ld (iy+asm_flag2),-2