mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
199 lines
3.4 KiB
Plaintext
199 lines
3.4 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/KERNEL.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/A2OSX.API.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
|
||
|
||
lda #12
|
||
jsr COUT
|
||
|
||
ldy #S.PS.hARGS
|
||
lda (pPs),y
|
||
beq .7
|
||
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>STYA ZPQuickPtr1
|
||
|
||
lda (ZPQuickPtr1),y
|
||
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
|
||
tya
|
||
ldy #FileLen
|
||
sta (pData),y
|
||
iny
|
||
pla
|
||
sta (pData),y
|
||
txa
|
||
ldy #hBuffer
|
||
txa
|
||
sta (pData),y
|
||
|
||
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
|
||
|
||
.8 clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda #12
|
||
jsr COUT
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
PRBYTE pha
|
||
lsr
|
||
lsr
|
||
lsr
|
||
lsr
|
||
ora #$B0
|
||
cmp #$BA
|
||
bcc .1
|
||
adc #6
|
||
.1 jsr COUT
|
||
pla
|
||
and #$0F
|
||
ora #$B0
|
||
cmp #$BA
|
||
bcc COUT
|
||
adc #6
|
||
bra COUT
|
||
*--------------------------------------
|
||
CROUT lda #13
|
||
*--------------------------------------
|
||
COUT phx
|
||
phy
|
||
ldx #DEVMGR.COUT
|
||
jsr pDevJmp
|
||
ply
|
||
plx
|
||
rts
|
||
pDevJmp jmp (pDev)
|
||
*--------------------------------------
|
||
CS.END
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
bCANCEL .BS 1
|
||
hFileName .BS 1
|
||
hBuffer .BS 1
|
||
FileLen .BS 2
|
||
xPos .BS 2
|
||
yPos .BS 2
|
||
|
||
DS.END
|
||
.ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE BIN/EDIT.S
|
||
ASM
|