Programming
Moderator: Aesthetics
This topic is interesting to me in that I started out wanting to do computer programming but eventually switched to sound engineering because I was a hell of a lot more passionate about that and would have rather made a living being broke and trying to weasel my way into the profession than sitting in an office doing code all day.
Also, I think a big part of me switching careers was that my programming courses consisted one year of making bubble graphs in Microsoft Powerpoint to learn the programming "workflow" - It was extremely boring, didn't learn a thing about programming or coding (neither did anyone else in the class) and felt like a year wasted.
To all the programmers out there though, I tip my hat to you! There is a lot more dough to be made in that profession than trying to break into the audio scene.
Also, I think a big part of me switching careers was that my programming courses consisted one year of making bubble graphs in Microsoft Powerpoint to learn the programming "workflow" - It was extremely boring, didn't learn a thing about programming or coding (neither did anyone else in the class) and felt like a year wasted.
To all the programmers out there though, I tip my hat to you! There is a lot more dough to be made in that profession than trying to break into the audio scene.
http://www.kashmirboots.com/upload/minisim.c
Mini x86 simulator which I just made in an hour .. and which doesn't support a lot of things like JMP/CALL, flags, memory and stack and so on. It's basically just a little framework.
Output:
Mini x86 simulator which I just made in an hour .. and which doesn't support a lot of things like JMP/CALL, flags, memory and stack and so on. It's basically just a little framework.
Output:
Code: Select all
MOV EAX, 0x10000001
EAX: 10000001 ECX: 0 EDX: 0 EBX: 0
ESP: 0 EBP: 0 ESI: 0 EDI: 0
MOV ECX, EAX
EAX: 10000001 ECX: 10000001 EDX: 0 EBX: 0
ESP: 0 EBP: 0 ESI: 0 EDI: 0
DEC ECX
EAX: 10000001 ECX: 10000000 EDX: 0 EBX: 0
ESP: 0 EBP: 0 ESI: 0 EDI: 0
ADD EAX, 0x22
EAX: 10000023 ECX: 10000000 EDX: 0 EBX: 0
ESP: 0 EBP: 0 ESI: 0 EDI: 0
XOR EAX, 0xDEAFBABE
EAX: CEAFBA9D ECX: 10000000 EDX: 0 EBX: 0
ESP: 0 EBP: 0 ESI: 0 EDI: 0
MOV EDX, 0xCEAFBA9D
EAX: CEAFBA9D ECX: 10000000 EDX: CEAFBA9D EBX: 0
ESP: 0 EBP: 0 ESI: 0 EDI: 0
XOR EAX, EDX
EAX: 0 ECX: 10000000 EDX: CEAFBA9D EBX: 0
ESP: 0 EBP: 0 ESI: 0 EDI: 0
Borné dans sa nature, infini dans ses vœux, l'homme est un dieu tombé qui se souvient des cieux.
http://kashmirboots.com/upload/ld.html
A program which I started 24 hours ago which is able to decode the length of an instruction in bytes.
A program which I started 24 hours ago which is able to decode the length of an instruction in bytes.
Borné dans sa nature, infini dans ses vœux, l'homme est un dieu tombé qui se souvient des cieux.
http://kashmirboots.com/upload/disasm1.html
Disassembler which I started Tuesday evening.
I think it would be fun to invent a fantasy CPU architecture and write a disassembler/emulator for it.
Ok I'll stop spamming now.
Disassembler which I started Tuesday evening.
I think it would be fun to invent a fantasy CPU architecture and write a disassembler/emulator for it.
Ok I'll stop spamming now.
Borné dans sa nature, infini dans ses vœux, l'homme est un dieu tombé qui se souvient des cieux.
Ha no way! Thats exactly what im working on right now.Guido wrote:http://kashmirboots.com/upload/disasm1.html
Disassembler which I started Tuesday evening.
I think it would be fun to invent a fantasy CPU architecture and write a disassembler/emulator for it.
Ok I'll stop spamming now.
I've chosen 24 basic instructions, 3 registers + a stack pointer. I've kept the instruction coding fairly simple:
byte 1 contains the opcode. byte 2 contains details of the register operands and any immediate values.
I've almost finished a basic assembler for it.
bytecode dissasembly is already working too.
I havent started on the emulator yet because im toying with the idea of writing a binary translator to convert it into obfuscated and semi random x86 instructions as part of a polymorphic program
I can post a zip of the source when I finish the assembler if anyone wants.
Just ask here.
Thanks for posting your source here guido, its always interesting to have a look at. I'm about to have a look at your instruction length decoder. Please, spam away
Cool, i'll get back to you on that soon guido, that would be cool
.
As for the assembler/dissasembler I was writing here is an exe and the source.
Expect some messy code, i should realy tidy it up.
http://www.zshare.net/download/91265166b8332a99/
It does some syntax checking and provides some somewhat helpfull error mesages.
you might want to recompile just in case my computer has a virus or something just to be safe.
It shouldnt, but who realy knows...
I have writen a quick document also, hopefully providing some information about the instructions i
have chosen and how they are encoded/decoded.
the command line switches to use the program are detailed in the document also.
i'm going to start writing the emulator soon, to check everything is ok before I write a binary translator.
here is an example of it dissasembling some random instructions I assembled:
As for the assembler/dissasembler I was writing here is an exe and the source.
Expect some messy code, i should realy tidy it up.
http://www.zshare.net/download/91265166b8332a99/
It does some syntax checking and provides some somewhat helpfull error mesages.
you might want to recompile just in case my computer has a virus or something just to be safe.
It shouldnt, but who realy knows...
I have writen a quick document also, hopefully providing some information about the instructions i
have chosen and how they are encoded/decoded.
the command line switches to use the program are detailed in the document also.
i'm going to start writing the emulator soon, to check everything is ok before I write a binary translator.
here is an example of it dissasembling some random instructions I assembled:
Code: Select all
D:\Projects\Metamorph\Release>metamorph -d -i ./out.mcode
-------------------------
Dissasembling 34 bytes...
ADR | OP OP1 OP2
-----.-------------------
0000 | NOP
0002 | NOP
0004 | CALL (&0018)
000A | LOAD R6 0xCAFEBABE
0010 | LOAD R2 0x0000DEAF
0016 | SUB R1 R2
0018 | JMP (&0000)
001E | MOV R3 ST
0020 | OR R1 R2
D:\Projects\Metamorph\Release>
I just finished a first version of the emulator/debugger:
Source, Exe, and examples included -
http://www.zshare.net/download/9130179465e1fce5/
Here is a wee screenshot of the debugger working:
Source, Exe, and examples included -
http://www.zshare.net/download/9130179465e1fce5/
Here is a wee screenshot of the debugger working:
Code: Select all
.------.--------------------------
| ADR | OP OP1 OP2
.------.--------------------------
| 003C | POP R4
| 003E | POP R0
| 0040 | POP R1
| 0042 | POP R2
| 0044 | ADD R0 R1
| 0046 | ADD R0 R2
| 0048 | PUSH R4
| 004A | RET
.----------------.----------------
| .registers | .stack
.----------------.----------------
| R0: 0x0000000E | 0x00000034
| R1: 0x0000001C | 0x00000070
| R2: 0x00000070 | 0x0000001C
| R3: 0x00000010 | 0x0000000E
| R4: 0x00000034
| R5: 0x00000001
| R6: 0x00000007
| ST: 0x0000005F
Press enter to step...
That's really cool! I'll surely also write a fantasy architecture when I'm done with my x86 disassembler/simulator.
So where did you learn all this stuff? Assembly language, disassemblers and emulators are fairly advanced matter in the world of computing. Personally I'm 100% self-taught.
edit: my disassembler is now about 900 lines of plain C code long with only a couple of instructions missing. Intel really did their best to complicate their opcode encoding system
. It now works with a lot of switch/case statements but after this is completely done and functional I want to replace that with a faster and more readable table-driven decoding system. And when that is done I'll proceed to write an emulator to operate on the structs the disassembler produces. http://kashmirboots.com/upload/disasm.html
So where did you learn all this stuff? Assembly language, disassemblers and emulators are fairly advanced matter in the world of computing. Personally I'm 100% self-taught.
edit: my disassembler is now about 900 lines of plain C code long with only a couple of instructions missing. Intel really did their best to complicate their opcode encoding system
Borné dans sa nature, infini dans ses vœux, l'homme est un dieu tombé qui se souvient des cieux.
Like you im also self-taught.
I did do a degree in Computer Game Development, but I wasnt learning anything programing wise that i hadnt already encoutered. I started real programming perhaps when I was around 13 i think, and i've been doing it ever since.
I ment to point out that i'm going to change the way stacks are handled by the emulator because right now its not possible to access values on the stack without a pop instruction. its almost useless for practical programs as it is.
But on the plus side, now that i have proven the assembler and instruction encoding work i'll get started on a binary translater most likely.
Your length dissasembler looks realy neat I can think of a bunch of cool uses for it.
I did do a degree in Computer Game Development, but I wasnt learning anything programing wise that i hadnt already encoutered. I started real programming perhaps when I was around 13 i think, and i've been doing it ever since.
I ment to point out that i'm going to change the way stacks are handled by the emulator because right now its not possible to access values on the stack without a pop instruction. its almost useless for practical programs as it is.
But on the plus side, now that i have proven the assembler and instruction encoding work i'll get started on a binary translater most likely.
Your length dissasembler looks realy neat I can think of a bunch of cool uses for it.
So, is anyone still programming here?
Around October I worked on a RAR archive password breaker (brute force) and after putting quite some effort into optimizing it and comparing it to other (commercial) crackers my cracker is basically the fastest one in the world, as far as I know. At the moment it's Linux and CLI only, and cracks only RAR 2.X archives (not version 3). If a password longer than a couple of characters is used RAR 3 cracking is pretty much pointless anyway, because it uses AES encryption which is impossible to brute force quickly.
Then I worked full-time on an x86 disassembler and emulator. The source code is now about 4000 lines and it is able to disassemble and emulate almost all instructions up to 80286. Once I have implemented certain interrupt handlers such as screenprinting and disk functions I should be able to boot to the DOS prompt
.
Once the program has matured more I'd like to experiment with runtime analysis, heuristic malware detection and that kind of stuff. Eventually I'd like to extend it to 386 compliance, but there's still a lot left to do.
Around October I worked on a RAR archive password breaker (brute force) and after putting quite some effort into optimizing it and comparing it to other (commercial) crackers my cracker is basically the fastest one in the world, as far as I know. At the moment it's Linux and CLI only, and cracks only RAR 2.X archives (not version 3). If a password longer than a couple of characters is used RAR 3 cracking is pretty much pointless anyway, because it uses AES encryption which is impossible to brute force quickly.
Then I worked full-time on an x86 disassembler and emulator. The source code is now about 4000 lines and it is able to disassemble and emulate almost all instructions up to 80286. Once I have implemented certain interrupt handlers such as screenprinting and disk functions I should be able to boot to the DOS prompt
Once the program has matured more I'd like to experiment with runtime analysis, heuristic malware detection and that kind of stuff. Eventually I'd like to extend it to 386 compliance, but there's still a lot left to do.
I work as a software engineer so I do a fair amount of programming. I'm most interested in visualization, so when I program in my free time it's usually graphics-based. Your stuff sounds interesting, I rarely touch the lower level side of things.
One small step for man, one giant leap for Wagon Christ.
Lately I've been writing a lot of programs that visualize mathematical concepts (e.g. Brownian motion). I'm really attracted to the idea of "seeing" data. More recently I've been trying to think of an interesting way to visualize my music library, but so far I haven't come up with any good ideas.
My best guess is you're writing your stuff in C? I have a strong object oriented background so I stick to C++. My C isn't bad but I don't have much experience with procedural programming.
My best guess is you're writing your stuff in C? I have a strong object oriented background so I stick to C++. My C isn't bad but I don't have much experience with procedural programming.
One small step for man, one giant leap for Wagon Christ.
- Waterbagel
- Dayvan Cowboy
- Posts: 1922
- Joined: Sun Aug 09, 2009 12:50 am
- Location: gulf coast US
Cool stuff Guido and Noum
Have I replied in this thread already? *scolls down*
No I haven't
I've been interested in programming since I was 10, and I started playing around with my uncle's Commodore 64. He eventually gave me my own, which eventually got replaced with a Commodore 128 (which is still in my room). During that time I learned a lot of BASIC and even a little bit of assembly. I spent a lot of time in those days typing in programs that were in books. I'd love typing them in and then seeing the resultant working program. I have to admit though, I didn't do a whole lot of original programs, it was mostly looking at existing programs and trying to figure out how they worked.
Eventually I graduated to using modern computers around the time my family finally got the internet in like 2002, and I learned a whole lot about them. I didn't really start doing programming for them though until I went to college and learned java and C. In the intermittent time I mostly just did mIRC scripting, which I'm not sure really counts.
These days I have a job as a "release engineer" for imaging software for printers. There isn't a whole lot of programming involved, except for making perl and bash scripts and dissecting and modifying existing ones other people have made. I want to get a more programming-oriented job eventually. I also need to motivate myself to do more stuff on my own, like your project, Guido. I've always wanted to play around with something low level like that.
Have I replied in this thread already? *scolls down*
No I haven't
I've been interested in programming since I was 10, and I started playing around with my uncle's Commodore 64. He eventually gave me my own, which eventually got replaced with a Commodore 128 (which is still in my room). During that time I learned a lot of BASIC and even a little bit of assembly. I spent a lot of time in those days typing in programs that were in books. I'd love typing them in and then seeing the resultant working program. I have to admit though, I didn't do a whole lot of original programs, it was mostly looking at existing programs and trying to figure out how they worked.
Eventually I graduated to using modern computers around the time my family finally got the internet in like 2002, and I learned a whole lot about them. I didn't really start doing programming for them though until I went to college and learned java and C. In the intermittent time I mostly just did mIRC scripting, which I'm not sure really counts.
These days I have a job as a "release engineer" for imaging software for printers. There isn't a whole lot of programming involved, except for making perl and bash scripts and dissecting and modifying existing ones other people have made. I want to get a more programming-oriented job eventually. I also need to motivate myself to do more stuff on my own, like your project, Guido. I've always wanted to play around with something low level like that.
Did your program render those images Noumenon? Looks neat!
And for small tools I use C but I make my larger projects (such as the emulator) in C++, although I don't really use much of C++'s specific constructs (for example I barely use templates), but I like to divide separate parts of the programs into classes, and C++ is nice for that. Although I think that I fully grasp the concept of object oriented programming, I still haven't really gotten around to learning the real C++ language specifics, and I imagine most of them are only really useful if you're working on larger projects.
And for small tools I use C but I make my larger projects (such as the emulator) in C++, although I don't really use much of C++'s specific constructs (for example I barely use templates), but I like to divide separate parts of the programs into classes, and C++ is nice for that. Although I think that I fully grasp the concept of object oriented programming, I still haven't really gotten around to learning the real C++ language specifics, and I imagine most of them are only really useful if you're working on larger projects.
Oh and as for visualizing your music library - I would personally find it interesting to see statistics and graphs about my music listening behaviour, maybe linked to other factors such as date/time, temperature, alcohol intake, etcetra.. Somewhat like this guy did
.
- Techboy
- Dayvan Cowboy
- Posts: 2322
- Joined: Tue Jun 20, 2006 4:11 pm
- Location: Glasgow, Scotland
- Contact:
fucking hell!!!!Guido wrote:Dono, check your PM.
Making a kernel is cool, I have never done it but I did read about the technical details of it various times. Check out this guy btw: http://www.bellard.org/jslinux/ (requires modern browser). He managed to code an x86 emulator in Javascript. Sheer genius.
i recently purchased a sega mega drive / genesis to you perhaps, with the intention of creating ROMs of my own to play music etc, perhaps as a backing instrument for myself ;D
ffs i just compiled c in my mobile phones WEB BROWSER! WTF! It's so beautiful I could cry.
- pianoforte
- Dayvan Cowboy
- Posts: 1415
- Joined: Thu Jun 02, 2011 2:41 am
- Location: grey gardens
It seems utterly hopeless when you get stuck on a problem, but the problems always clear up. I was once developing a website for a project I was undertaking, and WordPress suddenly and inexplicably deleted all my posts and pages, and I didn't have a backup. I tore my hair out several times over, and thought all was lost; then I contacted my host, and discovered they had a backup which they were happy to reinstate. A few hours later, I was back working. The problem was solved.turquoise70 wrote:On second thought... i hate my life. Not one programmer in EXISTENCE has ever told me anything REMOTELY encouraging. Fuck this profession, I hope I die before I graduate, I hope code eats my body literally skin to bone until there is nothing left.
Is this seriously the thing people take up when they want to die? HONESTLY?
SOMEBODY SAY ONE MOTHERFUCKING THING THAT IS REMOTELY MOTHERFUCKING GODDAMN ENCOURAGING TO SOMEBODY WHO IS JUST STARTING IN THIS AREA
the only thing i hate about programming? THE PEOPLE WHO ARE INVOLVED IN IT.
Variants of this situation have happened innumerable times in my tech escapades, and they always clear up - eventually.
Valotonin wrote:Celebrate collapse because it will be beautiful x