code logs -> 2008 -> Sat, 02 Feb 2008< code.20080201.log - code.20080203.log >
--- Log opened Sat Feb 02 00:00:33 2008
00:13 Syloq [~Syloq@NetAdmin.Nightstar.Net] has joined #code
00:14 Syloq is now known as Syloqs-AFH
01:53 gnolam [lenin@85.8.5.ns-20483] has quit [Quit: Z?]
04:15 Derakon [~Derakon@67.160.122.ns-21493] has joined #code
04:15 mode/#code [+o Derakon] by ChanServ
04:16 * Derakon eyes his current polygon implementation, cries a little at what will be required to implement basic rotations of polygons.
04:21
<@Derakon>
Given the artistic style I have in mind for this project, though, I simply don't think I can get away with not handling rotation properly...bah. Bah!
04:25
<@Derakon>
Wait, hang on...
04:26
<@Derakon>
While I have "edges" and "edgeToNormal" fields in my Polygon class, I don't appear to actually use either of them. The important field is "verts", which is just an ordered list of the vertices.
04:27 * Derakon hugs SAT collision detection.
04:28
<@Vornicus>
Heh
04:30
<@Derakon>
Well, the brilliant thing about SAT is that it depends solely on the vertices of the polygons involved.
04:30
<@Derakon>
I only need edges for determining the outward-facing normals.
04:30
<@Derakon>
But I can generate normals using three things: the two endpoints, and the center of the polygon.
04:32
<@Vornicus>
indeed.
04:33
<@Derakon>
(In fact, the only reason I saw the edges and edgeToNormal fields was because I was looking at an old version of polygon.hh.
04:33
<@Derakon>
)
04:34
<@Vornicus>
pff
04:39 * Derakon sighs. "I found myself about to ask the question 'if you rotate a bunch of vertices about their mutual center, then does the center move?' Fortunately, I restrained myself."
04:40
<@Vornicus>
heh
04:50
<@ToxicFrog>
04:50
<@Derakon>
Oh, damnit, I've confused myself again. I do actually use those fields. So what polygon file was I looking at before?
04:51
<@Derakon>
I really need to set up some damned CVS already.
04:52
<@ToxicFrog>
git 4tw.
04:54
<@Derakon>
I suppose my approach can still work...it'll just be inefficient as all get out.
04:55
<@Derakon>
Original strategy was to maintain two copies of the coordinates: one un-rotated and one rotated (on the theory that most polygons don't rotate all that often). When rotation occurs, update the rotated set.
04:55
<@Derakon>
But instead, I'll need to update the rotated set, and the edges, and the map of edges to their normals.
04:55
<@Derakon>
Which makes rotation a lot more expensive.
05:03
< Doctor_Nick>
voxels
05:03
<@Derakon>
These are logical polygons; I use them for collision detection. If it were just a matter of appearances, I'd have no problem.
05:04
<@McMartin>
Voxels are also extremely expensive and get ugly looking fast once you get close to them.
05:51
<@Vornicus>
eww voxels
05:51
<@Vornicus>
The only company I know that actually uses them is Nova Logic.
05:52
<@Vornicus>
They've been using them for 15 years.
06:00
<@McMartin>
Didn't one of the C&C games use them? Poorly?
06:08
< Doctor_Nick>
THE WAVE OF THE FUTURE
06:09 Raif [~corvusign@67.161.90.ns-4200] has joined #Code
06:10
<@Derakon>
Hmph...I'd forgotten that SDL's image rotation does not keep your objects centered by default.
06:10
<@Derakon>
So if you take a square, say, and rotate it, then you need to move its draw location up and to the left to keep it visually centered.
06:10
<@Derakon>
Since by rotating the square, you've made its bounding box larger.
06:14
<@Derakon>
There, that's fixed.
06:16
<@McMartin>
You should probably have your sprite class include a "hot spot" field that is "this coordinate is the place I mean for the coordinate"
06:16
<@McMartin>
Since it's likely to not only change but wiggle on, say, animated humanoids.
06:17
<@Derakon>
Fair point...I'll deal with that later, though. Right now my problems are with space objects, which aren't actually animated.
06:18
<@Derakon>
I've spent too much time not actually producing anything...I can live with Niobium being not-fully-general if it means producing a playable game.
06:24
<@McMartin>
Well, it's likely to come up in Jetblade.
06:24
<@Derakon>
Oh, yes.
06:29
<@Derakon>
Well, that's progress.
06:29
<@Derakon>
The ship now rotates on its center.
06:29
<@Derakon>
Its bounding box rotates about its upper-left corner, in the opposite direction.
06:47
<@Derakon>
Hrm. Apparently the center is changing when I rotate about it. *sigh*
06:51
<@Derakon>
Ahh, yes. Rounding errors.
07:38 Derakon is now known as Derakon[AFK]
08:38 You're now known as TheWatcher
09:16 Vornicus is now known as Vornicus-Latens
10:28 UndeadAnno [AnnoDomini@83.21.84.ns-25961] has quit [Ping Timeout]
10:33 UndeadAnno [AnnoDomini@83.21.84.ns-25961] has joined #Code
11:51 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
11:51 mode/#code [+o gnolam] by ChanServ
14:55 * UndeadAnno searches for a 68HC05 memory map.
15:02
< UndeadAnno>
Okay, this is ridiculous. The snapshot feature is disabled in this PDF, for copyright reasons, allegedly. But what it really does is waste me about 15 seconds of time that I need to crop the requisite bitmap in the image editor of my choice after a printscreen, rather than getting it directly from the PDF viewer.
15:07 Bobsentme [Bobsentme@75.46.20.ns-3148] has joined #Code
15:07
< Bobsentme>
Morning
15:19
<@ToxicFrog>
UndeadAnno: see rule 5.
15:19
< UndeadAnno>
!google "rule 5"
15:20
< UndeadAnno>
DiceBot doesn't have that function? Weird.
15:21
< UndeadAnno>
"5. Anonymous does not forgive, Anonymous does not forget."
15:21
<@ToxicFrog>
Actually I just arbitrarily assigned the number, so google probably won't work.
15:21
< UndeadAnno>
:P
15:22
< Bobsentme>
heh
15:22
< UndeadAnno>
This kind of security makes me imagine the "Protection from Noobs" spell.
15:22
<@ToxicFrog>
Well. The one I was thinking of was "There are two kinds of copy protection: the kind that doesn't work at all, and the kind that doesn't work on pirates."
15:23
< UndeadAnno>
I see.
15:24
<@ToxicFrog>
This would appear to be the former.
15:24 * UndeadAnno is trying to learn Intel 8051 and Motorola 68HC05 through compiling the answers to the exam required knowledge points given by the lecturer.
15:31
< Bobsentme>
Is it perfectly understandable to beat a teacher that tells you to create an SQL script to find Customers who haven't made orders from two tables, when there AREN'T any customers who haven't made orders?
15:32
< UndeadAnno>
Not really.
15:32
< UndeadAnno>
It's what they call a trick question.
15:33
< UndeadAnno>
If you don't know crap about what you're doing, you'll fail to understand why there aren't any result.
15:33
< UndeadAnno>
*results
15:37
< Doctor_Nick>
professors have these things called "office hours"
15:38
< UndeadAnno>
Also called "recreation time", by those professors who are just painful enough to interact with in classes, much less tete-a-tete on their own ground.
15:38
< Bobsentme>
Too many witnesses in the office. Plus, it's saturday.
15:40
< Bobsentme>
This may make some of you cringe: He's teaching an SQL coding class by making people point and click through menus of Microsoft SQL management express, rather than having us code things.
15:41
< UndeadAnno>
Not me. I still don't know how to use that crap. Graphical mode, sure. SQL out of Notepad, sure. Wizards - too arcane.
15:41
< UndeadAnno>
Pun not intended.
17:01
< Bobsentme>
Ok. Trying to do a self join on an Employees Table. Table has columns EmployeeID, FirstName, LastName, and ReportsTo. In the ReportsTo column, are Numbers showing the employeeID that people report to.
17:02
< Bobsentme>
Basically, I have to show the Employee's first name, Last name, and the full name of the person they report to
17:02
< Bobsentme>
When I try this:
17:02
< Bobsentme>
SELECT dbo.Employees.FirstName, dbo.Employees.LastName, dbo.Employees.ReportsTo
17:02
< Bobsentme>
FROM dbo.Employees INNER JOIN
17:02
< Bobsentme>
dbo.Employees AS Employees_1 ON dbo.Employees.FirstName = Employees_1.FirstName AND dbo.Employees.LastName = Employees_1.LastName AND Employees.ReportsTo = Employees_1.FirstName
17:03
< Bobsentme>
I get a conversion error
17:03
< Bobsentme>
"Conversion failed when converting nvarchar value 'Nancy' to data type int
17:04
< Bobsentme>
Happens no matter what iteration of ReportsTo in the from line that I've tried.
17:04
< Bobsentme>
Any suggestions?
17:04
< Bobsentme>
(Also, I've spent 2 hours on this, checking the book and internet, before I gave in and asked you guys)
17:05
< UndeadAnno>
"SELECT k.FirstName, k.LastName, l.FirstName, l.LastName FROM Employees k, Employees l WHERE k.ReportsTo == l.EmployeeID" is all I'm able to come up with, but it's 99% wrong, probably.
17:06
<@EvilDarkLord>
Bobsentme: I suggest pasting into the pastebin, it makes for more readable code.
17:07 * Bobsentme is unaware of the pastebin, sorry
17:07 * EvilDarkLord points to topic.
17:08
< Bobsentme>
Ahhh.
17:08 * Bobsentme apologizes again
17:10 You're now known as TheWatcher[afk]
17:18
< Bobsentme>
Well, that one shows no results. =\
17:20
< Bobsentme>
If I back up a step, and show the Employees First Name, Last Name, and Reports to, I get The first name, Last name, and a # in the reports to field.
17:21
< Bobsentme>
I'm trying to convert the # in the ReportsTo field to the name associated with the employeeID.
17:21
< Bobsentme>
if that clears things up?
17:25
< UndeadAnno>
Maybe try a subselect statement? Get it to return a concatenated full name of the ReportsTo employee, and slap it into a normal select with FirstName and LastName.
17:25 * UndeadAnno is not sure this is possible.
17:29
< Bobsentme>
Hmmm, I think I finally found a page to help. And I think I'm misunderstanding the entire concept of self joins.
17:37 Derakon[AFK] is now known as Derakon
17:42 * Bobsentme figured it out
18:23
< Bobsentme>
6 hours, and 3 sql scripts done.
18:23
< Bobsentme>
This does not bode well for my test scores, I'm sure.
18:33 You're now known as TheWatcher
19:09
<@Derakon>
Hrm...somewhere in here, I'm losing the x and y values on my objects.
19:11
<@ToxicFrog>
That sounds unhealthy.
19:12
<@Derakon>
Yes, well, it's causing the position update portion of my update cycle to crash.
19:15
<@Derakon>
Ahh...it's because I tried to do self.super:update().
19:16 * UndeadAnno has done five out of nine points of his compilation.
19:26
< UndeadAnno>
Could someone explain to me the idea of interrupts? (Particularly if it relates to Intel 8051 or Motorola 68HC05, but I'm not picky.)
19:27
<@ToxicFrog>
Ok.
19:27
<@ToxicFrog>
The idea behind them, how they work, or both?
19:28
< UndeadAnno>
Both.
19:29
<@ToxicFrog>
Ok.
19:30
<@ToxicFrog>
The underlying concept is that the system needs some way of dealing with asynchronously signaled events, regardless of what's currently executing. Maybe it's a piece of hardware changing state, maybe it's a timer going off, whatever.
19:31
<@ToxicFrog>
So, how do you do this? Well, maybe you set a memory location, say - but now you have to wait for something to actually read that.
19:31
<@ToxicFrog>
There's no guarantee that the currently running code will ever handle it.
19:32
<@ToxicFrog>
And even if it does, constantly polling a register or memory location to see if it's changed is wasteful.
19:33 * Bobsentme thinks this is already kicking my explanation's butt.
19:33
< UndeadAnno>
'Asynchronously signaled events'? Like, say, a port with a multiplexed signal or something?
19:34
<@ToxicFrog>
So, what's needed is some way to tell the processor when such an event has occurred, immediately (or as soon as practical) handle it, and then go back to whatever it was doing before.
19:34
<@ToxicFrog>
In this context, events which may be signaled at any time regardless of current software state.
19:34
< UndeadAnno>
Oh.
19:34
<@ToxicFrog>
The program calling get_event(), which blocks until something happens and then returns an event, is synchronous.
19:34
<@Derakon>
The upshot is, you tell the computer "When this happens, execute this bit of code over here."
19:35
<@ToxicFrog>
The network card pulling IRQ low as soon as it recieves an ethernet frame is not.
19:35
<@ToxicFrog>
So. That's what they're for. Now for how this actually works.
19:35
< UndeadAnno>
So there's like a piece of hardware that sets/unsets a 'flag' and it interrupts?
19:36
<@ToxicFrog>
The processor has a list of interrupts. Some of these are connected to peripherals (via, say, the PCI bus); some are conneted to builtin hardware like timers; and some can be activated in software (eg, through the int command)
19:36
<@ToxicFrog>
Typically they're actual pins on the CPU, or at least the hardware ones are.
19:36 * UndeadAnno nods.
19:36
<@ToxicFrog>
Something pulls them high (or low, depending on your signaling conventions) to signal an interrupt.
19:36
<@ToxicFrog>
Anyways. List of interrupts.
19:37
<@ToxicFrog>
Each interrupt in the list is associated with a memory location, the interrupt vector.
19:38
<@ToxicFrog>
This location contains the address of a procedure, the interrupt handler, which is written to deal with whatever event the interrupt represents.
19:38
< UndeadAnno>
I seem to recall there being a chunk of memory on the memory map labelled as interrupt vectors or something.
19:38
<@ToxicFrog>
When the interrupt occurs, the processor:
19:38
<@ToxicFrog>
- saves the current state, typically by stacking all registers
19:39
<@ToxicFrog>
- calls the interrupt handler
19:39
<@ToxicFrog>
And either the interrupt handler (through a special instruction like RTI) or the processor restores the original state when it's done.
19:40
<@ToxicFrog>
So. From the point of view of the currently executing program, the processor took a bit longer between instructions than normal. From the point of view of the system as a whole, an event suddenly occurred and was immediately dealt with.
19:41
< UndeadAnno>
I see. How long does it have to wait until it can actually do that, though? I don't think it can just drop everything, midway through decoding an instruction, and go call the interrupt vector...
19:41
<@ToxicFrog>
They aren't just used for hardware - they can also be used to implement built-in routines (such as INT 13 for disk access in DOS)
19:41
<@ToxicFrog>
Typically it'll happen at the next clock.
19:41
<@ToxicFrog>
Or, on non-pipelined processors, at the next fetch.
19:42
<@ToxicFrog>
The specifics vary from processor to processor, though.
19:42
< UndeadAnno>
Are the interrupt vectors usually long?
19:43
<@ToxicFrog>
It can (and does) get more complicated - you can typically disable some or all interrupts temporarily, for example, or interrupts might have priority levels such that a high-priority interrupt can occur while a low-priority interrupt handler is still running.
19:43
<@ToxicFrog>
Like I said, they're memory locations.
19:43
<@ToxicFrog>
Pointers.
19:43
<@ToxicFrog>
They're typically however wide a pointer is on that machine.
19:43 Vornicus-Latens is now known as Vornicus
19:44
< UndeadAnno>
So... the vector is the address of the beginning of the subroutine that handles that particular interrupt?
19:44
<@ToxicFrog>
Yes.
19:44
<@ToxicFrog>
In effect, the interrupt vector list is a jump table.
19:45
<@ToxicFrog>
When interrupt, say, 8 goes off, it looks at entry 8 and jumps to that address to execute the handler.
19:45
<@jerith>
Yes.
19:45
<@jerith>
The vectors are usually just far enough apart for a jump to the real ISR.
19:45
< UndeadAnno>
So it's done through indirect addressing. Something like JMP Interrupt_table+Interrupt_number?
19:45
<@ToxicFrog>
Kiiiiiiindof.
19:46
<@ToxicFrog>
First the processor saves the current execution state so it can return there when the ISR completes.
19:46
<@ToxicFrog>
And typically it also masks out other interrupts so the ISR isn't, itself, interrupted.
19:46
<@jerith>
I think each vector is hardcoded.
19:46
<@ToxicFrog>
jerith: no, the location of each vector is hardcoded.
19:46
<@jerith>
That depends on the chip, though.
19:47
<@jerith>
I thought the vector /was/ the location?
19:47
<@ToxicFrog>
The vector contains the location of the ISR.
19:47
<@ToxicFrog>
You are free to write any location into the vector you desire.
19:47
<@ToxicFrog>
But the vector itself will always be at the same place so that the IRQ handling hardware can find it.
19:48
<@gnolam>
And so your assembly can find it.
19:48
<@ToxicFrog>
That too.
19:48
<@jerith>
Nono, I thought the vector was the address the interrupt caused a jump to, not the contents of that address.
19:48
<@ToxicFrog>
...er
19:48
< UndeadAnno>
So, you have to write your own subroutines for handling specific interrupts?
19:48
<@jerith>
Yes.
19:49
<@jerith>
Take a serial port interrupt.
19:49
<@ToxicFrog>
Typically, each entry in the vector list is an address
19:49
<@ToxicFrog>
In C, it would look something like:
19:49
<@McMartin>
Perhaps the 6502 would be a handy example here, since it has a grand total of 3 interrupts.
19:50
<@ToxicFrog>
void do_interrupt(int n) { void * isr = interrupts[n]; asm { jmp isr; }}
19:50
<@jerith>
When a byte comes in, the proc jumps to your ISR, where you have code that does something with the byte.
19:50
<@ToxicFrog>
The vector list is an array of pointers. A single vector is a pointer to the start of the ISR for that interrupt.
19:50 * McMartin nods
19:50
<@McMartin>
On most systems the ISR is actually in ROM, I note.
19:50
<@ToxicFrog>
The interrupt handler loads that pointer into the program counter, in effect.
19:50
<@ToxicFrog>
Er. Processor interrupt handler, that is.
19:51
<@ToxicFrog>
Not the ISR.
19:51
<@ToxicFrog>
McMartin: but you can point (at least some) vectors to stuff in RAM.
19:51
<@McMartin>
The vector almost always is, and then the ISR sometimes does other checks.
19:51
<@ToxicFrog>
Otherwise installing custom ISRs is a problem~
19:51
<@ToxicFrog>
...it is?
19:51
<@ToxicFrog>
It hasn't been on anything I've used.
19:51
<@McMartin>
On the x86, the vector is in RAM.
19:52
<@ToxicFrog>
Likewise on the 68k and 68HC12
19:52
<@McMartin>
The C64 keeps the vector in ROM and the ISR as part of its BIOS, which includes checks to specific *other* locations for user IRQ handling
19:52
<@ToxicFrog>
If it weren't, it would be impossible to install custom ISRs.
19:52
<@ToxicFrog>
Without ugliness like that, at leasy.
19:52
<@McMartin>
This is because it needs to do processing in the ISR to handle things like "scanning the keyboard".
19:52
<@McMartin>
And the 6502 only has one IRQ.
19:52
<@ToxicFrog>
Aah.
19:52
<@ToxicFrog>
Anyways. On the processors UndeadAnno is using, it's in RAM.
19:53
<@McMartin>
(It has *three* vectors, but the other two are POWER and, essentially, VBLANK.)
19:53
<@ToxicFrog>
So custom interrupt handling is just a matter of writing your own ISR, then storing the address of same in the corresponding vector.
19:54
<@McMartin>
(also, cheap shot; on the 68k code I looked at, it was a Genesis cart, so *everything* was in ROM~)
19:54
< UndeadAnno>
So, let me get this straight. Interrupt pin/flag lights up. Execution is stopped, processor state is stored on the stack. With the knowledge of what number interrupt this is, the processor looks up an interrupt vector and goes to the subroutine to which the interrupt vector points. Stuff is done, subroutine ends. Processor state is pulled off the stack. Operation is resumed.
19:55
<@ToxicFrog>
Yes.
19:56
< UndeadAnno>
Yay.
19:56
< UndeadAnno>
Thank you.
19:59
<@gnolam>
And woe befall anyone who writes an interrupt that's more than a few instructions long.
20:00
<@gnolam>
Or "takes more than a few instructions to execute", rather.
20:07 You're now known as TheWatcher[afk]
21:07 Vornicus is now known as Finerty
21:23
<@McMartin>
There are some ugly side points involving how to deal with nested interrupts on some architectures, and on most you at minimum have to watch out for cases where another interrupt happens while you're still stacking the registers.
21:26
< UndeadAnno>
Fun. I've got two PDFs that tell different stories about 68HC05 interrupts.
21:27
< UndeadAnno>
Third PDF claims a story different from the two previous.
21:27
< UndeadAnno>
I wish I had noted down which version of the controller we worked with SPECIFICALLY.
21:29
< UndeadAnno>
Oh, well. I'll pick the least verbose and write which specific version I'm talking about. That's gotta earn me some credit.
21:38 EvilDarkLord is now known as EvilTestingLord
21:38 EvilTestingLord is now known as EvilDarkLord
22:01 UndeadAnno [AnnoDomini@83.21.84.ns-25961] has quit [Ping Timeout]
22:08 UndeadAnno [AnnoDomini@83.21.52.ns-26733] has joined #Code
22:37 Bobsentme [Bobsentme@75.46.20.ns-3148] has left #Code [passed_out.exe]
23:32
<@Derakon>
What's the syntax for generating a list of numbers in Lua? Like the "(0..10)" syntax in Perl?
23:32
<@Derakon>
Or whatever it is Python uses.
23:33
<@McMartin>
range(11)
23:33
<@Derakon>
Danke.
23:33
<@McMartin>
In python
23:33
<@Derakon>
Oh.
23:33
<@McMartin>
In Lua, no idea~
23:36 Xiphias [~Ameroth@Nightstar-13101.wlms-broadband.com] has joined #code
23:46 Xiphias [~Ameroth@Nightstar-13101.wlms-broadband.com] has quit [Quit: I was never gone]
23:53
<@ToxicFrog>
Lua doesn't have a function for it built in, IIRC.
23:53
<@ToxicFrog>
Off the top of my head, two ways:
23:53
<@ToxicFrog>
function range(first, last) local r = {}; for i=first,last do r[#r+1] = i; end; return unpack(r); end
23:54
<@ToxicFrog>
Or 'return r' if you want it as a table.
23:54
<@ToxicFrog>
If you want it as a table, you can also do something like:
23:55
<@Derakon>
Or if I just want to iterate N times, I can do "for i = 1, N do ... end"?
23:55
<@ToxicFrog>
function range(first) return setmetatable({}, { __index = function(self, k) return k-1+first end }) end
23:55
<@ToxicFrog>
However, this probably isn't what you want, because it can't be iterated or exploded (since it doesn't have any real values).
23:55
<@ToxicFrog>
Yes.
23:55
<@Derakon>
Thank you.
23:55
<@ToxicFrog>
it's actually for <name>=start,end[,step]
23:55 * Derakon nods.
23:56
<@Derakon>
It's been a few months since I did any Lua, so~
--- Log closed Sun Feb 03 00:00:39 2008
code logs -> 2008 -> Sat, 02 Feb 2008< code.20080201.log - code.20080203.log >