Fixed up shift demo and cbmiolib.c65
This commit is contained in:
parent
5f25d66aeb
commit
033767fb91
2 changed files with 37 additions and 37 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#INCLUDE <c64start.c65>
|
#INCLUDE <c64start.c65>
|
||||||
#INCLUDE <c64defs.c65>
|
#INCLUDE <c64defs.c65>
|
||||||
|
#PRAGMA _P_REMOVE_UNUSED 1
|
||||||
#INCLUDE <cbmiolib.c65>
|
#INCLUDE <cbmiolib.c65>
|
||||||
|
|
||||||
#PRAGMA _P_USE_CBM_STRINGS 1
|
#PRAGMA _P_USE_CBM_STRINGS 1
|
||||||
|
|
|
||||||
|
|
@ -17,31 +17,29 @@
|
||||||
|
|
||||||
GOTO lib_cbmio_skip
|
GOTO lib_cbmio_skip
|
||||||
|
|
||||||
WORD lib_cbmio_to_txtptr
|
FUNC lib_cbmio_print ( {WORD strptr} )
|
||||||
FUNC lib_cbmio_print ( lib_cbmio_to_txtptr )
|
|
||||||
//On c64 we "borrow" the undocumented "print zero-terminated string" routine
|
//On c64 we "borrow" the undocumented "print zero-terminated string" routine
|
||||||
#IFDEF MACHINE_C64
|
#IFDEF MACHINE_C64
|
||||||
ASM
|
ASM
|
||||||
lda lib_cbmio_to_txtptr
|
lda |strptr|
|
||||||
ldy lib_cbmio_to_txtptr+1
|
ldy |strptr|+1
|
||||||
jsr $ab1e ; strout kernal routine
|
jsr $ab1e ; strout kernal routine
|
||||||
ENDASM
|
ENDASM
|
||||||
#IFEND
|
#IFEND
|
||||||
#IFNDEF MACHINE_C64
|
#IFNDEF MACHINE_C64
|
||||||
BYTE lib_cbmio_to_char
|
BYTE ch
|
||||||
PEEK lib_cbmio_to_txtptr -> lib_cbmio_to_char
|
ch = PEEK strptr
|
||||||
WHILE lib_cbmio_to_char
|
WHILE ch
|
||||||
GOSUB $ffd2 PASSING lib_cbmio_to_char AS ACC
|
GOSUB $ffd2 PASSING ch AS ACC
|
||||||
INC lib_cbmio_to_txtptr
|
strptr++
|
||||||
PEEK lib_cbmio_to_txtptr -> lib_cbmio_to_char
|
ch = PEEK strptr
|
||||||
WEND
|
WEND
|
||||||
#IFEND
|
#IFEND
|
||||||
FEND
|
FEND
|
||||||
|
|
||||||
WORD lib_cbmio_tl_txtptr
|
FUNC lib_cbmio_printlf ( {WORD strptr} )
|
||||||
FUNC lib_cbmio_printlf ( lib_cbmio_tl_txtptr )
|
|
||||||
|
|
||||||
CALL lib_cbmio_print ( lib_cbmio_tl_txtptr )
|
CALL lib_cbmio_print ( strptr )
|
||||||
CALL lib_cbmio_print ( @lib_cbmio_tl_linefeed )
|
CALL lib_cbmio_print ( @lib_cbmio_tl_linefeed )
|
||||||
|
|
||||||
FEND
|
FEND
|
||||||
|
|
@ -77,18 +75,17 @@ lib_cbmio_text_nullstr
|
||||||
ENDASM
|
ENDASM
|
||||||
|
|
||||||
|
|
||||||
BYTE lib_cbmio_hb_value
|
FUNC lib_cbmio_hexoutb ( {BYTE value} )
|
||||||
FUNC lib_cbmio_hexoutb ( lib_cbmio_hb_value )
|
|
||||||
ASM
|
ASM
|
||||||
;ldy #0
|
;ldy #0
|
||||||
;lda (lib_cbmio_ho_varaddress),y
|
;lda (lib_cbmio_ho_varaddress),y
|
||||||
lda lib_cbmio_hb_value
|
lda |value|
|
||||||
and #$0f
|
and #$0f
|
||||||
tax
|
tax
|
||||||
lda lib_cbmio_ho_hexdigits,x
|
lda lib_cbmio_ho_hexdigits,x
|
||||||
sta lib_cbmio_ho_hextxt+1
|
sta lib_cbmio_ho_hextxt+1
|
||||||
;lda (lib_cbmio_ho_varaddress),y
|
;lda (lib_cbmio_ho_varaddress),y
|
||||||
lda lib_cbmio_hb_value
|
lda |value|
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
|
|
@ -101,33 +98,35 @@ FUNC lib_cbmio_hexoutb ( lib_cbmio_hb_value )
|
||||||
|
|
||||||
FEND
|
FEND
|
||||||
|
|
||||||
WORD lib_cbmio_lib_cbmio_ho_value
|
FUNC lib_cbmio_hexoutw ( {WORD value} )
|
||||||
FUNC lib_cbmio_hexoutw ( lib_cbmio_lib_cbmio_ho_value )
|
BYTE high
|
||||||
ASM
|
BYTE low
|
||||||
lda lib_cbmio_lib_cbmio_ho_value+1
|
|
||||||
sta lib_cbmio_hb_value
|
// Extract high byte (shift right 8 bits)
|
||||||
jsr lib_cbmio_hexoutb
|
high = value >> 8
|
||||||
lda lib_cbmio_lib_cbmio_ho_value
|
|
||||||
sta lib_cbmio_hb_value
|
// Extract low byte (direct assignment takes low byte)
|
||||||
jsr lib_cbmio_hexoutb
|
low = value
|
||||||
ENDASM
|
|
||||||
|
// Print high byte then low byte (big-endian order)
|
||||||
|
CALL lib_cbmio_hexoutb ( high )
|
||||||
|
CALL lib_cbmio_hexoutb ( low )
|
||||||
FEND
|
FEND
|
||||||
|
|
||||||
WORD lib_cbmio_i_ptr
|
FUNC lib_cbmio_input ( {WORD strptr} )
|
||||||
FUNC lib_cbmio_input ( lib_cbmio_i_ptr )
|
BYTE ch
|
||||||
BYTE char
|
|
||||||
|
|
||||||
LET char = 0
|
ch = 0
|
||||||
WHILE char <> 13
|
WHILE ch <> 13
|
||||||
ASM
|
ASM
|
||||||
jsr $ffcf
|
jsr $ffcf
|
||||||
sta |char|
|
sta |ch|
|
||||||
ENDASM
|
ENDASM
|
||||||
POKE lib_cbmio_i_ptr WITH char
|
POKE strptr , ch
|
||||||
INC lib_cbmio_i_ptr
|
strptr++
|
||||||
WEND
|
WEND
|
||||||
DEC lib_cbmio_i_ptr //replace ending #13 with #0
|
strptr-- //replace ending #13 with #0
|
||||||
POKE lib_cbmio_i_ptr WITH 0
|
POKE strptr , 0
|
||||||
FEND
|
FEND
|
||||||
|
|
||||||
ASM
|
ASM
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue