Skip to content

Commit

Permalink
Added SPOINT
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Robson committed Jan 30, 2024
1 parent 67a4719 commit 7eff08e
Show file tree
Hide file tree
Showing 20 changed files with 65 additions and 40 deletions.
Binary file modified basic/scripts/__pycache__/tokens.cpython-311.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions basic/scripts/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def create(self):
#
self.add(0x80,"""
!!STR $ ( RAND( RND( JOYPAD( INT( TIME( EVENT(
INKEY$( ASC( CHR$( POINT( LEN( ABS( SGN( HIT( !!UN9
INKEY$( ASC( CHR$( POINT( LEN( ABS( SGN( HIT( SPOINT(
MID$( LEFT$( RIGHT$( TRUE FALSE !!UN4 !!UN5 !!UN6 !!UN7
KEY( PEEK( DEEK( ALLOC( MAX( MIN(
""",48)
Expand Down Expand Up @@ -145,7 +145,7 @@ def create(self):
#
self.add(0x2E0,"""
SIN( COS( TAN( ATAN( LOG( EXP( VAL( STR$(
ISVAL( SQR( PAGE SPRITEX( SPRITEY( NOTES( HIMEM
ISVAL( SQR( PAGE SPRITEX( SPRITEY( NOTES( HIMEM
""")

if __name__ == "__main__":
Expand Down
46 changes: 32 additions & 14 deletions basic/sources/arithmetic/unary/hardware/point.asm
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,43 @@
; ************************************************************************************************
; ************************************************************************************************


.section code

; ************************************************************************************************
;
; Read Pixel from screen
;
; ************************************************************************************************

.section code

