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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 259
» Latest member: DonaldDeade
» Forum threads: 1,074
» Forum posts: 6,434

Full Statistics

Online Users
There are currently 147 online users.
» 0 Member(s) | 145 Guest(s)
Bing, Google

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

 
  [trs80model1] first test
Posted by: nitrofurano - 02-19-2017, 10:36 AM - Forum: Other Archs - No Replies

first test for TRS-80 Model 1 (the very first computer i started programming, back in my childhood)
( the wiki page related to this thread is at - <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs_-_TRS-80">http://www.boriel.com/wiki/en/index.php ... s_-_TRS-80</a><!-- m --> )



Attached Files
.zip   example01e_startingtowork.zip (Size: 19.34 KB / Downloads: 811)
Print this item

  Using ZXbasic to add page banked IM music
Posted by: emook - 02-18-2017, 11:43 AM - Forum: Gallery - Replies (1)

Hi,

As a small challange I wanted to see if I could add music to games written with ADG by Jonathan Caudwell. ADG games usually take around 30k of memory starting from around 32000 so this leaves no room for music and playback.

My idea was that I would swap in bank 4 (@49152) and set up my music and then an IM routine at 25500. The IM routine swaps to bank 4, plays a frame of music and swaps the bank back to 0 and allows the game to continue. Here's the code I came up with (the music routine and data have been compressed with zx7 to take up less space)

An working example can be seen here with : http://torinak.com/qaop#128#l=http://zxbasic.uk/uploads/monty_tls.z80


Code:
#include <memcopy.bas>
' REM IM music for ADG v1
' monty

border 0
paper 0
ink 6
cls

ASM
    di                    ; disable intsd
    LD A,(23388)
    AND 248  
    OR 4 ; select bank 4
    LD BC,32765
    LD (23388),A
    OUT (C),A
    EI
END ASM

' the playsoutine expects the music to be at 51310, so lets copy the music there
zx7Unpack(@music, 51310)
' The play routine expects to be at 49152, so lets copy it there
zx7Unpack(@ayplay, 49152)
' This is routine that will be called every frame, lets copy it to its correct location
memcopy(@Ints, $6060, 60)
' we need to init our play routine, so call it
randomize usr 49152
randomize USR @IMStart
' Start ADG game

'randomize usr 32000

END

ayplay:
asm
    incbin "vt49152.bin.zx7"
END asm

music:
asm
    incbin "intro.pt3.zx7"
END asm
musicend:


Ints:
    asm
        di                  ; disable interrupts
        push af             ; save all std regs
        push bc
        push de
        push hl
        push ix            
        push iy
        ex af, af'          ; and shadow af
        push af
        ; swap to bank 4
        LD A,(23388)  ; load a with previos port value
        AND 248  
        OR 4 ; bank 4
        LD BC,32765
        LD (23388),A
        OUT (C),A

        call 49157       ; play the current tune
        
        ;swap back to bank 0
        LD A,(23388)  
        AND 248
        OR 0
        LD BC,32765
        LD (23388),A
        OUT (C),A
        pop af
        ex af, af'          ; restore af
        pop iy
        pop ix              ; restore ix & iy
        pop hl
        pop de
        pop bc
        pop af              ; restore all std regs
        ei                  ; enable interrupts
        jp 56
    END asm

IMStart:
    asm
    DI
    ; swap to bank 4 before IM start
    LD A,(23388)
    AND 248
    OR 4
    LD BC,32765
    LD (23388),A
    OUT (C),A    
    ; this code creates a 256 byte vector table at $FE00, then sets IM2
    ld hl, $5e00
    ld de, $5e01
    ld bc, 256
    ld a, h
    ld i, a
    ld a, $60
    ld (hl), a
    ldir
    im 2
    ; now swap back to 0
    LD A,(23388)  
    AND 248
    OR 0
    LD BC,32765
    LD (23388),A
    OUT (C),A
    ei
    ret      
END asm

IMOff:
    ASM         
        DI
        IM 1
        EI
        RET
END ASM

Print this item

  How can I use ZXB as Assembler only
Posted by: Luzie - 02-13-2017, 09:28 PM - Forum: How-To & Tutorials - Replies (2)

I want to use ZXB "as Assembler only". So no single BASIC statement will be used.

E.g. I just want to assemble this:

ASM
ORG 50000
RET
END ASM

and after compiling this should result in just a .BIN or .TAP-File which contains the single $C9 mcode ($C9=201 dez for RET) and is in memory from adress 50000 dez.

Is there a simple way for doing this?

Print this item

  Experimenting With Channel Pitches
Posted by: emook - 02-07-2017, 10:15 PM - Forum: Gallery - Replies (1)

Hi again,

This time I try and create realistic pitch based vu meters. I noticed while doing this there isn't an inbuilt feature to ensure things stay nicely synced, I find PAUSE to blunt so used a MC routine that return false if not enough frames had passed or true if it was time for an update.

Music is converted from the Megadrive, music is on interrupts, uses Putchars for the octopus, some bits compressed with zx7.

Source included.

[Image: VuMeters.png]



Attached Files
.zip   VuOutRun.zip (Size: 19.63 KB / Downloads: 749)
Print this item

  ZXBASIC_USER_DATA relocation?
Posted by: Haplo - 02-07-2017, 04:53 PM - Forum: Help & Support - Replies (2)

Hi,

in my project I use a lot of memory, indeed I use all the banks of RAM available. But my main code has grown beyond the 49151 position and now I have a serious problem by switching pages of RAM: ZXbasic stores some vitality data in the end of the generated code, like ZXBASIC_USER_DATA, so if the label overcome 49152, I can't switch pages without risky consequences Sad

My question is, it's posible to move/relocate these labels to another area more secure?
Of course I could do it manuallyby editing the .asm generated but I hope that exists an easy way to avoid this.

Print this item

  Compounded Let statments
Posted by: emook - 02-02-2017, 01:17 PM - Forum: ZX Basic Compiler - Replies (6)

Hello,

I've noticed that somthing that is possible is Sinclair Basic doesn't seem possible in Boriel....

eg:

Sinclair Basic

10 LET x=0
20 LET x=x+1-(50 AND x=50)
30 PRINT AT 0,0;x,
40 GOTO 20

As you can see x=x+1 will increment minus 0 unless x=50 then it will subtract 50. Great for loops and counters. In ZXB I am having to expand this into IF THEN statements.

x=0
x=x+1
myloop:
IF x=50 THEN
x=0
END IF
Print at 0,0;x,
GOTO myloop

Print this item

  [taito-minivader] Just Another Snake Game
Posted by: nitrofurano - 01-15-2017, 05:59 PM - Forum: Other Archs - No Replies

Minivaders version (the control limitation conditions to be played in a different way)
( <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Released_Programs_-_TaitoMinivader#Just_Another_Snake_Game">http://www.boriel.com/wiki/en/index.php ... Snake_Game</a><!-- m --> )



Attached Files
.zip   justanothersnakegame_minivaders_20170115.zip (Size: 15.17 KB / Downloads: 816)
Print this item

  Reading Kempston Joystick using function IN 31
Posted by: Luzie - 01-08-2017, 09:45 PM - Forum: How-To & Tutorials - Replies (4)

Hi,

I´m missing the IN function in ZX BASIC (as it was in Original Sinclair ZX Spectrum BASIC).

Would like to use it as described here:
<!-- m --><a class="postlink" href="https://chuntey.wordpress.com/2010/01/06/using-kempston-joystick-in-your-own-basic-programs/">https://chuntey.wordpress.com/2010/01/0 ... -programs/</a><!-- m -->

Must I use some machine code emulate?
If so, can someone please post me an example?

Regards,

Luzie

Print this item

  Xmas2016
Posted by: emook - 01-06-2017, 01:47 AM - Forum: Gallery - Replies (2)

Another little play around.

[Image: qyuNSW0.png]

Music Jingle Bells by EA-SOFT/ATS'97



Attached Files
.zip   xmas-emook.zip (Size: 5.61 KB / Downloads: 854)
Print this item

  compiler error (unicode argument expected)
Posted by: slenkar - 01-02-2017, 01:29 AM - Forum: Bug Reports - No Replies

Traceback (most recent call last):
File "/root/Downloads/zxbasic/zxb.py", line 348, in <module>
sys.exit(main(sys.argv)) # Exit
File "/root/Downloads/zxbasic/zxb.py", line 339, in main
output(asm_output, fout)
File "/root/Downloads/zxbasic/zxb.py", line 72, in output
ofile.write('\t')
TypeError: unicode argument expected, got 'str'

EDIT- oh it was because I needed 1.3.0

I was using 1.2.9 so problem solved!

Print this item