X-Received: by 10.182.61.77 with SMTP id n13mr103092obr.34.1383061377344; Tue, 29 Oct 2013 08:42:57 -0700 (PDT) Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!i2no8581023qav.0!news-out.google.com!9ni1328qaf.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.bbs-scene.org!macgui.com!dog_cow From: D Finnigan Newsgroups: comp.sys.apple2.programmer Subject: Example high-res assembly program Date: Tue, 29 Oct 2013 15:42:57 +0000 (UTC) Organization: Mac GUI Lines: 90 Message-ID: NNTP-Posting-Host: gunshin.wiredns.net Mime-Version: 1.0 X-Trace: technocratmedia-w1.news.bbs-scene.org 1383061377 2451 74.119.145.48 (29 Oct 2013 15:42:57 GMT) X-Complaints-To: abuse@bbs-scene.org NNTP-Posting-Date: Tue, 29 Oct 2013 15:42:57 +0000 (UTC) User-Agent: Mac GUI Usenet Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Received-Bytes: 3783 Xref: csiph.com comp.sys.apple2.programmer:925 Following is a program that I wrote that uses paddles 0 and 1 to define X and Y coordinates for the end point of a line segment that begins in the upper left corner of the screen. It uses Monitor routines PREAD and WAIT. It uses some high-res Applesoft entry points too. Here are these Applesoft entry points and their arguments: 1.) HGR - $F3E2 Clears the screen just like the BASIC command 2.) HGR2 - $F3D8 Just like the BASIC command; shows page 2 with no text at bottom 3.) HCOLOR - $F6F0 Takes a hi-res color, 0-7, in the X register 4.) HPLOT - $F457 Plots a single point. Also calls HPSON in advance. A-reg = vert. coord X-reg = horiz. coord, low-byte Y-reg = horiz. coord, high-byte 5.) HLINE - $F53A Draws a line anywhere on the screen, starting from the initial cursor position, which can be altered with HPSON. A-reg = horiz. coord, low-byte X-reg = horiz. coord, high-byte Y-reg = vert. coord 6.) HPOSN - $F411 This will set the initial cursor position. The arguments re the same as HPLOT. Just as a reminder, the high-res screen boundaries are 280 points horizontal, by 192 vertical (with no text), or 160 vertical (with text). Here is the Paddle Line program: ORG $0300 JSR $F3E2 ; HGR LDX #$03 ; HCOLOR 3 JSR $F6F0 ; SET HCOLOR LDA #$00 ; INITIAL COORDS TAX ; ALL ZERO TAY ; ALL ZERO JSR $F411 ; SET HPSON LDX #$00 ; GET PADDLE 0 (HORIZ) JSR $FB1E ; PREAD RETURNS IN Y-REG TYA ; MOVE TO ACCUM PHA ; SAVE ON STACK JSR $FCA8 ; DELAY NECESSARY FOR PREAD LDX #$01 ; GET PADDLE 1 (VERT) JSR $FB1E ; PREAD CPY #$A1 ; IS RESULT < 161? BCC $0324 ; YES, SO SKIP NEXT LDY #$A0 ; NO, SO LIMIT TO 160 LDX #$00 ; HORIZ. HIGH-BYTE ALWAYS ZERO PLA ; GET SAVED HORIZ. LOW-BYTE FROM STACK JSR $F53A ; HLINE LDA #$FF ; LONG DELAY JSR $FCA8 ; WAIT JMP $0300 ; BEGIN AGAIN I wrote this program using a pen and paper. My reference books were the white Apple II manual and the Stanton arcade graphics book. I typed it in and executed it on a platinum IIe with a b&w Apple composite monitor. It worked the first time. I have no idea what this program looks like on a color monitor, or with an emulator. Further Technical notes: I wrote this program assuming that the subroutines would NOT preserve the CPU registers. This may or may not be true in all cases, so it may be that the program could be optimized. It is necessary to let some amount of time pass between consecutive reads of the paddles. The first delay is based on the initial paddle reading. If it's 0, then the delay may not be long enough, which could adversely affect the reading of paddle 1. In most cases, this result is probably inconsequential. -- ]DF$ Apple II Book: http://macgui.com/newa2guide/ Usenet: http://macgui.com/usenet/ <-- get posts by email! Apple II Web & Blog hosting: http://a2hq.com/