| Welcome, Guest |
You have to register before you can post on our site.
|
| Online Users |
There are currently 101 online users. » 0 Member(s) | 101 Guest(s)
|
| Latest Threads |
GuSprites
Forum: Help & Support
Last Post: zedex82
2026-06-19, 06:39 PM
» Replies: 2
» Views: 357
|
New video Couse / Nuevo c...
Forum: News
Last Post: Duefectu
2026-04-29, 11:02 PM
» Replies: 0
» Views: 2,702
|
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,849
|
How to open fuse as an ex...
Forum: How-To & Tutorials
Last Post: Duefectu
2026-02-09, 01:52 PM
» Replies: 3
» Views: 1,745
|
Old zxbasic game errors
Forum: Help & Support
Last Post: boriel
2025-11-09, 11:52 AM
» Replies: 7
» Views: 2,541
|
Error: Undefined GLOBAL l...
Forum: Help & Support
Last Post: ardentcrest
2025-11-04, 05:46 PM
» Replies: 3
» Views: 1,397
|
A Fast(er) Plot Routine f...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-30, 03:16 PM
» Replies: 2
» Views: 1,480
|
Hall of Fame - Include fo...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-28, 03:48 PM
» Replies: 0
» Views: 820
|
[SOLVED] Array layout bug...
Forum: Bug Reports
Last Post: Zoran
2025-10-25, 05:48 PM
» Replies: 2
» Views: 1,541
|
|
|
| Reading, storing and writing screen values |
|
Posted by: oblo - 2013-03-05, 06:33 PM - Forum: Help & Support
- Replies (4)
|
 |
Hi all
I'm starting to learn how to manipulate screen directly at memory address level. Right now, I'm messing with this code
Code: rem screen values
paper 0: border 0: ink 7: cls
dim conta as byte
dim x,y,n,adres,dirb as uinteger
bucle:
y=RND*10
x=RND*32
adres=0
POKE attrAddress(x,y),RND*256
Print at 10,0; "X="; x; " - "; "Y="; y;
print at 11,0; "Attrib address is.......: "; attrAddress(x,y);
print at 12,0; "Attrib value is.........: "; PEEK attrAddress(x,y);
print at 13,0; "The 8 screen addresses..: "
for conta=0 to 7
poke scrAddress(x,y)+adres,RND*256
print scrAddress(x,y)+adres;","; PEEK (scrAddress(x,y)+adres)
adres=adres+256
next conta
pause 0
cls
goto bucle
rem funciones
FUNCTION scrAddress(x AS UBYTE, y AS UBYTE) AS UINTEGER
ASM
; This FUNCTION returns the address into HL of the screen address
; x,y in character grid notation.
; Original CODE was extracted by BloodBaz
; 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
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.
'Rebuilt for ZX BASIC by Britlion from NA_TH_AN's fourspriter, with permission.
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
Questions are:
- Are there any better options to read and write given a X and Y coordinates?
- What is the best way to storage screen memory addresses and their values? Integer (for addresses) and Ubyte (for values) arrays, right?
Thanks and regards
|
|
|
| Parser bug (*solved*) |
|
Posted by: einar - 2013-02-26, 05:16 PM - Forum: Bug Reports
- Replies (4)
|
 |
Trying to compile the following code:
Code: #define BIFROSTstop() \
asm \
call 65012 \
end asm
10 PAUSE 0 : BIFROSTstop() : PAUSE 0
Produces the following error message:
Quote:illegal character ':'
However the following code compiles just fine:
Code: #define BIFROSTstop() \
asm \
call 65012 \
end asm
10 PAUSE 0 : BIFROSTstop()
PAUSE 0
This bug is relevant because BIFROST* interface library for ZX BASIC makes extensive use of defines as above, for performance reasons. I'm sure this is not the only case. Therefore I'm concerned about users getting confused by weird errors like this.
|
|
|
| UDG definition bug (*solved*) |
|
Posted by: wilco2009 - 2013-02-20, 11:55 PM - Forum: Bug Reports
- Replies (10)
|
 |
The ZXSpectrum hangs with the following code:
Code: FOR n=0 TO 7: POKE USR "A"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "B"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "C"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "D"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "E"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "F"+n,255: NEXT n
PRINT "\a \b \c \d \e \f"
Definition of UDG A & B works properly but program does not work from UDG C.
|
|
|
| Joystick Library |
|
Posted by: wilco2009 - 2013-02-08, 10:12 PM - Forum: Gallery
- Replies (2)
|
 |
Attached is included my joystick library to manage the joystick
Basically includes constants and macros to keep the same speed access that reading directly the keyboard ports.
The file keyboard.bas is a interface library to manage the keyboard.
Keyboard.bas is used by joystick.bas. It includes all the functions to manage the access to the joystick, The structure of joystick.bas as the following:
- Keyboard (OPQA/Enter), Kempston, Sinclair (Two players) and Cursor Joystick are supported.
- The active joystick is stored internally in the CtrlSelected variable and includes two functions to access it (SelectControl/GetSelectedControl).
- The other functions lets read the state of all joystick buttons.
- In order to let control two players (Sinclair case), are included in all functions a parameter called "played" with possible values PLAYER1/PLAYER2 (0/1).
- The Sinclair right player is used for player 2.
<!-- m --><a class="postlink" href="https://docs.google.com/folder/d/0B69T2laxW_ueenc4SmJBTzFEeEU/edit?usp=sharing">https://docs.google.com/folder/d/0B69T2 ... sp=sharing</a><!-- m -->
|
|
|
| Stack |
|
Posted by: na_th_an - 2013-02-08, 11:35 AM - Forum: How-To & Tutorials
- Replies (1)
|
 |
Maybe this has been solved before, but I can't search for "stack" in the forum 'cause the search engine tells me it's a very common word so it won't be included in the search XD
Were the stack is located? Can I control where it is located without messing things up?
I'm asking this 'cause I'll be trying using extra RAM pages in 128K models for storage.
|
|
|
| fourspriter error with -O 2 option |
|
Posted by: jevilon - 2013-02-07, 09:25 PM - Forum: Bug Reports
- Replies (6)
|
 |
When I try to build my game, using fourspriter 2.1, if you compile normal works, but if I put optimization level 2 or level 3 gives me the error:
main.bas: 5526: error: Undefined label '__LABEL__fsp21DataPool'
Na_th_an I asked and he said that you mentioned it to you.
greetings
|
|
|
|