Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Gob's Program for the SWTPC 6800
- ;
- ;OUTCH - outputs character stored in acc. A to terminal
- ;INCH - inputs character from terminal into acc. A
- ;CONTRL - returns control to the monitor (to end the program)
- OUTCH EQU $E1D1
- INCH EQU $E1AC
- CONTRL EQU $E0E3
- ORG $0
- GREET FCC "Gob's Program: Y/N?"
- MESSAGE FCC "PENUS "
- NL FCB $0D,$0A
- ASK FCC "? "
- RESPONSE RMB 1
- ORG $0800
- LDS #$7FF
- main: JSR newline
- LDX #$0
- loop: LDAA GREET,X
- JSR OUTCH
- INX
- CPX #19 ;length of GREET
- BNE loop
- JSR newline
- LDX #$0
- loop1: LDAA ASK,X
- JSR OUTCH
- INX
- CPX #2 ;length of ASK
- BNE loop1
- poll: JSR INCH
- CMPA #33 ;only accept printed characters (above SPACE in ASCII)
- BMI poll
- STAA RESPONSE
- poll1: JSR INCH
- CMPA #13 ;13 = $0D = return key
- BNE poll1
- LDAA RESPONSE
- CMPA #89 ;'Y' = 89
- BNE main
- forever: JSR newline
- CLRB
- line: LDX #$0
- loop2: LDAA MESSAGE,X
- JSR OUTCH
- INX
- CPX #6 ;length of MESSAGE
- BNE loop2
- INCB
- CMPB #13 ;80 characters per line / length of MESSAGE ~= 13
- BNE line
- BRA forever
- newline: LDX #0 ;simple subroutine to print a newline
- LDAA NL,X ;takes no input but does destroy contents in X and A
- JSR OUTCH
- INX
- LDAA NL,X
- JSR OUTCH
- RTS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement