| Welcome, Guest |
You have to register before you can post on our site.
|
| Forum Statistics |
» Members: 273
» Latest member: mindlin
» Forum threads: 1,085
» Forum posts: 6,486
Full Statistics
|
| Online Users |
There are currently 33 online users. » 0 Member(s) | 32 Guest(s) Bing
|
| Latest Threads |
location of heap manageme...
Forum: Help & Support
Last Post: boriel
2026-03-07, 12:13 AM
» Replies: 1
» Views: 212
|
non-paged supervisor code...
Forum: Help & Support
Last Post: sdo303
2026-02-20, 06:38 PM
» Replies: 8
» Views: 688
|
How to open fuse as an ex...
Forum: How-To & Tutorials
Last Post: Duefectu
2026-02-09, 01:52 PM
» Replies: 3
» Views: 1,062
|
Old zxbasic game errors
Forum: Help & Support
Last Post: boriel
2025-11-09, 11:52 AM
» Replies: 7
» Views: 1,671
|
Error: Undefined GLOBAL l...
Forum: Help & Support
Last Post: ardentcrest
2025-11-04, 05:46 PM
» Replies: 3
» Views: 808
|
A Fast(er) Plot Routine f...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-30, 03:16 PM
» Replies: 2
» Views: 928
|
Hall of Fame - Include fo...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-28, 03:48 PM
» Replies: 0
» Views: 473
|
[SOLVED] Array layout bug...
Forum: Bug Reports
Last Post: Zoran
2025-10-25, 05:48 PM
» Replies: 2
» Views: 942
|
3DOS Commands?
Forum: Help & Support
Last Post: boriel
2025-10-06, 02:54 PM
» Replies: 3
» Views: 1,105
|
CLS/Fade out ASM Sub-rout...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-05, 03:39 PM
» Replies: 2
» Views: 835
|
|
|
| sub and function, asm and ix |
|
Posted by: nitrofurano - 2013-06-10, 03:22 PM - Forum: Help & Support
- No Replies
|
 |
when advancing a bit more on the MSX part of Boriel's ZX-Basic Compiler, and after that help from accessing paged memory on ZX-Spectrum 128k, i got this situation:
the library i used on the MSX "version"
Code: sub msxvpoke(tad as uinteger,tva as uinteger)
asm
ld h,(ix+5)
ld l,(ix+4)
ld a,(ix+6)
call $004D
end asm
end sub
there i'm seeing that sub is using 'ix' from the arguments, but i don't know how are they arranged (as ubyte, uinteger, etc.), and why or what for we use fastcall, get ix instead of bc,de,hl,af - and from a function, in which register or index the value is returned (af, just like from fastcall?)
i can't find documentation explaining it better on the wiki: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:FUNCTION">http://www.boriel.com/wiki/en/index.php ... C:FUNCTION</a><!-- m --> and <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:SUB">http://www.boriel.com/wiki/en/index.php/ZX_BASIC:SUB</a><!-- m -->
thanks and cheers!
|
|
|
| zxbasic for dos? |
|
Posted by: slenkar - 2013-05-29, 07:00 PM - Forum: Wishlist
- Replies (10)
|
 |
Would it be easier to create a script to translate zxbasic to C, or to write a compiler target for x86 asm?
|
|
|
| 128k memory paging, how can we do that? :S |
|
Posted by: nitrofurano - 2013-05-29, 01:55 PM - Forum: Help & Support
- Replies (11)
|
 |
hi everyone!
based on the information i found at <!-- m --><a class="postlink" href="http://www.worldofspectrum.org/faq/reference/128kreference.htm">http://www.worldofspectrum.org/faq/refe ... erence.htm</a><!-- m -->
i tried this one:
Code: cls
page1=0
a=(((peek($5B5C))band $F8)bor (page1 band 7))
poke $5B5C,a:out $7FFD,a
poke $C123,80
page1=1
a=(((peek($5B5C))band $F8)bor (page1 band 7))
poke $5B5C,a:out $7FFD,a
poke $C123,81
page1=0
a=(((peek($5B5C))band $F8)bor (page1 band 7))
poke $5B5C,a:out $7FFD,a
print peek($C123)
page1=1
a=(((peek($5B5C))band $F8)bor (page1 band 7))
poke $5B5C,a:out $7FFD,a
print peek($C123)
pause 0
and i can't figure out what is going wrong there...- any clue? :S
|
|
|
| Scrolling Tiles |
|
Posted by: slenkar - 2013-05-21, 05:56 PM - Forum: How-To & Tutorials
- Replies (10)
|
 |
