Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #925
| From | D Finnigan <dog_cow@macgui.com> |
|---|---|
| Newsgroups | comp.sys.apple2.programmer |
| Subject | Example high-res assembly program |
| Date | 2013-10-29 15:42 +0000 |
| Organization | Mac GUI |
| Message-ID | <dog_cow-1383061375@macgui.com> (permalink) |
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/
Back to comp.sys.apple2.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Example high-res assembly program D Finnigan <dog_cow@macgui.com> - 2013-10-29 15:42 +0000
Re: Example high-res assembly program Michael J. Mahon <mjmahon@aol.com> - 2013-10-29 13:08 -0500
Re: Example high-res assembly program D Finnigan <dog_cow@macgui.com> - 2013-10-29 18:17 +0000
Re: Example high-res assembly program Antoine Vignau <antoine.vignau@laposte.net> - 2013-10-29 11:27 -0700
Re: Example high-res assembly program Michael J. Mahon <mjmahon@aol.com> - 2013-10-29 19:59 -0500
Re: Example high-res assembly program aiiadict@gmail.com - 2013-10-29 13:51 -0700
Re: Example high-res assembly program Antoine Vignau <antoine.vignau@laposte.net> - 2013-10-29 14:47 -0700
Re: Example high-res assembly program aiiadict@gmail.com - 2013-10-30 10:02 -0700
Re: Example high-res assembly program David Schmidt <schmidtd@my-deja.com> - 2013-10-30 13:10 -0400
Re: Example high-res assembly program aiiadict@gmail.com - 2013-10-30 10:35 -0700
Re: Example high-res assembly program Antoine Vignau <antoine.vignau@laposte.net> - 2013-10-31 11:13 -0700
Re: Example high-res assembly program aiiadict@gmail.com - 2013-11-01 09:02 -0700
Re: Example high-res assembly program aiiadict@gmail.com - 2013-10-31 09:49 -0700
Re: Example high-res assembly program qkumba <peter.ferrie@gmail.com> - 2013-10-31 10:55 -0700
Re: Example high-res assembly program aiiadict@gmail.com - 2013-11-01 10:52 -0700
Re: Example high-res assembly program Michael J. Mahon <mjmahon@aol.com> - 2013-11-01 15:00 -0500
Re: Example high-res assembly program aiiadict@gmail.com - 2013-11-02 09:48 -0700
csiph-web