The following warnings occurred:
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval
Warning [2] Undefined array key "attachments" - Line: 20 - File: portal.php(680) : eval()'d code PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/portal.php(680) : eval()'d code 20 errorHandler->error_callback
/portal.php 680 eval




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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 277
» Latest member: Elemento26
» Forum threads: 1,087
» Forum posts: 6,490

Full Statistics

Online Users
There are currently 105 online users.
» 0 Member(s) | 103 Guest(s)
Applebot, Google

Latest Threads
GuSprites
Forum: Help & Support
Last Post: zedex82
2026-06-19, 06:39 PM
» Replies: 2
» Views: 355
New video Couse / Nuevo c...
Forum: News
Last Post: Duefectu
2026-04-29, 11:02 PM
» Replies: 0
» Views: 2,699
location of heap manageme...
Forum: Help & Support
Last Post: boriel
2026-03-07, 12:13 AM
» Replies: 1
» Views: 745
non-paged supervisor code...
Forum: Help & Support
Last Post: sdo303
2026-02-20, 06:38 PM
» Replies: 8
» Views: 1,848
How to open fuse as an ex...
Forum: How-To & Tutorials
Last Post: Duefectu
2026-02-09, 01:52 PM
» Replies: 3
» Views: 1,743
Old zxbasic game errors
Forum: Help & Support
Last Post: boriel
2025-11-09, 11:52 AM
» Replies: 7
» Views: 2,538
Error: Undefined GLOBAL l...
Forum: Help & Support
Last Post: ardentcrest
2025-11-04, 05:46 PM
» Replies: 3
» Views: 1,396
A Fast(er) Plot Routine f...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-30, 03:16 PM
» Replies: 2
» Views: 1,479
Hall of Fame - Include fo...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-28, 03:48 PM
» Replies: 0
» Views: 819
[SOLVED] Array layout bug...
Forum: Bug Reports
Last Post: Zoran
2025-10-25, 05:48 PM
» Replies: 2
» Views: 1,539

 
  Labels as byte values in inline assembly
Posted by: britlion - 2011-03-13, 02:47 PM - Forum: Help & Support - Replies (3)

If I had code that wanted to make a jump table, and still be able to compile it such that it can move around, how can I do this?

That is, I want something like

jump_table:
defb routine1
defb routine2
defb routine3


routine1:
<code>
ret

routine2:
<code>


routine3:
<code>


The design calls for a jp (hl). I could probably code around it, but I'm wondering how I could get label locations into the actual bytes compiled?

Print this item

  Bug or Feature?
Posted by: LCD - 2011-03-10, 06:39 PM - Forum: Help & Support - Replies (8)

Hi Boriel, I ran into following Problem:

Code:
print at 17,0;(peek 3)*9
gives me back 247. Why is this a Problem? PEEK 3 is 255, so (PEEK 3)*9 should be calculated as 255*9=2295, so it looks like the result of this calculation is stored in UBYTE. No problem because PEEK gives back UBYTE, but a multiplication is a little bit more problematic.
Code:
dim c1 as uinteger c1=peek(adr) print c1*9
Works, but
Code:
dim c1 as ubyte c1=peek(adr) print c1*9
does not work. The same if I use such a calculation as Parameter for a sub.
Any chance to fix this?

Another Problem:
Code:
print at 17,0;1<<3+2
Usually bit shifting should have the highest poriority, not the addition, thats why the result is 1<<(3+2)=32, but it should be (1<<3)+2=10.

Print this item

  Possible String issue? (*solved*)
Posted by: LTee - 2011-03-10, 02:44 PM - Forum: Bug Reports - Replies (21)

I don't know whether this is expected behaviour or not because of the way Strings are stored, but my high score routine just presented this issue so I thought I'd check before I changed how it works. :-)

If I declare a string outside of a sub I can use it within any sub. If I change the value within the sub then that's fine, unless I make it equal to another String which was declared within that sub. If I do that, the value of the first string becomes blank as soon as the sub ends.

This is kind of hard to explain, so see this example:

Code:
dim testglobal as string cls testglobal = "global" print testglobal setlocal() print testglobal print "done" sub setlocal dim testlocal as string testlocal = "local" testglobal = testlocal print testlocal print testglobal end sub
The output from this is:
Code:
global local local done
During the sub the value of testglobal is "local". Once the sub ends, it becomes blank.

I think I would be better off using a function for this kind of thing rather than a sub, but I just thought it was worth checking whether that behaviour was expected or not.

Print this item

  New beta release 1.2.8r2153
Posted by: boriel - 2011-03-10, 12:05 AM - Forum: Bug Reports - Replies (3)

