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#265 from boriel/bugfix/SAVE_err
Browse files Browse the repository at this point in the history
Bugfix/save err
  • Loading branch information
boriel committed Mar 31, 2020
2 parents c6878b7 + 2bcfc31 commit a7a26e4
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 31 deletions.
37 changes: 30 additions & 7 deletions library-asm/save.asm
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ SAVE_CONT:
ldir ; Copy String block NAME
ld l, (ix + 13)
ld h, (ix + 14) ; Restores start of bytes

ld a, r
push af
call ROM_SAVE

LOCAL NO_INT
pop af
jp po, NO_INT
ei
NO_INT:
; Recovers ECHO_E since ROM SAVE changes it
ld hl, 1821h
ld (23682), hl
Expand All @@ -98,14 +106,15 @@ SAVE_STOP:
LOCAL PO_MSG
LOCAL WAIT_KEY
LOCAL SA_BYTES
LOCAL SA_CHK_BRK
LOCAL SA_CONT

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
Expand All @@ -116,12 +125,17 @@ ROM_SAVE:
call WAIT_KEY
push ix
ld de, 0011h
ld a, r
push af
xor a
call SA_BYTES
pop ix

call SA_CHK_BRK
jr c, SA_CONT
pop ix
ret

SA_CONT:
ei
ld b, 32h

LOCAL SA_1_SEC
Expand All @@ -135,9 +149,18 @@ SA_1_SEC:
pop ix
call SA_BYTES

pop af
ret po
ei
SA_CHK_BRK:
ld b, a
ld a, (5C48h)
and 38h
rrca
rrca
rrca
out (0FEh), a
ld a, 7Fh
in a, (0FEh)
rra
ld a, b
ret

