- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 9
- Posts with Upvotes
- 9
- Upvoting Members
- 6
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
152 Posted Topics
Re: [code] mov ah,0ah lea dx,para_list ; DS:DX should point to buffer with ; first byte containing length int 21h mov thename,al ;On return from 21/0A AL=last char read ; usually the carriage return 0D [/code] A correct buffer used as a parameter to function 21/0A would have the following form: … | |
Re: JL or JB / JC ; Jump less-than or jump below JG or JA ; Jump greater-than or jump above The CMP instruction subtracts the dest-src from each other, and updates the FLAGS which can be tested by conditional jumps. For instance JB is equivalent to JC (Jump if CF … | |
Re: Creating a data structure in 8086 assembler is as simple as declaring any other data variables. [code] MYVAR1 DB 0 ; an 8-bit quantity FAR_OFF DW 0 ; a 32-bit far pointer FAR_SEG DW 0 ; Now for the mentioned data structure StudentId DW 0 ; this is also the … | |
Re: Resources on assembly placed on the web go way back, there is a lot to find. Recent: Programming From The Ground Up. X86 32-bit Assembly, AT&T Syntax, Under Linux. [url]http://savannah.nongnu.org/projects/pgubook/[/url] Power Basic, downloads on assembler X86. [url]http://www.powerbasic.com/support/downloads/assembler.htm[/url] Art Of Assembly. [url]http://webster.cs.ucr.edu/AoA/DOS/pdf/0_AoAPDF.html[/url] Old: Here is a list of the old files … | |
Re: Linux and Windows run on several different machine architectures to which they have been ported, assembly language programs are machine specific and cannot be garuanteed to run or properly assemble under another version of Linux or Windows. If a compatible assembler and library were used on systems of the same … | |
Re: This code worked for me... mov al, 182 ; Prepare the speaker for the out 43h, al ; note. mov ax, 4560 ; Frequency number (in decimal) ; for middle C. out 42h, al ; Output low byte. mov al, ah ; Output high byte. out 42h, al in al, … | |
Re: Describing the error or the output of the assembler makes it a bit easier for us to know where to look for an error in your code listing, sorry. | |
Re: Programs perform a lot of arithmetic in code, if reading human readable source code check for an abundance of these operators (+-*/) and () [] pairs, or look for red-tape directives such as #include .include include .i386, to identify the probability of the source-code being a valid program. | |
Re: It's pretty rudimentary stuff in any language to pair two strings together. The target buffer is the length of the two strings excluding the NULL characters +1 for the NULL terminator. Indexing is fundamental to an array of operations and this is one of them, maintain an index into the … | |
Re: This code builds a Small Model .EXE program, whick allocates several segments to the program, .stack 100h allocates a 256-byte stack segment and will initialize SS : SP when the .EXE header is read by the loader, the code: [code] mov ax, @data mov ds, ax [/code] is necessary to … | |
Re: When you say 32-bit and 64-bit computers do you mean the IA-32, IA-64, AMD-64, x86??? No matter anyways. A true 32-bit machine has 32-bit wide CPU registers, and also for true 64-bit machines their registers are 64-bits wide. The x86 line is backwards compatible and: Lower 16-bits are used in … | |
Re: You'd be right about that, MASM is an x86 assembler mainly used with MS-Windows and MS-DOS. It is apart of Visual Studio and was included with Microsoft C/C++ for DOS. MASM-32 these days is used for making Windows applications in assembler. At least, that's all I've used MASM-32 for. Under … | |
Re: ESI is a general purpose register, it does not care if it is set to the end of an array, in fact that is one of it's intended purposes: Example code, Set DirectionFlag to 1 to go from higher to lower address using MOVSW, ESI will be decremented by 2 … | |
Re: Each digit is a multiple of a power of ten. the 4th digit of 9,321 is 9*10^3. Sum each of these multiples of powers of ten (the base) and you'll have the binary equivalent of the value. If the digits were entered as ASCII subtract 30H (48d) to turn it … | |
Re: How are you accessing 32-bit registers without a prefix before going into protected mode? | |
Re: Function AH = 2C of the INT 21 Dos interrupt will return the current time. Seconds are returned in DH. Here is a simple expample of using this interrupt, it will print the ascii character 'A' every time a second has passed. This program is in a infinite loop, modify … | |
Re: BP+1 does sound odd due to the fact that this would refer only to the second byte of the subroutines return address, and because WORDs are pushed and popped off the stack, thus the indexes would normally be an even value when indexing into the stack. After setting up a … | |
Re: In contrast to regular re-iteration in a repetitive procedure a recursive function calls itself over and over again to perform its operation. It takes parameters just as any other function and has a condition upon which its recursion will stop. | |
Re: Do you mean the assembly language implementation of basicly an assembly language interpreter? That would be pretty long code... An example of such a program though would be the Ketman Assembly Language Tutorial, a 8086 tutorial and assembly language interpreter. Instruction format deals with the binary encoding of a processor's … | |
Re: The operand size attribute is apart of the instructions opcode and specifies 8-bit, 16-bit, or 32-bit operands. The IDTr register contains the 32-bit linear address of the Interrupt Descriptor Table and a 16-bit Limit Field, which specifies the number of entries in this table. Though 6 byte operands are not … | |
Re: Give me convience or give me death... This is 16-bit code, but it should give you the general idea, the LOOPZ will decrement CX even if the ZeroFlag is clear (no Zero Result), both LOOPZ and JCXZ are used to exit the loop, and LOOPZ is used to exit when … | |
Re: The previous contents of the accumulator AX is destroyed on each execution of DIVide. Hence your are dividing your divisor by your previous remainder and quotient in AX. That seems to me a bug. An 8-bit divisor will divide against a 16-bit Implicit Dividend in AX, after the division AH … | |
Re: To create a two-dimensional array is simple. Instead of a single index you will have two axises with which to index into your array. For a [50][25] do: Y * 25 + X, where 25 is the width or number of columns, Y is the row, X the column. | |
Re: MessageBox is a predefined window class, with one or more buttons, one window, and with a title and text. Try the Iczelion Win32 Assembly Language Tutorial. [code] .386 .model flat,stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc includelib \masm32\lib\kernel32.lib include \masm32\include\user32.inc includelib \masm32\lib\user32.lib .data MsgBoxCaption db "Hello",0 MsgBoxText db "Hello World!",0 … | |
Re: Offset means literally "displacement", an offset is added to an address. Each item in an array lies then at it's own offset. 'H' 'E' 'L' 'L' 'O', the first 'L' lies at offset 2 into the array, X0XXX1XXX2X This is because the offset is added to the beginning of the … | |
Re: BYTE PTR VAL, would correctly refer to a byte size storage location in MASM syntax, also BYTE PTR [VAL]. For performing computations the byte order of the values are irrelevant, and are transparent unless handled a byte at a time. Your code should have shown you that your double word … | |
Re: Headers - A C/C++ program is a compiled program, if by headers you mean prefixed program format information that is used by the operating systems loader, typically. Data Structures are just that, 'data'. They are interpreted by program code. If the executable is already compiled, you will have to reverse … | |
Re: I assume your using the linux API, due to your INT80 system calls. Any keystrokes read into the buffer should be printable. Check you parameters to the API calls. What is this? [code] mov ecx, msg2 ; number of output bytes bassically in segment.data [/code] You are loading the counter … | |
Re: Each hex digit represents a nibble. 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Subtract 48 from the ASCII value, is it less than or equal to 9? If so shift it into the proper nibble. If not subtract 65 'A' or 97 'a' from the original value and add ten and shift into the proper nibble. … | |
Re: To make a bootable 1.44MB disk image, create a binary file exactly 1474560. The first 512 bytes of this image at the very beginning will be the Boot Record. Stack may not be initialized upon entry. If so set up your own stack. [code] mov ax, cs mov ss, ax … | |
Re: I noticed you're using 16-bit assembler, similar in syntax to 32-bit. For the string initialization instruction, STOS it takes an initializer in the accumulator and a pointer to the string to initialize in ES : DI. For a 4096 byte array do: [code] mov cx, 4096 ; initialize 4096 bytes … | |
Re: AS for the following .EXE assembly language source: [code] mov ax,@data mov ds,ax ; data segment mov ax,num1 ;ax = num1 add ax,num2 ;ax =ax+num2 mov dx,offset ax ;moving offset of ax to dx for printing mov ah,09h ;calling 9th service int 21h ;print mov ax , 4c00h ;exit code … | |
Re: I know... Only a newbie wouldn't know that you couldn't print out the result of a arithmetic operation directly to the screen. [code] mov ah,6 mov dl,6 add dl,ah mov ah,02h ; WHY NOT PRINT OUT 12 TO SCREEN, IM NEWBIE int 21h [/code] why not try adding ah to … | |
Re: MCGA mode 13h is a 320x200 graphics mode capable of displaying 256 different colors at a time, to plot pixels in this mode a byte containing a value between 0-255 is written to video ram at segment address A000, the byte's value represents the corresponding pixel's color on the screen … | |
Re: Remember segment:offset addresses are non-unique, 0000:7C00, 07C0:0000, 07BF:0010 form the same physical address of 07C00 A segment address is just that, the address of a segment, it is bit extended into a 20-bit value which represents the physical address of the first byte of the segment and the offset is … | |
Re: Hello, as to your question: [code] add al,bl ; AL now contains value user entered in DECimal mov ah,09h lea dx,y int 21h ; but AL is destroyed after here ; after this MS-DOS call AL is overwritten with dollar-sign char of ; printed string, DOS uses fast putchar to … | |
Re: Your origin in 7C00h indicated that you were booted by the BIOS, but you want to jump to 0x1000? When you've loaded nothing there??? Is 0x1000 a physical or segment address? If it is a segment adress to transfer control to code a 1000:0000 and be able to return you … | |
Re: Actually an 8-bit divisor divides against the 16-bit dividend in AX, AH=remainder AL=quotient, so he must clear AH before the division: [code] xor ah, ah mov al, bl mov bl, 10 div bl [/code] And a 16-bit divisor divides against the dividend in DX:AX , remainder is stored in DX, … | |
Re: Hello, there was no problem I could see in your code. To others, there are multiple ways to get the length of a string entered by a user under DOS, for 21/0A DOS always reads one less than count so there is always a carriage return at the end, for … | |
Re: You could get the size of the text file using 21/42, that is, the LSEEK function. [code] XOR CX, CX XOR DX, DX ; CX:DX=+0 MOV BX, filehandle MOV AL, 2 ; Move from end of file MOV AH, 42h INT 21h ; a.e. DX:AX contains length of file [/code] … | |
Re: .COM programs are bare binary executables designed to be loaded directly past the PSP, also referred to as tiny model programs, for the code, data and stack all fit onto one segment, limiting the programs size. The .COM format was merely a carry over from CP/M, and so is the … | |
Re: Good old fundamentals of low-level array manipulation, implemented the code, does no printing, viewable someway nonetheless. [code] bits 16 org 100h start: mov si, arr ; our array of unsorted odds and evens mov di, odd mov bx, even cld mov cx, arr_len start_l: lodsb test al, 0x1 ; test … | |
Re: Segmentation Unit-->Linear Address-->Paging Unit-->Physical Address As long as the paging unit and MMU are off, Linear Addresses should map to physical. To turn a 16-bit segment address into a 32-bit linear address do: mov bx, 0b800h movzx eax, bx shl eax, 4 ; eax now contains linear address The only … | |
Re: Why the DAA instruction while summing the values? It will effect the AX registers value, probably on auxiliary carry. --- 21/02 Output Char takes an ASCII character in DL [code] mov dl, 0x41 ; 'A' mov ah, 0x2 int 0x21 ; display an 'A' [/code] You must translate the sum … | |
Re: In 16-bit assembly language: Interrupt Service Routines are pointed to by the Interrupt Vector Table occupying the first 1,024 bytes of physical address space. Each IVT entry points to an interrupt handler routine, the IVT entry has the format of an intel format far pointer. The processor multiplies the interrupt … | |
Re: May I ask, what assembler accepts that syntax? | |
Re: Just to note newbie the addressing mode [sp], is extant. In 16-bit assembly language bp is provided to be used in indirect addressing mode. The addressing mode [sp-bp] does not exist. If you are writing a bootstrap routine and you wonder where to pass control, that is either to another … | |
Re: If your working with the Windows Console, going into graphics mode will force full screen. .'.Anti | |
Re: Here's code that finds the maximum value in an array of bytes. [code] bits 16 org 100h start: mov bx, arr mov al, [bx] xor di, di inc di start_l: cmp byte [bx+di], 0 jz exit cmp al, [bx+di] jb swap return: inc di jmp start_l swap: mov al, [bx+di] … | |
Re: Each assembler's syntax is different, some follow something close to Intel Syntax, as DOS and Windows assemblers do, and UNIX assemblers use AT&T syntax because UNIX was developed at bell labs. The syntax doesn't matter as long as it assembles into the same machine instructions, it doesn't matter how opcodes … |
The End.