pouët.net

Go to bottom

Assembler in DOS.

category: code [glöplog]
strange thing. ive seen some intros using this code:
Code: push 0a000h pop es

when i compile and link my final .com looks like this:

Code: 00000000 50 push ax 00000001 55 push bp 00000002 8BEC mov bp,sp 00000004 C7460200B8 mov word [bp+0x2],0xa000 00000009 5D pop bp 0000000A 07 pop es


why is that?
its smaller just using two mov's :P
is it the compiler that is bloated or am i missing something?
added on the 2011-05-05 15:18:56 by rudi rudi
i imploded it. but its still 4 bytes.
68 00 A0 07
opposed to:
B4 A0 8E C0

:/
added on the 2011-05-05 15:36:20 by rudi rudi
68 00 A0 - push word 0a000h
07 - pop es

B4 A0 - mov ah,0a0h
8E C0 - mov es,ax
added on the 2011-05-05 15:38:10 by rudi rudi
sorry, the listing shouldve been like this:
C7460200A0 mov word [bp+0x2],0xa000

i used textmode forgot to change the opcodes for clearer readability like 0A000..
added on the 2011-05-05 15:45:37 by rudi rudi
Quote:
when i compile

When you compile *what*?

And with what compiler? With what options?
added on the 2011-05-05 15:48:13 by mic mic
turbo assembler 3.2:

tasm.exe src.asm
tlink.exe /t src.obj

simple as that...
added on the 2011-05-05 15:50:25 by rudi rudi
rudi, you must enable 80286 code. By default TASM compiles for 8086. But 8086 does not support push 0a000h pop es. Write

Code:.286

at the beginning of your program and it will work. (You could also write .386, .486 or .586...)
added on the 2011-05-05 16:30:27 by Adok Adok
yea, thanks adok. it worked.
added on the 2011-05-05 17:22:21 by rudi rudi
Don't forget the coolest asm instruction ever: xlat
BTW, this thread has number 8088. Cool, isn't it? :) 8088 was the CPU of the very first PCs in the early 1980s.
added on the 2011-05-05 21:03:53 by Adok Adok
yay, i didnt notice :)
added on the 2011-05-05 21:52:11 by rudi rudi
Rudi have you tried FASM? has DOS version(with IDE) if you are coding in a pure DOS environment.
added on the 2011-05-05 22:11:27 by Intrinsic Intrinsic
rudi, but the "mov ah, 0a0h" version requires al to be zero!
added on the 2011-05-05 22:45:53 by ryg ryg
NOOOOOOOOOOOOOOOOOT safe
added on the 2011-05-06 00:07:02 by ferris ferris
OMG! Unsafe demo code! ;)
added on the 2011-05-06 10:07:02 by raer raer
There are also some ways to put pixels with the "mov ah,0a0h version" even if AL is not zero. You must keep in mind that physical address = segment * 16 + offset. If you want to put a pixel to position x,y you usually calculate offset = y*320 + x (provided you are in screen mode 13h). But if the segment is not equal to 0a000h, then the offset must be calculated in a different way, depending on the difference of the segment to 0a000h (which is the value of AL when you write mov ah,0a0h mov es,ax). Let's say the difference is d, then you must subtract d*16 from the offset. This, however, implies that you cannot put pixels to the positions where the offset would be lower than d*16 if the segment were 0a000h. I used that trick in my 256b intro Indian Summer (source code is included in the archive).
added on the 2011-05-06 10:24:09 by Adok Adok
Hehe at first I was at a loss as well about that could be about but yeah, processor indications on top of your .asm files are pretty standard fare. Though I must admit I find it a tad weird that unsupported assembler (given the assumed platform) is intrinsicly expanded into that. I mean sure this is kind of a volatile topic since well.. what exactly is the right heuristic on what en where to enable silent/intrinsical expansion/implosion of code but I think that a straight assembler shouldn't do this. Anyone agree or?
added on the 2011-05-06 23:20:25 by superplek superplek
that->what
added on the 2011-05-06 23:21:10 by superplek superplek
(and I've used Tasm for many years..)
added on the 2011-05-06 23:21:25 by superplek superplek
i tried accessing the bios fonts, to manipulate them, but im not sure if i got the correct address. do they lie in segment F000? and index FA6E?

so if i where to change character 'a' which is ascii-code 97, wouldnt this be right to do:

Code: mov ax,0F000h mov es,ax mov ax,0FA6Eh add ax,97*8 ;FA6E + 97*8 (since each char takes 8 bytes) mov di,ax mov al,22h ;new bit-pattern for character 'a'. stosb ;store al at es:di ret


i did not find much documentation about the bios fonts on the net. but i found the addresses F000:FA6E though im not sure if that is correct. also isnt the rest of above code right (if you take for granted that filesize is not important here) ?

added on the 2011-05-07 19:41:44 by rudi rudi
also, does dosbox support bios font manipulation? i heard from earlier versions that dosbox had bitmapped fonts, but i dont know if that means that their not in the bios.
added on the 2011-05-07 19:42:58 by rudi rudi
rudi: There was an article about "Manipulating the BIOS font" in Hugi 12.
added on the 2011-05-07 20:49:04 by Adok Adok
ok, cool. ill check it out
added on the 2011-05-07 21:04:54 by rudi rudi
imagine more "aargh" here.

you don't manipulate the bios font. the bios font is in ROM (well, or used to be anyway, a long time ago :).

anyway, the point is this: the bios font's only purpose is to be uploaded to the the right region of video memory on a mode change.

if you want to modify the active text mode font, you can change that region.
added on the 2011-05-08 05:11:05 by ryg ryg
ryg: :) of course. i felt a little retarded after posting that code, because i was a little too fast. i wonder where i can change the position of that region though. ive found some more docs on the matter, but holy crap there's so much weird services out there. :P
added on the 2011-05-08 11:34:34 by rudi rudi

login

Go to top