Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 362 online users. » 0 Member(s) | 361 Guest(s) Bing
|
Latest Threads |
Includes in ASM
Forum: How-To & Tutorials
Last Post: bracckets
04-04-2024, 12:17 AM
» Replies: 2
» Views: 914
|
Intermittent errors
Forum: Help & Support
Last Post: zarsoft
03-12-2024, 12:39 PM
» Replies: 0
» Views: 465
|
Store array information i...
Forum: Help & Support
Last Post: rbiondi
03-10-2024, 09:42 PM
» Replies: 0
» Views: 616
|
ScrollLeft function scrol...
Forum: Bug Reports
Last Post: rbiondi
03-07-2024, 03:57 PM
» Replies: 2
» Views: 1,199
|
string.bas errors when co...
Forum: Bug Reports
Last Post: rbiondi
03-01-2024, 10:10 AM
» Replies: 2
» Views: 1,060
|
Using Beepola with ZX BAS...
Forum: How-To & Tutorials
Last Post: edtoo
02-29-2024, 09:47 AM
» Replies: 15
» Views: 34,637
|
Johnny Bravo
Forum: Gallery
Last Post: zarsoft
02-11-2024, 11:20 PM
» Replies: 0
» Views: 632
|
Compiling +D G+DOS progra...
Forum: ZX Basic Compiler
Last Post: boriel
01-22-2024, 08:32 AM
» Replies: 4
» Views: 9,251
|
VAL = ? (solved)
Forum: Bug Reports
Last Post: zarsoft
01-03-2024, 11:44 PM
» Replies: 8
» Views: 4,268
|
Wrong math (solved)
Forum: Bug Reports
Last Post: zarsoft
01-03-2024, 11:38 PM
» Replies: 4
» Views: 2,340
|
|
|
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 )
Thanks in advance
|
|
|
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
:-)
|
|
|
Crash when creating UDGs using ASM (possibly not a bug) |
Posted by: worcestersource - 04-05-2021, 10:14 AM - Forum: Help & Support
- 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
|
|
|
ZX0 decompression examples |
Posted by: RandomiserUsr - 03-31-2021, 08:29 AM - Forum: Help & Support
- Replies (3)
|
|
Hi
I have been looking into the ZX0 library
Having created a compress file by running this "zx0 testscreen.scr"
And to us this file this is a test file I created t.bas
#include "zx0.bas"
10 dzx0Standard(@testscreen1, 16384)
20 GOTO 20
testscreen1:
asm
incbin "testscreen.scr.zx0"
end asm
When compiled and run it indeed does display the image on screen.
Some questions:-
Q1.I have been able to convert some artwork (PNG) to .SCR and compress this and then load it on screen BUT (newbie alert) I am running out of memory/program crashes/resets Emulator.
So the question is, can I do this and if so HOW?
(A) load from a M: drive (emulator allowing) and/or
(B) use the 128K Mode and then use the memory banks for images and leave the '48K' for the main game?
Q2. How can I display the SCR file but only print it to the top half of the screen?
1/3 or 2/3rds is okay as well? Is there any code examples (ASM/ZXB)
Q3. Next to the text,
I want to next compress text files that contain a description of a game room.
Looking at an example I tried this (don't laugh!) :-
dzx0Standard(@Text1, 50000)
Text1:
asm
incbin "location1.txt.zx00"
end asm
Text2:
asm
incbin "location2.txt.zx00"
end asm
But this does nothing but load it to the address of 50000 but I want the routine to return a STRING containing the decompressed text?
Quote:UPDATE 4th April 2021: I have worked how to do Q3 in a standalone test.bas file but when I do this in my main program it crashes the app soon after starting it up?
I am using these params --tzx --BASIC --autorun --heap=1000 --optimize 2 --org=25000--debug-memory --debug-array
Lots of questions but hopefully some kind person can help? :-)
thanks
|
|
|
Potential bug in impl of LOAD "..." CODE |
Posted by: georgeo - 03-15-2021, 09:21 PM - Forum: Help & Support
- Replies (8)
|
|
Hi everyone (probably for the attention of Boriel),
My search for the source of instability in my game continues, though I no longer think it is to do with memory management, but a possible bug in the compiler, for the implementation of LOAD "..." CODE. I have noticed that part of my program gets corrupted after I use LOAD "..." CODE to load some UDGs at the top of memory. Digging in to the implementation of the function, I found the following code (sorry, I can't copy and paste code out of the emulator I am using):
https://1drv.ms/u/s!Atca6hVb5b8Tp5JxCEWC...g?e=qGHdEg
At the end of the snippet, a call is made to 0xE6E1, which is a wrapper to the ROM loader routine (in this case, to load a tape header). IX points to the place in memory where the header should be loaded, which -- in this case -- is inside my program code. If I understand correctly what is going on, the snippet starts with a call to MEM_FREE (0xDB56, in this case) which returns a pointer to space in the heap (perhaps where the header can be stored?). However, the IX register is loaded with 2*SP and passed to the tape loader, which I think is a mistake.
Is that a possible bug?
If this is indeed a bug, it fits with my experience. As the size of my program grows, I need to raise the origin address to avoid random crashes. For example, if I have a 30kb program with origin address at 29,000, then the stack will reside somewhere near the start of the heap, so 2*SP will be around 58,000 which will be near the end of my program. However, if I up the origin to 31,000, then 2*SP will be more like 62,000, which will be just past the end of my program. As the size of my program increases, it will eventually grow past 2*SP and then will start to get corrupted and crash randomly, when I load from tape, so I again need to raise the origin address.
It all seems to fit, but maybe I've just convinced myself,
Georgeo.
|
|
|
Memory used ? |
Posted by: RandomiserUsr - 03-13-2021, 02:10 PM - Forum: Help & Support
- Replies (6)
|
|
I wonder if there is a way to print the available memory your compile ZX Basic program has used whilst running it?
One more question on memory usage, which would be better in terms of reducing memory overhead?
1) IF WORD$ = "SAVE WORLD" THEN
or
2) IF WORD = 99 and WORD=98 THEN
thanks in advance
Ken
|
|
|
|