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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 273
» Latest member: Zilog_Z80A
» Forum threads: 962
» Forum posts: 6,053

Full Statistics

Online Users
There are currently 40 online users.
» 0 Member(s) | 39 Guest(s)
Google

Latest Threads
REPEAT UNTIL
Forum: Wishlist
Last Post: boriel
Yesterday, 03:28 PM
» Replies: 1
» Views: 12
Print color bug
Forum: Bug Reports
Last Post: Darkstar
10-11-2022, 06:57 PM
» Replies: 18
» Views: 987
SIN and COS functions hav...
Forum: Bug Reports
Last Post: boriel
08-17-2022, 06:49 AM
» Replies: 2
» Views: 511
Binary into asm
Forum: Help & Support
Last Post: Nando
08-11-2022, 12:10 PM
» Replies: 12
» Views: 1,698
Set Number Layout to xx.0...
Forum: Help & Support
Last Post: boriel
08-02-2022, 10:32 PM
» Replies: 1
» Views: 471
Using Beepola with ZX BAS...
Forum: How-To & Tutorials
Last Post: Nando
08-02-2022, 09:25 PM
» Replies: 12
» Views: 21,628
HRPrintFast
Forum: Help & Support
Last Post: boriel
07-25-2022, 12:06 PM
» Replies: 2
» Views: 548
Features breaking compila...
Forum: Core
Last Post: Ljg701
06-19-2022, 08:44 AM
» Replies: 1
» Views: 617
New Text Adventure game u...
Forum: Gallery
Last Post: RandomiserUsr
06-01-2022, 10:21 PM
» Replies: 0
» Views: 460
Testing a variable within...
Forum: Help & Support
Last Post: RandomiserUsr
03-25-2022, 09:59 PM
» Replies: 11
» Views: 4,128

 
  print42() to allow CR chr$(13)
Posted by: RandomiserUsr - 09-03-2021, 11:16 PM - Forum: Wishlist - Replies (2)

Trying to use CHR$(13) in print42() and it is ignored - could this be implemented please?


Thanks

Print this item

  struggle on using/implementing sprite libraries
Posted by: nitrofurano - 08-25-2021, 08:02 PM - Forum: Wishlist - Replies (2)

since a long time i was thinking how simple or possible would be using sprite engines/libraries on zxbasic-compiler (just like those used on z88dk and so on)

so i started to try this (very glitchy and inefficient, as the code shows... Big Grin  )

(wsad or cursors for moving)

Code:
ink 1
border 1:ink 5:bright 1: paper 1: cls

sub putudgsprite(txp1 as uinteger,typ1 as uinteger,tad1 as uinteger)
  poke uinteger $5C7B,tad1+(7-(typ1 mod 8))+(txp1 mod 8)*32
  print at int(typ1/8),int(txp1/8);"\A\C"
  print at 1+int(typ1/8),int(txp1/8);"\B\D"
  end sub

yo=0:xo=0
putudgsprite(xo,yo,@udg01)
x1=128:y1=128

do
  cn1=((255-(in 64510)) band 2)/2 bor ((255-(in 65022)) band 2) bor ((255-(in 65022)) band 1)*4 bor ((255-(in 65022)) band 4)*2 :'- wsad
  cn2=((255-(in 61438)) band 8)/8 bor ((255-(in 61438)) band 16)/8 bor ((255-(in 63486)) band 16)/4 bor ((255-(in 61438)) band 4)*2 :'-7658
  cn0=cn1 bor cn2
  x1=x1-((cn0 band 4)/4)
  x1=x1+((cn0 band 8)/8)
  y1=y1-((cn0 band 1)/1)
  y1=y1+((cn0 band 2)/2)
  over 1 
  putudgsprite(xo,yo,@udg01)
  xo=x1:yo=y1
  putudgsprite(x1,y1,@udg01)
  pause 1
  loop

do:loop

