The following warnings occurred:
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval




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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 277
» Latest member: Elemento26
» Forum threads: 1,087
» Forum posts: 6,490

Full Statistics

Online Users
There are currently 105 online users.
» 0 Member(s) | 103 Guest(s)
Applebot, Google

Latest Threads
GuSprites
Forum: Help & Support
Last Post: zedex82
2026-06-19, 06:39 PM
» Replies: 2
» Views: 355
New video Couse / Nuevo c...
Forum: News
Last Post: Duefectu
2026-04-29, 11:02 PM
» Replies: 0
» Views: 2,699
location of heap manageme...
Forum: Help & Support
Last Post: boriel
2026-03-07, 12:13 AM
» Replies: 1
» Views: 745
non-paged supervisor code...
Forum: Help & Support
Last Post: sdo303
2026-02-20, 06:38 PM
» Replies: 8
» Views: 1,848
How to open fuse as an ex...
Forum: How-To & Tutorials
Last Post: Duefectu
2026-02-09, 01:52 PM
» Replies: 3
» Views: 1,743
Old zxbasic game errors
Forum: Help & Support
Last Post: boriel
2025-11-09, 11:52 AM
» Replies: 7
» Views: 2,538
Error: Undefined GLOBAL l...
Forum: Help & Support
Last Post: ardentcrest
2025-11-04, 05:46 PM
» Replies: 3
» Views: 1,396
A Fast(er) Plot Routine f...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-30, 03:16 PM
» Replies: 2
» Views: 1,479
Hall of Fame - Include fo...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-28, 03:48 PM
» Replies: 0
» Views: 819
[SOLVED] Array layout bug...
Forum: Bug Reports
Last Post: Zoran
2025-10-25, 05:48 PM
» Replies: 2
» Views: 1,539

 
  Memory Management
Posted by: britlion - 2011-03-31, 10:48 AM - Forum: Wishlist - Replies (16)

Why not just put your org lower, have your low non speed critical functions, use align to hop to 32768 and stick a defs 6912, 0 to skip your screen buffer zone?

Print this item

  A For-Next bug in 1.2.8-s682
Posted by: Darkstar - 2011-03-29, 07:24 PM - Forum: Bug Reports - Replies (13)

This works:

Code:
For i = AttrAddress to AttrAddress + NumberOfCells - 1 Poke i, AttrColor Next i

This does not:

Code:
For AttrAddress = AttrAddress to AttrAddress + NumberOfCells - 1 Poke AttrAddress, AttrColor Next AttrAddress

This would work in other dialects.

Thanks,

Darkstar

Print this item

  A string bug in 1.2.8-s682 (*solved*)
Posted by: Darkstar - 2011-03-29, 02:17 AM - Forum: Bug Reports - Replies (12)

This does not work:

Code:
#Include "alloc.bas" Declare function String$ (ByVal NumberOfChars as ubyte, ByVal Char as string) as string Declare sub PlayScrBasic (byval SkyColor as ubyte) Ink 7: Paper 0: Flash 0: Bright 1: Over 0: Inverse 0: Border 0: Cls Print "Hello" Const Black as ubyte = 0 Const Blue as ubyte = 1 Const Red as ubyte = 2 Const Magenta as ubyte = 3 Const Green as ubyte = 4 Const Cyan as ubyte = 5 Const Yellow as ubyte = 6 Const White as ubyte = 7 PlayScrBasic (Cyan) End Function String$ (ByVal NumberOfChars as ubyte, ByVal Char as string) as string 'Dim Chars$ as string 'Dim CharPtr as uinteger 'Dim CharsPtr as uinteger 'Dim CharsPtrDeallocate as uinteger 'CharStr 'NumberOfChars = NumberOfChars + 1 'CharsPtr = Allocate(NumberOfChars) 'Dim CharStr as string at @CharP ''CharP = @Char$ 'Return "x" '@Char$ Dim i as ubyte For i = 1 to NumberOfChars Chars$ = Chars$ + Char$ Next i Return Chars$ End Function sub PlayScrBasic (byval SkyColor as ubyte) Dim i as ubyte Dim Space32$ as string Space32$ = String$(32, " ") cls Paper SkyColor If SkyColor <> 0 then fOR i = 0 TO 12 'Print at i, 0; String$(32, " ") Print at i, 0; Space32$ Next i End if Space32$ = "" Paper Green Print at 11, 6; String$(21, " ") FOR i = 8 TO 21 Paper Red Print at i, 5; " " IF i > 11 THEN Print at i,5; String$(22, " ") IF i > 12 AND i < 21 THEN Paper Blue Print at i, 0; String$(5, " ") Print at i, 27; String$(5, " ") End if End if Next i Paper Yellow Print at 21, 0; String$(5, "Û") Print at 21, 27; String$(5, "Û") Paper Black end sub

