MaxCoderz

for your 1 bit pleasure!

All times are UTC




Post new topic Reply to topic  [ 73 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: Mon 27 Nov, 2006 12:05 pm 
Offline
Calc King

Joined: Sat 05 Aug, 2006 7:22 am
Posts: 1513
maybe it would be easier to use the S flag instead (sign)
It'd bit 7 of the F register, if you do anything to A that doesnt kill it (or a, or 0, and a, and $FF) then bit 7 of a is written into the S bit, and you could then use a conditional non-relative jump which has somehthing to do with the sign (eg: jp p,label or jp m,label).
Which is 4 T-states faster if you allready were using JP, and 1 or 5 T-states faster if you were using JR previously (depending on whether the condition in JR was true (5 faster) or false (1 faster))
so
Code:
ld a,$FF
or a
jp P/M, label

instead of
Code:
ld a,$FF
bit 7,a
jr z,label / jp z,label


M means bit 7 is set, P means it is reset. And the Z80 doesn't know whether a byte is signed or not, for the S flag it will just assume it is and just write bit 7 to it no matter what.

Edit: I haven't tested it yet, but after OR, P/V is parity, so maybe it could be used instead of Bit 1,x?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon 27 Nov, 2006 12:27 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
Parity does not correspond to any particular bit, but the total number of set bits. %00000010 and %00000001 have the same parity.

If you want to test the least significant bit and don't need to preserve the accumulator, I'd shift or rotate it right and pick up the carry.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon 27 Nov, 2006 12:50 pm 
Offline
Calc King

Joined: Sat 05 Aug, 2006 7:22 am
Posts: 1513
that's a pitty.. I had allways wondered what that P/V really does you know.. And what it is used for.

as for shifting, it also goes for bit 7, but if you want the accumulator back after doing that you end up being just as fast as when using BIT, no gain no loss, but if you don't need to preserve it its 4 T-states faster..

Still the sign trick works :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon 27 Nov, 2006 12:58 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
The most obvious application of parity is in communications and the parity bit. Let's say you are using a "parity even" communications protocol. For every byte you send, you attach a ninth bit. This bit's purpose is to force the number of set bits to be even each time - so if the byte you are sending has an even number of set bits you send a 0, if it has an odd number you send a 1 to make it even.

By even, I mean the number of set bits, not whether the original number was even or not.

At the other end, the device receives the 8 bits then uses the 9th bit to check that the parity is even. If not, something went wrong and it signals an error.

It's obviously not very robust, but it's one level of protection.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon 27 Nov, 2006 4:06 pm 
Offline
Calc King

Joined: Sat 05 Aug, 2006 7:22 am
Posts: 1513
I guess it'd work, but if that 9th bit is corrupted it could reject good data or accept bad data, but chances are bigger that it'll work as planned (although there's a bigger chance that it won't work when there's a lot of corruption overall and that would be when you needed it to work)
so why didn't 'they' make it a seperate bit but rather give 1 bit 2 uses?
doesn't x86 have seperate flags for parity and overflow?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon 27 Nov, 2006 4:19 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
King Harold wrote:
so why didn't 'they' make it a seperate bit but rather give 1 bit 2 uses?
Overflow is meaningless for logical operations, so it represents parity in those instances. I suppose they reasoned that you'd only ever want to use one meaning or the other at a time.
It might also have resulted in less circuitry this way. Who knows?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri 22 Dec, 2006 4:00 pm 
Offline
Calc King

Joined: Sat 05 Aug, 2006 7:22 am
Posts: 1513
I found 2 weird things, they're in the 'intellisense' thingy
When you type something like "bc" hit ctrl-space and then go on typing something that doesnt exist, say, "fdg", then the intelli-window will consist of 1 empty line but continue moving as you type.
The other thing is that you cant click its scrollbar, well you can but it closes directly after, and it doesnt close when you click outside it, a bit contradictionary.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri 22 Dec, 2006 4:14 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
When you click on it, the outside window (Latenite) loses focus, so it closes the window. If you click outside it, but within Latenite, it doesn't lose focus - and so keeps open.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri 22 Dec, 2006 4:17 pm 
Offline
Calc King

Joined: Sat 05 Aug, 2006 7:22 am
Posts: 1513
Not that window - the intelli-window :P


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri 22 Dec, 2006 4:23 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
When you click on it [the autocompletion window], the outside window (Latenite) loses focus, so it [Latenite] closes the [autocompletion] window. If you click outside it [the autocompletion window], but within Latenite, it [the autocompletion window] doesn't lose focus - and so keeps open.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri 22 Dec, 2006 5:28 pm 
Offline
Calc King

Joined: Sat 05 Aug, 2006 7:22 am
Posts: 1513
so why does it(latenite) close it(the other window)?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri 22 Dec, 2006 5:55 pm 
Offline
Maxcoderz Staff
User avatar

Joined: Thu 16 Dec, 2004 10:06 pm
Posts: 3064
Location: Croydon, England
Because I couldn't find a cleaner, reliable solution. The window is always on top (it has to be) and I didn't want it to end up floating on top of other windows if you switched out of it.

This will be fixed with my new custom text editor.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri 22 Dec, 2006 6:20 pm 
Offline
Calc King

Joined: Sat 05 Aug, 2006 7:22 am
Posts: 1513
ok, I see.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri 22 Dec, 2006 9:26 pm 
Offline
New Member
User avatar

Joined: Tue 28 Mar, 2006 10:50 pm
Posts: 73
Location: Wouldn't you like to know?
Another Bug (or maybe not):
When trying to compile an application (using the TI-83+ native script) & with everything else set up, Brass creates a .8xp and a .8xk file. Also, when you try to debug it, it always tries to send the .8xp file instead of the .8xk file (even if i delete it in the compile script)

_________________
Please "encourage" me to work more on Image any way you deem necessary


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon 08 Jan, 2007 1:11 pm 
Offline
Calc King

Joined: Sat 05 Aug, 2006 7:22 am
Posts: 1513
is Brass supposed to echo the .echo directive in pass 1?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 73 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB ® Forum Software © phpBB Group | DVGFX2 by: Matt