mirror of
https://github.com/RevCurtisP/C02.git
synced 2025-02-21 03:29:25 +00:00
Minor changes to include/ .a02 files
This commit is contained in:
parent
5289bb8717
commit
976dd4cf44
@ -42,12 +42,12 @@ ISFLS: LDA #$00 ; Return FALSE
|
|||||||
RTS
|
RTS
|
||||||
|
|
||||||
;C02/ML Character Conversion Routines
|
;C02/ML Character Conversion Routines
|
||||||
tolowr: JSR ISUPR ;If Char IS Not Upper Case
|
TOLOWR: JSR ISUPR ;If Char IS Not Upper Case
|
||||||
BCC ISRTS ; Return
|
BCC ISRTS ; Return
|
||||||
ORA #$20 ;Else Set Bit 5
|
ORA #$20 ;Else Set Bit 5
|
||||||
RTS ; and Return
|
RTS ; and Return
|
||||||
|
|
||||||
touppr: JSR ISLWR ;If Char IS Not Lower Case
|
TOUPPR: JSR ISLWR ;If Char IS Not Lower Case
|
||||||
BCC ISRTS ; Return
|
BCC ISRTS ; Return
|
||||||
AND #$DF ;Else Clear Bit 5
|
AND #$DF ;Else Clear Bit 5
|
||||||
RTS ; and Return
|
RTS ; and Return
|
||||||
|
@ -22,7 +22,6 @@ PTRRTN: LDY (1,X) ;Load Pointer MSB into Y
|
|||||||
LDA TEMP0 ;Load Pointer Addres into A
|
LDA TEMP0 ;Load Pointer Addres into A
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
|
||||||
;ptrset(ptr, &addr) - Store Address in Pointer
|
;ptrset(ptr, &addr) - Store Address in Pointer
|
||||||
;Args: A = Zero Page Pointer Address
|
;Args: A = Zero Page Pointer Address
|
||||||
; X,Y = Address to Store
|
; X,Y = Address to Store
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
;Uses: System Dependent
|
;Uses: System Dependent
|
||||||
;Affects: System Dependent
|
;Affects: System Dependent
|
||||||
;Returns: A = Character Code of Key
|
;Returns: A = Character Code of Key
|
||||||
GETC EQU GETCHR ;Alias to external GETCHRroutine
|
GETC EQU GETCHR ;Alias to external GETCHR Routine
|
||||||
|
|
||||||
;void putc(c) - PUT Character to screen
|
;void putc(c) - PUT Character to screen
|
||||||
;Args: Character code to display
|
;Args: Character code to display
|
||||||
@ -16,15 +16,17 @@ GETC EQU GETCHR ;Alias to external GETCHRroutine
|
|||||||
;Uses: System Dependent
|
;Uses: System Dependent
|
||||||
;Affects: System Dependent
|
;Affects: System Dependent
|
||||||
;Returns: System Dependent
|
;Returns: System Dependent
|
||||||
PUTC EQU PUTCHR ;Alias to external PUTCHRRoutine
|
PUTC EQU PUTCHR ;Alias to external PUTCHR Routine
|
||||||
|
|
||||||
;char gets(&s) - GET String input from keyboard
|
;char gets(&s) - GET String input from keyboard
|
||||||
;Args: Y,X = Address of String
|
;Args: Y,X = Address of String
|
||||||
;Sets: SRCLO,SRCLHI = Address of String
|
;Sets: SRCLO,SRCLHI = Address of String
|
||||||
;Affects: N,Z,C
|
;Uses: TEMP3
|
||||||
|
;Affects: X,N,Z,C
|
||||||
;Returns: A,Y = Number of Characters in String
|
;Returns: A,Y = Number of Characters in String
|
||||||
GETS: JSR SETSRC ;Initialize Source String
|
GETS: JSR SETSRC ;Initialize Source String
|
||||||
GETSL: JSR GETC ;Get Keypress
|
GETSL: STY TEMP3 ;Save Y Index
|
||||||
|
JSR GETC ;Get Keypress
|
||||||
CMP #DELKEY ;If Delete
|
CMP #DELKEY ;If Delete
|
||||||
BNE GETSE ;Then
|
BNE GETSE ;Then
|
||||||
TYA ; If Offset is Zero
|
TYA ; If Offset is Zero
|
||||||
@ -39,10 +41,12 @@ GETSE: CMP #ESCKEY ;Else If Escape
|
|||||||
GETSC: CMP #RTNKEY ;Else If Not Carriage Return
|
GETSC: CMP #RTNKEY ;Else If Not Carriage Return
|
||||||
BEQ GETSX
|
BEQ GETSX
|
||||||
JSR PUTC ; Echo Character
|
JSR PUTC ; Echo Character
|
||||||
|
LDY TEMP3 ;Restore Y Index
|
||||||
STA (SRCLO),Y ; Store Character at offset
|
STA (SRCLO),Y ; Store Character at offset
|
||||||
INY ; increment offset and
|
INY ; increment offset and
|
||||||
BPL GETSL ; loop if less than 128
|
BPL GETSL ; loop if less than 128
|
||||||
GETSX: JSR NEWLIN ;Else Advance Cursor to Next Line
|
GETSX: JSR NEWLIN ;Else Advance Cursor to Next Line
|
||||||
|
LDY TEMP3 ;Restore Y Index
|
||||||
LDA #$00 ; Terminate String
|
LDA #$00 ; Terminate String
|
||||||
STA (SRCLO),Y ; and
|
STA (SRCLO),Y ; and
|
||||||
GETSY: TYA ; Return String Length
|
GETSY: TYA ; Return String Length
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
; C02 library stdlib.h02 assembly language subroutines
|
; C02 library stdlib.h02 assembly language subroutines
|
||||||
; Requires
|
; Requires
|
||||||
; external zero page locations SRCLO and srchi
|
; external zero page locations SRCLO and SRCHI
|
||||||
; and external locations RANDOM, RDSEED, TEMP0, TEMP1, and TEMP2.
|
; and external locations RANDOM, RDSEED, TEMP0, TEMP1, and TEMP2.
|
||||||
|
|
||||||
;abs(n) - Get ABSolute Value
|
;abs(n) - Get ABSolute Value
|
||||||
|
@ -29,16 +29,16 @@ STRCMR: RTS ;
|
|||||||
;Args: A = Character to look for
|
;Args: A = Character to look for
|
||||||
; X,Y = Pointer to string to search in
|
; X,Y = Pointer to string to search in
|
||||||
;Sets: SRCLO,SRCHI = Pointer to string
|
;Sets: SRCLO,SRCHI = Pointer to string
|
||||||
; TEMP0 = Character being searched for
|
; TEMP3 = Character being searched for
|
||||||
;Affects: N,Z
|
;Affects: N,Z
|
||||||
;Returns: A = Position in string, C=1 if found
|
;Returns: A = Position in string, C=1 if found
|
||||||
; A = $FF, C=0 if not found
|
; A = $FF, C=0 if not found
|
||||||
; Y = Position of last character scanned
|
; Y = Position of last character scanned
|
||||||
STRCHR: JSR SETSRC ;Initialize Source String
|
STRCHR: JSR SETSRC ;Initialize Source String
|
||||||
STRCHA: STA TEMP0; ;Save Search Character (alternate entry point)
|
STRCHA: STA TEMP3; ;Save Search Character (alternate entry point)
|
||||||
STRCHL: LDA (SRCLO),Y ;Get Next Character
|
STRCHL: LDA (SRCLO),Y ;Get Next Character
|
||||||
BEQ STRCLC ;If NUL, Return $FF and Carry Clear
|
BEQ STRCLC ;If NUL, Return $FF and Carry Clear
|
||||||
CMP TEMP0 ;Compare Character
|
CMP TEMP3 ;Compare Character
|
||||||
BEQ STRLEX ;If Found, Return Index
|
BEQ STRLEX ;If Found, Return Index
|
||||||
INY ;Increment Counter and Loop if < 128
|
INY ;Increment Counter and Loop if < 128
|
||||||
BPL STRCHL ;Else Return $FF and Carry Clear
|
BPL STRCHL ;Else Return $FF and Carry Clear
|
||||||
@ -71,7 +71,7 @@ STRDST EQU SETDST ;Aliased to System Header function
|
|||||||
;Requires: DSTLO, DSTHI - Pointer to destination string
|
;Requires: DSTLO, DSTHI - Pointer to destination string
|
||||||
;Args: X,Y = Pointer to source string
|
;Args: X,Y = Pointer to source string
|
||||||
;Sets: SRCLO,SRCHI = Pointer to source string
|
;Sets: SRCLO,SRCHI = Pointer to source string
|
||||||
; TEMP0 = Length of source prior to concatenation
|
; TEMP3 = Length of source prior to concatenation
|
||||||
;Affects: C,N,Z
|
;Affects: C,N,Z
|
||||||
;Returns: A,Y = Total length of concatenated string
|
;Returns: A,Y = Total length of concatenated string
|
||||||
STRCAT: JSR SETSRC ;Initialize Source String
|
STRCAT: JSR SETSRC ;Initialize Source String
|
||||||
@ -79,10 +79,10 @@ STRCAL: LDA (DSTLO),Y ;Find end of Destination String
|
|||||||
BEQ STRCAX ;
|
BEQ STRCAX ;
|
||||||
INY ;
|
INY ;
|
||||||
BPL STRCAL ;
|
BPL STRCAL ;
|
||||||
STRCAX: STY TEMP0 ;Subtract Destination String Length
|
STRCAX: STY TEMP3 ;Subtract Destination String Length
|
||||||
LDA SRCLO ; from Source String Pointer
|
LDA SRCLO ; from Source String Pointer
|
||||||
SEC
|
SEC
|
||||||
SBC TEMP0
|
SBC TEMP3
|
||||||
STA SRCLO
|
STA SRCLO
|
||||||
LDA SRCHI
|
LDA SRCHI
|
||||||
SBC #$00
|
SBC #$00
|
||||||
@ -125,13 +125,13 @@ STRCUT: JSR SETSRC ;Initialize Source String
|
|||||||
;Sets: DSTLO,DSTHI = Pointer to position in source string
|
;Sets: DSTLO,DSTHI = Pointer to position in source string
|
||||||
; End of string if not found
|
; End of string if not found
|
||||||
; SRCLO,SRCHI = Pointer to source string
|
; SRCLO,SRCHI = Pointer to source string
|
||||||
; TEMP0 = Last position checked in destination string
|
; TEMP3 = Last position checked in destination string
|
||||||
;Affects: N,Z
|
;Affects: N,Z
|
||||||
;Returns: A = Position, C=1 if found
|
;Returns: A = Position, C=1 if found
|
||||||
; A = $FF, C=0 if not found
|
; A = $FF, C=0 if not found
|
||||||
; Y = Last position checked in source string
|
; Y = Last position checked in source string
|
||||||
STRSTR: JSR SETSRC ;Initialize Source String
|
STRSTR: JSR SETSRC ;Initialize Source String
|
||||||
STY TEMP0 ;Initialize Position
|
STY TEMP3 ;Initialize Position
|
||||||
STRSTL: LDY #$00; ;Initialize Compare Offset
|
STRSTL: LDY #$00; ;Initialize Compare Offset
|
||||||
LDA (DSTLO),Y ;Get Start Character in Destination
|
LDA (DSTLO),Y ;Get Start Character in Destination
|
||||||
BEQ STRCLC ;If NUL return $FF and Carry Clear
|
BEQ STRCLC ;If NUL return $FF and Carry Clear
|
||||||
@ -140,7 +140,7 @@ STRSTL: LDY #$00; ;Initialize Compare Offset
|
|||||||
BMI STRSTN ; If Source is Greater
|
BMI STRSTN ; If Source is Greater
|
||||||
LDA (SRCLO),Y ; If at End of Source String
|
LDA (SRCLO),Y ; If at End of Source String
|
||||||
BEQ STRSTX ; Return Current Position
|
BEQ STRSTX ; Return Current Position
|
||||||
STRSTN: INC TEMP0 ; Else Increment Position
|
STRSTN: INC TEMP3 ; Else Increment Position
|
||||||
BMI STRCLC ; If > 127 return $FF and Carry Clear
|
BMI STRCLC ; If > 127 return $FF and Carry Clear
|
||||||
INC DSTLO ; Increment Source Pointer
|
INC DSTLO ; Increment Source Pointer
|
||||||
BNE STRSTL
|
BNE STRSTL
|
||||||
@ -148,30 +148,29 @@ STRSTN: INC TEMP0 ; Else Increment Position
|
|||||||
BNE STRSTL ; Loop
|
BNE STRSTL ; Loop
|
||||||
BEQ STRCLC ; Else return $FF and Carry Clear
|
BEQ STRCLC ; Else return $FF and Carry Clear
|
||||||
STRSTX: SEC ;Else Set Carry
|
STRSTX: SEC ;Else Set Carry
|
||||||
LDA TEMP0 ; Load Position
|
LDA TEMP3 ; Load Position
|
||||||
RTS ; and Return
|
RTS ; and Return
|
||||||
|
|
||||||
;strrch(c, &s) - Find Last Occurance Character in String
|
;strrch(c, &s) - Find Last Occurance Character in String
|
||||||
;Args: A = Character to look for
|
;Args: A = Character to look for
|
||||||
; X,Y = Pointer to string to search in
|
; X,Y = Pointer to string to search in
|
||||||
;Sets: SRCLO,SRCHI = Pointer to string
|
;Sets: SRCLO,SRCHI = Pointer to string
|
||||||
; TEMP0 = Character being searched for
|
; TEMP3 = Character being searched for
|
||||||
; TEMP1 = Position of character
|
|
||||||
;Affects: Y,C,N,Z
|
;Affects: Y,C,N,Z
|
||||||
;Returns: A = Position of last occurance in string
|
;Returns: A,X = Position of last occurance in string
|
||||||
; A = $FF if not found
|
; $FF if not found
|
||||||
; Y = Position of last character scanned
|
; Y = Length of String
|
||||||
STRRCH: JSR SETSRC ;Initialize Source String
|
STRRCH: JSR SETSRC ;Initialize Source String
|
||||||
STA TEMP0; ;Save Search Character (alternate entry point)
|
STA TEMP3; ;Save Search Character (alternate entry point)
|
||||||
LDA #$FF ;Initialize Position
|
LDX #$FF ;Initialize Position
|
||||||
STA TEMP1 ; to 255
|
|
||||||
STRRCL: LDA (SRCLO),Y ;Get Next Character
|
STRRCL: LDA (SRCLO),Y ;Get Next Character
|
||||||
BEQ STRRCX ;If NUL, Exit with Position
|
BEQ STRRCX ;If NUL, Exit with Position
|
||||||
CMP TEMP0 ;Compare Character
|
CMP TEMP3 ;Compare Character
|
||||||
BNE STRRCS ;If Found
|
BNE STRRCS ;If Found
|
||||||
STY TEMP1 ; Store Counter
|
TYA ; Store Counter
|
||||||
|
TAX
|
||||||
STRRCS: INY ;Increment Counter
|
STRRCS: INY ;Increment Counter
|
||||||
BPL STRRCL ; and Loop if < 128
|
BPL STRRCL ; and Loop if < 128
|
||||||
STRRCX: LDA TEMP1 ;Load Position Accumulater
|
STRRCX: TXA ;Copy Position to Accumulater
|
||||||
RTS ; and Return
|
RTS ; and Return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user