prodos-drivers/b.s

665 lines
16 KiB
ArmAsm
Raw Normal View History

2017-12-09 17:03:44 +00:00
;;; Disassembly of BYE.SYSTEM (Bird's Better Bye)
2017-11-12 04:44:15 +00:00
.setcpu "65C02"
2017-12-09 17:03:44 +00:00
.include "apple2.inc"
2017-11-12 04:44:15 +00:00
.include "prodos.inc"
2017-12-09 21:00:27 +00:00
RESETVEC := $3F2
2017-11-12 04:44:15 +00:00
RAMRDOFF := $C002
RAMRDON := $C003
RAMWRTOFF := $C004
RAMWRTON := $C005
ALTZPOFF := $C008
ALTZPON := $C009
ROMINNW := $C082
ROMINWB1 := $C089
LC300 := $C300
MON_SETTXT := $FB39
MON_TABV := $FB5B
SETPWRC := $FB6F
BELL1 := $FBDD
MON_HOME := $FC58
COUT := $FDED
SETINV := $FE80
SETNORM := $FE84
2017-12-09 17:29:35 +00:00
COL80HPOS := $057B
2017-12-09 17:03:44 +00:00
2017-12-09 21:00:27 +00:00
;;; ProDOS
BITMAP := $BF58
2017-12-09 22:11:29 +00:00
BITMAP_SIZE := $18 ; Bits for pages $00 to $BF
DEVNUM := $BF30 ; Most recent accessed device
DEVCNT := $BF31 ; Number of on-line devices minus 1
DEVLST := $BF32 ; Up to 14 units
2017-12-09 17:03:44 +00:00
2017-12-09 21:00:27 +00:00
;;; ASCII
2017-12-09 17:03:44 +00:00
ASCII_TAB := $9
2017-12-09 21:00:27 +00:00
ASCII_DOWN := $A ; down arrow
ASCII_UP := $B ; up arrow
ASCII_CR := $D
ASCII_SYN := $16 ; scroll up
ASCII_ETB := $17 ; scroll down
ASCII_EM := $19 ; move cursor to upper left
2017-12-09 17:03:44 +00:00
ASCII_ESCAPE := $1B
;;; ------------------------------------------------------------
.define HI(char) (char|$80)
.macro HIASCII arg
.repeat .strlen(arg), i
.byte .strat(arg, i) | $80
.endrep
.endmacro
.macro HIASCIIZ arg
HIASCII arg
.byte 0
.endmacro
2017-12-09 22:11:29 +00:00
;;; ------------------------------------------------------------
;;; ProDOS Technical Reference Manual, 5.1.5.2:
;;;
;;; ProDOS MLI call $65, the QUIT call, moves addresses $D100 through
;;; $D3FF from the second 4K bank of RAM of the language card to
;;; $1000, and executes a JMP to $1000. What initially resides in that
;;; area is Apple's dispatcher code.
2017-12-09 21:00:27 +00:00
;;; ------------------------------------------------------------
;;; Entry point
2017-12-09 17:03:44 +00:00
;;; ------------------------------------------------------------
;; Loads at $2000 but executed at $1000.
2017-11-13 15:57:57 +00:00
2017-11-12 04:44:15 +00:00
.org $2000
L2000: jmp install_and_quit
install_src := *
2017-12-09 21:00:27 +00:00
;;; ------------------------------------------------------------
;;; Selector
;;; ------------------------------------------------------------
2017-11-12 04:44:15 +00:00
.org $1000
.proc bbb
2017-11-13 15:57:57 +00:00
2017-12-09 21:00:27 +00:00
prefix := $280 ; length-prefixed
filenames := $1400 ; each is length + 15 bytes
read_buffer := $2000 ; Also, start location for launched SYS files
2017-11-13 15:57:57 +00:00
2017-12-09 22:11:29 +00:00
mark_params := $60
mark_ref_num := $61
mark_position := $62 ; 3-bytes
next_device := $65 ; next device number to try
2017-12-09 21:00:27 +00:00
current_entry := $67 ; index of current entry
num_entries := $68 ; length of |filenames|
2017-11-13 15:57:57 +00:00
2017-12-09 22:11:29 +00:00
2017-12-09 21:00:27 +00:00
curr_len := $69 ; length of current entry name
curr_ptr := $6C ; address of current entry name (in |filenames|)
2017-12-09 17:03:44 +00:00
2017-12-09 21:00:27 +00:00
page_start := $73 ; index of first entry shown on screen
2017-12-09 17:29:35 +00:00
2017-12-09 22:11:29 +00:00
max_entries := 128 ; max # of entries; more are ignored
types_table := $74 ; high bit clear = dir, set = sys
2017-12-09 21:00:27 +00:00
top_row := 2 ; first row used on screen
bottom_row := 21 ; last row used on screen
;;; ------------------------------------------------------------
cld ; ProDOS protocol for QUIT routine
lda ROMINNW ; Page in ROM for reads, writes ignored
;; Point reset vector at this routine
stz RESETVEC
lda #>bbb
sta RESETVEC+1
2017-12-09 17:03:44 +00:00
2017-11-12 04:44:15 +00:00
jsr SETPWRC
lda #$A0
2017-12-09 21:00:27 +00:00
jsr LC300 ; Activate 80-Column Firmware
;; Update system bitmap
ldx #BITMAP_SIZE-1 ; zero it all out
2017-12-09 22:11:29 +00:00
: stz BITMAP,x
2017-11-12 04:44:15 +00:00
dex
2017-12-09 21:00:27 +00:00
bpl :-
2017-12-09 22:11:29 +00:00
inc BITMAP+BITMAP_SIZE-1 ; protect ProDOS global page
lda #%11001111 ; protect zp, stack, text page 1
sta BITMAP
;; Find device
lda #2
sta $60
ldx DEVCNT ; max device num
stx next_device
lda DEVNUM
2017-11-12 04:44:15 +00:00
bne L1042
2017-12-09 22:11:29 +00:00
check_device:
ldx next_device
lda DEVLST,x
cpx #1
bcs :+
ldx DEVCNT
2017-11-12 04:44:15 +00:00
inx
2017-12-09 22:11:29 +00:00
: dex
stx next_device
2017-11-12 04:44:15 +00:00
L1042: sta on_line_params_unit
MLI_CALL ON_LINE, on_line_params
2017-12-09 22:11:29 +00:00
bcs check_device
2017-11-12 04:44:15 +00:00
stz $6B
2017-11-13 15:57:57 +00:00
lda prefix+1
2017-11-12 04:44:15 +00:00
and #$0F
2017-12-09 22:11:29 +00:00
beq check_device
2017-11-12 04:44:15 +00:00
adc #$02
tax
2017-11-13 15:57:57 +00:00
L1059: stx prefix ; truncate prefix to length x
lda #'/'
sta prefix+1
sta prefix,x
stz prefix+1,x
2017-11-12 04:44:15 +00:00
MLI_CALL OPEN, open_params
bcc L107F
lda $6B
2017-12-09 22:11:29 +00:00
beq check_device
2017-11-12 04:44:15 +00:00
jsr BELL1
jsr L11DA
2017-11-13 15:57:57 +00:00
stx prefix
2017-11-12 04:44:15 +00:00
jmp keyboard_loop
2017-11-13 15:57:57 +00:00
L107F: inc $6B ; ???
2017-12-09 17:03:44 +00:00
stz num_entries
2017-11-12 04:44:15 +00:00
lda open_params_ref_num
sta read_params_ref_num
2017-12-09 22:11:29 +00:00
sta mark_ref_num
2017-11-12 04:44:15 +00:00
lda #$2B
sta read_params_request
stz read_params_request+1
2017-11-13 15:57:57 +00:00
jsr do_read
2017-11-12 04:44:15 +00:00
bcs L10B3
ldx #$03
L109A: lda $2023,x
sta $6E,x
dex
bpl L109A
sta read_params_request
lda #$01
sta $72
2017-12-09 22:11:29 +00:00
stz mark_position+1
stz mark_position+2
2017-11-12 04:44:15 +00:00
lda $70
ora $71
bne L10B5
2017-12-09 21:00:27 +00:00
L10B3: bra finish_read
2017-11-12 04:44:15 +00:00
L10B5: bit $71
bmi L10B3
2017-12-09 22:11:29 +00:00
L10B9: lda mark_position+1
2017-11-12 04:44:15 +00:00
and #$FE
2017-12-09 22:11:29 +00:00
sta mark_position+1
2017-11-12 04:44:15 +00:00
ldy $72
lda #$00
cpy $6F
bcc L10CE
tay
sty $72
2017-12-09 22:11:29 +00:00
inc mark+position+1
L10CC: inc mark_position+1
2017-11-12 04:44:15 +00:00
L10CE: dey
clc
bmi L10D8
adc $6E
bcc L10CE
bcs L10CC
L10D8: adc #$04
2017-12-09 22:11:29 +00:00
sta mark_position
MLI_CALL SET_MARK, mark_params
2017-11-12 04:44:15 +00:00
bcs L10B3
2017-11-13 15:57:57 +00:00
jsr do_read
2017-11-12 04:44:15 +00:00
bcs L10B3
inc $72
2017-11-13 15:57:57 +00:00
lda read_buffer
2017-11-12 04:44:15 +00:00
and #$F0
beq L10B9
dec $70
bne L10F8
dec $71
L10F8: ror $201E
bcc L10B5
lda $2010
cmp #$0F
beq L1108
cmp #$FF
bne L10B5
2017-12-09 17:03:44 +00:00
L1108: ldx num_entries
2017-12-09 22:11:29 +00:00
cpx #max_entries
2017-12-09 21:00:27 +00:00
bcs finish_read
2017-12-09 22:11:29 +00:00
sta types_table,x
2017-12-09 21:00:27 +00:00
jsr update_curr_ptr
2017-11-12 04:44:15 +00:00
ldy #$0F
2017-11-13 15:57:57 +00:00
L1115: lda read_buffer,y
2017-12-09 21:00:27 +00:00
sta (curr_ptr),y
2017-11-12 04:44:15 +00:00
dey
bpl L1115
iny
and #$0F
2017-12-09 21:00:27 +00:00
sta (curr_ptr),y
2017-12-09 17:03:44 +00:00
inc num_entries
2017-11-12 04:44:15 +00:00
bne L10B5
2017-12-09 22:11:29 +00:00
L1126: jmp check_device
2017-11-12 04:44:15 +00:00
2017-12-09 21:00:27 +00:00
finish_read:
MLI_CALL CLOSE, close_params
2017-11-12 04:44:15 +00:00
bcs L1126
2017-12-09 17:03:44 +00:00
2017-12-09 21:00:27 +00:00
draw_screen:
jsr MON_SETTXT ; TEXT
jsr MON_HOME ; HOME
lda #23 ; VTAB 23
2017-11-12 04:44:15 +00:00
jsr MON_TABV
2017-12-09 17:03:44 +00:00
;; Print help text
ldy #0
lda #20 ; HTAB 20
jsr cout_string_hpos
2017-12-09 21:00:27 +00:00
;; Draw prefix
jsr home
2017-12-09 17:03:44 +00:00
ldx #0
: lda prefix+1,x
2017-11-12 04:44:15 +00:00
beq L1153
2017-12-09 17:29:35 +00:00
jsr ascii_cout
2017-11-12 04:44:15 +00:00
inx
2017-12-09 17:03:44 +00:00
bne :-
L1153: stz current_entry
2017-12-09 17:29:35 +00:00
stz page_start
2017-12-09 17:03:44 +00:00
lda num_entries
2017-11-12 04:44:15 +00:00
beq keyboard_loop
2017-12-09 17:29:35 +00:00
cmp #bottom_row
2017-11-12 04:44:15 +00:00
bcc L1161
lda #$14
L1161: sta $6A
lda #$02
sta $22
sta $20
lda #$16
sta $21
sta $23
2017-12-09 17:03:44 +00:00
L116F: jsr draw_current_line
inc current_entry
2017-11-12 04:44:15 +00:00
dec $6A
bne L116F
2017-12-09 17:03:44 +00:00
stz current_entry
beq draw_current_line_inv
2017-12-09 17:29:35 +00:00
;;; ------------------------------------------------------------
2017-12-09 17:03:44 +00:00
.proc on_up
2017-12-09 21:00:27 +00:00
jsr draw_current_line ; clear inverse selection
2017-12-09 17:03:44 +00:00
ldx current_entry
2017-12-09 17:29:35 +00:00
beq draw_current_line_inv ; first one? just redraw
dec current_entry ; go to previous
2017-12-09 21:00:27 +00:00
lda CV
cmp #top_row ; at the top?
bne draw_current_line_inv ; if not, just draw
dec page_start ; yes, adjust page and
lda #ASCII_SYN ; scroll screen up
2017-12-09 17:03:44 +00:00
bne draw_current_line_with_char
.endproc
2017-11-12 04:44:15 +00:00
2017-12-09 17:29:35 +00:00
;;; ------------------------------------------------------------
2017-12-09 17:03:44 +00:00
.proc on_down
2017-12-09 21:00:27 +00:00
jsr draw_current_line ; clear inverse selection
2017-12-09 17:03:44 +00:00
ldx current_entry
2017-11-12 04:44:15 +00:00
inx
2017-12-09 21:00:27 +00:00
cpx num_entries ; past the limit?
bcs draw_current_line_inv ; yes, just redraw
stx current_entry ; go to next
lda CV
cmp #bottom_row ; at the bottom?
bne draw_current_line_inv ; if not, just draw
inc page_start ; yes, adjust page and
lda #ASCII_ETB ; scroll screen down
2017-12-09 17:03:44 +00:00
;; fall through
.endproc
2017-12-09 17:29:35 +00:00
;;; ------------------------------------------------------------
2017-12-09 17:03:44 +00:00
draw_current_line_with_char:
jsr COUT
draw_current_line_inv:
jsr SETINV
jsr draw_current_line
;; fall through
;;; ------------------------------------------------------------
2017-11-12 04:44:15 +00:00
2017-12-09 17:29:35 +00:00
.proc keyboard_loop
2017-11-12 04:44:15 +00:00
lda KBD
bpl keyboard_loop
sta KBDSTRB
jsr SETNORM
2017-12-09 17:03:44 +00:00
ldx num_entries
2017-12-09 17:29:35 +00:00
beq :+ ; no up/down/return if empty
2017-12-09 21:00:27 +00:00
cmp #HI(ASCII_CR)
2017-11-13 15:57:57 +00:00
beq on_return
2017-12-09 17:03:44 +00:00
cmp #HI(ASCII_DOWN)
2017-11-12 04:44:15 +00:00
beq on_down
2017-12-09 17:03:44 +00:00
cmp #HI(ASCII_UP)
2017-11-12 04:44:15 +00:00
beq on_up
2017-12-09 17:29:35 +00:00
: cmp #HI(ASCII_TAB)
2017-11-12 04:44:15 +00:00
beq next_drive
2017-12-09 17:03:44 +00:00
cmp #HI(ASCII_ESCAPE)
2017-11-12 04:44:15 +00:00
bne keyboard_loop
2017-12-09 17:29:35 +00:00
;; fall through
.endproc
;;; ------------------------------------------------------------
2017-11-12 04:44:15 +00:00
2017-12-09 17:29:35 +00:00
.proc on_escape
2017-11-12 04:44:15 +00:00
jsr L11DA
dec $6B
bra L11F1
2017-12-09 17:29:35 +00:00
.endproc
;;; ------------------------------------------------------------
2017-11-13 15:57:57 +00:00
L11DA: ldx prefix
2017-11-12 04:44:15 +00:00
L11DD: dex
2017-11-13 15:57:57 +00:00
lda prefix,x
cmp #'/'
2017-11-12 04:44:15 +00:00
bne L11DD
cpx #$01
bne L11EC
2017-11-13 15:57:57 +00:00
ldx prefix
2017-11-12 04:44:15 +00:00
L11EC: rts
next_drive:
2017-12-09 22:11:29 +00:00
jmp check_device
2017-11-12 04:44:15 +00:00
L11F0: inx
L11F1: jmp L1059
2017-12-09 17:29:35 +00:00
;;; ------------------------------------------------------------
.proc on_return
2017-11-13 15:57:57 +00:00
MLI_CALL SET_PREFIX, set_prefix_params
2017-11-12 04:44:15 +00:00
bcs next_drive
2017-12-09 17:03:44 +00:00
ldx current_entry
2017-12-09 21:00:27 +00:00
jsr update_curr_ptr
2017-11-13 15:57:57 +00:00
ldx prefix
: iny
2017-12-09 21:00:27 +00:00
lda (curr_ptr),y
2017-11-12 04:44:15 +00:00
inx
2017-11-13 15:57:57 +00:00
sta prefix,x
2017-12-09 21:00:27 +00:00
cpy curr_len
2017-11-13 15:57:57 +00:00
bcc :-
stx prefix
2017-12-09 17:03:44 +00:00
ldy current_entry
2017-12-09 22:11:29 +00:00
lda types_table,y
2017-11-13 15:57:57 +00:00
bpl L11F0 ; is directory???
2017-12-09 17:29:35 +00:00
;; nope, system file, so...
;; fall through
.endproc
2017-11-13 15:57:57 +00:00
2017-12-09 17:03:44 +00:00
;;; ------------------------------------------------------------
2017-11-13 15:57:57 +00:00
.proc launch_sys_file
2017-11-12 04:44:15 +00:00
jsr MON_SETTXT
jsr MON_HOME
2017-11-13 15:57:57 +00:00
lda #$95 ; Right arrow
2017-11-12 04:44:15 +00:00
jsr COUT
2017-11-13 15:57:57 +00:00
2017-11-12 04:44:15 +00:00
MLI_CALL OPEN, open_params
bcs next_drive
lda open_params_ref_num
sta read_params_ref_num
2017-11-13 15:57:57 +00:00
lda #$FF ; Load up to $FFFF bytes
2017-11-12 04:44:15 +00:00
sta read_params_request
sta read_params_request+1
2017-11-13 15:57:57 +00:00
jsr do_read
2017-11-12 04:44:15 +00:00
php
MLI_CALL CLOSE, close_params
plp
bcs next_drive
2017-11-13 15:57:57 +00:00
jmp read_buffer ; Invoke the loaded code
.endproc
2017-11-12 04:44:15 +00:00
2017-12-09 17:03:44 +00:00
;;; ------------------------------------------------------------
cout_string_hpos:
2017-12-09 21:00:27 +00:00
sta CH
2017-11-13 15:57:57 +00:00
2017-12-09 17:29:35 +00:00
.proc cout_string
2017-11-13 15:57:57 +00:00
lda help_string,y
2017-12-09 17:29:35 +00:00
beq done
2017-11-12 04:44:15 +00:00
jsr COUT
iny
2017-11-13 15:57:57 +00:00
bne cout_string
2017-12-09 17:29:35 +00:00
done: rts
.endproc
2017-11-12 04:44:15 +00:00
2017-12-09 17:29:35 +00:00
;;; ------------------------------------------------------------
2017-12-09 21:00:27 +00:00
;; Compute address/length of curr_ptr/curr_len
;; Call with entry index in X.
.proc update_curr_ptr
stz curr_ptr+1
2017-11-12 04:44:15 +00:00
txa
asl a
2017-12-09 21:00:27 +00:00
rol curr_ptr+1
2017-11-12 04:44:15 +00:00
asl a
2017-12-09 21:00:27 +00:00
rol curr_ptr+1
2017-11-12 04:44:15 +00:00
asl a
2017-12-09 21:00:27 +00:00
rol curr_ptr+1
2017-11-12 04:44:15 +00:00
asl a
2017-12-09 21:00:27 +00:00
rol curr_ptr+1
sta curr_ptr
lda #>filenames
2017-11-12 04:44:15 +00:00
clc
2017-12-09 21:00:27 +00:00
adc curr_ptr+1
sta curr_ptr+1
ldy #0
lda (curr_ptr),y
sta curr_len
2017-11-12 04:44:15 +00:00
rts
2017-12-09 21:00:27 +00:00
.endproc
2017-11-12 04:44:15 +00:00
2017-12-09 17:29:35 +00:00
;;; ------------------------------------------------------------
2017-12-09 17:03:44 +00:00
draw_current_line:
2017-12-09 17:29:35 +00:00
lda #2 ; hpos = 2
sta COL80HPOS
ldx current_entry ; vpos = entry - page_start + 2
2017-11-12 04:44:15 +00:00
txa
sec
2017-12-09 17:29:35 +00:00
sbc page_start
2017-11-12 04:44:15 +00:00
inc a
inc a
jsr MON_TABV
2017-12-09 17:29:35 +00:00
2017-12-09 22:11:29 +00:00
lda types_table,x
bmi name ; is sys file?
;; Draw folder glyph
2017-12-09 17:29:35 +00:00
stz COL80HPOS
2017-12-09 21:00:27 +00:00
lda INVFLG
2017-11-12 04:44:15 +00:00
pha
2017-11-13 15:57:57 +00:00
ldy #(folder_string - string_start) ; Draw folder glyphs
jsr cout_string
2017-11-12 04:44:15 +00:00
pla
2017-12-09 21:00:27 +00:00
sta INVFLG
2017-12-09 22:11:29 +00:00
;; Draw the name
name: jsr space
2017-12-09 21:00:27 +00:00
jsr update_curr_ptr
2017-11-12 04:44:15 +00:00
L129F: iny
2017-12-09 21:00:27 +00:00
lda (curr_ptr),y
2017-12-09 17:29:35 +00:00
jsr ascii_cout
2017-12-09 21:00:27 +00:00
cpy curr_len
2017-11-12 04:44:15 +00:00
bcc L129F
2017-12-09 21:00:27 +00:00
space: lda #HI(' ')
2017-12-09 17:29:35 +00:00
bne cout ; implicit RTS
2017-12-09 21:00:27 +00:00
home: lda #HI(ASCII_EM) ; move cursor to top left
2017-12-09 17:29:35 +00:00
;; Sets high bit before calling COUT
ascii_cout:
ora #$80
cout: jmp COUT
2017-11-12 04:44:15 +00:00
2017-12-09 17:03:44 +00:00
;;; ------------------------------------------------------------
2017-11-13 15:57:57 +00:00
.proc do_read
MLI_CALL READ, read_params
2017-11-12 04:44:15 +00:00
rts
2017-11-13 15:57:57 +00:00
.endproc
2017-11-12 04:44:15 +00:00
2017-12-09 17:03:44 +00:00
;;; ------------------------------------------------------------
2017-11-12 04:44:15 +00:00
2017-11-13 15:57:57 +00:00
string_start := *
2017-11-12 04:44:15 +00:00
.proc help_string
2017-12-09 17:03:44 +00:00
HIASCIIZ "RETURN: Select | TAB: Chg Vol | ESC: Back"
2017-11-12 04:44:15 +00:00
.endproc
;; Mousetext sequence: Enable, folder left, folder right, disable
.proc folder_string
.byte $0F,$1B,$D8,$D9,$18,$0E
.byte 0 ; null terminated
.endproc
2017-12-09 17:03:44 +00:00
;;; ------------------------------------------------------------
2017-11-12 04:44:15 +00:00
.proc open_params
params: .byte 3
2017-11-13 15:57:57 +00:00
path: .addr prefix
2017-11-12 04:44:15 +00:00
buffer: .addr $1C00
ref_num:.byte 0
.endproc
open_params_ref_num := open_params::ref_num
.proc close_params
params: .byte 1
ref_num:.byte 0
.endproc
.proc on_line_params
params: .byte 2
unit: .byte $60
2017-11-13 15:57:57 +00:00
buffer: .addr prefix+1
2017-11-12 04:44:15 +00:00
.endproc
on_line_params_unit := on_line_params::unit
.proc set_prefix_params
params: .byte 1
2017-11-13 15:57:57 +00:00
path: .addr prefix
2017-11-12 04:44:15 +00:00
.endproc
.proc read_params
params: .byte 4
ref_num:.byte 1
2017-11-13 15:57:57 +00:00
buffer: .word read_buffer
2017-11-12 04:44:15 +00:00
request:.word 0
trans: .word 0
.endproc
read_params_ref_num := read_params::ref_num
read_params_request := read_params::request
2017-12-09 17:03:44 +00:00
;;; ------------------------------------------------------------
2017-12-09 21:11:36 +00:00
.res $13FF-*-2, 0
.byte $48,$AD ; 72, 173 ???
2017-11-12 04:44:15 +00:00
.endproc
.assert .sizeof(bbb) = $3FF, error, "Expected size is $3FF"
2017-12-09 17:03:44 +00:00
;;; ------------------------------------------------------------
2017-12-09 21:00:27 +00:00
;;; Installer
;;; ------------------------------------------------------------
2017-12-09 17:03:44 +00:00
2017-12-09 21:11:36 +00:00
.org $2402
2017-12-09 17:03:44 +00:00
.proc install_and_quit
2017-11-12 04:44:15 +00:00
jsr install
2017-12-09 17:03:44 +00:00
MLI_CALL QUIT, params
.proc params
2017-11-12 04:44:15 +00:00
params: .byte 4
type: .byte 0
res1: .word 0
res2: .byte 0
res3: .addr 0
.endproc
2017-12-09 17:03:44 +00:00
.endproc
;;; ------------------------------------------------------------
2017-11-12 04:44:15 +00:00
.proc install
src := install_src
end := install_src + .sizeof(bbb)
2017-12-09 21:11:36 +00:00
dst := $D100 ; Install location in ProDOS (bank 2)
2017-11-12 04:44:15 +00:00
src_ptr := $19
dst_ptr := $1B
sta ALTZPOFF
lda ROMIN
lda ROMIN
lda #>src
sta src_ptr+1
lda #<src
sta src_ptr
lda #>dst
sta dst_ptr+1
lda #<dst
sta dst_ptr
loop: lda (src_ptr)
sta (dst_ptr)
inc src_ptr
bne :+
inc src_ptr+1
: inc dst_ptr
bne :+
inc dst_ptr+1
: lda src_ptr+1
cmp #>end
bne loop
lda src_ptr
cmp #<end
bne loop
lda (src_ptr) ; WTF??
sta (dst_ptr)
sta ALTZPOFF
sta ROMINWB1
sta ROMINWB1
rts
.endproc