Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Optimization Message-ID: <1226.UUL1.3#5129@willett.UUCP> Date: 27 Jun 90 02:30:07 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 38 Date: 06-25-90 (06:32) Number: 1805 (Echo) To: MARK SMILEY Refer#: NONE From: PETE KOZIAR Read: NO Subj: MORE EFFICIENT 0< Status: PUBLIC MESSAGE Another little optimization for F83 and/or F-PC. Using the magic CWD instruction, we can gain quite a few cycles, making the definition for 0< being: CODE 0< POP AX CWD PUSH DX NEXT END-CODE We can extend this to other words in a similar fashion: CODE 0> POP AX NEG AX CWD PUSH DX NEXT END-CODE CODE 0<> POP AX CWD MOV BX, DX NEG AX CWD AND BX, DX PUSH BX NEXT END-CODE This saves the Jxx instruction, as well as the immediate move instructions. I think it's used often enough to justify "kernel twiddling." --- * Via Qwikmail 2.01 The Baltimore Sun Date: 06-25-90 (06:54) Number: 1806 (Echo) To: MARK SMILEY Refer#: NONE From: PETE KOZIAR Read: NO Subj: MISTAKE IN LAST NOTE Status: PUBLIC MESSAGE Oops. That's what I get for entering a message the first thing in the morning! The AND BX, DX in the definition for 0<> always results in zero, since the number cannot be both positive and negative at the same time. The correct instruction would be OR BX, DX which returns true if the number was either > 0 or < 0, and false if it was the only number that is neither positive nor negative, i.e., 0. ----- This message came from GEnie via willett through a semi-automated process. Report problems to: uunet!willett!dwp or willett!dwp@hobbes.cert.sei.cmu.edu