However if I rem out everything that has Space32$ in it and unrem:
'Print at i, 0; String$(32, " ")'
Then it works fine and heap size does not seem to matter. If I press break
and restart the program then it fails on the second run even though it
works fine the first time if I make the changes noted above.

My bat file to compile this is as follows:
@echo off
if exist GAME.TAP del GAME.TAP
zxb Invasion.b --optimize=0 --output=GAME --tap --BASIC --autorun --org=39680 --array-base=0 --string-base=0 --heap-size=1280 --strict-bool --enable-break
ren GAME GAME.TAP

I do not trust this string handling and it would be nice to have a inbuildt
String$(NumChars, Char$) function.

Thanks,

Darkstar.

Print this item

  Sound effects?
Posted by: LTee - 2011-03-25, 09:48 AM - Forum: How-To & Tutorials - Replies (21)

Can anyone suggest how I could make some half-reasonable beeper sound effects? My initial experiments with BEEP are.... uninspiring. :-D

I was wondering if there was a tool or something that I could use to create some snazzier effects and then somehow integrate those into my ZXBasic setup? Or are there any tricks that people use to get more out of BEEP?

Thanks!

Print this item

  What's wrong with this code?
Posted by: LTee - 2011-03-24, 03:14 PM - Forum: Help & Support - Replies (4)

Okay, this is driving me mad. :-D

I wrote a little routine to 'shuffle' the numbers 1 to 10 into an array, randomly. It's not exactly the best way of doing this but it was supposed to be a quick test. Regardless, it doesn't work. Or rather, it does work - the first time you run it. The second loop of the same code never completes and I can't decide if I found a bug or if I've made a mistake.

Here's the code:

Code:
dim levelMap(10) as UBYTE randomize for x = 1 to 10 cls generateLevelMap() for n = 1 to 10: print levelMap(n): next n pause 0 next x SUB generateLevelMap() dim lm as UBYTE dim lmPos as UBYTE = 0 'clear the map first for lm = 1 to 10 levelMap(n) = 0 next lm 'debug code to print the map, to make sure it's empty print for lm = 1 to 10 print levelMap(n);","; next lm print pause 0 'now fill it randomly print for lm = 1 to 10 do 'get a random position in the array lmPos = int(rnd * 10) + 1 'debug code to print the number we randomly picked print lmPos;","; 'debug code to print the array element if it ISN'T empty if levelMap(lmPos) <> 0 then print ink 2;levelMap(lmPos);","; end if loop until levelMap(lmPos) = 0 'write the current number into the empty random element levelMap(lmPos) = lm 'debug code to show that we handled this number okay print inverse 1;lm next lm pause 0 cls END SUB

I've stuck a load of debug info in there so that you can see what it's doing.

Basically it does this:
1. Clear the array to all zeroes
2. For each number, 1 to 10....
3. Look in a random array position to see if it's zero.
3a. if it isn't, loop around to 3 and try a different one
3b. if it is, write the number into that array position and move on to the next number
4. The result should be the numbers 1 to 10 in a random order in the array, after a variable number of iterations.

First run, no problem.

Second run, although the debug code shows that the array was cleared, the do...loop until loop never completes - by the time it's checking the array within that loop it contains the OLD values again, despite me having zeroed them out just a few seconds earlier.

Am I missing an obvious goof? :-D

Print this item

  Effects of running out of memory
Posted by: LTee - 2011-03-23, 03:03 PM - Forum: Help & Support - Replies (4)

I just added another (hopefully the final!) screen to my game and after compilation it locked up at the menu screen. I suspect that this is because of a lack of memory - my compiled code is now 28932 bytes long, so starting at the default of 32768 that takes me up to 61700. The heap is 4k still, yes? So there's not actually enough space to allocate it, I suspect. Compiling with -O2 took the size down a little and allowed it to run for longer, but I was still getting lockups.

