Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Help - Newbie To Assembler

StarburnStarburn Member Posts: 17
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?}
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}
pop es {Place value from top of stack back into es}

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

(btw Im using Pascals built in assembler .. I know :/ - I have to for A-Level)


  • StarburnStarburn Member Posts: 17
    ah ha.. I got it..

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

  • slicer69slicer69 Member Posts: 272
    procedure Change_Screen(attr: byte); assembler;
    push es
    mov ax, 0b800h
    mov es, ax
    mov al, attr
    mov di, 1
    mov cx, 2000
    mov es:[di], al
    inc di
    inc di
    loop @top_loop
    pop es

  • StarburnStarburn Member Posts: 17
    [b][red]This message was edited by Starburn at 2002-10-1 10:47:41[/red][/b][hr]
    Thanks slicer.
  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    \ \ free video tutorials and ebooks about || PHP Python Scratch Perl Go Java Swift C# Visual Basic C++ Objective-C MATLAB C Visual Basic .NET JavaScript Assembly PL/SQL Ruby Delphi R Dart D ABAP Julia COBOL Fortran ML Bash VBScript Scheme SAS Kotlin F# Awk LabVIEW Alice Crystal Erlang Scala Lisp Logo Transact-SQL Prolog Lua Clojure Hack Ada Apex FoxPro Rust || _________

Sign In or Register to comment.