fix carry and shifts in hardware, misc
This commit is contained in:
@ -40,9 +40,9 @@
|
||||
#define pushretaddr2 writememory(cpu->s++, lobyte((cpu->i-1)%65536));
|
||||
#define lni cpu->instr = readmemory(cpu->i++); cpu->cycle = 0;
|
||||
#define ldi cpu->instr = readmemory(cpu->i); cpu->cycle = 0;
|
||||
#define addf(x,y) { x=(x+y); cpu->cf=x>=256; x&=0xFF; setzf(x); }
|
||||
#define subf(x,y) addf(x,-y);
|
||||
#define cmpf(x,y) { int t=x-y; cpu->cf=(t<0); setzf(t); }
|
||||
#define addf(x,y) { x=(x+y)&0x1FF; cpu->cf=x>=256; x&=0xFF; setzf(x); }
|
||||
#define subf(x,y) addf(x,(-y)&0xFF);
|
||||
#define cmpf(x,y) { int t=x+((-y)&0xFF); cpu->cf=t>=256; t&=0xFF; setzf(t); }
|
||||
#define rol(x,y) x=(x<<y)|(x>>(8-y));
|
||||
#define ror(x,y) x=(x>>y)|(x<<(8-y));
|
||||
#define sra(x,y) x=(x>>y);
|
||||
|
Binary file not shown.
@ -369,7 +369,7 @@ local function RedrawKeyInfo(x, y, uk, run)
|
||||
lg.setColor(0,0,0)
|
||||
lg.rectangle("fill",x,y,768,12)
|
||||
lg.setColor(1,1,1)
|
||||
printHighlight("[ESC] Toggle keyboard", 0, lk.isDown("escape"), x, y)
|
||||
printHighlight("[F4] Toggle keyboard", 0, lk.isDown("f4"), x, y)
|
||||
lg.setColor(1,1,1)
|
||||
if uk then
|
||||
printHighlight("Keystrokes passed to device", 23, false, x, y)
|
||||
@ -656,7 +656,7 @@ function love.draw()
|
||||
end
|
||||
|
||||
function love.keypressed(k)
|
||||
if k=="escape" then
|
||||
if k=="f4" then
|
||||
UseKeyboard = not UseKeyboard
|
||||
else
|
||||
if UseKeyboard then
|
||||
@ -674,5 +674,5 @@ function love.keypressed(k)
|
||||
end
|
||||
end
|
||||
function love.keyreleased(k)
|
||||
if k~="escape" and UseKeyboard then KeyboardOnKey(Keyboard, k, false, CPU, Memory) end
|
||||
if k~="f4" and UseKeyboard then KeyboardOnKey(Keyboard, k, false, CPU, Memory) end
|
||||
end
|
||||
|
@ -63,19 +63,19 @@ void cpu_instr_46_1(struct CPU* const cpu, struct Memory* const mem) { loadstack
|
||||
void cpu_instr_46_2(struct CPU* const cpu, struct Memory* const mem) { tst(cpu->u); lni; }
|
||||
void cpu_instr_47_0(struct CPU* const cpu, struct Memory* const mem) { cpu->a=sra(cpu->a,cpu->c); setzf(cpu->a); lni; }
|
||||
void cpu_instr_48_0(struct CPU* const cpu, struct Memory* const mem) { loadimmedt cpu->cycle++; }
|
||||
void cpu_instr_48_1(struct CPU* const cpu, struct Memory* const mem) { if( cpu->nz ) { jmprelt } else { lni } }
|
||||
void cpu_instr_48_1(struct CPU* const cpu, struct Memory* const mem) { if( cpu->nz ) { jmprelt } else { lni } }
|
||||
void cpu_instr_49_0(struct CPU* const cpu, struct Memory* const mem) { loadimmedt cpu->cycle++; }
|
||||
void cpu_instr_49_1(struct CPU* const cpu, struct Memory* const mem) { jmprelt }
|
||||
void cpu_instr_50_0(struct CPU* const cpu, struct Memory* const mem) { loadimmedt cpu->cycle++; }
|
||||
void cpu_instr_50_1(struct CPU* const cpu, struct Memory* const mem) { if(!cpu->nz ) { jmprelt } else { lni } }
|
||||
void cpu_instr_50_1(struct CPU* const cpu, struct Memory* const mem) { if(!cpu->nz ) { jmprelt } else { lni } }
|
||||
void cpu_instr_51_0(struct CPU* const cpu, struct Memory* const mem) { loadimmedt cpu->cycle++; }
|
||||
void cpu_instr_51_1(struct CPU* const cpu, struct Memory* const mem) { if(!cpu->cf ) { jmprelt } else { lni } }
|
||||
void cpu_instr_51_1(struct CPU* const cpu, struct Memory* const mem) { if(!cpu->cf ) { jmprelt } else { lni } }
|
||||
void cpu_instr_52_0(struct CPU* const cpu, struct Memory* const mem) { loadimmedt cpu->cycle++; }
|
||||
void cpu_instr_52_1(struct CPU* const cpu, struct Memory* const mem) { if( cpu->cf ) { jmprelt } else { lni } }
|
||||
void cpu_instr_52_1(struct CPU* const cpu, struct Memory* const mem) { if( cpu->cf ) { jmprelt } else { lni } }
|
||||
void cpu_instr_53_0(struct CPU* const cpu, struct Memory* const mem) { loadimmedt cpu->cycle++; }
|
||||
void cpu_instr_53_1(struct CPU* const cpu, struct Memory* const mem) { if(cpu->nz && (!cpu->cf)) { jmprelt } else { lni } }
|
||||
void cpu_instr_53_1(struct CPU* const cpu, struct Memory* const mem) { if( cpu->nz && cpu->cf ) { jmprelt } else { lni } }
|
||||
void cpu_instr_54_0(struct CPU* const cpu, struct Memory* const mem) { loadimmedt cpu->cycle++; }
|
||||
void cpu_instr_54_1(struct CPU* const cpu, struct Memory* const mem) { if((!cpu->nz) || cpu->cf) { jmprelt } else { lni } }
|
||||
void cpu_instr_54_1(struct CPU* const cpu, struct Memory* const mem) { if((!cpu->nz) || (!cpu->cf)) { jmprelt } else { lni } }
|
||||
void cpu_instr_55_0(struct CPU* const cpu, struct Memory* const mem) { cpu->b=lobyte(cpu->p); lni; }
|
||||
void cpu_instr_56_0(struct CPU* const cpu, struct Memory* const mem) { cpu->c=hibyte(cpu->p); lni; }
|
||||
void cpu_instr_57_0(struct CPU* const cpu, struct Memory* const mem) { cpu->b=lobyte(cpu->q); lni; }
|
||||
|
Reference in New Issue
Block a user