Do I get a prize for finding the first pathological behavior of IDE 3.0?
In the following stripped down case, no symbols past the use of the 'warning' macro, are seen by the assembler.
As shown, it generates an error 3 pass 2 that Symbol <OnReset> is not defined.
Move the warning{testing} line down below the declaration for IRQ_freq and it will declare IRQ_freq as missing also.
Comment out the warning{testing} line and it compiles happily.
Mike C.
device SX28,oschs3,turbo,stackx,bor42;,watchdog
Irc_cal IRC_SLOW
freq 50_000_000
reset OnReset
LIST Q=37
ID 'SPEM1005'
;
; may be used with {Text to be displayed goes in here} to generate a warning
; from a text string
warning MACRO text
ERROR P1W ?text
ENDM
osc equ 50_000_000 ; assume 50 MHz oscillator
ISR_freq equ 614_400 ; 1.627uS
; protocol related constants
; the initial times 10 and subsequent +5 s are to force rounding to take place at the proper points
; the final divide by 10 removes the initial factor of 10
; proper ISR rate to produce accurate baud rates is 307200, or 614400.
; actual ISR rate with a 50 Mhz crystal is osc/ISR_count
; percent error is (ISR_real-ISR_freq)*100)/ISR_freq
IF (ISR_real) > (ISR_freq)
; Real frequency is too high
ISR_Error equ ((ISR_real-ISR_freq)*1000)/ISR_freq
ELSE
; Real frequency is too low
ISR_Error equ ((ISR_freq-ISR_real)*1000)/ISR_freq
ENDIF
I'll look into what's going on under the hood later, but this will keep you moving. In general, make user errors occur on pass two and life should be good.
Oh, so cool! Thanks guys, you may have supplied the "missing link" -- the piece that allows full-speed development on the SX, so we don't have to re-write all those PBasic commands (like SERIN, SEROUT, HIGH, LOW, RANDOM, RCTIME, SHIFTOUT, etc).
One question though: I see the on-line 'help' (from the application 'help' entry) has been updated, excellent. Can you release a PDF of the on-line help? I always like to have a book I can add notes to, and read in bed in the evenings.
Yes, we can do that (in time). I suspect it will be changing a bit in the early days so would you allow us a month or two before doing this? We plan on providing a printed syntax/reference guide with SX/B commands, but a bit of time on the internet would make it a better document.
I have programmed a simple program for the SX/B to toggle output pins on port B on and off.
When I run the program (Ctrl-R), the program works just fine. However, when
I try to debug it (breaks in·inserted or not),·I cannot seem to get the "Step" "Walk"
"Run" "Poll" or·"Stop" buttons·to be active. Nothing happens on the pin (which when "Run" will blink).
Am I missing something simple, or what?
As for the language, I was sort of hoping for support for 16,24,or32 bit
integer math....··· ...Any plans for that stuff? Also, I see the 1/2 page
boundries still problematic calls (gosubs).
In general, it looks neat...·· ...If were working right (is it?)...
-Dan
P.S. Code:
'
' Device Settings
'
DEVICE········· SX28, OSC32KHZ, TURBO, STACKX, OPTIONX
FREQ··········· 32_768
'
' IO Pins
'
PinsA·········· VAR·RA······················· ' roll button
PinsB·········· VAR···· RB····················· ' LEDs out for die #1
PinsC·········· VAR···· RC····················· ' LEDs out for die #2
'
' Variables
'
Count1·········· VAR···· Byte··················· ' value of die #1
Count2·········· VAR···· Byte··················· ' value of die #2
' ========================================================================= · PROGRAM Start
' =========================================================================
Start: · TRIS_B = %00000000··········
· Count1 = 0
Main: · · Count1 = Count1 + 1 · break · If Count1 > 40 then Main · PinsB = not PinsB · Goto Main
Check the WATCH and BREAK commands in the on-line Help file for debugging. This should clarify the debugging capabilities you are looking for - I don't see these commands in your code.
No further support for the math routines are planned for the moment (like floating point in particular). And yes, page boundaries are not managed by the compiler. Although this is a simplistic approach for us not to add the support, it is keeping this product educational in nature and allowing the SX's architecture to be see-through when using the compiler. The core design is intended to be simple, useful and FREE.
Ken:
Sure, waiting a few months for the initial gotcha's to be revealed and documented before the PDF is issued isn't a problem. It's nice that the on-line help is up-to-date, at least.
Oh, by the way, there's a "@" character in the example SEROUT.sbx file. I assumed that was some Page shifting token -- but I can't find it in the on-line help. I also assume it is some 'well-known' SX assembly thing -- but it would be nice to have it mentioned in the SX/B help.
I thought gotchas are usually hidden. This is what the SX/B compiler does not do:
- no floating point math
- no auto page switching
- no Stamp-style serial debugging (you can hook up hyperterminal)
- no optimization (i.e., using one set of DJNZ timing loops for multiple PAUSE commands)
However, there's enough in this compiler to make the SX a rippin' fast, very useful processor for people without assembly language experience (like me!). I wouldn't have a prayer of writing a SHIFTOUT or SEROUT routine in assembly language with my current skill set.
Setting the frequency to 1Mhz, fixed the debugging problem.
Figures! I chose example code from the SX/B (Digital Dice) to modify
to learn the Basic Lang. Of course I ended up choosing the only example
with a 32Khz clock!·· 1 out of 6, and I had to pick it!
You'd think I'd do better buying lottery tickets than I do!
Note on documentation: As we are currently all-electronic (.CHM file), I will update the help file with some regularity; either correcting errors (I hope there aren't many of those) or adding new project ideas to share with others. As Ken pointed out, once we get passed any initial growing pains we can move to a PDF doc that you can print and make notes on.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams
Applications Engineer, Parallax
Dallas Office
Since SX/B is an inline compiler, you can move code-heavy commands (e.g., SERIN and SEROUT) to subroutines so that they are·coded (to assembly) just once.· SX/B allows the user to pass parameters to subroutines (by value or by address) -- you can even send a variable number of parameters to a subroutine and intelligently deal with that.·
Here's a subroutine that uses SEROUT to transmit a character, once (if no repeats specified) of many times.
' Use: GOSUB TX_Byte, theByte {,repeats}
' -- first parameter is byte to transmit
' -- second (optional) parameter is number of times to send
TX_Byte:
tCount = __PARAMCNT ' parameters
temp1 = __PARAM1 ' byte to send
temp2 = __PARAM2 ' repeats
IF tCount = 0 THEN TX_Exit ' nothing to send
IF tCount > 1 THEN TX_Go ' send with repeats
temp2 = 1 ' set repeats to 1
TX_Go:
SEROUT Sout, Baud, temp1 ' send the character
\ DJNZ temp2, TX_Go
TX_Exit:
RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams
Applications Engineer, Parallax
Dallas Office
It is documented in GOTO, where the @ character may be used to jump across code pages.· I have added the "@" character to the index.· You can download the updated help file from the sticky post at the top of this forum.· Thanks for the catch.
allanlane5 said...
Ken:
Sure, waiting a few months for the initial gotcha's to be revealed and documented before the PDF is issued isn't a problem. It's nice that the on-line help is up-to-date, at least.
Oh, by the way, there's a "@" character in the example SEROUT.sbx file. I assumed that was some Page shifting token -- but I can't find it in the on-line help. I also assume it is some 'well-known' SX assembly thing -- but it would be nice to have it mentioned in the SX/B help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams
Applications Engineer, Parallax
Dallas Office
Post Edited (Jon Williams) : 11/2/2004 5:45:58 PM GMT
Jon: It sounds like SX/B is mostly MACROs... with a nicer interface. E.g. is IF con THEN statement actually a SASM macro like DOIF con? And if that is the case, is there a general way to expand the command set in SX/B by adding new macros?
I suppose you *could* add Macro's -- but the key point of interest to me is that Parallax has implemented those PBasic commands I'm used to. I looked at the SEROUT example -- it illustrates having a PAGE 1 Jump Table, then putting the subroutines on Page 2, and calling them with GOSUB <PageZero> --> GOTO @Page1.
Thus I can leverage my PBasic keyword experience in the SX environment. I don't have to re-invent the SEROUT command -- there it is in the assembly output! They've also done very clever parameter passing support, by having 4 globals _PARAM1.._PARAM4, which 'automatically' get stuffed when you do a GOSUB Parm1, Parm2.
Unfortunately, the hoops you have to jump through to make effective use of the SX architecture (*know* when you are leaving a page, *insure* your subroutines are in the first half of a page, etc) may make the learning curve a little steep for BS2 writers. But at least there *is* a learning curve now, instead of the leap of faith you had to take before.
It is a compiler, abeit very straightforward in that it produces straight, inline code. SX/B actually lives outside the IDE, and is called by the IDE for an SX/B project. SXB.EXE compiles the code and returns any errors to the IDE that may have cropped up.
It's designed to be flexible enough for pros to get good use out of it; straight assembly instructions can be added with "\" and ASM..ENDASM. I'm sure that pros like you will push it in places we didn't expect and we'll grow the product from your input.
BTW ... I didn't write the compiler. If it weren't for SX/B, I wouldn't be doing very much with the SX (I have very little patiece when it comes to code writing).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams
Applications Engineer, Parallax
Dallas Office
I guess this is a Ken / Jon question. Are there any definate plans for the SX/B IDE, i.e. to develop it towards the slickness of the BS2 GUI and Javalin GUI's, along with more of the familiar keywords and commands? Any timescales?
Unfortunately, the hoops you have to jump through to make effective use of the SX architecture (*know* when you are leaving a page, *insure* your subroutines are in the first half of a page, etc) may make the learning curve a little steep for BS2 writers. But at least there *is* a learning curve now, instead of the leap of faith you had to take before.
SASM Macros can remove all of those requirements. I NEVER worry about paging, subroutine placement, or any of that.
We've talked about improving the compiler to remove the paging issue -- but have made no decisions one way or another. And let's not escape the point of SX/B: education. We're not trying to relieve the programmer from understanding SX architecture, we're just trying to give new SX users (like me!) a set of "training wheels" to make the transition easier.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams
Applications Engineer, Parallax
Dallas Office
Post Edited (Jon Williams) : 11/2/2004 10:19:46 PM GMT
Just a minute while I upload a copy of our business plan. . [noparse]:)[/noparse]
Jon and I would normally provide the same answer. Other future improvements have been considered, but we're taking this in a step-by-step fashion.
I need to learn about the James' Newton SASM macro approach to understand how these can be used within SX/B since assembly is supported. The first time I programmed the SX for anything useful was with SX/B, aside from some learning LED blinking in SASM.
I just noticed a what I would consider a funny in the version of SASM used with IDE 3.0. It produces a "Warning 73, Pass 2: Multibyte instruction following skip instruction", but, the multibyte instruction is a page followed by a call, which I believe should be legal.
Not a problem since it is a warning, not an error, but it should ignore repeated page and bank instructions when it considers what follows a skip. At least I'm pretty sure that should be the proper behavior.
Post the source that caused the problem. I think this is something Bean mentioned to me a few days ago in a private email. I want to double check.
This is a new warning I added to SASM to prevent people from going nuts/calling tech support when they have a skip followed by a multi-byte instruction and think that the SX-Key has gone insane or something. Due to the potential for missing something subtle like this, I made it a warning and not an error. My feeling was that if the compiler warned erroneously, people could handle it. If it indicated an error and stopped assembling erroneously, then people wouldn't be nearly as forgiving.
In reference to the post from Paul, the SX will skip both the page instruction and the following call. It will not just skip the page instruction. This has been the subject of some confusion and has been covered in other posts, that this specifically allows skips over 'long' calls and jumps. The skip instruction will skip any number of page or bank instructions, finally skipping the first non page or bank instruction after such a run.
Mike C.
Ref Gunther's post from 9/22/04:
'There is another important thing to know, concerning skip and bank instructions:
stz ; just for demonstation
sz
bank Comm
mov x, Comm_TxData
As the zero flag is set, the sz instruction will execute a skip. Here, the SX automatically skips the bank instruction plus the next mov instruction which makes a lot sense, as just skipping the bank instruction would directly lead into chaos.
In general, when any skip instruction is immediately followed by one or more subsequent bank instructions all these bank instructions are skipped plus the next non-bank instruction. The same is true for page instructions.
Hang on... A skip WILL continue to skip a page or bank instruction AND the next following instruction. As Mike C. says, it should ignore repeated page and bank instructions when it considers what follows a skip.
This is NOT true for other multi-word instructions such as cjne or like that. ( and to be exact, instructions are NOT bytes, they are 12 bit words )
I think what Peter is doing is a "quick fix" to keep from having to make the assembler figure out which of the two cases are in effect. Rather than error in both cases which would be wrong for a page / bank case, he has set it to warn in both cases, which is mearly annoying for the page / bank case. This is much better than doing nothing in both cases which is very wrong for the cje, etc... case.
Now, I am speaking for Peter here, so fogive me if I am wrong. But I KNOW that a skip will keep skipping past a page or bank and also the next following SINGLE instruction.
Ok, Ok I stand corrected, sorry to add to the confusion. In another day or so I will remove the above post. Very little mention of this is made (I have not personally come across this being said·in any of the documents provided by Ubicom, Parallax, or Gunther's book). Though I typically just print out the pdf's to read offline, so if this information is only provided in the html help files it would explain my lack of·knowledge with this particular feature of the SX architecture.·It's good news in that I can go back in my code and replace the conditional jumps with conditional skips when the following instruction is a page or bank saving a byte of storage and a clock cycle for each instance.
Paul ·
Post Edited (Paul Baker) : 11/18/2004 10:41:49 PM GMT
I just realized that switching the error line in the warning macro I posted in this thread from 'ERROR P1W' to 'ERROR P2W' to get around a problem with pass 1 warnings in the latest version of SASM, broke the display of values in hexadecimal. For whatever reason, using the ERROR directive in that way as a pass two warning, it seems to ignore the RADIX directive.
If you look at my post in the "SX/B Application Notes to be improved" thread
, you'll see where I set the RADIX in such a way as to get my display values in Hexadecimal. It worked fine with the ERROR P1W usage, but doesn't with the ERROR P2W usage.
Comments
In the following stripped down case, no symbols past the use of the 'warning' macro, are seen by the assembler.
As shown, it generates an error 3 pass 2 that Symbol <OnReset> is not defined.
Move the warning{testing} line down below the declaration for IRQ_freq and it will declare IRQ_freq as missing also.
Comment out the warning{testing} line and it compiles happily.
Mike C.
device SX28,oschs3,turbo,stackx,bor42;,watchdog
Irc_cal IRC_SLOW
freq 50_000_000
reset OnReset
LIST Q=37
ID 'SPEM1005'
;
; may be used with {Text to be displayed goes in here} to generate a warning
; from a text string
warning MACRO text
ERROR P1W ?text
ENDM
osc equ 50_000_000 ; assume 50 MHz oscillator
ISR_freq equ 614_400 ; 1.627uS
; protocol related constants
; the initial times 10 and subsequent +5 s are to force rounding to take place at the proper points
; the final divide by 10 removes the initial factor of 10
; proper ISR rate to produce accurate baud rates is 307200, or 614400.
; actual ISR rate with a 50 Mhz crystal is osc/ISR_count
; percent error is (ISR_real-ISR_freq)*100)/ISR_freq
ISR_count equ ((osc*10/ISR_freq)+5)/10
ISR_real equ (osc/ISR_count)
warning {testing}
; calculate the error to .1% resolution
IF (ISR_real) > (ISR_freq)
; Real frequency is too high
ISR_Error equ ((ISR_real-ISR_freq)*1000)/ISR_freq
ELSE
; Real frequency is too low
ISR_Error equ ((ISR_freq-ISR_real)*1000)/ISR_freq
ENDIF
OnReset
END
I'm really jazzed to see the ASM command. Does that drop us into SASM or is it a seperate assembler that is part of SX/B?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Change your macro body from this:
ERROR P1W ?text
to this:
ERROR P2W ?text
I'll look into what's going on under the hood later, but this will keep you moving. In general, make user errors occur on pass two and life should be good.
Thanks, PeterM
One question though: I see the on-line 'help' (from the application 'help' entry) has been updated, excellent. Can you release a PDF of the on-line help? I always like to have a book I can add notes to, and read in bed in the evenings.
Yes, we can do that (in time). I suspect it will be changing a bit in the early days so would you allow us a month or two before doing this? We plan on providing a printed syntax/reference guide with SX/B commands, but a bit of time on the internet would make it a better document.
Let me know if our schedule works for you.
Thanks,
Ken Gracey
I have programmed a simple program for the SX/B to toggle output pins on port B on and off.
When I run the program (Ctrl-R), the program works just fine. However, when
I try to debug it (breaks in·inserted or not),·I cannot seem to get the "Step" "Walk"
"Run" "Poll" or·"Stop" buttons·to be active. Nothing happens on the pin (which when "Run" will blink).
Am I missing something simple, or what?
As for the language, I was sort of hoping for support for 16,24,or32 bit
integer math....··· ...Any plans for that stuff? Also, I see the 1/2 page
boundries still problematic calls (gosubs).
In general, it looks neat...·· ...If were working right (is it?)...
-Dan
P.S. Code:
'
' Device Settings
'
DEVICE········· SX28, OSC32KHZ, TURBO, STACKX, OPTIONX
FREQ··········· 32_768
'
' IO Pins
'
PinsA·········· VAR·RA······················· ' roll button
PinsB·········· VAR···· RB····················· ' LEDs out for die #1
PinsC·········· VAR···· RC····················· ' LEDs out for die #2
'
' Variables
'
Count1·········· VAR···· Byte··················· ' value of die #1
Count2·········· VAR···· Byte··················· ' value of die #2
' =========================================================================
· PROGRAM Start
' =========================================================================
Start:
· TRIS_B = %00000000··········
· Count1 = 0
Main:
·
· Count1 = Count1 + 1
· break
· If Count1 > 40 then Main
· PinsB = not PinsB
· Goto Main
Check the WATCH and BREAK commands in the on-line Help file for debugging. This should clarify the debugging capabilities you are looking for - I don't see these commands in your code.
No further support for the math routines are planned for the moment (like floating point in particular). And yes, page boundaries are not managed by the compiler. Although this is a simplistic approach for us not to add the support, it is keeping this product educational in nature and allowing the SX's architecture to be see-through when using the compiler. The core design is intended to be simple, useful and FREE.
Thanks,
Ken Gracey
The SX key cannot debug below about 300 KHz.
Bean.
Sure, waiting a few months for the initial gotcha's to be revealed and documented before the PDF is issued isn't a problem. It's nice that the on-line help is up-to-date, at least.
Oh, by the way, there's a "@" character in the example SEROUT.sbx file. I assumed that was some Page shifting token -- but I can't find it in the on-line help. I also assume it is some 'well-known' SX assembly thing -- but it would be nice to have it mentioned in the SX/B help.
I thought gotchas are usually hidden. This is what the SX/B compiler does not do:
- no floating point math
- no auto page switching
- no Stamp-style serial debugging (you can hook up hyperterminal)
- no optimization (i.e., using one set of DJNZ timing loops for multiple PAUSE commands)
However, there's enough in this compiler to make the SX a rippin' fast, very useful processor for people without assembly language experience (like me!). I wouldn't have a prayer of writing a SHIFTOUT or SEROUT routine in assembly language with my current skill set.
Ken Gracey
Parallax, Inc.
Setting the frequency to 1Mhz, fixed the debugging problem.
Figures! I chose example code from the SX/B (Digital Dice) to modify
to learn the Basic Lang. Of course I ended up choosing the only example
with a 32Khz clock!·· 1 out of 6, and I had to pick it!
You'd think I'd do better buying lottery tickets than I do!
Thanks!
-Dan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Since SX/B is an inline compiler, you can move code-heavy commands (e.g., SERIN and SEROUT) to subroutines so that they are·coded (to assembly) just once.· SX/B allows the user to pass parameters to subroutines (by value or by address) -- you can even send a variable number of parameters to a subroutine and intelligently deal with that.·
Here's a subroutine that uses SEROUT to transmit a character, once (if no repeats specified) of many times.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Post Edited (Jon Williams) : 11/2/2004 5:45:58 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!
Thus I can leverage my PBasic keyword experience in the SX environment. I don't have to re-invent the SEROUT command -- there it is in the assembly output! They've also done very clever parameter passing support, by having 4 globals _PARAM1.._PARAM4, which 'automatically' get stuffed when you do a GOSUB Parm1, Parm2.
Unfortunately, the hoops you have to jump through to make effective use of the SX architecture (*know* when you are leaving a page, *insure* your subroutines are in the first half of a page, etc) may make the learning curve a little steep for BS2 writers. But at least there *is* a learning curve now, instead of the leap of faith you had to take before.
It's designed to be flexible enough for pros to get good use out of it; straight assembly instructions can be added with "\" and ASM..ENDASM. I'm sure that pros like you will push it in places we didn't expect and we'll grow the product from your input.
BTW ... I didn't write the compiler. If it weren't for SX/B, I wouldn't be doing very much with the SX (I have very little patiece when it comes to code writing).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
I guess this is a Ken / Jon question. Are there any definate plans for the SX/B IDE, i.e. to develop it towards the slickness of the BS2 GUI and Javalin GUI's, along with more of the familiar keywords and commands? Any timescales?
Excellent work so far!
James
<http://www.sxlist.com/techref/ubicom/inst/macro.htm>
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Post Edited (Jon Williams) : 11/2/2004 10:19:46 PM GMT
Just a minute while I upload a copy of our business plan. . [noparse]:)[/noparse]
Jon and I would normally provide the same answer. Other future improvements have been considered, but we're taking this in a step-by-step fashion.
I need to learn about the James' Newton SASM macro approach to understand how these can be used within SX/B since assembly is supported. The first time I programmed the SX for anything useful was with SX/B, aside from some learning LED blinking in SASM.
Ken Gracey
Parallax, Inc.
You really can't complain for the price...
Bean.
I just noticed a what I would consider a funny in the version of SASM used with IDE 3.0. It produces a "Warning 73, Pass 2: Multibyte instruction following skip instruction", but, the multibyte instruction is a page followed by a call, which I believe should be legal.
Not a problem since it is a warning, not an error, but it should ignore repeated page and bank instructions when it considers what follows a skip. At least I'm pretty sure that should be the proper behavior.
Mike C.
Post the source that caused the problem. I think this is something Bean mentioned to me a few days ago in a private email. I want to double check.
This is a new warning I added to SASM to prevent people from going nuts/calling tech support when they have a skip followed by a multi-byte instruction and think that the SX-Key has gone insane or something. Due to the potential for missing something subtle like this, I made it a warning and not an error. My feeling was that if the compiler warned erroneously, people could handle it. If it indicated an error and stopped assembling erroneously, then people wouldn't be nearly as forgiving.
Thanks, PeterM
Here is a simple example that assembles with just the warning mentioned.
device SX28,oschs3,turbo,stackx,bor42,protect;,watchdog
Irc_cal IRC_SLOW
freq 50_000_000
reset start
org 0
sz
call @that
start jmp start
org $200
that retp
In reference to the post from Paul, the SX will skip both the page instruction and the following call. It will not just skip the page instruction. This has been the subject of some confusion and has been covered in other posts, that this specifically allows skips over 'long' calls and jumps. The skip instruction will skip any number of page or bank instructions, finally skipping the first non page or bank instruction after such a run.
Mike C.
Ref Gunther's post from 9/22/04:
'There is another important thing to know, concerning skip and bank instructions:
stz ; just for demonstation
sz
bank Comm
mov x, Comm_TxData
As the zero flag is set, the sz instruction will execute a skip. Here, the SX automatically skips the bank instruction plus the next mov instruction which makes a lot sense, as just skipping the bank instruction would directly lead into chaos.
In general, when any skip instruction is immediately followed by one or more subsequent bank instructions all these bank instructions are skipped plus the next non-bank instruction. The same is true for page instructions.
Good luck,
G
This is NOT true for other multi-word instructions such as cjne or like that. ( and to be exact, instructions are NOT bytes, they are 12 bit words )
I think what Peter is doing is a "quick fix" to keep from having to make the assembler figure out which of the two cases are in effect. Rather than error in both cases which would be wrong for a page / bank case, he has set it to warn in both cases, which is mearly annoying for the page / bank case. This is much better than doing nothing in both cases which is very wrong for the cje, etc... case.
Now, I am speaking for Peter here, so fogive me if I am wrong. But I KNOW that a skip will keep skipping past a page or bank and also the next following SINGLE instruction.
For more info see:
http://www.sxlist.com/techref/ubicom/inst/skip.htm
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!
Paul
·
Post Edited (Paul Baker) : 11/18/2004 10:41:49 PM GMT
I just realized that switching the error line in the warning macro I posted in this thread from 'ERROR P1W' to 'ERROR P2W' to get around a problem with pass 1 warnings in the latest version of SASM, broke the display of values in hexadecimal. For whatever reason, using the ERROR directive in that way as a pass two warning, it seems to ignore the RADIX directive.
If you look at my post in the "SX/B Application Notes to be improved" thread
http://forums.parallax.com/forums/default.aspx?f=7&m=53715&g=53964#m53964
, you'll see where I set the RADIX in such a way as to get my display values in Hexadecimal. It worked fine with the ERROR P1W usage, but doesn't with the ERROR P2W usage.
MRC