Voting

Category

assembly language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language UNIVAC

(Assembly w/ machine language for UNIVAC)

Date:11/27/08
Author:Jared Blaser
URL:n/a
Comments:0
Info:http://www.bitsavers.org/pdf/univac/univac1/
Score: (3.60 in 5 votes)
;
; BEER.ASM
;
; "99 BOTTLES OF BEER" SONG LYRICS GENERATOR
; FOR UNIVAC
;
; 2008-11-25
;
; (C) JARED BLASER
;

; UNIVAC WAS THE FIRST COMMERCIAL COMPUTER
; MADE IN THE USA, WITH FIRST DELIVERY
; OCCURING ON MARCH 31, 1951.
;
; UNIVAC WAS ORIGINALLY PROGRAMMED DIRECTLY
; IN MACHINE LANGUAGE, HAND ASSEMBLED,
; UNTIL AROUND 1960 WHEN A SMALL NUMBER OF
; ASSEMBLERS BECAME AVAILABLE.
;
; FOR UNIVAC DIEHARDS, A MACHINE LANGUAGE
; LISTING FOLLOWS THIS ASSEMBLY CODE.
; OF COURSE, THE MACHINE CODE IS GIVEN IN
; ASCII, RATHER THAN A REAL UNIVAC'S
; 'EXCESS 3', BUT THE CHARACTERS ARE THE
; SAME WITH THE EXCEPTION OF SEVERAL OUTPUT
; FUNCTION CHARACTERS, AS NOTED BELOW.

; CODED FOR USE WITH UNIVAC I SIMULATOR 1.1
; AND INTEGRATED ASSEMBLER, BOTH WRITTEN BY
; PETER ZILAHY INGERMAN, PHD.

; SPECIAL OUTPUT CHARACTERS TO BE USED WITH
; THE UNIVAC SIMULATOR ARE:
;  i = <IGNORE/NULLCHAR>
;  t = <TAB>
;  r = <CR>
;  % = <SINGLE CHARACTER SHIFT>
;  $ = <SHIFT LOCK>
;  ? = <SHIFT RELEASE>

; UNIVAC ENCODES TWO INSTRUCTIONS PER WORD
; THUS THIS ASSEMBLY CODE LISTS TWO COLUMNS
; OF INSTRUCTIONS (WITH OPERAND) ON EACH
; LINE.

; OUTPUT IS PRINTED ON THE OPERATOR'S
; CONSOLE.


$ORG	0000

;
; PRINT FIRST LINE OF VERSE
;
LIN1	B  COUNT	L  ZERO		; CHECK IF ZERO COUNT
	00		T  LIN11
	50 CSHFT	B  COUNT	; YES, UPPER-CASE NEXT PHRASE ('NO MORE')
LIN11	R  SRX		U  PHR1		; CALL PHRASE ONE
	50 VOTW		50 COMMA	; PRINT PHRASE TWO
	R  SRX		U  PHR1		; CALL PHRASE ONE AGAIN
	50 PRDCR	00

;
; PRINT SECOND LINE OF VERSE
;
LIN2	R  SRX		U  PHR3		; CALL PHRASE THREE
	50 COMMA	B  COUNT	; PRINT COMMA, AND...
	L  ZERO		Q  RESET	; CHECK COUNT ZERO
	S  ONE		H  COUNT	; NO, DEC COUNT
	00		U  LIN21
RESET	B  NINE9	H  COUNT	; YES, RESET TO 99
LIN21	R  SRX		U  PHR1		; CALL PHRASE ONE
	50 VOTW		50 PRDCR	; PRINT PHRASE TWO
	50 CR		B  COUNT

;
; CHECK IF FINISHED
;
	L  NINE9	Q  FINIS	; CHECK DONE ALL ROUNDS
	00		U  LIN1		; NO, ANOTHER ROUND, PLEASE!
FINIS	90		90		; YES, WE'RE DRUNK, LET'S STOP!



;
; (SUB) PRINT BEER COUNT PHRASE
;
; UPON ENTRY, REGISTER-A CONTAINS COUNT
;
PHR1	K		Q  PHR11	; CHECK IF COUNT IS ZERO

MPC	B  TEN		T  MPC1		; NO, CHECK IF COUNT LESS THAN TEN
	F  MASK		U  MPC2		;  NO, USE 2-DIGIT MASK
MPC1	F  MASK1	00		;  YES, USE 1-DIGIT MASK
MPC2	B  COUNT	E  OVRLY
	C  MCNT		50 MCNT		;  MASK AND PRINT COUNT

	00		U  PHR12
PHR11	50 VNM		00		; YES, PRINT 'NO MORE'
PHR12	50 VB		B  COUNT	; PRINT 'BOTTLE'
	L  ONE		Q  PHR13	; CHECK IF COUNT IS ONE, YES, SKIP
	50 VS		00		; NO , PRINT PLURAL 'S'
PHR13	50 VOB		B  COUNT	; PRINT 'OF BEER'; RELOAD COUNT
SRX	90		90		; DYNAMICALLY LOADED RETURN INSTRUCTION


;
; (SUB) PRINT CONSUME PHRASE
;
; UPON ENTRY, REGISTER-A CONTAINS COUNT
;
PHR3	L  ZERO		Q  PHR31	; CHECK IF COUNT IS ZERO
	50 VTODA	50 VTODA+1	; NO, PRINT 'TAKE ONE DOWN...'
	50 VTODA+2	U  SRX
PHR31	50 VGTTS	50 VGTTS+1	; YES, PRINT 'GO TO THE STORE...'
	50 VGTTS+2	U  SRX



; DEFINE OUR LIMITS
COUNT	|000000		|000099
NINE9	|000000		|000099
TEN	|000000		|000010
ONE	|000000		|000001
ZERO	|000000		|000000

; DEFINE COUNT MASK AND STORAGE
MASK	|111111		|111100
MASK1	|111111		|111110
OVRLY	|iiiiii		|iiiiii
MCNT	|000000		|000000

; DEFINE OUR STRINGS
VNM	|NO MOR		|Eiiiii
VB	| BOTTL		|Eiiiii
VS	|Siiiii		|iiiiii
VOB	| OF BE		|ERiiii
VOTW	| ON TH		|E WALL
VTODA	|%TAKE 		|ONE DO
	|WN AND		| PASS 
	|IT ARO		|UNDiii
VGTTS	|%GO TO		| THE S
	|TORE A		|ND BUY
	| SOME 		|MOREii
COMMA	|, iiii		|iiiiii
PRDCR	|.riiii		|iiiiii
CR	|riiiii		|iiiiii
CSHFT	|iiiiii		|iiiii%




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;
; BEER.OBJ
;
; "99 BOTTLES OF BEER" SONG LYRICS GENERATOR
; FOR UNIVAC
;
; 2008-11-25
;
; (C) JARED BLASER
;

; MACHINE LANGUAGE

B 0037L 0041	0
000000T 0003	1
500060B 0037	2
R 0031U 0019	3
500050500057	4
R 0031U 0019	5
500058000000	6
R 0031U 0032	7
500057B 0037	8
L 0041Q 0012	9
S 0040H 0037	10
000000U 0013	11
B 0038H 0037	12
R 0031U 0019	13
500050500058	14
500059B 0037	15
L 0038Q 0018	16
000000U 0000	17
900000900000	18
K 0000Q 0026	19
B 0039T 0022	20
F 0042U 0023	21
F 0043000000	22
B 0037E 0044	23
C 0045500045	24
000000U 0027	25
500046000000	26
500047B 0037	27
L 0040Q 0030	28
500048000000	29
500049B 0037	30
900000900000	31
L 0041Q 0035	32
500051500052	33
500053U 0031	34
500054500055	35
500056U 0031	36
000000000099	37
000000000099	38
000000000010	39
000000000001	40
000000000000	41
111111111100	42
111111111110	43
iiiiiiiiiiii	44
000000000000	45
NO MOREiiiii	46
 BOTTLEiiiii	47
Siiiiiiiiiii	48
 OF BEERiiii	49
 ON THE WALL	50
%TAKE ONE DO	51
WN AND PASS 	52
IT AROUNDiii	53
%GO TO THE S	54
TORE AND BUY	55
 SOME MOREii	56
, iiiiiiiiii	57
.riiiiiiiiii	58
riiiiiiiiiii	59
iiiiiiiiiii%	60

Download Source | Write Comment

Alternative Versions

Comments

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: