How I can increase size of stack in assembly (NASM OS X intel64) I used **.STACK 4096** before **section .data** but return this error error: attempt to define a local label before any non-local labels error: parser: instruction expected Please guide me.

Member Avatar
Member Avatar
+0 forum 1

hi , please convert this block code to intel syntax ( nasm) xorps %xmm0, %xmm0 movaps %xmm0, -64(%rbp) movb $2, -63(%rbp) movl $3103850762, -60(%rbp) movw $20480, -62(%rbp) leaq -64(%rbp), %r14

Member Avatar
Member Avatar
+0 forum 2

Hey guys! I'm in the process of writing a bootloader and I'm having trouble printing out memory information, using 16 bit nasm I know INT 12h stores the low memory information in AX but I can't seem to print it out correctly. I'm currently trying to print it by converting to ascii, moving it into a string and printing it with INT 10h but right now I just get ASCII smiley faces. Can I get a snippet of asm on how to print the contents of AX to the screen? Thanks

Member Avatar
Member Avatar
+0 forum 6

I bet all Computer Science related courses would learn low level or machine level languanges in due time and in our university we used the portable 80x86 assembler NASM for our Assembly code So here's my experimentation on how to use "functions" and recursion using a Fibonacci Solver as a test case As you may notice the code only output the final outcome of the Fibonacci sequence instead of printing every number for all steps. I might or might not update this depending on my free time and motivation but for now here's what i've done :)

Member Avatar
+0 forum 0

I am writing a program to get an integer from the user, and then print out all the numbers from 0 up to the number. My code gets the input fine, but when printing it out, it prints continuously in what seems to be an endless loop. Here is my code: SECTION .data ; Constant variable declaration len EQU 32 ; Constant length msg db "Enter a number: ", 0 ; Input message msglen EQU $-msg ; Input message length SECTION .bss ; Uninitialised data declaration other resd len ; Output counter that is incremented data resd len ; Input …

Member Avatar
Member Avatar
+0 forum 1

Hi, everyone! This is my first post ever here in Daniweb. I experienced a problem in printing the sorted array of 5 numbers, as the following code only prints the first iteration of the loop, and it does not print the array input. Here's the code: section .data i db 0 ; Value to be incremented question db 'Enter a number: ' ; Prompt questionLen equ $-question newLine db 10, 10, 0 ; New blank line newLineLen equ $-newLine section .bss num resb 5 ; Array of size 5 counter resb 1 ; Value to be incremented counter2 resb 1 …

Member Avatar
+0 forum 0

Here's the problem, I was wondering if i am right to assume that when a three-digit input is entered, i.e. 123, then the string 1 will be stored to al, 2 to ah, but i'm not sure where the 3 goes, or if ever it's plain wrong to look at the problem that way. Here's my plan, ask for 3-digit number, access the digits separately, convert to integer, manipulate the digits separately, then check if greater than 100, 175, and so so.

Member Avatar
Member Avatar
+0 forum 5

Hello guys, i'm trying to compute the area of a triangle using the Floating-Point stack (FPU87), but i'm having an issue outputting my value. I'm computing the area using Heron's formula: T = sqrt{s * (s - a ) * (s - b) * (s - c) } Note: s = (a+b+c) / 2 I'm outputting: s * (s - a ) * (s - b) * (s - c), from the FPU87 stack just to make sure it did the calculations correctly, but i'm getting "-nan". I know it means "not a number", but as a test I inputted …

Member Avatar
Member Avatar
+0 forum 2

Hey all, admittedly this is some homework help. I'm trying to write a program which takes a string in of hex characters, calls an assembler function which gives me the decimal value of the hex string. That assembler function calls a "checker" function in C which makes sure each character is a legal HEX value. My question is two fold, how do I take an EBX register in assembler and properly pass it to a C function expecting a character. I can't seem to properly pass from assembler back to C: [CODE] #include <stdio.h> #include <string.h> int main(void) { char …

Member Avatar
Member Avatar
+0 forum 1

I am a beginner in learning assembly language. I wanted to know which assembler would be best to use between NASM and MASM in today's context. Also, can you give a link to documentation on these assemblers?And tutorial specific for these assembler (as assembly is not standardized)

Member Avatar
Member Avatar
+0 forum 3

