From: random AT visi DOT net (Michael Bosley) Newsgroups: comp.os.msdos.djgpp Subject: Q: Optimize this bit? Date: Fri, 08 May 1998 04:46:50 GMT Organization: @Home Network Lines: 60 Message-ID: <35528c1b.112750235@news> NNTP-Posting-Host: cx582964-a.nwptn1.va.home.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hello all, I have this bit of code that repeats an assignment. It is used to draw bits to the screen (thus, the vga name). If someone could optimize this (or even better, show me/explain to me how!) I would be extrememly grateful. 3 types of assignments: 1) Standard single assignment VGA[offset + 52] = 254; VGA[offset + 59] = 86; VGA[offset + 60] = 83; 2) Unrolled loop assignments VGA[offset + 711] = 218; VGA[offset + 712] = 200; VGA[offset + 713] = 241; VGA[offset + 714] = 232; VGA[offset + 715] = 222; VGA[offset + 716] = 222; VGA[offset + 717] = 235; VGA[offset + 718] = 243; VGA[offset + 719] = 245; 3) Unrolled loop/repetitive assignments VGA[offset + 1035] = 243; VGA[offset + 1036] = 243; VGA[offset + 1037] = 243; VGA[offset + 1038] = 243; VGA[offset + 1039] = 243; VGA[offset + 1040] = 243; I know you can write (terminology?) word length bits in assembly using something like repstosw (???) but I don't know assembly (and I do want to learn) and I wouldn't know how to write it. AFAIK, it would probably be (umm, in, i think, intel format?)... pop ds ; save some register (???) lots of mov and repstosw/repsto... here mov VGA[offset + 711], 211 ; move the value 211 into the array element push ds ; restore the saved register (???) repstosw => repeated store of words? Thanks all!!!!! Michael Bosley random AT N0_-_SPAM DOT visi DOT net !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Do Not Send Me Unsolicited Email! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!