Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 592 online users. » 0 Member(s) | 591 Guest(s) Bing
|
Latest Threads |
Includes in ASM
Forum: How-To & Tutorials
Last Post: bracckets
04-04-2024, 12:17 AM
» Replies: 2
» Views: 540
|
Intermittent errors
Forum: Help & Support
Last Post: zarsoft
03-12-2024, 12:39 PM
» Replies: 0
» Views: 309
|
Store array information i...
Forum: Help & Support
Last Post: rbiondi
03-10-2024, 09:42 PM
» Replies: 0
» Views: 397
|
ScrollLeft function scrol...
Forum: Bug Reports
Last Post: rbiondi
03-07-2024, 03:57 PM
» Replies: 2
» Views: 790
|
string.bas errors when co...
Forum: Bug Reports
Last Post: rbiondi
03-01-2024, 10:10 AM
» Replies: 2
» Views: 704
|
Using Beepola with ZX BAS...
Forum: How-To & Tutorials
Last Post: edtoo
02-29-2024, 09:47 AM
» Replies: 15
» Views: 32,610
|
Johnny Bravo
Forum: Gallery
Last Post: zarsoft
02-11-2024, 11:20 PM
» Replies: 0
» Views: 468
|
Compiling +D G+DOS progra...
Forum: ZX Basic Compiler
Last Post: boriel
01-22-2024, 08:32 AM
» Replies: 4
» Views: 8,617
|
VAL = ? (solved)
Forum: Bug Reports
Last Post: zarsoft
01-03-2024, 11:44 PM
» Replies: 8
» Views: 3,160
|
Wrong math (solved)
Forum: Bug Reports
Last Post: zarsoft
01-03-2024, 11:38 PM
» Replies: 4
» Views: 1,733
|
|
|
String Adress wrong (*solved*) |
Posted by: LCD - 06-18-2010, 12:36 PM - Forum: Bug Reports
- Replies (4)
|
|
Strangely my proportional Print SUB from Tips section, with example, does not work anymore with the latest development version of ZXBC, because the address of text in b$ is returned incorrectly (in ROM).
Code: DIM b$ AS STRING
b$="test"
PRINT PEEK(Uinteger,@b$)+2
It does not return the correct address and compiled program says "A Invalid argument" at the end.
Code: DIM b$ AS STRING
dim adr as uinteger
b$="test"
adr=PEEK(Uinteger,@b$)+2
print adr
Does not change anything.
comes with a "Undefined label '_test_b'." if used in SUBs
|
|
|
strings initialized? |
Posted by: programandala.net - 06-18-2010, 12:34 PM - Forum: Help & Support
- Replies (6)
|
|
Yesterday I experienced a kind of coding poltergeist with the following simple function:
Code: function strings(times as ubyte, text as string ) as string
dim i as ubyte
dim result as string
for i = 1 to times
let result = result + text
next i
return result
end function
The program did strange things when printing the string returned by strings(): it printed other strings of the program that had nothing to do, and then froze. The reason was I had supposed the DIMed strings were initialized to an empty string but they are not; it took time to find out. When I added a simple line, everything worked as expected:
Code: dim result as string
let result = ""
I've searched in the forum, but found no reference about this. The DIM wiki page doesn't mention string initialitazion. I just want to confirm this issue before updating the wiki. Are strings not initialized to empty strings because of a technical issue or simply because it's not implemented yet? Is this definitive or will it change in the future?
|
|
|
typo in library comment |
Posted by: programandala.net - 06-17-2010, 08:48 PM - Forum: Bug Reports
- Replies (1)
|
|
This is not a bug but an innocuous typo. The following lines in library/csrlin.bas:
Code: dim maxy as ubyte at 23683: REM 'Max COL position + 1 (default 33)
dim ny as ubyte at 23689 : REM current maxx - column screen position
Should read:
Quote: dim maxy as ubyte at 23683: REM 'Max LIN position + 1 (default 24)
dim ny as ubyte at 23689 : REM current maxy - line screen position
I guess they were copied and pasted from library/pos.bas
|
|
|
Any way to to include command line options into the code? |
Posted by: programandala.net - 06-16-2010, 07:25 PM - Forum: Help & Support
- Replies (3)
|
|
Is there any compiler directive to include command line options into the source? I've looked in the docs and in the forum, and found some mentions about "#pragma", but nothing clear.
I always include the following comment at the top of my source
Code: ' Compile with the following command:
' zxb.py myprogram.bas --tap --autorun --BASIC --strict-bool
in order to remember the options needed (sometimes I tinker with them, and they are not the same for every program). It would be easier to include the options into the source:
Code: #option tap
#option strict-bool
or
Code: #options tap strict-bool
Then all programs could be compiled just with zxb.py program.bas. Of course, the actual command line options would have higher priority than those in the source.
|
|
|
Illegal Character "." |
Posted by: britlion - 06-16-2010, 12:50 AM - Forum: Help & Support
- Replies (5)
|
|
I was playing with putChars to tighten it and add attribs...
This comes back with "illegal character "." in line 52. There is indeed one in that line. It's in a comment. If you remove it (I already removed all the others) it freaks into "Too many errors. Giving up".
Line 52:
; gets screen address in HL, and bytes address in DE. [<<<< This . is apparently an error] Copies the 8 bytes to the screen
I have no idea why!
Code: SUB Baspaint (x as uByte,y as uByte, width as uByte, height as uByte, attribute as ubyte)
dim i,j as ubyte
FOR i=x to x+width-1
for j=y to y+height-1
poke (22528+(CAST(uinteger,32)*j)+i),attribute
next j
next i
END SUB
SUB paint (x as uByte,y as uByte, width as uByte, height as uByte, attribute as ubyte)
print x,y,width,height,attribute
END SUB
SUB putChars(x as uByte,y as uByte, width as uByte, height as uByte, dataAddress as uInteger)
BLPutChar:
LD a,(IX+5)
;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
PUSH HL ; save our address
LD E,(IX+12) ; Marker - This will be poked for the data address by the subroutine
LD D,(IX+13)
LD B,(IX+9) ; Marker - this will be poked for the width
PUSH BC ; save our column count
BLPutCharColumnLoop:
LD B,(IX+11) ; Marker - this will be poked for the height by the subroutine
BLPutCharInColumnLoop:
; gets screen address in HL, and bytes address in DE. Copies the 8 bytes to the screen
ld a,(DE) ; First Row
LD (HL),a
INC DE
INC H
ld a,(DE)
LD (HL),a ; second Row
INC DE
INC H
ld a,(DE)
LD (HL),a ; Third Row
INC DE
INC H
ld a,(DE)
LD (HL),a ; Fourth Row
INC DE
INC H
ld a,(DE)
LD (HL),a ; Fifth Row
INC DE
INC H
ld a,(DE)
LD (HL),a ; Sixth Row
INC DE
INC H
ld a,(DE)
LD (HL),a ; Seventh Row
INC DE
INC H
ld a,(DE)
LD (HL),a ; Eigth Row
INC DE ; Move to next data item.
DEC B
JR Z,BLPutCharNextColumn
;The following code calculates the address of the next line down below current HL address.
PUSH DE ; save DE
ld a,l
and 224
cp 224
jp z,BLPutCharNextThird
BLPutCharSameThird:
ld de,-1760
;and a
add hl,de
POP DE ; get our data point back.
jp BLPutCharInColumnLoop
BLPutCharNextThird:
ld de,32
;and a
add hl,de
POP DE ; get our data point back.
JP BLPutCharInColumnLoop
BLPutCharNextColumn:
POP BC
POP HL
DEC B
JP Z BLPutCharsEnd
INC HL
PUSH HL
PUSH BC
JP BLPutCharColumnLoop
BLPutCharsEnd:
end asm
END SUB
goto start
datapoint:
asm
defb 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32
defb 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64
defb 65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96
defb 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128
end asm
start:
cls
putChars(10,10,3,3,@datapoint)
paint(10,10,3,3,79)
|
|
|
|