strange code. then again i have never worked with PCI devices.
btw; mov is copy B to A.
and brackets are the same as ZAsm: #value/variable
i recommend you learn masm32, if you want to learn the actual language..
http://www.masm32.com/
Hello all,
I am sorry if this is not the right forum to be asking stuff about the real assembly and not zAsm, but this was the best place with many knowledgeable people in it...
I just (by saying just I mean about 5-6 hours ago) started messing around with Assembly because I was very intrigued by what the tutorials I found here had to say. But my GMod takes a long time to open up and I thought if I at least get the basics the remainder will come easily and downloaded a emulator ( EMU8086 - THE MICROPROCESSOR EMULATOR, it is called but I have no idea about its quality.) The program had a couple of example programs in it and I always try to learn things by examples and not tutorials, but this was too much... So with the help of some googled tutorials and the "HelloWorld" example program I managed to write my first assembly code that outputs something.
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-spacere;overflow:auto'>org 100h
MOV AX, 0B800h
MOV DS, AX
MOV CL,065
MOV CH, 0100b
MOV [02h],CX </div>
Now my questions are:
1- Why do I need the lines:
MOV AX, 0B800h
MOV DS, AX
to make the code input something into the command prompt? And why doesn't MOV DS,0B800h work? Doesn't that do the same thing?
2- What does those square brackets around 02h represent? Do they have a specific function regarding video output?
3- I learned from trial and error that the data inside the square brackets point where the other data will be put to on the screen. Can someone tell me how the math of this thing work? What exactly is 02h?
4- Again a question regarding 02h: Why doesn't the letter (A in this code) dissappear when I put 03h instead? And why does it reappear when I put 04h and other even numbers but no odd ones?
5- I know the first byte in CX represent the ASCII and the second byte is the color code, but is there a way to write this straight to command:
MOV [02h], ...?
For example why doesn't
MOV [02h],0650100b
or something similar work? Do I always need to use CH and CL (or some other variable) to define color?
6- Final question! In that example HelloWorld program I saw pieces of code like "int 10h" and stuff... What do they mean and where can I find them?
Whew... That was long. I know this is not exactly the right place but any help would be appreciated!
Thanks in advance!
strange code. then again i have never worked with PCI devices.
btw; mov is copy B to A.
and brackets are the same as ZAsm: #value/variable
i recommend you learn masm32, if you want to learn the actual language..
http://www.masm32.com/
1) You use 16bit assembler, each register is limited to 32 bit, and to describe 24-bit address you gotta set segment too (read how it works in some tutorial)
Ohh OK, thanks for the reply I wondered the logic behind it but even the easiest tutorial is too damn complicated for this thing... <_<
2) They specify memory offset. 02h - address in memory.
This uses DS segment register to specify segment.
3) Memory address = (Segment << 4) | (Address) [check this again though]
It has nothing to do with video output, except that B8000 is offset of video memory (that's why we put B800 in the DS)
4) Because 00,02,04,06... specify character. 01,03,05,07.. specify character parameters, just like in wired console screen.
5) Huh what?
6) They call interrupts, http://www.htl-steyr.ac.at/~morg/pcinfo/ha...ts/inte1at0.htm
For the segmenting you'll have to setup the GDT too..
^ 51mbps Fiber ftw[03:32] <ITSBOT> lua serializing function to be
intergrated into xbox live
[03:34] <ITSBOT> no girlfriend for a pineapple under the Channels
I thought that in 16 bit real mode the segments are fixed, the GDT is only required for 32 bit protected mode / 64 bit long mode etc where the segments are not fixed.For the segmenting you'll have to setup the GDT too..[/b]
If I was you I woulden't bother learning any 16 bit assembly, just about the only place its needed is in first and second stage bootloaders. 32 bit assembly is the way to go, check out masam.
Also the program example you have there basically puts a character and a number representing parameters together, then just writes it directly to the video memory.
MOV CL,065; This sets the low byte to 065 (dec) which is the ascii code for a letter 'A'.
MOV CH, 0100b; This sets the high byte to 0100, as to what parameter 0100 actually is.. its hard to say, no idea what kind of display adapter your emulator is emulating..
MOV [02h],CX ; This puts the character + parameter into DS:02h (The video memory)
Yeah, I'm working on a bootloader for loading my kernel.. Wanna start protected mode from the bootsector. :P
^ 51mbps Fiber ftw[03:32] <ITSBOT> lua serializing function to be
intergrated into xbox live
[03:34] <ITSBOT> no girlfriend for a pineapple under the Channels
GDT & IDTR required only in protected mode, or virtual mode.
Protected mode in boot sector - bad idea, do it in what you load from boot sector.
Bookmarks