Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #4558 > unrolled thread

calling HPLOT from assembly language

Started byvince@pianoman.cluster.toy
First post2018-05-27 03:43 +0000
Last post2018-05-27 12:12 -0700
Articles 4 — 3 participants

Back to article view | Back to comp.sys.apple2.programmer


Contents

  calling HPLOT from assembly language vince@pianoman.cluster.toy - 2018-05-27 03:43 +0000
    Re: calling HPLOT from assembly language awanderin <awanderin@gmail.com> - 2018-05-27 00:28 -0600
      Re: calling HPLOT from assembly language vince@pianoman.cluster.toy - 2018-05-27 14:35 +0000
      Re: calling HPLOT from assembly language Antoine Vignau <antoine.vignau@laposte.net> - 2018-05-27 12:12 -0700

#4558 — calling HPLOT from assembly language

Fromvince@pianoman.cluster.toy
Date2018-05-27 03:43 +0000
Subjectcalling HPLOT from assembly language
Message-ID<slrnpgkabk.hch.vince@pianoman.cluster.toy>
So I was trying to quickly get some HGR lines drawn from assembly language
by calling directly into the Applesoft ROM.

From what I can tell the following code *should* work and draw a white
line from 100,100 to 150,150.  Instead what it does is draw a solid white
box from X 0 to 280 from Y 100 to 150.

Is there something obvious I am doing wrong here?

Thanks,

Vince


000000r 1  2C 50 C0     	bit	SET_GR			; graphics mode
000003r 1  2C 57 C0     	bit	HIRES			; hires mode
000006r 1  2C 53 C0             bit	TEXTGR			; mixed text/graphics
000009r 1  2C 54 C0             bit	PAGE0			; first graphics page
00000Cr 1  20 58 FC     	jsr	HOME
00000Fr 1               
00000Fr 1  A9 20        	lda	#$20
000011r 1  85 E6        	sta	HGR_PAGE
000013r 1               
000013r 1  20 F2 F3     	jsr	HCLR			; clear screen
000016r 1               
000016r 1               	; HCOLOR=3
000016r 1  A2 03        	ldx	#3
000018r 1  BD F6 F6     	lda	COLORTBL,X		; get color pattern from table
00001Br 1  85 E4        	sta	HGR_COLOR
00001Dr 1               
00001Dr 1               	; HPLOT 100,100 to 150,150
00001Dr 1               	; X= (y,x), Y=a
00001Dr 1  A0 00        	ldy	#0
00001Fr 1  A9 64        	lda	#100
000021r 1  A2 64        	ldx	#100
000023r 1  20 57 F4     	jsr	HPLOT0
000026r 1               
000026r 1               	; X=(a,x), y=Y
000026r 1  A9 00        	lda	#0
000028r 1  A2 96        	ldx	#150
00002Ar 1  A0 96        	ldy	#150
00002Cr 1  20 3A F5     	jsr	HGLIN

[toc] | [next] | [standalone]


#4560

Fromawanderin <awanderin@gmail.com>
Date2018-05-27 00:28 -0600
Message-ID<yubzi0lwr1w.fsf@gmail.com>
In reply to#4558
vince@pianoman.cluster.toy writes:

> So I was trying to quickly get some HGR lines drawn from assembly language
> by calling directly into the Applesoft ROM.
>
> From what I can tell the following code *should* work and draw a white
> line from 100,100 to 150,150.  Instead what it does is draw a solid white
> box from X 0 to 280 from Y 100 to 150.
>
> Is there something obvious I am doing wrong here?

F457 (HPLOT0) takes y-coord in A, x-coord in X(lo), Y(hi).
F53A (HGLIN) takes y-coord in Y, x-coord in A(lo), X(hi).

See http://www.txbobsc.com/scsc/scdocumentor/F49C.html
and http://www.txbobsc.com/scsc/scdocumentor/F3D8.html

for the source.