I managed to get it done using ZXBASIC
Code: DIM mapdata(31) AS UBYTE => {1,0,2,0,2,1,1,2,1,0,2,0,2,1,1,2,1,0,2,0,2,1,1,2,1,0,2,0,2,1,1,2}
DIM brick(7) AS UBYTE =>{249,249,0,159,159,0,249,249}
DIM crystal(7) AS UBYTE =>{16,40,84,40,84,40,16,0}
Dim CurrentGraphic as ubyte=1
Dim NextGraphic as Ubyte
Dim PreviousGraphic as ubyte
Dim address as UInteger
Dim LineStartAddress as UInteger
addr=16384
LineStartAddress=addr
Dim PreviousAddress as UInteger
Dim LandscapeEightIter as Ubyte
Dim LandscapeIter as ubyte
Dim LineNumber as UByte
for x=0 to 31
Print AT 0,x;"["
next
for iterations=0 to 258 'scroll left 258 times
address=16384
for y=0 to 7
LineStartAddress=address
for x=0 to 31
CurrentGraphic = PEEK(address)
'pause 5
if x>0 'the leftmost byte has no graphics to its left
if CurrentGraphic Band 128=128 'if this graphic has a dot on the left
PreviousGraphic=PreviousGraphic Bor 1 'Add a dot to the right of the previous graphic byte
POKE PreviousAddress,PreviousGraphic
end if
end if
PreviousAddress=address 'save the address of the byte on the left
CurrentGraphic=CurrentGraphic SHL 1 'shift dors to left
PreviousGraphic=CurrentGraphic 'save graphic
if x<31
POKE address,CurrentGraphic
end if
if x=31
if mapdata(LandscapeIter)=1
NextGraphic=brick(LineNumber)
end if
if mapdata(LandscapeIter)=2
NextGraphic=crystal(LineNumber)
end if
if mapdata(LandscapeIter)=0
NextGraphic=0
end if
if LandscapeEightIter=0
if NextGraphic Band 1=1
CurrentGraphic=CurrentGraphic BOR 1
end if
end if
if LandscapeEightIter=1
if NextGraphic Band 2=2
CurrentGraphic=CurrentGraphic BOR 1
end if
end if
if LandscapeEightIter=2
if NextGraphic Band 4=4
CurrentGraphic=CurrentGraphic BOR 1
end if
end if
if LandscapeEightIter=3
if NextGraphic Band 8=8
CurrentGraphic=CurrentGraphic BOR 1
end if
end if
if LandscapeEightIter=4
if NextGraphic Band 16=16
CurrentGraphic=CurrentGraphic BOR 1
end if
end if
if LandscapeEightIter=5
if NextGraphic Band 32=32
CurrentGraphic=CurrentGraphic BOR 1
end if
end if
if LandscapeEightIter=6
if NextGraphic Band 64=64
CurrentGraphic=CurrentGraphic BOR 1
end if
end if
if LandscapeEightIter=7
if NextGraphic Band 128=128
CurrentGraphic=CurrentGraphic BOR 1
end if
end if
POKE address,CurrentGraphic
end if
address=address+1 'move one square right
next
address=LineStartAddress
address=address+256 'move one line down
LineNumber=LineNumber+1
next
LineNumber=0
LandscapeEightIter=LandscapeEightIter+1
if LandscapeEightIter=8
LandscapeEightIter=0
LandscapeIter=LandscapeIter+1
end if
next
Print "done"
Print STR(178 Band 128)
STOP
but I could never get it done using assembly:
Code: function FASTCALL drawthis() as ubyte
asm
;LD HL,2000
;LD (delayiter),HL
LD HL,16384
;drawvert:
;LD A,31
;LD L,A
;LD (screenwidthiter),A
;drawblokes:
;LD A,(graphic)
;DEC A
;LD (graphic),A
;LD (HL),A
;LD A,(screenwidthiter)
;LD L,A
;DEC A
;LD (screenwidthiter),A
;LD B,A
;INC B
;INC B
;INC B
;djnz drawblokes
;LD A,(screenheightiter)
;LD L,A
;INC H
;DEC A
;LD (screenheightiter),A
;LD B,A
;INC B
;djnz drawvert
LD A,31
LD (screenwidthiter),A
LD A,7
LD (screenheightiter),A
LD HL,60000
LD (delayiter),HL
loop:
LD BC,20000
LD A,7
LD (screenheightiter),A
LD HL,16384
LD (screenaddress),HL
screenvert:
;LD BC,6000
;wait:
;DEC BC
;LD A,B
;Or C
;jp nz,wait
LD (screenaddress),HL
;load landscape number into a
LD HL,data
LD BC,(landscapeiter)
ADD HL,BC
LD A,(HL)
LD (__LABEL__printablevar),A
;load graphic into B
CP 0
jp z,thisisempty
CP 1
jp z,thisisbrick
CP 2
jp z,thisiscrystal
jp thisisbrick
thisisempty:
LD B,0
jp donegraphic
thisisbrick:
LD HL,brick
LD DE,(screenheightiter)
ADD HL,DE
LD B,(HL)
jp donegraphic
thisiscrystal:
LD HL,crystal
LD DE,(screenheightiter)
ADD HL,DE
LD B,(HL)
jp donegraphic
donegraphic:
LD A,0
LD (rightbit),A
LD A,(landscapeiter)
CP 0
jp z,bit0
CP 1
jp z,bit1
CP 2
jp z,bit2
CP 3
jp z,bit3
CP 4
jp z,bit4
CP 5
jp z,bit5
CP 6
jp z,bit6
CP 7
jp z,bit7
bit0:
BIT 0,B
jp nz,setbitfirst
jp z,dontsetbitfirst
bit1:
BIT 1,B
jp nz,setbitfirst
jp z,dontsetbitfirst
bit2:
BIT 2,B
jp nz,setbitfirst
jp z,dontsetbitfirst
bit3:
BIT 3,B
jp nz,setbitfirst
jp z,dontsetbitfirst
bit4:
BIT 4,B
jp nz,setbitfirst
jp z,dontsetbitfirst
bit5:
BIT 5,B
jp nz,setbitfirst
jp z,dontsetbitfirst
bit6:
BIT 6,B
jp nz,setbitfirst
jp z,dontsetbitfirst
bit7:
BIT 7,B
jp z,dontsetbitfirst
jp nz,setbitfirst
setbitfirst:
LD A,1
LD (rightbit),A
dontsetbitfirst:
LD HL,(screenaddress)
LD A,31
LD L,A
LD (screenwidthiter),A
LD (screenaddress),HL
LD A,0
LD (leftbit),A
BIT 7,(HL)
jp nz,dontsetbit
LD A,1
LD (leftbit),A
dontsetbit:
LD A,(HL)
SLA A
LD (HL),A
LD A,(rightbit)
CP 0
jp z, dontsetrightbit
LD A,(HL)
OR 1
LD (HL),A
dontsetrightbit:
LD A,(leftbit)
LD (rightbit),A
LD A,30
LD (screenwidthiter),A
LD L,A
LD (screenaddress),HL
screenhori:
LD A,0
LD (leftbit),A
BIT 7,(HL)
jp nz,dontsetbit3
LD A,1
LD (leftbit),A
dontsetbit3:
LD B,(HL)
SLA B
LD A,(rightbit)
CP 0
jp nz,dontsetblockbit2
LD A,B
OR 1
LD B,A
dontsetblockbit2:
LD (HL),B
LD A,(screenwidthiter)
LD L,A
DEC A
LD (screenwidthiter),A
LD A,(leftbit)
LD (rightbit),A
LD A,(screenwidthiter)
CP 0
jp nz,screenhori
LD A,(screenheightiter)
INC H
DEC A
LD (screenaddress),HL
LD (screenheightiter),A
CP 0
jp nz,screenvert
LD A,(__LABEL__landscapeeightiter)
INC A
LD (__LABEL__landscapeeightiter),A
LD A,(__LABEL__landscapeeightiter)
CP 8
jp nz,dontresetblock
LD A,0
LD (__LABEL__landscapeeightiter),A
LD A,(landscapeiter)
INC A
LD (landscapeiter),A
dontresetblock:
;jp loop
end asm
end function
Dim x as Integer
for x=0 to 31
Print AT 0,x;STR(x)
next
for x=0 to 30
drawthis()
Print AT x,0;STR(PEEK(@printablevar))+"-"
next
Print "done"
STOP:
printablevar:
ASM
defb 255
END ASM
landscapeeightiter:
ASM
defb 0
blockiter:
defw 8
delayiter:
defw 60000
screenwidthiter:
defb 31
screenheightiter:
defb 8
scrolliter:
defw 10000
graphic:
defb 255
screenaddress:
defw 0
landscapeiter:
defb 0
data:
defb 1,1,0,1,1,1,0,1,1,2,2,2,2,0,1,0,1,0,2,2,2,2
brick:
defb 249,249,0,159,159,0,249,249
crystal:
defb 16,40,84,40,84,40,16,0
rightbit:
defb 0
leftbit:
defb 0
DISPNUM:
call 11563 ; We'll push the BC register onto the calculator stack
call 11747 ; and then output that number to the screen by calling this routine
ret
end asm
|
|
|
| trying to print from assembly |
|
Posted by: slenkar - 2013-05-20, 07:38 PM - Forum: How-To & Tutorials
- Replies (3)
|
 |
