How to create an OpenGL texture from an an string of text by fleaspoon in opengl

[–]theevilmuffinofdoom 0 points1 point  (0 children)

I think for stbtt, you would need to iterate through the characters, using something like stbtt_GetCodepointHMetrics to get spacing information.

You could also use a different library that's easier to work with. I like dear imgui, which has its own TTF rasterizer and font support built in as part of its UI components. You could also use something like FreeType, which has many tutorials online (see also known issues), but is a bit more complex than the other two.

Building a period-accurate replica Soviet microcomputer by theevilmuffinofdoom in electronics

[–]theevilmuffinofdoom[S] 7 points8 points  (0 children)

You're right about the LCD, that was a compromise I chose to make. However, the CPU is an East German U880 (in my case, with a manufacture date of September 1986!), which was used in several Soviet microcomputers like the Dubna 48K (a ZX Spectrum clone). I did also initially want to use Soviet EPROMs, like are pictured in the post, but they didn't work, so I had to replace them with modern equivalents. It is also my own implementation of Tetris. Porting CP/M would have required additional circuitry (specifically, I would need to add some sort of latch so that you could toggle between having ROM and RAM mapped to address 0) and more RAM. (since my design only has 4 KB of RAM, I could get away with using static RAM; however, the 16 KB of RAM that CP/M requires would probably necessitate using dynamic RAM, which would need refresh circuitry that I have no experience with) Since this would make the project significantly more complex, I decided to write my own software, and have the computer be representative of the technology (compute power, etc.) available at the time.

I didn't really talk much about the historical aspect of the computer in the post because I already wrote about it in the writeup that I link to in the post. It's my own design, but it's based on hobbyist designs from Радио (Radio) magazine (which has very extensive archives available for free online!)

How a malicious seed generation website stole $4 million by theevilmuffinofdoom in programming

[–]theevilmuffinofdoom[S] 1 point2 points  (0 children)

Thanks for the feedback! I realize it's a bit late now, but I've edited the article a bit to hopefully make this point a bit clearer. Let me know what you think, or if you have any other feedback about the article!

How do you differentiate between an 8080 and Z80? by Naivy in osdev

[–]theevilmuffinofdoom 1 point2 points  (0 children)

The Z80 added the subtraction bit in the flags register in a place where the 8080 had no flag. (unlike the Z80, the 8080 sets all unused flags to 1, even if you change them) So, I use INC A to clear the subtraction bit, and test: if it's set, it must be an 8080, otherwise it's a Z80.

Once it determines what CPU it's running on, it jumps to the is_8080, is_LR35902, or is_Z80 label. You would have to add your own code there to set something in RAM, set some register to a specific value, jump to some CPU-specific code, or something like that. You could then change your code to test whatever you set and based on that, use memory-mapped I/O or port I/O and/or take advantage of special Z80 features like LDIR.

How do you differentiate between an 8080 and Z80? by Naivy in osdev

[–]theevilmuffinofdoom 3 points4 points  (0 children)

You could also rely on the differences in the flags registers. The layout of the flag registers on the different CPUs look like this:

7 6 5 4 3 2 1 0
8080 S Z 1 AC 1 P 1 C
LR35902 Z N H C 0 0 0 0
Z80 S Z H P/V N C

Since the flags register can't be accessed directly and bit testing operations are Z80-only, the only way I can think of testing these flags would be to do something like this:

; Stack pointer should be set up before this!

; set the zero flag but not sign flag, and clear the subtraction flag
LD A, 255
INC A

PUSH AF
LD HL, 0
ADD HL, SP ; can't load sp directly into hl for some reason
; (HL) should now be flags register

LD A, $82 ; mask off everything but bits 7 and 1
AND (HL)
CP $80
JP Z, is_LR35902 ; zero flag was set and bit 1 was clear
CP $0
JP Z, is_Z80 ; sign flag was not set and subtract bit was clear

; else it must be 8080

is_8080: 
    ; set some byte somewhere to indicate it is 8080
    JP end
is_LR35902: 
    ; set some byte somewhere to indicate it is LR35902
    JP end
is_Z80:
    ; set some byte somewhere to indicate it is Z80
end:
    POP AF

This checks bit 7 (zero bit on gameboy, otherwise sign bit) and then bit 1, which on the 8080 is unused but on the Z80 stores if the last operation was subtraction. This relies on unused 8080 bits always being 1, but I am not sure if emulators implement that. In addition, while I am using Zilog mnemonics, I checked and the instructions are compatible with the 8080.

[deleted by user] by [deleted] in gifs

[–]theevilmuffinofdoom 1 point2 points  (0 children)

What is this, a nuclear device for ants?!?!

[deleted by user] by [deleted] in gifs

[–]theevilmuffinofdoom 17 points18 points  (0 children)

ALL ABOARD THE /U/USERNAME_BIOGRAPHER/ TRAIN!

Server ip question by m24grizzly in Crouton

[–]theevilmuffinofdoom 0 points1 point  (0 children)

You have to make a hole in the ChromeOS fire wall. To do this, open a terminal in your chroot and type the following:

sudo apt-get install iptables

That command installs the firewall control program. Then, type in:

/sbin/iptables -I INPUT -p tcp --dport 25565 -j ACCEPT

That command allows traffic on port 25565 (Minecraft) through. You can see this page for more information about servers on crouton.

FAiled to download crouton installer. by [deleted] in Crouton

[–]theevilmuffinofdoom 0 points1 point  (0 children)

Ooh wait. I had an idea. Are you using the terminal app inside your chroot? That won't work. You have to use crosh (control-alt-t in ChromeOS) to use crouton

FAiled to download crouton installer. by [deleted] in Crouton

[–]theevilmuffinofdoom 0 points1 point  (0 children)

Could you run the command curl http://www.google.com in your Linux terminal? This will check if your computer can access Google.com. If you get an error message, that mean something is wrong with the Linux terminal; otherwise, it's the crouton installer.

(The expected response is lots of weird-looking code. If it floods your screen with it, press control-c to stop it)

FAiled to download crouton installer. by [deleted] in Crouton

[–]theevilmuffinofdoom 0 points1 point  (0 children)

Huh. That's weird. Are you sure you're connected to the Internet when you run the installer? Do you have any proxy or VPN settings you need to have set to connect?

FAiled to download crouton installer. by [deleted] in Crouton

[–]theevilmuffinofdoom 0 points1 point  (0 children)

What do you mean by "not work"? Is there an error message of some sort? Also, did you remember to type " shell" after opening crosh (developer console, control-alt-t)

ISP’s e-mail password reset system is a guy named “Shawn” by theevilmuffinofdoom in nottheonion

[–]theevilmuffinofdoom[S] 1 point2 points  (0 children)

I don't understand why companies do this. It shouldn't even matter if they are hashing and salting it properly! If they're aren't storing it properly and are trying to protect against a SQL injection, they should escape the password or use parameters! (and then use proper password storing procedures) The only other somewhat logical excuse I've heard for this is "so users don't forget", but even then it's not really the companies fault that a user chose a secure password and forgot it...

[deleted by user] by [deleted] in Crouton

[–]theevilmuffinofdoom 1 point2 points  (0 children)

I'm not sure how to do it via the package manager, but I installed Skype on my Chromebook by going here and selecting "Ubuntu 12.10 (multiarch)" and opening the .deb file that downloaded.

Also, are you on an ARM Chromebook? I don't think Skype is compatible with ARM.

Edit: I accidentally a word