Okay, this is a new beta release. It fixes several *CRITICAL* bugs found mainly by LTee.
Please, download here: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive#Latest_Development_Version">http://www.boriel.com/wiki/en/index.php ... nt_Version</a><!-- m -->

Version 1.2.7 should not be used (It will be soon removed from the download archive).

Print this item

  Netbook dont run zxb.exe (*solved*)
Posted by: compiuter - 2011-03-09, 09:16 PM - Forum: Bug Reports - Replies (22)

Under win xp my netbook do not run zxb executable file.
It is the first time I have this problem.
Perhaps due to core changes?

Print this item

  HOW MUCH MEMORY? ARRAY STRING
Posted by: JBGV - 2011-03-09, 12:08 PM - Forum: Help & Support - Replies (1)

Hola, I speak English like Tarzan, sorry to write in Spanish: (And an attempt in English with google translator :oops: )


Tengo un par de dudas:

Creo recordar que cuando declarábamos una matriz alfanumérica DIM a$(10) sin especificar el tamaño, automáticvamente se reservaba en memoria espacio suficiente para cadenas de 255 caracteres para cada uno de los elementos de la matriz. Eso era un gasto de memoria muy caro, sobre todo para los que no sabemos programar y desperdiciamos memoria en cada línea Cry , por eso limitábamos el tamaño mediante DIM a$(10,20) (por ejemplo) para limitar el tamaño de cada elemento a 20 caracteres.

Usando el compilador la instrucción DIM a$ (10,20) no limita el tamaño de cada elemento ,sino que crea una matriz alfanumerica de 10x20.

La duda es si al declarar la matriz DIM a$(n) AS STRING se está reservando memoria para cadenas de 255 caracteres en los n elementos.

El juego que estaba haciendo empezó hacer cosas raras, hasta que me di cuenta que el problema debia ser la falta de memoria (al eliminar arrays de texto el juego volvia a funcionar), ¿como puedo saber cuanta memoria he gastado?, lei que lo que ocupaba el archivo TZX era mas o menos lo que ocupaba el programa, eso es asi?.

--------------

I have a couple of questions:

I remember that when we declared an array alphanumeric DIM a $ (10) without specifying the size, automáticvamente reserved memory space for strings of 255 characters for each of the elements of the matrix. That was a very expensive cost of memory, especially for those who do not know programming and wasted memory on each line Cry , so we just kept the size by DIM a $ (10.20) (for example) to limit the size of each item to 20 characters.

Using the compiler instruction DIM to $ (10,20) does not limit the size of each element, but creates an alphanumeric matrix of 10x20.

The question is whether to declare the array DIM a $ (n) AS STRING is allocate memory for strings of 255 characters in the n elements.

The game was getting started doing strange things, until I realized that the problem was to be the lack of memory (to delete arrays of text the game was returning to work), how I can know how much memory I have spent?, I read that occupied the TZX file more or less what was occupied by the program, it is so?.

Print this item

  "Illegal Preprocessor" errors on some files (*solved*)
Posted by: LTee - 2011-03-07, 10:11 AM - Forum: Bug Reports - Replies (9)

For the 1.2.8 test I recompiled all the sources I have kicking around and discovered that a couple won't compile any more. Specifically these are ones containing ASM sections with comments, and they throw an "illegal preprocessor character" error. Curiously the line numbers of the errors don't seem to help much, they seem to point to lines which are blank or ones which don't actually have the character that the preprocessor is complaining about.

This isn't a regression in 1.2.8, by the way - I checked them with 1.2.7 as well and the same problem happens there. Guess I didn't recompile my entire collection of source for a while. :-)

I've included one of the files in full, because I didn't write them so I'm not sure how to cut them down. Apologies. If you need the other one as well then let me know.

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)

On a possibly-related note, I've discovered that Print42.bas no longer compiles in 1.2.7/1.2.8. That gives the following error:
Code:
Print42.bas:390: Error: Syntax error. Unexpected token 'DEFB' [DEFB]

Print this item

  Collision attr routine.
Posted by: compiuter - 2011-03-06, 11:50 PM - Forum: Wishlist - Replies (7)

I was thinking about any routines that get attr positions up, right, down and left for one character of x,y position.
-p-
qAr
-s-
And the same for a tile
-pq-
rABt
sCDu
-vw-
and poke those valours into printer buffer or into a variable address, etc.
I'm tired for repeat the same sentences IF ATTR in basic listing cause is a heavy job.
I have no time now, but if someone has free time for this and they want...
I think this can be a library called e.g. ATTTR.bas or ATTTR.asm
Thx.

Print this item

  New beta release 1.2.8r2121
