389 Posted Topics
Re: You push each key until you get a linefeed 0ah then only pop one value. 0Dh is carriage return! How many did you push? You need to count them! But using push-pop you're on the right track. Of course this is one method but it will work. | |
Re: Think Check Writing Program [CODE] ary [] = { Zero, One, ...., Nineteen Twenty, Thirty, Fourty, ... Ninety, Hundred, Thousand }; if (n <= 19) ary[n] else if (n < 100) // 20...99 j = ary[ (n / 10) + 18 ] // Get 10's k = ary[ n % … | |
Re: Assembler issue. I don't work in Linux but try... mov eax, DWORD PTR [esi+edx * 4] ...or some variation of that. Sometimes assemblers get hinky about extra parenthesis. Assembler rules already state that register to left of scalar is scaled! | |
Re: The simple answer is you can't. The .386 and above have a Real Mode and a Protected Modes. Win32 such as XP, Win98, etc. are Protected Mode. DOS is Real Mode. You can't mix and match without a lot of overhead and thunking between overlapped Real Mode and Protected Mode … | |
Re: You're working in 16-bit RealMode but why is your origin at 7c00h ? lodsb is equivalent to [code=Asm] ;16-bit mov al,ds:[si] inc si ;32-bit mov al,ds:[esi] inc esi [/code] I don't see a problem but you are using Video Interrupt 10h, command 0Eh which ah=command, al=character. There is no color … | |
Re: I'm not familiar with that product but am familiar with various emulators, etc. Same target, same emulator? Check for loose connections on the target. Double check your pins! Your target has all voltages it requires? Verify that! Did the target sustain an electrical discharge? The idea is look for a … | |
Re: You have a problem with the MARS library. li $v0,1 Print integer mov $a0,$s0 a0 is integer syscall <--- MISSING li $v0,10 syscall #exit | |
Re: Well finally a processor I'm not familiar with. Not 80x86 unless its been macroized as assembly. Is a bit similar looking to MIPS. | |
Re: You could also setup a timer, that will call a callback and/or send a windows message. | |
Re: You don't say where you are in High School but hopefully you are in Honors classes because without them you'll be on the Community College tract. Times change. In the early days of programming you could get a job programming games if you had skills, or knew someone. These days … | |
Re: You aren't being very clear due to grammatical errors in your posting! ASSUMING You want the employee closest to the average First sum and count the number of employees. If 0 then none If 1 then that employee (or include into the averaging). If more then one sum = 0 … | |
Re: Yep! Other methods of access [code=Asm] arr db 1,2,3,4,5 mov bx,offset arradd mov al,[bx+4] mov bx,4 mov al,arradd[bx] [/code] If you were trying to access 16-bit elements [code=Asm] mov bx,4 shl bx,1 mov ax,arradd[bx] or mov bx,4 shl bx,1 add bx,arradd mov ax,[bx] or mov bx,4 mov ax,arradd[bx*2] ;; using … | |
Re: You need to keep the ASCII text ouside the code flow or it will be treated like code, which it isn't! You need to modify your code as to something as follows! [code=Asm] MOV AH,9 ; Write String to STDOUT mov DX,Hola mov CX,25 prt: int 21h ; DOS -Interrupt … | |
Re: Yep! For REAL mode (16-bit) absolutely true! A slightly more visual method is.. 12340 <-- Seg 1234:0 _0100 <-- Offset 0:0100 --------- 12440 <- 1244:0 1240:40 Same physical address! OR Seg 1234 + (0100 >> 4) Seg: 1244 And set offset to 0 | |
Re: You did NOT listen!!! I posted on your other two posts to properly post your code. It is assembly language and is WAY too big to make simple prognosis! I had some time to spare this morning so I did what I told you to do but you didn't! I … | |
Re: Sorry, what you need is someone with a lot of free time to help you out. First, code tags! Second, COMMENTS! Your code is all crammed together with no comments. One has to understand fully what your code is doing before they can truly help you! Once you fix that, … | |
Re: I am assuming you are reading an ASCII file. Do not overwrite the last byte in the file. Get file length. Allocated buffer of size+1. Read file of size into the buffer. Set terminator (that extra byte you appended) buffer[size]=0; It'll handle the empty file scenario! But you really should … | |
Re: Can you explain exactly what you want? Or what your problem is! You are precarious, you draw a diagonal line but step +x,+y, check for x reaching the next waypoint axis exactly (zero flag check), but then check y. If y2-y1 is not equal to x2-x1 then you have a … | |
Re: I believe they're 80x86 based now? I have no idea what toolset the current units use. Until a couple years ago they were PowerPC w/AltiVec, before that PowerPC, and before that 68000. They have their own Toolset. My favorite is Code Warrior with the PowerPC / AltiVec. I tend to … | |
Re: In its simplest form [code=Asm] mov ah,0 int 1Ah ; TIME - Get System time ; CX:DX = number of clock ticks since midnight ; AL = midnight flag [/code] There are approx. 18.2 clock ticks per second. If you mean the Real-time clock [code=Asm] mov ah,2 int 1Ah ; … | |
Re: How many bytes over are you? There are ways to optimize code! 80x86 uses variable length functions and register AL has the fewest bytes! Compile with a list file output and examine the binary for each line! I've grabbed one block of your code [code] ; MOV BX, 0 ; … | |
Re: You aren't saying what's happening, and you aren't mentioning your toolset. See if <buffer> is in its own segment or sitting at 0100h in the code instruction pointer path! [code] buffer db 10,?, 10 dup(' ') ; Get Buffered Keyboard input mov dx, offset buffer mov ah, 0ah ; Command … | |
Re: Simplify. Use a case statement for handling each side of the die. if you insist on if-then, then use if-elseif-else- Shouldn't you return the value you rolled? Or why go through all that pain. Use a table! [CODE=C] char *Dice[] = { "*********\n" \ "* *\n" \ "* * *\n" … | |
Re: You need to properly align your columns! Here's an example of two else's that you missed because they were hidden by improper file alignment! [code] else if(check_name == CANCEL) { fclose(ptr); StudMenu(); break; } else { check_name = 0; entermiddlename: fflush(stdin); printf("Enter student middle name: "); gets(a_mname); check_name = BlankCatch(a_mname); … | |
Re: You really should start your own post with this as other then communications it's a different project! You first need to determine how you are going to detect trash level. Keep in mind a particle of trash isn't always small. And large skinny objects quite often get put into trash … | |
Re: Debug run vs Release not run is quite often an initialization error. Memory typically isn't initialized in Release. Your constructor shold initialize your data members to a known good value. Before use. | |
Re: You're using the 0x10 VIDEO BIOS services handler for your video handling so use the 0x16 KEYBOARD BIOS services handler for your keyboard handling! [code] ; Get Keyboard value (and wait for press) mov ah,0 int 16h ; KEYBOARD ;ah=scan code al=ASCII character [/code] | |
Re: You really don't have enough for a useful snippet. It doesn't do anything! Takes input then terminates! And you need more comprehensive comments. Something more like... [code] ; Get a character from input with echo in al mov ah,1 ; CMD: Get single char int 21h ; DOS interrupt . … | |
Re: This is the best I can do until you start to post your own realistically attempted code. Bite sized chunks. Make your ASCII and integer print functions then test! Try to rework your functions in C into a simpler form! You can use an ASCII table [code] char szHex[] = … | |
Re: Integer versus the Floating-Point processor. You're adding Floating-Point result of the reciprocal addition onto the integer register! N fTally = 0.0 fOne = 1.0 [code] while N fN = N f = 1.0 / fN fTally = fTally + f N-- end while [/code] | |
Re: What were the rules your teacher gave you? Which flavor of MIPS are you using? There are scalar and vector square root functions and estimated reciprocal square root vector functions, dependent upon which MIPS family chipset you're using! There are also algorithmic guesstimation formulas for integer only processors. | |
Re: Ahem! I appreciate the thoughts but no thanks. As of this coming Monday my free time will be severly taxed so I might find time to help with the various assemblies but will have to back off all the other sub-forums. There are many other capable programmers out there that … | |
Re: Actually your code needs work. Compare what you have to the following... [code=Asm] .model small .stack 100h .data .code start: mov ah,1 ; input character from keyboard (with echo) int 21h ; DOS Interrupt ; al = character mov dl,al ; Save character mov ah,1 ; input character from keyboard … | |
Re: Spelling of your ASCII$ string buffer. To be consistent [code=Asm]LEA DX, message[/code] And the missing $ terminator! [code=Asm]message DB 'Test!$'[/code] or [code=Asm]message DB 'Test!','$'[/code] | |
Re: I'm not sure of what you're trying to say, but DOS interrupt is 21h ; 21 Hex not 21 decimal. DOS terminate is 20h ; 20 Hex not 20 decimal In the assembler you enter -E 0200 and I'm assuming you mean 0200h (hex) not 200 (decimal) You entere -A … | |
Re: Okay, I'm confused. I'm assuming you're debugging up first and so that's why only 'w' is supported. [code] do{ cin >>numsquare; if ((ro-numsquare) < 0 ) cout <<"The number of square is not in the range,enter again:"; }while((ro-numsquare)<0); ???? You wish to move up numsquare, but I don't see what … | |
Re: How about a function table! No macro! [code] funcA: mov eax,1 ret funcB: mov eax,2 ret funcC: mov eax,3 ret funcTbl: dd funcA, funcB, funcC ;;; and in your code mov eax,1 cmp eax,3 jae bypass call cs:funcTbl[eax*4] bypass: ret [/code] | |
Re: MASM is my thing when linked with Visual Studio. Not NASM but I'll try to help... Assemble First.asm into an Win32 object file First.obj C:\Documents and Settings\tom\Desktop\Assembly>nasm -f win32 First.asm -o First.obj Seems okay C:\Documents and Settings\tom\Desktop\Assembly>gcc First.obj -o prog.exe C:\Documents and Settings\tom\Desktop\Assembly>prog.exe C:\Documents and Settings\tom\Desktop\Assembly> Try moving the .data … | |
Re: Your problem is pretty simple! Think of it as a kind of two dimensional array. You can solve it by calculation but visualy. <i> --- N = 1 1 X N = 2 1 XX 2 X N = 3 1 XXX 2 XX 3 X N = 4 for … | |
Re: I've haven't used this library but from what I've seen... [code] #include <al/al.h> //#include <al/alc.h> //#include <al/alu.h> #include <al/alut.h> [/code] I've only seen al.h and alut.h included. the others are internal libraries and may be interferring with thedefinitions? | |
Re: Here's a link to a forum with someone with a similar problem. [url]http://www.nabble.com/How-to-call-MessageBoxA-from-Nasm-program--td23420607.html[/url] For this kind of problem, posting code would be more beneficial! | |
Re: Why would you? You need low level access to Input / Output ports, chip system only instructions, etc. High level languages do not do everything the assembly instructions do! In fact High level lanaguages are built upon a near majority, but not all of the processors instruction set! | |
Re: That doesn't make sense. You have a Java class and the Java instructor is telling you to code in Assembly? Or is this an Assembly class but where does Java come in? The first thing you have to do is un-Java it. That is un-object oriented it. What assembler are … | |
Re: No matter how you do it, the fraction part is the result of the remainder / divisor so still need a division! Could fake it somewhat. In integer part % ----- = ------- whole 100 So could calculate a whole integer form of the remainder and stick your own decimal … | |
Re: It needs to be in your include path. Which 32-bit assembler are you using? | |
Re: So you have no electronics background so you're looking for off the shelf components so as to build your project. You want to do sensor monitoring but keep focusing on a camera, which you really don't need. You in essence need to detect existence of a vehicle. The camera will … | |
Re: bool gFlag = true; Event sets flag to false, and causes thread to fall out of loop! Simple but effective! // while (true){ while ( gFlag ){ Don't sleep your thread so long. If you need 1000ms timing then [code] int nSnooze = 1000; while ( gFlag ) { Sleep(25); … | |
Re: A for loop is like a while loop, note the components below [code] for (int m = 0; m < 4; m++ ) int m = 0; while ( m < 4 ) { m++ } [/code] In your code you have the initializer int m = 0 You have … | |
Re: Which terminal he will put his PC ? Are there 20 pre-existing x,y coordinates or are you setting the coordinate for each terminal you say exist? This is a form of path traversal. This can be done more easily with recursion! Is this a single line and each terminal is … |
The End.