mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-24 21:31:20 +00:00
186 lines
3.2 KiB
Plaintext
186 lines
3.2 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BOOT/BIN/EDIT
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/LIBSTR.I
|
||
*--------------------------------------
|
||
ZPPTR1 .EQ ZPBIN
|
||
ZPPTR2 .EQ ZPBIN+2
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp (.1,x)
|
||
.DA #$61 6502,Level 1 (65c02)
|
||
.DA #1 BIN Layout Version 1
|
||
.DA 0
|
||
.DA CS.END-CS.START Code Length To Relocate
|
||
.DA DS.END-DS.START Data Segment to Allocate
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
* Relocation Table
|
||
*--------------------------------------
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT lda #0
|
||
ldy #DS.END-DS.START-1
|
||
|
||
.1 sta (pData),y
|
||
dey
|
||
bpl .1
|
||
|
||
ldy #S.PS.hARGS
|
||
lda (pPs),y
|
||
beq .7
|
||
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>STYA ZPPTR1
|
||
|
||
lda (ZPPTR1)
|
||
cmp #'/'
|
||
bne .10
|
||
|
||
ldy #S.PS.hARGS
|
||
lda (pPs),y
|
||
bra .3
|
||
|
||
.10 ldy #S.PS.hARGS
|
||
lda (pPs),y
|
||
>PUSHA
|
||
ldy #S.PS.hPREFIX
|
||
lda (pPs),y
|
||
>PUSHA
|
||
>SYSCALL SYS.PStrCat
|
||
|
||
.3 ldy #hFileName
|
||
sta (pData),y
|
||
|
||
>SYSCALL SYS.LoadFileA
|
||
bcs .9
|
||
bra .8
|
||
|
||
.7 >PUSHWI 16
|
||
>PUSHBI 0
|
||
>SYSCALL SYS.GetMem
|
||
bcs .9
|
||
>LDYAI 0
|
||
|
||
.8 pha Y,A = len,X=hMem
|
||
tya
|
||
ldy #FileLen
|
||
sta (pData),y
|
||
iny
|
||
pla
|
||
sta (pData),y
|
||
|
||
txa
|
||
ldy #hBuffer
|
||
sta (pData),y
|
||
|
||
lda #$80
|
||
ldy #bSaved
|
||
sta (pData),y
|
||
ldy #bInsert
|
||
sta (pData),y
|
||
|
||
lda #12
|
||
jsr COUT
|
||
|
||
lda (pPs)
|
||
ora #S.PS.F.EVENT Now accept events
|
||
sta (pPs)
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
CS.RUN ldy #bCANCEL
|
||
lda (pData),y
|
||
bne .9
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT ldy #S.EVT.hDEV is Event from active IN device?
|
||
lda (pEvent),y
|
||
ldy #S.PS.hINDEV
|
||
cmp (pPs),y
|
||
bne .9
|
||
|
||
lda (pEvent)
|
||
and #S.EVT.F.KEY is it a KEY event?
|
||
beq .9
|
||
|
||
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
|
||
lda (pEvent),y
|
||
bne .9
|
||
|
||
ldy #S.EVT.DATALO
|
||
lda (pEvent),y
|
||
cmp #$03 Ctrl-C
|
||
bne .1
|
||
|
||
lda #$FF
|
||
ldy #bCANCEL
|
||
sta (pData),y
|
||
bra .8
|
||
|
||
.1 cmp #$20
|
||
|
||
.8 clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT ldy #hBuffer
|
||
lda (pData),y
|
||
>SYSCALL SYS.FreeMemA
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CROUT lda #13
|
||
*--------------------------------------
|
||
COUT phx
|
||
phy
|
||
ldx #DEVMGR.COUT
|
||
jsr pDevJmp
|
||
ply
|
||
plx
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
bCANCEL .BS 1
|
||
hFileName .BS 1
|
||
hBuffer .BS 1
|
||
FileLen .BS 2
|
||
cPos .BS 1
|
||
rPos .BS 2
|
||
bInsert .BS 1
|
||
bSaved .BS 1
|
||
DS.END
|
||
.ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE BIN/EDIT.S
|
||
ASM
|