~rabbits/potato

bed3e24162e9e2b6ebbfbbaa10d2c6871bf26be2 — Devine Lu Linvega a month ago f884ccd
Trying to catch out-of-memory
4 files changed, 13 insertions(+), 40 deletions(-)

M src/apps.tal
M src/assets.tal
M src/draw.tal
M src/potato.tal
M src/apps.tal => src/apps.tal +8 -0
@@ 457,6 457,14 @@ JMP2r

&on-init ( win* -- )

	( TODO: Catch memory overflow )
	#ff00 ;mem .bounds LDZ2 ADD2 SUB2 #2100 GTH2 ,&space-ok JCN
		POP2
		;close-win JSR2
		;dict/create ;dict/err-space ;add-err JSR2
		JMP2r
		&space-ok

	( win/name ) STH2k #0008 ADD2 LDA2 ;make-src JSR2 .File/name DEO2
	#2100
		DUP2 .File/length DEO2

M src/assets.tal => src/assets.tal +1 -0
@@ 30,6 30,7 @@
	&months
		"Jan $1 "Feb $1 "Mar $1 "Apr $1 "May $1 "Jun $1
		"Jul $1 "Aug $1 "Sep $1 "Oct $1 "Nov $1 "Dec $1
	&err-space "Space 20 "Unavailable $1

( icn )


M src/draw.tal => src/draw.tal +1 -17
@@ 146,7 146,7 @@ JMP2r
	#01 .Screen/auto DEO
	.Screen/x DEI2 ,&x STR2
	;vert1-icn .Screen/addr DEO2
	#7000
	#8000
	&loop
		#00 OVR #10 SFT2 [ LIT2 &x $2 ] ADD2 .Screen/x DEO2
		#00 OVR #90 SFT2 ;mem-type JSR2 #00 SWP #40 SFT2 ;prog-chrs ADD2 .Screen/addr DEO2


@@ 480,22 480,6 @@ JMP2r

JMP2r

@draw-progbar ( den num -- )

	STH
	#00 .Screen/auto DEO
	#00
	&loop
		DUP STHkr LTH STH
		;vert-icn ;check-icn STHr [ JMP SWP2 POP2 ] .Screen/addr DEO2
		.Screen/x DEI2k INC2 INC2 ROT DEO2
		#0a .Screen/sprite DEO
		INC GTHk ,&loop JCN
	POP2
	POPr

JMP2r

@draw-scrollbar ( h -- )

	#01 SUB

M src/potato.tal => src/potato.tal +3 -23
@@ 37,7 37,6 @@
	&win $1
@drag $1
@length $1
@lock $2
@bounds $2
@dir $40



@@ 61,32 60,13 @@
	;dict/home-ext ;set-dir JSR2
	;untrap JSR2

	( auto-start with a few windows )
	;no-name ;app-void #0606 #0040 #0060 ;add-win JSR2
	;no-name ;app-void #0606 #0050 #0070 ;add-win JSR2
	;no-name ;app-void #0606 #0060 #0080 ;add-win JSR2
	;no-name ;app-void #0606 #0070 #0090 ;add-win JSR2

	( allocate some memory to win1 )
	#2000 ;mem-req JSR2
	;windows #000a ADD2 STA2
	#2000 ;windows #000c ADD2 STA2
	( allocate some memory to win2 )
	#1000 ;mem-req JSR2
	;windows #001a ADD2 STA2
	#1000 ;windows #001c ADD2 STA2
	( allocate some memory to win3 )
	#3000 ;mem-req JSR2
	;windows #002a ADD2 STA2
	#3000 ;windows #002c ADD2 STA2

	;no-name ;app-about #2213 #0120 #0060 ;add-win JSR2

BRK

( memory operations )

@mem-req ( len* -- ptr* )
@mem-req ( len* -- ptr*|ffff )

	( TODO: Catch memory overflow )

	( ptr )
	;mem .bounds LDZ2 ADD2