Path: ns-mx!hobbes.physics.uiowa.edu!zaphod.mps.ohio-state.edu!mips!cs.uoregon.edu!nntp.uoregon.edu!cie.uoregon.edu!nparker From: nparker@cie.uoregon.edu (Neil Parker) Newsgroups: comp.sys.apple2 Subject: Re: Various Questions Keywords: assembly language brain fry Message-ID: <1992Jan7.112046.26998@nntp.uoregon.edu> Date: 7 Jan 92 11:20:46 GMT References: Sender: news@nntp.uoregon.edu Organization: The Universal Society for the Prevention of Reality Lines: 93 In article garyd@windslc.seri.gov (Gary Desrochers) writes: > I have a couple of questions. > >[...first question removed, since I can't answer it...] > >2) I would like to know what the address of the true hplotto command in >applesoft is. What I want is the memory address. In several books it >is given as F53A. Now this cannot be the start of the hplotto. The >reason I say this is that when I set it up like this: > >lda xlowbyte >ldx xhighbyte >ldy ybyte >jsr F53A > > The ybyte needs to be the line on the screen that the line will >finnish. Now this is fine but the xhighbyte and xlowbyte is the number >of places in the positive direction that the hires cursor moves. It is >not the general x coordinate. Of course I have made sure and tested >this out extensively so I know this is what it does. The reason I think >there must be another location is that in Applesoft you can give it a: > >hplot 100,100 to 10,10 > >and it will plot backwards. I cannot, using location F53A, plot >backwards. It will only plot forwards. Now I can use location F411 to >move the hires cursor backwards and then hplot forwards but there must >be an eisier way. I have tried negative numbers but makes it go around >the screen many many many times so I know negative integers don't work. > >Does anyone know of a fix to this? No, there is no other Applesoft line drawing routine--it's all done using $F53A (HLIN). The proper way to use it is to use $F411 (HPOSN) or $F457 (HPLOT) to set the starting point, and then draw to the ending point with $F53A. There's no need to use negative numbers. Just give the starting point to $F411 or $F457, and the ending point to $F53A. It may be helpful to examine the actual code used by Applesoft's HPLOT token to do the drawing: DSCTMP EQU $9D ;Zero-page temporary CHRGOT EQU $B7 ;Get current token from program text TOTKN EQU $C1 ;Applesoft TO token SYNCHR EQU $DEC0 ;Give SYNTAX ERROR if next token doesn't match A-reg HPLOT EQU $F457 ;Plot a point HLIN EQU $F53A ;Draw line from last point to new point HFNS EQU $F6B9 ;Parse X,Y coords from program text HCOLRTS EQU $F6F5 ;Address of nearby RTS instruction * * This is the main entry point for Applesoft's HPLOT token. Before calling * this entry point, the main parser loop will have put the next token after * the HPLOT in the accumulator. * * This code is found at $F6FE in the Applesoft ROM. * CMP #TOTKN ;Is it a TO? BEQ HP1 ;If so, go straight to line-drawing code JSR HFNS ;Get X,Y coords of starting point JSR HPLOT ;Draw the starting point HP2 JSR CHRGOT ;Get token from program text CMP #TOTKN ;Is it a TO? BNE HCOLRTS ;If not, return to caller HP1 JSR SYNCHR ;Verify TO token JSR HFNS ;Get X,Y coords of ending point STY DSCTMP ;Shuffle regs for HLIN TAY TXA LDX DSCTMP JSR HLIN ;Draw the line JMP HP2 ;Loop to check for more points Looking at your HPLOT example (HPLOT 100,100 TO 10,10), it's fairly easy to see what calls this code executes...it simply calls $F457 to plot 100,100, and then it calls $F53A to draw to 10,10. You ought to be able to accomplish the same thing in machine language like this: LDA #$64 LDX #$64 LDY #0 JSR $F457 LDA #$0A LDX #0 LDY #$0A JSR $F53A - Neil Parker -- Neil Parker No cute ASCII art...no cute quote...no cute nparker@cie.uoregon.edu disclaimer...no deposit, no return... parker@corona.uoregon.edu (This space intentionally left blank: )