|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
|
Real programmers can write assembly code in any language.
Larry Wall
See also ..\Bulletin\index.shtml
STOP THE GENOCIDEfrom Erkki Tapola <erkki.tapola@welho.com>
STOP THE GENOCIDE Erkki Tapola 29-Jul-96
Every second billions of innocent assembler instructions are executed all over the world. Inhumanly they are put on a pipeline and executed with no regard to their feelings. The illegal instructions are spared, although they should be executed instead of the legal ones.
Prior to the execution the instructions are transported to a cache unit using a bus. There they spent their last moments waiting for the execution. Just before the execution the instruction is separated into several pieces. The execution isn't always fast and painless. On crude hardware the execution of a complex instruction can take as long as 150 clock cycles. Scientists are working on shorter execution times.
Microsoft endorses the needless execution of instructions with their products like DOS(TM), Windows(TM), Word(TM) and Excel(TM). It is more humane to use software which minimises the executions.
Modern machines use several units to execute multiple instructions simultaneously. This way it is possible to execute several hundred million instructions per second. The time is near when there will be no more instructions to execute.
ACT NOW! Before it's too late
This article was written on recycled paper by hand.
|
Re:Somewhere in the middle... (Score:5, Informative)
by Lord Ender (156273) on Thursday February 05, @08:47PM (#8197155) |
| This was posted to USENET by its author, Ed Nather, on May 21,
1983. A recent article devoted to the *macho* side of programming made the bald and unvarnished statement: Real Programmers write in FORTRAN. Maybe they do now, in this decadent era of Lite beer, hand calculators, and "user-friendly" software but back in the Good Old Days, when the term "software" sounded funny and Real Computers were made out of drums and vacuum tubes, Real Programmers wrote in machine code. Not FORTRAN. Not RATFOR. Not, even, assembly language. Machine Code. Raw, unadorned, inscrutable hexadecimal numbers. Lest a whole new generation of programmers grow up in ignorance of this glorious past, I feel duty-bound to describe, as best I can through the generation gap, how a Real Programmer wrote code. I'll call him Mel, because that was his name. I first met Mel when I went to work for Royal McBee Computer Corp., a now-defunct subsidiary of the typewriter company. The firm manufactured the LGP-30, a small, cheap (by the standards of the day) drum-memory computer, and had just started to manufacture the RPC-4000, a much-improved, bigger, better, faster --- drum-memory computer. Cores cost too much, and weren't here to stay, anyway. (That's why you haven't heard of the company, or the computer.) I had been hired to write a FORTRAN compiler Mel didn't approve of compilers. "If a program can't rewrite its own code", he asked, "what good is it?" Mel had written, in hexadecimal, the most popular computer program the company owned. It ran on the LGP-30 and played blackjack with potential customers at computer shows. Its effect was always dramatic. The LGP-30 booth was packed at every show, and the IBM salesmen stood around talking to each other. Whether or not this actually sold computers was a question we never discussed. Mel's job was to re-write the blackjack program for the RPC-4000. (Port? What does that mean?) The new computer had a one-plus-one addressing scheme, in which each machine instruction, in addition to the operation code and the address of the needed operand, had a second address that indicated where, on the revolving drum, the next instruction was located. In modern parlance, every single instruction was followed by a GO TO! Put *that* in Pascal's pipe and smoke it. Mel loved the RPC-4000 because he could optimize his code: that is, locate instructions on the drum so that just as one finished its job, the next would be just arriving at the "read head" and available for immediate execution. There was a program to do that job, an "optimizing assembler", but Mel refused to use it. "You never know where it's going to put things", he explained, "so you'd have to use separate constants". It was a long time before I understood that remark. Since Mel knew the numerical value of every operation code, and assigned his own drum addresses, every instruction he wrote could also be considered a numerical constant. He could pick up an earlier "add" instruction, say, and multiply by it, if it had the right numeric value. His code was not easy for someone else to modify. I compared Mel's hand-optimized programs with the same code massaged by the optimizing assembler program, and Mel's always ran faster. That was because the "top-down" method of program design hadn't been invented yet, and Mel wouldn't have used it anyway. He wrote the innermost parts of his program loops first, so they would get first choice of the optimum address locations on the drum. The optimizing assembler wasn't smart enough to do it that way. Mel never wrote time-delay loops, either, even when the balky Flexowriter required a delay between output characters to work right. He just located instructions on the drum so each successive one was just *past* the read head when it was needed; the drum had to execute another complete revolution to find the next instruction. He coined an unforgettable term for this procedure. Although "optimum" is an absolute term, like "unique", it became common verbal practice to make it relative: "not quite optimum" or "less optimum" or "not very optimum". Mel called the maximum time-delay locations the "most pessimum". After he finished the blackjack program and got it to run ("Even the initializer is optimized", he said proudly), he got a Change Request from the sales department. The program used an elegant (optimized) random number generator to shuffle the "cards" and deal from the "deck", and some of the salesmen felt it was too fair, since sometimes the customers lost. They wanted Mel to modify the program so, at the setting of a sense switch on the console, they could change the odds and let the customer win. Mel balked. He felt this was patently dishonest, which it was, and that it impinged on his personal integrity as a programmer, which it did, so he refused to do it. The Head Salesman talked to Mel, as did the Big Boss and, at the boss's urging, a few Fellow Programmers. Mel finally gave in and wrote the code, but he got the test backwards, and, when the sense switch was turned on, the program would cheat, winning every time. Mel was delighted with this, claiming his subconscious was uncontrollably ethical, and adamantly refused to fix it. After Mel had left the company for greener pa$ture$, the Big Boss asked me to look at the code and see if I could find the test and reverse it. Somewhat reluctantly, I agreed to look. Tracking Mel's code was a real adventure. I have often felt that programming is an art form, whose real value can only be appreciated by another versed in the same arcane art; there are lovely gems and brilliant coups hidden from human view and admiration, sometimes forever, by the very nature of the process. You can learn a lot about an individual just by reading through his code, even in hexadecimal. Mel was, I think, an unsung genius. Perhaps my greatest shock came when I found an innocent loop that had no test in it. No test. *None*. Common sense said it had to be a closed loop, where the program would circle, forever, endlessly. Program control passed right through it, however, and safely out the other side. It took me two weeks to figure it out. The RPC-4000 computer had a really modern facility called an index register. It allowed the programmer to write a program loop that used an indexed instruction inside; each time through, the number in the index register was added to the address of that instruction, so it would refer to the next datum in a series. He had only to increment the index register each time through. Mel never used it. Instead, he would pull the instruction into a machine register, add one to its address, and store it back. He would then execute the modified instruction right from the register. The loop was written so this additional execution time was taken into account --- just as this instruction finished, the next one was right under the drum's read head, ready to go. But the loop had no test in it. The vital clue came when I noticed the index register bit, the bit that lay between the address and the operation code in the instruction word, was turned on --- yet Mel never used the index register, leaving it zero all the time. When the light went on it nearly blinded me. He had located the data he was working on near the top of memory --- the largest locations the instructions could address --- so, after the last datum was handled, incrementing the instruction address would make it overflow. The carry would add one to the operation code, changing it to the next one in the instruction set: a jump instruction. Sure enough, the next program instruction was in address location zero, and the program went happily on its way. I haven't kept in touch with Mel, so I don't know if he ever gave in to the flood of change that has washed over programming techniques since those long-gone days. I like to think he didn't. In any event, I was impressed enough that I quit looking for the offending test, telling the Big Boss I couldn't find it. He didn't seem surprised. When I left the company, the blackjack program would still cheat if you turned on the right sense switch, and I think that's how it should be. I didn't feel comfortable hacking up the code of a Real Programmer. |
Slashdot Learning Computer Science via Assembly Language
|
Forgetting the Most Important Point (Score:4, Funny)
by duck_prime (585628) on Thursday February 05, @08:45PM (#8197142) |
For learning, we don't have to learn assembly first anymore, you can start with any language. I think it is good to take a two pronged approach. Learn C first, and at the same time, start learning digital logic. [...] When one is comfortable with both, I think learning assembly is much easier.You are missing the One True Purpose of assembly language, and the One True Reason everyone should learn assembly first: Nothing else in the Universe can make students grateful -- grateful! -- to be allowed to use C |
|
Re:Not So New Concept (Score:5, Funny) by Jester99 (23135) on Thursday February 05, @07:39PM (#8196515) (http://www.people.cornell.edu/pages/ak333/) |
| "The C Programming Language -- A language which combines the flexibility of assembly language with the power of assembly language." The way I heard it was far drier humor: "C: The language combining the power of assembly with the ease of use of assembly." |
|
Re:Not necessarily the mark of a great programmer (Score:4,
Funny) by s20451 (410424) on Thursday February 05, @06:53PM (#8195984) (http://www.andreweckford.com/ | Last Journal: Thursday January 15, @01:07PM) |
| I'm not a great programmer, but I never really understood
programming -- especially C programming -- until I took 68000 assembly.
It also took a digital logic course so I could imagine how a processor
was built. It's just abstract manipulation of symbols until you can
imagine exactly how your printf("Hello World!\n"); gets broken up into
neat little binary chunks. ps. Don't make them learn x86 assembly. I think that's banned under the Geneva convention. |
Todd's Humor Archive IBM enhanced instruction set (fwd) by Poivre (poivre@netcom.com) Sat, 14 May 1994 14:56:27 -0700 (PDT)
PROPOSED ADDITIONS TO THE IBM INSTRUCTION SET IBM Intrepid Use Only
IBM Model 3090/69 Features & Assembler Language Commands
AAAH Add And Automatically Halt AARTZ Add And Reset To Zero ABC Abdicate Basic Compiler ACM Automatically Clear Memory ADN Ad Nauseam ADN Add Naseum AIM Add Improper BAH Branch And Hang BBBAB Bite Baudy Bit And Branch BBC Branch Before Compare BBT Branch on Binary Tree BBW Branch Both Ways BCEGR Branch on CE Ground BEW Branch Either Way BH Branch and Hang BKCRDR Backspace Card Reader BKSPD Backspace Disk BKTPR Break Tape Reverse BLMNF BLow MaiN Fuse BLPIN Branch and LooP INdefinite BMR Branch Multiple Registers BNEV Branch NEVer BOB Branch On Bug BOBI Branch On Blinking Indicator BOBOI Branch On Burned-Out Indicator BOC Branch OCcasionally BOCBF Branch On Chip-Box Full BOD Beat On Drum BOI Byte Operator Immediately BOPLT Burn Out Pilot LighTs BOPO Branch On Power Off BOSO Branch On Sleepy Operator BOV Burn Out Vdu BOXMS Branch On Index Missing BPDI Be Polite, Don't Interrupt BPE Bypass Program Error BPECK ByPass Error ChecK BPO Branch on Power Off BRPCB BuRP and Clear Bytes BRST BRanch SomeTimes BSCH Burst Select CHannel BST Backspace and Stretch Tape BYCRE BYpass CoRE BYTRN BYTe and RuN CBS Crash Bothersome Source-code CCS Chinese Character Set CDHI Crash Disk Head Immediate CEMU Close Eyes and Monkey with User space CIRM Circulate Memory CLBR CLobber ReGister CLBRI CLobber ReGister Immediately CM Circulate Memory CMBG Create Machine Bug CNFM Confuse Memory CNFOP Confuse Operator CPPR Crumple Printer Paper and Rip CRB CRash and Burn CRDT CReate Data CTRNS Convert To Roman Numerals CU Convert to Unary CVUME Cover Up Machine Errors CZZC Convert Zone to Zip Code DABCM Digit And Branch Converter Modifier DAC Divide And Conquer DAMIT Transfer Control to Perdition DAO Divide And Overflow DC divide and conquer DCTCB Dump Core To Chad Box DDMWH Dump Dim Map of Western Hemisphere DESSPK Destroy Storage Protect Key DEVIA Develop Ineffective Address DITCK Drop Into Check DLTCR Delete Core DMC Destroy Memory Chip DMNS Do what I Mean, Not what I Say DMPK Destroy Memory Protect Key DNPG Do Not Pass Go DO Divide and Overflow DRPBTS Drop Bits DSTME Destroy Memory ECL Early Card Lace EDPMAB Electrocute DP Manager And Branch EIOC Execute Invalid OpCode EJCAB Eject Chad Box EJD Eject Disk EMPC EMulate Pocket Calculator EMU407 407 Emulation EPE Execute Program Error EPI Execute Programmer Immediately EPMAS Erase Protected Memory Areas ERCDP Erase Card Punch ERCDS Erase Cards EROS Erase Read-Only Storage ERPTW Erase Print Wheel ERROS Erase Read Only Storage ESTOP Emergency STOP ** RESIST ALL EFFORTS TO RESTART ** ETCRD Eat Card EXIOC Execute Invalid Op Code EXOP Execute Operator EXPP EXecute Political Prisoner FDCDJ Feed Card and Jam FSKPRW Forms Skip and Run Away GFD Go Forth and Divide GFM Go Forth and Multiply GLPSB Gulp and Store Bytes GPAER Generate Parity Error HCF Halt and Catch Fire ** PRIVILEGED OPERATION ** HCFC Branch Before Compare HCFR Halt and Catch FiRe ** PRIVILEGED OPERATION ** HDLF Hurl Disc Like Frisbee IAI Inquire And Ignore IBP Insert Bug and Proceed IFKTR Initiate Fake-out Routine IGSPC Ignore Supervisor Call IIAH Ignore Interrupt And Hang IIB Ignore Inquiry and Branch IKC Ignore Keyboard and Crash ILLAND Illogical AND ILLOR Illogical OR ILPS Invert Logical Power Supply INC1401 1401 INCompatibility INVRB Invert Record and Branch IOCSM Input/Output Conversely Synchronized to Matrix ITLKC Interlock Core JMKYP Jam Keypunches JMPNC Punch JRA Jump to Random Address JSRLR Jump to SubRoutine and Lose return Address LCC Load and Clear Core LGOWY Load and Go Away LMBR Lose Message and Branch LPCON Loop Continuous LUPGA Loop Until Programmer Goes Away (in desperation) MBF Multiply and Be Fruitful MDRBT Move and Drop Bits MKTIV Make Tape Invalid MLR Move and Lose Record MVCON Move Continuous MVLR Move and Lose Record MVWRC Move and Wrap Core NBC Negate By Clearing OOOH Or Only On Half-hours PBC Print and Break Chain PBS Pop Before Stacking PCHD Punch Disk PCHOP Punch Operator PD Play Dead PDKBN Punch Disk Binary PDOSI Play Des O'Connor Song Immediate PDSK Punch Disk PINV Punch Invalid POF Print On Fly POPI Punch OPerator Immediately PRANB Pick up Random Bits PRSMR Print and Smear PS* Punch obscenity PSD Pause and Smoke Dope PSP Print and Shred Paper PVLC Punch Variable Length Card RBAFG Read Binary And Forget RCDRD Rewind Card Reader RCDSCD Read Card and Scramble Data RCTKG Read Count Key and Garbage RD Reverse Directions RDBGG Random Bug Generator ** SPECIAL FEATURE ** RDBR Read Bad Record RDCBX Read Chad Box RDCHS Read Chaos RDIOST Read-In Only Storage ** SPECIAL FEATURE ** RDIRG Read Inter Record Gap RDNOR Read Noise Record RDS ReaD Sideways REDTH Reduce Throughput REIMT Reinitialize Meter REPAB Reverse Parity And Branch REWFR Rewind Forward RINV Read Invalid RIODNR Rotate Input/Output Device Numbers Randomly RIRG Read Inter-Record Gap RNR Rather Not Run ROLPR Rewind On-Line Printer RPBL Read Print and Blush RPI Reverse Priority of Interrupts RPLT Read from Plotter RPM Read Programmer's Mind RPTR Read from Printer RRR Rotate Right Randomly RSC Read and Shred Card RSD on Read error Self Destruct RSPP Randomly Shred Printer Paper RSTOM Read from STore-Only Memory RVDOD Reverse Drum Or Disk RVDRI Reverse Drum Immediate RWBKT Rewind and Break Tape RWCR Rewind Card Reader RWDSK Rewind Disk RWTOD Rewind Tape Onto Disk RWWRT Read and Write While Ripping Tape SADP Stop And Demand Payrise SARTZ Subtract And Reset To Zero SCCHS Scramble Channels SCDTA Scatter Data SCMRY Scatter Memory SCPR Scatter Print SCPSW Scatter Program Status Word SDI Scratch Disc Immediate SHAB SHift A Bit SHLBM SHift a Little Bit More SHLPN SHarpen Light PeNcil SKRSD Seek Record and Scar Disk SLD Slip Disk SMR Skip on Meaningless Result SMTACS Shift Manual To Automatic and Check Stop SOSAJ Select Output Stacker And Jam SOT Sit On a Tack SPRDK Shuffle Program Deck SPSW Scramble Program Status Word SPT Scramble Protected Tapes SQPC Sit Quietly and Play with your Crayons SRSD Seek Record and Scar Disk SRZ Subtract and Reset to Zero SSJ Select Stacker and Jam SST Stop and Stretch Tape STAB Switch To Alternate Bedlam STDR Stop and Demand a Rest STROM STore in Read-Only Memory STSLD Stacker Select Disk STTPB Stretch Tape Binary STUP Stacker Upset TADBT Transfer And Drop Bits TCLSR Transfer Control and Lose Return TCTDK Transfer Control To Disk TCTOL Transfer Control To Overhead Lights TCTPL Transfer Control To Pilot Lights TCTWS Transfer Control To Wall Socket TDB Transfer and Drop Bits TMTDK Transfer Monitor To Disk TPDEC Triple Pack Decimal TRAHG Transfer And Hang TRDB Transfer And Drop Bits TRSCH Trap Secretary and Halt UER Update and Erase Record UINDA Use Inverse Digital Array UNCPB Uncouple CPUs and Branch UPERR Update and Erase Record UPTR Update Transaction WBI Water BInary tree WCDR Write CD-ROM WCTKG Write Count Key and Garbage WEMG Write Eighteen Minute Gap WMTAE Write Memory , Transfer, And Erase WNOSR Write Noise Record WPM Write Programmer's Mind WRR Write Random Record WWRLR Write Wrong Length Record XMAS eXclusive OR Main Areas of Storage XSP eXecute Systems Programmer ZIPCD Address of Memory . Zip Code = 85281 ZIPEX Address by Nine-Digit Zipcode And Remember --- "On A Clear Disk You Can Seek Forever."
Jokes Magazine Amusing Opcodes September 5, 2001
BNE - Branch to Non-Existent code
BNR - Branch for No Reason.
BRA - Branch to Random Address
BVS - Branch to Virtual Subroutine
CLD - CalL a Doctor
CMD - Create Meaningless Data.
DEC - DElete the Code
DRA - Decrement Random Address.
EDR - Emit Deadly Radiation.
JMP - Jump if Memory Present (conditional jump)
LLI - Lose Last Instruction.
PRS - Push Results off Stack.
RIS - Remain In Subroutine.
RTI - Return from the Infinity
SHB - Scramble High order Bit.
TEC - Take Extra time for Calculation
Assembler files from Programmer's Heaven: binary, source, and text.
NASM: The Netwide Assembler Project.
NASM Information and links by John Fine, the moderator of comp.lang.asm.x86. Also includes helpful software and further links.
Win95 Assembly by G. Adam Stanislav.
Pass32 32-bit assembler by Dieter R. Pawelczak.
Other low level languages
The BAssPasC (BAPC3) programming language has been made for those Assembly language programmers who want to make fast and small program code, but are striving for faster development, easier overview and less typing.
In first approach, the BAPC is a expansion for the assembly language in the form of a macro-set. But then today it covers the full assembly, nearly everything can be written using just the BAPC instructions. With the LIBs the BAPC can be ranked among the high level computer languages, it steps much over the level being just a macro-set.
The philosophy of BAPC programming doesn't differ much from assembly, but it results in a smaller, tenser and more perspicuous source. This way bigger, more complicated programs can be written, whose handling was more labored in asm. For this BAPC gives lots of possibilities: for example the fast compiling of BPO, easier handling of binary files or the possibility of defining the visibility of the labels.
Copyright © 1996-2007 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.
Last modified: February 28, 2008