Browse Source

added EDT_C128

pull/5/head
Michael Steil 4 years ago
parent
commit
8590e91f37
  1. 533
      EDT_C128/buf.src
  2. 105
      EDT_C128/bufop.src
  3. 638
      EDT_C128/command.src
  4. 210
      EDT_C128/declare.src
  5. 652
      EDT_C128/dos.src
  6. 29
      EDT_C128/edt.src
  7. 138
      EDT_C128/help.src
  8. 627
      EDT_C128/kernal.src
  9. 742
      EDT_C128/keyops.src
  10. 238
      EDT_C128/keyproc.src
  11. 128
      EDT_C128/macro.src
  12. 447
      EDT_C128/main.src
  13. 386
      EDT_C128/plot.src
  14. 54
      EDT_C128/print.src
  15. 63
      EDT_C128/scroll.src
  16. 97
      EDT_C128/validate.src
  17. 5
      README.md
  18. 1
      build.sh

533
EDT_C128/buf.src

@ -0,0 +1,533 @@
.subttl EDT text buffer primatives.
;
;
;
;buffer primatives:
;
;
; the file is stored in two stacks. all chars before the current char
; are in the first stack. all chars after the current char are in
; the second stack. This is done to permit extremely rapid insertion of
; chars.
;
; the text within the two stacks is a seris of <cr> separated lines.
;
; several paramaeters use the concept of charecter number. this is
; in concept the offset of the char from the start of the text. This
; if done so as to permit rapid movement to certain locations within
; the file. ( such as the paste marker , etc. ).
;
; CHAR NUMBERS ARE STORED AS A POINTER WHERE THE CHAR WOULD BE
; IF THE CHARECTER WAS ON THE PRE-STACK !!!. Therefore if the buffer
; is aligned such that the char is the current char in the buffer,
; then PREP would yeild the char number.
;
; startp: points to first legal char position in buffer
; prep: has index or char position of "current char"
; points one past precious char.
; postp: points directly to the current charecter unless
; at eof in which case points to undefined.
; endp: points directly to past last legal position in buffer.
;
;
;
;
; zpage startp,2 ; start of test pointer
; zpage prep,2 ; pre stack pointer
;buf_pos = prep ; yet another name for that guy
; zpage postp,2 ; post stack pointer
; zpage stopp,2 ; end of text pointer
;
zpage buf_cr_flag ; flag set iff buffer routines add/sub a <cr>
; ( buf_insert, buf_remove only )
zpage buf_change_flag ; flag set if buffer contents change.
;
buf_init
ldai text_start startp, prep <= start of text
stax startp
stax prep
stax cur_pos cur_pos <= $3000
;
ldai text_end postp<= endp <= end of text
stax endp
stax postp
;
ldai 0
stax cr_count_pre cr_count(s) <= 0000
stax cr_count_post
;
clc return
rts
;
; four basic primitaves are defined for transfering
; chars from one list to another. These are for use only
; by other buffer routines ( do not call from key operations,
; because these do not affect the higher function flags like
; buf_cr_flag, and buf_changed flag ).
;
; push_post pushes a char after the current loc
; pull_post pulls a char from behind current loc.
; pre_push push a char infront of the current loc.
; pre_pull pull a char from infront of current loc.
;
;
buf_back_fast
jsr pre_pull
bcc push_post
rts
;
push_post ; if full
cmpdr postp,prep,x
bne 10$
sec ; puke
lda #error_insufficient_memory
rts
;
10$ decd postp ;dec post counter
;
ldy #0 ;store char
sta mmu_bank0
sta (postp),y
sta mmu_normal
cmp #cr ;if cr
bne 20$
incd cr_count_post incremennt cr counter
20$ clc ; return happy
rts
;
;
pull_post ; if empty stack
cmpdr postp,endp,x
bne 10$
lda #error_eob ; return error, and a null
rts
10$ ldy #0 ; load char at stack pointer
sta mmu_bank0
lda (postp),y
sta mmu_normal
incd postp ; increment stack pointer
cmp #cr ; if cr
bne 20$
decd cr_count_post decrement the cr_counter
20$ clc ; return happy
rts
;
;
;
pre_pull
cmpdr prep,startp,x ; if empty
bne 10$
lda #error_sob ; return error
sec
rts
;
10$ decd prep ; dec the pre pointer
ldy #0 ; a <= char @ prep
sta mmu_bank0
lda (prep),y
sta mmu_normal
cmp #cr
bne 20$
decd cr_count_pre
20$ clc
rts ; return happy
;
;
buf_advance_fast
jsr pull_post
bcc pre_push
rts
;
pre_push
cmpdr prep,postp,x ; if prep = postp
bne 10$
lda #error_insufficient_memory
sec
rts ; return unhappy
;
10$ ldy #0
sta mmu_bank0
sta (prep),y ;stash char
sta mmu_normal
incd prep ; point to next
cmp #cr
bne 20$
incd cr_count_pre
20$ clc ; return happy
rts
;
;
;
;
;
;buffer operations
; ( above primatives )
;
; these primatives simply move the buffer around
;
; buf_char
; returns current buffer char in .a
; buf_to_cursor
; moves buffer to last known cursor position
; buf_position
; adjusts buffer to char position in x,a
; buf_top
; positions buffer at top of file
; buf_bot
; positions buffer at eof
; buf_sol
; moves buffer to start of current line
; buf_eol
; moves buffer to end of current line
;
; buf_to_col
; moves buffer to the closest column available
; for the variable .a
; buf_col_return
; returns .a = the column for the current buffer position.
; buf_word_check
; returns c=1 iff at beginning of word
; buf_return_free
; returns x,a = number of free bytes in buffer
;
; the following operations modify the buffer and the number
; of charecters in the buffer.
;
; buf_insert
; inserts char into buffer
; ( also updates dot_pos if necessary )
; buf_remove
; deletes char from buffer
; ( also updates dot pos if neccesary )
; returns char in .a
;
; NOTE: buf_insert and buf_remove are NOT complementary.
; buf_insert advances the cursor position in the buffer,
; while buf_delete removes the current charecter, instead of
; the last inserted char.
;
; The following buffer operations modify the line_count variable.
; this variable is 8 bit twos complement. This is used to keep
; track of how many <crs> have been transversed to get to a certain
; cursor position.
; Note that the variable buf_cr_flag is set if any <crs> are encountered.
;
; buf_advance
; moves a char forward if possible
; buf_back
; moves a char back if possible
;
; buf_search_check
; checks to see if buffer is positioned at
; a copy of the search string
;
;
; simple posisitioning primatives
;
buf_char
cmpdr postp,endp,a ; if @ [eob]
bne 20$
lda #0 ; return null and error
sec
rts
;
20$ ldy #0 ; return char
sta mmu_bank0
lda (postp),y
sta mmu_normal
clc
rts
;
;
;
;
; buf_position
; sets buffers to specified position
; ( well not too quickly right now ).
;
zpage set_pos_temp,2
;
buf_to_cursor
ldax cur_pos
;
buf_position
stax set_pos_temp
;
10$ cmpdr prep,set_pos_temp,a
bne 20$
clc
rts
;
20$ bcc 40$
jsr buf_back_fast
bcc 10$
rts
;
40$ jsr buf_advance_fast
bcc 10$
rts
;
;
buf_top
lda #0
.byte $2c
buf_bot
lda #$ff
tax
jsr buf_position
clc
rts
;
;
; buf_sol
; set buffer so that it as at the start of the current line.
; ( if it is not already there )...
;
buf_sol
jsr buf_back_fast
bcs 90$
cmp #cr
bne buf_sol
jmp buf_advance_fast
90$ rts
;
buf_eol_entry
jsr pre_push
buf_eol
jsr pull_post
bcs 90$
cmp #cr
bne buf_eol_entry
jsr push_post
90$ clc
rts
;
;
;
; column primiatives for buffer.
;
zpage buf_col_temp,2 two bytes for buffer coloumn
zpage buf_col_count
;
buf_col_return
ldax buf_pos temp <= buffere psoition
stax buf_col_temp
lda #0 cout <= 0
sta buf_col_count
jsr buf_sol buf <= start of line
;
10$ cmpdr buf_pos,buf_col_temp,a while buf_pos < temp
bcs 80$
jsr buf_internal_advance do advance
bcc 10$ break if error
;
80$ lda buf_col_count a <= coloumn
clc return happy
rts
;
;
buf_to_col
sta buf_col_temp temp <= .a
lda #0 count <= 0
sta buf_col_count
jsr buf_sol buf <= start of line.
jmp 50$ go enter middle of loop
;
;
10$ jsr buf_internal_advance
bcs 80$
;
50$ jsr buf_char
bcs 80$
cmp #cr
beq 80$
lda buf_col_count
cmp buf_col_temp
bcc 10$
beq 80$
jsr buf_back opps, went too far, so back up a char
jmp buf_col_return and return
80$ lda buf_col_count
clc
rts
;
;
;buf_internal_advance
; advances buffer one byte.
; updates buffer coloumn count.
; returns next char after buffer in .a
; returns c=1 iff at end of buffer
;
;
buf_internal_advance
jsr buf_advance_fast advance a char
bcs 90$ if no error
cmp #tab if was tab
bne 20$
lda buf_col_count set to one before nextr tab stop
ora #$07
sta buf_col_count
jmp 80$ elseif was control
;
20$ and #%01111111
cmp #%00100000
bcs 80$
jsr 80$
jsr 80$
jsr 80$
80$ inc buf_col_count inc buf_col_count
bne 88$ if over_flow
dec buf_col_count dec buf_col_count
sec return w/ carry set...
rts
88$ clc return happy
90$ rts return
;
; return error if current char is not begining of a word.
; i.e. current = tab or <cr>
; or current not tab,<cr>, or space
; and previous is tab,<cr>, or space
;
buf_word_check
jsr buf_char if cannot read current char
bcs 80$ return happy( must be EOB )
cmp #tab if tab
beq 80$ return happy
cmp #cr if cr
beq 80$ return happy
cmp #space if space
beq 90$ return unhappy
;
;
jsr buf_back_fast back up a char
bcs 80$ if error, return happy ( mst be TOF )
jsr buf_char read char
pha save char, advance, recall char
jsr buf_advance_fast
pla
cmp #tab if tab
beq 80$ return happy
cmp #space if space
beq 80$ return happy
cmp #cr if cr
bne 90$
80$ clc return happy
rts
90$ sec return unhappy
rts
;
; buf_return_free
; sets x,a to number of free bytes in buffer
;
buf_return_free
ldax postp x,a <= postp - prep
sbcx prep
rts
;
;
;
;
;buf_insert
;
buf_insert
jsr pre_push push the byte onto the stack
bcs 90$ if ok
jsr buf_cr_check check for cr and set flags
ldx dot_flag if dots enabled
beq 80$
cmpdr buf_pos,dot_pos,a if buf_pos < dot_pos
bcs 80$
incd dot_pos inc dot_pos
80$ clc return happy
90$ rts
;
;
buf_remove
jsr pull_post pull "current char"
bcs 90$ if ok
pha save char
jsr buf_cr_check flag iff <Cr>
ldx dot_flag if dot dropped
beq 80$
cmpdr buf_pos,dot_pos,a if > buf_position
bcs 80$
decd dot_pos dec dot_pointer
80$ pla recall char
clc return happy
90$ rts return
;
;
;
; buf_advance
; moves a char forward if possible
; buf_back
; moves a char back if possible
; buf_search_forward
; searchs buffer for position of text forwards
; buf_search_backward
; searchs buffer for position of text backwards
;
;
buf_cr_check
cmp #cr if .a = <cr>
bne 80$
sta buf_cr_flag flag that pig
80$ ldx #$80 mark buffer as changed
stx buf_change_flag
clc return happy w/ z=1 iff .a == <cr>
rts
;
; buf_advance
; advances one char in text list
; returns the char char just pushed in front of here.
; ( ie used to be the current char ).
;
buf_advance = buf_advance_fast
;
; back_char
; backs up one in the list.
; returns the new current char.
;
buf_back = buf_back_fast
;
;
;
; compares search string to current buffer positon
;
;
buf_search_check
sta mmu_bank0
jsr 1$
sta mmu_normal
rts
; if not enough chars in main buffer to match string
1$ lda search_len
ldx #0
adcx postp
cmpx endp
beq 8$
bcs 90$ go complain
8$ ldy #0 y <= 0
; while more chars in search string
10$ cpy search_len
beq 80$ do
lda (postp),y .a <= char from buffer
cmp search_buffer,y if doesn't match char in search buffer
beq 20$
jsr change_case_of_char change case of char
cmp search_buffer,y if doesn't match search buffer
bne 90$ exit unhappy
20$ iny iny
jmp 10$ enddo
;
80$ clc return happy
rts
;
90$ lda #error_no_select_range_active
sec return failure
rts
;

105
EDT_C128/bufop.src

@ -0,0 +1,105 @@
.subttl CUT and PASTE types of operations
;
;
;
;BUFLOAD:
; entry: buf_pos text buffer pointer to destination.
; abuf_start pointer to source in bank one.
; x,a = number of bytes to load from one.
;
; exit: error if insufficient room.
; information transfered from abuffer area into the
; text buffer. text buffer is left at the end of the inserted
; information.
;
; BUFSAVE: ( effect a cut type of operation ).
; entry: cut_start_pos text buffer pointer of start of text to "cut"
; cut_end_pos text buffer pointer to end of text to cut.
;
; abuf_start destination start address.
; ( may be "played with" for appends.. )
; abuf_end max legal position to moditfy.
;
; exit: error returned in insufficient room for operation.
; information transferd from the text buffer in bank 0
; to the buffer in bank one.
; x,a = number of bytes saved
;
buf_save
ldax cut_end_pos len <- number of bytes to cut
sbcx cut_start_pos
stax abuf_len
;
adcx abuf_start x,a <= calced end address
bcs 90$
cmpx abuf_end if > end address
bcc 10$
90$ lda #error_insufficient_memory
sec return unhappy
rts
10$ stax abuf_end
ldax cut_start_pos move buffer to start of ara to "cut"
jsr buf_position
;
20$ ldax abuf_start while start <> end
cmpx abuf_end
beq 30$ do
;
jsr buf_remove remove byte from text buffer
ldy #0 stash it out
sta mmu_bank1
sta (abuf_start),y
sta mmu_normal
incd abuf_start inc start address
jmp 20$
;
30$ ldax abuf_len x,a <= number of bytes moved
clc return happy
rts
;
;BUFLOAD:
; entry: buf_pos text buffer pointer to destination.
; abuf_start pointer to source in bank one.
; x,a = number of bytes to load from one.
;
; exit: error if insufficient room.
; information transfered from abuffer area into the
; text buffer. text buffer is left at the end of the inserted
; information.
;
;
buf_load
stax abuf_len len <= number of bytes to load
adcx abuf_start end <= ending pointer
stax abuf_end
;
jsr buf_return_free x,a <= space to fit
cmpx abuf_len if x,a < lengtth of buffer
bcs 20$
lda #error_insufficient_memory
sec return error
rts
;
20$ ldax abuf_start while start <> end
cmpx abuf_end
beq 30$
;
ldy #0 do a <= char from bank one
sta mmu_bank1
lda (abuf_start),y
sta mmu_normal
jsr buf_insert insert the char
bcs 90$
incd abuf_start start <= start + 1
jmp 20$
;
;
30$ clc ;return happy
rts
;
90$ lda #99 return the unknown error
sec
rts
;
;

638
EDT_C128/command.src

