« first day (781 days earlier)      last day (3240 days later) » 

12:00 AM
RELOAD!
There are 1398 unanswered questions (94.3606% answered)
 
i suppose i can put the "kernel" printing lines after the bunch of nops, just to be sure all the memory is loaded
 
@MotokoKusanagi I see. In a traditional physical environment, the bootloader and the OS would be different source files and usually written separately to the disk. I'm not so used to directly creating an image file.
 
if it gets too big i may end up splitting up the files and using include directives
 
Also, you should know that although cli hlt will mostly stop the processor, unmasked interrupts (such as NMI) could still occur.
 
12:04 AM
'hlt' is OK for learning, but here: jmp here is more certain.
It won't be a noticeable difference until you try with real hardware.
And speaking of real hardware, the real stuff is a little bit messier.
 
i thought so
 
Specifically, all BIOS is supposed to jump to 0000:7C00h but some jumps to 07C0:0000h which is just flat wrong, but ... it exists.
That means that you need to be careful with code offsets.
And make sure that everything takes relative addresses.
Specifically, all BIOS is supposed to jump to 0000:7C00h but some jumps to 07C0:0000h which is just flat wrong, but ... it exists.
 
is there a way to get rid of the %define START 0x7C00 and just capture the starting address?
 
Again, this is pretty esoteric stuff if all you're really wanting to do is experiment with virtual machines.
@MotokoKusanagi No, because that %define START is a directive to the assembler. That can (and should) stay as is, but the code needs to be OK even if the code segment is not set to 0.
There are two ways to do that. The easiest way is to simply force the code segment to be what you want by doing a far jump (which sets both CS and IP).
The other way is to do a lot of mathematical gymnastics and to alter the code offsets after loading, which is difficult to do correctly.
 
i suppose i can start off the bootloader by just copying the first sector to the correct address. do you see any problems with my code regarding specific addressing (besides the compiler directive saying "expect to be here")
 
12:14 AM
In fact, that's exactly how most bootloaders do it.
Some copy themselves to a particular location in memory and then far jump there.
 
so basically far enough that no sensible bios would put anything there
 
Back in the old days, there was no such location, because any add-in card might have its own address space for both ROM and RAM.
 
CodeReview might be a better choice — MadProgrammer 7 secs ago
 
Why would you want to copy the bootloader and place it some place else?
 
These days, however, directly after where the bootloader is loaded is a pretty safe bet.
@SirPython Two reasons: One is so that all you have to write portably (that is, address agnostic) is the part that copies the bootloader. The second, much less common, is that the bootloader might be compressed on disk and you need to uncompress it to some other location to run.
It's even possible for the bootloader to go from real mode to protected mode and set up all of the sectors on behalf of the OS that's loaded afterwards, but I've never seen that actually done in commercial software.
That's done by Linux bootloaders such as grub and LILO, if I recall correctly, but as part of a multistage loader and not in a single sector loader.
 
12:22 AM
Is the OSDev wiki a good place to learn more about bootloaders and BIOS?
 
@SirPython Probably, but some of the information there is so out of date that even I recognize it. :)
 
the only thing i can think of is if i put some instructions for loading the first sector in 0x7C00, it may overwrite the instructions necessary for returning and jumping to main
 
0
Q: Need help to optimize a skill system

Andy Mapublic SkillType[] skills; public SkillType a, b, c; public int acost, bcost, ccost; public int acooldown, bcooldown, ccooldown; skills = new SkillType[2]; skills[0] = a; skills[1] = b; skills[2] = c; acost = a.getCost(); bcost = b.getCost(); ccost = c.getCost(); acooldown = a.getCooldown(); bco...

 
@MotokoKusanagi No, I mean just after the bootloader's space which is 7c00 + 200 = 7e00
 
7e00 is where my kernel starts
if you can call it a kernel... it just extends the instructions of the loader
i think i'm going to leave that special case off the table for now
 
12:31 AM
I'm voting to close this question as off-topic because it appears to belong on codereview.stackexchange.com — Peter Duniho 21 secs ago
 
Yes, that's just fine. Just like my dummy kernel
 
that reminds me
is video mode 7 that important?
mine is zero
 
Not that important. Use whatever works.
 
