Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request boriel-basic#264 from boriel/feature/make_SAVE_to_…
Browse files Browse the repository at this point in the history
…ignore_BREAK

Feature/make save to ignore break
  • Loading branch information
boriel committed Mar 29, 2020
2 parents 2e474f5 + 303247f commit c6878b7
Show file tree
Hide file tree
Showing 10 changed files with 328 additions and 11 deletions.
55 changes: 53 additions & 2 deletions library-asm/save.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ SAVE_CODE:
LOCAL ROM_SAVE
LOCAL __ERR_EMPTY
LOCAL SAVE_STOP
ROM_SAVE EQU 0970h

#ifdef __ENABLE_BREAK__
ROM_SAVE EQU 0970h
#endif
MEMBOT EQU 23698 ; Use the CALC mem to store header

pop hl ; Return address
Expand Down Expand Up @@ -90,5 +92,54 @@ SAVE_CONT:
SAVE_STOP:
pop ix
jp __STOP

#ifndef __ENABLE_BREAK__
LOCAL CHAN_OPEN
LOCAL PO_MSG
LOCAL WAIT_KEY
LOCAL SA_BYTES

CHAN_OPEN EQU 1601h
PO_MSG EQU 0C0Ah
WAIT_KEY EQU 15D4h
SA_BYTES EQU 04C6h

ROM_SAVE:

push hl
ld a, 0FDh
call CHAN_OPEN
xor a
ld de, 09A1h
call PO_MSG
set 5, (iy + 02h)
call WAIT_KEY
push ix
ld de, 0011h
ld a, r
push af
xor a
call SA_BYTES

pop ix
ld b, 32h

LOCAL SA_1_SEC
SA_1_SEC:
halt
djnz SA_1_SEC

ld e, (ix + 0Bh)
ld d, (ix + 0Ch)
ld a, 0FFh
pop ix
call SA_BYTES

pop af
ret po
ei
ret

