DEF FN doesn't exist in PBcc/PBwin but you should be able to
name the function
FUNCTION fndecodeit$(st$) AS STRING
without any problems.
Or perhaps just
FUNCTION fndecodeit(st$) AS STRING
which will make the editing a little less for the conversion
------------------
Client Writeup for the CPA
mailto:[email protected][email protected]</A>
[This message has been edited by Fred Buffington (edited June 06, 2005).]
Announcement
Collapse
No announcement yet.
Problems converting source to CCv4
Collapse
X
-
The "far end" parameters for LOCATE have to do with changing the cursor
size, or "caret" as it's called now. I think PB/CC has a CURSOR command
for that, although I'm a bit rusty on the subject. It looks like your
code is aiming to switch from a half-sized caret to a full-sized caret,
or versa vice, when the INSERT key is pressed.
------------------
Tom Hanlin, PowerBASIC Staff
Opinions expressed may not be those of my employer or myself
Leave a comment:
-
Your PB/CC help file (well, my version 3.03 help file anyway) contains Appendix B, Converting From DOS; and the MS-DOS LOCATE function and how it differs from the PB/CC LOCATE is discussed there.
My help file does not have an 'index' entry for "converting" or "MS-*" or "DOS".. you kind of have to hunt .. but using the help file's search facility on LOCATE will get your there. So will the index entry for LOCATE; that gets you to both the PB/CC LOCATE and the 'Converting from DOS' entry.
Leave a comment:
-
Hi
Thanks for the help & advice and yes the code was just a snippet from
from the main program.
I've also encountered another issue ref the locate command, does anyone know an
equivalent in cc4
IF ins=1 THEN LOCATE,,,5,13 ELSE LOCATE,,,13,13
Regards
Adam Wright
T:+44(0)1527 893666
F:+44(0)1527 893601
------------------
TWS
Leave a comment:
-
Well, functions SaveScreen and RestoreScreen are not used in your program, so they can be 'converted' by deleting them. Just as well, too, because those 16-bit BIOS interrupts aren't going to work anyway.
But... assuming you simply forgot to post the code where these functions are desired, take a look at PCOPY, PAGE and maybe even closer to what your MS-DOS code does, the SCREEN and SCREENATTR functions (allows you to save the screen contents to a buffer you define; PCOPY+PAGE allows you to save to/restore from a buffer provided by the compiler).
...on the READ statements, find DATA and READ$ in the help file. There's no RESTORE, but since DATA are LOCAL to a prodedure, you can simply create a separate procedure (SUB or FUNCTION) for each RESTORE point in your original program.
MCM
Leave a comment:
-
Looking further at your code, I see some other things that will need to be addressed.
When you start a PB/DOS program, it begins with the first line of code in your program. Again, because of Windows conventions, PB/CC and PB/Win programs don't start with the first line, they always begin by calling a function called WinMain (or the alias PBMain). You will need to reorganize your code so that your "main" code is located in WinMain, and all of your other SUBs and FUNCTIONs are located outside WinMain.
Also, DEF FN is no longer supported, but you can accomplish exactly the same thing by defining a FUNCTION.
I'd suggest reviewing the PB/CC Help File section titled "Appendix B - Upgrading from DOS" for a good overview of the changes you'll need to make.
-- Eric
[This message has been edited by Eric Pearson (edited June 01, 2005).]
Leave a comment:
-
Converting that code will require a complete rewrite. It isn't so much a "compiler" thing as an "operating system" thing. Unlike DOS, Windows does not allow programs to access the screen buffer directly. In Windows, all of the hardware is "abstracted" and you must use what are called API Functions to perform virtually all hardware-related operations like that.
So there is no way to directly convert things like CALL INTERRUPT, DEF SEG, and REG calls to a Windows language like PBCC or PB/Win.
Take a step back and ask yourself what you are trying to accomplish. For example, it appears that you need to save and restore console screens, and display some screens based on DATA statements. I'd suggest searching the BBS (primarily the Source Code forum) for key words like save, restore, etc. You might also try things like SaveScreen because they are likely to be used.
It is also likely that people will post responses to this thread, pointing out specific sample programs that you can use, but you are far more likely to get a useful response if you post specifically what you need to accomplish rather than "I need code that does what this old DOS code does". In other words, you'll get better answers if you make it easier for people to help you. Lots of people here have never used DEF SEG, etc. so you'll be better off describing your goals, not the old way you used to do it. Depending on what you need to do, you may be able to accomplish it with built-in functions like PCOPY, without resorting to API functions.
I would also like to mention that my company publishes a product called Console Tools, which is a large collection of functions that are designed to make transitioning from DOS to PBCC quite a bit easier. It does, in fact, provide a save-screen and restore-screen system, the ability to simulate screen buffer PEEKs/POKEs, and lots of other things that you might find useful. For more info, click on one of the links below.
-- Eric Pearson, Perfect Sync Software
------------------
Perfect Sync Development Tools
Perfect Sync Web Site
Contact Us: mailto:[email protected][email protected]</A>
[This message has been edited by Eric Pearson (edited June 01, 2005).]
Leave a comment:
-
Problems converting source to CCv4
Hi
I'm trying to convert an old powerbasic program to work on Console
Compiler v4.
I have the following code which I'd like to convert but having
problems with.
Any help would be appreciated
Regards
Adam Wright
T:+44(0)1527 893666
F:+44(0)1527 893601
thepass$=TRIM$(fnDecodeit$(MID$(user$(uc),32,10)))
def fnDecodeIt$(s$)
p$=""
FOR x=1 TO LEN(s$)
a=ASC(MID$(s$,x,1))
p$=p$+CHR$(a-128)
NEXT
fnDecodeIt$=p$
END def
FUNCTION SaveScreen$
reg 1,15*256
CALL interrupt &H10
IF reg(1)-(reg(1)\256)*256=7 THEN address=&HB000 ELSE address=&HB800
def seg=address
SaveScreen$=PEEK$(0,4000)
def seg
END FUNCTION
SUB RestoreScreen(S$)
reg 1,15*256
CALL interrupt &H10
IF reg(1)-(reg(1)\256)*256=7 THEN Address=&HB000 ELSE Address=&HB800
def seg=address
POKE$ 0,s$
def seg
END SUB
restore DataFormat
FOR df=1 TO 28
READ ti(df),tl(df),tmp$:IF cflag=1 THEN tmp$=LEFT$(tc$(df)+SPACE$(tl(df)),tl(df))
tc$(df)=tmp$
IF tc$(df)="" THEN tc$(df)=SPACE$(tl(df))
NEXT
DataFormat:
DATA 1,30,"###########@ " 'numfmt
DATA 1,30,"###########@ " 'display fmt
DATA 2,30,"" 'start
DATA 2,30,"" 'stop
DATA 4,1 ,"B" 'cd
DATA 6,1 ,"Y" 'miss nos.
DATA 2,10,"" 'box qty
DATA 2,10,"" 'sub qty
DATA 2,10,"" 'pall qty
DATA 2,10,"1 " 'Start Box
DATA 2,10,"1 " 'Start Pallet
DATA 3,1 ,"Y" 'Forward No.
DATA 1,30,"" 'Ord Num
DATA 1,30,"" 'Cus Num
DATA 1,30,"" 'Design
DATA 1,30,"" 'Size
DATA 3,1 ,"Y" 'Show Prod date
DATA 3,1 ,"Y" 'Show Logo flag
DATA 5,1 ,"B" 'Special text
DATA 1,70,"" 'info 1
DATA 1,70,"" 'info 2
DATA 1,70,"" 'info 3
DATA 1,22,"" 'address 1
DATA 1,22,"" 'address 2
DATA 1,22,"" 'address 3
DATA 1,22,"" 'address 4
DATA 1,30,"" 'unit of Issue
DATA 1,30,"" 'Pack configuration
------------------
TWSTags: None
Leave a comment: