--------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAK00018Date: 06/15/97 From: HUGH NOLAND Time: 12:52pm \/To: GLENN VERDINS (Read 2 times) Subj: text attribute GV> How do i write a string to the screen, but being able to specify a text GV> attribute? GV> GV> Like the Mov Ah,9 Int 21 function, only with colors? Check out int 10h, function 13h. The following program illustrates the use of this function. ;--------------------------------------------------------------------- ;A program to illustrate the use of the BIOS write_string function. ;--------------------------------------------------------------------- cseg segment assume cs:cseg, ds:cseg org 100h begin: jmp main buf db "This is my test string--printed out as" db "yellow text on a black background.",13,10 len dw $ - buf main: mov ah,13h ;write_string function (int 10h) mov al,0 mov bl,0eh ;color attribute yellow on black mov bh,0 ;page mov dh,20 mov dl,2 ;dh,dl = row, col of start of string output mov cx,len ;cx holds length of string mov bp,offset buf ;es:bp==>start of string int 10h mov ax,4c00h int 21h cseg ends end begin --Hugh Noland-- --- Maximus/2 3.01 * Origin: Madman BBS * Chico, California * 916-893-8079 * (1:119/88) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAK00019Date: 06/13/97 From: KURT WISMER Time: 07:29pm \/To: ALL (Read 2 times) Subj: problem with my code... ok, can someone tell me what i'm doing wrong here? the problematic behaviour is described below... ; DiskBack - generates an image of a floppy disk in a file (and parses ; out the empty space). cseg segment word assume cs:cseg, ds:cseg org 100h begin: mov dx, offset file ;create file with filename in [dx] xor cx, cx ;set file attributes = 00000000 mov ah, 3ch ;create function => int 21h, ah = 3ch int 21h ;returns handle of created file in ax mov ax, 3d01h ;open function => int 21h, ah = 3dh ;open access is "write" => al = 00000001b = 01h ;[dx] = file name int 21h ;returns handle of opened file in ax mov di, ax ;save handle xor ax, ax ; drive al = 0 => a: drive mov dx, 0ffffh ; start at sector -1 arge: inc dx ;move sector pointer forward by 1 mov cx, 1h ;read 1 sector mov bx, offset buff ;set read buffer int 25h ;absolute disk read cx sectors starting at dx jc close ;close and exit on error mov bx, offset buff ;prep buffer for comparison mov cx, 200h ;200h byte string comparisons between buffer loop1: cmp byte ptr[bx], 0f6h ;compare the sector to the hex byte f6 (empty) jne writ ;write sector at first instance of a difference inc bx loop loop1 jmp arge ;skip sector save routine if the sector is ;full of f6h's writ: push dx ;save sector index mov bx, offset buff + 200h ;append sector index to buffered sector mov byte ptr[bx], dh ;for later recovery mov byte ptr[bx + 1], dl mov bx, di ;restore file handle mov dx, offset buff mov ah, 40h ;write function => int 21h, ah = 40h ;--------- problem line ---------- mov cx, 202h ; **** write 200h (512) bytes ;--------------------------------- int 21h ;writes 1 sector to the file with handle bx pop dx ;restore sector index jmp arge close: mov bx, di ;restore file handle mov ah, 3eh ;close file => int 21h, ah = 3eh int 21h ;bx = file handle mov ax, 4c00h ;exit program int 21h ; file db 'diskback.img',0 buff db 202 dup(?) cseg ends end begin -------- so here's the problem... as it stands now the resulting com file executes and saves the first sector of drive a: and the word sized number representing which sector it is, but refuses to go any further (i can tell by the amount of time the program takes to exit)... if i change the "problem line" to "mov cx, 200h" the program goes through all of a: drive and i get the 4608 bytes worth that i was expected from a freshly formatted floppy but i lose the "sector index" number (obviously, since i'm no longer writing those last two bytes)... i've tried putting a separate write procedure for those last two bytes but i get the same result as if i left it as it looks above... what am i missing? (this is being assembled under tasm, btw) ... ow that you know that i know that you know that i kn... --- TGWave v1.20.b09 * Origin: fks Online! * Ontario, Canada * (905)820-7273 * (1:259/423) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAK00020Date: 06/15/97 From: STEVEN READ Time: 01:59pm \/To: DYLAN GRIFFITHS (Read 2 times) Subj: Asm optimiser On 06-05-97 (23:31) DYLAN GRIFFITHS wrote to ALL DG> Is there a program that will take an assemlber source file DG> for input and output a file with suggested optimizations DG> and/or possible detection of logic errors? DG> * Origin: Games Garden BBS[Saskatoon, SK] (306) 343-0709 (1:140/237) I have no experience with their products but, try this company: V Communications Inc 4320 Stevens Creek Blvd, #275 San Jose, CA 95129 Tel: 408-296-4224 Tel: 800-662-8266 Fax: 408-296-4441 Email: 75031.3042@compuserve.com ASM Checker - source code analyzer ASM ProPak - assembly tools package ASMtool - assembly source analyzer & flowcharter ASMtool 486 This company makes the well known disassembler -- Sourcer. --- * QMPro 1.53 * steven read pcohio com --- InterEcho 1.19 * Origin: PC-Ohio PCBoard * Cleveland, OH * 216-381-3320 (1:157/200) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAK00021Date: 06/15/97 From: ROBERT FORTUNE Time: 11:43am \/To: DAN MCGREGOR (Read 2 times) Subj: Books and stuff... DM>Okay, I am thinking of starting up in Assembler and I just wanted to know whe DM>to start and how to learn. Are books the way or are experienced programmers DM>the only way to learn? Dan, Use any and all methods possible. One very good book for beginners is Jeff Duntemann's "Assembly Language, Step By Step". It may be out of print so check used book stores. I got my copy by posting messages in conferences like this one asking if anyone had a copy they would be willing to sell. One reply did and I got it for about $10.00.. --- OLX 2.1 TD Solving problems is the path to knowledge. * Origin: MoonDog BBS RIME NetHub Brooklyn,NY (1:278/15) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAK00022Date: 06/15/97 From: ROBERT FORTUNE Time: 11:43am \/To: LUIS CARDOSO (Read 2 times) Subj: instrucoes BYTECODE. LC> What mean exactly "BYTECODE Instructions?" I were reading a LC>article that said that in the compilation the software generate LC>BYTECODE instructions. Luis, Sounds like they meant machine code instructions. That is every micro- processor (CPU) has a set number of machine codes that it understands. This is called the microprocessor's "Instruction Set". When you write an assembler instruction in your asm programs and you then assemble your asm program the assembler converts your mneumonic assembly language instructions to machine code instructions. The purpose of assembly language is to give people something they can work with that is better than all numbers (hex or binary). Would you rather remember that 40H (hex) means 'add one to the AX register' or be able to use ADD AX, 1? Assembly and other computer languages are for our benefit since we cannot remember lots of numbers as easily as we can text-based information. Compilers work similar to assemblers in that they convert human mneumonic instructions into machine code instructions that the computer can understand. When you write PRINT "Hello!" in your program the computer doesn't have a clue what that means. That is why a computer language interpreter or compiler must first convert your program to machine code which the computer can understand. Those bytecode instructions you read about. Of course since computers are binary devices at their level of operation they understand only binary so that add instruction would be something like 01000000b (binary). How would you like to program directly in binary? Imagine page after page of binary code like 0100001110 and it's your job to make sense of it. Sound like fun? That is why we use high level languages and assembly language. Hope that helps. -Robert --- OLX 2.1 TD Life is hard, and then we die. * Origin: MoonDog BBS RIME NetHub Brooklyn,NY (1:278/15) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAK00023Date: 06/15/97 From: BRIAN MCCLOUD Time: 11:18am \/To: CAMERON CLARK (Read 2 times) Subj: Re: ASM optimiser DG>Is there a program that will take an assemlber source file for input and DG>output a file with suggested optimizations and/or possible detection of DG>logic errors? BM> Detect logic errors? In assembly language? That is doubtful... BM> optimizations, however, could be done, especially if it was written for a BM> different processor... CC> You could detect some specifics, but you'd have to make a "smart" CC> assembler. Example, give the 'bler (assembler) a knowledge base CC> of DOS interupt services. It can check if you've assigned the CC> right registers for the service. All you'd need would be about 4 bytes for each function (possibly even get more than just dos), with each bit representing a register, and if the bit is set, that register has to have a value (for call), or gets a value (on return). CC> You could try a "define before use" clause for registers. If a register CC> has not been assigned a value (by declaration or by INT call), you could CC> produce a warning that it may not be defined yet. CC> You could try to define pairs of instuctions. Maybe warn if a "push" CC> has no accompanying "pop" in a function macro. Warn if a macro destroys CC> registers that haven't been saved (or pushed). Or if SP would end up different at the end of a function - I caught someone a few weeks ago trying to push the remainders of division by 16, but didn't pop them before he got to the RET instruction. CC> If a well experienced asm writter could think of the common mistakes CC> he makes, he could find some semantic warnings that would really fit CC> the bill. This is true... however, I'm not sure those would be logic errors exactly... logic errors would be like dividing where you wanted to multiply... the program would still run, it just wouldn't do quite what you wanted it to do. If you're going to go this far, you could even provide directives to make self-decrypting code automatically... then it could check the code before it was encrypted... ((Cloud)) MauveCloud@juno.com * OLX 2.2 * Bank error in your favor. Collect $200. --- PCBoard (R) v15.3/M 10 * Origin: Next time, Dial The Wrong Number! (209) 943-1880 (1:208/205) --------------- FIDO MESSAGE AREA==> TOPIC: 145 ASSEMBLY LANG. Ref: EAK00024Date: 06/15/97 From: BRIAN MCCLOUD Time: 11:18am \/To: CRAIG HART (Read 2 times) Subj: ASM optimiser CH> > That part could be done without too much trouble... like changing CH> > multiple SHL CH> > instructions to a single SHL instruction (286+ can have an immediate CH> > value for CH> > a SHL, but an 8086 can't), CH>SHL ,1 is valid on the 808x. The _difference_ is that 1 is the only CH>legal immediate value for the 808x processors. it's not really an immediate value... it's a single byte, followed by an r/m byte, and the 1 is implied. For the 80286, there is an immediate byte there to specify explicitly how far to shift it. CH> or turning a REP MOVSW into a REP MOVSD (it CH> > would CH> > have to find where you assigned CX as well)... CH>CX does not need to change for any form of the rep instruction. If what ou CH>are trying to say is that rep movsd uses ecx, guess again. it does not. Your first sentence is incorrect. To get the same amount of memory for different REP instructions, you'd need to modify CX, since they're in different increments of SI and/or DI for each decrement of CX. I know it doesn't use ECX, but you have to make sure it doesn't move more data than you wanted. A REP MOVSW with CX = 8000h would move exactly 64k of data. A REP MOVSD with the same CX would try to move 128k of data, which would only work if you were doing 32-bit addressing, in which case it probably would end up using ECX as a counter. To move 64k of data with a REP MOVSD, you'd need to make CX = 4000h, exactly half as many doublewords as words. If you were sing REP MOVSB, you'd have to make CX = FFFFh, and add an extra MOVSB at the end. ((Cloud)) MauveCloud@juno.com * OLX 2.2 * Jones' Motto: Friends may come and go, but enemies accumu --- PCBoard (R) v15.3/M 10 * Origin: Next time, Dial The Wrong Number! (209) 943-1880 (1:208/205)