File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44; YYY and ZZZ are 16 bit on top of the stack.
55
66#include once <error.asm>
7+ #include once <free.asm>
78
89SAVE_CODE:
910
@@ -14,16 +15,20 @@ SAVE_CODE:
1415 LOCAL ROM_SAVE
1516 LOCAL __ERR_EMPTY
1617 LOCAL SAVE_STOP
18+ LOCAL STR_PTR
19+ LOCAL SAVE_EMPTY_ERROR
1720
1821#ifdef __ENABLE_BREAK__
1922 ROM_SAVE EQU 0970h
2023#endif
2124 MEMBOT EQU 23698 ; Use the CALC mem to store header
25+ STR_PTR EQU MEMBOT + 17
2226
2327 pop hl ; Return address
2428 pop bc ; data length in bytes
2529 pop de ; address start
2630 ex ( sp ) , hl ; CALLE => now hl = String
31+ ld (STR_PTR) , hl
2732
2833; This function will call the ROM SAVE CODE Routine
2934; Parameters in the stack are HL => String with SAVE name
@@ -34,7 +39,7 @@ SAVE_CODE:
3439__SAVE_CODE: ; INLINE version
3540 ld a , b
3641 or c
37- ret z ; Return if block length == 0
42+ jr z , SAVE_EMPTY_ERROR ; Return if block length == 0
3843
3944 push ix
4045 ld a , h
@@ -79,6 +84,8 @@ __ERR_EMPTY:
7984SAVE_CONT:
8085 ld de , MEMBOT + 1
8186 ldir ; Copy String block NAME
87+ ld hl , (STR_PTR)
88+ call MEM_FREE
8289 ld l , (ix + 13 )
8390 ld h , (ix + 14 ) ; Restores start of bytes
8491
@@ -97,8 +104,15 @@ NO_INT:
97104 pop ix
98105 ret
99106
107+ SAVE_EMPTY_ERROR:
108+ ld a , ERROR_InvalidArg
109+
100110SAVE_STOP:
101111 pop ix
112+ push af
113+ ld hl , (STR_PTR)
114+ call MEM_FREE
115+ pop af
102116 jp __STOP
103117
104118#ifndef __ENABLE_BREAK__
You can’t perform that action at this time.
0 commit comments