I fixed this by moving the ramtop up to 30000 and now it seems fine. However, is there any way for me to be sure that this is enough space? And is there anything I should watch out for now that I've had to use some contended memory?

Print this item

  Try this for faster multiply?
Posted by: britlion - 2011-03-23, 01:26 AM - Forum: Wishlist - Replies (1)

(where /should/ I be putting this sort of thing?)

Plug this in for mul16.asm

Code:
__MUL16: ; Mutiplies HL with the last value stored into de stack ; Works for both signed and unsigned PROC LOCAL __MUL16LOOP1 LOCAL __MUL16NOADD1 LOCAL __MUL16LOOP2 LOCAL __MUL16NOADD2 ex de, hl pop hl ; Return address ex (sp), hl ; CALLEE caller convention ;;__MUL16_FAST: ; __FASTCALL ENTRY: HL = 1st operand, DE = 2nd Operand ;; ld c, h ;; ld a, l ; C,A => 1st Operand ;; ;; ld hl, 0 ; Accumulator ;; ld b, 16 ;; ;;__MUL16LOOP: ;; sra c ; C,A >> 1 (Arithmetic) ;; rra ;; ;; jr nc, __MUL16NOADD ;; add hl, de ;; ;;__MUL16NOADD: ;; sla e ;; rl d ;; ;; djnz __MUL16LOOP __MUL16_FAST: ld b, 8 ld a, d ld c, e ex de, hl ld hl, 0 __MUL16LOOP1: add hl, hl ; hl << 1 ;sla c rla ; a,c << 1 jr nc, __MUL16NOADD1 add hl, de __MUL16NOADD1: djnz __MUL16LOOP1 ld a,c ld b,8 __MUL16LOOP2: add hl, hl ; hl << 1 rla ; a,c << 1 jr nc, __MUL16NOADD2 add hl, de __MUL16NOADD2: djnz __MUL16LOOP2 ret ; Result in hl (16 lower bits) ENDP

I think it saves on average about 110 T states per multiply, according to my tests. If I counted correctly, it's 10 bytes longer.

Why it's faster:

SLA C is a long slow opcode, compared to just doing the RLA. It's faster to loop twice and roll the A register round the two halves than it is to roll the 16 bit pair.

Also in this case, JR is a better choice than the original JP instruction. Not only is it a byte shorter, but it's faster on average. Probably.

16 JP NC instructions = 160 T states.
JR is 7 if condition fails, 12 if it passes. We can assume that for bits, half will be 1 and half will be 0. So that's an average of (8*12)+(8*7)=156 T states. It's worth saving the byte; which compensates for a double loop being a few extra bytes.

Could also probably shave a little time by using dec b && jp nc _mul16loop since that will jump most times. Probably not worth the bytes. Having two short loops actually speeds up the DJNZ a little too Smile

Print this item

  Run Time error in Footy code.
Posted by: britlion - 2011-03-19, 05:16 PM - Forum: Bug Reports - Replies (5)

1.2.8-s644 Still isn't running correctly.

My half build football manager program gives an out of memory error at some early string handling. Goes right past that if compiled with 1.26.

I tried to attach a file, here, but couldn't.

With 1.2.8-s644 this breaks at line 438, just after the print 2. With 1.26 it works (it breaks later. Haven't investigated that).

Always compiled with --debug-array --debug-memory (not with O3).

Print this item

  fixed is broken (*solved*)
Posted by: britlion - 2011-03-18, 12:37 AM - Forum: Bug Reports - Replies (7)

Code:
CLS #include <input.bas> dim num AS FIXED value$=input(8) cls print value$ num=VAL(value$) print num print num/2 print ln (num)

The last line - ln(num) breaks it. Without that line it compiles, but gives nonsensical answers. I think this is the reason why my fSin benchmark isn't compiling. fSin works with fixed point numbers.

There's an issue with input / strings as well though:

Code:
CLS #include <input.bas> dim num AS FIXED value$=input(8) cls print value$

Compiles, but gave an out of screen error for me.

Print this item

  Loosing "print8.asm" (solved-not a bug)
Posted by: compiuter - 2011-03-14, 07:05 PM - Forum: Help & Support - Replies (2)

In my netbook I overwrite your new version 128r573 with old 126 and run my program. This file seems to be loosed.

Print this item