Minor changes to include/ .a02 files

This commit is contained in:
Curtis F Kaylor 2019-03-22 21:18:49 -04:00
parent 5289bb8717
commit 976dd4cf44
5 changed files with 31 additions and 29 deletions

View File

@ -42,12 +42,12 @@ ISFLS: LDA #$00 ; Return FALSE
RTS
;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
ORA #$20 ;Else Set Bit 5
RTS ; and Return
touppr: JSR ISLWR ;If Char IS Not Lower Case
TOUPPR: JSR ISLWR ;If Char IS Not Lower Case
BCC ISRTS ; Return
AND #$DF ;Else Clear Bit 5
RTS ; and Return

View File

@ -22,7 +22,6 @@ PTRRTN: LDY (1,X) ;Load Pointer MSB into Y
LDA TEMP0 ;Load Pointer Addres into A
RTS
;ptrset(ptr, &addr) - Store Address in Pointer
;Args: A = Zero Page Pointer Address
; X,Y = Address to Store

View File

@ -8,7 +8,7 @@
;Uses: System Dependent
;Affects: System Dependent
;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
;Args: Character code to display
@ -16,15 +16,17 @@ GETC EQU GETCHR ;Alias to external GETCHRroutine
;Uses: System Dependent
;Affects: 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
;Args: Y,X = 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
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
BNE GETSE ;Then
TYA ; If Offset is Zero
@ -39,10 +41,12 @@ GETSE: CMP #ESCKEY ;Else If Escape
GETSC: CMP #RTNKEY ;Else If Not Carriage Return
BEQ GETSX
JSR PUTC ; Echo Character
LDY TEMP3 ;Restore Y Index
STA (SRCLO),Y ; Store Character at offset
INY ; increment offset and
BPL GETSL ; loop if less than 128
GETSX: JSR NEWLIN ;Else Advance Cursor to Next Line
LDY TEMP3 ;Restore Y Index
LDA #$00 ; Terminate String
STA (SRCLO),Y ; and
GETSY: TYA ; Return String Length

View File

@ -1,6 +1,6 @@
; C02 library stdlib.h02 assembly language subroutines
; Requires
; external zero page locations SRCLO and srchi
; external zero page locations SRCLO and SRCHI
; and external locations RANDOM, RDSEED, TEMP0, TEMP1, and TEMP2.
;abs(n) - Get ABSolute Value

View File

@ -29,16 +29,16 @@ STRCMR: RTS ;
;Args: A = Character to look for
; X,Y = Pointer to string to search in
;Sets: SRCLO,SRCHI = Pointer to string
; TEMP0 = Character being searched for
; TEMP3 = Character being searched for
;Affects: N,Z
;Returns: A = Position in string, C=1 if found
; A = $FF, C=0 if not found
; Y = Position of last character scanned
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
BEQ STRCLC ;If NUL, Return $FF and Carry Clear
CMP TEMP0 ;Compare Character
CMP TEMP3 ;Compare Character
BEQ STRLEX ;If Found, Return Index
INY ;Increment Counter and Loop if < 128
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
;Args: X,Y = 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
;Returns: A,Y = Total length of concatenated string
STRCAT: JSR SETSRC ;Initialize Source String
@ -79,10 +79,10 @@ STRCAL: LDA (DSTLO),Y ;Find end of Destination String
BEQ STRCAX ;
INY ;
BPL STRCAL ;
STRCAX: STY TEMP0 ;Subtract Destination String Length
STRCAX: STY TEMP3 ;Subtract Destination String Length
LDA SRCLO ; from Source String Pointer
SEC
SBC TEMP0
SBC TEMP3
STA SRCLO
LDA SRCHI
SBC #$00
@ -125,13 +125,13 @@ STRCUT: JSR SETSRC ;Initialize Source String
;Sets: DSTLO,DSTHI = Pointer to position in source string
; End of string if not found
; SRCLO,SRCHI = Pointer to source string
; TEMP0 = Last position checked in destination string
; TEMP3 = Last position checked in destination string
;Affects: N,Z
;Returns: A = Position, C=1 if found
; A = $FF, C=0 if not found
; Y = Last position checked in source string
STRSTR: JSR SETSRC ;Initialize Source String
STY TEMP0 ;Initialize Position
STY TEMP3 ;Initialize Position
STRSTL: LDY #$00; ;Initialize Compare Offset
LDA (DSTLO),Y ;Get Start Character in Destination
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
LDA (SRCLO),Y ; If at End of Source String
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
INC DSTLO ; Increment Source Pointer
BNE STRSTL
@ -148,30 +148,29 @@ STRSTN: INC TEMP0 ; Else Increment Position
BNE STRSTL ; Loop
BEQ STRCLC ; Else return $FF and Carry Clear
STRSTX: SEC ;Else Set Carry
LDA TEMP0 ; Load Position
LDA TEMP3 ; Load Position
RTS ; and Return
;strrch(c, &s) - Find Last Occurance Character in String
;Args: A = Character to look for
; X,Y = Pointer to string to search in
;Sets: SRCLO,SRCHI = Pointer to string
; TEMP0 = Character being searched for
; TEMP1 = Position of character
; TEMP3 = Character being searched for
;Affects: Y,C,N,Z
;Returns: A = Position of last occurance in string
; A = $FF if not found
; Y = Position of last character scanned
;Returns: A,X = Position of last occurance in string
; $FF if not found
; Y = Length of String
STRRCH: JSR SETSRC ;Initialize Source String
STA TEMP0; ;Save Search Character (alternate entry point)
LDA #$FF ;Initialize Position
STA TEMP1 ; to 255
STA TEMP3; ;Save Search Character (alternate entry point)
LDX #$FF ;Initialize Position
STRRCL: LDA (SRCLO),Y ;Get Next Character
BEQ STRRCX ;If NUL, Exit with Position
CMP TEMP0 ;Compare Character
CMP TEMP3 ;Compare Character
BNE STRRCS ;If Found
STY TEMP1 ; Store Counter
TYA ; Store Counter
TAX
STRRCS: INY ;Increment Counter
BPL STRRCL ; and Loop if < 128
STRRCX: LDA TEMP1 ;Load Position Accumulater
STRRCX: TXA ;Copy Position to Accumulater
RTS ; and Return