udg01:
asm
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %11111111
defb %11111111
defb %11111111
defb %11111111
defb %11111111
defb %11111111
defb %11111111
defb %11111111

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %01111111
defb %01111111
defb %01111111
defb %01111111
defb %01111111
defb %01111111
defb %01111111
defb %01111111

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %10000000
defb %10000000
defb %10000000
defb %10000000
defb %10000000
defb %10000000
defb %10000000
defb %10000000

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %00111111
defb %00111111
defb %00111111
defb %00111111
defb %00111111
defb %00111111
defb %00111111
defb %00111111

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %11000000
defb %11000000
defb %11000000
defb %11000000
defb %11000000
defb %11000000
defb %11000000
defb %11000000

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %00011111
defb %00011111
defb %00011111
defb %00011111
defb %00011111
defb %00011111
defb %00011111
defb %00011111

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %11100000
defb %11100000
defb %11100000
defb %11100000
defb %11100000
defb %11100000
defb %11100000
defb %11100000

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %00001111
defb %00001111
defb %00001111
defb %00001111
defb %00001111
defb %00001111
defb %00001111
defb %00001111

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %11110000
defb %11110000
defb %11110000
defb %11110000
defb %11110000
defb %11110000
defb %11110000
defb %11110000

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %00000111
defb %00000111
defb %00000111
defb %00000111
defb %00000111
defb %00000111
defb %00000111
defb %00000111

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %11111000
defb %11111000
defb %11111000
defb %11111000
defb %11111000
defb %11111000
defb %11111000
defb %11111000

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %00000011
defb %00000011
defb %00000011
defb %00000011
defb %00000011
defb %00000011
defb %00000011
defb %00000011

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %11111100
defb %11111100
defb %11111100
defb %11111100
defb %11111100
defb %11111100
defb %11111100
defb %11111100

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %00000001
defb %00000001
defb %00000001
defb %00000001
defb %00000001
defb %00000001
defb %00000001
defb %00000001

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

defb %11111110
defb %11111110
defb %11111110
defb %11111110
defb %11111110
defb %11111110
defb %11111110
defb %11111110

defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000
defb %00000000

end asm

so, any idea of using "true" sprites instead of that attempt above? Big Grin

Print this item

  #include MACRO
Posted by: RandomiserUsr - 08-21-2021, 11:48 AM - Forum: Help & Support - Replies (2)

I wonder if you could show some examples of how to use #include MACRO introduced in 1.5.1 as I don't see anything in the wiki

thanks

Print this item

  loading files from +3 dsk
Posted by: nitrofurano - 08-07-2021, 09:39 PM - Forum: Help & Support - Replies (5)

recently i was trying this
https://worldofspectrum.org/forums/discu...n-assembly
is there some more efficient way, that works?
all my examples there were totally made on ZX-Basic Compiler - i'm now stuck in the last one, i only can load one file when it was supposed to load more...

Print this item

  LRIM/RTRIM/TRIM built in functions
Posted by: RandomiserUsr - 08-01-2021, 10:00 AM - Forum: Wishlist - Replies (3)

It would be handy to have a 

LTRIM
RTRIM
TRIM

functions built in to ZXB

I know you could right one but I wonder if there is a faster way to be compiled?

thanks

Print this item

  https://zxbasic.readthedocs.io down?
Posted by: RandomiserUsr - 06-10-2021, 08:04 PM - Forum: Bug Reports - Replies (3)

Hi

Not sure if this is the best place to report this but https://zxbasic.readthedocs.io/ seems to be not working?

Print this item

  GOTO inside a function question?
Posted by: RandomiserUsr - 06-05-2021, 03:14 PM - Forum: Help & Support - Replies (3)

I have two functions that have a return 0 


Code:
FUNCTION processTest(test INTEGER) as INTEGER

......processing stuff

IF X=1 THEN
   poke TestAddress, 1
   GOTO displayMsg
END IF

return 0
END FUNCTION


Does the this cause any memory leaks on the stack?
i.e. by not "returning" something is left on the stack and won't be removed?

I remember something about GOSUB/RETURN having this or am I okay to not RETURN (I am experimenting before you may say it's not "good practice  Smile    )


Thanks in advance

Print this item

  How to carve up ZX Basic into different ORG values
Posted by: RandomiserUsr - 05-15-2021, 09:29 AM - Forum: Help & Support - Replies (10)

This might be asking a tricky thing to do but :-

GOAL :  
To have main.bas compile at 24576 as main.tap
with the ability to at runtime, call on the functions in the below separate files

Functions.bas compile at last address use above +1 as functions-Bank1.bin
** ZX Basic functions only 

textdata.bas compile at  last address use above +1 as textdata-Bank3.bin
** Mixture of ZX BASIC and ASM functions and data references.

picturedata.bas  compile at last address use above +1 as picturedata-Bank6.bin
** Mixture of ZX BASIC and ASM functions and picture references but uses the 168384 address to load into.

This I am hoping would result in files being created that I can then join them together into one TAP file which can then be loaded via an emulator.
The idea is then to be able switch to the relevant bank # to call the relevant function,.

Issue:
When the main,bas is compiled the compiler insists on functions being accessible at runtime, a very logical thing, so the compile fails as the methods are not in main.bas but in the other *.BIN files.

Is there a way around this?
I was using blank labels which helps a bit but I can't really do this with the functions (I have not tried though)

thanks
:-)

Print this item

Bug Game is crashing due to out of memory (48k) (*solved*)
Posted by: RandomiserUsr - 04-25-2021, 01:34 PM - Forum: Bug Reports - Replies (10)

