3

I was wondering where I can try to code assembly. I want to code a x86 processor, but I am not sure where I should do so. Can I do it in visual studio? Is there a program in which I can code assembly?

I Googled it and looked for it everywhere but I couldn't find anything.

Pikamander2
  • 7,332
  • 3
  • 48
  • 69
Martin
  • 37
  • 1
  • 10
  • 1
    Yes, visual studio comes with an assembler. See https://stackoverflow.com/tags/x86/info for links to guides in general, with links to docs for other assemblers like NASM, and the GNU assembler (GAS). – Peter Cordes Sep 28 '18 at 07:32
  • Thanks! I will check it out – Martin Sep 28 '18 at 07:39
  • 2
    Generally speaking, you program using a text editor, assemble using an assembler, possibly link using a linker and then test your code by executing it (no tool needed) or running it under a debugger. – fuz Sep 28 '18 at 09:46

1 Answers1

1

When I started using assembly I was using Turbo Assembler (TASM) under DosBox emulator. There are great variety of videos and blog posts over Internet on how to setup and use it. It is really easy. It has all the needed tooling - compiler and debugger. So give it a chance. You can use each text editor you prefer for writing the source.

It is possible to use MS VS but it has some specifics. I recommend you to start with TASM.

Good luck!

kamentk
  • 513
  • 3
  • 12
  • 3
    But why would you want to learn 16-bit DOS? There's no particular reason for doing that, and you have to learn the DOS system calls instead of using C library functions. See my answer on [Drawing a character in VGA memory with GNU C inline assembly](https://stackoverflow.com/a/34918617) for more about why learning DOS isn't an ideal way to start out. – Peter Cordes Sep 28 '18 at 07:58
  • Well I will have to learn it for my apprenticeship so I thought I might jsut take a look into it, so when i have to learn it I won't be completly useless. After that I hope we will do some actual coding like Python or Java, but I mean it is kinda important to know how processors even work and so on. – Martin Sep 28 '18 at 08:03
  • 3
    @MartinGeidobler 16bit though? There are significant differences between programming in the old 16bit style and the newer 32 or 64bit styles, some skills will of course transfer – harold Sep 28 '18 at 08:45
  • @PeterCordes Why not? Most of the 32/64-bit assembly is just C without control statements. DOS requires you to handle some of the task currently implemented by the OS and it's easier to understand. – Margaret Bloom Sep 28 '18 at 13:01
  • @MargaretBloom: Being the same as C is a good thing for total beginners that want to learn what registers really are, and exactly how their C turns into code a CPU runs. Once you understand the basics of registers and memory, and pointers, then you can learn about control registers and x86 segmentation if you want, and it's also easy because you understand about bits and addresses and so on. I learned asm on m68k after typing in a Mandelbrot program in C out of a printed book(!), and then (when the edit/compile/run cycle was too slow with gcc on an Atari ST), started modifying the asm. – Peter Cordes Sep 28 '18 at 13:40
  • @MartinGeidobler: I should have said "why 16-bit DOS asm instead of 32 or 64-bit asm that can run natively under a modern OS?" If you'd read the answer I linked, you'd have understood that, so I guess you didn't. I'd recommend doing so. If you'd still rather learn a bunch of obsolete details about one specific OS (DOS) that you'll probably never program for, then by all means go for it, just be aware that's what you're doing. – Peter Cordes Sep 28 '18 at 13:41