#endif
Expand Down
34 changes: 28 additions & 6 deletions tests/functional/save.asm
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,14 @@ SAVE_CONT:
ldir ; Copy String block NAME
ld l, (ix + 13)
ld h, (ix + 14) ; Restores start of bytes
ld a, r
push af
call ROM_SAVE
LOCAL NO_INT
pop af
jp po, NO_INT
ei
NO_INT:
; Recovers ECHO_E since ROM SAVE changes it
ld hl, 1821h
ld (23682), hl
Expand All @@ -452,6 +459,8 @@ SAVE_STOP:
LOCAL PO_MSG
LOCAL WAIT_KEY
LOCAL SA_BYTES
LOCAL SA_CHK_BRK
LOCAL SA_CONT
CHAN_OPEN EQU 1601h
PO_MSG EQU 0C0Ah
WAIT_KEY EQU 15D4h
Expand All @@ -467,11 +476,15 @@ ROM_SAVE:
call WAIT_KEY
push ix
ld de, 0011h
ld a, r
push af
xor a
call SA_BYTES
pop ix
call SA_CHK_BRK
jr c, SA_CONT
pop ix
ret
SA_CONT:
ei
ld b, 32h
LOCAL SA_1_SEC
SA_1_SEC:
Expand All @@ -482,11 +495,20 @@ SA_1_SEC:
ld a, 0FFh
pop ix
call SA_BYTES
pop af
ret po
ei
SA_CHK_BRK:
ld b, a
ld a, (5C48h)
and 38h
rrca
rrca
rrca
out (0FEh), a
ld a, 7Fh
in a, (0FEh)
rra
ld a, b
ret
#line 144 "/zxbasic/library-asm/save.asm"
#line 167 "/zxbasic/library-asm/save.asm"
ENDP
#line 33 "save.bas"
ZXBASIC_USER_DATA:
Expand Down
34 changes: 28 additions & 6 deletions tests/functional/save01.asm
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,14 @@ SAVE_CONT:
ldir ; Copy String block NAME
ld l, (ix + 13)
ld h, (ix + 14) ; Restores start of bytes
ld a, r
push af
call ROM_SAVE
LOCAL NO_INT
pop af
jp po, NO_INT
ei
NO_INT:
; Recovers ECHO_E since ROM SAVE changes it
ld hl, 1821h
ld (23682), hl
Expand All @@ -456,6 +463,8 @@ SAVE_STOP:
LOCAL PO_MSG
LOCAL WAIT_KEY
LOCAL SA_BYTES
LOCAL SA_CHK_BRK
LOCAL SA_CONT
CHAN_OPEN EQU 1601h
PO_MSG EQU 0C0Ah
WAIT_KEY EQU 15D4h
Expand All @@ -471,11 +480,15 @@ ROM_SAVE:
call WAIT_KEY
push ix
ld de, 0011h
ld a, r
push af
xor a
call SA_BYTES
pop ix
call SA_CHK_BRK
jr c, SA_CONT
pop ix
ret
SA_CONT:
ei
ld b, 32h
LOCAL SA_1_SEC
SA_1_SEC:
Expand All @@ -486,11 +499,20 @@ SA_1_SEC:
ld a, 0FFh
pop ix
call SA_BYTES
pop af
ret po
ei
SA_CHK_BRK:
ld b, a
ld a, (5C48h)
and 38h
rrca
rrca
rrca
out (0FEh), a
ld a, 7Fh
in a, (0FEh)
rra
ld a, b
ret
#line 144 "/zxbasic/library-asm/save.asm"
#line 167 "/zxbasic/library-asm/save.asm"
ENDP
#line 37 "save01.bas"
ZXBASIC_USER_DATA:
Expand Down
34 changes: 28 additions & 6 deletions tests/functional/save02.asm
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,14 @@ SAVE_CONT:
ldir ; Copy String block NAME
ld l, (ix + 13)
ld h, (ix + 14) ; Restores start of bytes
ld a, r
push af
call ROM_SAVE
LOCAL NO_INT
pop af
jp po, NO_INT
ei
NO_INT:
; Recovers ECHO_E since ROM SAVE changes it
ld hl, 1821h
ld (23682), hl
Expand All @@ -453,6 +460,8 @@ SAVE_STOP:
LOCAL PO_MSG
LOCAL WAIT_KEY
LOCAL SA_BYTES
LOCAL SA_CHK_BRK
LOCAL SA_CONT
CHAN_OPEN EQU 1601h
PO_MSG EQU 0C0Ah
WAIT_KEY EQU 15D4h
Expand All @@ -468,11 +477,15 @@ ROM_SAVE:
call WAIT_KEY
push ix
ld de, 0011h
ld a, r
push af
xor a
call SA_BYTES
pop ix
call SA_CHK_BRK
jr c, SA_CONT
pop ix
ret
SA_CONT:
ei
ld b, 32h
LOCAL SA_1_SEC
SA_1_SEC:
Expand All @@ -483,11 +496,20 @@ SA_1_SEC:
ld a, 0FFh
pop ix
call SA_BYTES
pop af
ret po
ei
SA_CHK_BRK:
ld b, a
ld a, (5C48h)
and 38h
rrca
rrca
rrca
out (0FEh), a
ld a, 7Fh
in a, (0FEh)
rra
ld a, b
ret
#line 144 "/zxbasic/library-asm/save.asm"
#line 167 "/zxbasic/library-asm/save.asm"
ENDP
#line 34 "save02.bas"
ZXBASIC_USER_DATA:
Expand Down
34 changes: 28 additions & 6 deletions tests/functional/save03.asm
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,14 @@ SAVE_CONT:
ldir ; Copy String block NAME
ld l, (ix + 13)
ld h, (ix + 14) ; Restores start of bytes
ld a, r
push af
call ROM_SAVE
LOCAL NO_INT
pop af
jp po, NO_INT
ei
NO_INT:
; Recovers ECHO_E since ROM SAVE changes it
ld hl, 1821h
ld (23682), hl
Expand All @@ -452,6 +459,8 @@ SAVE_STOP:
LOCAL PO_MSG
LOCAL WAIT_KEY
LOCAL SA_BYTES
LOCAL SA_CHK_BRK
LOCAL SA_CONT
CHAN_OPEN EQU 1601h
PO_MSG EQU 0C0Ah
WAIT_KEY EQU 15D4h
Expand All @@ -467,11 +476,15 @@ ROM_SAVE:
call WAIT_KEY
push ix
ld de, 0011h
ld a, r
push af
xor a
call SA_BYTES
pop ix
call SA_CHK_BRK
jr c, SA_CONT
pop ix
ret
SA_CONT:
ei
ld b, 32h
LOCAL SA_1_SEC
SA_1_SEC:
Expand All @@ -482,11 +495,20 @@ SA_1_SEC:
ld a, 0FFh
pop ix
call SA_BYTES
pop af
ret po
ei
SA_CHK_BRK:
ld b, a
ld a, (5C48h)
and 38h
rrca
rrca
rrca
out (0FEh), a
ld a, 7Fh
in a, (0FEh)
rra
ld a, b
ret
#line 144 "/zxbasic/library-asm/save.asm"
#line 167 "/zxbasic/library-asm/save.asm"
ENDP
#line 33 "save03.bas"
ZXBASIC_USER_DATA:
Expand Down

0 comments on commit a7a26e4

Please sign in to comment.