| Welcome, Guest |
You have to register before you can post on our site.
|
| Online Users |
There are currently 178 online users. » 0 Member(s) | 175 Guest(s) Baidu, Bing, Google
|
| Latest Threads |
Old zxbasic game errors
Forum: Help & Support
Last Post: boriel
2025-11-09, 11:52 AM
» Replies: 7
» Views: 144
|
Error: Undefined GLOBAL l...
Forum: Help & Support
Last Post: ardentcrest
2025-11-04, 05:46 PM
» Replies: 3
» Views: 110
|
A Fast(er) Plot Routine f...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-30, 03:16 PM
» Replies: 2
» Views: 167
|
Hall of Fame - Include fo...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-28, 03:48 PM
» Replies: 0
» Views: 93
|
[SOLVED] Array layout bug...
Forum: Bug Reports
Last Post: Zoran
2025-10-25, 05:48 PM
» Replies: 2
» Views: 219
|
3DOS Commands?
Forum: Help & Support
Last Post: boriel
2025-10-06, 02:54 PM
» Replies: 3
» Views: 383
|
How to open fuse as an ex...
Forum: How-To & Tutorials
Last Post: zedex82
2025-10-05, 07:36 PM
» Replies: 2
» Views: 281
|
CLS/Fade out ASM Sub-rout...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-05, 03:39 PM
» Replies: 2
» Views: 275
|
ZX Basic Studio Bugs
Forum: Bug Reports
Last Post: Duefectu
2025-09-23, 04:07 PM
» Replies: 5
» Views: 1,084
|
Printing with FZX
Forum: Help & Support
Last Post: boriel
2025-07-17, 10:08 PM
» Replies: 1
» Views: 1,967
|
|
|
| Weird bug involving OVER 1 (*solved*) |
|
Posted by: einar - 2014-11-02, 02:47 PM - Forum: Bug Reports
- Replies (5)
|
 |
ZX BASIC has some weird bug involving OVER 1. Unfortunately I was unable to isolate this problem to produce a short example, so I will have to provide my full source code...
The ZEN source code is available here:
<!-- m --><a class="postlink" href="https://www.dropbox.com/sh/bgtoq6tdwropzzr/AAAknv_0PeJGhn36dLJZfGASa">https://www.dropbox.com/sh/bgtoq6tdwrop ... 6dLJZfGASa</a><!-- m -->
Right at the beginning, you will notice it sets ATTR_P to INK 0:
Code: INK 0: PAPER 0: FLASH 0: BRIGHT 0: CLS
Afterwards it never sets a different INK, except for a single PRINT statement at the end of this sub-routine:
Code: sub drawTile(row AS UBYTE, col AS UBYTE, color AS UBYTE)
DIM tile AS UBYTE
DIM ch AS UBYTE
LET tile = PEEK BOARD(row, col)
IF tile = 0 THEN
IF row=0 AND col=width THEN
OVER 1
ELSEIF color=2 THEN
LET tile = 16
END IF
END IF
LET ch = (tile<<2)+32
POKE UINTEGER 23606, @zenchr-256
INK color
PRINT AT row0+(row<<1), col0+(col<<1); CHR$(ch);CHR$(ch+1);AT row0+(row<<1)+1, col0+(col<<1);CHR$(ch+2);CHR$(ch+3);:
INK 0
OVER 0
end sub
An obvious optimization would be setting a temporary INK inside this PRINT statement, instead of using a separate INK statement before, and another INK 0 immediately afterwards. Right? Unfortunately that won't work! Try it yourself. Replace these lines:
Code: INK color
PRINT AT row0+(row<<1), col0+(col<<1); CHR$(ch);CHR$(ch+1);AT row0+(row<<1)+1, col0+(col<<1);CHR$(ch+2);CHR$(ch+3);:
INK 0
OVER 0
with this:
Code: PRINT INK color; AT row0+(row<<1), col0+(col<<1); CHR$(ch);CHR$(ch+1);AT row0+(row<<1)+1, col0+(col<<1);CHR$(ch+2);CHR$(ch+3);:
OVER 0
If you recompile ZEN with this change, parts of the board will be disappearing on screen. If you analyze the screen when it happens, you will notice the INK colors are correct on screen, but the pixels are missing. Therefore this PRINT statement is apparently using OVER 1 even in cases where OVER 1 wasn't set.
This bug is not relevant for me anymore since I have already released this game anyway, but it demonstrates ZX BASIC has some bug involving OVER 1 that may affect other developers in the future.
|
|
|
| Routine mapping? |
|
Posted by: einar - 2014-11-02, 06:51 AM - Forum: Wishlist
- Replies (2)
|
 |
Right now, ZX BASIC already supports variable mapping. If I already have a variable defined at a certain memory address, I can reference it as follows:
Code: DIM x AS UBYTE AT 64000
It would be nice if ZX BASIC could also support routine mapping. If I already have an assembly routine implemented at a certain memory address, I would like to reference it as follows:
Code: DECLARE sub FASTCALL doSomething(src as UINTEGER, dst as UINTEGER) AT 64000
In the meantime, I'm having to use this workaround:
Code: sub FASTCALL doSomething(src as UINTEGER, dst as UINTEGER)
asm
jp 64000
end asm
end sub
EDIT: Of course routine mapping should also work with both sub-routines and functions, either FASTCALL or not, exactly like any other ZX BASIC routine implemented in asm directly inside the routine body.
|
|
|
| [poby-news] first test |
|
Posted by: nitrofurano - 2014-10-23, 01:19 PM - Forum: Other Archs
- No Replies
|
 |
first test for Poby-News arcade machine:
<!-- m --><a class="postlink" href="https://dl.dropboxusercontent.com/u/795795/retrocoding/arcade/PobyNews/example01c_works.zip">https://dl.dropboxusercontent.com/u/795 ... _works.zip</a><!-- m -->
|
|
|
|