10 February 2021, 16:18 | #1 |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
Strange issue with BSET
So I have a struct setup like so:
Code:
rsset 0 testWord rs.w 1 sizeOf rs.l 0 structTest: ds.b sizeOf Code:
lea structTest,a1 Code:
clr.w testWord(a1) bset #$0,testWord(a1) ;testWord now equals $100 Code:
clr.w d1 move.w d1, testWord(a1) bset #$0,d1 move.w d1, testWord(a1) ;testWord now equals $1 |
10 February 2021, 16:25 | #2 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,430
|
BSET/BCLR/BCHG/BTST only work on a single byte when used on a value in memory
|
10 February 2021, 16:29 | #3 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,021
|
Obviously bset in memory is acting on bytes, not words. I don't know if seomthing like bset.w exists, probably not. In this case you have to take into account that it acts on bytes and skip the high-order byte:
bset #$0,testWord+1(a1) |
10 February 2021, 16:32 | #4 |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
Ah, well that makes sense now then. As always, thanks for the help guys, I'll build my low level knowledge up slowly but surely
|
10 February 2021, 16:37 | #5 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,483
|
|
10 February 2021, 17:32 | #6 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
And the classic "btst #14,dmaconr" which only works by "accident" because it does modulo 8 hiding the mistake from everyone which I saw in loads of old code
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Strange keyboard issue | malko | support.WinUAE | 3 | 01 October 2019 19:15 |
Strange Keyboard Issue | TheTonyOne | support.FS-UAE | 4 | 07 January 2015 01:48 |
Strange Issue | mai | support.WinUAE | 6 | 06 January 2010 12:54 |
Strange Graphics issue | asm1 | support.Hardware | 5 | 04 March 2009 18:12 |
Strange 3.5 floppy issue ... | falconsfan | support.Hardware | 1 | 28 April 2007 09:13 |
|
|