Skip to content

Commit

Permalink
View history
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoAiresCastello committed Dec 29, 2024
1 parent 488dc77 commit 9611b80
Show file tree
Hide file tree
Showing 66 changed files with 279 additions and 3,499 deletions.
2 changes: 2 additions & 0 deletions 0.4/PTM.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<ClCompile Include="src\PTML_SOUND.cpp" />
<ClCompile Include="src\PTML_VARS.cpp" />
<ClCompile Include="src\t_image.cpp" />
<ClCompile Include="src\t_program_editor.cpp" />
<ClCompile Include="src\t_record_file.cpp" />
<ClCompile Include="src\t_sound.cpp" />
<ClCompile Include="src\t_sound_wav.cpp" />
Expand Down Expand Up @@ -82,6 +83,7 @@
<ClInclude Include="src\t_array_ref.h" />
<ClInclude Include="src\t_image.h" />
<ClInclude Include="src\t_namespace.h" />
<ClInclude Include="src\t_program_editor.h" />
<ClInclude Include="src\t_record_file.h" />
<ClInclude Include="src\t_rect.h" />
<ClInclude Include="src\t_sound.h" />
Expand Down
21 changes: 15 additions & 6 deletions 0.4/PTM.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
<ClCompile Include="src\t_screen.cpp">
<Filter>GRAPHICS - CORE</Filter>
</ClCompile>
<ClCompile Include="src\t_main_editor.cpp">
<Filter>CORE</Filter>
</ClCompile>
<ClCompile Include="src\PTML_runtime.cpp">
<Filter>RUNTIME UTILITIES</Filter>
</ClCompile>
Expand Down Expand Up @@ -128,6 +125,12 @@
<ClCompile Include="src\t_image.cpp">
<Filter>GRAPHICS - CORE</Filter>
</ClCompile>
<ClCompile Include="src\t_main_editor.cpp">
<Filter>EDITOR</Filter>
</ClCompile>
<ClCompile Include="src\t_program_editor.cpp">
<Filter>EDITOR</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\t_string.h">
Expand Down Expand Up @@ -196,9 +199,6 @@
<ClInclude Include="src\t_screen.h">
<Filter>GRAPHICS - CORE</Filter>
</ClInclude>
<ClInclude Include="src\t_main_editor.h">
<Filter>CORE</Filter>
</ClInclude>
<ClInclude Include="src\t_function_ptr.h">
<Filter>UTIL</Filter>
</ClInclude>
Expand Down Expand Up @@ -304,6 +304,12 @@
<ClInclude Include="src\t_image.h">
<Filter>GRAPHICS - CORE</Filter>
</ClInclude>
<ClInclude Include="src\t_program_editor.h">
<Filter>EDITOR</Filter>
</ClInclude>
<ClInclude Include="src\t_main_editor.h">
<Filter>EDITOR</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="UTIL">
Expand Down Expand Up @@ -339,5 +345,8 @@
<Filter Include="RUNTIME UTILITIES">
<UniqueIdentifier>{d73b4aac-b700-424b-8ae1-15ba947d5ef1}</UniqueIdentifier>
</Filter>
<Filter Include="EDITOR">
<UniqueIdentifier>{a7b7ca7a-6d73-42da-885c-4b9bfc3e8753}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
Binary file modified 0.4/build/PTM.exe
Binary file not shown.
73 changes: 37 additions & 36 deletions 0.4/build/root/CHARSET
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
AUTOREF 0
CLS
SET ix,1
SET iy,1
SET c,0
RTILE
TILE 0,15,0
:loop
LOCATE ix,iy
CSET 0,c
PUT
INC c
INC ix
GOTO.LE ix,16,loop
INC iy
SET ix,1
GOTO.LE iy,16,loop
SET ix,1
SET iy,0
SET ch,0
:loop2
LOCATE ix,iy
PRINTF "%X",ch
INC ix
INC ch
GOTO.LE ix,16,loop2
SET ix,0
SET iy,1
SET ch,0
:loop3
LOCATE ix,iy
PRINTF "%X",ch
INC iy
INC ch
GOTO.LE iy,16,loop3
LOCATE 0,18
main:
AUTOREF 0
CLS
SET ix,1
SET iy,1
SET c,0
RTILE
TILE 0,15,0
loop:
LOCATE ix,iy
CSET 0,c
PUT
INC c
INC ix
GOTO.LE ix,16,loop
INC iy
SET ix,1
GOTO.LE iy,16,loop
SET ix,1
SET iy,0
SET ch,0
loop2:
LOCATE ix,iy
PRINTF "%X",ch
INC ix
INC ch
GOTO.LE ix,16,loop2
SET ix,0
SET iy,1
SET ch,0
loop3:
LOCATE ix,iy
PRINTF "%X",ch
INC iy
INC ch
GOTO.LE iy,16,loop3
LOCATE 0,18
74 changes: 38 additions & 36 deletions 0.4/build/root/PALETTE
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
AUTOREF 0
CLS
SET ix,1
SET iy,1
SET c,0
RTILE
TILE 0,0,0
:loop
LOCATE ix,iy
BSET 0,c
PUT
INC c
INC ix
GOTO.LE ix,16,loop
INC iy
SET ix,1
GOTO.LE iy,16,loop
SET ix,1
SET iy,0
SET ch,0
:loop2
LOCATE ix,iy
PRINTF "%X",ch
INC ix
INC ch
GOTO.LE ix,16,loop2
SET ix,0
SET iy,1
SET ch,0
:loop3
LOCATE ix,iy
PRINTF "%X",ch
INC iy
INC ch
GOTO.LE iy,16,loop3
LOCATE 0,18
main:
AUTOREF 0
CLS
SET ix,1
SET iy,1
SET c,0
RTILE
TILE 0,0,0