@ -0,0 +1,638 @@
.subttl "COMMAND LINE EDITOR AND COMMANDS"
;
;*****************************************************************************
; commands:
;*****************************************************************************
;
; save file s(ave)(4|5|6|7|8|9|10|11) (@)file(,s,p)(=( )[main|paste])
; w(rite)(4|5|6|7|8|9|10|11) (@)files(,s,p)(=( )[main|paste])
; load file l(oad)(8|9|10|11) file(,s)
; include file i(nclude)(8|9|10|11) file(,s)
; exit & save e(xit)(8|9|10|11) (file(,s))
; exit no save q(uit)
; goto line [0-9](0-9(0-9(0-9(0-9(0-9(0-9)))))
; never mind (cr)
; disk status @ (8|9|10|11)
; disk command @ (8|9|10|11) (text sent to command channel )
; directory $ (8|9|10|11) ( example filename for drive to use )
; monitor monitor
;
name_max = 40 ; max disk size command string
ram load_name,name_max+2 file name of last loaded file
ram load_name_len length
ram load_disk source of file
ram temp_name,name_max+2 temp filename
ram temp_name_len temp filename length
ram temp_disk temporary disk drive number
ram replace_flag flag for '@'
ram charno index into command string
ram prompt_addr,2
;
;
;******************************************************************************
; COMMAND LINE EDITOR
;******************************************************************************
;
;
;
; get_command
; gerates a commaand prompt and allows single line editing
; for the user to enter a command.
;
; exit: command : contains the users text for the command
; command_len : number of chars in users command
;
;
get_command
stax prompt_addr save the prompt address
jsr command_clear clear the command line
;
10$ ldax prompt_addr do
jsr command_refresh refresh the command line
;
jsr cursor_wait_for_key key key from user ( use cursor )
;
cmp #$e0 if any keypad key
bcs 80$
;
cmp #142 or shift return or function key
bcs 20$
cmp #133
bcc 20$
80$ clc return happy w/ key in .a
rts
;
20$ jsr command_insert_delete
jmp 10$ forever
;
;
;command_refresh
; entry: x,a = pointer to text for prompt on command line
; exit: command line refreshed ( prompt and user text ).
;
;
command_refresh
tay x,y <= x,a
;
lda col_offset kill shifting for the char plotter
pha
lda #0
sta col_offset
;
tya save prompt addr on stack
pha
txa
pha
;
lda status_line point to the command line
jsr set_line
lda #12
sta col_count
pla recall address of the prompt
tax
pla
jsr print_null_terminated_string
;
ldx #0 x <= 0
20$ cpx command_len while x < command_len
bcs 30$ do
txa save x
pha
lda command,x print the char
jsr plot_char
pla restore x
tax
inx inc x
jmp 20$
; blank rest of command line
30$ jsr clear_to_eol
pla restore the coloumn offset
sta col_offset
rts return
;
; command_clear
; zeros out users command line.
;
command_clear
lda #0
sta command_len
rts
;
; command_insert_delete
; if .a = delete
; if command_len <> 0
; removes a char from command.
; else
; beep
; else if room to add chars
; add .a to command
; else
; beep
;
; entry: .a = single petscii char
; exit: command,command_len altered
;
command_insert_delete
cmp #delete if delete
bne 50$
dec command_len dec command length
bpl 80$ if < 0
inc command_len inc command_length
9$ jmp beep beep & return
;
50$ ldx command_len
sta command,x save this char as part of the command
beq 70$
ldx col_count if col_count >= command_len_max
cpx command_len_max
bcs 9$ go beep and return
70$ inc command_len increment the command length
80$ rts return
;
;***************************************************************************
; COMMAND DISPATCH
;***************************************************************************
;
; do_command
; prompts user for a command
; reads command.
; executes command.
; exit: c=0 ok
; c=1 error code in .a
;
command_message
.byte "COMMAND: ",0
;
do_command
lda plot_mode if in ascii mode
bpl 5$
jsr petscii goto petscii mode
ldai command_message get the command from the user
jsr get_command
jsr ascii goto ascii mode
jmp 10$ else
;
5$ ldai command_message get the command from the user
jsr get_command
;
10$ lda command_len if len is null
bne 20$
clc return
rts
;
20$ lda command if first char is digit
jsr isdigit
bcs 50$
jmp goto_line execute goto line command
;
50$ ldx #110$-100$-1 search list of letters for command
lda command
60$ cmp 100$,x
beq 80$
dex if not found
bpl 60$
jmp syntax puke
80$ inc new_screen force a new screen after the command
txa jmp to command using list of addresses
asl a
tax
lda 110$+1,x
pha
lda 110$,x
pha
rts
;
90$ sec
rts
;
100$ .byte "ELIQSW@M$OAPFKT"
110$ .word exit-1,load-1,include-1,quit-1,save-1,save-1,disk-1
.word monitor-1,directory-1,status_enable_command-1
.word ascii_command-1,petscii_command-1,filter_command-1
.word key_command-1,type-1
;
;
;****************************************************************************
; bcd to hex utils
; hex mul utils
; numeric parser
; isdigit routine
;****************************************************************************
;
; isdigit: tests to see if char is 0-9
; entry: .a = char under test
;
; exit: if true
; clc
; return hax value for char
; else
; return syntax error
;
;
isdigit cmp #'0 if cahr >= 0 and <= 9
bcc 90$
cmp #'9'+1
bcs 90$
and #$0f convert to binary
rts return w/ carry clear
90$ lda #error_syntax_error
sec return unhappy
rts
;
;
;
; char_mul_10
; entry:
; .a = petscii char
;
; exit: c=0 ok...
; c=1 overflow
; .a = error_illegal_numeric_value
; c=1 not a digit
; .a = error_syntax_error
;
char_mul_10
jsr isdigit if not a digit
bcs 99$ puke
;
ldy #4 asl number 4 times
10$ asl number
rol number+1
bcs 90$ puke if over flow
dey
bne 10$ or in this digit
ora number
sta number
clc return happy
rts
;
90$ lda #error_numeric_value_illegal
sec
99$ rts
;
;
; parse_command_to_number
; examines command line
; if 0-n decimal digits ( <9999 )
; returns:clc
; value in x,a
; else
; returns illegal quantity error
;
parse_command_to_number
lda #0 clear "number"
sta number
sta number+1
sta charno reset parser
;
10$ jsr gnc while chars can be got
bcs 20$
jsr char_mul_10 do attempt to process as a digit
bcc 10$ puke if errror
rts
;
20$ ldax number x,a <= bcd version
jsr bcd_to_hex convert to hex
clc return happy
rts
;
;
zpage bcd_to_hex_temp,2
;
; bcd_to_hex
; entry: x,a = 4 packed bcd digits ( garbage in, garbage out ).
; exit: x,a = binary equivelent.
;
bcd_to_hex ; convert x,a from bcd to hex
ldy #0 ; temp <= 0
sty bcd_to_hex_temp
sty bcd_to_hex_temp+1
;
pha ; save low order byte
txa
jsr 50$ ; do high order byte
pla ; recall low order byte
jsr 50$ ; do low order byte
ldax bcd_to_hex_temp
rts ; return w/ result
;
50$ pha save byte
lsr a do up a low order nybble
lsr a
lsr a
lsr a
jsr 100$
pla recall byte
100$ and #$0f mask
pha save nybble
;
jsr 150$ temp <= 10 * temp
lda bcd_to_hex_temp+1
pha
lda bcd_to_hex_temp
jsr 150$
jsr 150$
adc bcd_to_hex_temp
sta bcd_to_hex_temp
pla
adc bcd_to_hex_temp+1
sta bcd_to_hex_temp+1
;
pla temp += saved value of nybble
clc
adc bcd_to_hex_temp
sta bcd_to_hex_temp
bcc 118$
inc bcd_to_hex_temp+1
118$ rts
;
150$ asl bcd_to_hex_temp
rol bcd_to_hex_temp+1
rts
;
ungnc dec charno decrement the char pointer
bpl 10$ if underflow
lda #0 char pointer <= 0
sta charno
10$ rts return
;
gnc ldx charno if no more chars
cpx command_len
bcc 10$
rts return w/ carry set
;
10$ lda command,x a <= next char
inc charno point to next char
cmp #space set .z if space char
clc return w/ c=0.
rts
;
;**************************************************************************
; goto line ( just a numeric command )
;**************************************************************************
;
goto_line
jsr parse_command_to_number
bcs 90$ puke if error
stax number leave command in number
;
; while number <> number of previous crs.
10$ cmpdr number,cr_count_pre,a
beq 80$
bcs 30$ do if mumber < previous
jsr buf_back back up a char
jmp 40$ else
30$ jsr buf_advance advance char
40$ bcc 10$ puke if error
rts
;
80$ jsr buf_sol move to start of line
clc return happy
90$ rts
;
;
;**************************************************************************
; quit
;**************************************************************************
;
quit_text
.byte 'QUIT'
;
quit ldy command_len
cpy #4
bne 90$
dey
10$ lda command,y
cmp quit_text,y
bne 90$
dey
bpl 10$
inc quit_flag signal main loop to quit
clc return happy
rts
90$ jmp syntax
;
;
;******************************************************************************
; MONITOR
;******************************************************************************
;
monitor
ldx #110$-100$ if command is "MONITOR"
cpx command_len
bne 90$
10$ dex
bpl 5$
jsr k_monitor call kernal's monitor
jsr primm
.byte 147 clear screen
.byte "PLEASE WAIT...",0 tell user
jmp recover go set up cr_counts,& return
;
5$ lda 100$,x
cmp command,x
beq 10$
;
90$ lda #error_syntax_error puke
sec
rts
;
;
100$ .byte "MONITOR"
110$
;
;****************************************************************************
; PETSCII & ASCII MODE COMMANDS
;****************************************************************************
;
;
;restore_ascii_mode
; lda ascii_mode_flag
; beq petscii
; bne ascii
;
;
ascii_command
lda #$ff
sta ascii_mode_flag
;
ascii jsr set_8563_to_ascii
jsr primm ; select lower case, kill shift chicken
.byte 11,14,0
lda #$80
bmi ascii_entry
;
petscii_command
lda #0
sta ascii_mode_flag
;
petscii
jsr set_8563_to_petscii
jsr primm ; enable shift chicken
.byte 12,0
lda #$00
ascii_entry
sta plot_mode
sta kybd_mode
clc
rts
;
;****************************************************************************
; STATUS LINE COMMANDS ( on & off )
;****************************************************************************
;
status_enable_command ;
lda command_len if command is 1 char
cmp #1
beq 10$ go toggle status enable
;
lda command+1 if command is 'OF..'
cmp #'F
beq 20$ go zero status enable
cmp #'N if command is 'ON'
bne 30$ go set status enable
; if status is enabled
10$ lda status_enable
beq 30$
20$ lda #0 disable status
.byte $2c skip
30$ lda #1 enable status
sta status_enable
clc return happy
rts
;
;
;****************************************************************************
; FILTER COMMANDS
;****************************************************************************
;
;
ram filter_core_routine,2 ; address of cchar filter
;
;
filter_command
lda #1 if command < 2 chars long
cmp command_len
bcs 99$ syntax error
;
10$ lda command+1 find second command char in list
ldx #110$-100$-1
20$ cmp 100$,x
beq 30$
dex
bpl 20$ if not present
99$ lda #error_syntax_error syntax_error
90$ sec return pissed
rts
;
30$ lda 110$,x filter_core_routine <= addr of code for char filter
sta filter_core_routine
lda 120$,x
sta filter_core_routine+1
;
jsr select_something attempt to select something
bcc 40$ if failure
jmp 200$ filter one char and return
;
40$ jsr clear_dot clear any dot user left around
;
; while not at end of area to filter
50$ cmpdr cut_end_pos,buf_pos,a
beq 80$ do filter a char
jsr 200$
bcc 50$ puke if error
rts
80$ clc
rts
;
100$ .byte 'MAPC' ; filter command letters
110$ .byte <mask_char ; filter core addresses
.byte <convert_char_to_petscii
.byte <convert_char_to_ascii
.byte <change_case_of_char
120$ .byte >mask_char
.byte >convert_char_to_petscii
.byte >convert_char_to_ascii
.byte >change_case_of_char
;
; filter one char please
;
;
200$ jsr buf_remove remove the char from the buffer
bcs 90$ ( puke if error )
jsr 210$ jsr indirect to filter core routine
jmp buf_insert insert the char into the buffer & return
;
210$ jmp (filter_core_routine)
;
; character filters
;
convert_char_to_ascii ; assuming in petscii mode
jsr change_case_of_char swap them uppers and lowers
cmp #$c0 if $c0-$df
bcc 30$
cmp #$e0
bcs 30$
eor #%10100000 %110xxxxx -> %011xxxxx
30$ clc
rts
;
;
convert_char_to_petscii ; assuming in ascii mode
jsr change_case_of_char toggle case
cmp #$80 if $60-$7f
bcs 30$
cmp #$60
bcc 30$
eor #%10100000 %011xxxxx -> %110xxxxx
30$ clc
rts
;
mask_char ; uninvert any inverted chars
ldx ascii_mode_flag if ascii mode
beq 10$
and #%01111111 mask high order bit
clc return happy
rts
;
10$ cmp #$60 if < $60
bcc 80$ go pass char
cmp #$7f if < $80
bcs 20$
eor #%10100000 move to $c0-df
20$ cmp #$E0 if >= $e0
bcc 80$
eor #%01000000 move to $a0-$bf
80$ clc return happy
rts
;
;
;
;key_command
;
; toggles mode where the the key labeled cntrl becomes
; a tab key, and the key labeled stop becomes the
; control key.
;
;
key_command
lda #$04 a <= keycode for cntrl key
cmp cntrl_keycode if cntrl_keycode <> a
bne 50$
tax x <= code for cntrl key
lda #$09 a <= code for tab key
;
.byte $2c else
50$ ldx #$03 x <= code for stop key
;
stx stop_keycode stop_keycode <= .x
sta cntrl_keycode cntrl_keycode <= .a
clc return happy
rts
;
;

210
EDT_C128/declare.src

@ -0,0 +1,210 @@
.subttl EDT global memory declarations
;
; MEMORY MAP DECLARATIONS:
;
;
code_start = $2000 location of editor code bank 0
text_start = $4000 location of text buffer bank 0
text_end = $FEFF end of text buffer in bank 0
;
cut_start = $4000 cut / paste buffer bank 1
cut_end = $FEFF
cut_space = $BF00
;
dword_start = $1600 deleted word buffer bank 1
dword_space = $00FF
dword_end = dword_start+dword_space
;
dline_start = $1700 deleted line buffer bank 1
dline_space = $00FF
dline_end = dline_start+dline_space
;
curzpage = $0010 start of genral purpose zero page variables
curram = $1800 start of genral purpose ram variables
;
mmu_normal = $FF01
mmu_normal_cfg = $D501
mmu_normal_val = $00 ; normal means roms and i/o
;
mmu_bank0 = $FF02
mmu_bank0_cfg = $D502
mmu_bank0_val = $3F ; bank0 means all ram bank 0
;
mmu_bank1 = $FF03
mmu_bank1_cfg = $D503
mmu_bank1_val = $7F ; bank1 means all ram bank 1
;
init_mmu .macro ; macro for init mmu code
lda #0 ; hard coded enable i/o
sta $ff00
lda #%00000111 ; set shared ram from $0000 to $3FFF
sta $d506
lda #mmu_normal_val
sta mmu_normal_cfg
lda #mmu_bank0_val
sta mmu_bank0_cfg
lda #mmu_bank1_val
sta mmu_bank1_cfg
sta mmu_normal ; select normal mmu operation
.endm
;
;
;***************************************************************************
; EXCEPTION HANDLEING
;***************************************************************************
;
; through out this code, the carry is used to return the
; relative success or failure of an operation. Note most errors
; ripple up from the bottom level routines for dealing with the
; text buffer.
;
; c=0 ok
; c=1 operation failed.
; .a = error code for error routine
;
;***************************************************************************'
; TEXT BUFFER OPERAIONS
;***************************************************************************'
;
;
; the text buffer is divided into two stacks. all chars before the
; current char are in the first stack. all chars after the current char
; are in the second stack. This is done to permit extremely rapid
; insertion of chars and at the expanse of slower file positioning.
;
; the text within the two stacks is a seris or <cr> separated lines.
; nulls are disallowed. tab chars (09) are supported. Only printable
; chars and <cr>s are permitted.
;
; several paramaeters use the concept of charecter number. this is
; in concept the offset of the char from the start of the text. This
; if done so as to permit rapid movement to certain locations within
; the file. ( such as the paste marker , etc. ).
;
; CHAR NUMBERS ARE STORED AS A POINTER WHERE THE CHAR WOULD BE
; IF THE CHARECTER WAS ON THE PRE-STACK !!!. Therefore if the buffer
; is aligned such that the char is the current char in the buffer,
; then PREP would yeild the char number.
;
; thus two methods are used to refer to locations in the text:
; pointers:
; char numbers:
;
;
;***************************************************************************
; RAM DECLARATIONS
;***************************************************************************
;
; text buffer pointers
;
zpage startp,2 ; start of test pointer
zpage prep,2 ; pre stack pointer
buf_pos = prep
zpage postp,2 ; post stack pointer
zpage endp,2 ; end of text pointer
;
; display formatting information
;
zpage nlines,1 ; max line number for text
ram error_line ; line number for error text
ram status_line ; line number for status
zpage max_col ; max number of coloumns for displayed text
ram status_enable ; enable for status line
zpage plot_mode ; b7=1 means display as ascii, else petscii
zpage kybd_mode ; b7=1 means ascii keybd in ascii, else petscii.
zpage ascii_mode_flag ; b7=1 means user in ascii mode, else petscii.
;
zpage hyster_lines ; hysteresis value for keeping cursor from
; top and bottom of screen
zpage hyster_col ; hystersis value for keeping cursor
; from left and right sides of screen
;
zpage cr_count_pre,2 ; number of crs in front of cursor
zpage cr_count_post,2 ; number of crs after cursor
;
zpage old_cr_count_pre,2 ; same as cr_count_pre, before last operation..
zpage col_offset ; number of chars to offset the text to the left
zpage col_count ; temp counter for shifting display
;
zpage dcol ; desired coloumn
zpage dcol_flag ; temp for detemining how to set cursor position
zpage cur_col ; cursor coloumn
zpage cur_row ; cursor row
cur_line = cur_row ; alternate definition
;
; error code ram
;
ram error_flag ; flag for errors
zpage errpnt,2 ; pointer into error text
;
; text buffer positioning
;
zpage cur_pos,2 ; cursor location in buffer
zpage dot_pos,2 ; char number of where the cut paste dot is
zpage dot_flag ; if non zero then cut paste dot dropped
ram number_flag ; if non zero, then repeat count being built
zpage repeat_count,2 ; repeat count value
;
;
; ram for cut and paste types of operations
;
ram dword_base,2 base and number of chars in deleted word buffer
ram dword_len,2
;
ram dline_base,2 base and number of chars in deleted line buffer
ram dline_len,2
;
ram cut_base,2
zpage cut_len,2
;
zpage abuf_len,2 internal to buf_save, buf_load
zpage abuf_temp,2 temp thingy
;
zpage abuf_start,2 start of area to cut/paste in alt buffer
zpage abuf_end,2 end of area to cut/paste
;
zpage cut_start_pos,2 ; text buffer pointers for cut and pste
zpage cut_end_pos,2 ; ( also used for plotting )
;
zpage number,2 ;good place for building numbers
;
ram new_screen ; flag to mark need to replot the entire screen
ram direction ; flag for advance / retreat
ram gold_flag ; self explanitory ( well read the damn code then !)
ram ds_flag ; link between reading ds$ and main loop.
; if <> 0 then ds was read, therefore leave on display
;
ram deleted_char_buffer ; this is self expanitory
ram deleted_char_type ; if 0 , char deleted via delete key
; else char deleted via keypad comma key
;
zpage command_len
ram command_len_max
ram command,80
ram search_buffer,80 ; search buffer is in bank 0...
ram search_len ; bytes in the search string...
ram quit_flag ; if set then editor is to return to basic
;
;
; define special chars
;
tab = $09
cr = $0d
escape = 27
rvs_on = 18
rvs_off = 18+128
home = 19
up = 17+128
down = 17
left = 29+128
right = 29
space = $20
insert = 20+128
delete = 20
gold_key = 133
gold_key_2 = 137
;
;
;

652
EDT_C128/dos.src

@ -0,0 +1,652 @@
.subttl disk commands
;
;********************************************
;
; Disk Command/Status Operations
;
; @[device-number][,command-string]
;
;********************************************
;
disk jsr load_to_temp assume default disk device
lda #0 clear name len
sta temp_name_len
jsr parse_no_default parse the string
bcs 90$
jsr puke_if_printer cannot use printers
bcs 90$
;
lda temp_name_len ignore the '0:' inserted by parse
cmp #3
bcs 10$
;
jmp dscheck no command is just dscheck
;
10$ ldx temp_name_len set up the file name
dex
dex
txa
ldx #<temp_name+2
ldy #>temp_name
jsr setnam
; open the disk channel,and read errst
jsr dscheck_no_setnam
90$ rts
;
;
;**************************************************************************
; disk status
;**************************************************************************
;dscheck read disk status
; plots status on status line
; returns c=0 if ok
; else returns c=1
; .a = 0
ds_lfn = 0 logical file number for ds check
;
ram ds_temp,2
;
dscheck lda #0 set up for error channel read
jsr setnam
dscheck_no_setnam ; entry point for submit command
ldx number
lda #ds_lfn
ldy #$6f
sty ds_flag ; force main routine to not update command line...
jsr setlfs
jsr open
bcs 90$
lda status
bmi 90$
ldx #ds_lfn
jsr chkin
bcs 90$
lda status
bpl 10$
90$ jsr 80$ close the command channel
lda #error_device_not_present
sec
rts
;
; set up for status line print
;
10$ lda status_line
jsr set_line
ldx #3 make sure can print
stx dflto
;
lda #0
sta ds_temp
sta ds_temp+1
;
20$ jsr basin do read a char
cmp #cr if cr
beq 80$ quit
cmp #'0' if not '0'
beq 30$
ldx ds_temp if ds_temp < 2
cpx #2
bcs 30$
inc ds_temp+1 inc ds_temp+1
30$ inc ds_temp inc ds_temp
jsr print print the char ( on command line )
jmp 20$ enddo
;
80$ lda #ds_lfn
jsr close
jsr clear_to_eol blank rest of line
jsr clrchn clear channels
lda ds_temp+1 return c=0 if ds_temp == 0
cmp #1
lda #0 .A = 0 ( null error ).
rts
;
;
;******************************************************************************
; read & display the disk directory
;******************************************************************************
ram t1
ram t0,2
ram dir_flag
;
directory
jsr load_to_temp assume default disk device
lda #0 clear name len
sta dir_flag dir_flag <= 0
sta temp_name_len
jsr parse_no_default parse the string
bcs 99$
jsr puke_if_printer can't dir printers
bcs 99$
;
lda #'$ convert 0: to $:
sta temp_name
;
lda #2 if name is 2 char long
cmp temp_name_len
bne 5$
dec temp_name_len name <= 1 char long ( "$" only )
;
5$ lda replace_flag puke iff replace flag set.....
beq 10$
lda #error_syntax_error
sec
99$ rts
;
10$ lda temp_name_len setnam
ldx #<temp_name ;fnadr low
ldy #>temp_name ;fnadr high
jsr setnam
lda #ds_lfn ;la
ldx number ;fa
ldy #$60 ;sa
jsr setlfs
jsr open ;open directory channel
bcs 90$ ;...branch on error
lda status
bmi 90$
ldx #ds_lfn
jsr chkin ;make it an input channel
bcs 90$ ;...branch on error
lda status
bmi 90$
;
lda #147
jsr print ; clear screen
inc dir_flag ; mark that we are reading directory
;
ldy #3 ;first pass only- trash first two bytes read
;
20$ sty t1 ;loop counter
25$ jsr basin
sta t0 ;get # blocks low
lda status
bne 90$ ;...branch if error
jsr basin
sta t0+1 ;get # blocks high
lda status
bne 90$ ;...branch if error
dec t1
bne 25$ ;...loop until done
;
ldax t0 print number
jsr print_decimal
;
lda #' '
jsr print print a space
;
30$ jsr basin ;read & print filename & filetype
beq 40$ ;...branch if eol
ldx status
bne 90$ ;...branch if error
jsr print
bcc 30$ ;...loop always
;
40$ lda #cr
jsr print ;start a new line
ldy #2
bne 20$ ;...loop always
;
90$ jsr clrchn ; clear channels
lda #ds_lfn ; close dir channel
sec
jsr close
lda dir_flag ; if we were really reading that crap
beq 95$
jsr primm scroll dir up above error and stat lines
.byte cr,cr,0
jsr press_any_key_to_continue
95$ jmp dscheck show user the problem
;******************************************************************************
; disk parser which has no right to exist
;******************************************************************************
;
; parse:
; parses users command for unit number, replace symbol,
; and file name.
; entry:
; users command in commanad,command_len.
; exit:
; c=1 .a=error code for why command is questionable.
; c=0 number,number = legal specified or
; default unit number.
; replace flag == 0 iff no '@'
; temp_name,temp_name_len <= default or
; specified filename with '0:'.
;
;
parse
jsr load_to_temp assume load file name ( save op ? )
parse_no_default
lda #0
sta charno char number is 0
sta replace_flag clear replace flag
;
10$ jsr gnc do read chars until at space
bcs parse_end quit if no more
bne 10$
;
15$ jsr gnc read first nonn white char after command
bcs parse_end quit if no more
beq 15$
jsr ungnc forget that we read it
jsr isdigit if was a digit
bcs 50$
lda #0 number <= 0
sta number
sta number+1
20$ jsr gnc do read char
bcs 30$ if no more or char is white
beq 30$ break
jsr char_mul_10 build up value
bcc 20$ if error
rts return
; enddo
;
30$ ldax number convert disk number to binary
jsr bcd_to_hex
stax number
;
40$ jsr gnc skip_white
bcs parse_end quit if done
beq 40$
jsr ungnc unread first non white char
;
50$ jsr gnc read next char
bcs parse_end quit if done
cmp #'@ if '@'
bne 60$
sta replace_flag set replace_flag
jsr gnc read next char
bcs parse_end end if done
;
60$ jsr ungnc unget current char ( must be file name time... )
lda #0 temp_name_len <= 0
sta temp_name_len
;
70$ jsr gnc do copy name from comand to temp_name
bcs parse_end quit if eof
ldx temp_name_len puke if too many chars
cpx #name_max-2-4 ( max string - space for "0:,s,r" )
bcs syntax
sta temp_name,x
inc temp_name_len
jmp 70$
;
syntax lda #error_syntax_error
sec
rts
;
parse_end ;if first char(s) are not "0:"
lda temp_name_len
cmp #2
bcc 10$
lda temp_name
cmp #'0
bne 10$
lda #':
cmp temp_name+1
beq 20$
10$ jsr insert_zero_colon
;
20$ lda number+1 if number < 4 or > 11
bne 90$
lda number
cmp #4
bcc 90$
cmp #12
bcc 100$
90$ sec puke
lda #error_numeric_value_illegal
100$ rts return
;
;
;
;**********************************************************************
; parser utils
;**********************************************************************
;
;
load_to_temp ; copy load file params to temp params
lda #0
sta number+1 number <= $00,load_disk
lda load_disk assume the default disk
sta number
;
ldy load_name_len copy load_name to temp_name
sty temp_name_len
10$ lda load_name,y
sta temp_name,y
dey
bpl 10$
rts
;
temp_to_load ; copy temp params to file params
lda number
sta load_disk
ldx temp_name_len
stx load_name_len
10$ lda temp_name,x
sta load_name,x
dex
bpl 10$
rts
;
insert_zero_colon
lda #':'
jsr insert_char_into_temp
lda #'0'
insert_char_into_temp
pha save char
lda temp_name_len
cmp #name_max
bcc 5$
lda #error_syntax_error
rts
5$ inc temp_name_len
ldx temp_name_len
10$ lda temp_name-1,x
sta temp_name,x
dex
bne 10$
pla
sta temp_name
rts
;
puke_if_printer
lda #error_numeric_value_illegal .a <= error code
ldx #7 return c=1 iff unit < 8
cpx number
rts
;
;
;**************************************************************************
; exit and save
;**************************************************************************
;
exit jsr parse parse the filename and unit number
bcs 90$
;
jsr puke_if_printer
bcs 90$ error, cannot exit to printer....
;
lda #'@ exit always replaces
sta replace_flag
jsr insert_char_into_temp
bcs 90$
jsr exit_entry try to save
bcs 90$
jsr dscheck check the save status
bcc 10$ if error
90$ rts return
;
10$ inc quit_flag signal main loop to quit
rts return happy
;
;
;
;
save jsr parse parse the filename and unit number
bcc 10$
rts
10$ jsr puke_if_printer if not a printer
bcs 90$
jsr exit_entry
bcs 90$
jmp dscheck
90$ rts
;
;
ram last_byte
;
type jsr clrchn clear channels
lda #0
sta temp_name_len
lda #1 number <= > 256
sta number+1
; parse the users crap
jsr parse_no_default
bcs 90$
jsr puke_if_printer if not printer
bcc 91$ puke
lda number save unit number on stack
pha
;
ldx temp_name_len if name = 0:"" ( inserted by parse )
dex
dex
bne 10$
lda #$FF x,a <= $00FF
jmp 50$ else
;
10$ stx command_len mark command len
20$ lda temp_name+2,x copy name to command
sta command,x
dex
bpl 20$
jsr parse_command_to_number convert to a number
bcc 50$ if error
tay save .a
pla restore stack
tya restore .a
bcs 90$ go complain
93$ lda #error_device_not_present
.byte $2c
92$ lda #error_syntax_error
.byte $2c
91$ lda #error_numeric_value_illegal
90$ pha
lda #2
jsr close
pla
sec
rts
;
50$ tay y <= low order bit of sa
pla .a <= unit number
cpx #0 if x <> 0
bne 91$ illegal quatity
tax .x <= unit
lda #2 la <= 2
jsr setlfs
lda #0 no name
jsr setnam
jsr open open
bcs 93$ device not present error
ldx #2 ckout
jsr ckout
bcs 93$ device_not_present_error
;
jsr buf_top move buffer to start of file
;
60$ jsr buf_advance while can read from buffer
bcs 70$
sta last_byte
jsr bsout do write to disk
bit status if nothing there
bpl 65$
jsr 80$ do up the close
lda #error_device_not_present return pissed
sec
rts
65$ jsr stop if stop pressed
bne 60$
jsr 70$
lda #error_stopped
sec
rts
;
70$ lda #cr if last byte was not cr
cmp last_byte
beq 80$
jsr bsout send one for the dummy (printer)
;
80$ jsr clrchn clear channels
lda #2 close the file
jsr close
jsr buf_to_cursor restore the file position
jsr clrchn clear channels
clc
rts
;
;
exit_entry
lda replace_flag
beq 10$
lda #'@
jsr insert_char_into_temp
bcc 10$
rts
10$ ldx temp_name_len
lda #',
sta temp_name,x
inx
lda #'W
sta temp_name,x
inx
stx temp_name_len
;
jsr dopen open the file
bcs 90$ puke if error
jsr clrchn
ldx #2 set up to write to file
jsr ckout
jsr print_entry send the data and close the file
90$ php save stat and errorno
pha
jsr buf_to_cursor goto cursor position
pla restore stat and errorno
plp
rts return
;
ram last_byte
;
print_entry
jsr buf_top move buffer to start of file
;
20$ jsr buf_advance while can read from buffer
bcs 70$
sta last_byte
jsr bsout do write to disk
bit status if nothing there
bpl 20$
jsr 80$ do up the close
lda #error_device_not_present return pissed
sec
rts
;
70$ lda #cr if last byte was not cr
cmp last_byte
beq 80$
jsr bsout send one for the dummy (printer)
80$ jsr clrchn clear channels
lda #2 close the file
jsr close
jsr buf_to_cursor restore the file position
jsr clrchn clear channels
clc
rts
;
;
;*************************************************************************
; load and include
;*************************************************************************
;
;
include jsr load_1 parse,open,chkin,etc
bcc go_load if ok, go load
rts return unhappy
;
load jsr load_1 set up for the load
bcc 10$ return if error
rts
;
10$ jsr buf_init init the buffer
jsr temp_to_load make note of this file
lda #0
sta status
;
go_load
10$ jsr basin do read a char
jsr buf_insert insert the char
bcs 90$ puke if buffer full.....
lda status until status <> 0
beq 10$
jsr dscheck show disk status to the user
php save error status
pha save error number
jsr 90$ close file
pla recall error number and status
plp
rts return to the monkey
;
90$ lda #2 ; close the file
jsr close
lda #error_insufficient_memory
sec
rts
;
; load_1
; parse for load unit, and filename
; perform the open
; perform the chkin
; return c=0 if looks ok to load
; x,a = first two bytes in file
; return c=1 if some sort of error
;
;
;
load_1 jsr parse parse the filename and unit number
bcs 90$
jsr puke_if_printer
bcs 90$
;
lda replace_flag puke if replace flag
beq 10$
jmp syntax
10$ jsr dopen open the file
bcs 90$ puke if error
jsr clrchn clear channels
ldx #2 set up to read from it...
jsr chkin
90$ rts return
;
;
;**************************************************************************
; disk open
;**************************************************************************
;
dopen lda #2 ; setlfs for suggested unit
ldx number
tay
jsr setlfs
lda temp_name_len
ldx #<temp_name ; setname for "temp_name"
ldy #>temp_name
jsr setnam
lda #$0E ; set the bank
ldx #$0E
jsr setbnk
jsr open ; attempt to open the file
bcs 91$
jsr dscheck
bcs 90$
rts ; return happy
;
91$ lda #error_device_not_present
sec
;
90$ php
pha
lda #2 ; close the file
jsr close
pla
plp
rts
;
;

29
EDT_C128/edt.src

@ -0,0 +1,29 @@
version .macro
.byte "2.0"
.endm
.blist
.include macro ; decalre macros
.include declare ; declare variables and memory map
*=code_start ; init pc
jmp init ; code
;
jsr $ff7d ; primm....
.byte "(C)1986 COMMODORE ELECTRONICS, LTD.",$0d
.byte "ALL RIGHTS RESERVED",cr,00
rts
;
.include kernal
.include buf
.include main
.include keyproc
.include keyops
.include plot
.include bufop
.include command
.include dos
.include help
.ifgt *-text_start
*** error *** code overflow
.endif
.end

138
EDT_C128/help.src

@ -0,0 +1,138 @@
.subttl HELP routines
;****************************************************************************
; HELP STUFF
;****************************************************************************
;
f = rvs_off ; small version of rvs_off
b = rvs_on ; small version of rvs_on
;
grid_ul = $b0 ; upoper left corner
grid_ur = $ae ; upper right corner
grid_lr = $bd ; lower righht corner
grid_ll = $ad ; lower left corner
grid_vb = $dd ; vertical bar
grid_hb = $c0 ; horizontal bar
grid_cr = $db ; cross
grid_tc = $b2 ; top center bit ( connects left, right and below )
grid_rc = $b3 ; right center
grid_bc = $b1 ; bottom center
grid_lc = $ab ; left center
;
help jsr clear_repeat execute help once per keypress
lda plot_mode save plot mode
pha
bpl 10$ if ascii
jsr petscii select petscii mode
10$ jsr help_screen show first page
jsr press_any_key_to_continue
jsr help_screen_2 show second page
jsr press_any_key_to_continue
inc new_screen force screen replot
pla recall plot_mode
bpl 20$ if was ascii
jsr ascii select ascii mode
20$ clc return happy
rts
;
;
help_screen ; NOTE : '}' is a petscii vertical bar
jsr primm
.byte rvs_off ; kill any left over reverse
.byte 147 ; clear the screen
.byte "KEYPAD LAYOUT",cr
.byte grid_ul
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_tc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_tc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_tc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_ur,cr
;
.byte "} GOLD } HELP }FNDNXT }DELLIN }",cr
.byte "} ",b,"GOLD",f," } ",b,"HELP",f," } ",b,"FIND",f," }",b,"UDELLIN",f,"}",cr
;
.byte grid_ll
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_bc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_bc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_bc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_lr,cr
;
.byte grid_ul
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_tc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_tc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_tc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_ur,cr
;
.byte "} PAGE } SECT }APPEND }DELWRD }",cr
.byte "}",b,"COMMAND",f,"} ",b,"FILL",f," }",b,"REPLACE",f,"}",b,"UDELWRD",f,"}",cr
;
.byte grid_lc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_cr
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_cr
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_cr
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_rc,cr
;
.byte "}FORWARD}BACKWRD} CUT }DELCHR }",cr
.byte "}",b,"BOTTOM",f," } ",b,"TOP",f," } ",b,"PASTE",f," }",b,"UDELCHR",f,"}",cr
;
.byte grid_lc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_cr
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_cr
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_cr
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_rc,cr
;
.byte "} WORD } EOL } CHAR } ENTER }",cr
.byte "} ",b,"CASE",f," }",b,"DEL EOL",f,"}",b,"SPCINS",f," } }",cr
;
.byte grid_lc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_bc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_cr
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_rc
.byte " ",grid_vb,cr
;
.byte "} BOL } MARK } }",cr
.byte "} ",b,"OPEN LINE",f," }",b,"UNMARK",f," } ",b,"SUBS",f," }",cr
;
.byte grid_ll
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_bc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_bc
.byte grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_hb,grid_lr,cr
;
.byte cr
.byte "USE CURSOR KEYS TO MOVE ABOUT ",cr
.byte 0
rts
;
;
;
help_screen_2
jsr primm
.byte 147 ; clear the screen
.byte rvs_off
.byte "COMMANDS INCLUDE:",cr
; 01234567890123456789012345678901234567890
.byte " LOAD L( UNIT)( FILENAME)",cr
.byte " INCLUDE I( UNIT)( FILENAME)",cr
.byte " SAVE S( UNIT)( (@)(FILENAME))",cr
.byte " SAVE & EXIT E( UNIT)( (@)(FILENAME))",cr
.byte " TYPE (PRINT) T UNIT( SA)",cr
.byte " QUIT QUIT",cr
.byte " DISK STATUS @( UNIT)",cr
.byte " DISK COMMAND @( UNIT) DISK COMMAND",cr
.byte " DISK DIRECTORY $( UNIT)( FILENAME)",cr
.byte " GOTO LINE (NUMBER)",cr
.byte " INVOKE MONITOR MONITOR",cr
.byte " STATUS LINE O(N)(FF)",cr
.byte " DISPLAY MODE A(SCII) OR P(ETSCII)",cr
.byte " FILTER TEXT FA(TOP) OR FP(TOA)",cr
.byte " UNINVERT CHARS FM(ASK)",cr
.byte " MOVE TAB,CTRL K(EYMAP)",cr
.byte cr
; 01234567890123456789012345678901234567890
.byte "WHERE ITEMS IN PARENS ARE OPTIONAL.",cr
.byte "DEFAULT FILE IS DEVICE 8, NONAME.TXT.",cr
.byte "LOADS MODIFY THE CURRENT DEFAULTS.",cr
.byte cr
.byte "SOFTWARE BY HEDLEY DAVIS FOR COMMODORE.",cr
.byte 0
rts
;

627
EDT_C128/kernal.src

@ -0,0 +1,627 @@
.subttl kernal declarations and utilities
;
file = $08 always use 8s ( fa,sa,la )
;
status = $90 kernal status word
dfltn = $99 default input device
dflto = $9a
msgflg = $9d kernal i/o error message print enable
ndx = $d0 kernals idea of number of keys in queue
rvs = $f3 kernal rvs mode switch
qtsw = $f4 quote mode switch
scnrts = $c6c4 kernal scnrts routine
inmi = $0318
keychk = $033c
;
fetch_pointer = $02aa ; bank 1 indirection vectors.
stash_pointer = $02b9
;
decode = $033E keyboard indirection vectors
;
system_vector = $0a00 vector for monitor exit
;
init_status = $0a04 system init status
;
k_print = $C00C editor entry point for print a char routine
init80 = $C027 init 80 col to petscii chars
cursor_on = $CD6F enable cursor last cursor position
cursor_off = $CD9F shut of das blinken lights
vdcput = $CDCA write .a to 8563, data register (.y preserved)
vdcout = $CDCC write .a to 8563, register .x (.y preserved)
k_prend = $FF33 kernal irq & nmi return
;
;
kernal_keycode_tables = $fa80
;
close_all = $FF4A close all.....
setbnk = $FF68 set banks ( .a = load save bank )
; ( .x = file name back )
primm = $FF7D print immediate routine
setlfs = $FFBA set file structure
setnam = $FFBD set file name
open = $FFC0
close = $FFC3
chkin = $FFC6
ckout = $FFC9
clrchn = $FFCC
basin = $FFCF
bsout = $FFD2
stop = $FFE1
getin = $FFE4 read a single char from input
scrorg = $FFED return number of screen rows in .y
; max coloumns in .x
plot = $FFF0 positon cursor ( row y, coloumn x )
; c=0 means write, c=1 means read
;
ram keychk_save,2
;
k_monitor
jsr clrchn ; clear em to assure good kybd reads
php
sei
ldax keychk_save ; this is set up via first call to init_keyboard
stax keychk
plp
ldai 10$ ; set up return
stax system_vector
jmp $b000 ; enter monitor
;
; ; restore keyboard
10$ jsr init_keyboard
lda #0 kill messages
sta msgflg
rts
;
;
;
;
ram save_page,256
pntr = $fe
;
save_system
php
sei
sec
jsr save_zero_page_op
jsr save_vector_op
plp
rts
;
restore_system
php
sei
clc
jsr save_vector_op
jsr save_zero_page_op
plp
jmp set_8563_to_petscii
;
save_zero_page_op
;
lda #$00 get io in map
sta $ff00
;
ldx #$10 x <= $10
10$ lda $0,x do .a <= $0,x
bcs 20$ if c=0
lda save_page,x .a <= save_page,x
20$ sta $0,x $0,x , save_page <= .a
sta save_page,x
inx x++
bne 10$ until x==0
;
rts return
;
save_vector_op
; x <= index into table
ldx #110$-100$-2
40$ lda 100$,x do pntr <= $100,x
sta pntr
lda 100$+1,x
sta pntr+1
ldy #1 y <= 1
50$ lda (pntr),y do .a <= (pntr),y
bcs 60$ if c=0
lda save_page,x .a <= save_page,y
60$ sta (pntr),y (pntr),y <= .a
sta save_page,x save_page,x <= .a
dex x--
dey y--
bpl 50$ while y > 0
txa while x > 0
bpl 40$
;
rts
;
100$ .word $d501
.word $d503
.word $d505
.word system_vector
.word inmi
.word init_status
110$
;
kill_nmis
ldai k_prend ; kill nmis by pointing nmi to kernal rti.
stax inmi
rts
;
kill_basic
lda init_status
and #%11111110
sta init_status
rts
;
;
cursor_wait_for_text
sec y <= coloumn for cursor - screen offset
lda cur_col
sbc col_offset
tay
ldx cur_line x <= cursor line
clc position cursor @ y,x
jsr plot
cursor_wait_for_key
jsr cursor_on ;cursor on
10$ jsr get_key ;wait for a key
bcs 10$
pha ;save key
jsr cursor_off ;kill cursor
pla ;recall key
rts ; return
;
;
press_any_key_to_continue
jsr 10$
jsr primm
.byte rvs_on,"PRESS ANY KEY TO CONTINUE...",rvs_off,0
jsr cursor_wait_for_key
;
10$ lda error_line
clear_line ; position the cursor
jsr set_line
clear_to_eol
lda #'Q
print_escape_a
pha
lda #$1b
jsr print
pla
;
print pha
lda #0 kill quote mode stuff in editor
sta qtsw
pla
jmp k_print print the damn char
;
set_line ; position cursor in coloumn 0 on row .a
ldy #0 ; position the cursor
tax
clc
jsr plot
lda #rvs_off kill reverses
.byte $2c skipparoo
beep lda #$07
jmp print
;
; print_null_terminated_string
; prints the ttext string pointed to by x,a
;
print_null_terminated_string
stax errpnt ; set up pointer
;
10$ ldy #0 ; do a <= char at pointer
lda (errpnt),y
bne 20$ ; if null
rts ; return
20$ jsr print ; print the char
incd errpnt
jmp 10$ ;loop
;
;
;******************************************************************************
; print decimal routime
;******************************************************************************
;print_decimal
; prints a decimal number given a 16 bit hex value
; entry:
; x,a = 16 bit hex value
;
zpage print_decimal_temp,2
zpage print_decimal_flag
;
print_decimal ;temp <= x,a
stax print_decimal_temp
lda #0 flag <= 0
sta print_decimal_flag
ldx #8 x <= 5*2-2
10$ ldy #0 do y <= 0
20$ lda print_decimal_temp+1 while temp > 100$,x (double)
cmp 100$+1,x
bcc 40$
bne 30$
lda print_decimal_temp
cmp 100$,x
bcc 40$
30$ sec do temp <= temp - 100$,x (double)
lda print_decimal_temp
sbc 100$,x
sta print_decimal_temp
lda print_decimal_temp+1
sbc 100$+1,x
sta print_decimal_temp+1
iny y++
jmp 20$
;
40$ cpy #0 if y <> 0 or x == 0 or flag <> 0
bne 50$
cpx #0
beq 50$
lda print_decimal_flag
beq 60$
;
50$ stx print_decimal_flag save x
tya print char for y
ora #$30
jsr print
ldx print_decimal_flag recall x
;
60$ dex x--
dex x--
bpl 10$ while x > 0
;
clc return happy
rts
;
100$ .word 1,10,100,1000,10000
;
;
;
;
; get_key and key scanner routines
;
kybd_buf_len = 10
ram kybd_buf,kybd_buf_len keyboard buffer
zpage kybd_pin input and output pointers
zpage kybd_pout
;
get_key ldx kybd_pout if pout = pin
cpx kybd_pin
bne 10$
lda #0 return .a = 0 , c=1
sec
rts
;
10$ lda kybd_buf,x a <= buf,pout
jsr kybd_advx inc pout
stx kybd_pout
bit kybd_mode
bpl 80$ if ascii mode keyboard
;
bpl 80$ if any controls
cmp #$20
bcc 80$ pass normally
cmp #$80
bcc 20$
cmp #$a0
beq 88$ ( trap shifted space )
bcc 80$
cmp #$e0
bcs 80$
;
20$ cmp #$C0 if repeat of upper case
bcc 70$
; remap to normal upper case
eor #%10100000 ( %110xxxxx -> %011xxxxx )
;
70$ jsr change_case_of_char
;
80$ cmp #$03 eat stop keys ( this is a kludge )
beq get_key
.byte $2c
88$ lda #space
clc return .c = 0
rts
;
;
;
kybd_in ldx kybd_pin buf,pin <= .a
jsr kybd_advx if (pin+1) <> pout
cpx kybd_pout
beq 10$
ldx kybd_pin pout <= pin++
sta kybd_buf,x
jsr kybd_advx
stx kybd_pin
10$ jmp scnrts continue w/ keybd irq
;
kybd_advx
dex
bpl 10$
ldx #kybd_buf_len-1
10$ rts
;
pntr1 = cut_start_pos
pntr2 = cut_end_pos
;
;
ram remapped_keycodes,$59+$59+$59+$59+$59 ; ram for new keycodes
stop_keycode = remapped_keycodes+$3f
cntrl_keycode = remapped_keycodes+$3a
;
init_keyboard
;
php kill irqs
sei
;
lda #0 pin <= pout <= 0
sta kybd_pin
sta kybd_pout
sta ndx
;
ldax keychk
stax keychk_save
;
ldai kybd_in keychk vector points to kybd_in
stax keychk
;
ldai kernal_keycode_tables
stax pntr1
;
ldai remapped_keycodes
stax pntr2
;
ldx #0 ; move 59 bytes
10$ ldy #$59
20$ lda (pntr1),y
sta (pntr2),y
dey
bpl 20$
;
; set keys for codes $E0-$ED
;
ldy #$E0+110$-100$-1 ; y <= $Ed
40$ tya ;do save y
pha
lda 100$-$E0,y ; y <= offset for key to be defined as y
tay ;
pla ; .a <= what was that coed again
pha
sta (pntr2),y ; redefine key
pla ; restore y
tay
dey ; dey
cpy #$E0-1 ;until y = 5
bne 40$
;
txa ; y <= 2*x
asl a
tay
lda pntr2 ; set up decode indirection vector.
sta decode,y
lda pntr2+1
sta decode+1,y
;
ldy #pntr1 ; point to next bank of keys
jsr 120$
ldy #pntr2
jsr 120$
inx
cpx #$05 ; if more to do
bne 10$ ; go do 'em
; ; get the control left and right keys
lda #$ee
sta remapped_keycodes+$59+$59+$59+$55
lda #$ef
sta remapped_keycodes+$59+$59+$59+$56
;
plp reenable irqs
rts
;
120$ clc
lda $00,y
adc #$59
sta $00,y
lda $01,y
adc #0
sta $01,y
rts
;
; $E0 $E1 $E2 $E3 $E4 $E5 $E6 $E7 $E8 $E9 $Ea $Eb $Ec $Ed
; 0 1 2 3 4 5 6 7 8 9 . E - +
100$ .byte $51,$47,$44,$4f,$45,$42,$4d,$46,$41,$4e,$52,$4c,$4a,$49
110$
; $Ee = control left
; $Ef = control right
;
;
; errors and error routine
;
;
;
error_table
.byte 0 ; error zero is not an error !!, no text...
error_eob = 1
error_advance_past_bottom_of_buffer = 1
.byte "ADVANCE PAST BOTTOM OF BUFFER",0
error_sob = 2
.byte "BACKUP PAST TOP OF BUFFER",0
error_noimp = 3
.byte "FUNCTION NOT IMPLEMENTED",0
error_string_was_not_found = 4
.byte "STRING WAS NOT FOUND",0
error_no_select_range_active = 5
.byte "NO SELECT RANGE ACTIVE",0
error_select_range_is_already_active = 6
.byte "SELECT RANGE IS ALREADY ACTIVE",0
error_insufficient_memory = 7
.byte "INSUFFICIENT MEMORY",0
error_numeric_value_illegal = 8
.byte "NUMERIC VALUE ILLEGAL",0
error_syntax_error = 9
.byte "COMMAND SYNTAX ERROR",0
error_device_not_present = 10
.byte "DEVICE NOT PRESENT",0
error_stopped = 11
.byte "STOPPED",0
error_unknown = 12
.byte "MR. ERROR IS CONFUSED !!!",0
.byte 0
;
;
error_display
lda error_line ; position cursor
jsr set_line
lda #rvs_on ; print error message inverted
jsr print
;
lda #>error_table ; point to base of error table
sta errpnt+1
lda #<error_table
sta errpnt
;
ldx error_flag ; x <= error_flag + 1
inx
;
jmp 50$ ; goto middle of error scan loop.
;
30$ ldy #$00 ;do while (errpnt) <> null
lda (errpnt),y
beq 40$
incd errpnt do inc errpnt
jmp 30$
;
40$ incd errpnt inc errpnt ( point past the null )
lda (errpnt),y if at another null
bne 50$
lda #error_unknown ; at end of the string, go puke
sta error_flag
jmp error_display
50$ dex x <= x - 1
bne 30$ ;while x > 0
;
ldax errpnt ; print error message
;
jsr print_null_terminated_string
jmp clear_to_eol
;
;
;
;*******************************************************************************
; ascii charecter definitions
;*******************************************************************************
;
ram store_base
ram char_invert
;
;
set_8563_to_petscii
jmp init80
;
;
set_8563_to_ascii
lda #0 ; spit normal chars.
sta char_invert
lda #$20 ; do eight chars in lower case set
jsr 10$
lda #$30 ; do eight chars in upper case set
jsr 10$
dec char_invert ; time to invert chars
lda #$28 ; do eight chars in lower case set
jsr 10$
lda #$38 ; do eight chars in upper case set
;
10$ sta store_base ; save base address to modify
ldx #7 ; x <= 7
20$ txa ; do stack .x
pha
jsr 30$ ; spit out the xth char
pla ; recall x
tax
dex ; dex
bpl 20$ ; while x > 0
rts ;return
;
; .a = index of char to send
;
30$ asl a ; y <= offset for char address
tay
lda store_base ; set address or with the base address
ora char_offset+1,y
ldx #18 ; tell 8563 where to put this char
jsr vdcout
inx
lda char_offset,y
jsr vdcout
;
tya ; y <= offset into char definition
asl a
asl a
tay
;
40$ lda ascii_chars,y
eor char_invert
jsr vdcput
iny
tya
and #$07
bne 40$
rts
;
;
char_offset
.word $01c0,$01e0,$01f0,$0400,$05b0,$05c0,$05d0,$05e0
;
;char_rom_locations
; .byte 28,30,31,64,91,92,93,94
;
ascii_chars
.byte $00,$60,$30,$18,$0c,$06,$03,$00 ; backslash ( pound )
.byte $00,$18,$3c,$66,$00,$00,$00,$00 ; up arrow ( up arrow )
.byte $00,$00,$00,$00,$00,$00,$7f,$00 ; underscore ( back arrow )
.byte $00,$18,$0c,$06,$00,$00,$00,$00 ; grave accent ( horiz bar )
.byte $0e,$18,$18,$70,$18,$18,$0e,$00 ; open curly bracket ( cross )
.byte $18,$18,$18,$00,$18,$18,$18,$00 ; vertical bar ( half hash )
.byte $70,$18,$18,$0e,$18,$18,$70,$00 ; close curly bracket (vert bar)
.byte $00,$00,$06,$3c,$60,$00,$00,$00 ; tilde ( pi )
;
;char_rom_locations
; .byte 28,30,31,64,91,92,93,94
;
;
; change case of char:
; examines the charecter in .a and changes its case
; if appropriate. x,y are preserved.
;
change_case_of_char
bit plot_mode if ascii mode
bpl 100$
cmp #'A if 'A'-'Z' or 'a'-'z'
bcc 70$
cmp #'Z'+1
bcc 65$
cmp #'a'
bcc 70$
cmp #'z'+1
bcs 70$
;
65$ eor #'a'-'A' toggle case
70$ rts return
;
100$ cmp #65 if petscii letter
bcc 170$
cmp #91
bcc 160$
cmp #193
bcc 170$
cmp #219
bcs 170$
160$ eor #%10000000 toggle case of it
170$ rts return
;
;

742
EDT_C128/keyops.src

@ -0,0 +1,742 @@
.subttl control key function
;******************************************************************************
; functions asscociated with keys
;******************************************************************************
;
; cusor_up,cursor_down,cursor_left,cursor_right
;
; delete deletes char before cursor
; line_feed delete char to beginning of word
; back_space delete char to beginning of line
;
; insert .a inserts a char of text
;
; keypad layout
;
; -----------------------------------------------------------------
; | gold: | help: | find_nxt | del_line |
; | gold: | help: | find | un_del_line |
; +---------------+---------------+---------------+---------------+
;
; +---------------+---------------+---------------+---------------+
; | page | sect | append | del_word |
; | command | fill | replace | un_del_word |
; +---------------+---------------+---------------+---------------+
; | advance | backup | cut | del_char |
; | bottom | top | paste | un_del_char |
; +---------------+---------------+---------------+---------------+
; | word | eol | char | |
; | change_case | del_eol | specins | subs |
; +---------------+---------------+---------------+ |
; | line | select | enter |
; | open_line | reset | |
; +---------------+---------------+---------------+---------------+
;
;
;****************************************************************************
; key operations:
;****************************************************************************
;
; this section of contains the functions implemented by
; control charecters, keypad keys, and the arrow keys.
;
; keys in this section are listed in the following order:
;
; arrow ( cursor ) keys
; misc control keys
; pf1-pf4
; keypad numbers in ascending order
; non_numeric_keypad_keys
;
; all of these control functions exeoect a call to control_preprocess
; immediately before control is passed to them. This call sets up
; flags in the processor condition codes regarding the state
; of the gold function ( this a gold key ? ) and the state of
; the direction byte ( are we forwards or reverse ) ?.
;
; as you see, a signicant amouint of dispatching still must take place
; at this level of operation, as DISPATCH only breaks control down
; to the key level, NOT the intended function level.
;
;
;
;
;*****************************************************************************
; arrow keys
;*****************************************************************************
;
;
; cursor_up move cursor up
; cursor_down move cursor down
; cursor_left move cursor left
; cursor_right move cursor right
;
;
cursor_right
jmp buf_advance
cursor_left
jmp buf_back
;
;
cursor_up
inc dcol_flag ; mark this operation as set coloumn by dcol
jsr buf_sol ; move to start of a line
jmp buf_back ; back up a char and return
;
; move cursor down a line
; ( forces new screen )
;
cursor_down
inc dcol_flag ; mark this as a special dcoloumn operation
jsr buf_eol ; advance the cursor to end of this line
jmp buf_advance ; go one more char and return
;
; shift screen to left if seems reasonable
;
ctl_left
clc
lda col_offset
adc #$08
bcs 10$
sta col_offset
inc new_screen force replot
10$ clc
rts
;
; shift screen to right if seems reasonable
;
ctl_right
sec
lda col_offset
beq 10$
sbc #$08
inc new_screen force replot
10$ sta col_offset
clc
rts
;
;
;*****************************************************************************
; mics control keys
;*****************************************************************************
;
key_delete
jsr buf_back ; back up so char to remove is current char
bcs 90$
jsr buf_remove ; remove char
sta deleted_char_buffer ; save in buffer
lda #0 ; mark type of deleted char ( edt subtilty)
sta deleted_char_type
clc ; return happy
90$ rts
;
key_clear
key_ctl_r
inc new_screen ; force a new screen
clc
rts
;
;key_insert
; lda deleted_char_buffer
; jsr buf_insert
; rts
;
;
;*****************************************************************************
; PF keys
;*****************************************************************************
;
key_pf1 rts ; trapped else where
;
key_pf2 jmp help
;
key_pf3_50
;
; implement the find function
;
; KLUDGE: this routine assumes forwards key is $E4 and backwards key
; is $e5
;
;
lda direction ; stack the current direction
pha
ldai search_message ; get text from user
jsr get_command ; ( termination key in .a )
;
lsr a ; set direction if user hit adv or back
eor #$72
bne 5$
rol a
sta direction
;
5$ ldx command_len ; copy text & length to buffer
stx search_len
dex
10$ lda command,x
sta search_buffer,x
dex
bpl 10$
lda #0
sta gold_flag ; clear the gold flag to fix repeat problem
;
jsr search ; go search for requestted text (BUF call )
;
tay ; y <= possible error
pla ; a <= old direction
bcc 7$ ; if error occured
sta direction ; restore old direction
7$ tya ; .a <= possible error
rts ; return
;
search_message
.byte "SEARCH FOR: ",0
;
; implemenent the find next function
;
key_pf3 bne key_pf3_50
search jsr char_function do move a char
bcs 90$ until error or at search string
jsr buf_search_check
bcs search
rts return happy
;
90$ jsr buf_to_cursor restore buffer position
lda #error_string_was_not_found
sec return unhappy
rts
;
key_pf4 bne key_pf4_50
;
; implement the delete line function
;
ldax buf_pos cut_start_pos <= cursor postition
stax cut_start_pos
jsr buf_eol move to end of this line
jsr buf_advance advance another byte ( cr )
delete_eol_entry
ldax buf_pos cur_end_pos <= buffer positon
stax cut_end_pos
cmpx cut_start_pos if same as start
bne 10$
lda #error_advance_past_bottom_of_buffer
sec puke
rts
;
10$ ldax dline_base abuf_start <= base of dline_buffer
stax abuf_start
;
ldai dline_space abuf_end <= end of dline buffer
adcx dline_base
stax abuf_end
;
jsr buf_save perform the "cut"
bcs 90$ if no error
stax dline_len dline_len <= x,a
90$ rts return
;
; implement the undelete line function
;
key_pf4_50
ldax dline_base abuf_start <= base of dline slicer
stax abuf_start
ldax dline_len x,a <= dline_len
jsr buf_load preform the "paste" and return
bcs 90$
jsr buf_to_cursor restore previous buffer position
90$ rts
;
;
;*****************************************************************************
; Keypad keys ( numeric )
;*****************************************************************************
;
key_0 bne key_0_50
;
; implements the beginning of a line operation
;
key_bol
lda direction
bne 10$ ;if forwards
;
jsr buf_eol ; goto end of current line
jmp buf_advance ; advance one char & return
; else
10$ jsr buf_back ; go back one char
bcs 90$
jmp buf_sol ; set to start of whichever line we're on & return
90$ rts
;
; implement the open line function
;
key_0_50
jsr clear_repeat ; do this only once
lda #cr ; pretend he typed a cr and a back arrow.
jsr buf_insert
bcs 90$
jmp buf_back
90$ rts
;
;
key_1 bne 50$
;
; implement the word function
;
10$ jsr char_function do move a char
bcs 49$
jsr buf_word_check until at start of word
bcs 10$
49$ rts
;
; implement the change case function
;
50$ lda #'F ; pretend user entered undocumented FC command
sta command
lda #'C
sta command+1
lda #2
sta command_len
jmp filter_command ; let filter_command handle the problem
;
;
key_2 bne 50$
;
; implement the end of line function
;
10$ jsr char_function do move a char
bcs 90$
jsr buf_char until at eof or a cr
bcs 90$
cmp #cr
bne 10$
clc
90$ rts
;
; implement the delete to end of line function
;
50$ ldax buf_pos cut_start_pos <= cursor postition
stax cut_start_pos
jsr buf_eol move to end of this line
jmp delete_eol_entry let delete_line finish the job
;
key_3 bne specins
;
;
; implement the char function
;
char_function
lda direction
bne 10$
jmp buf_advance
10$ jmp buf_back
;
specins ldx repeat_count+1 if repeat count < 256
bne 90$
lda repeat_count repeat_count <- 0
stx repeat_count
jmp buf_insert insert and return
;
90$ lda #error_numeric_value_illegal
sec
rts
;
key_4 bne 50$
;
; implement the advance function
;
lda #0
sta direction
clc
rts
;
; implement the bottom function
;
50$ jsr buf_bot go to bottom of file ( lowlevel routine )
lda nlines put cursor on the floor
sta cur_line
inc new_screen set lotsa nasty flags
inc buf_cr_flag
clc
rts return
;
;
key_5 bne 50$
;
; implement the backwards function
;
lda #1
sta direction
clc
rts
;
; implement the top function
;
50$ nop
key_home
jsr buf_top go to top of file ( lowlevel routine )
lda nlines put cursor on the floor
sta cur_line
inc new_screen set lotsa nasty flags
inc buf_cr_flag
clc
rts return
;
;
;
key_6 bne 50$
;
; implement the cut function
;
jsr select_something if nothing to cut
bcs 90$ puke
;
; set up buf_save routine
ldax cut_base ;abuf_start <= cut_base
stax abuf_start
; ;abuf_end <= max addr legal for cut
ldai cut_space
adcx cut_base
stax abuf_end
;
jsr buf_save perform the cut
bcs 90$ if no error
stax cut_len cut_len <= number of chars
jsr clear_dot clear dot flag
90$ rts return
;
;
; implement the paste function
;
50$
subs_entry
ldax cut_base abuf_start <= pointer to base of cut area
stax abuf_start
ldax cut_len x,a <= length of cut
jmp buf_load perform paste and return
;
;
;
key_7 bne key_7_50
;
; implement the page function
;
10$ jsr char_function do move a char based on direction
bcs 90$ puke if error
jsr buf_char until at a line feed
bcs 90$
cmp #$0c
bne 10$ return happy
clc
90$ rts
;
; implement the command function
;
key_7_50
key_ctl_z
jsr clear_repeat kill repeats
jmp do_command do a command ( once )
;
;
key_8 bne 50$
;
; implement the section function
;
jsr buf_sol move cursor to start of current line
;
ldx #16 x <= 16
10$ txa do save .x on stack
pha
jsr key_bol perform the beginning of line function
tay recall x from stack preserving .a
pla
tax
tya
bcs 90$ puke if error
dex x <= x - 1
bne 10$ while x <> 0
90$ rts return
;
; implement the fill function
;
50$ jmp noimp
;
;
;
key_9 bne 50$
;
;
; implement the append_function
;
jsr select_something_no_move
bcs 90$
;
ldax cut_base ;abuf_start <= cut_base+len
adcx cut_len
stax abuf_start
; ;abuf_end <= max addr legal for cut
ldai cut_space
adcx cut_base
stax abuf_end
;
jsr buf_save perform the cut
bcs 90$ if no error
adcx cut_len cut_len += number of chars
stax cut_len
jsr clear_dot
rts return
;
90$ rts
;
; implement the replace function
;
50$ jsr select_something_no_move
bcs 90$
jsr buf_return_free ; determine if it'll fit
adcx cut_end_pos ; x,a <= free + cut_end-cut_start
sbcx cut_start_pos ; ( this is free after removal )
cmpx cut_len ; if x,a < cut_len
bcs 60$
lda #error_insufficient_memory
sec ; return error
rts
;
60$ ldax cut_end_pos ; buffer <= end of text to remove
jsr buf_position
70$ ldax buf_pos ; while buffer not at start cut removal area
cmpx cut_start_pos
beq 80$ ; do
jsr buf_remove ; remove a char
jsr buf_back ; back up a char
jmp 70$
;
80$ jsr clear_dot
ldax cut_base ; abuf_start <= base of cut buffer
stax abuf_start
ldax cut_len ; x,a <= cut_length
jmp buf_load ; read data in....
;
;
;
;
;
;*****************************************************************************
; Keypad Keys ( non-numeric )
;*****************************************************************************
;
;
key_comma bne 50$
;
; implement the delete char function
;
jsr buf_remove
bcs 90$
sta deleted_char_buffer
lda #1
sta deleted_char_type
90$ rts
;
;
; implement the undelete char function
;
50$ lda deleted_char_buffer
jsr buf_insert
bcs 90$
lda deleted_char_type
beq 90$
jmp buf_back
;
;
key_enter bne 50$
; implement the enter function
;
clc ; enter does absolutely nothing in this context.....
rts
;
; implement the substitute function
;
50$ jsr buf_search_check if at an instance of the search string
bcs 90$
ldx search_len if len <> 0
beq 70$
;
60$ txa do
pha save num chars on stack
jsr buf_remove remove a char
pla recall number of chars
tax
dex dec number of chars
bne 60$ while <> 0
;
70$ jsr subs_entry pasto
bcs 99$
jsr search find the next one...
bcs 99$ if on a different line
cmpdr cr_count_pre,old_cr_count_pre,a
beq 80$
lda #55 force screen replot
; ( load and store because increment could wrap )
sta new_screen
80$ clc return happy
rts
;
90$ lda #error_no_select_range_active
sec
99$ rts
;
key_dot bne 50$
;
; implement the dot function
;
lda dot_flag ; if dot flag is set
beq 10$
lda #error_select_range_is_already_active
sec ; puke
rts
;
10$ inc dot_flag ; set dot_flag
ldax buf_pos ; save buffer postion as dot position
stax dot_pos
jsr clear_repeat
clc ; return happy
rts
;
; implement the cancel dot function
;
50$ lda dot_flag ; if dot flag is set
beq 60$
inc new_screen ; force a new screen
60$ jsr clear_dot ; clear the dot flag
clc ; return happy
rts
;
clear_dot ; clear dot preserving registers and carry
pha
lda #0
sta dot_flag
pla
rts
;
;
key_dash bne 50$
;
; implement the delete word function
;
;
ldax buf_pos cut_start_pos <= buf_pos
stax cut_start_pos
20$ jsr buf_advance advance to start of next word
bcs 30$
jsr buf_word_check
bcs 20$
30$ ldax buf_pos cut_end_pos <= buf_pos
stax cut_end_pos
;
ldax cut_start_pos reposition buffer at start of "word"
jsr buf_position
;
ldax dword_base abuf_start <= start of dword buffer
stax abuf_start
;
ldai dword_space abuf_end <= max position in word_buffer
adcx abuf_start
stax abuf_end
;
jsr buf_save attempt the "cut"
bcs 40$ if no error
stax dword_len dword_len <= x,a
;
40$ rts return
;
;
; implement the undelete word function
;
50$ ldax dword_base
stax abuf_start
ldax dword_len
jsr buf_load preform the "paste" and return
bcs 90$
jsr buf_to_cursor restore previous buffer position
90$ rts
;
;
;
;**************************************************************************
; SELECT_SOMETHING
;**************************************************************************
;
;
; select_something
; attempts to select an area of text and positions
; buffer at start of that area
;
select_something
jsr select_something_no_move
bcc 10$
rts
;
10$ ldax cut_start_pos position buffer at start of area
jmp buf_position
;
;
; select_something_no_move
; sets up selection pointers to marked area or searched string
; or returns an error.
;
; if nothing is marked and not at start of search string
; return error selectr range not active
; if something is marked
; cut_start_pos,end_pos <= start and end of marked area
; else ( at start of search string )
; cut_start_pos,end_pos <= start and end of search string
; in text buffer
; return c=0
;
select_something_no_move
jsr set_cut_start_stop set up pointers around marked area
lda dot_flag if no dot dropped
bne 80$
; if search string is null
lda search_len
beq 90$ go puke
jsr buf_search_check if not at start of search instance
bcs 90$ go puke
;
ldax buf_pos cut_start_pos <= buffer_position
stax cut_start_pos
clc cut_end_pos <= same + length of search string
adc search_len
bcc 40$
inx
40$ stax cut_end_pos
;
80$ clc return happy
rts
;
90$ lda #error_no_select_range_active
sec
rts
;
;
;set_cut_start_stop
; sets cut_start and cut_end pointers based on
; cursor postions and the dot position
;
set_cut_start_stop
;
ldax cur_pos ; start & stop <= cursor position
stax cut_start_pos
stax cut_end_pos
;
ldax dot_pos ; if dot_pos < cursor_pos
cmpx cur_pos
bcs 10$
;
stax cut_start_pos start <= dot_pos
rts
; else
10$ stax cut_end_pos end <= dot_pos
rts return
;

238
EDT_C128/keyproc.src

@ -0,0 +1,238 @@
.subttl PROCESS A KEY
;******************************************************************************
; PROCESS KEY
;******************************************************************************
;
process_key
sta rxed_char save key
cmp #gold_key if either gold_key
beq 1$
cmp #gold_key_2
bne 5$
1$ sta gold_flag set gold_flag
clc return happy
rts
;
5$ cmp #delete if delete or a digit
beq 10$
cmp #'0
bcc 20$
cmp #'9'+1
bcs 20$
;
10$ lda command_len if gold or command len <> 0
ora gold_flag
beq 20$
;
lda #0 clear gold_flag
sta gold_flag
;
lda rxed_char add char to command line
jsr command_insert_delete
clc return happy
rts
;
20$ ldai 0 x,a <= 0
cmp command_len if something in command buffer
beq 30$
jsr parse_command_to_number ( x,a )
bcs 90$ if error
; go clear gold,repeat,and command
;
30$ stax repeat_count repeat_count <= value of number
;
50$ jsr execute_key do execute the key
bcs 90$ if error
; go clear gold,repeat,and command
lda repeat_count if repeat_count == 0
ora repeat_count+1
beq 80$ break
jsr stop if stop key pressed
bne 60$
;
lda #error_stopped stop error
bne 90$
;
60$ decd repeat_count decrement the repeat count
lda status_line position cursor
jsr set_line
ldax repeat_count
jsr print_decimal print number for user
jsr clear_to_eol clear to end of the line for the user..
lda repeat_count until repeat count == 0
ora repeat_count+1
bne 50$
;
80$ clc return happy w/ all kinds of stuff cleared
bcc 100$
;
90$ sta error_flag
sec
;
100$ ldy #0 clear the gold_flag
sty gold_flag
sty command_len clear command
;
clear_repeat
ldy #0 clear repeat count
sty repeat_count
sty repeat_count+1
rts
;
;******************************************************************************
; EXECUTE KEY
;******************************************************************************
; execute the key
; adjust the cursor column as is appropriatte.
; ( kludge to assist in up, and down and section operations ).
;
;
execute_key
ldx #0 desired column flag <= 0
stx dcol_flag
jsr dispatch_key dispatch the key to processing
bcs 5$ if no error
lda #0 a <= 0 ( no error )
5$ pha save any possible error condition
lda dcol_flag if dcol_flag <> 0
beq 10$
;
lda dcol .a <= buf_col <= cursor_col ( best fit )
jsr buf_to_col
sta cur_col
ldax buf_pos mark this position as cursor position
stax cur_pos
jmp 20$ else
;
10$ ldax buf_pos mark this position as curosr position
stax cur_pos
jsr buf_col_return cur_col <= dcol <= .a <= buffer's coloumn
sta dcol
sta cur_col
;
;
20$ pla recall error status
cmp #1 sec if <> 0
rts return
;
;
;*******************************************************************
; DISPATCH KEY
;*******************************************************************
;
; determine if key is control
; if not,
; insert key into buffer as normal
; otherwise
; call appropriate control key routine.
;
; remap control keys as follows: B7-B5 B7-B5
; 000 000
; 100 001
; 111 010
;
ram rxed_char
;
dispatch_key lda rxed_char a <= key
bmi 10$ if < 128
cmp #$20 if < $20
bcc control_key_0 control key
bcs normal_key normal ( text ) key
10$ cmp #$a0 if < $a0
bcc control_key_1 control_key
cmp #$e0 if >= $e0
bcs control_key_2 control_key
; fall through to normal key
;
normal_key ; normal key operation
ctlins ; control key insert operation
jmp buf_insert
;
control_key_2
control_key_1
eor #%10100000
control_key_0
asl a ; stack address for the keys operation
tax
lda control_dispatch+1,x
pha
lda control_dispatch,x
pha
lda direction ; set carry if direction is reversed
cmp #1
lda gold_flag ; set z flag if not a gold function
php ; save this status
lda rxed_char ; recall .a
plp ; restore status
rts ; rts to control routine
;
;
;
;*************************************************************************
; control key dispatch tables
;*************************************************************************
;
; first 32 entries low order control codes (0-31)
; second 32 entries high order control codes ( 128-159 )
; third 32 entries keypad keycodes
;
;
control_dispatch ;
;
; low order key codes
.word ctlins-1,ctlins-1,ctlins-1,ctlins-1 ; 0-3
.word ctlins-1,ctlins-1,ctlins-1,ctlins-1 ; 4-7
.word ctlins-1,normal_key-1,ctlins-1,ctlins-1 ; 8-11
.word ctlins-1,normal_key-1,ctlins-1,ctlins-1 ; 12-15
.word ctlins-1,cursor_down-1,key_ctl_r-1,key_home-1 ; 16-19
.word key_delete-1,ctlins-1,ctlins-1,recover-1 ; 20-23
.word ctlins-1,ctlins-1,key_ctl_z-1,ctlins-1 ; 24-27
.word ctlins-1,cursor_right-1,ctlins-1,ctlins-1 ; 28-31
;
; high order key codes
;
.word ctlins-1,ctlins-1,ctlins-1,ctlins-1 ; 128-131
.word help-1,key_pf1-1,key_pf2-1,key_pf3-1 ; 132-135
.word key_pf4-1,key_pf1-1,key_pf2-1,key_pf3-1 ; 136-139
.word key_pf4-1,ctlins-1,ctlins-1,ctlins-1 ; 140-143
.word ctlins-1,cursor_up-1,ctlins-1,key_clear-1 ; 144-147
.word ctlins-1,ctlins-1,ctlins-1,ctlins-1 ; 148-151
.word ctlins-1,ctlins-1,ctlins-1,ctlins-1 ; 152-155
.word ctlins-1,cursor_left-1,ctlins-1,ctlins-1 ; 156-159
;
; key pad key codes
;
.word key_0-1,key_1-1,key_2-1,key_3-1 ; 0-3
.word key_4-1,key_5-1,key_6-1,key_7-1 ; 4-7
.word key_8-1,key_9-1,key_dot-1,key_enter-1 ; 8-11
.word key_comma-1,key_dash-1,ctl_left-1,ctl_right-1 ; 12-15
.word ctlins-1,ctlins-1,ctlins-1,ctlins-1 ; 16-19
.word ctlins-1,ctlins-1,ctlins-1,ctlins-1 ; 20-23
.word ctlins-1,ctlins-1,ctlins-1,ctlins-1 ; 24-27
.word ctlins-1,ctlins-1,ctlins-1,ctlins-1 ; 28-31
;
;
noimp lda #error_noimp
sec
rts
;
;
recover
jsr buf_top goto top of file
ldai 0 clear <cr> count
stax cr_count_pre
jsr buf_bot goto bottom of file
ldai 0 clear <cr> count
stax cr_count_post
ldax cur_pos goto cursor position if possible
jsr buf_position
ldax buf_position set cursor to match buffer position
stax cur_pos
inc new_screen force a replot
clc return
rts
;
;
;

128
EDT_C128/macro.src

@ -0,0 +1,128 @@
.subttl 16 bit macro definitions
;
ram .macro %a,%b
%a = curram
.ifb <%b>
curram = curram+1
.else
curram = curram+%b
.endif
.endm
zpage .macro %a,%b
%a = curzpage
.ifb <%b>
curzpage = curzpage+1
.else
curzpage = curzpage+%b
.endif
.ifgt curzpage-$0090
ERROR- too many zero page variables.....
.endif
.endm
;
;
; double precision macros
;
;
ldax .macro %a
lda %a ; x,a <= %a
ldx %a+1
.endm
;
stax .macro %a
sta %a ; %a <= x,a
stx %a+1
.endm
;
cmpx .macro %a
cpx %a+1 ; compare x,a with %a
.ifn >%a
bne *+5
.else
bne *+4
.endif
cmp %a
.endm
;
;
cmpi .macro %a
cpx #>%a ; compare x,a with #%a
bne *+4
cmp #<%a
.endm
;
ldai .macro %a
lda #<%a ; x,a <= #%a
ldx #>%a
.endm
;
;
incd .macro %a
inc %a ; inc double precision %a
.ifn >%a
bne *+5
.else
bne *+4
.endif
inc %a+1
.endm
;
decd .macro %a
pha ; dec double precision %a
lda %a
.ifn >%a
bne *+5
.else
bne *+4
.endif
dec %a+1
dec %a
pla
.endm
;
adcx .macro %a
cld ; add %a to x,a
clc ; ( carry is only good condition code )
adc %a
pha
txa
adc %a+1
tax
pla
.endm
;
sbcx .macro %a
cld ; sub %a from x,a
sec ; ( carry is only good condition code )
sbc %a
pha
txa
sbc %a+1
tax
pla
.endm
;
cmpdr .macro %a,%b,%r ; double compare %a to %b using .%r
ld%r %a+1
cp%r %b+1
.ifn >%a
.ifn >%b
bne *+2+3+3
.else
bne *+2+3+2
.endif
.else
.ifn >%b
bne *+2+2+3
.else
bne *+2+2+2
.endif
.endif
ld%r %a
cp%r %b
.endm
;
cpa .macro %a
cmp %a
.endm

447
EDT_C128/main.src

@ -0,0 +1,447 @@
.subttl THE CORE OF EDT
;**************************************************************************
; initialization
;**************************************************************************
;
init jsr save_system save stuff necesary to return to basic
jsr init_editor init the editor
10$ jsr main_loop do main loop
lda quit_flag while quit_flag = 0
beq 10$
jsr restore_system restore system
jmp $4000 hard reset basic ( almost full init... )
;
init_editor
init_mmu ; init the mmu preconfig registers
jsr kill_basic ; no basic irqs ( frees zero page )
jsr kill_nmis ; don't like them nmis either
jsr init_keyboard ; modified keyboard driver
jsr scrorg
sty status_line ; bottom line is status
dey
sty error_line ; next to last is error line
dey
sty nlines ; next to next to last is last line in window
dex ; need to never place cursor past right of window
stx max_col
stx command_len_max
;
jsr buf_init
;
lda #0 a <= 0
sta plot_mode select petscii mode of display
sta kybd_mode select petscii keyboard mode
sta msgflg kill kernal messages
sta cur_line cur_line <= 0
sta cur_col cur_col <= 0
sta col_offset col_offset <= 0
sta dcol dcol <= 0
sta error_flag error_flag <= 0
sta dot_flag dot_flag <= 0
sta number_flag number_flag <= 0
sta direction direction <= 0
sta search_len search string <= ""
sta quit_flag quit_flag <= 0
;
;
lda #4
sta hyster_lines screen vertical hysterisis <= 5 lines
lda #1 screen horizontal hystersis <= 1 char
sta hyster_col
sta new_screen new_screen <= non_zero
sta status_enable enable status line display
;
ldai 0 ;x,a <= 0
stax dword_len bytes in word buffer <= 0
stax dline_len bytes in line buffer <= 0
stax cut_len bytes in cut buffer <= 0
stax repeat_count repeat_count <= 0
;
ldai cut_start ; init base pointers for various buffers
stax cut_base
ldai dline_start
stax dline_base
ldai dword_start
stax dword_base
;
lda #8 ; set up default disk
sta load_disk
; ; set up default filename
ldx #init_filename_end-init_filename
stx load_name_len
dex
1$ lda init_filename,x
sta load_name,x
dex
bpl 1$
;
lda #0 clear pending command
sta command_len
;
ldai init_message tell 'em who we are
jsr command_refresh
lda #1 prevent main from updateing command line
sta ds_flag have not recently read disk status
jmp refresh_display display the empty buffer & return
;
init_message
.byte 14 ; select lower case as default
; 0123456789012345678901234567890123456789 40 col max....
.byte "-- C128 TEXT FILE EDITOR V"
version
.byte " --"
.byte 0
;
init_filename
.byte "0:NONAME.TXT"
init_filename_end
;
;
;**********************************************************************
; main routine
;**********************************************************************
;
;
null_message
.byte " ",0
;
main_loop
lda error_flag if error flag <> 0
beq 20$
jsr beep beep
jsr error_display display error condition
jmp 30$ else
;
20$ lda error_line postition cursor
jsr set_line
;
lda status_enable if status enable <> 0
beq 25$
jsr print_status_info
;
25$ jsr clear_to_eol blank to eol
;
30$ lda status_line
jsr set_line
lda ds_flag if disk status not read
bne 40$
lda command_len if command len = 0
bne 35$
lda status_enable andif status line enabled
beq 35$
jsr print_status_info_2 print second line
jmp 40$ else
;
35$ ldai null_message update command line
jsr command_refresh ( has repeat count or null )
;
40$ jsr cursor_wait_for_text
pha save key
;
ldax cr_count_pre
stax old_cr_count_pre
ldx #0
stx buf_change_flag buf_line_offset <= 0
stx buf_cr_flag buf_cr_flag <= 0
stx error_flag error_flag <= 0
stx ds_flag ds_flag <= 0
;
pla recall key
50$ jsr process_key do process_key
bcs 60$ break if error
jsr get_key until no more keys to implement
bcc 50$
;
60$ jsr check_cur_col validate horizontal postiition of cursor
jsr pick_cur_line position the cursor vertically
jsr update_display fix the display to match
jmp buf_to_cursor position buffer and return
;
;
print_status_info
;
ldx #2 ; skip 0: in filename
10$ cpx load_name_len
txa
pha
lda #space
bcs 20$
lda load_name,x
20$ jsr print
pla
tax
inx
cpx #19
bne 10$
;
jsr primm
.byte "LINE = ",0 print line number
ldax cr_count_pre
jsr print_decimal
jsr primm print coloumn number
.byte " COL = ",0
ldx #0
lda cur_col
jsr print_decimal
jsr clear_to_eol clear to eol
rts
;;
print_status_info_2
bit plot_mode
bpl 20$
jsr primm
.byte "ASCII ",0
jmp 40$
20$ jsr primm
.byte "PETSCII",0
40$ jsr primm
.byte " FREE SPACE = ",0
jsr buf_return_free
jsr print_decimal
jmp clear_to_eol
;
;
;
;
;check_cur_col
; this routine is respncible for shifting the display
; left and right based on the number of columns, the
; current cursor coloumn, and the current display shift.
;
; if shifting is required, then the new_screen flag is set,
; and col_offset is adjusted to the new shift value.
;
;
check_cur_col
lda cur_col x <= calc minumum screen offset
clc ( cursor_col + hyster_col - screen width )
adc hyster_col ( rounded up to next tab stop )
bcc 10$
lda #255
10$ sec
sbc max_col
bcs 20$
lda #255
20$ ora #%00000111
tax
inx
;
;
lda cur_col y <= max screen offset
sec ( rounded down to tab stop )
sbc hyster_col
bcs 30$
lda #0
30$ and #%11111000
tay
;
cpx col_offset if x > current screen offset
bcc 40$
beq 40$
stx col_offset col_offset <= .x
inc new_screen force a screen
40$ cpy col_offset if y < current screen offset
bcs 50$
sty col_offset col_offset <= .y
inc new_screen force a screen
;
50$ clc
rts
;
;
; pick_cur_line
; looks at the number of crs in front of the cursor
; and the number that used to be there in order to determine
; how the cursor should move vertically. new cursor line is
; calculated base upon this delta and the line the cusor
; used to be on.
;
; sets old_cur_line to value of cur_line before entry, and
; then modifies cur_line to freshly calculated value.
;
; calls check_cur_line to assure that the new cursor position
; meets the rules for positiioning based upon the vertical
; hysteresis values.
;
ram old_cur_line temp var
;
pick_cur_line
lda cur_line
sta old_cur_line
cld x,a <= new cursor line
sec ( new text line-old text line+cur_line )
ldax cr_count_pre
sbcx old_cr_count_pre
clc
adc cur_line
bcc 10$
inx
10$ cpx #0 if < 0
bmi 30$ go set to line zero
bne 20$ if < nlines
cmp nlines
bcc 40$ go curline <= .a
20$ lda nlines curline <= nlines
.byte $2c
30$ lda #0
40$ sta cur_line
;
; jmp check_cur_line
;
; check_cur_line
; the purpose of this routines is too attempt to keep the
; cursor within the middle lines of the screen.
; I.E. moveing up and down operations result in the
; cursor being placed on the top or bottom lines of the screen.
; this function detects when the cursor is near the edge of
; a window, and examines the text buffer to see if a more
; optimal location can be selected.
;
; copy cursor line to temp location.
; modify temp location based on various rules for cursor placement
; compare temp tto cursor line
; if different
; cursor lione <= temp
; force new_screen
;
zpage val_temp,1
;
check_cur_line
lda cur_line a <= cur_line
bpl 10$ if .a < 0
lda #0 .a <= 0
;
10$ sta val_temp val_temp <= .a
;
sec .a <= max desired line
lda nlines
sbc hyster_lines
;
cmp val_temp if .a < val_temp
bcs 20$
;
ldax cr_count_post .a <= mim(hyster_lines,cr_count_post)
jsr 100$
;
eor #$ff .a <= nlines - .a
sec
adc nlines
;
cmp val_temp if .a < val_temp
bcs 20$
sta val_temp val_temp <= .a
;
20$ lda val_temp if val_temp < hyster_lines
cmp hyster_lines
bcs 50$
ldax cr_count_pre .a <= min(hyster_lines,cr_count_pre)
jsr 100$
cmp val_temp if .a > val_temp
bcc 50$
beq 50$
;
sta val_temp val_temp <= .a
;
50$ lda cr_count_post+1
; if < 255 lines after cursor
bne 70$
sec
lda nlines a <= nlines - number of crs behind us
sbc cr_count_post
bcc 70$ if .a > 0
;
cmp val_temp if .a > val_temp
bcc 70$
beq 70$
sta val_temp select a new cursor line
;
; if cr_count_pre < val_temp
70$ ldx cr_count_pre+1
bne 80$
lda cr_count_pre
cmp val_temp
bcs 80$
sta val_temp val_temp <= cr_count_pre
;
80$ lda val_temp if val_temp <> cur_line
cmp cur_line
beq 88$
sta cur_line cur_line <= val_temp
88$ clc return happy
rts
;
;
100$ cpx #0 .a <= min( hyster_lines, (x,a) )
bne 110$
cmp hyster_lines
bcc 120$
110$ lda hyster_lines
120$ rts
;
;
;
;
; cr_count_pre(2) buffer line number after operation
; old_cr_count_pre(2) buffer line number before operation
; old_cur_line display line number before operation
; cur_line display line number
;
; buf_changed_flag set if operation changed buffer
; buf_cr_flag set if operation added or deled a CR from buf
; new_screen set if operation requires full refresh
; ( command, etc )
; dot_flag set if mark area enabled.
;
update_display
lda buf_cr_flag if buf_cr_flag <> 0
bne 99$ go force complete refresh
lda new_screen if new_screen <> 0
bne 99$ fo force complete refresh
ldax cr_count_pre x,a <= number of lines to scroll display
sbcx old_cr_count_pre
sec
sbc cur_line
bcs 10$
dex
10$ clc
adc old_cur_line
bcc 20$
inx
;
20$ cpx #0 if x,a > 0
bmi 30$
; if x,a > 16
bne 99$
cmp #16+1
bcs 99$ go force complete refresh
bcc 40$ else
;
30$ inx if x,a < -10
bne 99$
cmp #$FF-16
bcc 99$ go force complete refresh
;
40$ cmp #0 if scroll_num (.a ) <> 0
beq 50$
ldx buf_change_flag if buf_changed
bne 99$ go force complete refresh
ldx dot_flag if dot is dropped
bne 99$ go force complete refresh
;
jmp scroll_and_refresh go scroll and refresh
;
50$ ldx dot_flag if dot dropped
beq 60$
ldax cr_count_pre if moved past a line
cmpx old_cr_count_pre
bne 99$ go refresh entire display
jmp refresh_cursor_line go refresh cursor line
60$ lda buf_change_flag if buffer changed
beq 70$
jmp refresh_cursor_line refresh_cursor_line
70$ rts return
;
99$ lda #0 clear new_screen
sta new_screen
jmp refresh_display refresh_entire_display

386
EDT_C128/plot.src

@ -0,0 +1,386 @@
.SUBTTL DISPLAY REFRESH ROUTINES
;
;
zpage scroll_temp
;
scroll_and_refresh
sta scroll_temp
and #$ff
bpl scroll_up_a
eor #$ff correct sign of calcuation
clc
adc #1
;
scroll_down_a
pha save number of lines to scroll
clc
sbc cur_line
jsr scroll_buf_pos
;
pla recall number of lines to scroll
sta scroll_temp
20$ jsr scroll_down do scroll the display one line
jsr buf_sol move to start of this line
lda #0 plot a line
jsr plot_line
jsr buf_sol move to previous line
jsr buf_back
dec scroll_temp dec temp
bne 20$ until temp < 0
;
rts return
;
;
scroll_up_a
pha save number of lines to scroll
sta scroll_temp scroll_temp <= number of lines past
lda nlines cursor where the first unshown line is.
sec
sbc cur_line
sbc scroll_temp
clc
adc #$01
jsr scroll_buf_pos
;
pla recall number of lines to scroll
sta scroll_temp
20$ jsr scroll_up do move the display down a line
lda nlines plot a line
jsr plot_line
jsr buf_advance move to start of next line
dec scroll_temp dec temp
bne 20$ until temp = 0
;
rts return
;
scroll_buf_pos
sta scroll_temp save number of lines to move buffer
jsr buf_to_cursor position buffer at cursor
lda scroll_temp a <= number of lines to move buffer
beq 80$ if non zero
bmi 20$ if > 0
10$ jsr buf_eol do move to end of line
jsr buf_advance move to start of next
dec scroll_temp temp--
bne 10$ until temp == 0
rts return
;
20$ jsr buf_sol do move to start of line
jsr buf_back back up to end of previous line
inc scroll_temp temp ++
bne 20$ until temp == 0
80$ jmp buf_sol move to start of line & return
;
;
scroll_up
ldx nlines
ldy max_col
clc
jsr plot
jsr primm
.byte escape,"B",escape,"V",home,home,0
rts
;
scroll_down
ldx nlines
ldy max_col
clc
jsr plot
jsr primm
.byte escape,"B",escape,"W",home,home,0
rts
;
;
;
; refresh_line_group
;
; refreshes lines .a through .x where 0 <= x,a <= nlines
;
zpage refresh_min_line min line number to refresh
zpage refresh_max_line max line to refresh
zpage refresh_cur_line current line being refreshed
;
;
refresh_display
lda #0
ldx nlines
jmp refresh_line_group
;
;
refresh_cursor_line
lda cur_line
ldx #0
;
refresh_line_group
sta refresh_min_line save lines to refresh
stx refresh_max_line
jsr buf_to_cursor position buffer on cursor line
lda cur_line
sta refresh_cur_line
;
10$ lda refresh_cur_line while cur_line <> min_line
cmp refresh_min_line
beq 30$
bcc 20$ if cur_line > min_line
;
dec refresh_cur_line dec cur_line
jsr buf_sol back up buffer to match
jsr buf_back
jmp 10$ else
;
20$ inc refresh_cur_line inc cur_line
jsr buf_eol advance buffer to match
jsr buf_advance
jmp 10$
;
30$ jsr buf_sol position buffer at start of this line
;
40$ jsr buf_char do if no more chars in buffer
bcs 100$ goto special handler
lda refresh_cur_line refresh cur_line
jsr plot_line
jsr buf_advance point to next line in buffer
inc refresh_cur_line cur_line ++
lda refresh_max_line while cur_line =< max_line
cmp refresh_cur_line
bcs 40$
cmp nlines if at end of display
beq 80$
jsr buf_char orif not at end of buffer
bcs 100$
80$ rts return happy
;
100$ lda refresh_cur_line print [EOF] on this line & clear to EOL
jsr set_line
jsr primm
.byte "[EOF]",27,"Q",0
110$ lda refresh_cur_line do if have done last line
cmp nlines
bcc 120$
clc return happy
rts
120$ inc refresh_cur_line point to next line
lda refresh_cur_line blank it
jsr set_line
jsr clear_to_eol
jmp 110$ loop
;
;
; Plot line routine
;
plot_line
jsr set_line ; position display cursor at start of this line
lda #0 ; set up display_shift
sta col_count
;
lda dot_flag ;if no dots
beq 5$ go kill rvs mode
jsr set_cut_start_stop set up the cut pointers
ldax buf_pos if after start and before end
cmpx cut_start_pos
bcc 5$
cmpx cut_end_pos
bcs 5$
lda #rvs_on turn rvs mode on
.byte $2c
5$ lda #rvs_off
jsr print
;
;
10$ ldx dot_flag do if dots enabled
beq 40$
cmpdr cut_start_pos,buf_pos,a if at start of marked area
bne 30$
lda #rvs_on turn rvs_on
jsr print
30$ cmpdr cut_end_pos,buf_pos,a if at end of marked area
bne 40$
lda #rvs_off turn rvs_off
jsr print
;
;
40$ jsr buf_advance_fast advance a char ( returns w/ in .a )
bcs 80$ if error
; go clear to eol & return
cmp #cr if went past a <cr>
beq 70$ go back,clear to eol & return
;
50$ jsr plot_char plot the char
jmp 10$ endo forever
;
70$ jsr buf_back_fast
;
80$ jmp clear_to_eol blank rest of line and return
;
;
; ***************** PETSCII MODE *********************
; charecter keyboard map type print format
;---------------------------------------------------------------------------
;$00-1F 0-31 control normal petscii ( control ) control exp
;$20-3F 32-63 numerics & punc " ( text ) numerics
;$40-5F 64-95 lower_case " ( text ) lower case
;$60-7F 96-127 NEVER RXED FROM KYBD ( inv text ) inv upper case
;$80-9F 128-159 more control normal ( control ) control exp
;$A0-BF 160-191 pet graphics normal ( text ) pet graphics
;$C0-DF 192-223 upper case text normal ( text ) upper case
;$E0-FF 224-225 KEYPAD KEYS ( SPECIAL ) ( control ) inv pet graphics
;
; **************** ASCII MODE ************************
; charecter keyboard map type print format
;---------------------------------------------------------------------------
; printed as
;$00-1F 0-31 control normal petscii ( control ) control exp
;$20-3F 32-63 numerics & punc " ( text ) numerics
;$40-5F 64-95 upper_case " ( text ) upper case
;$60-7F 96-127 lower case ( text ) lower case
;$80-9F 128-159 more control normal ( control ) control exp
;$A0-BF 160-191 NEVER RXD FROM KYBD ( inv text ) inv numerics
;$C0-DF 192-223 NEVER RXD FROM KYBD ( inv text ) inv upper case
;$E0-FF 224-225 KEYPAD KEYS ( SPECIAL ) ( control ) inv lower case
;
; the keyboard remmapping is accomplished in the GET_KEY routine
; the display codes remapping in accomplished in the PLOT_CHAR routine.
;
;
;commands:
; ascii enter ascii mode ( display and kybd only )
; petscii enter petscii mode ( display and kybd only )
; ptoa filter text from petscii to ascii ( marked area )
; atop filter text from ascii to petscii ( marked area )
; asc_mask mask ascii text high order bit ( marked area )
;
;
;
;*****************************************************************************
; PLOT A CHAR
;*****************************************************************************
; character petscii print format ascii print format
;---------------------------------------------------------------------------
;$00-1F 0-31 control exp (excpt cr&tab) control exp (excpt cr&tab)
;$20-3F 32-63 text text
;$40-5F 64-95 text case change text
;$60-7F 96-127 inverse text case change text
;
;$80-9F 128-159 control exp inverse control exp
;$A0-BF 160-191 text inverse text
;$C0-DF 192-223 text inverse case change text
;$E0-FF 224-225 inverse text inverse case change text
;
zpage plot_temp
;
plot_char
cmp #tab if tab char
beq plot_tab go plot as such
bit plot_mode if ascii_mode
bmi plot_asc go plot as ascii
;
cmp #$20 if < 20
bcc plot_ctl go plot as control expansion
cmp #$60 if < 60
bcc plot_char_8 go plot normally
cmp #$80 if < 80
bcc 70$ go plot mode inverse
cmp #$a0 if < a0
bcc plot_ctl go plot as control
cmp #$e0 if < e0
bcc plot_char_8 go plot as normal text
;
70$ pha save char
jsr rvs_tog toggle rvs_mode
pla recall char
jsr plot_char_8 plot char
php save status
jsr rvs_tog restore reverse mode
plp recall status
rts
;
plot_asc ; plot char as ascii
cmp #tab if tab
beq plot_tab go plot tab
and #$ff if char > 128
bpl 10$
pha save char
jsr rvs_tog toggle reverse mode
pla recall char
jsr 10$ plot as ascii
php save status
jsr rvs_tog restore reverse mode
plp recall status
rts
;
10$ and #$7f mask to 7 bits
cmp #$20 if control
bcc plot_ctl plot expansion
cmp #$40 if $40-$7f
bcc 20$
jsr change_case_of_char
20$ jmp plot_char_8 actually plot the char
;
;
plot_ctl ; plot char as control expansion
sta plot_temp plot_temp <= char
lda #'<
jsr plot_char_8 plot a '<'
;
lda plot_temp plot hex value for high order nybble
lsr a
lsr a
lsr a
lsr a
jsr plot_char_hex
lda plot_temp plot hex for low order nybble
jsr plot_char_hex
lda #'> plot a '>'
jmp plot_char_8
;
plot_tab ; plot a tab char
lda col_count plot_temp <= #spaces to print
and #$07
eor #$07
sta plot_temp
lda #space do plot a space
10$ jsr plot_char_8
dec plot_temp until all spaces ploted
bpl 10$
rts return
;
plot_char_hex ; plot low order nybble as a hex digit
and #$0f mask high order bits
ora #$30 make digit
cmp #$3a if > '9'
bcc plot_char_8
adc #$06 advance to letters
;
plot_char_8 ; really and for true plot the char ( if on screen )
tax save .a
sec .a <= current coloumn - offset
lda col_count
sbc col_offset
bcc 20$ if positive
;
cmp max_col if a >= width of screen
bcc 10$
bne 90$ if a == width of screen
ldx #191 plot a continuation char
jsr 10$
90$ sec return c=1
rts
;
10$ txa recall a
jsr print print it finally
20$ inc col_count increment the display coloumn
clc
rts return c=0
;
rvs_tog lda rvs if the kernal not in reverse mode
bne 10$
lda #rvs_on turn rvs mode on
.byte $2c else
10$ lda #rvs_off turn rvs mode off
jmp print & return
;
;

54
EDT_C128/print.src

@ -0,0 +1,54 @@
;
print jsr clrchn
jsr parse ; parse the filename ( we'll ignore the name )
bcs 90$
lda #0 ; set up kernal for no name
jsr setnam
lda #printer_lfn set up lfs etc. using users device
ldy #0
ldx list_device ; ( puke if device is not 4 or 5 )
cpx #4
beq 10$
cpx #5
beq 10$
lda #error_numeric_value_illegal
sec
rts
;
10$ jsr setlfs
;
jsr open ; attempt the open
bcc 90$ ; puke if error
;
ldx #print_lfn ; attach the printer..
jsr ckout
bcc 90$
;
; save current buffer position
; ; point to start of buffer
jsr start of file
;
20$ jsr forward while can get a byte
bcs 80$
jsr bsout do print the byte
jsr stop if stop key
bne 20$
jsr 80$ close the file
lda #error_stop return stop key error
sec
rts
;
80$ jsr clrchn
ldx #print_lfn ; close the file
jsr close
jsr clrchn
clc ; return happy
rts
;
90$ jsr 80$ ; close the file
lda #error_device_not_present
sec ; return error
rts
;

63
EDT_C128/scroll.src

@ -0,0 +1,63 @@
;
;
;num lines
;
;
scroll_up_a
pha save number of lines to scroll
sta scroll_temp scroll_temp <= number of lines past
lda nlines cursor where the first unshown line is.
sec
sbc scroll_temp
sbc cur_line
sta scroll_temp
jsr buf_to_cursor position buffer at cursor
10$ jsr buf_eol do move to stat of next line
jsr buf_advance
dec scroll_temp dec temp
bne 10$ while temp <> 0
;
pla recall number of lines to scroll
sta scroll_temp
20$ jsr scroll_up do move the display down a line
lda nlines plot a line
jsr plot_line
jsr buf_advance move to start of next line
dec scroll_temp dec temp
bne 20$ until temp = 0
;
rts return
;
;
;
;
;
scroll_down_a
pha save number of lines to scroll
sta scroll_temp scroll_temp <= number of lines before cursor
lda cur_line to first not yet shown line.
sec
sbc scroll_temp
sta scroll_temp
;
jsr buf_to_cursor position buffer at cursor
10$ jsr buf_sol do move to next line
jsr buf_back
dec scroll_temp dec temp
bne 10$ while temp <> 0
;
pla recall number of lines to scroll
sta scroll_temp
20$ jsr scroll_down do scroll the display one line
jsr buf_sol move to start of this line
lda #0 plot a line
jsr plot_line
jsr buf_sol move to previous line
jsr buf_back
dec scroll_temp dec temp
bne 20$ until temp = 0
;
rts return
;
;
;

97
EDT_C128/validate.src

@ -0,0 +1,97 @@
.subttl validate routine
;
;
; validate:
; the purpose of this routines is too attempt to keep the
; cursor within the middle lines of the screen.
; I.E. moveing up and down operations result in the
; cursor being placed on the top or bottom lines of the screen.
; this function detects when the cursor is near the edge of
; a window, and examines the text buffer to see if a more
; optimal location can be selected.
;
;
; validate works a follows:
; copy cursor line to temp location.
; modify temp location based on various rules for cursor placement
; compare temp tto cursor line
; if different
; cursor lione <= temp
; force new_screen
;
ram val_temp,1
;
validate
lda cur_line a <= cur_line
bpl 10$ if .a < 0
lda #0 .a <= 0
;
10$ sta val_temp val_temp <= .a
;
sec .a <= max desired line
lda nlines
sbc hyster_lines
;
cmp val_temp if .a < val_temp
bcs 20$
;
ldax cr_count_post .a <= mim(hyster_lines,cr_count_post)
jsr 100$
;
eor #$ff .a <= nlines - .a
sec
adc nlines
;
cmp val_temp if .a < val_temp
bcs 20$
sta val_temp val_temp <= .a
;
20$ lda val_temp if val_temp < hyster_lines
cmp hyster_lines
bcs 50$
ldax cr_count_pre .a <= min(hyster_lines,cr_count_pre)
jsr 100$
cmp val_temp if .a > val_temp
bcc 50$
beq 50$
;
sta val_temp val_temp <= .a
;
50$ lda cr_count_post+1
; if < 255 lines after cursor
bne 70$
sec
lda nlines a <= nlines - number of crs behind us
sbc cr_count_post
bcc 70$ if .a > 0
;
cmp val_temp if .a > val_temp
bcc 70$
beq 70$
sta val_temp select a new cursor line
;
; if cr_count_pre < val_temp
70$ ldx cr_count_pre+1
bne 80$
lda cr_count_pre
cmp val_temp
bcs 80$
sta val_temp val_temp <= cr_count_pre
;
80$ lda val_temp if val_temp <> cur_line
cmp cur_line
beq 88$
sta cur_line cur_line <= val_temp
inc new_screen force a new_screen
88$ clc return happy
rts
;
;
100$ cpx #0 .a <= min( hyster_lines, (x,a) )
bne 110$
cmp hyster_lines
bcc 120$
110$ lda hyster_lines
120$ rts
;

5
README.md

@ -154,6 +154,7 @@ Using [kernalemu](https://github.com/mist64/kernalemu) and [cbm6502asm](https://
| [HCD65_3.5](HCD65_3.5) | 1986 | BSO-compatible rewrite |
| [HCD65_65CE02_0.1](HCD65_65CE02_0.1) | 1988 | 65CE02/4510 opcode support |
| [HCD65_65CE02_0.2](HCD65_65CE02_0.2) | 1990 | update |
| [EDT_C128](EDT_C128) | 1986 | |
| [LOADER_PET](LOADER_PET) | 1979 | OBJ Loader |
| [LOADER_C64](LOADER_C64) | 1986 | OBJ Loader |
@ -492,6 +493,10 @@ The PET OBJ Loader, version V121379. Extracted from [ted_kernal_basic_src.tar.gz
The OBJ Loader of the C64 Macro Assembler, version V072882. Extracted from [c64_kernal_bas_src.tar.gz](http://www.zimmers.net/anonftp/pub/cbm/src/c64/c64_kernal_bas_src.tar.gz) and converted to uppercase and LST-style indenting.
### EDT_C128
The editor for the HCD65 assembler for the C128 (1986). Source: [c128_dev_pack.tar.gz](http://www.zimmers.net/anonftp/pub/cbm/src/c128/index.html)
### MONITOR_KIM
The KIM-1 "monitor" ROM (1975), i.e. 6530-002 and 6530-003. From the [Hans Otten reconstructed source from the KIM-1 users manual](http://retro.hansotten.nl/uploads/6502docs/usrman.htm).

1
build.sh

@ -186,3 +186,4 @@ build1 FIG FOR1-1
# build2 HCD65_65CE02 c65
# build2 HCD65_65CE02_0.1 c65
# build2 HCD65_65CE02_0.2 c65
# build2 EDT_C128 edt

Loading…
Cancel
Save