IRC logs for #opendune on OFTC at 2011-03-19
            
03:54:38 *** glx has quit IRC
05:04:40 *** fjb is now known as Guest1369
05:04:41 *** fjb has joined #openDune
05:11:30 *** Guest1369 has quit IRC
08:19:24 *** SmatZ has quit IRC
08:19:24 *** tneo has quit IRC
08:22:02 *** tneo has joined #openDune
08:23:03 *** SmatZ has joined #openDune
12:36:02 *** Alberth has joined #openDune
12:37:48 <Alberth> not quite sure whether I like this enough to do for a longer time, but http://devs.openttd.org/~alberth/diffs/b4b8/
12:43:53 <SmatZ> :-) Alberth
12:54:32 <Alberth> http://devs.openttd.org/~alberth/diffs/10_widgeth.patch
13:04:04 <TrueBrain> :D:D
13:04:37 <TrueBrain> cascade approach :D
13:04:58 <TrueBrain> how did you figure out variables? Looking at current source, or?
13:07:18 <Alberth> g_widgetClickInfo = (WidgetClickInfo *)&emu_get_memory8(0x2E6B, 0x0, 0x0);
13:09:01 <Alberth> and emu_GUI_Widget_Allocate()
13:12:05 <TrueBrain> and renaming variable_16 to variable_3A sounds wrong :p
13:12:25 <Alberth> :)
13:25:55 *** glx has joined #openDune
13:25:55 *** ChanServ sets mode: +o glx
13:26:22 <glx> hello
15:55:21 <Xaroth|Work> o/
15:58:18 <SmatZ> hello Xaroth|Work
16:00:24 <Alberth> http://devs.openttd.org/~alberth/diffs/uitvoer2.patch replaced some f__2598_0000_0017_EB80() :)
16:04:26 <Alberth> note that it has a new file :)
16:04:29 <TrueBrain> emu_ds by default is 0x353F (g_global)
16:05:04 <TrueBrain> and no need to keep emu_ax in most of those cases :D
16:12:03 <Xaroth|Work> <3 Alberth
16:12:10 <Xaroth|Work> and o/ SmatZ
16:14:50 <glx> http://svn.opendune.org/~glx/temp.patch <-- I started something too :)
16:23:39 <Alberth> please reload uitvoer2.patch
18:34:38 <Alberth> eh, spinlock :)
19:01:52 <SmatZ> where?
19:03:16 <Alberth> f__2B6C_0197_00CE_4D32(), l__01EA:
19:03:37 <Alberth> f__2B6C_0169_001E_6939() first statements
19:04:18 <SmatZ> :) well, spinlock isn't a problem in program written for one-process OS :)
19:05:06 <Alberth> it is if the same process also emulates interrupts ;)
19:05:33 <SmatZ> I think the interrupts are asynchronous
19:05:49 <SmatZ> called from "timeout" routine
19:06:30 <Alberth> I don't know. Like openttd, I don't know what main() actually does :)
19:07:37 <SmatZ> in openttd, everything is synchronous - VideoDriver::MainLoop() checks inputs, moves screen buffer to screen, and calls GameLoop()
19:08:56 <SmatZ> in OpenDune, there is a routine called on SIGALRM
19:09:09 <SmatZ> at least... I think that's what I was said when I asked how it works :)
19:09:12 <SmatZ> I can be very wrong
19:10:05 <SmatZ> given there's no "SIGALRM" in OpenDune code, I am wrong :)
19:10:12 <Alberth> :)
19:16:52 <SmatZ> otoh, there is SIGALRM in libemu code
19:17:00 <SmatZ> so it might work that way :)
19:17:50 <SmatZ> it must work that way if there is a spinlock that doesn't end in an endless loop :)
19:19:08 <Alberth> I did have frozen games in the past, so I am not too sure it works :)
19:19:35 <SmatZ> hehe :)
19:20:11 <SmatZ> if the variable the loop "waits" for isn't volatile, the compiler can optimise that to "if (...) while (1);"
19:20:39 <SmatZ> (or there isn't a function call, asm statement, ...)
19:22:19 <Alberth> iirc some delay call got added
19:38:21 <Alberth> http://www.fpaste.org/Ocgf/ let's shift one bit 3 times :)
19:42:01 <SmatZ> :)
19:42:16 <SmatZ> well, shl r/m,imm8 was added in 80186 (iirc)
19:42:54 <SmatZ> maybe the compiler was set to support 8086...
19:43:33 <SmatZ> yup, 80186
19:44:29 <SmatZ> or the compiler just failed to generate that instruction :)
19:44:38 <SmatZ> it would be interesting to test DUNE2 on a 8086
19:47:00 <Alberth> I would not be surprised if that worked
19:52:12 <SmatZ> reminds me of SimCity2000, where the setup program worked fine on a 80286, but the game itself didn't run
19:53:57 * SmatZ has a strong urge to run SC2000 :)
20:07:28 <Alberth> emu_addb(&emu_get_memory8(emu_ds, 0x00, 0x7080), 0x1);
20:07:28 <Alberth> emu_adcb(&emu_get_memory8(emu_ds, 0x00, 0x7080), 0x0);
20:07:42 <Alberth> what does the 2nd add do?
20:07:50 <SmatZ> adc is add with carry
20:08:01 <SmatZ> if the first add overflowed, it adds +1
20:08:10 <SmatZ> so ... that adds 1 to a word
20:08:19 <Alberth> so it adds one extra when 0x7080 is 255
20:08:24 <SmatZ> yes
20:08:54 <SmatZ> it's not a word, but it's usally used that way... on 8bit CPUs, 2 8-bit adds are combined to add to a word
20:09:28 <Alberth> yeah, I programmed the 6502 in some dark ages :)
20:09:31 <SmatZ> :-)
20:09:48 <Alberth> but I was wondering about a nice C equivalent
20:09:55 <SmatZ> 0x7080 will never be 0 (maybe only when the program starts, or when explicitly initialised by 0)
20:09:59 <SmatZ> hmm
20:10:13 <SmatZ> xxx++
20:10:17 <SmatZ> xxx += !xxx
20:10:27 <SmatZ> (assuming it's an unsigned char)
20:10:54 <Alberth> 0x7080 = (0x7080 < 255) ? 0x7080 + 1 : 1
20:11:29 <SmatZ> that would work, too :)
20:11:41 <SmatZ> still, it has to be unsigned char
20:11:53 <Alberth> I cannot read your solution :)
20:12:27 <SmatZ> xxx += !xxx will add 1 if it is 0 :)
20:12:52 <Alberth> /* 7080(2) */ PACK uint16 regionFlags; /*!< Flags: 0x4000 - Mouse still inside region, 0x8000 - Region check. */ interesting
20:12:58 <SmatZ> so if xxx++ results in 0 (because it was 255), it will change to 1
20:13:40 <SmatZ> Alberth: I don't know much about that :(
20:13:51 <SmatZ> (I mean, I know nothing about that)
20:14:08 <Alberth> low byte seems some counter-like value, while upper bits are real flags
20:14:19 <SmatZ> oh
20:14:24 <Alberth> I see that too for the first time :)
20:14:30 <SmatZ> so it might be better split to two bytes
20:15:03 <SmatZ> yeah, now I connected it to that "0x7080" you mentioned earlier :)
20:15:40 <Alberth> yeah, except I just did s/emu_get_memory16(emu_ds, 0x00, 0x7080)/g_global->regionFlags/gc :)
20:15:59 <SmatZ> unless it has some hacky uses, like highlight flags in openttd :)
20:16:10 <SmatZ> :-)
20:16:50 <Alberth> hmm, regionFlags may be used elsewhere too
20:17:39 <Alberth> hmm, not
20:17:47 <SmatZ> :)
20:18:02 <Alberth> weird
20:32:59 * Alberth needs a mercurial repo
21:19:32 <TrueBrain> Alberth: the 0x7080 is sometimes used for fast boolean operations .. very odd and annoying :p
21:19:41 <TrueBrain> other usages are 32bits, but then they have different addresses :)
21:20:24 <Alberth> would be too simple otherwise :)
21:21:14 <TrueBrain> and yeah, it seems lowbits of 0x7080 are no flags, but used differently
21:21:15 <TrueBrain> happens :p
21:23:56 <Alberth> http://www.fpaste.org/Vb9x/ empty functions anyone ?
21:24:20 * Alberth goes to bed
21:24:37 <TrueBrain> can't see source, but yes, it has empty functions :p
21:24:39 <TrueBrain> sleep well :)
21:24:51 <TrueBrain> the A ones are sound/music drivers .. lots of empty callbacks
21:26:41 <Alberth> I had a mouse/window one, cannot find it currently
21:27:10 *** Alberth has left #openDune
21:37:42 <glx> ABXX are sound and music drivers, 2756 are calls to the drivers :)
21:38:29 <glx> 2BD1 are named empty function IIRC
21:38:55 <glx> yup emu_Empty1 and emu_Empty2 :)