News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Help Needed Please!

Started by Cuso, June 12, 2006, 09:45:34 PM

Previous topic - Next topic

Cuso

I'm new in the assembler programming. I need to create a software in assembly intel microprocessor based that define an array of 20 values byte type and calculate the average. Also need to create another software that get a value type byte of a variable and invert the values of the bits 0 & 1, convert in 1 the values oh the bits 2 & 3 and convert in 0 the values of the bits 4 & 5.


Any help will be appreciated

no-one

I bet this is a homework assignment, you better read the rules.  I just did and that is definately a no no.  Make a stab at it and show us the code and then ask specific questions and you might get help...

from no-one

Ossa

It sounds like homework (apologies if it isn't):

1) Please read the rules on homework: here

2) Some things that might be helpful (supposing that you are using MASM):

An array is created (in the .data or .data? sections) like this:

for unitialised:

.data?

MyByteArray db 20 dup (?)


or initialised (to 0):

.data

MyByteArray db 20 dup (0)


To invert certain bits, you can do something like this (for the al register):

xor al, BITMASK

where the bits in the mask should be 0 for preserved bits and 1 for inverted bits.

To set bits to 0, use and in place of xor (when a 0 is in the mask, it is set to zero - a 1 will preserve the bit). Use or when you want to set bits to 1.

Hope that helps - specific questions that don't involve us doing work for you will be more than welcome,
Ossa
Website (very old): ossa.the-wot.co.uk

Cuso

This is my code i'm beggining with the sum but i'm getting an error


title sum and average

.model small
.data
marca     db '>>>>'
array01  db  1,  3,  5,  7,  9,  11,  2,  13,  14,  21
array02  db  5,  4, 10, 23,  6,  17,  15,  21,  22,  15
arrSum   db  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
                                                   
                                                   
.code
main proc
    mov ax,@data
    mov ds,ax
    mov al,array01[0]        
    add al,array02[0]        
    mov arrSum[0],al                                      


    mov ax,4c00h
    int 21h
main endp
end main

Cuso

My appologize for not reading the rules.  :(

Ossa

Although people won't help DO homework, people here are perfectly happy to help with any problems you might have in understanding.

Some questions:

What is the error?
Have you got the 16-bit linker?
What commandlines are you using for assembly?

It works fine for me once I add this line after the .MODEL directive:

.stack 200h

Ossa
Website (very old): ossa.the-wot.co.uk

Cuso

I there a place where I can get examples in Assembly so I can develope my software

no-one

It works fine for me, also.

I don't know where you can find examples using the 16bit assembler.  masm32 has examples but they are not what you are looking for.  There are example codings in this forum...

no-one

Ossa

16-bit ASM? With MASM? There are loads, just google (I'm not saying that they are any good though). There are none that I can recommend

Attached is something I've started working on about a week back... it might be a bit advanced - it is a translation of the first two of the Denthor tutorials to 16-bit MASM syntax (about using VGA graphics under DOS) - but if you want code to start working from, it should help.

Ossa

P.S. sorry that took a while - my connection just went a bit flaky... don't know why.

[attachment deleted by admin]
Website (very old): ossa.the-wot.co.uk

no-one

Ossa,
Those are nice tutes.  The second one needs a little work, though.  After the screen fades to black, it should be cleared fiirst (the buffer) and then switched to text mode so you don't get that split second of garbage.  VERY nice, though, you have done a very nice job.

No-one

Ossa

Glad you liked them, no-one. Don't forget that I'm just porting them - they were written by Denthor in PASCAL many years back.

I'll swap that over for the ASM. The reason it's like that is because thats how the C is... I just tanslated it (I need to change other things too... like the string output function - it's the worst version of a string output function ever).

I'm hoping to do the other 7 tutorials that I have the C code for in the near future, but tutorials 10 to 21 will take a bit longer as I don't have a copy of the C, only part of the PASCAL - something that I've never used (though it should be easy enough). I'm also missing code for the occasional episode and I'm missing tutorial 18 completely (don't even know the topic). The tutorials move quite fast (3D starts in tutorial 8), but for people who are still interested in 16-bit stuff, they're nice tutorials.

Oh well, I'll do up to tut 9 and if anyone really wants the rest, I'll try to do them at some point.

Ossa
Website (very old): ossa.the-wot.co.uk

no-one

Your efforts are appreciated by no-one.

that is a joke, I really appreciate your efforts. :U