Advertisement
antiquekid3

Gob's Program - SWTPC 6800 Assembly

Apr 24th, 2012
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Gob's Program for the SWTPC 6800
  2. ;
  3. ;OUTCH - outputs character stored in acc. A to terminal
  4. ;INCH - inputs character from terminal into acc. A
  5. ;CONTRL - returns control to the monitor (to end the program)
  6.  
  7. OUTCH       EQU $E1D1
  8. INCH        EQU $E1AC
  9. CONTRL  EQU $E0E3
  10.  
  11.             ORG $0
  12.            
  13. GREET       FCC "Gob's Program: Y/N?"
  14. MESSAGE FCC "PENUS "
  15. NL          FCB $0D,$0A
  16. ASK     FCC "? "
  17. RESPONSE    RMB 1
  18.  
  19.             ORG $0800
  20.            
  21.             LDS #$7FF
  22. main:       JSR newline
  23.            
  24.             LDX #$0
  25. loop:       LDAA    GREET,X
  26.             JSR OUTCH
  27.             INX
  28.             CPX #19     ;length of GREET
  29.             BNE loop
  30.            
  31.             JSR newline
  32.            
  33.             LDX #$0
  34. loop1:  LDAA    ASK,X
  35.             JSR OUTCH
  36.             INX
  37.             CPX #2          ;length of ASK
  38.             BNE loop1
  39.            
  40. poll:       JSR INCH
  41.             CMPA    #33     ;only accept printed characters (above SPACE in ASCII)
  42.             BMI poll
  43.             STAA    RESPONSE
  44.            
  45. poll1:  JSR INCH
  46.             CMPA    #13     ;13 = $0D = return key
  47.             BNE poll1
  48.             LDAA    RESPONSE
  49.             CMPA    #89     ;'Y' = 89
  50.             BNE main
  51.            
  52. forever:    JSR newline
  53.             CLRB
  54. line:       LDX #$0
  55. loop2:  LDAA    MESSAGE,X
  56.             JSR OUTCH
  57.             INX
  58.             CPX #6          ;length of MESSAGE
  59.             BNE loop2
  60.             INCB
  61.             CMPB    #13     ;80 characters per line / length of MESSAGE ~= 13
  62.             BNE line
  63.             BRA forever
  64.            
  65. newline:    LDX #0          ;simple subroutine to print a newline
  66.             LDAA    NL,X        ;takes no input but does destroy contents in X and A
  67.             JSR OUTCH
  68.             INX
  69.             LDAA    NL,X
  70.             JSR OUTCH
  71.             RTS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement