6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Jun 30, 2024 4:18 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Fri Jul 13, 2007 8:13 pm 
Offline
User avatar

Joined: Sun Feb 13, 2005 9:58 am
Posts: 85
hi all, i'm working on the original 6502 figforth and i've some problems on decoding the hidden behavior of the code.

Where can i find a good explanation about flags and branches?
I need a non introductive manual, i think.

thanks!
btw:
i'm also looking for digital copies of 6502 books, because i'd love to buy some used book but i'm quite afraid that custom will loose it (amazon is ok, custom not at all)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jul 13, 2007 9:00 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8460
Location: Southern California
I'm somewhat familiar with Ragsdale's original 6502 figForth, but maybe not as much so as Wally Daniels is. The company I was working for in 1990 bought a commercial metacompiler that had its roots in this one, but was modified including to make it Forth-83, and I've added an awful lot to it and fixed some bugs too. What specifically do you need to know?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jul 14, 2007 9:36 am 
Offline
User avatar

Joined: Sun Feb 13, 2005 9:58 am
Posts: 85
if you look at this piece of code, the (FIND) word, there are a couple of passage that engage me for a bit of time:
Code:
        L249      LDY #0
                  LDA (N),Y
                  EOR (N+2),Y
        ;
        ;
                  AND #$3F
                  BNE L281
        L254      INY
                  LDA (N),Y
                  EOR (N+2),Y
                  ASL A
                  BNE L280
                  BCC L254
                  LDX XSAVE
                  DEX
                  DEX
                  DEX
                  DEX
                  CLC
                  TYA
                  ADC #5
                  ADC N
                  STA 2,X
                  LDY #0
                  TYA
                  ADC N+1
                  STA 3,X
                  STY 1,X
                  LDA (N),Y
                  STA 0,X
                  LDA #1
                  PHA
                  JMP PUSH
        L280      BCS L284
        L281      INY
                  LDA (N),Y
                  BPL L281
        L284      INY
                  LDA (N),Y
                  TAX
                  INY
                  LDA (N),Y
                  STA N+1
                  STX N
                  ORA N
                  BNE L249
                  LDX XSAVE
                  LDA #0
                  PHA
                  JMP PUSH       ; exit false upon reading null link


for example:
Code:
        L281      INY
                  LDA (N),Y
                  BPL L281
 

if i got it right, the BPL instruction that is described as branch if >=0, only look at N flag, so if the LDA (N),Y load <$80 make it jump.

This is my problem: having a good description about flags and branches.

I'm resolving with the help of emulator sources, but maybe exist an easy way! :)

thanks


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jul 14, 2007 5:04 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
http://www.westerndesigncenter.com/wdc/ ... manual.pdf

There are four flags (N, V, C, and Z), and eight branching instructions (each pair checking for truth or falsity) which work with them. How these flags are affected by various instructions is best researched with the above manual.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jul 14, 2007 7:50 pm 
Offline
User avatar

Joined: Sun Feb 13, 2005 9:58 am
Posts: 85
thank you.
i just found this table on a datasheet, maybe it can be useful

BCC Branch C = 0
BCS Branch if C = 1

BEQ Branch if Z = 1
BNE Branch if Z = 0

BPL Branch if N = 0
BMI Branch if N = 1

BVC Branch if V = 0
BVS Branch if V = 1


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


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: