diff --git a/CREDITS.md b/CREDITS.md index a514a658..e2790ddd 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -9,6 +9,7 @@ * enthusi/Onslaught - for his example Turbo Tape 64 compatible loader * djmips - for fast 8x8 multiplication routine * Verz - for the integer division routine +* Mike Barry - for his PRIMM implementation ## for documentation diff --git a/STATUS.md b/STATUS.md index ba005490..a8e6603a 100644 --- a/STATUS.md +++ b/STATUS.md @@ -397,3 +397,16 @@ Not all of them - only these we want to have implemented. | `$FF80` | revision byte | DONE | |
+ +### API extensions - MEGA65 build + +Not all of them - only these we want to have implemented. Note: this is likely to change in the future! + +
+ +| Address | Name | Status | Remarks | +| :-------: | :------- | :------: | :--------------------------------------------------------------------: | +| `$FF7D` | PRIMM | DONE | print immediate, address compatible with C128 and C65 ROMs | +| `$FFF8` | | DONE | reset vector for usage within hypervisor, starts in legacy mode | + +
diff --git a/src/aliases/,aliases_ram_lowmem.s b/src/aliases/,aliases_ram_lowmem.s index 151c261a..e9491bc4 100644 --- a/src/aliases/,aliases_ram_lowmem.s +++ b/src/aliases/,aliases_ram_lowmem.s @@ -100,8 +100,8 @@ !addr COLSTORE = $9C ; [!] screen border storage for tape routines } !addr MSGFLG = $9D ; bit 6 = error messages, bit 7 = control message - !addr PTR1 = $9E ; for tape support, counter of errorneous bytes - !addr PTR2 = $9F ; for tape support, counter for errorneous bytes correction + !addr PTR1 = $9E ; for tape support, counter of errorneous bytes [!] also used by PRIMM + !addr PTR2 = $9F ; for tape support, counter for errorneous bytes correction [!] also used by PRIMM !addr TIME = $A0 ; $A0-$A2 jiffy clock !addr IECPROTO = $A3 ; [!] IEC or pseudo-IEC protocol, >= $80 for unknown; originally named TSFCNT !addr TBTCNT = $A4 ; temporary variable for tape and IEC, [!] our usage probably differs in details diff --git a/src/basic/,imports.s b/src/basic/,imports.s index fa3bb638..1024c047 100644 --- a/src/basic/,imports.s +++ b/src/basic/,imports.s @@ -18,6 +18,7 @@ ;; #ALIAS# clear_screen = KERNAL_0.clear_screen ;; #ALIAS# printf = KERNAL_0.printf +;; #ALIAS# PRIMM = KERNAL_0.PRIMM ;; #ALIAS# plot_set = KERNAL_0.plot_set ;; #ALIAS# print_hex_byte = KERNAL_0.print_hex_byte diff --git a/src/kernal/jumptable_m65/ff7d.jprimm.s b/src/kernal/jumptable_m65/ff7d.jprimm.s new file mode 100644 index 00000000..082aee5d --- /dev/null +++ b/src/kernal/jumptable_m65/ff7d.jprimm.s @@ -0,0 +1,11 @@ +;; #LAYOUT# M65 KERNAL_0 #TAKE +;; #LAYOUT# * * #IGNORE + + +; 'Print immediate' - useful debug routine, present on many CBM machines +; see https://www.pagetable.com/?p=926 + + +JPRIMM: + + jmp PRIMM diff --git a/src/kernal/print/primm.s b/src/kernal/print/primm.s new file mode 100644 index 00000000..00df50ea --- /dev/null +++ b/src/kernal/print/primm.s @@ -0,0 +1,31 @@ +;; #LAYOUT# M65 KERNAL_0 #TAKE +;; #LAYOUT# * * #IGNORE + + +; 'Print immediate', original implementation by Mike Barry, adapted to 65CE02 +; see http://www.6502.org/source/io/primm.htm + + +PRIMM: + + pla ; get low part of (string address-1) + sta PTR1 + pla ; get high part of (string address-1) + sta PTR2 + +bra @2 +@1: + jsr JCHROUT ; output a string char +@2: + inc PTR1 ; advance the string pointer + bne @3 + inc PTR2 +@3: + ldy #$00 + lda (PTR1), y ; get string char + bne @1 ; output and continue if not NUL + lda PTR2 + pha + lda PTR1 + pha + + rts