From dc696fba73ca8848ba72399fe7c0a31a652e9df9 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 27 Apr 2023 10:44:42 -0700 Subject: [PATCH] Starting file save/load --- gui/notepad/notepad.tal | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/gui/notepad/notepad.tal b/gui/notepad/notepad.tal index b048686..7e39e82 100644 --- a/gui/notepad/notepad.tal +++ b/gui/notepad/notepad.tal @@ -32,12 +32,7 @@ ;on-frame .Screen/vector DEO2 ;on-control .Controller/vector DEO2 - ( initialize memory ) - #0801 - &l - #00 OVR #d0 SFT2 ;mem ADD2 STH2 #20 STH2r STA - INC GTHk ?&l - POP2 + file-init draw-header #00 change-page @@ -112,7 +107,7 @@ BRK .Screen/height DEO2 draw-header redraw - #00 .Mouse/state DEO + [ LIT2 00 -Mouse/state ] DEO BRK @@ -151,7 +146,7 @@ BRK &on-mouse-down ( -> ) - #00 .Mouse/state DEO + [ LIT2 00 -Mouse/state ] DEO .Mouse/y DEI2 #00d6 SUB2 NIP #18 .Mouse/x DEI2 NIP SUB @@ -332,17 +327,33 @@ JMP2r ( @|file ) +@file-init ( -- ) + + ;notepad-txt file-size #0000 EQU2 ?file-new + +@file-load ( -- ) + + ;notepad-txt .File/name DEO2 + #8000 .File/length DEO2 + ;mem .File/read DEO2 + +JMP2r + @file-new ( -- ) + ( initialize pages ) + #0801 + &l + #00 OVR #c0 SFT2 ;mem ADD2 STH2 #20 STH2r STA + INC GTHk ?&l + POP2 + JMP2r @file-save ( -- ) JMP2r -@file-load ( -- ) - -JMP2r @notepad-txt ".notepad $1 @@ -495,7 +506,7 @@ JMP2r @get-page ( -- addr* ) - ;mem #00 .page LDZ #d0 SFT2 ADD2 + ;mem #00 .page LDZ #c0 SFT2 ADD2 JMP2r