Hi

I am writing a text adventure game (simply for my own fun) rather than use the other systems out there e.g. PAW Infocom, DAAD, TADS,  Aventuron etc... I wanted the challenge in writing one for the ZX Spectrum . :-)

The biggest issue I had was the amount of Text that needed storing.
At first I was going to use some sort of compression but couldn't get it work so I created a tokenised dictionary that turned string arrays (Locations, Objects, Examination results etc...)  to numeric arrays thus the memory was reduced quite a bit. So I thought this would suffice but I soon ran out of memory.

I then attempted to look into the text compression again and then worked out how to do this, but due to the size of the dictionary which was needed still it crashed when there was a decompression of the location file.

I also attempted to use +3 Disk but whilst I was able to a) load a picture b) load a text it crashed subsequent attempts. (Memory clash perhaps)?

So I am here looking for some hints/tips on the options I have.
I do have another plan though where I will try to rewrite it but this time start using text compression from the start.... we will see ... but the main thing for me is

Thanks to Boriel bringing the ZXB to use and Einar Saukas for their both their support :-)

Print this item

  Crash when creating UDGs using ASM (possibly not a bug)
Posted by: worcestersource - 04-05-2021, 10:14 AM - Forum: Bug Reports - Replies (3)

Hi there,

I can't for the life of me work out why I've hit this wall. I'm currently designing the graphics for my game, keeping character maps in one file and test harness in another. It crashes out with "J Invalid I/O device, 30:1".

The code in the character file, called, _graphics.bas is as follows:

Code:
graphicsroom:
ASM
DEFB 000, 254, 254, 254, 254, 254, 254, 254 ; A - roof A
DEFB 000, 000, 254, 254, 254, 254, 254, 254 ; B - roof B
DEFB 254, 254, 000, 069, 170, 069, 170, 000 ; C - top wall
DEFB 085, 168, 085, 000, 170, 069, 170, 000 ; D - bottom wall
DEFB 000, 000, 000, 000, 000, 126, 126, 126 ; E - wall cap
DEFB 060, 060, 060, 060, 060, 060, 060, 000 ; F - vert wall (shared)
DEFB 124, 124, 124, 124, 124, 124, 124, 000 ; G - vert wall (left)
DEFB 062, 062, 062, 062, 062, 062, 062, 000 ; F - vert wall (right)
DEFB 000, 000, 000, 000, 000, 000, 000, 000 ; G -
DEFB 000, 000, 000, 000, 000, 000, 000, 000 ; H -
DEFB 000, 000, 000, 000, 000, 000, 000, 000 ; I -
DEFB 238, 136, 136, 000, 238, 136, 136, 000 ; J - floor A
DEFB 254, 170, 212, 170, 212, 170, 212, 000 ; K - floor B

END ASM

And the scratch file to display them is:

Code:
#include "_graphics.bas"

POKE UINTEGER 23675, @graphicsroom

let toproof$ = chr(144) + chr(145)
let caproof$ = chr(148)
let topwall$ = chr(146) + chr(146)
let botwall$ = chr(147) + chr(147)
let sharewall$ = chr(149)
let lefwall$ = chr(150)
let rigwall$ = chr(151)
let floorA$ = chr(155) + chr(155)
let floorB$ = chr(156) + chr(156)


border 0 : paper 0 : ink 7 : bright 1 : cls

print "  " + caproof$ + toproof$ + toproof$ + toproof$ + caproof$

bright 1 : print "  " + sharewall$; : bright 0 : print topwall$ + topwall$ + topwall$; : bright 1 : print sharewall$

bright 1 : print "  " + lefwall$; : bright 0 : print botwall$ + botwall$ + botwall$; : bright 1 : print rigwall$

bright 1 : ink 7 : print "  " + sharewall$; : bright 0 : ink 1 : print floorA$ + floorA$; : INK 2 : PRINT floorB$; : bright 1 : ink 7 : print sharewall$

bright 1 : ink 7 : print "  " + lefwall$; : bright 0 : ink 1 : print floorA$ + floorA$; : INK 2: PRINT floorB$; : bright 1 : ink 7 : print rigwall$

I have determined that if the last DEFB line in the graphics file is replaced with...

Code:
DEFB 254, 170, 212, 170, 212, 170, 000, 000 ; K - floor B

i.e. substituting the last 212 with 000, there is no crash. If I replace it with 001, all of the graphics corrupt but still run. Other values either work as expected or produce crashes. Adding another line after DEFB, i.e. graphic character L, causes it to crash.

It may be me as I'm still learning zxbc. I'm using the latest downloadable version on Mac. I've tried running this with an older download from earlier this year and it also crashes.

Thanks,


Steve

Print this item