Hey guys, I'm fairly new to assembly & i'm having trouble iterating through an array; i.e. increasing the index as I loop. I'm working under x86-64 in Linux using NASM. There doesn't seem to be much documentation on the 64-bit architecture. Also, the book i'm using seems to code all the examples in C, then disassembles the code into AT&T syntax assembly. Doesn't really help. Description of my code: After taking in the first input & moving it into slot 0 of the array, I ask if there's more input. If there is, I move into the loop. I think …

Member Avatar
Member Avatar
+0 forum 2

Hi guys. so i wanna code my own Simple Dos-like OS that boots to a prompt with the simple command of "Hello" which should load a message that says "Hello, World!". Would someone be generous enough to give me some source code that just boots and has the command "Hello". I can do everything else from there. all i need is basically the bootloader and the prompt. Thanks!

Member Avatar
Member Avatar
+0 forum 9

Hello! I have just started learning assembly language, and I have decided to use the NASM assembler. I made a small program, included below, that is supposed to take a number, add 5, and print out the final result. The program correctly prints the prompt, and takes a value, but then crashes. NASM makes no warning or error messages. I would appreciate any help! -tundra010 The code: [CODE] ; This program is supposed to get a number, add 5 to it, and print out the final number. [section .data] prompt: db 'Enter a number: ',0 fmt: db '%d',0 [section .text] …

Member Avatar
Member Avatar
+0 forum 6

When I was making my most recent youtube video, I tried to do the following to define a string of bytes.. [CODE]main: jmp .game win_msg db "You win!",0 .game:[/CODE] but was greeted with compile errors saying that the label '.game' did not exist... I KNOW that it's possible to do this as I do it on the initial startup, so does anyone have any idea why it might not be working? Specs: Intel processor, nasm16 This is not really a true problem as I found a way around it, I'm just very curious as to WHY it didn't work. [URL="http://www.youtube.com/watch?v=cZ0RIR4VSOo"]My …

Member Avatar
Member Avatar
+0 forum 1

Hi friends, I am a newbie to Assembly Language programming, I don't know whats the equivalent Assembly code for NASM compiler and moreover is there any compiler available for ubuntu so that I can run my TASM code as it is? Here is my simple code that works fine in TASM [CODE] ;sum=b1+b2+b3 .model small .stack 100h .data b1 db 100 ; b1=100, b1 is stored in 0 th offset of data segment b2 db 20 ; b2=20 b3 db 40 ; b3=40 sum db ? .code MOV ax,@data MOV ds,ax MOV ah,b1 ; ah=b1 i.e ah=100 ADD ah,b2 ; …

Member Avatar
Member Avatar
+0 forum 3

This is my OS that I've been working on for almost 3 months now (not all at once.. in periods of a few days each time). Would anyone skilled in NASM mind looking at parts of it and give me their opinion on my code? Note that there are many files; I'll do my best to organize it all right here. Anybody can use any of this code as long as my name is in the credits. :) [URL="http://pastebin.com/sEutJFwS"][COLOR="Red"]Boot.asm[/COLOR][/URL] [COLOR="Green"]--[/COLOR] [URL="http://pastebin.com/Ft5GSs3A"][COLOR="Red"]Kernel.asm[/COLOR][/URL] [URL="http://pastebin.com/DDdV4eer"][COLOR="Red"][COLOR="Red"]Includes.asm[/COLOR][/COLOR][/URL] [COLOR="Green"]--[Kernel][/COLOR] [URL="http://pastebin.com/QfrZn5iS"][COLOR="Red"]Calls.asm[/COLOR][/URL] [URL="http://pastebin.com/KSvrXCNv"][COLOR="Red"]Macros.asm[/COLOR][/URL] [COLOR="Green"]--[Kernel menu stuff][/COLOR] [URL="http://pastebin.com/NJsYVas4"][COLOR="Red"]Buttons.asm[/COLOR][/URL] [URL="http://pastebin.com/DK7Y1ugi"][COLOR="Red"]Core.asm[/COLOR][/URL] [URL="http://pastebin.com/n7T09QLe"][COLOR="Red"]Msgbox.asm[/COLOR][/URL] [URL="http://pastebin.com/w2LF2D4d"][COLOR="Red"]Textbox.asm[/COLOR][/URL] [COLOR="Green"]--[Kernel game engine][/COLOR] [URL="http://pastebin.com/4aG83ZRv"][COLOR="Red"]Engine.asm[/COLOR][/URL] [URL="http://pastebin.com/hTmQSp2m"][COLOR="Red"]#Macros.asm[/COLOR][/URL] [URL="http://pastebin.com/uYSbE2fd"][COLOR="Red"]Crate.asm[/COLOR][/URL] [URL="http://pastebin.com/XxSUrLCg"][COLOR="Red"]Fences.asm[/COLOR][/URL] [URL="http://pastebin.com/X40Csavm"][COLOR="Red"]Player.asm[/COLOR][/URL] …

