mirror of
https://github.com/a2geek/basic-system-cmd.git
synced 2024-06-19 10:29:29 +00:00
Handling switches correctly.
This commit is contained in:
parent
9f38bb4c43
commit
7c2c18bb43
83
online.asm
83
online.asm
|
@ -39,7 +39,8 @@ extrncmd = $be06 ; External command JMP vector
|
||||||
xtrnaddr = $be50 ; Execution address of external command
|
xtrnaddr = $be50 ; Execution address of external command
|
||||||
xlen = $be52 ; Length of command string-1
|
xlen = $be52 ; Length of command string-1
|
||||||
xcnum = $be53 ; BASIC cmd number (external command = 0)
|
xcnum = $be53 ; BASIC cmd number (external command = 0)
|
||||||
pbits = $be54 ; Parameter bits
|
pbits = $be54 ; Parameter bits allowed (2 bytes)
|
||||||
|
fbits = $be56 ; Parameter bits found
|
||||||
vslot = $be61
|
vslot = $be61
|
||||||
vdriv = $be62
|
vdriv = $be62
|
||||||
gosystem = $be70
|
gosystem = $be70
|
||||||
|
@ -48,6 +49,27 @@ sunitnum = $bec7
|
||||||
sbufadr = $bec8
|
sbufadr = $bec8
|
||||||
getbufr = $bef5
|
getbufr = $bef5
|
||||||
|
|
||||||
|
; Parameter bits flags (note setup for two bytes and for lo/hi usage)
|
||||||
|
|
||||||
|
pfix = $0080 ; Prefix needs fetching, pathname optional
|
||||||
|
slot = $0040 ; No parameters to be processed
|
||||||
|
rrun = $0020 ; Command only valid during program
|
||||||
|
fnopt = $0010 ; Filename is optional
|
||||||
|
crflg = $0008 ; CREATE allowed
|
||||||
|
t = $0004 ; File type
|
||||||
|
fn2 = $0002 ; Filename #2 for RENAME
|
||||||
|
fn1 = $0001 ; Filename expected
|
||||||
|
|
||||||
|
ad = $8000 ; Address
|
||||||
|
b = $4000 ; Byte
|
||||||
|
e = $2000 ; End address
|
||||||
|
l = $1000 ; Length
|
||||||
|
line = $0800 ; '@' line number
|
||||||
|
sd = $0400 ; Slot and drive numbers
|
||||||
|
f = $0200 ; Field
|
||||||
|
r = $0100 ; Record
|
||||||
|
v = $0000 ; Volume number ignored
|
||||||
|
|
||||||
; MONITOR locations:
|
; MONITOR locations:
|
||||||
|
|
||||||
crout = $fd8e
|
crout = $fd8e
|
||||||
|
@ -131,6 +153,8 @@ entry:
|
||||||
cpx #cmdlen
|
cpx #cmdlen
|
||||||
bne :--
|
bne :--
|
||||||
|
|
||||||
|
; Setup for BASIC.SYSTEM to parse
|
||||||
|
opts = fnopt|sd ; Filename is optional (due to glitch) and slot and drive
|
||||||
lda #cmdlen-1
|
lda #cmdlen-1
|
||||||
sta xlen
|
sta xlen
|
||||||
lda #<online
|
lda #<online
|
||||||
|
@ -138,12 +162,10 @@ entry:
|
||||||
lda #>online
|
lda #>online
|
||||||
sta xtrnaddr+1
|
sta xtrnaddr+1
|
||||||
stz xcnum
|
stz xcnum
|
||||||
lda #$10 ; Filename is optional
|
lda #<opts
|
||||||
sta pbits
|
sta pbits
|
||||||
lda #$04 ; Slot and drive numbers
|
lda #>opts
|
||||||
sta pbits+1
|
sta pbits+1
|
||||||
stz vslot
|
|
||||||
stz vdriv
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -151,12 +173,6 @@ notOurCommand:
|
||||||
sec
|
sec
|
||||||
jmp (nextcmd)
|
jmp (nextcmd)
|
||||||
|
|
||||||
nextcmd: .word 0
|
|
||||||
|
|
||||||
cmdtable:
|
|
||||||
asciih "ONLINE"
|
|
||||||
cmdlen = *-cmdtable
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; Perform ONLINE command
|
; Perform ONLINE command
|
||||||
; Note we use the input buffer address
|
; Note we use the input buffer address
|
||||||
|
@ -173,8 +189,11 @@ cmdlen = *-cmdtable
|
||||||
; S5 D1 ERR=$57 (S7 D1)
|
; S5 D1 ERR=$57 (S7 D1)
|
||||||
;
|
;
|
||||||
online:
|
online:
|
||||||
lda vdriv
|
lda #>sd
|
||||||
asl
|
bit fbits+1
|
||||||
|
beq @1 ; Bit was NOT set
|
||||||
|
lda vdriv ; 1 or 2, use 2nd bit to toggle drive (then drive 1 has bit off, drive 2 has bit on)
|
||||||
|
and #%00000010
|
||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
ora vslot
|
ora vslot
|
||||||
|
@ -183,13 +202,13 @@ online:
|
||||||
asl
|
asl
|
||||||
asl
|
asl
|
||||||
sta sunitnum
|
sta sunitnum
|
||||||
stz sbufadr
|
@1: stz sbufadr
|
||||||
lda #>buffer
|
lda #>buffer
|
||||||
sta sbufadr+1
|
sta sbufadr+1
|
||||||
|
; Note: if we have a specific unit, this is not zero terminated -- fake it!
|
||||||
|
stz buffer+16
|
||||||
lda #$C5 ; ONLINE system command
|
lda #$C5 ; ONLINE system command
|
||||||
jsr gosystem
|
jsr gosystem
|
||||||
bcc @continue
|
|
||||||
rts
|
|
||||||
|
|
||||||
@continue:
|
@continue:
|
||||||
ldx #0
|
ldx #0
|
||||||
|
@ -197,8 +216,7 @@ online:
|
||||||
ldy buffer,x
|
ldy buffer,x
|
||||||
beq @exit
|
beq @exit
|
||||||
jsr printsd
|
jsr printsd
|
||||||
lda #' '|$80
|
jsr printspc
|
||||||
jsr cout
|
|
||||||
tya
|
tya
|
||||||
and #$0f
|
and #$0f
|
||||||
beq @deverr
|
beq @deverr
|
||||||
|
@ -225,22 +243,20 @@ online:
|
||||||
jmp crout
|
jmp crout
|
||||||
; A device error message
|
; A device error message
|
||||||
@deverr:
|
@deverr:
|
||||||
lda #'E'|$80
|
ldy #0
|
||||||
|
: lda msgERR,y
|
||||||
|
beq :+
|
||||||
jsr cout
|
jsr cout
|
||||||
lda #'R'|$80
|
iny
|
||||||
jsr cout
|
bne :-
|
||||||
jsr cout
|
: inx
|
||||||
lda #'='|$80
|
|
||||||
jsr cout
|
|
||||||
inx
|
|
||||||
lda buffer,x
|
lda buffer,x
|
||||||
tay ; short-term save
|
tay ; short-term save
|
||||||
jsr prbyte
|
jsr prbyte
|
||||||
tya
|
tya
|
||||||
cmp #$57 ; duplicate volume error
|
cmp #$57 ; duplicate volume error
|
||||||
bne @adjust
|
bne @adjust
|
||||||
lda #' '|$80
|
jsr printspc
|
||||||
jsr cout
|
|
||||||
lda #'('|$80
|
lda #'('|$80
|
||||||
jsr cout
|
jsr cout
|
||||||
inx
|
inx
|
||||||
|
@ -271,5 +287,18 @@ printsd:
|
||||||
adc #'1'|$80 ; ... making the '1' a '2'
|
adc #'1'|$80 ; ... making the '1' a '2'
|
||||||
jmp cout
|
jmp cout
|
||||||
|
|
||||||
|
printspc:
|
||||||
|
lda #' '|$80
|
||||||
|
jmp cout
|
||||||
|
|
||||||
|
msgERR:
|
||||||
|
asciizh "ERR=$"
|
||||||
|
|
||||||
|
cmdtable:
|
||||||
|
asciih "ONLINE"
|
||||||
|
cmdlen = *-cmdtable
|
||||||
|
|
||||||
|
nextcmd: .word 0
|
||||||
|
|
||||||
_CodeEndAddress:
|
_CodeEndAddress:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user