#endif
ENDP
24 changes: 23 additions & 1 deletion tests/functional/code00.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ LOAD_CODE:
; Must skip first 8 bytes used by
; PRINT routine
TMP_HEADER EQU HEAD1 + 17 ; Temporary HEADER2 pointer storage
LD_BYTES EQU 0556h ; ROM Routine LD-BYTES
#line 34 "/zxbasic/library-asm/load.asm"
TMP_FLAG EQU 23655 ; Uses BREG as a Temporary FLAG
pop hl ; Return address
pop af ; A = 1 => LOAD; A = 0 => VERIFY
Expand Down Expand Up @@ -1543,6 +1543,28 @@ LOAD_END:
pop ix ; Recovers stack frame pointer
ld hl, (TMP_HEADER) ; Recovers tmp_header pointer
jp MEM_FREE ; Returns via FREE_MEM, freeing tmp header
LOCAL LD_BYTES_RET
LOCAL LD_BYTES_ROM
LOCAL LD_BYTES_NOINTER
LD_BYTES_ROM EQU 0562h
LD_BYTES:
inc d
ex af, af'
dec d
ld a, r
push af
di
call 0562h
LD_BYTES_RET:
; Restores DI / EI state
ex af, af'
pop af
jp po, LD_BYTES_NOINTER
ei
LD_BYTES_NOINTER:
ex af, af'
ret
#line 262 "/zxbasic/library-asm/load.asm"
ENDP
PRINT_TAPE_MESSAGES:
PROC
Expand Down
24 changes: 23 additions & 1 deletion tests/functional/code01.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ LOAD_CODE:
; Must skip first 8 bytes used by
; PRINT routine
TMP_HEADER EQU HEAD1 + 17 ; Temporary HEADER2 pointer storage
LD_BYTES EQU 0556h ; ROM Routine LD-BYTES
#line 34 "/zxbasic/library-asm/load.asm"
TMP_FLAG EQU 23655 ; Uses BREG as a Temporary FLAG
pop hl ; Return address
pop af ; A = 1 => LOAD; A = 0 => VERIFY
Expand Down Expand Up @@ -1543,6 +1543,28 @@ LOAD_END:
pop ix ; Recovers stack frame pointer
ld hl, (TMP_HEADER) ; Recovers tmp_header pointer
jp MEM_FREE ; Returns via FREE_MEM, freeing tmp header
LOCAL LD_BYTES_RET
LOCAL LD_BYTES_ROM
LOCAL LD_BYTES_NOINTER
LD_BYTES_ROM EQU 0562h
LD_BYTES:
inc d
ex af, af'
dec d
ld a, r
push af
di
call 0562h
LD_BYTES_RET:
; Restores DI / EI state
ex af, af'
pop af
jp po, LD_BYTES_NOINTER
ei
LD_BYTES_NOINTER:
ex af, af'
ret
#line 262 "/zxbasic/library-asm/load.asm"
ENDP
PRINT_TAPE_MESSAGES:
PROC
Expand Down
24 changes: 23 additions & 1 deletion tests/functional/code02.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ LOAD_CODE:
; Must skip first 8 bytes used by
; PRINT routine
TMP_HEADER EQU HEAD1 + 17 ; Temporary HEADER2 pointer storage
LD_BYTES EQU 0556h ; ROM Routine LD-BYTES
#line 34 "/zxbasic/library-asm/load.asm"
TMP_FLAG EQU 23655 ; Uses BREG as a Temporary FLAG
pop hl ; Return address
pop af ; A = 1 => LOAD; A = 0 => VERIFY
Expand Down Expand Up @@ -1543,6 +1543,28 @@ LOAD_END:
pop ix ; Recovers stack frame pointer
ld hl, (TMP_HEADER) ; Recovers tmp_header pointer
jp MEM_FREE ; Returns via FREE_MEM, freeing tmp header
LOCAL LD_BYTES_RET
LOCAL LD_BYTES_ROM
LOCAL LD_BYTES_NOINTER
LD_BYTES_ROM EQU 0562h
LD_BYTES:
inc d
ex af, af'
dec d
ld a, r
push af
di
call 0562h
LD_BYTES_RET:
; Restores DI / EI state
ex af, af'
pop af
jp po, LD_BYTES_NOINTER
ei
LD_BYTES_NOINTER:
ex af, af'
ret
#line 262 "/zxbasic/library-asm/load.asm"
ENDP
PRINT_TAPE_MESSAGES:
PROC
Expand Down
24 changes: 23 additions & 1 deletion tests/functional/load02.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ LOAD_CODE:
; Must skip first 8 bytes used by
; PRINT routine
TMP_HEADER EQU HEAD1 + 17 ; Temporary HEADER2 pointer storage
LD_BYTES EQU 0556h ; ROM Routine LD-BYTES
#line 34 "/zxbasic/library-asm/load.asm"
TMP_FLAG EQU 23655 ; Uses BREG as a Temporary FLAG
pop hl ; Return address
pop af ; A = 1 => LOAD; A = 0 => VERIFY
Expand Down Expand Up @@ -1548,6 +1548,28 @@ LOAD_END:
pop ix ; Recovers stack frame pointer
ld hl, (TMP_HEADER) ; Recovers tmp_header pointer
jp MEM_FREE ; Returns via FREE_MEM, freeing tmp header
LOCAL LD_BYTES_RET
LOCAL LD_BYTES_ROM
LOCAL LD_BYTES_NOINTER
LD_BYTES_ROM EQU 0562h
LD_BYTES:
inc d
ex af, af'
dec d
ld a, r
push af
di
call 0562h
LD_BYTES_RET:
; Restores DI / EI state
ex af, af'
pop af
jp po, LD_BYTES_NOINTER
ei
LD_BYTES_NOINTER:
ex af, af'
ret
#line 262 "/zxbasic/library-asm/load.asm"
ENDP
PRINT_TAPE_MESSAGES:
PROC
Expand Down
24 changes: 23 additions & 1 deletion tests/functional/load03.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ LOAD_CODE:
; Must skip first 8 bytes used by
; PRINT routine
TMP_HEADER EQU HEAD1 + 17 ; Temporary HEADER2 pointer storage
LD_BYTES EQU 0556h ; ROM Routine LD-BYTES
#line 34 "/zxbasic/library-asm/load.asm"
TMP_FLAG EQU 23655 ; Uses BREG as a Temporary FLAG
pop hl ; Return address
pop af ; A = 1 => LOAD; A = 0 => VERIFY
Expand Down Expand Up @@ -1547,6 +1547,28 @@ LOAD_END:
pop ix ; Recovers stack frame pointer
ld hl, (TMP_HEADER) ; Recovers tmp_header pointer
jp MEM_FREE ; Returns via FREE_MEM, freeing tmp header
LOCAL LD_BYTES_RET
LOCAL LD_BYTES_ROM
LOCAL LD_BYTES_NOINTER
LD_BYTES_ROM EQU 0562h
LD_BYTES:
inc d
ex af, af'
dec d
ld a, r
push af
di
call 0562h
LD_BYTES_RET:
; Restores DI / EI state
ex af, af'
pop af
jp po, LD_BYTES_NOINTER
ei
LD_BYTES_NOINTER:
ex af, af'
ret
#line 262 "/zxbasic/library-asm/load.asm"
ENDP
PRINT_TAPE_MESSAGES:
PROC
Expand Down
41 changes: 40 additions & 1 deletion tests/functional/save.asm
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ SAVE_CODE:
LOCAL ROM_SAVE
LOCAL __ERR_EMPTY
LOCAL SAVE_STOP
ROM_SAVE EQU 0970h
#line 21 "/zxbasic/library-asm/save.asm"
MEMBOT EQU 23698 ; Use the CALC mem to store header
pop hl ; Return address
pop bc ; data length in bytes
Expand Down Expand Up @@ -448,6 +448,45 @@ SAVE_CONT:
SAVE_STOP:
pop ix
jp __STOP
LOCAL CHAN_OPEN
LOCAL PO_MSG
LOCAL WAIT_KEY
LOCAL SA_BYTES
CHAN_OPEN EQU 1601h
PO_MSG EQU 0C0Ah
WAIT_KEY EQU 15D4h
SA_BYTES EQU 04C6h
ROM_SAVE:
push hl
ld a, 0FDh
call CHAN_OPEN
xor a
ld de, 09A1h
call PO_MSG
set 5, (iy + 02h)
call WAIT_KEY
push ix
ld de, 0011h
ld a, r
push af
xor a
call SA_BYTES
pop ix
ld b, 32h
LOCAL SA_1_SEC
SA_1_SEC:
halt
djnz SA_1_SEC
ld e, (ix + 0Bh)
ld d, (ix + 0Ch)
ld a, 0FFh
pop ix
call SA_BYTES
pop af
ret po
ei
ret
#line 144 "/zxbasic/library-asm/save.asm"
ENDP
#line 33 "save.bas"
ZXBASIC_USER_DATA:
Expand Down
41 changes: 40 additions & 1 deletion tests/functional/save01.asm
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ SAVE_CODE:
LOCAL ROM_SAVE
LOCAL __ERR_EMPTY
LOCAL SAVE_STOP
ROM_SAVE EQU 0970h
#line 21 "/zxbasic/library-asm/save.asm"
MEMBOT EQU 23698 ; Use the CALC mem to store header
pop hl ; Return address
pop bc ; data length in bytes
Expand Down Expand Up @@ -452,6 +452,45 @@ SAVE_CONT:
SAVE_STOP:
pop ix
jp __STOP
LOCAL CHAN_OPEN
LOCAL PO_MSG
LOCAL WAIT_KEY
LOCAL SA_BYTES
CHAN_OPEN EQU 1601h
PO_MSG EQU 0C0Ah
WAIT_KEY EQU 15D4h
SA_BYTES EQU 04C6h
ROM_SAVE:
push hl
ld a, 0FDh
call CHAN_OPEN
xor a
ld de, 09A1h
call PO_MSG
set 5, (iy + 02h)
call WAIT_KEY
push ix
ld de, 0011h
ld a, r
push af
xor a
call SA_BYTES
pop ix
ld b, 32h
LOCAL SA_1_SEC
SA_1_SEC:
halt
djnz SA_1_SEC
ld e, (ix + 0Bh)
ld d, (ix + 0Ch)
ld a, 0FFh
pop ix
call SA_BYTES
pop af
ret po
ei
ret
#line 144 "/zxbasic/library-asm/save.asm"
ENDP
#line 37 "save01.bas"
ZXBASIC_USER_DATA:
Expand Down

0 comments on commit c6878b7

Please sign in to comment.