Announcement

Collapse
No announcement yet.

Question About $CPU Metastatement

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Clay Clear
    replied
    Thanks, Stavros!


    ------------------

    Leave a comment:


  • Stavros A Petridis
    replied
    I have tested it.
    If for example you compile with $CPU 386 meta and you run the program
    in a lower CPU the program prints in the screen NO 386 and ends.


    ------------------
    Byte Hunters of the World Unite.

    Leave a comment:


  • Clay Clear
    replied
    Thanks for the info, Tom. I will go ahead and keep my CPU-testing
    code as-is, then (except that I replaced the testing for the values in
    pbvCpu & pbvNpx with ASM code that manually checks for 8086/8088/80286
    CPU's - do not want to have to recode in future compiler versions if those
    internal vars change ).


    ------------------

    Leave a comment:


  • Tom Hanlin
    replied
    I am not at work right now, but I would doubt that the program goes
    so far as to check whether a specific processor is available. If you
    specify a '386, the program probably assumes that you know what you're
    doing-- i.e., that a 386 is available. Plus, there are few enough
    optimizations that would benefit from 386-level coding anyway, so
    running that code on a lesser processor would be "iffy"-- it would
    probably usually work, but it might drop dead at any moment.

    Short version? If you expect customers will use less than a 386, don't
    use 386 optimizations, or put in your own prevention code.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Michael Mattias
    replied
    From PB/DOS 3.5 help file: (Help, Language Reference, $CPU, link to "Generated Code")
    You can mix CPU code. For example, you can generate 8086/8088 code in
    your main program and 80286 code in a unit; when you do this, though,
    the final program won't run on a CPU that's at a lower level than the
    highest-level CPU specified in the entire program. Thus the example
    here would require at least an 80286 machine to run a program made from
    the main program and the unit.

    Leave a comment:


  • Clay Clear
    replied
    Disregard. I will stick to my original plan of using pbvCpu & pbvNpx.
    I did not want to rely on them in case they changed in future compiler
    versions. I do not have to rely on them NOW, but the code is much shorter
    with them.


    ------------------

    Leave a comment:


  • Clay Clear
    started a topic Question About $CPU Metastatement

    Question About $CPU Metastatement

    If I use $CPU 80386 in a program, will the program automatically
    abort with a runtime error if the program is run on a machine less
    than a '386? I am trying to figure out whether I really need the
    code for testing for the 8086/8088/80286/80386 before finally
    testing for the 80486. *IF* the PB EXE's will automatically abort
    on too low of a processor, then my OBJ file should be able to go
    directly to testing for a 80486. Doing so requires using the registers
    in 32-bit mode. I have no end machines to determine the answer
    myself.

    Thank you for any replies.


    ------------------
Working...
X