; Arcadia 2001 - chartest.asm
; Written by PeT (former MESS emulation author)
; Disassembled and over-commented by Adam Trionfo
;                               ballyalley @ hotmail.com
;
; Version 1.1 - April 21, 2002
; Version 1.0 - April 19, 2002
;
; Signetics 2650 source-code for the Arcadia 2001 console.
;
; This program displays the characters that are built into
; the Arcadia 2001, then loops forever.  That's it.  
;
; This file assembles well under VACS v1.24 (by W.H. Taphoorn)
; The simplest command works:
;      asm chartest.asm
; The output will be in Hex format- you need to convert the
; Hex format file to a plain binary file (I use Win-Hex).
; Next pad with 00h or FFh for a 2048 byte file that will
; run cleanly under the Arcadia emulator.

; Equates - Name the 2650 condition codes

z     equ  0
eq    equ  z
p     equ  1
gt    equ  p
n     equ  2
lt    equ  n
un    equ  3

      org         0000H        ; Start of Arcadia ROM

programentry:
      eorz  r0                 ; Zero-out register 0
      bctr,un     programstart ; Branch to start of program
      retc,un                  ; Called on VSYNC or VBLANK?
                               ; As suggested by Paul Robson

programstart:
      ppsu        00100000b    ; Set Interrupt Inhibit bit
                               ; The Tech doc that Paul
                               ; wrote infers that Inter-
                               ; rupts aren't used
      lodi,r0     00h          ; Put 00h into register 0,

; The Arcadia's 64 characters are displayed on the screen
; using a loop.  Since the last eight characters (38h-3Fh)
; are user defined, nothing is displayed (since nothing
; has been defined for them in the program).  The first
; loop will print a space (00h) at 1800h (the start
; of the screen display).  On the second run through the
; loop a '/' (01h) will be printed at 1801h (second byte
; of screen display) and so on until the loop has finished
; displaying all the 64 characters.

displaychars:
      stra,r0     1800h,r0     ; Store character at the start
                               ; of the screen display plus
                               ; register zero
      addi,r0     01h          ; Increment reg 0 by 1
      comi,r0     64d          ; Compare to (decimal) 64 (40h)
      bcfr,eq     displaychars ; Break out of loop after
                               ; 64 iterations
 
; Set Background Color to black (color 07h)
      lodi,r0     00000111b    ; Put Black (07h) into reg 0
      stra,r0     19F9h        ; Bits 0-2 of 19F9h control
                               ; background color

loopforever:
      bctr,un     loopforever  ; Loop forever

      end ; End of assembly
