Skip to content

Commit 5034041

Browse files
committed
Install newer version of e-accelerator.
1 parent a0ae8ad commit 5034041

2 files changed

Lines changed: 63 additions & 77 deletions

File tree

disk/dos/efast.asm

Lines changed: 63 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -65,49 +65,48 @@ copy_e: lda EDITRV,x
6565
; Patch new HATABS, stored in current MEMLO
6666
lda MEMLO
6767
ldx MEMLO+1
68-
sta hatabs_l+1
69-
stx hatabs_h+1
7068
sta pntr
7169
stx pntr+1
7270

73-
; And store our new PUT
71+
; Store new DOSINI handler address
72+
sta DOSINI
73+
stx DOSINI+1
74+
75+
; Address of new PUT is at start of handler
7476
; (note, C is set here, so adds 1 less)
75-
adc #(handler_put-1 - handler_hatab) - 1
77+
adc #(handler_put - 1 - handler_start - 1)
7678
bcc :+
7779
inx
7880
: sta handler_hatab+6
7981
stx handler_hatab+7
8082

81-
; Store new DOSINI handler address
82-
sec
83-
adc #(handler_jdos - handler_put)
83+
; And store our new handler table
84+
clc
85+
adc #(handler_hatab - handler_put + 1)
8486
bcc :+
8587
inx
86-
: sta DOSINI
87-
stx DOSINI+1
88+
: sta hatabs_l+1
89+
stx hatabs_h+1
8890

8991
; And address of new MEMLO
9092
clc
91-
adc #(handler_end - handler_jdos)
93+
adc #(handler_end - handler_hatab)
9294
sta sMEMLOL+1
9395

9496
; If we adjusted X it means that in the reload handler
9597
; we also need to increment X, so keeps the "INX" in the code
9698
bcs :+
97-
cpx pntr+1
98-
bne :+
9999
; We did not increment X, replace the INX with a NOP.
100100
lda #234 ; NOP
101101
sta sMEMLOH
102102
:
103103

104104
; Copy our handler code to new position
105105
copy_handler:
106-
ldy #(handler_end - handler_put + 15)
107-
cloop: lda handler_hatab,y
108-
sta (pntr),y
106+
ldy #(handler_end - handler_start)
107+
cloop: lda handler_start-1,y
109108
dey
110-
cpy #$FF
109+
sta (pntr),y
111110
bne cloop
112111

113112
; Store new MEMLO / HATAB
@@ -140,67 +139,70 @@ call_cio:
140139
.assert (>install_msg) = (>error_msg), error, "messages must be in the same page"
141140
.assert (>install_msg) = (>dev_e), error, "e: must be in the same page"
142141

143-
install_msg:
142+
dev_e:
143+
install_msg: ; NOTE: message must begin with "E:"
144144
.byte "E:Fast Installed", $9B
145+
145146
error_msg:
146147
.byte "Can't install", $FD, $9B
147148

148-
dev_e:
149-
.byte "E:", $9B
150149

151150
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
152151
;
153152
; Installed handler
154153
;
154+
handler_start:
155155

156-
; File HEADER
157-
.segment "HANDHDR"
158-
.word handler_put
159-
.word handler_end - 1
160-
.segment "HANDLER"
156+
; Calls original DOSINI, adjust MEMLO and reinstall E: handler
157+
handler_jdos:
158+
jsr $FFFF
161159

162-
; Handler device table
163-
handler_hatab = handler_put - 16
160+
; Load HATABS value:
161+
load_hatab:
162+
163+
hatabs_l:
164+
lda #$00
165+
sta HATABS+1
166+
hatabs_h:
167+
ldx #$00
168+
stx HATABS+2
169+
170+
; Loads MEMLO value
171+
sMEMLOL:lda #$00
172+
sMEMLOH:inx ; This is replaced by a NOP if possible
173+
174+
sta MEMLO
175+
stx MEMLO+1
176+
rts
164177

165178
; Handler PUT function
166179
handler_put:
180+
; Don't handle in graphics modes
181+
ldx DINDEX
182+
bne jhand
183+
167184
; Don't handle wrap at last column!
168185
ldx COLCRS
169186
cpx RMARGN
170187
bcs jhand
171188

172-
; And don't handle in graphics modes
173-
ldx DINDEX
174-
bne jhand
175-
176189
; Check for control character:
177190
; $1B, $1C, $1D, $1E, $1F, $7D, $7E, $7F
178191
; $9B, $9C, $9D, $9E, $9F, $FD, $FE, $FF
179192
;
180-
; To ignore high bit, store in X the shifted character
181-
asl
193+
; Store original in Y and shift A to remove high bit:
182194
tay
183-
; Restore full value in A
184-
ror
185-
186-
cpy #2*ATCLR ; chars >= $7D are special chars
187-
bcs jhand
188-
cpy #$C0 ; chars >= $60 don't need conversion
189-
bcs conv_ok
190-
cpy #$40 ; chars >= $20 needs -$20 (upper case and numbers)
191-
bcs normal_char
192-
cpy #2*ATESC ; chars <= $1B needs +$40 (control chars)
193-
bcc ctrl_char
194-
195-
; Special character jump to old handler
196-
jhand: jmp $FFFF
197-
198-
; Convert ATASCII to screen codes
199-
ctrl_char:
200-
adc #$61 ; Chars from $00 to $1F, add $40 (+$21, subtracted bellow)
201-
normal_char:
202-
sbc #$20 ; Chars from $20 to $5F, subtract $20
195+
asl
196+
cmp #2*ATCLR
197+
bcs jhandy ; Skip $7D-$7F and $FD-$FF
198+
sbc #$3F
199+
bpl conv_ok ; $20-$5F and $A0-$DF are ok
200+
cmp #$C0 + 2 * ATESC - 1
201+
bcs jhandy ; Skip $1B-$1F and $9B-$9F
202+
eor #$40
203203
conv_ok:
204+
cpy #$80 ; Restore sign
205+
ror
204206

205207
; Check break and stop on START/STOP flag
206208
wait_stop:
@@ -271,10 +273,9 @@ skip_adr:
271273
no_cursor:
272274

273275
; Update column
274-
ldx COLCRS
275-
inx
276-
stx COLCRS
277-
stx OLDCOL
276+
inc COLCRS
277+
lda COLCRS
278+
sta OLDCOL
278279
inc LOGCOL
279280

280281
; Reset ESC flag
@@ -283,29 +284,14 @@ no_cursor:
283284
iny
284285
rts
285286

286-
; Calls original DOSINI, adjust MEMLO and reinstall E: handler
287-
handler_jdos:
288-
jsr $FFFF
289-
290-
; Load HATABS value:
291-
load_hatab:
292-
293-
hatabs_l:
294-
lda #$00
295-
sta HATABS+1
296-
hatabs_h:
297-
ldx #$00
298-
stx HATABS+2
299-
300-
; Loads MEMLO value
301-
sMEMLOL:lda #$00
302-
sMEMLOH:inx ; This is replaced by a NOP if possible
287+
; Calls original E: put
288+
jhandy: tya
289+
jhand: jmp $FFFF
303290

304-
sta MEMLO
305-
stx MEMLO+1
306-
rts
291+
; Handler device table
292+
handler_hatab:
307293

308294
; End of resident handler
309-
handler_end:
295+
handler_end = handler_hatab + 16
310296

311297
; vi:syntax=asm_ca65

disk/dos/efast.com

-17 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)