Jump to content

Recommended Posts

Just stumbled into a bug with MADS' built-in ADW macro when used with (ZP),Y:

LDY #$04
ADW (OBSPEC),Y PTR2 PTR4

A334: A0 04             LDY #$04
A336: 18                CLC
A337: B1 C1     LIMITCLIP.OFFSCREEN LDA (OBSPEC),Y
A339: 65 E2     [email protected] ADC PTR2
A33B: 85 E6             STA PTR4
A33D: C8                INY
A33E: B1 C1             LDA (OBSPEC),Y
A340: 65 E3             ADC $E3
A342: 85 E6             STA PTR4 ; <<<<<<< should be $E7, not $E6


LDY #$04
MWA (OBSPEC),Y PTR4

A334: A0 04             LDY #$04
A336: B1 C1             LDA (OBSPEC),Y
A338: 85 E6             STA PTR4
A33A: C8                INY
A33B: B1 C1             LDA (OBSPEC),Y
A33D: 85 E7             STA $E7 ; <<<<<<<<<<<<< $E7 = correct

Using the latest build here, and I'm sure ADW used to store the MSB correctly in older versions. Haven't looked to see if the bug exists in SBW as well.

Edited by flashjazzcat

Share this post


Link to post
Share on other sites

adw (zp),y bug fix

 

Great - many thanks. This fixes the issue described but (ZP),Y support is still very inconsistent in the ADW and SBW macros:

ptr1	equ $80
ptr2	equ $82
ptr3	equ $84

	org $2000
	
Start
	ldy #0
	adw Num1 #2
	ldy #0
	adw (ptr1),y #2 		; error - extra characters on line
	ldy #0
	adw (ptr1),y #2 Num1
	ldy #0
	adw (ptr1),y Num1 Num2
	ldy #0
	adw (ptr1),y #2 (ptr2),y	; error - extra characters on line
	ldy #0
	adw Num1 Num2 Num3
	ldy #0
	adw (ptr1),y (ptr2),y (ptr3),y	; error - extra characters on line
	rts
	
	
Num1	.word 0
Num2	.word 0
Num3	.word 0

	end start
	

The exact same errors appear for SBW. These seem like potentially common scenarios and they work with absolute references.

Edited by flashjazzcat

Share this post


Link to post
Share on other sites

correct version (',y' -> ',Y')

 

Wow - that was fast. :) Thanks. I'll test this thoroughly over the coming days. The example appears to compile perfectly.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...