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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 258
» Latest member: manuelzo75
» Forum threads: 1,074
» Forum posts: 6,434

Full Statistics

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

Latest Threads
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 258
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 275
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 1,561
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 530
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 427
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 299
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 1,052
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,875
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 412
ZXodus][Engine
Forum: ZX Basic Compiler
Last Post: boriel
02-19-2025, 11:43 PM
» Replies: 69
» Views: 213,702

 
  Scroll x 2 pixels, 4 pixels and 8 pixels (char level)
Posted by: Joflof - 03-28-2019, 01:31 AM - Forum: Help & Support - Replies (4)

I am still learning and reading about most stuff, and I run across the scroll.bas library from Boriel that comes with ZXBasic. It was kinda impressive to see that kind of smooth scroll on a spectrum, and even if it is "attribute free", you can get nice results with clever programming of the colors.

As I am trying to scroll a big screen, even if the function is fast, I would like to do it by 2 pixels instead of one. Of course I can execute the function 2 times, but it shows the scroll when it moves every pixel so the result is the same. Is the code modificable in any way so the scroll is done by 2, 4 or even 8 pixels? That last option would be a great way to scroll screens, though I will have to deal with attributes of course.

If it is not possible, is there any "print" alternative fast enough to be able to simulate a scroll by char?

Thanks Smile

Print this item

  Some general questions from a novice ZX programmer
Posted by: Joflof - 03-22-2019, 07:44 AM - Forum: Help & Support - Replies (3)

Hi there!

Long story short, I coded some "games" in the 90s as a child with +3 Basic. Basically shit. I always wanted to code something decent and playable for my beloved speccy and well... better late than never!

I started reading, and reading, and reading a looot of information from a bunch of forums everytime I had a doubt and more or less I solved most things, but for a start, here is something that is bloking me from going on.

I managed to compile, with ZX Basic, a program where I can draw and print stuff into the screen, check keypresses, manage the charset and the udg's, use 4 sprites with fourspriter... and everything in a pretty reasonably-easy way, and also load compressed screens with aplib. The thing is that so far more or less everything is working, but there is a concept I don't understand. This is where I am stuck:

In my test program, I load a new entire charset with a set of tiles to draw a background, from a binary file, using aplib and included through asm code "incbin namefile.bin". I also add another compressed file for the udg graphics, and finally another one which stores the screen data and colors to create using the previously loaded charsets.

Followint instructions from other forums, with asm I prepared a space of memory following this example suggested by the god and lord nathan:

Code:
Sub mapContainer ()
mapdata:
   Asm
      mymap: defs 2400, 0
   End Asm
level1:
   Asm
         binary "level1c.bin"
   End Asm
level2:
   Asm
         binary "level2c.bin"
   End Asm
level3:
   Asm
         binary "level3c.bin"
   End Asm
End Sub

Which I changed to this:

Code:
Sub loadroom()
roombg:
   Asm
      roombg: defs 768, 0
   End Asm
roomtiles:
   Asm
      roomtiles: defs 768, 0
   End Asm
roomudg:
   Asm
      roombg: defs 168, 0
   End Asm
room01bg:
   Asm
         binary "room01.bgc"
   End Asm
room01tiles:
   Asm
         binary "room01.tic"
   End Asm
room01udg:
   Asm
         binary "room01.udc"
   End Asm
End Sub

That should load the 3 compressed files, but I am not sure where. Are those memory adresses? Arrays? That is confusing me. Applying the udg to the system was easy and worked, I just poked it to the specific adress. With the tiles though I had a problem, cause I had to add on the poke (0) + 256 (not sure why) and when I try that, it complains that @roomtiles is not an array. Finally, I solved it deleting the definition for @roomtiles in the asm part and defining it as an array with DIM roomtiles (787) etc.

Then the poking of the charset worked, but I had to change the (0) + 256 to (0) + 259 to get it right. Does it have something to do with being an array and having extra header info? I am really confused with arrays / memory adresses.

And finally, with all those loaded, I tried to load roombg, with my tile and attributes information, and to read it byte per byte... but I can't. Defining it in the asm code doesnt allow me to use it like roombg(15) to read the 15th byte, and defining it as an array makes it crash when I try to read it, giving incoherent values.

Which is the correct way to read byte per byte information of that memory adress? I tried peek, but dont know how to do it well, I tried value = peek 15 + @roombg, for example, but I also failed.

Everything is working great, in general, but this problem got me stuck.

Also, I would like to know where in the memory I am loading stuff and how much memory I have free... cause in the future, for sure, I will need to use banking switching if I want to load like 50 rooms :lol:

Well, thanks for everything! I will wait to see if I can understand exactly how to use this Smile

Print this item

  v1.8.9 : IF / ULONG > ULONG() array comparison bug (*solved*)
Posted by: JMcGibbitts - 02-05-2019, 08:03 PM - Forum: Bug Reports - Replies (3)

Hello Boriel, my first post here, so I'm sorry it's to report a bug.

I found a problem when comparing a ULONG variable with any entry in an array of ULONGs.
Saving the array entry to a temporary ULONG variable to compare with is a workaround.

The problem seems to happen with v1.87, so is perhaps an older bug.

A working code comparison sample is pasted below. 
The code purpose is to find where to insert a page number in an array of page numbers, where the pages are stored in correct sequence but are not simply incrementing numbers.
Switch between SUBs v1() / v2() to compare the output.

Thanks

Code:
' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Declarations
DIM ulStoryPage, ulTemp AS ulong   
DIM ulLongStory (5) AS ulong   => { 900000, 700000, 500000, 300000, 100000, 0 }
DIM uiCounter, uiPosition, uiYPos AS ubyte
' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Inits.
LET uiCounter = 5 : LET uiPosition = 5 : LET uiYPos = 10
LET ulStoryPage = 500001
' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Cosmetics
BORDER 0
INK 1
PAPER 0
BRIGHT 1
CLS
PRINT AT 0,0; "Story Page = "; ulStoryPage
' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Toggle this between v1() and V2() to compare.
v1()   ' v1() fails the comparison against the array.
'v2()   ' v2() uses a temp variable to store / compare array value.

DO
LOOP

' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SUB v1()    ' Find the page position in the story - V1...  This fails the comparison, so the page is never inserted.
    DO
        LET uiCounter = uiCounter - 1
        IF ulStoryPage > ulLongStory(uiCounter)     '  Trying to compare the ULONG against the ULONG in the array.
            LET uiPosition = uiCounter
            PRINT AT uiYPos,0; INK 4; "Slot=";uiCounter; " Page="; ulLongStory(uiCounter); " insert @"; uiPosition
        ELSE
            PRINT AT uiYPos,0; INK 2; "Slot=";uiCounter; " Page="; ulLongStory(uiCounter)
        ENDIF
        LET uiYPos = uiYPos + 1
    LOOP UNTIL uiCounter = 0
END SUB


' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SUB v2()    ' Find the page position in the story V2...  Assigns the array value to a temp value to compare.  (This works)
    DO
        LET uiCounter = uiCounter - 1
        LET ulTemp = ulLongStory(uiCounter)         '     Using a temporary ULONG to compare with instead of the array.
        IF ulStoryPage > ulTemp
            LET uiPosition = uiCounter
            PRINT AT uiYPos,0; INK 4; "Slot=";uiCounter; " Page="; ulLongStory(uiCounter); " insert @"; uiPosition
        ELSE
            PRINT AT uiYPos,0; INK 2; "Slot=";uiCounter; " Page="; ulLongStory(uiCounter)
        ENDIF
        LET uiYPos = uiYPos + 1
    LOOP UNTIL uiCounter = 0
END SUB

Print this item

  O-EYES
Posted by: oblo - 12-11-2018, 02:23 PM - Forum: Gallery - No Replies

Hi all

I've just finished my last game: O-EYES, a ZX Spectrum port of the arcade game EYES. Don't know why but I like it to play some quick rounds, so I decided to make this version. Oh, and as you can see, I've used the ol' and cheap trick to print in the inlay an arcade screenshot, instead of an actual Spectrum screenshot :wink:

[Image: O-Eyes-v1-0-1.jpg] [Image: O-Eyes-v1-0-2.jpg]

You can download O-EYES from this link and it contains:

- TZX with the playable version 1.0 of the game
- Source code (Boriel's ZX Basic .bor files)
- Cassette inlay
- Readme.txt

As always, all comments are welcome and hope you enjoy it Smile



Attached Files
.7z   O-Eyes.7z (Size: 156.28 KB / Downloads: 744)
Print this item

  List of ZX Basic supported engines
Posted by: oblo - 12-10-2018, 07:56 AM - Forum: ZX Basic Compiler - Replies (6)

Hi all

I'm gathering information about engines that support ZX Basic. So far, I found those:

- FASE: here and here
- Nirvana: here
- Nirvana+: here and here
- Bifrost* Engine: here
- Bifrost*2 Engine: here
- ZXodus][Engine: here and here (but engine download link is not found)

Do you have more information about them or more engines to add to the list? It would be nice to have a repository with all of them.

Cheers.

Print this item

  128k memory: saving and restoring data
Posted by: oblo - 12-04-2018, 07:51 AM - Forum: Help & Support - Replies (3)

Hi all

I'm trying to program a game for the +2A/+2B/+3, so I can use more RAM. Thanks to a lot of info I found on the forums, I manage to access all memory banks with this:

Code:
asm
  di
end asm

poke 23388,16 + bank_number : OUT 32765,16 + bank_number

asm
  ei
end asm

Question is, I don't know how to efectively save and retrieve data in the 45152-65535 address range. I prepared some programs just with data arrays, saved with something like SAVE "databank6" CODE 49151,16384 and then load it from the main program but no data is restored, so I assume I'm doing it wrong and saving no data at all.

How can it be achieved? Thanks in advance an regards.

Print this item

  O-Puzz Attack!!
Posted by: oblo - 12-01-2018, 08:56 PM - Forum: Gallery - No Replies

Hi all

With some help from boriel & britlion (thank you both!) I've just finished another game: O-Puzz Attack!!, a game inspired in the Panel de Pon/Tetris Attack/Puzzle League series by Nintendo. Two game modes, nine levels of difficulty and more awaits!
[Image: o-puzzattack-v1-0.jpg]

Attached to this post is a .7zip file with the playable .TAP, the cassette inlay, the source code and a readme.txt . I've enjoyed so much making this game, but I think this can be my last "one-screen-skill-game" and start with other kinds of games, like adventures, platforms or even simulation Smile

Hope you like it. Cheers!



Attached Files
.7z   O-PuzzAttack.7z (Size: 184.5 KB / Downloads: 739)
Print this item

  Lock CAPS poking memory
Posted by: oblo - 11-29-2018, 07:54 AM - Forum: Help & Support - Replies (5)

Hi all

AFAIK, poking 23617 address with 128 locks the CAPS in BASIC. I'm trying this inside the compiler but only works with a bunch of keys, while using others (like W, Z or X) shows garbage instead of the CAPS.
Is there any other way to force CAPS inside ZX Basic? I already tried all possible values 0 to 255) with no luck.

Thanks and regards

Print this item

  Reading keyboard/joystick input
Posted by: oblo - 11-25-2018, 08:40 AM - Forum: Help & Support - Replies (3)

Hi all

In order to control a 8x16 sprite, I'm using the MultiKeys function to read keyboard/Sinclair II input in a form of a subroutine inside the program. Problem is, the control experience is abrupt at its best, because keyboard is only read each time the subroutine is called. I'm trying to adjust it calling the subroutine in several places of the program, but it's not enough good to have a steady sprite control performance.
Any advice regards keyboard/sprite control, or it's just about to detect good places in the program to call the keyboard subroutine?

Thanks and regards

Print this item

  Escape (RTM version released)
Posted by: oblo - 11-15-2018, 12:44 PM - Forum: Gallery - Replies (1)

Hi all

Although is not 100% finished, I have decided to release a beta of the game I'm now working on: a clone of the 80s VTech handheld named Escape. These images compare the original with this version:
[Image: escape01.jpg] [Image: escape02.jpg]

Guards' sprites are not finished and they are giving me hard time (I'm using ZX Paintbrush to convert JPGs to UDGs, but they are so tiny and masked that there is almost no detail at all), there are some random crashes and some features are not implemented (all included in the README.txt file) but besides that, I'm trying to simulated all handheld features (clock, chrono, cycles, etc...) For a full comparative, you can download the Escape simulator for Windows from Madrigal's site

As always, attached the .tap with the source code and a readme.txt with instructions and additional info. Any comments and help (especially with the sprites thing) are welcome Smile

Cheers



Attached Files
.7z   escape_v010.7z (Size: 24.46 KB / Downloads: 710)
Print this item