1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-25 06:31:25 +00:00

Fixed header.?02 so they will compile and assemble

This commit is contained in:
Curtis F Kaylor 2019-11-15 00:05:53 -05:00
parent f7c9742027
commit 8d12f452a0
2 changed files with 6 additions and 45 deletions

View File

@ -37,6 +37,10 @@ STKEHI EQU $2B
STKLO EQU $2C ;Stack Pointer
STKHI EQU $2D
;Placeholders Labels for the Example Code Below
POLKEY EQU $FFFE ;ROM Read Key Routine
WSTART EQU $FFFF ;BASIC Warm Start Routine
ORG $0200 ;Program Start Address
START: NOP ;System specific initialization code
@ -77,45 +81,5 @@ NEWLIN: RTS ;Code to move Cursor to beginning of next line
;Print Character to Screen
PUTCHR RTS ;Code to write ASCII character to Screen
;Clear the Screen
CLRSCR: RTS ;Code to Clear Screen
INCLUDE "../include/prbyte.a02" ;PRBYTE and PRHEX routines
;Move Cursor to Specified Coordinates
SETPOS: RTS ;Move Cursor to Column A, Row Y
;Get Cursor Position
GETPOS: RTS ;Return Cursor Column in A, Row in Y
;Get Screen Size
GETSIZ: RTS ;Return Screen Width in A, Height in Y
;Note: The following two functions replicate calls available
;in the Apple-1 monitor and are included for test purposes
;They will likely be removed before the final release
;Print Byte as Two-Digit Hex Number to Console
PRBYTE: PHA ;Save Accumulater
LSR ;Shift Hi Nybble to Low Nybble
LSR
LSR
LSR
JSR PRHEX ; and Print it
PLA ;Restore Accumulator
; and fall into PRHEX
;Print Low Nybble as Hex Digit to Console
PRHEX: AND #$0F ;Strip High Nybb
SED ;Set Decimal Flag for
CLC ; Addition Wizardry
ADC #$90 ;Convert to $90-$99,$00-$05
ADC #$40 ;Convert to $30-$39,$41-$46
CLD ;Clear Decimal Flag
JMP PUTCHR ;Print Hex Digit and Return
;Alternate Code for Systems with Interrupts that don't CLD
PRHEX: AND #$0F ;Strip High Nybble
CMP #$0A ;If Low Nybble >= 10
BCC PRHEXC ;
ADC #$06 ; Convert ':' to 'A'...
PRHEXC: ADC #$30 ;Convert to ASCII Character
JMP PUTCHR ;Print Hex Digit and Return

View File

@ -36,15 +36,12 @@ char rdseed; //System Seed for Pseudo-Random Number Generator
//System Subroutines
void delchr(); //Delete previous character
char getkey(); //Read ASCII character from Console
char getpos(); //Get Cursor Position
char getsiz(); //Get Screen Size
void newlin(); //Advance cursor to beginning of next line
char polkey(); //Poll Console for character
char putchr(); //Print ASCII character to Console
void prbyte(); //Print Accumulator as Hexadadecimal number
void prhex(); //Print Low Nybble of Accumulator as Hex Digit
char getchr(); //Wait for character from Console
void setpos(); //Set Cursor Position
//System Labels
start: //Start of Code