loop:
LOCATE ix,iy
BSET 0,c
PUT
INC c
INC ix
GOTO.LE ix,16,loop
INC iy
SET ix,1
GOTO.LE iy,16,loop
SET ix,1
SET iy,0
SET ch,0
loop2:
LOCATE ix,iy
PRINTF "%X",ch
INC ix
INC ch
GOTO.LE ix,16,loop2
SET ix,0
SET iy,1
SET ch,0
loop3:
LOCATE ix,iy
PRINTF "%X",ch
INC iy
INC ch
GOTO.LE iy,16,loop3
LOCATE 0,18
4 changes: 4 additions & 0 deletions 0.4/build/root/TEST_GAME_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
main:
CURSOR 0
PRINT "Hello World 123!"
HALT
25 changes: 21 additions & 4 deletions 0.4/src/PTM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
#include "t_program.h"
#include "t_program_line.h"
#include "t_program_runner.h"
#include "t_program_editor.h"
#include "t_filesystem.h"

int wnd_size = 3;
t_window wnd;
t_main_editor main_editor;
t_program_editor program_editor;
t_interpreter intp;
t_program prg;
t_program_runner prg_runner;
Expand Down Expand Up @@ -64,16 +66,21 @@ void PTM::init()
scr.set_palette(&pal);

intp.init(this, &scr, &kb);
program_editor.init(this, &scr, &kb);
main_editor.init(this, &scr, &kb, &intp);

main_editor.active = true;
program_editor.active = false;
}

void PTM::run_main()
{
snd.alert();

bool autoexec = t_filesystem::file_exists(autoexec_file);
if (!autoexec)

if (!autoexec) {
snd.alert();
main_editor.print_welcome(true);
}

while (wnd.is_open()) {
if (autoexec) {
Expand Down Expand Up @@ -110,6 +117,7 @@ void PTM::reset()
new_program();
main_editor.reset();
main_editor.print_welcome(false);
program_editor.reset();
}

void PTM::pause(int frames)
Expand Down Expand Up @@ -139,6 +147,9 @@ void PTM::on_machine_cycle()
if (!wnd.is_open())
return;

if (program_editor.active)
program_editor.draw_program();

if (auto_screen_update)
refresh_screen();

Expand All @@ -158,14 +169,20 @@ void PTM::on_machine_cycle()
else if (!kb.alt() && !halted) {
kb.push_key(key);
if (!prg_runner.is_running()) {
main_editor.on_keydown();
if (main_editor.active)
main_editor.on_keydown();
if (program_editor.active)
program_editor.on_keydown();
}
}
}
}

void PTM::on_escape_key_pressed()
{
if (!enable_user_break)
return;

if (halted) {
halted = false;
}
Expand Down
1 change: 1 addition & 0 deletions 0.4/src/PTM.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class PTM

t_tile tilereg;
bool auto_screen_update = true;
bool enable_user_break = true;

void run();
void exit();
Expand Down
1 change: 1 addition & 0 deletions 0.4/src/PTML_ALL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ t_function_ptr PTML::get_cmd_pointer(const t_string& cmd)
CMD("EXIT", EXIT);
CMD("RESET", RESET);
CMD("PAUSE", PAUSE);
CMD("BREAK", BREAK);

// === MEMORY ===
CMD("SET", SET);
Expand Down
6 changes: 6 additions & 0 deletions 0.4/src/PTML_CTFLOW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,9 @@ void PTML::PAUSE()
ARGC(1);
ptm->pause(NUM(1));
}

void PTML::BREAK()
{
ARGC(1);
ptm->enable_user_break = BOOL(1);
}
1 change: 1 addition & 0 deletions 0.4/src/PTML_CTFLOW.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ namespace PTML
void CALL_IFNKEY();
void RET();
void PAUSE();
void BREAK();
}
3 changes: 3 additions & 0 deletions 0.4/src/t_main_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ void t_main_editor::reset()

void t_main_editor::print_welcome(bool show_prompt)
{
if (!active)
return;

scr->print_string_crlf(ptm->version_string);
scr->print_string_crlf(ptm->title_short);
scr->print_string_crlf(ptm->copyright_notice);
Expand Down
2 changes: 2 additions & 0 deletions 0.4/src/t_main_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class t_sound;
class t_main_editor
{
public:
bool active = true;

t_dict<SDL_Keycode, t_string> function_keys;
t_dict<SDL_Keycode, t_string> function_keys_shifted;

Expand Down
Loading

0 comments on commit 9611b80

Please sign in to comment.