Member Avatar
Member Avatar
+1 forum 2

working on a 32bit architecture and i'm adding two arrays together slot by slot into a third array so if I have 3,4,4 and 4,4,4 in the arrays the third array should contain 7,8,8 at the end of the function I was able to pass in the arrays correctly and the amount of items into the function arleady, i know this because I ran test code now i'm working on the addition part of it, here is what I have, the logic makes sense to me but it's still seg faulting...ideas? [CODE];*************************************ADD ARRAY********************************************** segment .bss ; segment .data summessage db …

Member Avatar
+0 forum 0

I've run into a bit of a problem with my OS.. Displaying large amounts of information; like so- [CODE]mazemsg db 0x70,"Maze game: How to play--",0 db 0x74,"-Arrow keys for movement",0 db 0x7C,"-Move into the red crates to move them",0 db 0x7E,"-Push a crate onto yellow dots to clear both the crate and the dots",0 db 0x72,"-Green lines: You can jump over them, but crates cannot",0 db 0x7C,"-Mines: They can be hidden throughout the level",0 db 0x7C,"--Step on one to flag it, step on a flagged mine and die",0 db 0x7C,"--Pushing a crate onto a mine will create an ash cloud …

Member Avatar
+0 forum 0

Hi folks! :) I'm here with a problem of Assembly 8086 (x86) (NASM). I´m trying calculate the sum of all numbers, which are odd, lowers than X (X = number defined by user) Already solved the problem in C # and C + +, but i need the Assembly Code. In C#: [CODE="C#"] int num = 0; int res = 0; int all = 0; int soma = 0; num = Convert.ToInt32(Console.ReadLine()); while (all < num) { all++; res = all % 2; if (res == 1) { soma += all; } else { continue; } } Console.WriteLine(soma);[/CODE] In C++: …

Member Avatar
Member Avatar
+0 forum 1

I have read about how multicore processing works of the Intel. The manual that I read had left out a part that would of been useful how to actually use multiple cores. It just explained how all the different parts of the CPUs interact with each other, so could someone show me how to use them in assembly. If someone could give me some code in simplest form as possible (for me to understand), to help me that would be very helpful. The assembler I use is Nasm and I'm not to good at switching to protected mode so I …

Member Avatar
Member Avatar
+0 forum 1

I am wondering how to change the VGA resolution and the video memory pointer in real mode assembly (nasm). I have no idea how to do this, so can anyone help me?

Member Avatar
+0 forum 0

I would like to know, because I noticed how slow it can be when called over and over. How would I go about doing [CODE]xor ah,ah int 0x16[/CODE] Without the interrupt? [URL="http://www.youtube.com/watch?v=ZKFY0OivbwE"]Here's a link to my video.. can see small delays keys are pressed quickly or held in near the end when it shows the textbox.[/URL] Using NASM 16-bit assembler, intel processor. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 8

Hi everyone, I'm creating my own OS from scratch, and I'm first producing an installation CD so that I can easily install my kernel on a hard drive. So far, I've written a CD-based bootstrap loader in NASM that finds a program within the root directory of the CD, loads it into a known area in memory, and executes it (this uses the ISO-9660 specification). I'll more-than-likely just remain in 16-bit mode to run my installer, and switch to an installer that runs within the kernel once I get far enough (i.e. once I actually have a kernel!). Now, my …

Member Avatar
Member Avatar
+0 forum 4

Over the past few days I have been writing a bootloader/kernel in NASM... It loads perfectly fine when I write it to a virtual floppy using PARTCOPY, and then boot to it from Oracle VM VirtualBox. However, when I write it to a physical floppy and try to boot to it from startup, nothing appears and it hangs. Any ideas as to why? Bootloader code- [CODE][bits 16] [org 0x7C00] jmp reset reset: ;Resets floppy drive xor ax,ax ;0 = Reset floppy disk mov dl,0 ;Drive 0 is floppy int 0x13 jc reset ;If carry flag was set, try again mov …

Member Avatar
Member Avatar
+0 forum 1

The End.