Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 262
» Latest member: ThomasNiz
» Forum threads: 1,075
» Forum posts: 6,435

Full Statistics

Online Users
There are currently 157 online users.
» 0 Member(s) | 155 Guest(s)
Bing, Google

Latest Threads
Strange Happenings
Forum: Bug Reports
Last Post: zedex82
05-07-2025, 09:05 AM
» Replies: 0
» Views: 30
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 411
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 325
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 1,652
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 599
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 928
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 369
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 1,127
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,917
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 437

 
  Optimizer bug (*solved*)
Posted by: einar - 10-17-2014, 07:50 PM - Forum: Bug Reports - Replies (2)

I found an error in ZX BASIC optimizer. Take a look at this test program:

Code:
GO TO 10

sub FASTCALL test(flag AS UBYTE)
    asm
        cp 1
        jp m,45000
        jp 50000
    end asm
end sub

10 POKE 50000,201: POKE 45000,201
   test(1)

This program produces the expected result if you compile it as follows:

Code:
zxb.exe -t -O2 prog.bas

However it will refuse to compile if you use this instead:

Code:
zxb.exe -t -O3 prog.bas

In this latter case it will produce this error message:

Code:
C:>zxb.exe -t -O3 prog.bas
Traceback (most recent call last):
  File "zxb.py", line 348, in <module>
  File "zxb.py", line 301, in main
  File "optimizer.pyc", line 2287, in optimize
  File "optimizer.pyc", line 1493, in update_goes_and_comes
KeyError: '45000'

EDIT: Tested using latest ZX BASIC version 1.4.0s1898.

Print this item

  [konami-pingpong] first test
Posted by: nitrofurano - 10-16-2014, 06:07 PM - Forum: Other Archs - Replies (1)

first test for the Konami-PingPong arcade machine



Attached Files
.zip   example01c_working.zip (Size: 129 KB / Downloads: 707)
Print this item

  [tehkan-pinballaction] first test
Posted by: nitrofurano - 10-13-2014, 01:21 PM - Forum: Other Archs - Replies (1)

still a lot to improve (sprites, colours, playfields, etc.), but it seems working fine for now - soon i hope posting updates here! Smile



Attached Files
.zip   example01b_startingtowork.zip (Size: 115.97 KB / Downloads: 795)
Print this item

  [taito-minivader] first test
Posted by: nitrofurano - 10-12-2014, 05:45 PM - Forum: Other Archs - Replies (1)

an extremely simple arcade machine, b&w and no sound! Smile - soon i'll code some games for it! Smile
( <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs_-_TehkanPinballAction#Just_Another_Snake_Game">http://www.boriel.com/wiki/en/index.php ... Snake_Game</a><!-- m --> )



Attached Files
.zip   example01a_working.zip (Size: 99.63 KB / Downloads: 704)
Print this item

  [irem-m52] first experience
Posted by: nitrofurano - 10-11-2014, 12:02 PM - Forum: Other Archs - Replies (1)

now i'm starting Irem-M52 hardware (Moon Patrol arcade machine configuration)



Attached Files
.zip   example01e_working.zip (Size: 142.89 KB / Downloads: 771)
Print this item

  [irem-m62] first experience
Posted by: nitrofurano - 10-08-2014, 02:59 PM - Forum: Other Archs - Replies (2)

after successfully doing something for PacMan arcade machine, i started something for irem-m68 (Lode Runner arcade machine configuration for now) - i'm still about reading the joystick, and find out better how sprites works, but it seems interesting doing experiments on this one
( the wiki page related to this thread is at <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs_-_IremM62">http://www.boriel.com/wiki/en/index.php ... _-_IremM62</a><!-- m --> )



Attached Files
.zip   example01e_startingtowork.zip (Size: 134.03 KB / Downloads: 734)
Print this item

  Serious bug indexing arrays (*solved*)
Posted by: einar - 09-29-2014, 03:48 AM - Forum: Bug Reports - Replies (4)

Try running this program:

Code:
DIM score(1 TO 2) AS UBYTE
DIM player AS UBYTE

LET score(1)=0
LET score(2)=0
LET player = 1
LET score(player)=score(player)+1
PRINT "SCORE ";score(1);"x";score(2)

The result will be "SCORE 0x1". This code was supposed to increment the score for player 1, but it will increment it for player 2 instead!

Now try changing this program as follows:

Code:
DIM score(1 TO 2) AS UBYTE
DIM player AS UBYTE

LET score(1)=0
LET score(2)=0
LET player = 1
LET score(1)=score(1)+1
PRINT "SCORE ";score(1);"x";score(2)

Now it will give the correct result "SCORE 1x0".

Tested using latest ZX BASIC release 1.4.0s1893.

Print this item

  Conditional operator?
Posted by: einar - 09-16-2014, 08:57 PM - Forum: Wishlist - Replies (8)

Whenever I'm programming anything in ZX BASIC that involves non-trivial calculations, I really miss the conditional operator from C. So much that I finally decided to post a request here...

Since ZX BASIC already incorporates many useful operators from C like << (binary shift) and & (binary and), could you please consider incorporating C conditional operator also? What I mean is allowing code like this:

Code:
IF (a < 30) THEN
    LET a = a + 2
ELSE
    LET a = a + 1
END IF

To be written like this:

Code:
LET a = a + (a < 30 ? 2 : 1)

Those unfamiliar with C programming may not recognize it at first, but after you get used to it, the latter version is a lot easier to read. It's also easier for a compiler to optimize a single expression using conditional operators, instead of multiple IFs. Also this kind of feature would not introduce any problems or ambiguity in the parser.

For more complex expressions it makes a huge difference. Here's another example:

Code:
IF (row > 0) THEN
    LET pos = pos | (move & UP)
ELSE
    LET pos = pos | TOP
END IF
IF (row < 21) THEN
    LET pos = pos | (move & DOWN)
ELSE
    LET pos = pos | BOTTOM
END IF
IF (col > 0) THEN
    LET pos = pos | (move & LEFT)
ELSE
    LET pos = pos | LEFTMOST
END IF
IF (col < 31) THEN
    LET pos = pos | (move & RIGHT)
ELSE
    LET pos = pos | RIGHTMOST
END IF

Using conditional operators, all this code above would be simplified to this:

Code:
LET pos = pos | (row > 0 ? move & UP : TOP) |
                (row < 21 ? move & DOWN : BOTTOM) |
                (col > 0 ? move & LEFT : LEFTMOST) |
                (col < 31 ? move & RIGHT : RIGHTMOST)

Makes sense?

Print this item

  Happy Brithday
Posted by: ardentcrest - 08-30-2014, 11:02 AM - Forum: Off-Topic - Replies (1)

Happy Birthday Jose. Hope your well.

Have a great day.

Print this item

  [msx][colecovision][sg1000] Libreway and CMJN
Posted by: nitrofurano - 08-21-2014, 01:47 PM - Forum: Other Archs - No Replies

this is 2 months old, sorry for the delay
i actually submitted 2 games to Karoshi’s MSXDev '14 - <!-- m --><a class="postlink" href="http://karoshi.auic.es/index.php/board,26.0.html">http://karoshi.auic.es/index.php/board,26.0.html</a><!-- m -->

CMJN: <!-- m --><a class="postlink" href="http://karoshi.auic.es/index.php/topic,2523.0.html">http://karoshi.auic.es/index.php/topic,2523.0.html</a><!-- m -->
Libreway: <!-- m --><a class="postlink" href="http://karoshi.auic.es/index.php/topic,2527.0.html">http://karoshi.auic.es/index.php/topic,2527.0.html</a><!-- m -->

probably the most amazing part of coding them on on ZX-Basic Compiler is that it was really simple to convert to ColecoVision and SG1000 (MasterSystem retro-compatible) what i made for MSX1! really worth a try! Smile

Print this item