English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 10 February 2021, 16:18   #1
DanielAllsopp
Registered User
 
DanielAllsopp's Avatar
 
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
and I load it into memory like this

Code:
lea structTest,a1
What I basically want to do is set bit 0 of testWord, but I'm getting strange results, i.e. the value is ending up as $100 instead of $1 if I access the location directly:

Code:
clr.w testWord(a1)
bset #$0,testWord(a1)    ;testWord now equals $100
but if I do it via a data register:

Code:
clr.w d1
move.w d1, testWord(a1)
bset #$0,d1
move.w d1, testWord(a1)    ;testWord now equals $1
I'm losing the plot here trying to figure out why that is? Can anyone enlighten me?
DanielAllsopp is offline  
Old 10 February 2021, 16:25   #2
roondar
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
roondar is offline  
Old 10 February 2021, 16:29   #3
thomas
Registered User
 
thomas's Avatar
 
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)
thomas is offline  
Old 10 February 2021, 16:32   #4
DanielAllsopp
Registered User
 
DanielAllsopp's Avatar
 
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
DanielAllsopp is offline  
Old 10 February 2021, 16:37   #5
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,483
Quote:
Originally Posted by thomas View Post
Obviously bset in memory is acting on bytes, not words. I don't know if seomthing like bset.w exists,
Sure it exist: or.w
ross is offline  
Old 10 February 2021, 17:32   #6
Antiriad_UK
OCS forever!
 
Antiriad_UK's Avatar
 
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
Antiriad_UK is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:52.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07804 seconds with 15 queries