SCREEN_BUF_SIZE =       20 * 24
 SCREEN_BUF      =       $4000 - SCREEN_BUF_SIZE
 
-                .code
                 .export screen_setup_20x24
 
+                .segment "INIT"
+
 screen_setup_20x24:
 
                 ; initialize SAVMSC
 
 .assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary"
 
-
                 .end
 
 ; Constructor that writes to the 1/10 sec register of the TOD to kick it
 ; into action. If this is not done, the clock hangs. We will read the register
 ; and write it again, ignoring a possible change in between.
+.segment "INIT"
 
 .proc   initsystime
 
 
 .endproc
 
-
 ;----------------------------------------------------------------------------
 ; TM struct with date set to 1970-01-01
 .data
         .word           0       ; tm_wday
         .word           0       ; tm_yday
         .word           0       ; tm_isdst
-
 
 ; Constructor that writes to the 1/10 sec register of the TOD to kick it
 ; into action. If this is not done, the clock hangs. We will read the register
 ; and write it again, ignoring a possible change in between.
+.segment "INIT"
 
 .proc   initsystime
 
 
 .endproc
 
-
 ;----------------------------------------------------------------------------
 ; TM struct with date set to 1970-01-01
 .data
         .word           0       ; tm_wday
         .word           0       ; tm_yday
         .word           0       ; tm_isdst
-
 
         .include        "zeropage.inc"\r
 \r
 ; Initialize one-character buffer that is filled by kbhit()\r
+        .segment        "INIT"\r
 initcgetc:\r
         lda     #$00\r
         sta     CHARBUF         ; No character in buffer initially\r
         rts\r
 \r
 ; Input routine from 65V PROM MONITOR, show cursor if enabled\r
+        .code\r
 _cgetc:\r
         lda     CHARBUF         ; character in buffer available?\r
         beq     nobuffer\r
 
         .include        "pce.inc"
         .include        "extzp.inc"
 
-        .forceimport    ticktock
         .export         _clock
+        .forceimport    ticktock
         .importzp       sreg
+        .constructor    initclock
+
 
 .proc   _clock
 
 
 .endproc
 
-        .constructor initclock
-
+        .segment        "INIT"
 initclock:
         lda     #0
         ldx     #3
 
         .include        "pce.inc"
         .include        "extzp.inc"
 
-        .import vce_init
-        .import psg_init
-        .import vdc_init
+        .import         vce_init
+        .import         psg_init
+        .import         colors
+        .importzp       ptr1, tmp1
 
         .constructor    initconio
 
         .macpack        longbranch
 
+        .segment        "INIT"
 initconio:
         jsr     vce_init
         jsr     psg_init
         st2     #>$0088
         rts
 
-        .import colors
 set_palette:
         stz     VCE_ADDR_LO
         stz     VCE_ADDR_HI
 
         rts
 
-;----------------------------------------------------------------------------
-;
-;----------------------------------------------------------------------------
-
-        .importzp       ptr1, tmp1
 conio_init:
         ; Load font
         st0     #VDC_MAWR
         sta     tmp1
         jsr     copy
 
-
         ldx     #0
         stx     BGCOLOR
         inx
         stx     CHARCOLOR
 
-
         rts
 
 copy:
 
-
         .include        "pce.inc"
 
         .export         psg_init
 
+        .segment        "INIT"
 psg_init:
         clx
         stz     PSG_GLOBAL_PAN          ; Clear global balance
 
-
         .include        "pce.inc"
 
         .export         vce_init
 
+        .segment        "INIT"
 vce_init:
         ; Set CTA to zero
         stz     VCE_ADDR_LO