jump table now uses vectors in RAM

This commit is contained in:
FeralChild64 committed 2019-08-05 18:08:15 +02:00
1 parent fb9caa7602
commit d5d6581901
32 files changed
+60 -140

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ print_string_loop:
lda (temp_string_ptr),y lda (temp_string_ptr),y
beq print_string_end beq print_string_end
jsr via_IBSOUT jsr JCHROUT
txa txa
tay tay
+1 -1
View File
@@ -29,7 +29,7 @@ startup_banner:
jsr print_integer jsr print_integer
lda #$20 lda #$20
jsr via_IBSOUT jsr JCHROUT
;; Print the rest of the start up message ;; Print the rest of the start up message
ldx #34 ldx #34
+5 -5
View File
@@ -7,9 +7,9 @@ basic_do_error:
;; Print ? at start ;; Print ? at start
lda #$0d lda #$0d
jsr via_IBSOUT jsr JCHROUT
lda #$3f lda #$3f
jsr via_IBSOUT jsr JCHROUT
;; Print main part of error message ;; Print main part of error message
pla pla
@@ -18,7 +18,7 @@ basic_do_error:
;; Print ERROR at end ;; Print ERROR at end
lda #$20 lda #$20
jsr via_IBSOUT jsr JCHROUT
ldx #33 ldx #33
jsr print_packed_message jsr print_packed_message
@@ -27,9 +27,9 @@ basic_do_error:
;; XXX print line number if not in direct mode ;; XXX print line number if not in direct mode
lda #$0d lda #$0d
jsr via_IBSOUT jsr JCHROUT
lda #$0d lda #$0d
jsr via_IBSOUT jsr JCHROUT
;; Reset stack, and go back to main loop ;; Reset stack, and go back to main loop
ldx #$fe ldx #$fe
+1 -1
View File
@@ -52,7 +52,7 @@ rsl_l1: lda $0200,x
* *
;; Do printing of the new line ;; Do printing of the new line
lda #$0d lda #$0d
jsr via_IBSOUT jsr JCHROUT
;; Ignore empty lines ;; Ignore empty lines
lda tokenise_work1 lda tokenise_work1
+1 -1
View File
@@ -17,7 +17,7 @@ basic_do_break:
* *
lda #$0d lda #$0d
jsr via_IBSOUT jsr JCHROUT
cmd_end: cmd_end:
jmp basic_main_loop jmp basic_main_loop
+4 -4
View File
@@ -42,7 +42,7 @@ list_single_line: ; entry point needed by DOS wedge
pla pla
jsr print_integer jsr print_integer
lda #$20 lda #$20
jsr via_IBSOUT jsr JCHROUT
;; Iterate through printing out the line ;; Iterate through printing out the line
;; contents ;; contents
@@ -111,16 +111,16 @@ list_not_rem:
bne list_print_loop bne list_print_loop
list_is_literal: list_is_literal:
jsr via_IBSOUT jsr JCHROUT
iny iny
bne list_print_loop bne list_print_loop
list_end_of_line: list_end_of_line:
;; Clear reverse flag ;; Clear reverse flag
lda #$92 lda #$92
jsr via_IBSOUT jsr JCHROUT
;; Print end of line ;; Print end of line
lda #$0d lda #$0d
jsr via_IBSOUT jsr JCHROUT
rts rts
+3 -2
View File
@@ -191,6 +191,7 @@ end_of_line_search:
pla pla
sta basic_current_line_ptr+0 sta basic_current_line_ptr+0
jmp basic_relink_loop jmp basic_relink_loop
via_ILOAD:
jmp (ILOAD)
+1 -1
View File
@@ -115,7 +115,7 @@ found_start_of_number:
;; Print digits ;; Print digits
* lda $0100,y * lda $0100,y
ora #$30 ora #$30
jsr via_IBSOUT jsr JCHROUT
iny iny
cpy #5 cpy #5
bne - bne -
+5 -5
View File
@@ -38,7 +38,7 @@ found_message_in_token_stream:
beq + beq +
jsr print_packed_word jsr print_packed_word
lda #$20 lda #$20
jsr via_IBSOUT jsr JCHROUT
pla pla
tay tay
iny iny
@@ -47,7 +47,7 @@ found_message_in_token_stream:
pla pla
;; Rub out space at the end ;; Rub out space at the end
lda #$14 lda #$14
jsr via_IBSOUT jsr JCHROUT
rts rts
print_packed_word: print_packed_word:
@@ -144,7 +144,7 @@ next_packed_word_char:
;; X=1-14 = first 14 chars, so subtract one ;; X=1-14 = first 14 chars, so subtract one
lda packed_message_chars-1,x lda packed_message_chars-1,x
jsr via_IBSOUT jsr JCHROUT
;; See if there is a char in the low nybl to print ;; See if there is a char in the low nybl to print
pla pla
@@ -171,7 +171,7 @@ has_nybl:
;; X=1-14 = first 14 chars, so subtract one ;; X=1-14 = first 14 chars, so subtract one
lda packed_message_chars-1,x lda packed_message_chars-1,x
jsr via_IBSOUT jsr JCHROUT
* *
pla pla
tay tay
@@ -207,7 +207,7 @@ unpack_literal_char:
tya tya
pha pha
lda (temp_string_ptr),y lda (temp_string_ptr),y
jsr via_IBSOUT jsr JCHROUT
pla pla
tay tay
rts rts
+3 -3
View File
@@ -112,7 +112,7 @@ not_hexword:
not_pointer: not_pointer:
;; Print character ;; Print character
jsr via_IBSOUT jsr JCHROUT
printf_nextchar: printf_nextchar:
jsr printf_advance jsr printf_advance
@@ -148,11 +148,11 @@ printf_printhexbyte:
cmp #$3A cmp #$3A
bcc + bcc +
adc #6 adc #6
* jsr via_IBSOUT * jsr JCHROUT
pla pla
and #$0f and #$0f
ora #$30 ora #$30
cmp #$3A cmp #$3A
bcc + bcc +
adc #6 adc #6
* jmp via_IBSOUT * jmp JCHROUT
-42
View File
@@ -1,42 +0,0 @@
;;
;; Helper routines for jumping via vectors, to be used with JSR
;;
;; Note: they are not in the order of low memory vectors, to avoid
;; similarity with the original ROMs
via_ISAVE:
jmp (ISAVE)
via_ILOAD:
jmp (ILOAD)
via_ICLOSE:
jmp (ICLOSE)
via_IOPEN:
jmp (IOPEN)
via_ICHKIN:
jmp (ICHKIN)
via_IBASIN:
jmp (IBASIN)
via_IGETIN:
jmp (IGETIN)
via_ICKOUT:
jmp (ICKOUT)
via_IBSOUT:
jmp (IBSOUT)
via_ICLRCH:
jmp (ICLRCH)
via_ICLALL:
jmp (ICLALL)
via_ISTOP:
jmp (ISTOP)
+15 -15
View File
@@ -4,7 +4,7 @@
wedge_dos: wedge_dos:
;; Close all the channels, so that wedge has full control ;; Close all the channels, so that wedge has full control
jsr via_ICLALL jsr JCLALL
;; Set file parameters, channel 15 is a typical one for commands ;; Set file parameters, channel 15 is a typical one for commands
jsr select_device ; sets X register jsr select_device ; sets X register
@@ -41,11 +41,11 @@ wedge_dos_command:
jsr wedge_dos_setnam jsr wedge_dos_setnam
jsr JSETNAM jsr JSETNAM
jsr via_IOPEN jsr JOPEN
bcs wedge_dos_basic_error bcs wedge_dos_basic_error
;; Retrieve status, print it if not OK ;; Retrieve status, print it if not OK
jsr via_ICLALL jsr JCLALL
jsr wedge_dos_status_get jsr wedge_dos_status_get
lda BUF+0 lda BUF+0
cmp #$30 ; '0' cmp #$30 ; '0'
@@ -82,12 +82,12 @@ wedge_dos_status_get:
;; Set remaining file parameters, open the channel ;; Set remaining file parameters, open the channel
lda #$00 ; empty file name lda #$00 ; empty file name
jsr JSETNAM jsr JSETNAM
jsr via_IOPEN jsr JOPEN
bcs wedge_dos_basic_error bcs wedge_dos_basic_error
;; Set channel for input ;; Set channel for input
ldx #$0F ldx #$0F
jsr via_ICHKIN jsr JCHKIN
bcs wedge_dos_basic_error bcs wedge_dos_basic_error
ldy #$00 ldy #$00
@@ -98,7 +98,7 @@ wedge_dos_status_get:
;; XXX error in case of status != EOF ;; XXX error in case of status != EOF
;; Print out everything retrieved from the drive ;; Print out everything retrieved from the drive
bne + bne +
jsr via_IBASIN jsr JCHRIN
bcs wedge_dos_basic_error bcs wedge_dos_basic_error
sta BUF, y sta BUF, y
iny iny
@@ -118,7 +118,7 @@ wedge_dos_status_print:
dey dey
bmi + bmi +
lda BUF, x lda BUF, x
jsr via_IBSOUT jsr JCHROUT
inx inx
bne - bne -
* *
@@ -139,18 +139,18 @@ wedge_dos_directory:
jsr wedge_dos_setnam jsr wedge_dos_setnam
;; Open the file ;; Open the file
jsr via_IOPEN jsr JOPEN
bcs wedge_dos_basic_error bcs wedge_dos_basic_error
;; Set channel for file reading ;; Set channel for file reading
ldx #$00 ldx #$00
jsr via_ICHKIN jsr JCHKIN
bcs wedge_dos_basic_error bcs wedge_dos_basic_error
;; Ignore start address (2 first bytes) - XXX check for errors ;; Ignore start address (2 first bytes) - XXX check for errors
jsr via_IBASIN jsr JCHRIN
bcs wedge_dos_basic_error bcs wedge_dos_basic_error
jsr via_IBASIN jsr JCHRIN
bcs wedge_dos_basic_error bcs wedge_dos_basic_error
wedge_dos_directory_line: wedge_dos_directory_line:
@@ -159,7 +159,7 @@ wedge_dos_directory_line:
ldy #$FF ldy #$FF
* *
iny iny
jsr via_IBASIN jsr JCHRIN
bcs wedge_dos_basic_error bcs wedge_dos_basic_error
sta BUF, y sta BUF, y
cpy #$50 cpy #$50
@@ -199,15 +199,15 @@ wedge_dos_directory_display:
;; FALLTROUGH ;; FALLTROUGH
wedge_dos_clean_exit: wedge_dos_clean_exit:
jsr via_ICLALL jsr JCLALL
;; Print new line ;; Print new line
lda #$0D lda #$0D
jsr via_IBSOUT jsr JCHROUT
jmp basic_end_of_line jmp basic_end_of_line
wedge_dos_basic_error: wedge_dos_basic_error:
pha pha
jsr via_ICLALL jsr JCLALL
pla pla
tax tax
dex dex
+2 -1
View File
@@ -1,3 +1,4 @@
; open a logical file ; open a logical file
; C64 Programmer's Reference Guide Page 272 ; C64 Programmer's Reference Guide Page 272
jmp open ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (IOPEN)
+2 -1
View File
@@ -1,3 +1,4 @@
; close a specified logical file ; close a specified logical file
; C64 Programmer's Reference Guide Page 272 ; C64 Programmer's Reference Guide Page 272
jmp close ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICLOSE)
+2 -1
View File
@@ -1,3 +1,4 @@
; Open channel for input ; Open channel for input
; C64 Programmer's Reference Guide Page 272 ; C64 Programmer's Reference Guide Page 272
jmp chkin ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICHKIN)
+2 -1
View File
@@ -1,3 +1,4 @@
; Open channel for output ; Open channel for output
; C64 Programmer's Reference Guide Page 272 ; C64 Programmer's Reference Guide Page 272
jmp ckout ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICKOUT)
+2 -1
View File
@@ -1,3 +1,4 @@
; close input and output channels ; close input and output channels
; C64 Programmer's Reference Guide Page 272 ; C64 Programmer's Reference Guide Page 272
jmp clrchn ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICLRCH)
+2 -1
View File
@@ -1,3 +1,4 @@
; Input character from channel ; Input character from channel
; C64 Programmer's Reference Guide Page 272 ; C64 Programmer's Reference Guide Page 272
jmp chrin ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (IBASIN)
+2 -1
View File
@@ -1,3 +1,4 @@
; Output character to channel ; Output character to channel
; C64 Programmer's Reference Guide Page 272 ; C64 Programmer's Reference Guide Page 272
jmp chrout ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (IBSOUT)
+2 -1
View File
@@ -1,3 +1,4 @@
; Scan stop key ; Scan stop key
; C64 Programmer's Reference Guide Page 273 ; C64 Programmer's Reference Guide Page 273
jmp stop ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ISTOP)
+2 -1
View File
@@ -1,3 +1,4 @@
; Get character from keyboard queue (keyboard buffer) ; Get character from keyboard queue (keyboard buffer)
; C64 Programmer's Reference Guide Page 272 ; C64 Programmer's Reference Guide Page 272
jmp getin ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (IGETIN)
+2 -1
View File
@@ -1,3 +1,4 @@
; $FFE7 - Close all files vector ; $FFE7 - Close all files vector
; (http://codebase64.org/doku.php?id=base:kernalreference) ; (http://codebase64.org/doku.php?id=base:kernalreference)
jmp clall ; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect
jmp (ICLALL)
-21
View File
@@ -65,24 +65,3 @@ vector_restore:
rts rts
.scend .scend
;; XXX below we have quite a lot of data... should we decouple them?
vector_defaults:
.word default_irq_handler ;; CINV
.word $0000 ;; CBINV XXX implement this
.word $0000 ;; NMINV XXX implement this
.word open ;; IOPEN
.word close ;; ICLOSE
.word chkin ;; ICHKIN
.word ckout ;; ICKOUT
.word clrchn ;; ICLRCH
.word chrin ;; IBASIN
.word chrout ;; IBSOUT
.word stop ;; ISTOP
.word getin ;; IGETIN
.word clall ;; ICLALL
.word $0000 ;; USRCMD XXX implement this
.word load ;; ILOAD
.word save ;; ISAVE
-3
View File
@@ -1,3 +0,0 @@
$03 (most likely adddress higher byte) + JMP ($031C) (via public, documented vector) + JMP (address does not match)
Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way.
-3
View File
@@ -1,3 +0,0 @@
$03 (most likely adddress higher byte) + JMP ($031E) (via public, documented vector) + JMP (address does not match)
Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way.
-3
View File
@@ -1,3 +0,0 @@
$03 (most likely adddress higher byte) + JMP ($0320) (via public, documented vector) + JMP (address does not match)
Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way.
-3
View File
@@ -1,3 +0,0 @@
$03 (most likely adddress higher byte) + JMP ($0322) (via public, documented vector) + JMP (address does not match)
Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way.
-3
View File
@@ -1,3 +0,0 @@
03 (most likely adddress higher byte) + JMP ($0324) (via public, documented vector) + JMP (address does not match)
Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way.
-3
View File
@@ -1,3 +0,0 @@
$03 (most likely adddress higher byte) + JMP ($0326) (via public, documented vector)
Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way.
-4
View File
@@ -1,4 +0,0 @@
$03 (most likely adddress higher byte) + JMP ($032A) (via public, documented vector) + JMP (address does not match)
Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way.
-3
View File
@@ -1,3 +0,0 @@
$03 (most likely adddress higher byte) + JMP ($032C) (via public, documented vector)
Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way.
-3
View File
@@ -1,3 +0,0 @@
JMP ($031A) (via public, documented vector) + JMP (address does not match)
Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way.