Skip to content

Commit

Permalink
Added the turtle graphics system
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Robson committed Jan 27, 2024
1 parent 11693a4 commit 8c0a879
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 18 deletions.
Binary file modified basic/memory.dump
Binary file not shown.
44 changes: 44 additions & 0 deletions basic/sources/commands/hardware/turtle.asm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,50 @@ TurtleCheckInitialised:
_TCIExit:
rts

; ************************************************************************************************
;
; Turtle CLEAR|FAST|HIDE
;
; ************************************************************************************************

CommandTurtle: ;; [turtle]
lda (codePtr),y ; all 3 are in the minor group
iny
cmp #KWD_SYS_SH1
bne _CTSyntax

lda (codePtr),y ; check what it is
iny
cmp #KWD_CLEAR-$100
beq _CTClear
cmp #KWD_FAST-$100
beq _CTFast
cmp #KWD_Hide-$100
beq _CTHide
_CTSyntax:
.error_syntax

_CTClear:
stz turtleInitialised ; force reinitialisation
jsr TurtleCheckInitialised ; reinitialise it
stz ControlParameters+0 ; rotate 0 to draw it
stz ControlParameters+1
.DoSendMessage
.byte 9,2
.DoWaitMessage
rts

_CTHide:
.DoSendMessage ; hide command
.byte 9,4
.DoWaitMessage
rts

_CTFast:
lda #1 ; move fast
sta turtleFast
rts

; ************************************************************************************************
;
; Pen up
Expand Down
2 changes: 1 addition & 1 deletion basic/sources/generated/vectors_extended.asm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ExtendedVectorTable:
.word CommandLeft ; $19f left
.word CommandRight ; $1a0 right
.word CommandForward ; $1a1 forward
.word Unimplemented ; $1a2 turtle
.word CommandTurtle ; $1a2 turtle
.word Unimplemented ; $1a3 sweet
.word CommandTileMap ; $1a4 tilemap
.word CommandPenup ; $1a5 penup
Expand Down
5 changes: 4 additions & 1 deletion basic/test.bsc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cls
turtle fast
for i = 1 to 10
pendown 3
right 36
Expand All @@ -11,4 +12,6 @@ forward 80
right 90
forward 80
right 90
next
next
forward 100
turtle clear
12 changes: 3 additions & 9 deletions documents/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ General
Larger Additions
----------------

- Turtle Graphics System
- write BASIC interface.
TURTLE <HIDE>|<CLEAR>|<FAST>

- Serial upload timeout fix.

- Sprites
- something like AMAL
- something like AMAL - write spec document, probably bytecode

- Serial uploading
- save to storage option.
Expand All @@ -37,10 +35,6 @@ Other
-----
- Start the code review.
- Ongoing bug fixes

Add to Documentation
--------------------
- Left, Right, Penup , Pendown <n>

Notes
=====
Expand Down
5 changes: 4 additions & 1 deletion documents/release/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@ Changes
CHG: Modifier warm start so can use the keyboard to start serial handler.
*** Release 12 ***

27/01/24: Added ESC option to serial link to break out.
27/01/24: IMP: Added ESC option to serial link to break out.
IMP: Completed turtle graphics


Binary file modified documents/release/basic.odt
Binary file not shown.
Binary file modified documents/release/basic.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions firmware/common/include/data/basic_binary.h

Large diffs are not rendered by default.

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 2473 27-Jan-24)\r"
#define PROMPT "(Build 2475 27-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[] = {
595,1,685,1,630,1,468,1,550,1,488,1,583,1,430,1,335,1,351,1,544,1,443,1,406,1,296,1,447,1,268,1,418,1,360,1,542,1,266,1,632,1,646,1,546,1,273,1,290,1,226,1,624,1,504,1,542,1,683,1,375,1,337,1,291,1,507,1,236,1,300,1,461,1,674,1,599,1,504,1,527,1,283,1,399,1,410,1,541,1,531,1,429,1,686,1,618,1,203,1,65535 };
366,1,340,1,270,1,311,1,421,1,329,1,298,1,224,1,218,1,411,1,228,1,462,1,459,1,421,1,513,1,479,1,423,1,286,1,336,1,379,1,248,1,293,1,295,1,500,1,543,1,530,1,549,1,371,1,201,1,459,1,598,1,394,1,251,1,610,1,563,1,453,1,385,1,233,1,689,1,541,1,667,1,473,1,667,1,206,1,471,1,598,1,320,1,495,1,557,1,671,1,65535 };
// 20 expl50
static const uint16_t sfxData20[] = {
310,1,265,1,298,1,605,1,301,1,282,1,261,1,372,1,568,1,365,1,456,1,345,1,209,1,486,1,571,1,249,1,561,1,641,1,642,1,413,1,315,1,576,1,476,1,318,1,438,1,65535 };
317,1,603,1,402,1,212,1,379,1,687,1,661,1,521,1,287,1,615,1,318,1,367,1,215,1,391,1,592,1,200,1,280,1,262,1,663,1,441,1,408,1,231,1,251,1,330,1,685,1,65535 };
// 21 expl20
static const uint16_t sfxData21[] = {
490,1,520,1,245,1,201,1,455,1,332,1,621,1,382,1,608,1,584,1,65535 };
408,1,482,1,276,1,553,1,482,1,640,1,450,1,591,1,386,1,506,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
Binary file modified firmware/common/sources/interface/dispatch.o
Binary file not shown.
Binary file modified firmware/common/sources/interface/memory.o
Binary file not shown.
Binary file modified firmware/common/sources/interface/sfxmanager.o
Binary file not shown.

0 comments on commit 8c0a879

Please sign in to comment.