Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 349 online users. » 0 Member(s) | 346 Guest(s) Applebot, Bing, Google
|
Latest Threads |
Strange Happenings
Forum: Bug Reports
Last Post: boriel
05-23-2025, 09:15 AM
» Replies: 4
» Views: 1,905
|
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 2,090
|
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 1,774
|
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 4,270
|
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 2,883
|
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 2,762
|
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 1,482
|
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 3,790
|
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 4,746
|
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 1,196
|
|
|
Local 2D Array of strings crash (*solved*) |
Posted by: LTee - 11-16-2010, 03:09 PM - Forum: Bug Reports
- Replies (10)
|
 |
I seem to be having some issues trying to use a 2D array of Strings in some cases, but unfortunately I don't seem to be able to figure out what they are. A piece of code which seems to work fine in isolation fails when I put it into my main program with screen corruption and a crash. Is a 2D array of Strings 'bad form' for some reason?
In the end I replaced it with a 2D array of UBYTEs instead which worked okay (and was probably less wasteful, tbh - I was only storing single characters anyway). If I figure out a decent way to reproduce the crash without it being embedded in a huge chunk of other stuff then I'll post it. It could well be something silly that I've done elsewhere in the program. 
While I'm here, could someone clarify what is okay to declare within a SUB? I don't seem to have any problems declaring normal variables (e.g. DIM test AS UBYTE) within a SUB, but I seem to have crash issues if I try to declare and use an array (e.g. DIM test(2,2) AS UBYTE). Is it actually legal to try and do that?
This code, for example, crashes unless I move the UBYTE array outside of the SUB:
Code: test()
SUB test
DIM xpos as UBYTE
DIM ypos as UBYTE
DIM scrdata(22, 32) AS UBYTE
CLS
FOR ypos = 0 TO 21
FOR xpos = 0 TO 31
scrdata(ypos, xpos) = 65
NEXT xpos
NEXT ypos
PRINT "Done."
PAUSE 0
CLS
FOR ypos = 0 TO 21
FOR xpos = 0 TO 31
PRINT AT ypos, xpos; CHR(scrdata(ypos, xpos))
NEXT xpos
NEXT ypos
END SUB
Sorry if the answer here is obvious, I'm still getting used to how things work.
|
|
|
SEO & Permalinks enabled |
Posted by: boriel - 11-15-2010, 02:03 PM - Forum: News
- No Replies
|
 |
I've enabled SEO and friendly URLS (a.k.a. permalinks) in this forum. Please, report any web error (e.g. 404 - Not found) here or in a private message.
Thank you, and sorry for any inconvenience.
|
|
|
Spam on this forum |
Posted by: boriel - 11-05-2010, 11:02 PM - Forum: News
- No Replies
|
 |
This forum has recently being attacked by spammers. We're trying to fix this. Sorry for any inconvenience. :|
|
|
|
Randomize does not change the Seed (*solved*) |
Posted by: LCD - 08-16-2010, 02:24 PM - Forum: Bug Reports
- Replies (3)
|
 |
