Friday, December 6, 2024

Macro Assembler versus "Computer Intro!" Assembler for Odyssey2

First, lets look at the Macro Assembler "Hello World"
  cpu   8048              ; using the Intel 8048 CPU
  org   400h
  include "g7000.h"       ; common developer header
  jmp   myinit            ; go directly to myinit and skip start screen
  jmp   irq
  jmp   timer             ; required to have here, but not to use
  jmp   vsyncirq
  jmp   start             ; start of the app code 
  jmp   soundirq

myinit
  call init

timer
                          ; not used

start
  call gfxoff             ; turn off graphics mode while we paint
  mov r0,#vdc_char0       ; using #0 of the graphic character set
  mov r3,#20h             ; set the x
  mov r4,#20h             ; set the y
  mov r2,#0Bh             ; set to 11 characters long
  mov r1,#hellostr & 0FFh ; point to the string we will read 0FF is the terminator

loop
 mov a,r1                 ; move character into the accumulator
 movp a,@a                ; memory move the accumulator
 mov r5,a                 ; put the accumulator into register 5 where the call 
                          ; to vdc_char0 is stored to display
 inc r1                   ; ready for next character
 mov r6,#col_chr_white    ; register 6 is where vdc_char0 looks for color
 call printchar           ; display character
 djnz r2,loop             ; is register 2 in loop at 11 yet, if not continue loop
 call gfxon               ; turn on graphics mode
 
 stop
  jmp   stop

hellostr
  db   1Dh, 12h, 0Eh, 0Eh, 17h, 0Ch
  db   11h, 17h, 13h, 0Eh, 1Ah

Now lets look at "Computer Intro!" Assembler for Odyssey2
00 6B LDV.B.00       ;Load display register B with position 00
01 00
02 60 LDV.0.00       ;load register 0 with NULL
03 00
04 6C LDV.C.12       ;Load data space register C with step 12
05 12
06 09 MOV            ;Move data space to accumulator
07 30 BEQ.0.24       ;If NULL goto end
08 24
09 0B OTA            ;Display accumulator
10 12 GTO.06         ;go back to move at step 06   
11 06
12 1D                ;H  Start of data space
13 12                ;E
14 0E                ;L
15 0E                ;L
16 17                ;O
17 0C                ;space
18 11                ;W 
19 17                ;O
20 13                ;R
21 0E                ;L
22 1A                ;D
23 00                ;NULL  end of string
24 00 NOP            ;No operation, just a place to land
Both Hello Worlds have major differences while working mostly the same and using the same character set.

No comments:

Post a Comment

Merry Christmas!