|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
![]() |
Author | Message |
---|---|
Chris
|
x86 Assembler
![]() |
Well, my studying of assembler has been a huge success! It took countless tries but my formula for
ploting a pixel in 320x200x8 is memorized in my head! It will change resolution, print the pixel, return to the text mode resolution, and exit to dos. It was written in Microsoft Assembler 6.0. Here's my code:
I had to send my shift data to a register before I could do a register shift. Why? I don't know. I also had to write 0A000 to a register and then send it to my segment register. Why? Masm didn't like this code:
Do you have any suggestions? Is there something that could be simplier to this piece of code? Chris :o) |
|
Nyef
|
![]() |
Note that you can't actually see the pixel, because you forgot to wait for a keypress. :-)
Add a .286 here (I'm assuming that you don't have an 8088 to test this with).
With the .286 mentioned earlier, the next two lines can become "shl ax, 6".
Same here as above.
xor ax, ax ; I _think_ this is the call to wait for a key int 16h
Don't you mean mov es, 0a000h? You can't do a mov SS, imm. The instruction set won't let you.
Only the 3 I mentioned above. :-)
--Nyef |
|
Chris
|
![]() |
The reason why I knew it worked is because the first time I did it I forgot to change back to text resolution
so it kept the screen in graphics mode and the text was friggin huge!!! So I edited it to change back to text mode and that's why you can't see the pixel display. I haven't studied the keyboard interrupt yet. I know from an 8086 simulation program that you test the status of the port and if there is a keypress you compare the accumulator with what key you want to test: out 01h cmp al, 1A Or something like that. I think that should check the status of the Enter key, I'm not sure. I never knew you had to plug in which type of processor you were writing under. This whole time I've been using plain 8086 when I could have been using .286 and .386. Thanks a lot. I couldn't understand what I was doing wrong. Chris :o) |
|
|
![]() |
It is the starting address where the video memory in VGA mode is mapped. |
|
![]() ![]() ![]() |
|
Chris
|
![]() |
I understand that 0A000 is the starting address but I couldn't understand why I couldn't send hex to the es register. Later I found that you can only send data to it register to register. I also discovered that the SHL statement has been updated over the years. So unless you tell the assembler what processor you're writing for you'll encounter problems. I wrote this: SHL AX, 6 That's a 286 instruction from what I've heard. It's an updated method to performing shifts. If I want to use that new instruction in my assembler sources, I need to declare at the top before my code: .286 or something above or the assembler won't assemble it. Without that .286 or higher statement it will be as if I'm programming under a little 8086. It was fun while I was studying plain 8086 but I want to play with the big toys now. Anyway, if I wanted to shift by 6 in plain 8086, I would've had to have typed it like this: mov cl, 6 shl ax, cl or a long list of single shifts. Chris :o) |
|
Lin Ke-Fong
|
![]() |
shl is not a statement, it's an *instruction*, the instruction set of x86s has been improved over the time. And "shl ax, constant" is only available on 286 and newer chips. I may recommend you to take a look at http://developer.intel.com. Go to /design/PentiumII/manuals, and download the 3 volume (3 pdf files in fact!) Developer's Manual. You can also call Intel's Literature Center, the toll free number is on their website, you can ask them to send the three volumes, it's free of charge, but they aren't the latest revisions, I believe that they haven't printed them yet. Volume 1 will give you the needed basic understanding of the x86 processors, but it is mostly about the protected mode, however I think the 3 vol. set manuals from Intel is the best reference. |
|
Eric
|
![]() |
You can also get the Pentium III manuals: http://developer.intel.com/design/pentiumiii/manuals/ Volume 3 is the best reference. However, anyone unfamiliar with x86 assembly language should definitely read through Volume 1 first. Understand, though, that these documents are not meant to teach assembly language. They are reference manuals. Good luck. Eric |
|
|
![]() |
It prevents you from using illegal or advanced instructions. If you want to write for the 8086/8088 it would keep you from writing bad programs by using unsupported instructions. And always remember, once you think you know assembly, there's always more to learn... Pipeline stalls, instruction interleaving, instruction prefixes. |
|
![]() ![]() ![]() |
|
Lin Ke-Fong
|
![]() |
[x86 programming documentations]
Well actually they link to the same pdf files. Too bad that the printed version is not up to date :( |
|
![]() |