Another bug i discovered in the latest dev version is that RANDOMIZE does not change the seed.
I got exactly the same RND numbers with RANDOMIZE 0 as with RANDOMIZE 1 or even RANDOMIZE (without number, after a pause 0 to avoid the fact that the emulator always starts with frame count 0 and uses it as Seed.
Here is the evidence:
Code: print "Actual Seed: ";peek (uinteger,23670)
randomize 45
print "Seed after Random 45: ";peek (uinteger,23670)
randomize 37
print "Seed after Random 37: ";peek (uinteger,23670)
randomize
print "Randomized seed: ";peek (uinteger,23670)
There is a way around it:
Code: poke uinteger 23670,peek (uinteger,23672)
This does not rely on RANDOMIZE, it just copies two bytes from frames sysvar to seed sysvar, and gives you every time you start a program, new RND sequence (After a PAUSE 0 or selecting controls).
|
|
|
Screen corruption & possible crash (*solved*) |
Posted by: LCD - 08-15-2010, 02:43 PM - Forum: Bug Reports
- Replies (10)
|
 |
I wrote a function to transform Speccy frames to a timer:
Code: function Clock(tim as uinteger) as String
dim secs as Uinteger
dim mins,sec as ubyte
dim s$ as String
s$=""
secs=int(tim/50)
mins=int(secs/60)
sec=secs mod 60
s$=str(sec)
if len(s$)=1 then
s$="0"+s$
end if
return str(mins)+":"+s$
end function
dim a as uinteger
for a=0 to 1000
print at 0,0;Clock(a)
next a
After calling it often (it shows effect around timecode 0:08), there was a screen memory corruption. In my full program the timer was still working, but the keys did not work anymore, and after that, even the minute display was corrupted. Maybe a overflow?
Reducing the Heap size from default to 100 caused no corrupted screen memory, but a complete crash.
Oh, and I'm using the latest devel version.
Edit:
It looks like there is a leak in the STR function, as without STR my program does not crash after a while.
|
|
|
pos.bas (*solved*) |
Posted by: britlion - 07-31-2010, 07:49 PM - Forum: Bug Reports
- Replies (11)
|
 |
Code: #include <input.bas>
Drops the following error:
pos.bas:17: Error: syntax error. Unexpected token 'case_insensitive'
Obviously this happens with anything else that includes pos.bas as well, like #include <sinclair.bas>
|
|
|
Updates |
Posted by: britlion - 07-21-2010, 02:36 AM - Forum: Documentation
- No Replies
|
 |
I inserted documentation for
INK
PAPER
BORDER
INVERSE
BOLD
ITALIC
I added (Library Function) Input to the list, and changed CSRLIN and POS into versions that show they are (Library Functions) not inherently reserved words.
I then added INPUT and INKEY.
|
|
|
No INPUT? |
Posted by: ref - 07-18-2010, 10:52 AM - Forum: Help & Support
- Replies (7)
|
 |
hi there,
There is no "INPUT" keyword in the ZXBASIC's list, so I guess it's not implemented. However, I got no error on compiler output about "input" (if I use it) yet it does not compile the program. I tried "input a" and it gives "Syntax Error. Unexpected token 'a' <ID>" and does not complain about input. Whatever, there is no documentation on input, or I couldn't be able to locate where it is.
So, what is the equivalent of sinclair basic "INPUT" command? I just need to ask an user to type a name or number, do I need to program whole input funciton with inkey(undocumented) and print, or there is an easy way to do it?
|
|
|
Does it suck? |
Posted by: britlion - 07-17-2010, 10:59 PM - Forum: How-To & Tutorials
- Replies (3)
|
 |
Not as smooth as I'd like. *chuckle* But then, it is running on a spectrum..
<!-- m --><a class="postlink" href="http://dl.dropbox.com/u/4903664/DieRoller.z80">http://dl.dropbox.com/u/4903664/DieRoller.z80</a><!-- m -->
I think it shows what is possible with a few lines of basic (and some graphics, and some spritey type routines. Note that I wrote YET ANOTHER putblock routine - this goes across the whole sprite, then down a row. No attributes, and optimized for 32*32 bit character based sprites.
Code: SUB dieSound()
DIM n as uByte
FOR n=1 to 2
BEEP rnd/600,9
BEEP rnd/100,(-14-(rnd*5))
PAUSE 1
NEXT n
END SUB
SUB putChars(x as uByte,y as uByte, dataAddress as uInteger)
asm
BLPutChar:
LD a,(IX+5)
ld l,a
ld a,(IX+7)
LD b,a ; save it
AND 24
add a,64 ; 256 byte "page" for screen - 256*64=16384. Change this if you are working with a screen address elsewhere, such as a buffer.
ld h,a
ld a,b ; y value
AND 7
rrca
rrca
rrca
OR l
ld l,a
EX DE,HL
PUSH DE ; save our address
LD L,(IX+8) ; data address
LD H,(IX+9)
EX AF,AF'
LD A,4 ;row counter
EX AF,AF'
BLPutCharLoop:
LD B,8
BLPutCharOneCharLoop:
XOR A; LD A,0
LD C,A
; gets screen address in DE, and bytes address in HL. Copies the row to the screen
LDI ; also decrements B.
LDI
LDI
LDI ; 4 bytes copied.
LD A,C
ADD A,E ;(A should be -4)
LD E,A
INC D
LD A,B
OR A
JP NZ,BLPutCharOneCharLoop
EX AF,AF'
DEC A
JR Z, BLPutCharsEnd ; We've done all 4 rows.
EX AF,AF'
;need to sort our screen address for the next row. Is it right?
LD A,E ; DE has screen address
ADD A,32 ; down to next character
LD E,A
JR C, BLPutCharsCont ; Not in next third.
LD A,D
SUB 8
LD D,A
BLPutCharsCont:
JP BLPutCharLoop
BLPutCharsEnd:
end asm
END SUB
SUB graphicsData()
RETURN
dice:
ASM
; Name : Dice
; Frame : 0
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Dice000:
asm
; pixels and mask bit pairs
defb 1, 83, 48, 0
defb 3, 83, 14, 0
defb 6, 200, 67, 0
defb 4, 200, 97, 128
defb 12, 136, 96, 96
defb 8, 4, 32, 24
defb 24, 4, 8, 4
defb 16, 4, 140, 4
defb 16, 2, 14, 4
defb 32, 7, 3, 0
defb 64, 12, 64, 2
defb 64, 8, 96, 2
defb 128, 24, 24, 2
defb 128, 18, 6, 96
defb 0, 51, 1, 249
defb 128, 35, 192, 241
defb 128, 67, 128, 57
defb 64, 192, 0, 12
defb 0, 128, 0, 7
defb 68, 158, 0, 33
defb 71, 30, 0, 241
defb 47, 30, 0, 113
defb 14, 8, 0, 243
defb 44, 0, 0, 2
defb 52, 240, 1, 4
defb 24, 240, 7, 136
defb 24, 240, 7, 136
defb 8, 64, 7, 144
defb 6, 0, 0, 0
defb 3, 0, 0, 32
defb 0, 192, 28, 64
defb 0, 112, 60, 64
; Name : Dice
; Frame : 1
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Dice001:
asm
; pixels and mask bit pairs
defb 0, 28, 194, 128
defb 0, 49, 194, 128
defb 0, 193, 19, 64
defb 1, 128, 19, 32
defb 14, 0, 5, 32
defb 57, 0, 4, 16
defb 71, 16, 40, 24
defb 183, 48, 32, 8
defb 44, 115, 16, 12
defb 0, 199, 240, 4
defb 0, 15, 48, 130
defb 64, 6, 17, 195
defb 64, 56, 24, 193
defb 4, 225, 72, 193
defb 25, 129, 204, 64
defb 191, 3, 196, 1
defb 188, 33, 194, 1
defb 48, 120, 2, 2
defb 224, 120, 1, 64
defb 132, 120, 1, 98
defb 143, 0, 0, 226
defb 142, 0, 0, 228
defb 207, 0, 0, 96
defb 64, 0, 0, 36
defb 32, 0, 15, 44
defb 48, 0, 15, 24
defb 16, 0, 15, 24
defb 8, 1, 226, 24
defb 8, 1, 224, 120
defb 4, 1, 224, 224
defb 2, 56, 67, 128
defb 2, 60, 12, 0
; Name : Dice
; Frame : 2
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Dice002:
asm
; pixels and mask bit pairs
defb 255, 255, 252, 0
defb 192, 0, 2, 0
defb 167, 128, 121, 0
defb 147, 192, 60, 128
defb 136, 0, 0, 64
defb 164, 3, 192, 32
defb 178, 1, 224, 16
defb 177, 0, 0, 8
defb 176, 158, 3, 196
defb 144, 79, 1, 226
defb 128, 63, 255, 255
defb 128, 160, 0, 1
defb 128, 224, 0, 1
defb 128, 227, 12, 49
defb 128, 231, 158, 121
defb 128, 103, 158, 121
defb 128, 35, 12, 49
defb 160, 32, 0, 1
defb 176, 32, 0, 1
defb 176, 32, 0, 1
defb 176, 32, 0, 1
defb 144, 32, 0, 1
defb 64, 32, 0, 1
defb 32, 160, 0, 1
defb 16, 224, 0, 1
defb 8, 227, 12, 49
defb 4, 231, 158, 121
defb 2, 103, 158, 121
defb 1, 35, 12, 49
defb 0, 160, 0, 1
defb 0, 96, 0, 1
defb 0, 63, 255, 255
; Name : Dice
; Frame : 3
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Dice003:
asm
; pixels and mask bit pairs
defb 0, 1, 184, 0
defb 0, 26, 14, 0
defb 1, 160, 243, 128
defb 15, 0, 121, 192
defb 30, 224, 16, 112
defb 17, 248, 0, 28
defb 48, 112, 120, 6
defb 32, 52, 60, 131
defb 71, 14, 8, 28
defb 207, 3, 128, 15
defb 135, 0, 220, 0
defb 135, 56, 126, 0
defb 0, 120, 28, 12
defb 0, 56, 6, 192
defb 0, 57, 226, 11
defb 0, 1, 194, 115
defb 0, 1, 230, 22
defb 0, 0, 140, 0
defb 128, 0, 12, 1
defb 192, 0, 16, 1
defb 192, 0, 17, 195
defb 206, 0, 33, 130
defb 14, 0, 35, 4
defb 15, 0, 66, 12
defb 14, 112, 192, 8
defb 192, 112, 224, 24
defb 32, 121, 224, 16
defb 8, 113, 192, 48
defb 6, 3, 64, 160
defb 1, 6, 1, 160
defb 0, 196, 24, 0
defb 0, 125, 128, 0
; Name : Dice
; Frame : 4
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Dice004:
asm
; pixels and mask bit pairs
defb 0, 125, 128, 96
defb 1, 196, 24, 32
defb 3, 7, 129, 160
defb 6, 3, 192, 176
defb 24, 113, 193, 48
defb 32, 121, 161, 216
defb 192, 112, 128, 216
defb 0, 80, 192, 232
defb 0, 0, 98, 12
defb 0, 14, 35, 4
defb 192, 15, 49, 130
defb 192, 14, 17, 195
defb 192, 14, 20, 1
defb 128, 0, 14, 1
defb 0, 0, 143, 0
defb 56, 1, 231, 6
defb 56, 1, 194, 3
defb 120, 1, 226, 3
defb 56, 0, 6, 192
defb 0, 0, 28, 40
defb 135, 0, 112, 24
defb 135, 0, 192, 4
defb 207, 3, 0, 15
defb 71, 12, 8, 28
defb 96, 48, 60, 3
defb 48, 124, 120, 6
defb 49, 248, 0, 28
defb 14, 0, 0, 112
defb 15, 0, 1, 192
defb 1, 160, 3, 128
defb 0, 26, 14, 0
defb 0, 1, 184, 0
; Name : Die1
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Die1:
asm
; pixels and mask bit pairs
defb 255, 255, 252, 0
defb 192, 0, 2, 0
defb 160, 0, 1, 0
defb 144, 0, 0, 128
defb 136, 0, 0, 64
defb 164, 3, 192, 32
defb 178, 1, 224, 16
defb 177, 0, 0, 8
defb 176, 128, 0, 4
defb 144, 64, 0, 2
defb 128, 63, 255, 255
defb 128, 32, 0, 1
defb 128, 32, 0, 1
defb 128, 35, 0, 49
defb 132, 39, 128, 121
defb 134, 39, 128, 121
defb 134, 35, 0, 49
defb 134, 32, 0, 1
defb 130, 32, 0, 1
defb 128, 32, 12, 1
defb 128, 32, 30, 1
defb 128, 32, 30, 1
defb 64, 32, 12, 1
defb 32, 160, 0, 1
defb 16, 224, 0, 1
defb 8, 227, 0, 49
defb 4, 231, 128, 121
defb 2, 103, 128, 121
defb 1, 35, 0, 49
defb 0, 160, 0, 1
defb 0, 96, 0, 1
defb 0, 63, 255, 255
; Name : Die2
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Die2:
asm
; pixels and mask bit pairs
defb 255, 255, 252, 0
defb 192, 0, 2, 0
defb 167, 128, 1, 0
defb 147, 192, 0, 128
defb 136, 0, 0, 64
defb 164, 0, 0, 32
defb 178, 0, 0, 16
defb 177, 0, 0, 8
defb 176, 128, 3, 196
defb 144, 64, 1, 226
defb 128, 63, 255, 255
defb 160, 160, 0, 1
defb 176, 224, 0, 1
defb 176, 227, 0, 49
defb 176, 231, 128, 121
defb 144, 103, 128, 121
defb 128, 35, 0, 49
defb 160, 160, 0, 1
defb 176, 224, 0, 1
defb 176, 224, 0, 1
defb 176, 224, 0, 1
defb 144, 96, 0, 1
defb 64, 32, 0, 1
defb 32, 160, 0, 1
defb 16, 224, 0, 1
defb 8, 227, 0, 49
defb 4, 231, 128, 121
defb 2, 103, 128, 121
defb 1, 35, 0, 49
defb 0, 160, 0, 1
defb 0, 96, 0, 1
defb 0, 63, 255, 255
; Name : Die3
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Die3:
asm
; pixels and mask bit pairs
defb 255, 255, 252, 0
defb 192, 0, 2, 0
defb 167, 128, 1, 0
defb 147, 192, 0, 128
defb 136, 0, 0, 64
defb 164, 3, 192, 32
defb 178, 1, 224, 16
defb 177, 0, 0, 8
defb 176, 128, 1, 228
defb 144, 64, 0, 242
defb 128, 63, 255, 255
defb 128, 160, 0, 1
defb 128, 224, 0, 1
defb 128, 224, 0, 1
defb 132, 224, 0, 1
defb 134, 96, 0, 1
defb 134, 32, 0, 1
defb 166, 32, 0, 1
defb 178, 32, 0, 1
defb 176, 32, 12, 1
defb 176, 32, 30, 1
defb 144, 32, 30, 1
defb 64, 32, 12, 1
defb 32, 160, 0, 1
defb 16, 224, 0, 1
defb 8, 224, 0, 1
defb 4, 224, 0, 1
defb 2, 96, 0, 1
defb 1, 32, 0, 1
defb 0, 160, 0, 1
defb 0, 96, 0, 1
defb 0, 63, 255, 255
; Name : Die4
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Die4:
asm
; pixels and mask bit pairs
defb 255, 255, 252, 0
defb 192, 0, 2, 0
defb 167, 128, 121, 0
defb 147, 192, 60, 128
defb 136, 0, 0, 64
defb 164, 0, 0, 32
defb 178, 0, 0, 16
defb 177, 0, 0, 8
defb 176, 158, 3, 196
defb 144, 79, 1, 226
defb 128, 63, 255, 255
defb 160, 160, 0, 1
defb 176, 224, 0, 1
defb 176, 227, 0, 1
defb 176, 231, 128, 1
defb 144, 103, 128, 1
defb 128, 35, 0, 1
defb 160, 160, 0, 1
defb 176, 224, 0, 1
defb 176, 224, 0, 1
defb 176, 224, 0, 1
defb 144, 96, 0, 1
defb 64, 32, 0, 1
defb 32, 160, 0, 1
defb 16, 224, 0, 1
defb 8, 224, 0, 49
defb 4, 224, 0, 121
defb 2, 96, 0, 121
defb 1, 32, 0, 49
defb 0, 160, 0, 1
defb 0, 96, 0, 1
defb 0, 63, 255, 255
; Name : Die5
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Die5:
asm
; pixels and mask bit pairs
defb 255, 255, 252, 0
defb 192, 0, 2, 0
defb 167, 128, 121, 0
defb 147, 192, 60, 128
defb 136, 0, 0, 64
defb 132, 3, 192, 32
defb 130, 1, 224, 16
defb 129, 0, 0, 8
defb 128, 158, 3, 196
defb 128, 79, 1, 226
defb 128, 63, 255, 255
defb 128, 32, 0, 1
defb 128, 32, 0, 1
defb 128, 35, 0, 1
defb 132, 39, 128, 1
defb 134, 39, 128, 1
defb 134, 35, 0, 1
defb 134, 32, 0, 1
defb 130, 32, 0, 1
defb 128, 32, 12, 1
defb 128, 32, 30, 1
defb 128, 32, 30, 1
defb 64, 32, 12, 1
defb 32, 32, 0, 1
defb 16, 32, 0, 1
defb 8, 32, 0, 49
defb 4, 32, 0, 121
defb 2, 32, 0, 121
defb 1, 32, 0, 49
defb 0, 160, 0, 1
defb 0, 96, 0, 1
defb 0, 63, 255, 255
; Name : Die6
; Size : 32x32
; Palette: ZX Spectrum
; Masked : No
; RowOrder: Classic
end asm
Die6:
asm
; pixels and mask bit pairs
defb 255, 255, 252, 0
defb 192, 0, 2, 0
defb 167, 128, 121, 0
defb 147, 192, 60, 128
defb 136, 0, 0, 64
defb 164, 240, 15, 32
defb 178, 120, 7, 144
defb 177, 0, 0, 8
defb 176, 158, 3, 196
defb 144, 79, 1, 226
defb 128, 63, 255, 255
defb 128, 160, 0, 1
defb 128, 224, 0, 1
defb 128, 227, 0, 49
defb 128, 231, 128, 121
defb 128, 103, 128, 121
defb 128, 35, 0, 49
defb 160, 32, 0, 1
defb 176, 32, 0, 1
defb 176, 32, 12, 1
defb 176, 32, 30, 1
defb 144, 32, 30, 1
defb 64, 32, 12, 1
defb 32, 160, 0, 1
defb 16, 224, 0, 1
defb 8, 227, 0, 49
defb 4, 231, 128, 121
defb 2, 103, 128, 121
defb 1, 35, 0, 49
defb 0, 160, 0, 1
defb 0, 96, 0, 1
defb 0, 63, 255, 255
end asm
blank:
asm
blank:
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
defb 0, 0, 0, 0
END ASM
END SUB
REM Initialize Everything
graphicsData()
DIM diceFrames(3) AS uInteger
diceFrames(0)=@Dice000
diceFrames(1)=@Dice001
diceFrames(2)=@Dice002
diceFrames(3)=@Dice003
DIM diceSprites(5) AS uInteger
diceSprites(0)=@Die1
diceSprites(1)=@Die2
diceSprites(2)=@Die3
diceSprites(3)=@Die4
diceSprites(4)=@Die5
diceSprites(5)=@Die6
FUNCTION rollDice(x as uByte, y as uByte) as uByte
DIM roll,frames,i as uByte
roll = INT(RND*6) : REM Rolls 0-5 for animation.
frames=INT(rnd*6)+4
FOR i=1 to frames
dieSound()
asm
HALT
end asm
IF(x+i)<>0 then putChars(x+i-1,y,@blank) : END IF
IF i MOD 5 =0 then putChars(x+i,y,diceSprites(rnd*6))
ELSE putChars(x+i,y,diceFrames((i mod 5)-1))
END IF
NEXT i
PAUSE 1
putChars(x+i-1,y,@blank)
putChars(x+i,y,diceSprites(roll))
return roll+1
END FUNCTION
print rollDice(0,0)
print rollDice(15,0)
|
|
|
Array of addresses |
Posted by: britlion - 07-17-2010, 09:45 PM - Forum: Bug Reports
- Replies (2)
|
 |
I'm trying to make an array of sprite pointers.
The compiler doesn't seem to like
Code: DIM Sprites(5) AS uInteger => {@sprite1,@sprite2,@sprite3,@sprite4,@sprite5,@sprite6}
And I'm not quite sure why. It reports the error: Initializer expression is not constant. - and I beg to differ. I thought @label WAS a constant?
|
|
|
|