Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 155 online users. » 0 Member(s) | 153 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: 339
|
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: 334
|
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,888
|
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,813
|
|
|
Extending the language |
Posted by: britlion - 11-07-2011, 09:56 PM - Forum: Wishlist
- Replies (6)
|
 |
How hard would it be to make the language modular enough that it could be extended with new keywords?
E.g. if I wanted 64 column printing to work with MICROPRINT AT 18,43;INVERSE 1; "TEXT"
I could publish a module that would add this functionality?
|
|
|
ULAplus support |
Posted by: nitrofurano - 11-07-2011, 11:59 AM - Forum: Library
- Replies (8)
|
 |
since i'm seeing so many good games from MojonTwins supporting ULAplus, and its implementation looked so simple, i tried to code some library and example for that - be welcome testing it (i think would be a good idea if this could be implemented defaultly on zxbasic-compiler, what do you all think?)
(for now i'm testing this on SpectEmu on Wine, while there are no native emulators for LInux)
library/ulaplus.bas
Code: dim tmpv as uinteger
dim fdbkv as ubyte
function ulapluscheck():
tmpv=in(65339):pause 1:fdbkv=0
out 48955,0:out 65339,0:pause 1
if in(65339)<>tmpv then:fdbkv=1:out 48955,0:out 65339,tmpv:pause 1:end if
return fdbkv
end function
sub ulapluspalette(clv as ubyte, vlv as ubyte):
out 48955,(clv band 63):out 65339,vlv:pause 1
end sub
sub ulaplusswitch(flgv as ubyte):
out 48955,64:out 65339,(flgv band 1):pause 1
end sub
ulaplus_example.bas
Code: #include "library/ulaplus.bas"
ulaplusswitch(1):cls
a$="ULAplus is not present"
if ulapluscheck()<>0 then:a$="ULAplus is present":end if
print at 0,0;a$
for fl=0 to 1
flash fl
for hb=0 to 1
bright hb
for pa=0 to 7
paper pa:inverse 0
print " ";
next
for ik=0 to 7
ink ik:inverse 1
print " ";
next
next:next
for i=0 to 63
ulapluspalette(i, int(rnd*255) )
next
pause 0
|
|
|
displaying 8x8 patterns like tms9918 (msx1, sg1000, etc) |
Posted by: nitrofurano - 11-06-2011, 05:59 PM - Forum: Wishlist
- Replies (3)
|
 |
recently i were trying to use the zx-spectrum display like 8x8 patterns used on tms9918 (used on msx1, Sega-sg1000, Colecovision, ti99/4, etc. - and somehow similar on what is used on Sega-MasterSystem or NES)
i'm curious on using the display like this, specially when we see some games this way, if i'm not mistaking, 'Stop the ITA-Express' (Hudson), King's Valley (originally Konami, converted from Retroworks), etc.
besides tms9918 uses 2 banks of 2kb (one for bitmap, and another for 8x1 attributes), on the charmap01.bas i'm using 2k for bitmap and 256 bytes for attributes
issues: just like 32x24print example, and i'm not using asm routines, i'm having performance problems as expected (i really wished to be more skilled on assembly for that)
example.bas
Code: #include "library/vpokechr.bas"
#include "library/charmap01.bas"
border 0:cls
vpcls(32,@charmap01)
vpprint(6*32+3,@charmap01,"hello world!") :'- not working... (?)
'- for i=0 to 767:vpokechr(i, 128+int(rnd*127) ,@charmap01):next i
for i=0 to 767:vpokechr(i, int(rnd*255) ,@charmap01):next i
for i=0 to 255:vpokechr(i,i,@charmap01):next i
pause 0
library/vpokechr.bas
Code: dim adrv2 as uinteger
sub vpokechr(adrv as uinteger,chrv as uinteger,chmadr as uinteger)
adrv=adrv mod 768
poke 22528+adrv,peek(chmadr+2048+chrv)
for i=0 to 7
poke 16384+(adrv band 255)+((int(adrv/256))*2048)+(i*256),peek (chmadr+(chrv*8)+i)
next
end sub
sub vpcls(chrv as uinteger,chmadr as uinteger)
for adrv2=0 to 767
poke 22528+adrv2,peek(chmadr+2048+chrv)
for i=0 to 7
poke 16384+(adrv2 band 255)+((int(adrv2/256))*2048)+(i*256),peek (chmadr+(chrv*8)+i)
next
next
end sub
sub vpprint(adrv1 as uinteger,chmadr2 as uinteger,textv$ as string)
for adrv2=0 to len(textv)
vpokechr(adrv1+adrv2,val(textv$(adrv2)),chmadr2)
next
end sub
library/charmap01.bas
Code: poke uinteger 23606,@charmap01:poke uinteger 23675,@charmap01
goto end01
charmap01:
asm
defb 038h,000h,000h,000h,000h,000h,000h,000h
defb 0f8h,048h,040h,03ch,03ch,000h,01ch,01ch
defb 000h,000h,0ffh,0ffh,087h,0ffh,0ffh,071h
defb 003h,0ffh,0ffh,03fh,0ffh,0ffh,0ffh,0f8h
defb 0ffh,087h,0d3h,0ffh,007h,093h,000h,000h
defb 0ffh,0ffh,0ffh,0ffh,0f0h,000h,000h,0f0h
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,000h
defb 01ch,0ffh,01fh,03fh,0ffh,0ffh,0ffh,0ffh
defb 0ffh,0ffh,0fch,0ffh,0ffh,0ffh,0ffh,0ffh
defb 00fh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0c1h,0c1h,000h,0c1h,0c1h,0c1h,0e1h,0f1h
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0ffh,0fch,0fch,0fch,0fch,0ffh,0ffh,0ffh
defb 076h,000h,002h,000h,000h,012h,0c3h,03fh
defb 000h,070h,07fh,03fh,003h,000h,000h,0fch
defb 000h,000h,000h,0fdh,0f3h,060h,000h,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,087h
defb 0f9h,0ffh,080h,000h,0cah,0a8h,0b2h,007h
defb 0ffh,0ffh,0ffh,000h,070h,000h,000h,078h
defb 0c1h,0ffh,03fh,03fh,01fh,01fh,01fh,00fh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0e0h,0f0h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 037h,000h,0c9h,041h,073h,0ffh,0ffh,03fh
defb 0c0h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 000h,091h,0c3h,0ffh,0ffh,0ffh,0fch,0ffh
defb 0ffh,0ffh,0e9h,0f0h,0c0h,0e8h,0e4h,0e6h
defb 0ffh,0ffh,0ffh,0ffh,0ffh,07fh,0ffh,01fh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,000h
defb 0ffh,03eh,07ch,0ffh,0c8h,0a0h,000h,000h
defb 000h,0e0h,000h,000h,000h,000h,003h,01fh
defb 000h,000h,000h,000h,000h,000h,000h,000h
defb 030h,078h,078h,030h,030h,000h,030h,000h
defb 06ch,06ch,06ch,000h,000h,000h,000h,000h
defb 06ch,06ch,0feh,06ch,0feh,06ch,06ch,000h
defb 030h,07ch,0c0h,078h,00ch,0f8h,030h,000h
defb 000h,0c6h,0cch,018h,030h,066h,0c6h,000h
defb 038h,06ch,038h,076h,0dch,0cch,076h,000h
defb 060h,060h,0c0h,000h,000h,000h,000h,000h
defb 018h,030h,060h,060h,060h,030h,018h,000h
defb 060h,030h,018h,018h,018h,030h,060h,000h
defb 000h,066h,03ch,0ffh,03ch,066h,000h,000h
defb 000h,030h,030h,0fch,030h,030h,000h,000h
defb 000h,000h,000h,000h,000h,070h,030h,060h
defb 000h,000h,000h,0fch,000h,000h,000h,000h
defb 000h,000h,000h,000h,000h,030h,030h,000h
defb 006h,00ch,018h,030h,060h,0c0h,080h,000h
defb 078h,0cch,0dch,0fch,0ech,0cch,078h,000h
defb 030h,0f0h,030h,030h,030h,030h,0fch,000h
defb 078h,0cch,00ch,038h,060h,0cch,0fch,000h
defb 078h,0cch,00ch,038h,00ch,0cch,078h,000h
defb 01ch,03ch,06ch,0cch,0feh,00ch,00ch,000h
defb 0fch,0c0h,0f8h,00ch,00ch,0cch,078h,000h
defb 038h,060h,0c0h,0f8h,0cch,0cch,078h,000h
defb 0fch,0cch,00ch,018h,030h,060h,060h,000h
defb 078h,0cch,0cch,078h,0cch,0cch,078h,000h
defb 078h,0cch,0cch,07ch,00ch,018h,070h,000h
defb 000h,000h,030h,030h,000h,030h,030h,000h
defb 000h,000h,030h,030h,000h,070h,030h,060h
defb 018h,030h,060h,0c0h,060h,030h,018h,000h
defb 000h,000h,0fch,000h,0fch,000h,000h,000h
defb 060h,030h,018h,00ch,018h,030h,060h,000h
defb 078h,0cch,00ch,018h,030h,000h,030h,000h
defb 07ch,0c6h,0deh,0deh,0deh,0c0h,078h,000h
defb 030h,078h,0cch,0cch,0fch,0cch,0cch,000h
defb 0fch,066h,066h,07ch,066h,066h,0fch,000h
defb 03ch,066h,0c0h,0c0h,0c0h,066h,03ch,000h
defb 0fch,06ch,066h,066h,066h,06ch,0fch,000h
defb 0feh,062h,068h,078h,068h,062h,0feh,000h
defb 0feh,062h,068h,078h,068h,060h,0f0h,000h
defb 03ch,066h,0c0h,0c0h,0ceh,066h,03eh,000h
defb 0cch,0cch,0cch,0fch,0cch,0cch,0cch,000h
defb 078h,030h,030h,030h,030h,030h,078h,000h
defb 01eh,00ch,00ch,00ch,0cch,0cch,078h,000h
defb 0e6h,066h,06ch,078h,06ch,066h,0e6h,000h
defb 0f0h,060h,060h,060h,062h,066h,0feh,000h
defb 0c6h,0eeh,0feh,0d6h,0c6h,0c6h,0c6h,000h
defb 0c6h,0e6h,0f6h,0deh,0ceh,0c6h,0c6h,000h
defb 038h,06ch,0c6h,0c6h,0c6h,06ch,038h,000h
defb 0fch,066h,066h,07ch,060h,060h,0f0h,000h
defb 078h,0cch,0cch,0cch,0dch,078h,01ch,000h
defb 0fch,066h,066h,07ch,078h,06ch,0e6h,000h
defb 078h,0cch,0e0h,038h,01ch,0cch,078h,000h
defb 0fch,0b4h,030h,030h,030h,030h,078h,000h
defb 0cch,0cch,0cch,0cch,0cch,0cch,0fch,000h
defb 0cch,0cch,0cch,0cch,0cch,078h,030h,000h
defb 0c6h,0c6h,0c6h,0d6h,0feh,0eeh,0c6h,000h
defb 0c6h,0c6h,06ch,038h,06ch,0c6h,0c6h,000h
defb 0cch,0cch,0cch,078h,030h,030h,078h,000h
defb 0feh,0cch,098h,030h,062h,0c6h,0feh,000h
defb 078h,060h,060h,060h,060h,060h,078h,000h
defb 0c0h,060h,030h,018h,00ch,006h,002h,000h
defb 078h,018h,018h,018h,018h,018h,078h,000h
defb 010h,038h,06ch,0c6h,000h,000h,000h,000h
defb 000h,000h,000h,000h,000h,000h,000h,0ffh
defb 030h,030h,018h,000h,000h,000h,000h,000h
defb 000h,000h,078h,00ch,07ch,0cch,076h,000h
defb 0e0h,060h,07ch,066h,066h,066h,0bch,000h
defb 000h,000h,078h,0cch,0c0h,0cch,078h,000h
defb 01ch,00ch,00ch,07ch,0cch,0cch,076h,000h
defb 000h,000h,078h,0cch,0fch,0c0h,078h,000h
defb 038h,06ch,060h,0f0h,060h,060h,0f0h,000h
defb 000h,000h,076h,0cch,0cch,07ch,00ch,0f8h
defb 0e0h,060h,06ch,076h,066h,066h,0e6h,000h
defb 030h,000h,070h,030h,030h,030h,078h,000h
defb 018h,000h,078h,018h,018h,018h,0d8h,070h
defb 0e0h,060h,066h,06ch,078h,06ch,0e6h,000h
defb 070h,030h,030h,030h,030h,030h,078h,000h
defb 000h,000h,0ech,0feh,0d6h,0c6h,0c6h,000h
defb 000h,000h,0f8h,0cch,0cch,0cch,0cch,000h
defb 000h,000h,078h,0cch,0cch,0cch,078h,000h
defb 000h,000h,0dch,066h,066h,07ch,060h,0f0h
defb 000h,000h,076h,0cch,0cch,07ch,00ch,01eh
defb 000h,000h,0d8h,06ch,06ch,060h,0f0h,000h
defb 000h,000h,07ch,0c0h,078h,00ch,0f8h,000h
defb 010h,030h,07ch,030h,030h,034h,018h,000h
defb 000h,000h,0cch,0cch,0cch,0cch,076h,000h
defb 000h,000h,0cch,0cch,0cch,078h,030h,000h
defb 000h,000h,0c6h,0c6h,0d6h,0feh,06ch,000h
defb 000h,000h,0c6h,06ch,038h,06ch,0c6h,000h
defb 000h,000h,0cch,0cch,0cch,07ch,00ch,0f8h
defb 000h,000h,0fch,098h,030h,064h,0fch,000h
defb 01ch,030h,030h,0e0h,030h,030h,01ch,000h
defb 018h,018h,018h,000h,018h,018h,018h,000h
defb 0e0h,030h,030h,01ch,030h,030h,0e0h,000h
defb 076h,0dch,000h,000h,000h,000h,000h,000h
defb 010h,038h,06ch,0c6h,0c6h,0c6h,0feh,000h
defb 000h,000h,000h,0ffh,07ch,03ch,034h,000h
defb 0ffh,078h,000h,000h,000h,000h,000h,000h
defb 0ffh,0ffh,01ch,0ffh,022h,01bh,01fh,0ffh
defb 0dfh,0dfh,0ffh,0ffh,0ffh,0ffh,0d0h,0ffh
defb 0ffh,0ffh,01fh,000h,000h,000h,000h,013h
defb 0ffh,0ffh,077h,0c1h,000h,000h,000h,000h
defb 07fh,0ffh,0ffh,000h,00ch,004h,000h,00eh
defb 0ffh,0ffh,0e3h,083h,003h,083h,000h,0feh
defb 0d8h,0ffh,0ffh,0ffh,0f9h,0ffh,0f3h,0f0h
defb 00fh,0a0h,0ffh,0ffh,091h,010h,0f3h,0ffh
defb 0ffh,078h,0ffh,0ffh,0ffh,0ffh,0f8h,0f8h
defb 000h,000h,0f9h,068h,0e9h,0ffh,0ffh,0ffh
defb 000h,03eh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 00ch,000h,0c4h,00bh,0ffh,0ffh,0ffh,0ffh
defb 03fh,0ffh,0ffh,0ffh,0f8h,01fh,000h,040h
defb 0ffh,0ffh,0fch,01fh,01fh,0ffh,01fh,018h
defb 0ffh,0ffh,0ffh,0c3h,0ffh,0ffh,08fh,0f8h
defb 0ffh,0ffh,0ffh,0ffh,01fh,038h,0ffh,01fh
defb 007h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0e0h,0f0h,0f0h,0e0h,0f8h,0f0h,0f0h,0f0h
defb 0ffh,0ffh,0ffh,042h,000h,023h,000h,000h
defb 0f3h,0e3h,0ffh,0c3h,003h,0e1h,024h,01fh
defb 06bh,0ffh,079h,0ffh,0cdh,0b5h,0ffh,0ffh
defb 00ah,003h,027h,0ffh,0ffh,0e6h,0ffh,0ffh
defb 0f0h,0f0h,0f8h,0f0h,0e0h,070h,0e0h,000h
defb 000h,006h,006h,00eh,000h,000h,01eh,0ffh
defb 007h,007h,00fh,00fh,01fh,0ffh,0fch,01ch
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0e7h,0ffh,0ffh
defb 080h,000h,001h,000h,000h,000h,061h,031h
defb 087h,087h,083h,083h,083h,083h,083h,083h
defb 000h,0e1h,0c0h,000h,000h,0c0h,0c0h,000h
defb 01eh,01eh,01eh,01fh,00fh,00fh,00fh,00bh
defb 000h,0ffh,0ffh,0ffh,0ffh,07ch,0fch,07ch
defb 000h,0ffh,0ffh,0ffh,0ffh,000h,03ah,000h
defb 03fh,0ffh,0ffh,0ffh,0ffh,000h,04bh,000h
defb 0ffh,0ffh,0ffh,0ffh,0ffh,000h,000h,000h
defb 0ffh,0ffh,0f0h,0f0h,0f0h,000h,000h,000h
defb 0ffh,0ffh,009h,000h,004h,000h,000h,000h
defb 0ffh,0ffh,00ch,00ch,016h,000h,000h,000h
defb 0ffh,0ffh,010h,011h,011h,048h,0ceh,006h
defb 000h,000h,000h,0ffh,0ffh,010h,01ch,01ch
defb 0ffh,0ffh,0ffh,0f8h,0ffh,000h,03dh,019h
defb 0c0h,000h,0ffh,0ffh,07fh,010h,0b4h,0bch
defb 0ffh,0ffh,0ffh,0ffh,0ffh,000h,000h,038h
defb 0ffh,0ffh,0ffh,0ffh,0ffh,000h,000h,002h
defb 0ffh,0ffh,0ffh,0ffh,0ffh,000h,000h,060h
defb 0e8h,08fh,080h,0ffh,0ffh,000h,000h,0c0h
defb 01dh,0c7h,000h,087h,0f0h,047h,002h,002h
defb 09fh,000h,08fh,000h,090h,0ffh,0ffh,0ffh
defb 000h,03eh,000h,010h,000h,0ffh,0ffh,0ffh
defb 060h,03eh,0ffh,007h,007h,0ffh,0ffh,0ffh
defb 000h,070h,0e0h,0f0h,000h,0e3h,0c7h,0c7h
defb 017h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 05fh,0ffh,0ffh,0ffh,0dch,0c4h,02eh,03ch
defb 0ffh,0b7h,0ffh,0ffh,0ffh,0ffh,067h,079h
defb 0ffh,0f0h,0f5h,04fh,0ffh,0ffh,077h,0ffh
defb 0c0h,000h,0c0h,0c0h,080h,080h,080h,000h
defb 00ch,01eh,03eh,01eh,00eh,03fh,007h,066h
defb 000h,03ch,03ch,03ch,03ch,07ch,0ffh,07ch
defb 034h,070h,020h,001h,000h,000h,001h,000h
defb 019h,000h,007h,000h,083h,0c3h,0e0h,0e3h
defb 083h,083h,083h,083h,083h,083h,083h,0e3h
defb 000h,000h,000h,0c0h,000h,000h,000h,0c0h
defb 0ebh,0f9h,0f9h,0f9h,0fch,0fch,0fch,0fch
defb 07ch,0ffh,0fch,0feh,0fch,0fch,0fch,0fch
defb 000h,000h,000h,007h,007h,007h,00fh,000h
defb 000h,000h,000h,0f0h,0ffh,0ffh,0ffh,063h
defb 000h,000h,000h,000h,0f8h,0feh,0ffh,0ffh
defb 000h,000h,000h,000h,000h,0ffh,000h,0d9h
defb 000h,000h,000h,000h,0ffh,0d0h,050h,03fh
defb 000h,000h,000h,0ffh,0ceh,046h,026h,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 01ch,019h,000h,000h,000h,000h,008h,008h
defb 001h,087h,007h,007h,007h,007h,007h,007h
defb 038h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 078h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 000h,000h,030h,030h,022h,000h,000h,000h
defb 0ffh,0ffh,0f0h,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0ffh,0ffh,013h,0ffh,0ffh,0ffh,0ffh,0ffh
defb 000h,000h,000h,008h,000h,000h,000h,000h
defb 0ffh,0ffh,0ffh,000h,0ffh,0d6h,000h,0eah
defb 0ffh,0ffh,0ffh,007h,0b7h,007h,037h,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,000h,000h
defb 0ffh,0ffh,0f8h,000h,0cch,00ch,000h,000h
defb 0ffh,00fh,00fh,007h,007h,003h,003h,003h
defb 080h,080h,0ddh,08ch,084h,0c7h,0c7h,0c7h
defb 079h,039h,0ffh,0beh,000h,08ch,0c6h,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,00fh,027h,00fh
defb 0f0h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 07eh,0ffh,0fch,0ffh,0f0h,0ffh,0ffh,0ffh
defb 0fch,0fch,0fch,0fch,0ffh,0ffh,0ffh,0ffh
defb 000h,0fah,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0e0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h,0f0h
defb 0f3h,09fh,000h,0a3h,063h,0c3h,007h,007h
defb 000h,0d0h,0ffh,0ffh,0c7h,0c7h,0cfh,0ffh
defb 0ffh,0ffh,074h,014h,01ch,00ch,0cch,0ffh
defb 0fch,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 01ch,0ffh,0ffh,0ffh,0ffh,0e0h,0ffh,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0e3h,0ffh,0ffh,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0ffh,0ffh,0ffh,0fch,0ffh,0ffh,02bh,0ffh
defb 0ffh,0aeh,0cah,0bch,0e7h,0e7h,0a7h,0e7h
defb 0ffh,0fch,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0cdh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,076h,0f0h,000h
defb 0ffh,0ffh,0ffh,0ffh,0ffh,01ch,000h,000h
defb 0ffh,000h,0c4h,000h,0ffh,000h,000h,000h
defb 0ffh,000h,000h,000h,0f8h,0e8h,000h,000h
defb 0ffh,0ffh,0ffh,0ffh,0ffh,000h,000h,000h
defb 0ffh,0ffh,0feh,0ffh,0ffh,09ch,000h,000h
defb 0ffh,000h,060h,0f0h,0e0h,000h,000h,030h
defb 000h,000h,000h,000h,000h,000h,000h,000h
defb 000h,020h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 000h,042h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 060h,0ffh,0ffh,0f8h,0f8h,0ffh,0ffh,00ah
defb 0f8h,000h,000h,000h,000h,014h,000h,000h
defb 08dh,001h,001h,001h,049h,0edh,0e1h,000h
defb 0c7h,0ffh,0ffh,0ffh,0ffh,0ffh,0feh,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,01dh,01ch
defb 0c7h,0e1h,0f1h,0f0h,0f0h,0ffh,0ffh,0e7h
defb 0ffh,0ffh,0ffh,0ffh,03fh,0ffh,0ffh,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0ffh,0ffh,0ffh,0ffh,0feh,0fch,0ffh,0ffh
defb 0ffh,0ffh,03fh,05fh,0dfh,03fh,007h,01ch
defb 0f0h,0ffh,0ffh,0f8h,0f8h,0feh,0ffh,0fch
defb 007h,000h,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 0ffh,0ffh,0ffh,0fdh,0ffh,000h,0c1h,0c1h
defb 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
defb 010h,010h,010h,010h,010h,010h,030h,010h
defb 038h,010h,078h,010h,030h,010h,072h,072h
defb 008h,010h,010h,010h,038h,008h,07eh,038h
defb 038h,010h,030h,030h,010h,010h,010h,032h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 070h,070h,070h,070h,070h,070h,070h,070h
defb 010h,010h,010h,010h,010h,050h,050h,010h
defb 010h,010h,010h,010h,010h,010h,038h,038h
defb 038h,038h,038h,078h,010h,010h,010h,010h
defb 070h,070h,072h,072h,072h,078h,070h,050h
defb 010h,010h,010h,010h,010h,010h,010h,010h
defb 010h,010h,010h,010h,010h,010h,010h,010h
defb 038h,03ah,03ah,072h,010h,010h,010h,010h
defb 070h,030h,038h,050h,070h,078h,070h,07ah
defb 050h,050h,010h,050h,010h,010h,010h,062h
defb 050h,050h,010h,010h,010h,032h,072h,050h
defb 032h,030h,010h,070h,010h,010h,038h,030h
defb 030h,038h,038h,010h,030h,038h,03ah,07ah
defb 010h,010h,010h,020h,010h,010h,010h,032h
defb 072h,072h,010h,010h,032h,032h,032h,034h
defb 010h,010h,010h,070h,010h,010h,010h,032h
defb 010h,018h,030h,010h,030h,07eh,03ah,038h
end asm
end01:
|
|
|
four simultaneous players on one keyboard (idea for game) |
Posted by: nitrofurano - 11-05-2011, 06:49 PM - Forum: Gallery
- No Replies
|
 |
just sharing a snippet i coded now - this is about handling 4 simultaneous players (just like those arcade games from early 90's) on one keyboard - the only issues is maybe some sprites ('printing' udgs for that) may disapear, and on emulators (due on keyboard hardware or driver limitation) more than few simultaneous keys (like 6, depending) are not recognized, but i think this doesn't happen on real hardware.
this code is relativelly similar to one in assembly i posted on Karoshi msx forum, with some help from there - the code below has some differences, like the lack of hardware sprites on zx-spectrum, being all in basic language (except asm defb), etc.
please share oppinions, feedback, suggestions, etc., about this! - in my oppinion, games behaving like this (4 simultaneous players on one keyboard) are really rare on zx-spectrum, afaik
the keys used are 'wsad' for 1, 'tgfh' for 2, 'ikjl' for 3, and cursor keys for 4
Code: poke uInteger 23675,@udg01
poke uInteger 23606,@typeface-256
dim sq1,sq2,sq3,sq4 as uinteger
dim x1,y1,x2,y2,x3,y3,x4,y4 as byte
x1=5:y1=3:x2=10:y2=4:x3=5:y3=11:x4=10:y4=12
border 0:bright 1:paper 7:ink 0:flash 0:cls
drawsprites()
inverse 0:ink 0:bright 1
lp01:
pause 1
sq1=((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
sq2=((255-(in 64510)) band 16)/16 bor ((255-(in 65022)) band 16)/8 bor ((255-(in 65022)) band 8)/2 bor ((255-(in 49150)) band 16)/2 :'- tgfh
sq3=((255-(in 57342)) band 4)/4 bor ((255-(in 49150)) band 4)/2 bor ((255-(in 49150)) band 8)/2 bor ((255-(in 49150)) band 2)*4 :'- ikjl
sq4=((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
if sq1<>0 then
inverse 0:ink 0:bright 1:print at y1,x1;" ":print at y1+1,x1;" "
if ((sq1 band 4) <>0) and x1>0 then:x1=x1-1:end if
if ((sq1 band 8) <>0) and x1<30 then:x1=x1+1:end if
if ((sq1 band 1)<>0) and y1>0 then:y1=y1-1:end if
if ((sq1 band 2) <>0) and y1<22 then:y1=y1+1:end if
drawsprites()
end if
if sq2<>0 then
inverse 0:ink 0:bright 1:print at y2,x2;" ":print at y2+1,x2;" "
if ((sq2 band 4) <>0) and x2>0 then:x2=x2-1:end if
if ((sq2 band 8) <>0) and x2<30 then:x2=x2+1:end if
if ((sq2 band 1)<>0) and y2>0 then:y2=y2-1:end if
if ((sq2 band 2) <>0) and y2<22 then:y2=y2+1:end if
drawsprites()
end if
if sq3<>0 then
inverse 0:ink 0:bright 1:print at y3,x3;" ":print at y3+1,x3;" "
if ((sq3 band 4) <>0) and x3>0 then:x3=x3-1:end if
if ((sq3 band 8) <>0) and x3<30 then:x3=x3+1:end if
if ((sq3 band 1)<>0) and y3>0 then:y3=y3-1:end if
if ((sq3 band 2) <>0) and y3<22 then:y3=y3+1:end if
drawsprites()
end if
if sq4<>0 then
inverse 0:ink 0:bright 1:print at y4,x4;" ":print at y4+1,x4;" "
if ((sq4 band 4) <>0) and x4>0 then:x4=x4-1:end if
if ((sq4 band 8) <>0) and x4<30 then:x4=x4+1:end if
if ((sq4 band 1)<>0) and y4>0 then:y4=y4-1:end if
if ((sq4 band 2) <>0) and y4<22 then:y4=y4+1:end if
drawsprites()
end if
inverse 0:ink 0:bright 1
print at 0,0;sq1;",";sq2;",";sq3;",";sq4;" "
goto lp01
sub drawsprites():
inverse 1:ink 1:bright 0:print at y1,x1;"\A\B":print at y1+1,x1;"\C\D"
inverse 1:ink 2:bright 0:print at y2,x2;"\E\F":print at y2+1,x2;"\G\H"
inverse 1:ink 3:bright 0:print at y3,x3;"\I\J":print at y3+1,x3;"\K\L"
inverse 1:ink 4:bright 0:print at y4,x4;"\M\N":print at y4+1,x4;"\O\P"
end sub
udg01:
'- sprites from http://upload.wikimedia.org/wikipedia/commons/e/e0/AdobeGaramondSp.svg
asm
defb 000h,000h,000h,000h,003h,001h,001h,001h
defb 000h,000h,000h,000h,0C0h,080h,080h,080h
defb 001h,001h,001h,003h,000h,000h,000h,000h
defb 080h,080h,080h,0C0h,000h,000h,000h,000h
defb 000h,000h,000h,000h,007h,009h,001h,001h
defb 000h,000h,000h,000h,080h,080h,080h,080h
defb 001h,002h,006h,00Fh,000h,000h,000h,000h
defb 000h,000h,020h,0E0h,000h,000h,000h,000h
defb 000h,000h,000h,000h,003h,004h,000h,000h
defb 000h,000h,000h,000h,080h,0C0h,0C0h,080h
defb 003h,001h,000h,000h,000h,000h,003h,006h
defb 080h,0C0h,0C0h,0C0h,0C0h,080h,000h,000h
defb 000h,000h,000h,000h,000h,000h,001h,003h
defb 000h,000h,000h,000h,040h,0C0h,0C0h,0C0h
defb 002h,004h,008h,01Fh,000h,000h,000h,000h
defb 0C0h,0C0h,0C0h,0F0h,0C0h,0C0h,0C0h,0C0h
end asm
typeface:
asm
defb 000h,000h,000h,000h,000h,000h,000h,000h
defb 018h,03ch,03ch,018h,018h,000h,018h,000h
defb 036h,036h,036h,000h,000h,000h,000h,000h
defb 036h,036h,07fh,036h,07fh,036h,036h,000h
defb 018h,03eh,060h,03ch,006h,07ch,018h,000h
defb 000h,063h,066h,00ch,018h,033h,063h,000h
defb 01ch,036h,01ch,03bh,06eh,066h,03bh,000h
defb 00ch,00ch,018h,000h,000h,000h,000h,000h
defb 00ch,018h,030h,030h,030h,018h,00ch,000h
defb 030h,018h,00ch,00ch,00ch,018h,030h,000h
defb 000h,066h,03ch,0ffh,03ch,066h,000h,000h
defb 000h,018h,018h,07eh,018h,018h,000h,000h
defb 000h,000h,000h,000h,018h,008h,010h,000h
defb 000h,000h,000h,07eh,000h,000h,000h,000h
defb 000h,000h,000h,000h,000h,018h,018h,000h
defb 003h,006h,00ch,018h,030h,060h,0c0h,000h
defb 01ch,026h,063h,063h,063h,032h,01ch,000h
defb 00ch,01ch,00ch,00ch,00ch,00ch,03fh,000h
defb 03eh,063h,007h,01eh,03ch,070h,07fh,000h
defb 03fh,006h,00ch,01eh,003h,063h,03eh,000h
defb 00eh,01eh,036h,066h,07fh,006h,006h,000h
defb 07eh,060h,07eh,003h,003h,063h,03eh,000h
defb 01ch,030h,060h,07eh,063h,063h,03eh,000h
defb 07fh,063h,006h,00ch,018h,018h,018h,000h
defb 03ch,062h,072h,03ch,04fh,043h,03eh,000h
defb 03eh,063h,063h,03fh,003h,006h,03ch,000h
defb 000h,000h,018h,018h,000h,018h,018h,000h
defb 000h,018h,018h,000h,038h,018h,030h,000h
defb 00ch,018h,030h,060h,030h,018h,00ch,000h
defb 000h,000h,07eh,000h,07eh,000h,000h,000h
defb 030h,018h,00ch,006h,00ch,018h,030h,000h
defb 07ch,0c6h,006h,01ch,030h,000h,030h,000h
defb 03eh,063h,06fh,06fh,06fh,060h,03ch,000h
defb 01ch,036h,063h,063h,07fh,063h,063h,000h
defb 07eh,063h,063h,07eh,063h,063h,07eh,000h
defb 01eh,033h,060h,060h,060h,033h,01eh,000h
defb 07ch,066h,063h,063h,063h,066h,07ch,000h
defb 03fh,030h,030h,03eh,030h,030h,03fh,000h
defb 07fh,060h,060h,07eh,060h,060h,060h,000h
defb 01fh,030h,060h,067h,063h,033h,01fh,000h
defb 063h,063h,063h,07fh,063h,063h,063h,000h
defb 03fh,00ch,00ch,00ch,00ch,00ch,03fh,000h
defb 003h,003h,003h,003h,003h,063h,03eh,000h
defb 063h,066h,06ch,078h,07ch,06eh,067h,000h
defb 030h,030h,030h,030h,030h,030h,03fh,000h
defb 063h,077h,07fh,07fh,06bh,063h,063h,000h
defb 063h,073h,07bh,07fh,06fh,067h,063h,000h
defb 03eh,063h,063h,063h,063h,063h,03eh,000h
defb 07eh,063h,063h,063h,07eh,060h,060h,000h
defb 03eh,063h,063h,063h,06fh,066h,03dh,000h
defb 07eh,063h,063h,067h,07ch,06eh,067h,000h
defb 03ch,066h,060h,03eh,003h,063h,03eh,000h
defb 03fh,00ch,00ch,00ch,00ch,00ch,00ch,000h
defb 063h,063h,063h,063h,063h,063h,03eh,000h
defb 063h,063h,063h,077h,03eh,01ch,008h,000h
defb 063h,063h,06bh,07fh,07fh,077h,063h,000h
defb 063h,077h,03eh,01ch,03eh,077h,063h,000h
defb 033h,033h,033h,01eh,00ch,00ch,00ch,000h
defb 07fh,007h,00eh,01ch,038h,070h,07fh,000h
defb 000h,000h,000h,03ch,03ch,000h,000h,000h
defb 000h,000h,000h,07fh,07fh,000h,000h,000h
defb 000h,000h,000h,000h,000h,018h,018h,000h
defb 018h,03ch,03ch,018h,018h,000h,018h,000h
defb 03ch,042h,09dh,0a1h,0a1h,09dh,042h,03ch
defb 030h,018h,00ch,000h,000h,000h,000h,000h
defb 01ch,036h,063h,063h,07fh,063h,063h,000h
defb 07eh,063h,063h,07eh,063h,063h,07eh,000h
defb 01eh,033h,060h,060h,060h,033h,01eh,000h
defb 07ch,066h,063h,063h,063h,066h,07ch,000h
defb 03fh,030h,030h,03eh,030h,030h,03fh,000h
defb 07fh,060h,060h,07eh,060h,060h,060h,000h
defb 01fh,030h,060h,067h,063h,033h,01fh,000h
defb 063h,063h,063h,07fh,063h,063h,063h,000h
defb 03fh,00ch,00ch,00ch,00ch,00ch,03fh,000h
defb 003h,003h,003h,003h,003h,063h,03eh,000h
defb 063h,066h,06ch,078h,07ch,06eh,067h,000h
defb 030h,030h,030h,030h,030h,030h,03fh,000h
defb 063h,077h,07fh,07fh,06bh,063h,063h,000h
defb 063h,073h,07bh,07fh,06fh,067h,063h,000h
defb 03eh,063h,063h,063h,063h,063h,03eh,000h
defb 07eh,063h,063h,063h,07eh,060h,060h,000h
defb 03eh,063h,063h,063h,06fh,066h,03dh,000h
defb 07eh,063h,063h,067h,07ch,06eh,067h,000h
defb 03ch,066h,060h,03eh,003h,063h,03eh,000h
defb 03fh,00ch,00ch,00ch,00ch,00ch,00ch,000h
defb 063h,063h,063h,063h,063h,063h,03eh,000h
defb 063h,063h,063h,077h,03eh,01ch,008h,000h
defb 063h,063h,06bh,07fh,07fh,077h,063h,000h
defb 063h,077h,03eh,01ch,03eh,077h,063h,000h
defb 033h,033h,033h,01eh,00ch,00ch,00ch,000h
defb 07fh,007h,00eh,01ch,038h,070h,07fh,000h
defb 000h,000h,000h,03ch,03ch,000h,000h,000h
defb 000h,000h,000h,07fh,07fh,000h,000h,000h
defb 000h,000h,000h,000h,000h,018h,018h,000h
defb 018h,03ch,03ch,018h,018h,000h,018h,000h
defb 03ch,042h,09dh,0a1h,0a1h,09dh,042h,03ch
end asm
|
|
|
missing colour 9 - bug or feature lack |
Posted by: nitrofurano - 11-03-2011, 08:42 PM - Forum: Bug Reports
- Replies (8)
|
 |
i did a test with the code below on both zmakebas (tokenizes zxspectrum-basic into a .tap file) and Boriel's zxbasic compiler, and it seems Boriel's compiler is missing colour 9 support:
Code: 10 border 0:cls
12 for i=22528 to 22528+767:poke i,int(rnd*128):next i
20 print at 2,1;ink 8;"transparency test - ink"
21 print at 3,1;paper 8;"transparency test - paper"
22 print at 5,1;ink 9;paper 8;"contrast test - ink"
23 print at 6,1;paper 9;ink 8;"contrast test - paper"
99 pause 0
and the result is this (imagemagick thumbnail link below):
![[Image: borielzxbasiccompilerco.th.png]](http://img215.imageshack.us/img215/9306/borielzxbasiccompilerco.th.png)
while the tokenized version (using the zx-spectrum interpreter) seems to behave as predicted, the zxbasic-compiler version seems to take wrongly colour 9 (contrast) as colour 1 (blue).
what i'm seeing is that, somehow, zxbasic-compiler is not writing at the 23697 address (please check if i'm wrong), the bits 4 and 5 for ink (0x30), and 6 and 7 (0xC0) for paper - what contrast seems to do is, considering ink is 0 when paper is at least 4 (checking the green bit seems to be enough), and 7 when below 4 - and the same for paper related to ink (i just don't know why in the system variables it were using two bits instead of one, but i think this is up to that one coded the zx-spectrum rom) - i think when using '9' on 'ink' or 'paper' commands, these bits are switched on, and between '0' and '8' they are switched off, with some kind of 'bor' (0x30 for ink or 0xC0 for paper) or 'band' (0xCF for ink or 0x3F for paper)
i think now i found why this part of my library 'print64x32.bas' were not working:
Code: if (peek (23697) band 16)<>0 then:v6=(v5 band 248) bor ((1-(v5 band 32)/32)*7):end if :'- colour 9 - ink
if (peek (23697) band 64)<>0 then:v6=(v5 band 199) bor ((1-(v5 band 4)/4)*56):end if :'- colour 9 - paper
thanks!
|
|
|
how to convert sprite to ASM? |
Posted by: slenkar - 11-03-2011, 07:44 PM - Forum: ZX Basic Compiler
- Replies (13)
|
 |
does anyone know how to convert a sprite (in any format) to ASM defb statements?
say for example my sprite was like this:
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
1,0,0,0,0,0,0,1
|
|
|
for/next/step - did i find a bug? |
Posted by: nitrofurano - 11-03-2011, 01:53 PM - Forum: Help & Support
- Replies (3)
|
 |
i don't know if this is a bug, or if i'm defining variable kind wrongly ('j' is not stopping at '0') - thanks in advance! 
Code: border 0:cls
dim i,j as uinteger
for i=0 to 6143 step 3
poke 16384+0+i,128+16+2
poke 16384+1+i,64+8+1
poke 16384+2+i,32+4
next i
lp01:
for j=16384 to 0 step -32
print at 0,0;j;" "
pause 1
for i=0 to 767
poke 16384+6144+i,peek(i+j) band 127
next i
next j
goto lp01
|
|
|
ASM features EQU and DEFM |
Posted by: LCD - 11-01-2011, 12:59 AM - Forum: Wishlist
- Replies (4)
|
 |
Hi Boriel. I just adapted a ASM routine for key-redefining from WOS Forum to ZXBC for my next game, and noticed following:
EQU is not supported?
DEFM supports only Strings, but not mixed bytes+strings in one line like: DEFM 14,10,5,"Down",255
I adapted the lines by lacerating them to DEFB,DEFM and DEFB again, but maybe it would be a good idea to support bytes and Strings with DEFM, like other assemblers do.
|
|
|
its fussy about #include |
Posted by: slenkar - 10-30-2011, 07:53 PM - Forum: Help & Support
- Replies (20)
|
 |
the compiler doesnt like it when #include statements are not the first thing in a line
so this will work:
#include
but this will not:
<space> #include
the error message complains about a period or full stop being in the wrong place which is not the right issue.
This may turn someone off the language if they cant solve the problem
|
|
|
|