Jump to content

riobear1

Member
  • Posts

    33
  • Joined

  • Last visited

Awards

This user doesn't have any awards

Contact Methods

  • Discord
    Riobear1#2761

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

riobear1's Achievements

  1. Hi, I've not really posted for a long time here and was bored so I thought I'd release some information for getting started with assembly, this tutorial is mainly targeted at windows; however, I will include some information for Linux platforms. I'm not particularly experienced and am able to make a few different programs but am by no means proficient at assembly. You can find some resources at the bottom of the thread. If I make any mistakes or you have anything to add, let me know so that I can update the thread Setup To begin with, you'll want to install NASM (by downloading it from their website) or some sort of assembler; however, I'll be using NASM because that's what I've been getting used to. Other assemblers include FASM and MASM. Remember that different assemblers, processors and operating systems will interpret assembly language differently. Specifically, I will be using Windows 10 and programming in x32 bit as I'm still trying to learn x64 bit and there are a lot more registers so it is more complex. You'll also find that you want a linker, once again there are many linkers; however, I'll be using GoLink which you can get by searching up GoLink on your search engine.The job of the linker is to give the executable a reference to whatever dynamic libraries you may use. On Linux, an example of a linker would be GCC/G++. Proceed to add these to the path (this will vary by OS), either user or system will do but you will find it helpful if you add it to system. Programs Now that you've got all the required software installed, you can setup your programs directory and create the assembly file, I'd recommend using notepad++ as it has syntax highlighting for assembly language unlike many other coding environments. Another option would be something like VSCode with the extension for the syntax highlighting. Assembly language ignores white-space (except for newlines) so remember that it'll be easier to read if you try to spread the code out into readable sections. Now, ";" is used to create comments within code, so I'll attach a commented source code at the end for a simple hello world program, but hopefully this tutorial will help you to do that anyway. To define the entry point for the program you will use global %Entrypoint% Where %EntryPoint% is replaced with a name, usually WinMain / Main for x32 bit programs. When using GoLink, you must use WinMain as the normal entry point as it looks for that entry point by default. Below that you will want to import any external libraries or function through extern %FunctionName% with the function name being replaced by a WinAPI function / Function from a library. In windows, functions are used by importing dlls whereas in linux you can also use syscodes (windows keeps them internally to prevent malicious usage), these can be found at Linux Syscodes. It is possible to find the windows syscodes; however, they vary between builds and it is generally not a good idea to use them. Instead refer to the WinAPI Docs and use the required dll which is listed and the function you want to use. Remember that you use call to call the function and push parameters in reverse notation to add them to the stack in the correct order for the function. section .data is used to define variables/constants using the format of %VariableName% %TypeInstruction% %Value/Operand% e.g. msg db "Hello" ;DB stands for declare byte section .bss is a section used to reserve bytes in values. section .text is where the proper coding begins. You can define functions using the format, %FunctionName%: and then the code under that, remember to define the entry point's function. Then you execute your assembly instructions in the order of %Instruction% %Parameters%. Remember, functions that return a value return it to the accumulator and to store the value you will probably need/want to move it into one of the registers. There are different types of registers, the ones listed below are listed in order of x32 bit and x16 bit as colour coded, I skipped x8 bit and x64 because it's complicated and this is supposed to be a basic guide for people who are just starting or interested in dabbling in assembly. The usage of each register can vary depending on the compiler, etc. but if you're following the same sort of thing as me, you probably won't see to much of a problem. Code Operations A full list of instructions can be found here -> NASM Docs; however, some example operations include: There are also operation conditions which are added as suffixes to an instruction, these include: Example Program ;A simple print "Hello, World!" program, this only works on windows x32bit/x64bit ;Compiled using nasm -fwin32 print.asm -o print.obj ;Linked using golink /console/entry WinMain print.obj kernel32.dll ;You can clearly see the structure of compiling and linking but I'll go into detail after global WinMain ;EntryPoint extern GetStdHandle, WriteConsoleA ;External imports/functions STD_OUTPUT_HANDLE equ -11 ;Assigned value NULL equ 0 ;Assigned value section .data ;Variable definitions msg db "Hello World!", 13, 10, 0 ;Message definition in appropriate format msg.len equ $ - msg ;Buffer parameter definition section .bss ;Reserved stuff dummy resd 1 ;Reserves 4 bytes undefined space section .text ;Actual code WinMain: ;EntryPoint push STD_OUTPUT_HANDLE ;Push parameter 1 call GetStdHandle ;Call GetStdHandle function push NULL ;Pushes null 2 stack, 5th param push dummy ;Pushes the 4 reserved bytes to stack, 4th param push msg.len ;Pushes the buffer, 3rd push msg ;Pushes the message, 2nd push eax ;Pushes the STDOut result, 1st call WriteConsoleA ;Runs the function using the 5 parameters required jmp $ ;Maintains console by infinitely looping Compiling is done with NASM by doing nasm -f *format* -o *output* Linking is done with GoLink by doing golink /console /entry *entrypoint* *object* *dlls* Thanks for reading through my tutorial and information on learning assembly language, I hope that you enjoyed this and have learnt a lot from it, let me know how I can improve it or if I made any mistakes, feel free to add info below and I'll update the thread! I'll also add some useful resource websites that helped me get started: https://nasm.us/ http://www.godevtool.com/ https://cs.lmu.edu/ https://docs.microsoft.com/en-us/windows/win32/api/ https://syscalls.kernelgrok.com/
  2. You may want to buy slower ram or change the BIOS settings
  3. If it was an LGA 775 socket, it might may have been that someone in the past soldered some wires on to make it support LGA771 CPUs and Xeons. It's probably that they've grounded the pin with a wire so that it does the same as when you put the cover over the CPU contact point. Maybe it's something similar
  4. Simply use an overclocked fx8350 and gtx1050ti also overclocked on semi passive cooling and BOOM you have a radiator
  5. I meant as in an adapter rather than an sd card. like microsd to sd adapter would possibly work if you looked at the correct pins etc. SDcard readers use the same usb pins on motherboards unless they are pci, this theoretically would make it possible.
  6. Theoretically it is possible. But you'd have to use like an microsd to sd adapter and solder keyboard wires to the adaptor bit. It's not recommended and may not work but it probably will.
  7. Well I did the build a couple of years ago and upgraded it because mine seems.to be great. I also apparently don't need the six pin connector for the oc
  8. By most I mean it was beaten by two top end i7s and was in the top 11 on aida64 when oced at 4.5ghz
  9. Correcto but it's overclocked and is still brilliant. Beats most i7s
  10. Yeah, I'll leave it for now because it's a great budget card and I spent all my cash and some of my parents cash on it so not losing it yet. I'll do my research and as games require more horsepower I'll try and get it to keep up. It's perfect with my fx8350 (overclocked) too
  11. Cheers, I'll consider a bit more research into the VRMs and what they can handle and try and see if anyone has tried it.
  12. Maybe consider baking it then replacing the fans for better cooling. And check the PCI for any damages connections etc.
  13. So I'm going to ask a stupid question. I have recently installed a gtx1050ti from gigabyte and noticed the absence of the 6pin power supply connecter. Now I plan to overclock it further but would prefer a 6pin connector as it relieves stress from my PCI connections. I noticed there are empty pin holes where a 6pin could supposedly be added. What do you think? Anyone tried it or considered what extra mods may be necessary if done? Please let me know as I've seen people with 6pina nearly get their clocks for the GPU to nearly 2 GHz while I want to try and get some more overclock to it.
  14. I'll be trying this. Looks good and kudos for the brilliantly structured tutorial!
  15. Thanks for that note, First lets get info. together - You clearly are using a graphics card not Integrated graphics. Let's narrow what could be the issue: Graphics Card's giving up. PSU is giving up. Motherboard is failing. We can safely say it's not the monitors or cables because if they all go off together then it must be internal. The graphics card probably isn't failing if you include the notice that input is not working. A lack of power could cause the GFX card to stop working as intended and cut power to keyboards. and the motherboard could be failing and giving up at lower temperatures than standard due to wear and tear. I'd consider trying a different power supply if you have one spare. If not you could try the graphics card in a spare motherboard. If you have no spares I'd recommend having a look at the GFX card and Motherboard if they show anything have them looked at closer.
×