EXPUnaryPoint: ;; [point(]
jsr PointCommonCode
.DoSendMessage ; read pixel
.byte 5,33
.DoWaitMessage

PointCommonExit:
lda ControlError ; failed ?
bne _EUPError
lda ControlParameters+0 ; true/false option.
jmp EXPUnaryReturnA
_EUPError:
.error_range

; ************************************************************************************************
;
; Read Pixel from sprite layer
;
; ************************************************************************************************

EXPUnarySPoint: ;; [spoint(]
jsr PointCommonCode
.DoSendMessage ; read pixel on sprite layer
.byte 5,36
.DoWaitMessage
bra PointCommonExit

PointCommonCode:
jsr EXPEvalInteger16 ; x
inx
jsr ERRCheckComma
Expand All @@ -34,19 +62,8 @@ EXPUnaryPoint: ;; [point(]
sta ControlParameters+2
lda XSNumber1+1,x
sta ControlParameters+3
rts

.DoSendMessage ; read pixel
.byte 5,33
.DoWaitMessage

lda ControlError ; failed ?
bne _EUPError

lda ControlParameters+0 ; true/false option.
jmp EXPUnaryReturnA

_EUPError:
.error_range

.send code

Expand All @@ -59,6 +76,7 @@ _EUPError:
;
; Date Notes
; ==== =====
; 30-01-24 Added support for SPOINT which is almost identical.
;
; ************************************************************************************************

2 changes: 1 addition & 1 deletion basic/sources/generated/kwdconst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ KWD_LENLPAREN = $8d ; len(
KWD_ABSLPAREN = $8e ; abs(
KWD_SGNLPAREN = $8f ; sgn(
KWD_HITLPAREN = $90 ; hit(
KWD_SYS_UN9 = $91 ; !!un9
KWD_SPOINTLPAREN = $91 ; spoint(
KWD_MIDDOLLARLPAREN = $92 ; mid$(
KWD_LEFTDOLLARLPAREN = $93 ; left$(
KWD_RIGHTDOLLARLPAREN = $94 ; right$(
Expand Down
2 changes: 1 addition & 1 deletion basic/sources/generated/kwdtext.asm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BaseTokenText:
.byte $04,$41,$42,$53,$a8 ; $ 8e ABS(
.byte $04,$53,$47,$4e,$a8 ; $ 8f SGN(
.byte $04,$48,$49,$54,$a8 ; $ 90 HIT(
.byte $00 ; $ 91
.byte $07,$53,$50,$4f,$49,$4e,$54,$a8 ; $ 91 SPOINT(
.byte $05,$4d,$49,$44,$24,$a8 ; $ 92 MID$(
.byte $06,$4c,$45,$46,$54,$24,$a8 ; $ 93 LEFT$(
.byte $07,$52,$49,$47,$48,$54,$24,$a8 ; $ 94 RIGHT$(
Expand Down
2 changes: 1 addition & 1 deletion basic/sources/generated/vectors_standard.asm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ StandardVectorTable:
.word UnaryAbs ; $8e abs(
.word UnarySgn ; $8f sgn(
.word EXPUnaryHit ; $90 hit(
.word Unimplemented ; $91 !!un9
.word EXPUnarySPoint ; $91 spoint(
.word Unary_Mid ; $92 mid$(
.word Unary_Left ; $93 left$(
.word Unary_Right ; $94 right$(
Expand Down
5 changes: 3 additions & 2 deletions basic/test.bsc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
cls:gload "graphics.gfx"
rect solid ink 2 from 0,0 to 319,239
rect solid ink 1 from 0,0 to 319,239
for i = 0 to 31:line i*10,0 ink 3 to i*10,239:next
sprite 0 image $C0 to 100,100
sprite 0 image $C3 to 200,100
for i = 8 to 12:y = i * 10:print y,point(201,y),spoint(201,y):next
end
mem = alloc(8*6+3)
poke mem,1:poke mem+1,8:poke mem+2,6
Expand Down
2 changes: 0 additions & 2 deletions documents/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ General
Larger Additions
----------------

- SPOINT possibly

- Serial uploading
- save to storage option.

Expand Down
7 changes: 5 additions & 2 deletions documents/release/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,13 @@ Changes

29/01/24: IMP: Added keyboard support for ALT + ALTGR to emulator (framework/gfx)
IMP: Extracted locale code to a new file.
IMP: Added Locale
IMP: Added new Locale code
IMP: Added German keyboard file

30/01/24: BUG: CLS now clears the graphics screen but *not* the sprites if present
BUG: SPRITE CLEAR clears the sprites only
BUG: CLEAR now resets the sprites and clears the sprite layer, which makes them consistent.
IMP: TURTLE CLEAR is now TURTLE HOME
IMP: TURTLE CLEAR is now TURTLE HOME
IMP: Added SPOINT() to read sprite layer.
*** Release 15 ***

Binary file modified documents/release/api.odt
Binary file not shown.
Binary file modified documents/release/api.pdf
Binary file not shown.
Binary file modified documents/release/basic.odt
Binary file not shown.
Binary file modified documents/release/basic.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions firmware/common/config/dispatch.config
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ group 5
GFXDefaultPalette();
function 35 // Function 35, set up tilemap
TMPSelectTileMap(cpuMemory+DSPGetInt16(DCOMMAND,4),DSPGetInt16(DCOMMAND,6),DSPGetInt16(DCOMMAND,8));
function 36 // Function 36, read sprite pixel
GFXGraphicsCommand(36,DCOMMAND);

// ***************************************************************************************
//
Expand Down
4 changes: 2 additions & 2 deletions firmware/common/include/data/basic_binary.h

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions firmware/common/include/data/dispatch_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ switch (*DCOMMAND) {
case 35:
TMPSelectTileMap(cpuMemory+DSPGetInt16(DCOMMAND,4),DSPGetInt16(DCOMMAND,6),DSPGetInt16(DCOMMAND,8));
break;
case 36:
GFXGraphicsCommand(36,DCOMMAND);
break;
}
break;
case 6:
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/include/data/prompt.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
// This file is automatically generated
//
#define PROMPT "(Build 2561 30-Jan-24)\r"
#define PROMPT "(Build 2567 30-Jan-24)\r"
6 changes: 3 additions & 3 deletions firmware/common/include/data/sfxdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ static const uint16_t sfxData18[] = {
740,75,0,50,740,75,0,50,740,75,0,50,740,75,0,50,65535 };
// 19 expl100
static const uint16_t sfxData19[] = {
312,1,501,1,537,1,450,1,513,1,345,1,612,1,423,1,578,1,619,1,475,1,484,1,211,1,511,1,479,1,401,1,386,1,483,1,546,1,457,1,601,1,616,1,445,1,448,1,366,1,631,1,396,1,615,1,341,1,258,1,656,1,298,1,207,1,243,1,553,1,273,1,441,1,582,1,318,1,689,1,534,1,500,1,595,1,505,1,374,1,465,1,225,1,258,1,338,1,386,1,65535 };
464,1,246,1,439,1,391,1,206,1,394,1,224,1,320,1,582,1,691,1,315,1,581,1,679,1,537,1,474,1,261,1,328,1,226,1,422,1,524,1,246,1,630,1,668,1,696,1,596,1,512,1,203,1,384,1,478,1,317,1,562,1,207,1,393,1,620,1,518,1,503,1,214,1,632,1,327,1,501,1,636,1,423,1,680,1,267,1,430,1,561,1,297,1,299,1,623,1,432,1,65535 };
// 20 expl50
static const uint16_t sfxData20[] = {
263,1,315,1,513,1,671,1,315,1,357,1,493,1,294,1,400,1,351,1,586,1,653,1,312,1,373,1,441,1,478,1,530,1,388,1,357,1,477,1,442,1,309,1,402,1,657,1,306,1,65535 };
677,1,258,1,346,1,647,1,470,1,596,1,572,1,609,1,247,1,322,1,594,1,424,1,216,1,369,1,347,1,543,1,315,1,246,1,479,1,602,1,407,1,533,1,463,1,413,1,269,1,65535 };
// 21 expl20
static const uint16_t sfxData21[] = {
338,1,318,1,619,1,484,1,305,1,603,1,578,1,229,1,223,1,324,1,65535 };
418,1,524,1,457,1,354,1,207,1,547,1,392,1,243,1,301,1,560,1,65535 };
// 22 las30
static const uint16_t sfxData22[] = {
600,1,574,1,547,1,520,1,494,1,467,1,440,1,414,1,387,1,360,1,334,1,307,1,280,1,254,1,227,1,65535 };
Expand Down
9 changes: 9 additions & 0 deletions firmware/common/sources/interface/gfxcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ void GFXGraphicsCommand(uint8_t cmd,uint8_t *data) {
if (SPRSpritesInUse()) data[4] &= 0x0F;
}
break;
case 36:
isOk = (x1 >= 0 && y1 >= 0 && x1 < gMode.xGSize && y1 < gMode.yGSize);
data[2] = isOk ? 0 : 1;
data[4] = 0;
if (isOk && SPRSpritesInUse()) {
data[4] = gMode.graphicsMemory[x1 + y1 * gMode.xGSize] >> 4;
}
break;
}
}

Expand All @@ -282,5 +290,6 @@ void GFXGraphicsCommand(uint8_t cmd,uint8_t *data) {
// 18-01-24 Added function 33 (read pixel)
// 19/01/24 Added SOLID option to TEXT and IMAGE
// 28/01/24 Line parameters are now signed integers
// 30/01/24 Added SPOINT to read sprite pixel (36)
//
// ***************************************************************************************
9 changes: 0 additions & 9 deletions firmware/include/data

This file was deleted.

0 comments on commit 7eff08e

Please sign in to comment.