Welcome! Log In Create A New Profile

Advanced

Assembler help ?

Posted by esckay 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Assembler help ?
February 14, 2007 09:23AM
Hi,

Does anyone know where can I get more information for assembler, because I find that the information provided is not enough.

Has anyone taken a look at the assignments yet? There are reserved words in there that was not explained anywhere in the Unisa docs (Unless I don't have all the docs).

I am also unsure about which registers can be used and which can't, and where to find a list of all the available registers for use.

In assignment 1 question 1.9:
What will the carry flag (CF), the overflow flag (OF), the sign flag (SF) and the zero flag (ZF) be set to if the following arithmetic is done in an 8 bit register?
+FE+FB

How do I write the assembler code to test this? I tried moving the FE and FE to different registers and then adding the two registers, but I can't assemble my code since it get errors on FE and FB. Has anyone tried this yet, if so, can you please help me out?

Thanks,
Scherrit
Re: Assembler help ?
February 14, 2007 04:31PM
Hi
concerning question 9 here's how I did it.
The AX register is 16 bits and 'al' refers to the lower 8 bits of AX so I used 'al' as my first 8 bit register.
The BX register is also 16bits and it's lower 8 bits are called 'bl' so that's the second 8 bit register in my program.
When using nasm put 0x infront of any Hex number if it starts with a letter else if it starts with a number you can put an h at the end.

bits 16
org 0x100
mov al,0xFE
mov bl,0xFB
add al,bl
Re: Assembler help ?
February 15, 2007 10:28PM
Thanks, I appreciate the feedback.

Where did you get the info from? I am sure that I covered the chapters and the appendixes and I did not see that .... or did I just read crap ?
Re: Assembler help ?
February 19, 2007 11:32PM
When I worked out the question the first time I put FE into the windows calculator and saw it was a bunch of 1's ending in a zero so I used FFFE instead of FE and moved it into ax and then moved FFFB into bx and I guessed correctly it would give the correct answer which i found out a bit a later can be done easier with al and bl. If you look at page 7 to 12 part 2 of the study guide the registers are very well explained there. It's mentioned in the section on debug but part 2 covers it much better.
I have bumped into a few errors while studying this module that really slowed me down a good example is the program on page 48 of TL501 where it says user: times 20 db ' ' that space is a double space so in effect they leave 40 and not 20 spaces.
Good luck and post if you need help i only have 2 modules left so got plenty time on my hands.
Anonymous User
Re: Assembler help ?
March 21, 2007 04:23PM
I've ordered a book through Amazon.com called "Assembly Step-by-Step" for $0.75! Ok, the shipping is $9.95 but still it sounds like a bargain. Actually, the seller was Hippo_Books, but they sell through Amazon. Hopefully the book helps.
Re: Assembler help ?
April 11, 2007 08:45AM
Say i typed the program. How do i see the carry flag(CF), sign flag(SF), and overflow flag(OF)?
Anonymous User
Re: Assembler help ?
April 11, 2007 09:37AM
You should be able to see columns of data in MS debugger. They correspond to Overflow, sign, etc..

Here is a link to the HTML book called the art of assembly:

http://maven.smith.edu/~thiebaut/ArtOfAssembly/artofasm.html
Re: Assembler help ?
April 11, 2007 10:54AM
C:\unisa\nasm>nasm -f bin Q9.asm -o Q9.com -l Q9.lst
C:\unisa\nasm>debug Q9.com
-p

AX=00FE BX=0000 CX=0006 DX=0000 SP=FFFE BP=0000 SI=0000 DI=0000
DS=1781 ES=1781 SS=1781 CS=1781 IP=0102 NV UP EI PL NZ NA PO NC
1781:0102 B3FB MOV BL,FB
-p

AX=00FE BX=00FB CX=0006 DX=0000 SP=FFFE BP=0000 SI=0000 DI=0000
DS=1781 ES=1781 SS=1781 CS=1781 IP=0104 NV UP EI PL NZ NA PO NC
1781:0104 00D8 ADD AL,BL
-q

C:\unisa\nasm>
avatar Re: Assembler help ?
April 11, 2007 11:13AM
giggs,
The
"NV UP EI PL NZ NA PO NC"
string corresponds with the flags.
In last year's 501 tut, page 25 gave an explanation of each one. It is available on Osprey for download.
Reanie
Re: Assembler help ?
April 11, 2007 11:30AM
thanks, and for link...
i was missing 501
avatar Re: Assembler help ?
April 11, 2007 11:49AM
There's a 502 as well....
Re: Assembler help ?
April 14, 2007 02:56PM
Hi All,

With regards to question 9 how did you interpret the meaning of the 1 and 0 values for the flags? Would you agree with the following:

SF: PL=1 and NG=0
ZF: NZ=1 and ZR=0

Thank you in advance.

Regards
Fred
Re: Assembler help ?
April 14, 2007 05:57PM
Have a look at TL502 part 2 of the study guide page 11 and 12.

PL = 0 and NG = 1 (same as sign in two complement)

NZ = 0 ZR = 1
Sorry, only registered users may post in this forum.

Click here to login