Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › assembly language program HELP
New Posts  All Forums:Forum Nav:

assembly language program HELP

post #1 of 5
Thread Starter 
Write an assembly language program that fills a 400-byte block of memory with zeroes, then halts.

So far I have this:
Somehow loop this 400 times
{
MVI B, 0H //sets b to 00000000
MOV M,B //copys b to memory address M
}
HLT //Halts

its prob wrong. wat is a block of memory is it M? also how do you loop?
BTW this is supposed to be for the 8085 processor.
http://www.slideshare.net/shashank03...amming-of-8085
Edited by v193r - 2/8/11 at 8:18pm
Dozor
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD X2 555 BE ASUS M4A785TD-V EVO/U3S6 lookin 4 one G.SKILL Ripjaws CL9 4GB (2 x 2GB) DDR3 1600 
Hard DriveOSMonitorKeyboard
WD 500GB 7200RPM Windows 7 Pro x64 Bit Samsung 2233RZ @ 100 Hz HHKB P2 w/ Blank Keycaps 
PowerCaseMouseMouse Pad
CX430 NZXT M59 Steelseries Xai Steelseries 9HD 
  hide details  
Reply
Dozor
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD X2 555 BE ASUS M4A785TD-V EVO/U3S6 lookin 4 one G.SKILL Ripjaws CL9 4GB (2 x 2GB) DDR3 1600 
Hard DriveOSMonitorKeyboard
WD 500GB 7200RPM Windows 7 Pro x64 Bit Samsung 2233RZ @ 100 Hz HHKB P2 w/ Blank Keycaps 
PowerCaseMouseMouse Pad
CX430 NZXT M59 Steelseries Xai Steelseries 9HD 
  hide details  
Reply
post #2 of 5
Look into branch/jump instructions. You generally create a loop using a branch or jump on equal/not equal.

mov eax,10
loop:
<your loop code here>
dec eax
cmp eax,0
jne loop

In this case, you initialize memory to 10, perform some operations, decrement the count and go back to loop unless your count is 0. That is x86, but there is probably something very similar for your language.
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
post #3 of 5
Quote:
Originally Posted by C-bro View Post
Look into branch/jump instructions. You generally create a loop using a branch or jump on equal/not equal.

mov eax,10
loop:
<your loop code here>
dec eax
cmp eax,0
jne loop

In this case, you initialize memory to 10, perform some operations, decrement the count and go back to loop unless your count is 0. That is x86, but there is probably something very similar for your language.
Last 3 instuctructions could be combined into:

djnz eax, loop
post #4 of 5
Quote:
Originally Posted by vgplayer View Post
Last 3 instuctructions could be combined into:

djnz eax, loop
Good to know. MIPS was always my forte.
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
RAID0R
(14 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 4.0GHz MSI P55-GD80 GTX 470 | 8800GT PhysX 2x2GB G.Skill Ripjaws 
Hard DriveOptical DriveCoolingOS
60GB Agility 2|1TB RAID0|1.5TB Pioneer DVR-217D XSPC Raystorm | XSPC RX240 Windows 7 Professional x64 
MonitorKeyboardPowerCase
27" Dell 2709W | 17" Samsung Logitech G15 Corsair HX850 Corsair 650D 
Mouse
Microsoft IntelliMouse 
  hide details  
Reply
post #5 of 5
block BYTE 400 DUP(0)

wouldnt this work for a declaration?

x86
Edited by surfbumb - 2/13/11 at 12:07am
Black Silence
(15 items)
 
  
CPUMotherboardRAMHard Drive
i5 3570k @ 4.5 GHz Asus P8Z77-M Pro Kingston HyperX Genesis 8 GB - 1600 MHz Seagate Barracuda 250 GB 
Optical DriveCoolingOSMonitor
Samsung WriteMaster Noctua NH-D14 Windows 10 ASUS VS24AH-P 
KeyboardPowerCaseMouse
Logitech Navigator Enermax Infiniti 650W Fractal R3 Black Pearl Razer Death Adder 
Mouse PadAudio
SteelSeries QcK Mass Altec Lansing FX4021 
  hide details  
Reply
Black Silence
(15 items)
 
  
CPUMotherboardRAMHard Drive
i5 3570k @ 4.5 GHz Asus P8Z77-M Pro Kingston HyperX Genesis 8 GB - 1600 MHz Seagate Barracuda 250 GB 
Optical DriveCoolingOSMonitor
Samsung WriteMaster Noctua NH-D14 Windows 10 ASUS VS24AH-P 
KeyboardPowerCaseMouse
Logitech Navigator Enermax Infiniti 650W Fractal R3 Black Pearl Razer Death Adder 
Mouse PadAudio
SteelSeries QcK Mass Altec Lansing FX4021 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › assembly language program HELP