diff --git a/uxn/screen.ha b/uxn/screen.ha index 22e70a3..c09e326 100644 --- a/uxn/screen.ha +++ b/uxn/screen.ha @@ -19,13 +19,23 @@ fn draw_pixel(value: u8, state: *uxn) void = { const auto_a = (auto & 0b00000100) != 0; set_pixel(layer1,x,y,color,state); if(auto_x) { - const new_x = x + 1; + const new_x = if(flipx){ + yield x - 1; + }else{ + yield x + 1; + }; + // const new_x = x + 1; state.dev[0x28] = (new_x >> 8): u8; state.dev[0x29] = (new_x): u8; }; if(auto_y) { - const new_y = y + 1; + const new_y = if(flipy){ + yield y - 1; + }else{ + yield y + 1; + }; + // const new_y = y + 1; state.dev[0x2a] = (new_y >> 8): u8; state.dev[0x2b] = (new_y): u8; diff --git a/uxn/uxn.ha b/uxn/uxn.ha index 6372434..ee08d5d 100644 --- a/uxn/uxn.ha +++ b/uxn/uxn.ha @@ -148,7 +148,7 @@ fn emu_dei(port: u8, state: *uxn) u8 = { return time::date::second(&date): u8; case 0xc7 => const date = time::date::localnow(); - return time::date::weekday(&date): u8; + return (time::date::weekday(&date): u8 + 1) % 7; case 0xc8 => const date = time::date::localnow(); const day = time::date::yearday(&date) - 1; @@ -848,7 +848,7 @@ export fn uxn_step(state: *uxn) (done | error) = { // /* STH */ OPC(0x0f,GOT(x),PUT(x,!r)) case let sth_inst: STH => - let val = pop_or_get(sth_inst,0,state); + const val = pop_from_stack(sth_inst.keep,sth_inst.ret,sth_inst.short,state); push_to_stack(!sth_inst.ret, val, state); // /* LDZ */ OPC(0x10,POx(a,0),PEK(a, x, 0xff)) case let ldz_inst: LDZ =>