Posted by: boriel - 2011-03-06, 03:08 PM - Forum: Bug Reports - Replies (1)

Okay, this starts a new life cicle. Release 1.2.8x
At the moment it's just like 1.2.7 but with some code refactoring (no new features). Test is needed as it should behave exactly the same as previous versions (currently more than 40 tests proves so).

Download here:
<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive#Latest_Development_Version">http://www.boriel.com/wiki/en/index.php ... nt_Version</a><!-- m -->

Print this item

  Optimiser -o3 bug found (*solved*)
Posted by: LCD - 2011-03-04, 09:39 PM - Forum: Bug Reports - Replies (4)

Hi Boriel,

I have found a bug with -o3 optimiser (-o2 works well)
In following code (not fully finished yet) in -o3 mode not all chess Figures are displayed. The figures are named in german as they are just placeholders for graphics that will be added later.

Oh, just noticed that also the binary operator shortcuts (|, &, ...) are not working too (yet).

Code:
' Blind King (c) 2010 By LCD, written using BorIDE and ZXBC FUNCTION attrAddress(x as uByte, y as uByte) as uInteger ';; This function returns the memory address of the Character Position ';; x,y in the attribute screen memory. ';; Adapted from code by Jonathan Cauldwell - Adapted for ZX BASiC by Britlion from Na_TH_AN's fourspriter asm ld a,(IX+7) ;ypos rrca rrca rrca ;' Multiply by 32 ld l,a ;' Pass to L and 3 ;' Mask with 00000011 add a,88 ;' 88 * 256 = 22528 - start of attributes. ld h,a ;' Put it in the High Byte ld a,l ;' We get y value *32 and 224 ;' Mask with 11100000 ld l,a ;' Put it in L ld a,(IX+5) ;' xpos add a,l ;' Add it to the Low byte ld l,a ;' Put it back in L, and we're done. HL=Address. end asm END FUNCTION FUNCTION scrAddress(x as uByte, y as uByte) as Uinteger asm ;' This fn returns the address into HL of the screen address ;' x,y in character grid notation. ;' Original code was extracted by BloodBaz - Adapted for ZX BASiC by Britlion from Na_TH_AN's fourspriter ; x Arrives in A, y is in stack. and 31 ld l,a ld a,(IX+7) ; Y value ld d,a and 24 add a,64 ld h,a ld a,d and 7 rrca rrca rrca or l ld l,a end asm END FUNCTION sub putblock(x as Ubyte,y as ubyte,wid as ubyte,hgt as ubyte,adr as Uinteger) dim scr,attribute as Uinteger dim x1,y1 as Ubyte dim a as Ubyte poke uinteger @putblock1+7,wid poke uinteger @putblock2+7,wid for y1=0 to hgt-1 scr=scrAddress(x,y+y1) for a=0 to 7 poke uinteger @putblock1+1,adr poke uinteger @putblock1+4,scr putblock1: asm ld hl,1 ld de,2 ld bc,3 ldir end asm adr=adr+wid scr=scr+256 next a next y1 attribute=attrAddress(x,y) for y1=0 to hgt-1 poke uinteger @putblock2+1,adr poke uinteger @putblock2+4,attribute adr=adr+wid attribute=attribute+32 putblock2: asm ld hl,4 ld de,5 ld bc,6 ldir end asm next y1 End sub function ScanField(x as integer,y as integer,mask as ubyte) as ubyte if x>=0 and x<8 and y>=0 and y<8 then adr=@overlay+(y<<3)+x return peek adr band mask Else return 0 end if end function sub SetField(x as uinteger,y as uinteger,fig as ubyte) dim adr as uinteger adr=@overlay+(y<<3)+x poke adr,(peek adr) bor fig end sub function ScanDiagonal(x as ubyte,y as ubyte) as ubyte dim dist,found,d1,d2,d3,d4 as ubyte while found=0 end while 'This scans diagonal fields from x,y until figure or end of field for queen or bishop end Function function ScanStraight(x as ubyte,y as ubyte) as ubyte 'This scans straight fields until figure or end of field for queen or rook end Function function ScanNear(x as ubyte,y as ubyte) as ubyte 'This scans next fields of x,y until figure for king or pawn dim result as ubyte if ScanField(x-1,y-1,7)=1 or ScanField(x+1,y-1,7)=1 then result=1:end if if ScanField(x-1,y-1,7)=6 or ScanField(x,y-1,7)=6 or ScanField(x+1,y-1,7)=6 or ScanField(x-1,y,7)=6 or ScanField(x+1,y,7)=6 or ScanField(x-1,y+1,7)=6 or ScanField(x,y+1,7)=6 or ScanField(x+1,y+1,7)=6 then result=result bor 32:end if return result end Function function ScanKnight(x as ubyte,y as ubyte) as ubyte 'This scans field x,y if attacked by knight dim result as ubyte if ScanField(x-1,y-2,7)=3 or ScanField(x+1,y-2,7)=3 or ScanField(x-1,y+2,7)=3 or ScanField(x+1,y+2,7)=3 or ScanField(x-2,y-1,7)=3 or ScanField(x+2,y-1,7)=3 or ScanField(x-2,y+1,7)=3 or ScanField(x+2,y+1,7)=3 then result=3:end if return result end Function function ScanFields(x as ubyte,y as ubyte) as ubyte 'This scans all fields, first: diagonal for queen or bishop until figure or end of field print at 0,24;ScanNear(x,y);" "; print at 1,24;ScanKnight(x,y);" "; end Function paper 0:ink 6:bright 1:flash 0:border 2:cls 'print at 0,0;"\{i7}\{p1}Blind King 2010 By LCD" dim x,y,x1,y1,col,a,left,posx,posy as ubyte dim scr,adr as uinteger print at 23,0;"Press any key to start battle" pause 0 randomize cls adr=@chessboard for y=0 to 7 for x=0 to 7 col=peek(adr) for y1=0 to 2 scr=attrAddress(x*3,y*3+y1) poke scr,col:poke scr+1,col:poke scr+2,col next y1 adr=adr+1 next x next y ' Setup field left=8 'Bauern while left>0 x=int(rnd*7.9999) y=int(rnd*6.9999) if ScanField(x,y,7)=0 then SetField(x,y,1) left=left-1 end If end while left=2 'Türme while left>0 x=int(rnd*7.9999) y=int(rnd*6.9999) if ScanField(x,y,7)=0 then SetField(x,y,2) left=left-1 end If end while left=2 'Springer while left>0 x=int(rnd*7.9999) y=int(rnd*6.9999) if ScanField(x,y,7)=0 then SetField(x,y,3) left=left-1 end If end while left=2 'Läufer while left>0 x=int(rnd*7.9999) y=int(rnd*6.9999) if ScanField(x,y,7)=0 then SetField(x,y,4) left=left-1 end If end while left=1 'Dame while left>0 x=int(rnd*7.9999) y=int(rnd*6.9999) if ScanField(x,y,7)=0 then SetField(x,y,5) left=left-1 end If end while left=1 'König while left>0 x=int(rnd*7.9999) y=int(rnd*6.9999) if ScanField(x,y,7)=0 then SetField(x,y,6) left=left-1 end If end while ' Display field (test) for y=0 to 7 for x=0 to 7 a=ScanField(x,y,7) x1=x*3+1 y1=y*3+1 if a=1 then print at y1,x1;"B";:end If if a=2 then print at y1,x1;"T";:end If if a=3 then print at y1,x1;"S";:end If if a=4 then print at y1,x1;"L";:end If if a=5 then print at y1,x1;"D";:end If if a=6 then print at y1,x1;"K";:end If next x next y posx=7:posy=7 Mainloop: x1=posx*3+1 y1=posy*3+1 print at y1,x1;"F"; if inkey$="o" and posx>0 then print at y1,x1;" ";:posx=posx-1:ScanFields(posx,posy):end if if inkey$="p" and posx<7 then print at y1,x1;" ";:posx=posx+1:ScanFields(posx,posy):end if if inkey$="q" and posy>0 then print at y1,x1;" ";:posy=posy-1:ScanFields(posx,posy):end if if inkey$="a" and posy<7 then print at y1,x1;" ";:posy=posy+1:ScanFields(posx,posy):end if goto Mainloop 'pause 0 End chessboard: asm defb 32,64,32,64,32,64,32,64 defb 64,32,64,32,64,32,64,32 defb 32,64,32,64,32,64,32,64 defb 64,32,64,32,64,32,64,32 defb 32,64,32,64,32,64,32,64 defb 64,32,64,32,64,32,64,32 defb 32,64,32,64,32,64,32,64 defb 64,32,64,32,64,32,64,32 end asm overlay: '0=Leer '1=Bauer '2=Turm '3=Springer '4=Läufer '5=Königin '6=König '+128=hidden '+64=White field '+32=Black field asm defb 56,80,56,80,56,80,56,80 defb 80,56,80,56,80,56,80,56 defb 56,80,56,80,56,80,56,80 defb 80,56,80,56,80,56,80,56 defb 56,80,56,80,56,80,56,80 defb 80,56,80,56,80,56,80,56 defb 56,80,56,80,56,80,56,80 defb 80,56,80,56,80,56,80,56 end asm

Print this item