# 04 - And a whole byte is not enough ... | Take BK by the horns

Last week = R MDA = released its first release for the legendary Soviet computer , Electronics BK-0011M, and I want to tell you some details. Here is the work itself: Gift 2020

image

This gift is such a type of greeting intro, usually dedicated to birthdays. It so happened that by the time the work was completed, two prominent figures in the Russian demoscene had a synchronous birthday, and we decided to reformat this release a bit to GIFT, so that everyone was satisfied. Otherwise, we have before us the usual intro / demo, in no way associated with size restrictions.

Programming on the BC is not more difficult and not easier than on any other device. You take development tools, manuals, ready-made code libraries, put everything together and add an idea to it. There are a lot of development tools for the BC, there is even more reference information. In fact, everything that was done on the BC until 1997 is one continuous layer of reference information. There is even a very decent emulator that continues to be updated on a periodic basis, although it is strictly under Windows.

What is the problem? What is the technological challenge? Especially if we write banal HELLO WORLD for a new platform?


At the demoscene, it is customary to supply releases with an .NFO file , where they are described, briefly, but capaciously, all the details of what is happening. In fact, an article on Habr is not needed if you can read .NFO:

         ________    ___  ____    _______    ________
       __\       \ _/   \/    \ _/       \ __\       \__
       \__   __   \\     \     \\   __    \\__   __   _/
        /    |/ __/           _/_   |/   _/_/    |/  /_
        \    /    \_           /    /      \          \
         \____\___//___\  /___/____________/\_____\___/
                        \/   redefine the future!
gift 2020
demo, Elektronika BK0011M + AY-8910

code - siniy
 alarm - okin
  farted by ded

YouTube: sorry, no YouTube, BK is too hard even for RMDA

HowTO:

1) Download emulator here http://gid.pdp-11.ru
2) Install it and find installation directory
3) Replace /image/MKDOS513.IMG with file from our release
4) Launch emulator
5) In NC-style enviroment navigate up, change dir/disk
6) Find gft2o2o.com file and press Enter
7) AY-8910 must be enabled
8) Assembler+devtools also available at http://gid.pdp-11.ru

BK - shit na veka!

RMDA 2020 @ https://rmda.su

02/04/2020

russkie idut...

As part of this series of articles on Habré, we of course pursue educational goals. We tell you about the demoscene, but we do not set goals to teach you how to program in assembler. The work above is just three slides changing to music. It is very, very simple, but let's look at the code:

	CALL CLS
	MOV #msg3,R5
	MOV #40000+4.+0x1B00,R0
	CALL PRT

 MOV #8.,R0 ;  
 CLR R1
L1: SOB R1,L1
 SOB R0,L1
 MOV #32768.,R0
 MOV R0,COL

;setup timer
START:
 MOV #TICK,@#100
 MOV #2,@#102
 CLR @#177662 ; , 0 

SSH:
;load picture
 MOV #File_002,R1
 EMT 36

	MOV #msg1,R5
	MOV #40000+27.,R0
	ADD #0x3600,R0
	CALL PRT

;play song
	MOV #1,R0
	MOV R0,PSGPA
	MOV #SONG+16.,R0
	MOV R0,PSGPO
	CALL PL
	CALL CLS

 MOV #File_001,R1
 EMT 36

	MOV #msg2,R5
	MOV #40000+16.,R0
	ADD #0x3600,R0
	CALL PRT

;play song
	MOV #1,R0
	MOV R0,PSGPA
	MOV #SONG+16.,R0
	MOV R0,PSGPO
	CALL PL
	CALL CLS
	JMP SSH
CLS:
	MOV #40000,R0
CL:
	CLR (R0)+
	TST R0
	BPL CL
	RET
;**************************************************************************************
;play song
PL: WAIT
	MOV PSGPA,R0
	TST R0
	BEQ PSGA
	DEC R0
	MOV R0,PSGPA
	BR PL
PSGA:
	MOV PSGPO,R0
dumpreg:
	MOVB (R0)+,R1
	BIC #0xFF00,R1
	CMP #0xFF,R1
	BEQ stoplay
	CMP #0xFE,R1
	BNE nogetwait
	MOVB (R0)+,R2
	BIC #0xFF00,R2
	ASL R2
	ASL R2
	MOV R2,PSGPA
	BR stoplay
nogetwait:
	CMP #0xFD,R1
	BEQ stoplay2
	COMB R1
	MOV R1,@#177714
	MOVB (R0)+,R1
	BIC #0xFF00,R1
	COMB R1
	MOVB R1,@#177714
    BR dumpreg
stoplay2:
	RET ;MOV #SONG+16.,R0
stoplay:
	MOV R0,PSGPO
	JMP PL

;**************************************************************************************
TICK:
RTI
PSGPA: .WORD 1

PSGPO: .WORD SONG+16.
SONG:
 .byte 0x50,0x53,0x47,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
----   ,     
 .byte 0x0F,0x09,0x10,0x0A,0x0F,0x0B,0x46,0x0D,0x0C,0xFE,0x01,0x00,0xA1,0x04,0x16,0x0B
 .byte 0xFD ; end of song
.EVEN
;--------------------------------------------------------------
COL: .WORD 49152.;32768.
PRT:

tout:
	MOVB (R5)+,R3
	SUB #32.,R3
	BIC #0xFF00,R3
;*10
	ADD R3,R3;*2
	MOV R3,R1
	ADD R3,R3;*4
	ADD R3,R3;*8
	ADD R3,R1;*10
	ADD #112276,R1
	
	MOV R0,-(SP)
	MOVB #10.,4(SP)
cf:
	MOVB (R1)+,R2

;make for standart

	MOVB #8.,6(R6)
	MOV #0,R3
m2:
	ASR R2
	BCC m3
	BIS @#COL,R3
m3:
	CLC
	ROR R3
	ROR R3

	DECB 6(R6)
	BNE m2

	MOV R3,(R0);+
	ADD #64.,R0
	DECB 4(SP)
	BNE cf
	
	MOV (SP)+,R0
	INC R0
	INC R0
	TSTB (R5)
	BNE tout
	RET
;--------------------------------------------------------------
msg1: .ascii /2 may 1945/
 .byte 0
msg2: .ascii /Russkie idut.../
	.byte 0,0
msg3: .ascii /Happy birthday Tim & Random!/
	.byte 0,0

File_001:
 .WORD 3,0,0 ; 1= ,  ,  (0!  )
 .ASCII  "PO1             " ; 16 
 .BYTE 5,6   ; 40-100, 100-140 ( WORD -1.,   )
 .BLKB 20.   ;   

File_002:
 .WORD 3,0,0 ; 1= ,  ,  (0!  )
 .ASCII  "PO2             " ; 16 
 .BYTE 5,6   ; 40-100, 100-140 ( WORD -1.,   )
 .BLKB 20.   ;   

 .EVEN
 .END

IMPORTANT! Do not try to compile code from the article! It is specially reduced and formatted for normal readability on Habré. If you want to collect the work yourself - use the original archive on Pouet and the / source folder . It should be recognized right away that it was far from an honor, but for the first experience on a previously unknown computer, everything is pretty decent. Perhaps after Revision Online 2020 we will make a more advanced, final version of this Gift. Maybe…

What conclusions did we draw from the project at BC? On the one hand, everything is fine, there are development tools, there is documentation. The fact that BC is a terrible architecture, we already knew. However, no one expected after ZX and PC to face the situation of TOTAL LACK of the most basic procedures and libraries. For example, we were completely unprepared for the fact that to play the finished chiptune-track (siren), written in Vortex Tracker , we need the help of ourselvesManwe_sands. And it's not that in the AY you need to send inverted values ​​to the ports of the sound chip AY, this is half the trouble. For 20 years, people simply did not have a banal PT3 player, although in the 90s a huge amount of music from the ZX Spectrum was transferred to the BC in a few clicks of the mouse. So, for 20 years of inactivity, the scene of the legendary Soviet computer completely lost its spirituality.

Nothing, = RMDA = help!

For the rest, BC is fun and provocatively! Feel free to take the BC by the horns! Thank.

--- EOF ---

#FF - And a whole byte is not enough ... | Pilot)
# 00 - ICBM ... | Invitation to Revision Online 2020
# 01 - IBMP ... | What are intro?
# 02 - The MBM ... | The Cross of Changes
# 03 - IBMP ... | 2B or not 2B
# 04 - IBMP ... | Take BK by the horns
# 05 - The MBM ... | Anime
# 06 - IBMP ... | Meteorisms
# 07 - The MBM ... | Revision Online

Grandfather's Telegram Entertainment Channel:teleg.run/bornded

There is a chat next to the channel. In it, you can try to raise questions for the demoscene, assembler, pixel art, tracker music and other aspects of the processes. You can be answered or sent to other, more thematic chats.

So they won - so we win!

All Articles