Skip to content

Commit

Permalink
[BANNEX] Change EDIT to use the current device number (basic_fa) (X16…
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-b-jakobsson authored Oct 9, 2023
1 parent 12a3d9b commit 9247e6e
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions bannex/x16edit.s
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
.include "banks.inc"

.export x16edit
.import bajsrfar, frmevl, valtyp, fcerr, frefac, index1
.import bajsrfar, frmevl, valtyp, fcerr, frefac, index1, basic_fa

.segment "ANNEX"

.proc x16edit
beq new ; No input param, open editor with a new empty buffer
jsr frmevl ; Evaluate input
bit valtyp
bmi file ; Input is a string, try to open file in the editor
bmi set_file ; Input is a string, try to open file in the editor

error:
jmp fcerr ; Input was not a string => error

file:
set_file:
jsr frefac ; Get string
beq new ; String is empty, open new empty buffer

Expand All @@ -23,20 +23,27 @@ file:
sta $02 ; R0L = file name address low
lda index1+1
sta $03 ; R0H = file name address high
ldx #10 ; First RAM bank used by the editor
ldy #255 ; Last RAM bank used by the editor

jsr bajsrfar
.word $C003
.byte BANK_X16EDIT
rts
bra launch

new:
stz $04 ; R1L = file name length, 0 => no file

launch:
ldx #10 ; First RAM bank used by the editor
ldy #255 ; Last RAM bank used by the editor
stz $04 ; R1L = file name length, 0 => no file
stz $05 ; Default value: Auto-indent and word
stz $06 ; Default value: Tab stop width
stz $07 ; Default value: Word wrap position
lda basic_fa
sta $08 ; Set current active device number
stz $09 ; Default value: text/background
stz $0a ; Default value: header
stz $0b ; Default value: status bar

jsr bajsrfar
.word $C003
.word $C006
.byte BANK_X16EDIT
rts


.endproc

0 comments on commit 9247e6e

Please sign in to comment.