>
> Thanks,
>
> Vince
>
>
> 000000r 1  2C 50 C0     	bit	SET_GR			; graphics mode
> 000003r 1  2C 57 C0     	bit	HIRES			; hires mode
> 000006r 1 2C 53 C0 bit TEXTGR ; mixed text/graphics
> 000009r 1 2C 54 C0 bit PAGE0 ; first graphics page
> 00000Cr 1  20 58 FC     	jsr	HOME
> 00000Fr 1               
> 00000Fr 1  A9 20        	lda	#$20
> 000011r 1  85 E6        	sta	HGR_PAGE
> 000013r 1               
> 000013r 1  20 F2 F3     	jsr	HCLR			; clear screen
> 000016r 1               
> 000016r 1               	; HCOLOR=3
> 000016r 1  A2 03        	ldx	#3
> 000018r 1 BD F6 F6 lda COLORTBL,X ; get color pattern from table
> 00001Br 1  85 E4        	sta	HGR_COLOR
> 00001Dr 1               
> 00001Dr 1               	; HPLOT 100,100 to 150,150
> 00001Dr 1               	; X= (y,x), Y=a
> 00001Dr 1  A0 00        	ldy	#0
> 00001Fr 1  A9 64        	lda	#100
> 000021r 1  A2 64        	ldx	#100
> 000023r 1  20 57 F4     	jsr	HPLOT0
> 000026r 1               
> 000026r 1               	; X=(a,x), y=Y
> 000026r 1  A9 00        	lda	#0
> 000028r 1  A2 96        	ldx	#150
> 00002Ar 1  A0 96        	ldy	#150
> 00002Cr 1  20 3A F5     	jsr	HGLIN
>

-- 
--
Jerry    awanderin at gmail dot com

[toc] | [prev] | [next] | [standalone]


#4561

Fromvince@pianoman.cluster.toy
Date2018-05-27 14:35 +0000
Message-ID<slrnpglgh9.727.vince@pianoman.cluster.toy>
In reply to#4560
On 2018-05-27, awanderin <awanderin@gmail.com> wrote:
> vince@pianoman.cluster.toy writes:

> F457 (HPLOT0) takes y-coord in A, x-coord in X(lo), Y(hi).
> F53A (HGLIN) takes y-coord in Y, x-coord in A(lo), X(hi).
>
> See http://www.txbobsc.com/scsc/scdocumentor/F49C.html
> and http://www.txbobsc.com/scsc/scdocumentor/F3D8.html

beleive it or not I had been staring at those exact pages the past 3
days trying to figure it out. I can't believe I had A/X switched 
on the HGLIN code despite going through the code many many times.

Anyway it works now, thanks.

Vince

[toc] | [prev] | [next] | [standalone]


#4563

FromAntoine Vignau <antoine.vignau@laposte.net>
Date2018-05-27 12:12 -0700
Message-ID<baa51336-141d-4210-b480-13a853b85822@googlegroups.com>
In reply to#4560
On Sunday, May 27, 2018 at 8:28:28 AM UTC+2, awanderin wrote:
> 
> F457 (HPLOT0) takes y-coord in A, x-coord in X(lo), Y(hi).
> F53A (HGLIN) takes y-coord in Y, x-coord in A(lo), X(hi).
> 

The routine at $F457 is officially named HPLOT.
The routine at $F53A is officially named HILIN.
Please use the real names, source is from Apple's Applesoft resurrected source code.
av

HPLOT		JSR	HPOSN
HPLOT1		LDA	HCOLOR1	;CALC BIT POSN IN HBAS
		EOR	(HBASL),Y	;HNDX, AND HMASK FROM
		AND	HMASK	;Y-COORD IN A-REG,
		EOR	(HBASL),Y	;X-COORD IN X,Y-REGS.
		STA	(HBASL),Y	;FOR ANY 'L' BITS OF H
		RTS		;SUBSTITUTE CORRESPONDING 

---

		EJECT
		TITLE	'HI-RES GRAPHICS LINE DRAW SUBRS'
HLINRL		PHA
		LDA	#$0	;SET (X0L,X0H) AND
		STA	X0L	;Y0 TO ZERO FOR
		STA	X0H	;REL LINE DRAW
		STA	Y0	;(DX, DY).
		PLA
HILIN		PHA		;ON ENTRY
		SEC		;XL: A-REG
		SBC	X0L	;XH; X-REG
		PHA		;Y: Y-REG

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2.programmer


csiph-web