x86 Assembly

Moderators: None (Apply to moderate this forum)
Number of threads: 4563
Number of posts: 16029

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Help - Newbie To Assembler Posted by Starburn on 28 Sept 2002 at 8:35 AM
I need some help with this short program Ive been messing with, basically Ive just been getting into programming in assembler rather than high-level over the past week or so, and Im just having some trouble with this procedure:

procedure SetScr(Attrs : byte); assembler;
{Somehow place Attrs instead of $1F?}
asm
push es {Ive been told es needs to be preserved}
{Place attrs in 8bit register - ?}
mov ax, $B800 {Start of scr memory}
mov es, ax {Place in segment register}
mov cx, 2000d {Number of times to loop}
mov bx, 1d {Set to 1 (Attribs's not chars)}
@@1: {Label}
mov byte ptr es:[bx],$1F {moves $1F into es:bx ($B800:I)}
add bx,2 {Inc bx by 2}
loop @@1 {Dec cx, go to @@1}
pop es {Place value from top of stack back into es}
end;

As you can see from the comments, I need to place Attr into an 8bit register and then use it instead of $1F.
Although I cant seem to figure out how to do this? (What register to use).

Thanks for any help
-Matt.

(btw Im using Pascals built in assembler .. I know :/ - I have to for A-Level)
Report
Re: Help - Newbie To Assembler Posted by Starburn on 28 Sept 2002 at 8:53 AM
ah ha.. I got it..

I had to use dh.. I think because ax, bx, and cx are being used?

Report
Re: Help - Newbie To Assembler Posted by slicer69 on 28 Sept 2002 at 9:14 AM
procedure Change_Screen(attr: byte); assembler;
asm
push es
mov ax, 0b800h
mov es, ax
mov al, attr
mov di, 1
mov cx, 2000
@top_loop
mov es:[di], al
inc di
inc di
loop @top_loop
pop es
end;

Report
Re: Help - Newbie To Assembler Posted by Starburn on 30 Sept 2002 at 11:51 AM
This message was edited by Starburn at 2002-10-1 10:47:41

Thanks slicer.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.