What is 0x7C00 in relation to a physical floppy drive? Like, AA and 55 are the last two bytes of the 1 sector of the 0th track of the 0th head.
 
@Mat'sMug github.com/nhgrif/SQLConnect/releases/tag/1.0.0 I finally got around to doing this.
 
12:38 AM
The difference is that mode 0 is technically CGA resolution (40x25) while mode 7 is 80x25. It's been so long since CGA existed, I'd not be at all surprised if you said you'd never seen one.
 
@SirPython 0x7C00 is the address in memory, not the disk
 
@SirPython No relation to the drive. It was an arbitrary location in memory chosen by the original IBM BIOS engineers.
 
i had an ega once...
 
But isn't memory stored on the disk?
 
@SirPython Not exactly.
 
12:40 AM
memory meaning RAM
 
If it's not too anachronistic, consider getting books from the shelves of a library.
The library is disk, while your small work table in the library is RAM.
 
So the bootloader/other code on the disk is loaded into RAM?
 
You can only hold a small subset of books on your table, but where you place them on the table is up to you.
@SirPython Yes, anything that's used by the computer must be in RAM at some point.
 
and the registers are something like the page you're reading, i guess
 
@MotokoKusanagi Yes, that's about good.
 
12:44 AM
This question is perfect for [codereview.stackexchange](codereview.stackexchange.com). — helix 35 secs ago
 
@MotokoKusanagi And cache could be the individual book in front of you, if we can stretch the analogy a little farther.
I have to go now, but look forward to reading more of your assembly language experiments!
 
@MotokoKusanagi Is there a tool that you use to get a memory dump?
 
qemu - memsave
then hexdump and diff
against the original binary
memsave is in qemu
hexdump and diff are linux programs
so i qemu i can type memsave 0x7C00 0xFFFF dump.bin, and get all 64kBs
then i can use hexdump to obtain a readable form of both the compiled binary, and memory to be compared with diff
because the memory should start off as an exact copy of the disk
and since it's 16 bit mode, the largest address i can use is 64kB
while running qemu, if you press ctrl-alt-1 or ctrl-alt-2, you can switch between machine output and the console
 
Sorry; I'm having a little trouble following along. What should I type for the diff command?
 
12:59 AM
use diff a b if your two files are a and b
 
Then it just tells me that my files differ.
 
Oh, sorry. I thought there was more to it.
 
first, you get a memory dump of the machine, then you get hexdumps of both the memory dump, and the compiled binary, then compare the differences between the unexecuted binary, and the executed binary
 
@Hosch250 i just pulled resx translation helper, i'm getting a NullReferenceException in ResXTranslationHelperVM, line 145 -- _localizedData is null
 
1:03 AM
Hmm, that's weird.
 
@MotokoKusanagi Is there a way with the diff command to see the differences between the two files, rather than just a message say that they are different?
 
i haven't loaded any files
 
Huh, it wasn't doing that for me.
Hold on - I'm working on a bigger better version, and I accidentally used the same branch.
 
that's what diff does, it shows the difference
 
Can you download the release and see if that works?
 
1:04 AM
@nhgrif nice!
 
@MotokoKusanagi Hm... mine does not do that. I'll have to look more into the command line options.
 
$ diff a b
1,6c1,7
< 0000000 2ceb 08eb 00bb b400 cd0e 4610 048a 003c
< 0000010 f275 bbc3 7e00 c38e 00bb b400 b002 b501
< 0000020 b100 b601 cd00 7213 26ea 26ff 0000 31fa
< 0000030 8ec0 8ed8 fbc0 40be e87c ffc6 d5eb f4fa
< 0000040 6f6c 6461 7265 0a0d 9000 9090 9090 9090
< 0000050 9090 9090 9090 9090 9090 9090 9090 9090
---
> 0000000 29eb 08eb 00bb b400 cd0e 4610 048a 003c
> 0000010 f275 b4c3 b200 cd00 b413 b002 b501 b600
> 0000020 b100 bb01 7e00 13cd d5e9 fa01 c031 d88e
> 0000030 c08e befb 7c43 c9e8 ebff bed8 7c4c c1e8
 
No, that's not going to make a different.
 
I haven't pushed.
 
1:05 AM
@Hosch250 yep it crashes, release 1.1
 
Yeah, I'm testing that now.
I switched branches.
Weird, it isn't crashing for me at all.
 
