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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 260
» Latest member: Ra001
» Forum threads: 1,073
» Forum posts: 6,437

Full Statistics

Online Users
There are currently 288 online users.
» 0 Member(s) | 284 Guest(s)
Applebot, Baidu, Bing, Google

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

 
  Simple RLE Decompressor
Posted by: LCD - 04-29-2011, 11:47 PM - Forum: Wishlist - Replies (5)

Maybe not a bad idea: a decompress function for RLE encoded binaries (starting with dbyte contains length of compressed and a flag byte). Maybe something like UnRLE(sourceaddress,destinationaddress) returning the length of decompressed bytes or alternative, if the starting bytes are missing: UnRLE(sourceaddress,destinationaddress,length,flagbyte), or even with bank switching management. This will allow to pack more graphical and level-data into our programs. Maybe a job for britlion, to write a fastcall routine? This can be used for all Z80 computers then.

Print this item

  Reading files from disk
Posted by: na_th_an - 04-28-2011, 10:14 AM - Forum: How-To & Tutorials - No Replies

Maybe this is obvious, but let me ask - is there any way to read a BYTES file from disk (I mean, plan +3 disks) from a program compiled in ZX Basic to RAM? I mean, without having to exit the program and go back to plain BASIC to do so. Maybe through ROM calls? Any info on this would be greatly appreciated. I'd like to design some kind of system to make graphic adventures which load stuff from disk.

Print this item

  IF Nesting problem and +D Emulation (*solved*)
Posted by: LCD - 04-19-2011, 11:42 PM - Forum: Bug Reports - Replies (2)

Code:
    while (a band 16)=0
        h=a band 5
        v=a band 10
        if oldh=4 then
            if h=5 then newx=x+1
            elseif h=0 then newx=x-1
            end If
        else if oldh=5 then
            if h=1 then newx=x+1
            elseif h=4 then newx=x-1
            end If
        else if oldh=1 then
            if h=0 then newx=x+1
            elseif h=5 then newx=x-1
            end If
        else if oldh=0 then
            if h=4 then newx=x+1
            elseif h=1 then newx=x-1
            end If
        end If
    wend
The compiler does not like this, and revolts against WEND (should it not work?), but after removing some IFs this works:
Code:
    while (a band 16)=0
        h=a band 5
        v=a band 10
        if oldh=4 then
            if h=5 then newx=x+1
            elseif h=0 then newx=x-1
            end If
        end If
    wend

And I also noticed that one of my games crahes the Spectrum if ZX Spin is started with enabled +D emulation. Boriel, could you check all your compiler tests with ZX Spin and enabled +D? The game preview of QFJ I sent to you some time ago: If I try to play, the gems cannot be swaped. Without +D Emulation anything works okay.

Print this item

  Paper/Border rerun bug
Posted by: Darkstar - 04-12-2011, 10:34 PM - Forum: Bug Reports - Replies (5)

Code:
10 BORDER 4
20 CLS
30 PRINT AT 1,9;INK 3;"Hello World from Assi";
40 END

Hi,

The above code gives green paper with a magenta in ink in the text
message when run the second time from the BASIC loader.

Print this item

  DIM x as String = ?
Posted by: LTee - 04-07-2011, 12:36 PM - Forum: Wishlist - Replies (3)

Hi everyone!

Should this work?

Code:
DIM x as String = "test"

I get the following error when I try to compile:
Code:
Initializer expression is not constant.

Doing this instead is fine:
Code:
DIM x as String: x = "test"

I'm using the latest 1.2.8s696, by the way.

Print this item

  Japan Tsunami Appeal (open ZX firmware)
Posted by: cheveron - 04-04-2011, 08:34 AM - Forum: ZX Basic Compiler - Replies (8)

As some of you will be aware, I've been tinkering with an open source version of SE Basic that could be distributed with hardware without infringing Amstrad's copyright. I'm pleased to say the project is now viable, although it is not yet written.

I've also said I would only release it in exchange for a sack of cash. So let me quantify that: I want 100 people to donate a minimum of £10/€10 each to the Red Cross Japan Tsunami Appeal.

You can sign up here:
http://www.pledgebank.com/opense

If you are based in the UK you can make your donation here:
http://www.redcross.org.uk/Donate-Now/Ma...ami-Appeal

If you are based in Spain you can make your donation here:
http://www.cruzroja.es/portada/

I know it's called pledgebank but I want you to donate now. This is an honour system. If you say you've donated £10/€10 or more I'll assume you have.

Please sign up by July 1st.

Thank you.

-Andrew

P.S. I have donated £10 to get the ball rolling

The total has now reached 17 (13 of which have paid up already). It would be lovely to get to 20 this week. So to encourage you here's a progress report:

* More than 60% of the ROM is now fully functional and unencumbered by Amstrad code.
* The ROM is functionally compatible with SE Basic 2.21 http://www.worldofspectrum.org/infoseeki...id=0025327
* As far as I can tell, everything that ran on the 2.21 ROM still works.
* New RENUM routine. It only accepts the first two parameters, but it isn't broken either.
* New tokenizer. You can now enter INK and it will automatically be translated to PEN.
* 60 abbreviated commands:

Code:
A.TTR           ED.IT           LO.AD           RA.NDOMIZE
BE.EP           ER.ASE          ME.RGE          RE.AD
B.IN            E.XP            M.OVE           REN.UM
BO.RDER         FL.ASH          NE.XT           RES.TORE
BR.IGHT         F.ORMAT         N.OT            RET.URN
CH.R$           GOS.UB          ON.ERR          R.ND
CI.RCLE         G.OTO           OP.EN#          SA.VE
CLE.AR          I.NK            OV.ER           S.CREEN$
CL.OSE#         INKE.Y$         PA.PER          SO.UND
C.ODE           INP.UT          PAL.ETTE        ST.R$
CON.TINUE       INV.ERSE        PAU.SE          T.AB
DA.TA           L.EN            PE.EK           TH.EN
D.EFFN          LI.NE           PL.OT           U.SR
DEL.ETE         LL.IST          P.OINT          V.AL$
DR.AW           LP.RINT         PR.INT          VE.RIFY
* Macros for the following tokens:
Code:
LOAD, CODE, RUN, SIN, COS, TAN, ASN, ACS
* INSERT ([G]) mode now has it's own cursor (an I beam)

Thanks again to everyone who has already contributed.

Print this item

  Memory Management
Posted by: britlion - 03-31-2011, 09: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 - 03-29-2011, 06: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 - 03-29-2011, 01: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 - 03-25-2011, 08: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