/ hello-world / a / Assembler 8048 videopac.asm
Assembler 8048 videopac.asm
 1  
 2  ; Hello World for Philips Videopac (Magnavox Odyssey 2)
 3  ; by Frog ( https://github.com/petersobolev )
 4  ; 25 July 2016
 5  
 6  	cpu	8048
 7  	org	400h
 8  
 9  ; interrupt vectors
10  	jmp     02C3h                           ; selectgame (RESET)
11  	jmp     0009h                           ; irq
12  	jmp	timer                           ; timer
13  	jmp	001Ah                           ; vsyncirq
14  	jmp	start                           ; after selectgame
15  	jmp	0044h                           ; soundirq
16  
17  timer:
18  	ret                                     ; no timer needed
19  
20  
21  start:
22  
23  	call	011Ch                           ; gfxoff
24  
25  	mov	r0,#010h                        ; pointer in VDC - which char to display (one of 12)
26  	mov	r3,#40                          ; x
27  	mov	r4,#100                         ; y
28  	mov	r1,#hellostr & 0ffh             ; string to print (should be on same 255 bytes page)
29  
30  	mov	r2,#11                          ; string length
31  
32  nextchar:
33  	mov	a,r1
34  	movp	a,@a                            ; get char located at @r1
35  	mov	r5,a
36  	inc	r1                              ; inc addr of char
37  	mov	r6,#0eh                         ; white color
38  	call	03EAh                           ; printchar bios subroutine (increases r0, r3)
39  	djnz	r2,nextchar
40  
41  	call	0127h                           ; gfxon (show what is written to VDC)
42  
43  
44  loop:
45  	jmp 	loop                            ; just wait and do nothing
46  
47  ; 'HELLO WORLD' (ascii not supported by assembler)
48  hellostr:
49  	db 	01dh, 012h, 00eh, 00eh, 017h, 00ch, 011h, 017h, 013h, 00eh, 01ah
50