Binary files boottest and dump.bin differ
 
after starting the app, double click on the empty Value cell, then double click on the empty Localized Value cell
 
Yes, got it.
That is in the RemoveNode() method.
 
yep
 
1:08 AM
Every time you save an edit, I remove/add the node.
So, you are supposed to load the values before you do that...
Quick fix coming.
 
@SirPython use hexdump
and send it to a file with >
then use diff
 
Ah yes; that works perfectly.
 
That should fix it, @mjolka.
So, why did you pull it?
Do you have something you need to localize, or are you just interested?
 
just interested
 
I'm making it support 1-N files at a time now.
 
1:10 AM
that's a cool feature!
 
I didn't update the download.
I'll do that later.
 
@MotokoKusanagi and @Edward Thank you very much for all the help that you provided.
 
I think you're looking for codereview.stackchange.comTiny Giant 29 secs ago
 
Does it work?
 
1:17 AM
yep, all good
 
Good.
 
@mjolka git commit -ma "..." throws an error as appose to -am :O
 
If you want your changes to be saved, you'll have to enter two files to work from.
 
didn't know it even matters to put parameters in order :D
@QPaysTaxes ain't that crazy :)
are you SURE ! :)
@QPaysTaxes that explanation reduces it's crazy level a lot though :D
so you mean -m is a parametered flag? which one is a parameter which one is a flag. just want to familiarize myself with the glossary of it really
@QPaysTaxes Now I totally agree with you. So I paraphrase my question. ain't I crazy!?
:D thanks. it was a good point. Now that I know the reason I won't ever make the same mistake (I hope) :D
 
0
Q: The loading bootloader (follow up)

Motoko KusanagiI am pretty confident that my new bootloader is in good enough shape to post a follow up for my last question; a bootloader that actually loads! The idea behind it is it loads the remaining sectors on the disk (total 64kB for 16 bit address space). That way it's basically extending itself with ad...

0
Q: PowerShell Unpivot Object

JohnLBevanBased on a question on SO I thought I'd knock up a cmdlet to perform an unpivot on an object. I've not yet considered all the options (e.g. what happens when objects with empty lists are passed), so there are likely a few issues, but I wanted to get it out to the community early / see if people ...

 
1:25 AM
@QPaysTaxes I kept a dream diary for 3 years and from since I remember it all :/
maybe that made me more confused about Git
@QPaysTaxes Like the one in the Orange is the New Black?!!
 
ps. I've created a cmdlet which may help (i.e. you can just call the commandlet rather than having to tweak the more complex code above: codereview.stackexchange.com/questions/94509/… - not yet perfect, but being on code review its imperfections will soon be highlighted / can be resolved (or a better alternative found). — JohnLBevan 55 secs ago
 
Is this her? cuz if she is you are dreaming next level :D
 
@Mehrad love that show
 
I can quickly photo shop some long hair if the rest is okay
@mjolka Unfortunately finished it last week. Now the world is blank. If it wasn't for C# and Luther I wouldn't know what to do :P
@QPaysTaxes My girlfriend loves it and I grind my teeth :D
I watched a season of it afair
Not saying it's bad though. But I kinda compete to have better abs than Oliver and that makes it hard to keep up :D
hahahahah... I didn't hear that
@QPaysTaxes I have three french work mates and they bring crepes with Nutella and banana slices and that day is hard to go through :P
It's even harder than receiving exceptions with no inner exceptions and no description
Well. I thank you again for the tip. It cleared up so much confusion
 
1:50 AM
0
Q: Created classes with the same name. How does this work?

FragMonkeyI am a beginner at C# and am currently learning all about List collections and such. I am wondering how/why the code below works: I create a list of students: // Create student list List<Student> ListStudents = new List<Student>(); I use a WPF button click event to add a new Student (a class)...

 
@rolfl Concerning your benchmark... I'm afraid, I confused Arrays.fill and arraycopy. The former has a special handling in hg.openjdk.java.net/jdk8/jdk8/hotspot/file/55fb97c4c58d/src/…
And maybe the speed depends mostly on the array sizes and memory/cache bandwidth, does your array fit in L1? L2? L3?
And hi everyone....!
 
2:07 AM
@maaartinus I ran it for result arrays of 20,000 and 200,000
larger than L1, maybe L2
Also, System.arraycopy is a native method, probably not impacted by JIT at all.
 
I do like getting random Nice Answer badges on Meta. :-) Thanks, Meta Santa!
 
@rolfl Being native means nothing when JIT decides not to call it. And IIRC it does. I may be confusing things again, but the JIT overhead is pretty deadly for small arrays and there's nothing JIT couldn't do equally well.
 
1
Q: Are Codegolf KOTH controller programs allowed here?

Faraz MasroorI am in the process of writing a KOTH challenge for Code Golf (it's on the meta sandbox), and like for all KOTH challenges I need to write some code to pit everyone's bot against each other. I've done this but before my question goes live, I need people to review my code so that users can underst...

 
The Oracle/OpenJDK JIT system is a little foreign to me. I know the IBM JDK better. A native method is essentially C/C++/assembler code that is pre-compiled at a fixed optimization. The only additional optimizations that can be done on top of that is to essentially inline the function to the calling Java method's compiled code.
The native code in the JVM for things like arraycopy are probably hand-tuned for each JVM, and optimized using all sorts of other heuristics and tools.
While it is true that the JIT may/will compile regular loop code down to something fast, I don't expect it can compete... and the numbers "prove" that
You see that with things like C++ too.... strlen is faster than just a loop to count chars.
no matter how well you optimize it in the compiler.
memcopy, memset, etc. can do tricks that the optimizer will miss.
Under the covers, the arraycopy is probably doing something like a memcopy.
 
2:23 AM
Random question, not sure if it belongs here, but I don't really frequent any other chatrooms
So supposing I have code that takes hours in java, presuming the algorithm and implementation is near perfect in performance, memory, whatever, what could I do next to speed things up? Throwing more resources at it can help until you run out of resources, so whats the next step? Porting to assembly?
 
Read up on amdhal's law.
Amdahl's law, also known as Amdahl's argument, is used to find the maximum expected improvement to an overall system when only part of the system is improved. It is often used in parallel computing to predict the theoretical maximum speedup using multiple processors. The law is named after computer architect Gene Amdahl, and was presented at the AFIPS Spring Joint Computer Conference in 1967. The speedup of a program using multiple processors in parallel computing is limited by the time needed for the sequential fraction of the program. For example, if a program needs 20 hours using a singl...
 
I don't disagree, except for "I don't expect it can compete" part. If it does special handle something, it can. Concerning strlen and loop, the compiler can see that you're doing strlen manually and replace you loop by the call.
In Java, such things usually don't happen. Especially all the Integer and Long methods like bitCount are much faster than when you do exactly the same in your own code. That's because only such method get recognized as intrinsic.
 
I think we're getting in to esoterics... and experience here.
IBM Java has specific intrinsics that identify special patterns in the code.... and it may well pick up on an arraycopy-by-loop.....
It's also true that the JIT may well optimize things down to the same performance as a native method.
I just happen to "know" that System.arraycopy "can't be beaten" for performance, etc.
It is the right tool for the job, and, in the past 10 years other things have improved, but not enough
 
@rolfl Thanks for the link
 
@spyr03 - yours is an interesting problem, I don't mean to dismiss it, I am distracted with native Java ;-)
for long-running Java problems, there's a few ways to go when optimizing it, depending on how bad the code performs compared to expectations... when you start.
 
2:30 AM
regarding System.arrayCopy, would making two identical arrays at the time of creation be faster than making an array and copying it? Presuming you know it needs to be copied? What about 3 instead of two?
 
There is no easy way to compare Java performance with C/C++
Part of the problem is that Java has an interpreted time, a compile time, and a compiled time.
With C++ the code is never interpreted, and the compile time is completed before the program starts.
 
@rolfl Agreed, general vectorization is still missing and not everything is optimal. I posted such a thing or two on SO someday.
 
@QPaysTaxes Here's the output for the performance of the array-copies we were talking about earlier.....
 
I personally believe there will be a C3 in a couple of years trying and evaluating various C2 strategies. Written in Java.
 
Task ArrayCopies -> MJolka: (Unit: MICROSECONDS)
  Count    :    100000      Average  :   13.6460
  Fastest  :    7.5000      Slowest  : 2057.3400
  95Pctile :   19.7370      99Pctile :   28.0260
  TimeBlock : 18.473 12.918 13.027 13.200 13.373 13.071 12.927 13.053 13.282 13.145
  Histogram : 87680 11579   658    53     2     4    19     4     1
@QPaysTaxes ^^^^ That is a list of numbers, let me explain it to you, though.
I did the same operation 100,000 times.
the slowest of the lot took over 2 milliseconds.
the fastest took 7.5 microseconds.
500-times faster, or so.
yes.... now, look at the TimeBlock....
the average times of the first 10% was 18.5microseconds.
the average time of the next 10% was 13 microseconds....
TimeBlock : 18.473 12.918 13.027 13.200 13.373 13.071 12.927 13.053 13.282 13.145
yes
What is the performance of the function?
microseconds.
no, 7.5 microseconds.
unless only the first time is important, in which case, it's 2000 microseconds.
exactly
So, with C++, the same operation, hypothetically, will be 10 microseconds for every version.
C++ won't have a slow, or fast run.
C++'s run time may be faster, or slower, than Java's fastest run.
It is almost certain, though, that if you have a small program, that does not do much, that the C++ version will always be faster.
But, if you have a long-running program, wwhere JIT is able to compile down the code, then the JIT actually has a number of advantages that C++ does not have.
yes
 
2:41 AM
Oh I know this one
assembly is human readable machine code
 
In IBM's Java, it uses the same compiler engine and intermediate-code format that IBM's C, C++, and Fortran systems use.
What Java can do, though, is it can inline the code in different ways for different functions, and, for example, strip out impossible conditions when they will never happen....
for example, you may have a guard-clause in something that checks for indexes that are out of bounds.... but, when you use that function, the JIT compiler can prove tha tthe conditions will never happen, so it just strips that before the compile.
you may have the conditions in one place, but not another.
The Java JIT can also norrmally inline code a whole lot smarter than the static-compiled C++.
But, smart compiling, and smart diagnostics, and tracking, are expensive, and that compile time is a cost of running Java.... especially when the Java code is often compiled multiple times at different levels of compilation and optimization each time.
 
... and deoptimized. ;)
 
and deoptimized, yes.
 
Repeatedly.
 
Link on deoptimized Java? Why? For later better optimization?
 
2:47 AM
for methods that are no longer called often, they can be removed from the call sites.
All this compiled code has to sit in memory somewhere, and Java has to swap out some things when it starts getting full ;-)
 
Quite often, because of optimization invalidated e.g. by loading a new class. Every non-final non-private method is Java is virtual, which is damn costly. With only one implementation of a given class, it may be devirtualized. When another class gets loaded, this mayn't hold anymore.
 
Back to the original question:
18 mins ago, by QPaysTaxes
Would porting to C/C++ have any noticeable impact on the speed?
probably.... actually... ;-)
 
The speed depends on the programmer a lot. I guess, my C++ would be slower than my Java.
 
the bigger issue, though, is would there be fewer bugs, can you run it on other systems, can you interoperate with more code, and have access to more comprehensive libraris.
While well-written Java performance is not likely going to ever beat well-written C++ equivelents in terms of performance, the Java version of the code will likely be quicker to get running, on multiple platforms, and will be easier to support, fix bugs, and so on.
 
@QPaysTaxes This is pretty complicated stuff and after having read it many times, I believe I understand the performance much better than before: github.com/google/guava/issues/1268
BF? Brainfuck?
 
2:54 AM
Hey @maaartinus did you ever get around to posting that collatz sequence code? I haven't looked at it in a while, but I would love to see how you coded it
 
This reminds me of this wonderful sentence "That's only Brainfuck, not anything truly obfuscated and unreadable like Java".
@spyr03 No idea. There's something here, github.com/Maaartinus/collatz, but don't ask me if it's up to date.
 
TY
 
@spyr03 For what I think is an interesting take on collatz, see codereview.stackexchange.com/questions/84669/streaming-collatz
 
Funny. However,I find Java pretty good. It's a bit verbose, but with Lombok & Guava, it's not really bad. It has tons of things I could complain about for days, but all in all, it's fantastic.
 
Apart from the Guava, and Lombok, that ^^^^ ;-)
 

« first day (781 days earlier)      last day (3240 days later) »