this doesnt compile because the label is made outside of ASM tags
Code: function FASTCALL drawthis() as ubyte
asm
LD A,(landscapeeightiter)
INC A
LD (landscapeeightiter),A
end asm
end function
for x=0 to 20
drawthis()
Print AT x,0;STR(PEEK(@landscapeeightiter))+"-"
next
STOP
landscapeeightiter:
ASM
defb 100
END ASM
im trying to print the value of the byte at the address, but also modify it in assembly
|
|
|
| Assembly question |
|
Posted by: slenkar - 2013-05-12, 06:00 PM - Forum: Help & Support
- Replies (27)
|
 |
In assembly how do you know where to put data?
like say I wanted some arrays how would I know which address in RAM to place the variables?
Is it possible to access arrays created in zxbasic from assembly? how would I do that
|
|
|
| Version 1.3.0 Released! |
|
Posted by: boriel - 2013-04-29, 01:46 PM - Forum: ZX Basic Compiler
- Replies (6)
|
 |
ZX Basic 1.3.0 is out! Download it here
NOTE: This is revision 1.3.0s1022
If you already have it, you don't need to download it again.
- ! Fixed a bug in USR <string>
- ! Fixed a bug in SAVE / LOAD
- ! Fixed a serious bug in the preprocessor
- ! Fixed a bug with DIM and constants
- ! Fixed a bug with SHL/SHR for 0 shifts
- + Added -D option. ZXBASIC now allows commandline macro definition
- ! Fixed a bug with CODE and INKEY$
- ! Fixed a bug with string slicing assignation (e.g. a$(3) = "x")
- ! Fixed a bug with arrays of integer assignation (e.g. a(3) = 5, being a of Integer type)
- ! Fixed a bug with peephole optimizer (-O3)
- * Some changes and code refactorization towards 2.x branch
...and much much more.
|
|
|
| Did I run out of Ram? |
|
Posted by: slenkar - 2013-04-26, 04:42 PM - Forum: Help & Support
- No Replies
|
 |
my pathfinding function worked fine until recently, now it just crashes the spectrum
my wars.rzx file is 28K
EDIT- my mistake!
I was writing out of bounds to an array
|
|
|
|