From e05888d141bc64e92d81859af0d87627e6fbc477 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Fri, 22 Nov 2024 16:01:31 +1300 Subject: Simplify clock device implementation Two pairs of generic get/set functions now do the role of the previous pair of custom get/set functions for each timer. --- arm9/source/core.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'arm9/source/core.c') diff --git a/arm9/source/core.c b/arm9/source/core.c index 66bd204..a1f9ec1 100644 --- a/arm9/source/core.c +++ b/arm9/source/core.c @@ -107,14 +107,14 @@ u8 dev_read(Bedrock *br, u8 port) { case 0x35: return SECOND(get_datetime()); case 0x36: return HIGH(get_uptime()-br->clk.start); case 0x37: return LOW(get_uptime()-br->clk.start); - case 0x38: return get_timer1_high(&br->clk); - case 0x39: return get_timer1_low( &br->clk); - case 0x3A: return get_timer2_high(&br->clk); - case 0x3B: return get_timer2_low( &br->clk); - case 0x3C: return get_timer3_high(&br->clk); - case 0x3D: return get_timer3_low( &br->clk); - case 0x3E: return get_timer4_high(&br->clk); - case 0x3F: return get_timer4_low( &br->clk); + case 0x38: return get_timer_high(&br->clk.t1); + case 0x39: return get_timer_low( &br->clk.t1); + case 0x3A: return get_timer_high(&br->clk.t2); + case 0x3B: return get_timer_low( &br->clk.t2); + case 0x3C: return get_timer_high(&br->clk.t3); + case 0x3D: return get_timer_low( &br->clk.t3); + case 0x3E: return get_timer_high(&br->clk.t4); + case 0x3F: return get_timer_low( &br->clk.t4); // INPUT DEVICE case 0x40: return BOOL(br->inp.pointer); case 0x41: return br->inp.pointer << 7; @@ -169,14 +169,14 @@ Signal dev_write(Bedrock *br, u8 port, u8 v) { case 0x23: set_op2_low( &br->math,v); return 0; // CLOCK DEVICE // TODO: Set time and date - case 0x38: set_timer1_high(&br->clk,v); return 0; - case 0x39: set_timer1_low( &br->clk,v); return 0; - case 0x3A: set_timer2_high(&br->clk,v); return 0; - case 0x3B: set_timer2_low( &br->clk,v); return 0; - case 0x3C: set_timer3_high(&br->clk,v); return 0; - case 0x3D: set_timer3_low( &br->clk,v); return 0; - case 0x3E: set_timer4_high(&br->clk,v); return 0; - case 0x3F: set_timer4_low( &br->clk,v); return 0; + case 0x38: set_timer_high(&br->clk.t1,v); return 0; + case 0x39: set_timer_low( &br->clk.t1,v); return 0; + case 0x3A: set_timer_high(&br->clk.t2,v); return 0; + case 0x3B: set_timer_low( &br->clk.t2,v); return 0; + case 0x3C: set_timer_high(&br->clk.t3,v); return 0; + case 0x3D: set_timer_low( &br->clk.t3,v); return 0; + case 0x3E: set_timer_high(&br->clk.t4,v); return 0; + case 0x3F: set_timer_low( &br->clk.t4,v); return 0; // SCREEN DEVICE case 0x54: SET_HIGH(br->scr.x,v); return 0; case 0x55: SET_LOW( br->scr.x,v); return 0; -- cgit v1.2.3-70-g09d2