:c-thumbdown:
need help on a small assembler program. I have no clue how to really write in assembly im in a class ahead and the first program is the only assembly one and i havent taken assembly yet so i really need some help understanding it.
cpsc240= 57 * 13 mod 23 (print quotient=xx & remiander= XX)
for i = 1 to 10 print "OpSys" and i
I have to write it in the cmd's debug program.
So far i tried the second one i can now print OpSys 1 and thats about it i got no clue how to do a loop or make an integer i and add to it.
12 replies to this topic
#1
Posted 29 January 2011 - 05:00 PM
|
|
|
#2
Posted 29 January 2011 - 05:06 PM
What do you have so far (speaking of code)?
#3
Posted 29 January 2011 - 05:09 PM
well so far i tried the second one
and i just made it print OpSys 1
mov ax,0200
mov bx,004f
int 21
mov bx,0070
int 21
mov bx,0053
int 21
mov bx,0079
int 21
mov bx,0073
int 21
mov bx,0020
int 21
mov bx,0031
int 21
and i just made it print OpSys 1
mov ax,0200
mov bx,004f
int 21
mov bx,0070
int 21
mov bx,0053
int 21
mov bx,0079
int 21
mov bx,0073
int 21
mov bx,0020
int 21
mov bx,0031
int 21
#4
Posted 29 January 2011 - 05:14 PM
You can also use loops.
#5
Posted 29 January 2011 - 05:18 PM
You could make a separate block of code, that you can call, that prints to the screen "0pSys ":
print_0pSys: lea bx, string_1 lp1: mov al, [bx] cmp al, 0 jz lp1s mov dl, al mov ah, 2 int 0x21 inc bx jmp lp1 lp1s: ret
#6
Posted 29 January 2011 - 05:19 PM
You could also use loops in that manner for the loop that goes 1 through 10, that you mentioned.
#7
Posted 29 January 2011 - 05:19 PM
im slowly learning it, i know i need a loop and a condition where the loop ends after i = 10 but i dont really know the commands for it
#8
Posted 29 January 2011 - 05:25 PM
i also have to write it in cmd debug
#9
Posted 29 January 2011 - 05:28 PM
You might need to learn about some instructions:
MUL Intel Pentium Instruction Set Reference - MUL - Unsigned Multiply
IMUL Intel Pentium Instruction Set Reference - IMUL - Signed Multiply
DIV Intel Pentium Instruction Set Reference - DIV - Unsigned Divide
IDIV Intel Pentium Instruction Set Reference - IDIV - Signed Divide
ADD Intel Pentium Instruction Set Reference - ADD - Add
SUB Intel Pentium Instruction Set Reference - SUB - Subtract
INC Intel Pentium Instruction Set Reference - INC - Increment by 1
DEC Intel Pentium Instruction Set Reference - DEC - Decrement by 1
You might at least want to learn IMUL and IDIV, and maybe MUL and DIV (multiplication and division instructions), since that's what you have to do in that program; unless you already know those, of course.
I don't know about debug, though.
MUL Intel Pentium Instruction Set Reference - MUL - Unsigned Multiply
IMUL Intel Pentium Instruction Set Reference - IMUL - Signed Multiply
DIV Intel Pentium Instruction Set Reference - DIV - Unsigned Divide
IDIV Intel Pentium Instruction Set Reference - IDIV - Signed Divide
ADD Intel Pentium Instruction Set Reference - ADD - Add
SUB Intel Pentium Instruction Set Reference - SUB - Subtract
INC Intel Pentium Instruction Set Reference - INC - Increment by 1
DEC Intel Pentium Instruction Set Reference - DEC - Decrement by 1
You might at least want to learn IMUL and IDIV, and maybe MUL and DIV (multiplication and division instructions), since that's what you have to do in that program; unless you already know those, of course.
I don't know about debug, though.
#10
Posted 29 January 2011 - 05:32 PM
yeah thats whats making it hard for me is writing it in the debug program
#11
Posted 29 January 2011 - 05:52 PM
The things I mostly did were making a program for NASM assembler with
ORG 0x100at the top of the program assembly source file and assemble it directly, in flat-form binary format, to a .com file and run that either from command prompt or DOS-BOX. I don't really know the difference between debug and what I was doing.
#12
Posted 29 January 2011 - 06:36 PM
yeah its like the same in debug u write out the program and save it to a .com file and open it through cmd i just think some of the wording is different
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









