-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hi my name is Meinhard and I wrote a hellorld on my modern calculator. My model is only 35 years old. To write a machine language program a few steps are neccessary. First the TI-74 must be enhanced with the GETMEM, RELMEM, PEEK, POKE and EXEC subroutines. This I have done with my mass storage device. It's a Amtel microprocessor and a SD card reader that connects to the hexbus. With the subroutines I can do memory manipulation and start a program. So I wrote a BASIC program that pokes the machine language into the computers memory. With the EXEC subroutine I can start the program. Unfortunately it ends in a endless loop because I don't know how I can exit this program properly. By pressing the reset button it will break. Then the display buffer is shown by pressing SHIFT + 9. It shows a beautiful HELLORLD!
I hope this is ok for you?
BASIC sourcecode
with a lot of comments...
100 ! HELLORLD! challenge
110 ! Implementation of hellorld! an a TI-74 BASICALC
120 ! in machine language
130 ! MOV %>48,A -> write 'H' to A register
140 ! (HEX) 22 48 -> (DEZ) 34 72
150 ! STA @>208D -> write A register to memory 8333
160 ! (HEX) 8B 20 8D -> (DEZ) 139 32 141
170 ! JMP -2 -> jump to itself / endless loop
180 ! (HEX) E0 FE -> 224, 254
190 DATA 32,72,69,76,76,79,82,76,68,33
200 DATA 32,32,32,32,32,32,32,32,32,32
210 DATA 32,0
220 DATALENGTH=107! memory to allocate
230 STARTADDR=0! determined by GETMEM
240 OPEN #1,"12.",OUTPUT:! open serial output
250 PRINT #1,"":PRINT #1,""! linefeeds give space
260 PRINT #1,"reserve";DATALENGTH;"bytes of memory..."
270 CALL GETMEM(DATALENGTH,STARTADDR)
280 PRINT #1,"memory start address: ";STARTADDR
290 PRINT "startaddress:",STARTADDR:PAUSE
300 PRINT "writing machine language...";
310 PRINT #1,"write machine language to memory..."
320 ADR=STARTADDR! ADR counts up for POKE
330 OFFSET=141! offset of the "video memory"
340 RESTORE 190! use this data lines
350 READ VALUE! read a data value
360 IF VALUE=0 THEN 450! finish
370 CALL POKE(ADR,34)! MOV %>xx,A
380 CALL POKE(ADR+1,VALUE)! xx
390 CALL POKE(ADR+2,139)! STA @>20xx
400 CALL POKE(ADR+3,32)! 20
410 CALL POKE(ADR+4,OFFSET)! xx
420 ADR=ADR+5
430 OFFSET=OFFSET-1
440 GOTO 350
450 !generates an endless loop
460 CALL POKE(ADR,0)! nop
470 CALL POKE(ADR+1,224)! jmp xx
480 ADR=ADR+2
490 CALL POKE(ADR,-2)! xx -> -2 -> 254
500 PRINT:PRINT "reading memory...";
510 PRINT #1,"read the poked values back..."
520 PRINT #1,""
530 FOR READADR=STARTADDR TO ADR! loop memory
540 CALL PEEK(READADR,VALUE)! get values
550 PRINT #1,"read at:";READADR;" value:";VALUE
560 NEXT READADR
570 PRINT #1,""! print out clues on serial...
580 PRINT #1,"press [shift] + [9] and [enter]"
590 PRINT #1,"to execute the assembly program."
600 PRINT #1,""
610 PRINT #1,"Unfortunately it ends in an endless loop"
620 PRINT #1,"and nothing is displayed."
630 PRINT #1,"To break press RESET button and then"
640 PRINT #1,"[shift] + [9] and [enter] to show the"
650 PRINT #1,"video buffer with the result: HELLORLD!"
660 PRINT #1,""
670 PRINT #1,"Type in CALL EXEC(";STARTADDR;")"
680 PRINT #1,"to run the machine program again or"
690 PRINT #1,"type in CALL RELMEM(";STARTADDR;")"
700 PRINT #1,"to release the memory."
710 CLOSE #1
720 PRINT:PRINT "press [shift]+[9] & [enter]...":PAUSE
730 PRINT " CALL EXEC (";STARTADDR;")";
Serial output
The output on serial (connected terminal to the Amtel) is the following:
reserve 107 bytes of memory...
memory start address: 13920
write machine language to memory...
read the poked values back...
read at: 13920 value: 34
read at: 13921 value: 32
read at: 13922 value: 139
read at: 13923 value: 32
read at: 13924 value: 141
read at: 13925 value: 34
read at: 13926 value: 72
read at: 13927 value: 139
read at: 13928 value: 32
read at: 13929 value: 140
read at: 13930 value: 34
read at: 13931 value: 69
read at: 13932 value: 139
read at: 13933 value: 32
read at: 13934 value: 139
read at: 13935 value: 34
read at: 13936 value: 76
read at: 13937 value: 139
read at: 13938 value: 32
read at: 13939 value: 138
read at: 13940 value: 34
read at: 13941 value: 76
read at: 13942 value: 139
read at: 13943 value: 32
read at: 13944 value: 137
read at: 13945 value: 34
read at: 13946 value: 79
read at: 13947 value: 139
read at: 13948 value: 32
read at: 13949 value: 136
read at: 13950 value: 34
read at: 13951 value: 82
read at: 13952 value: 139
read at: 13953 value: 32
read at: 13954 value: 135
read at: 13955 value: 34
read at: 13956 value: 76
read at: 13957 value: 139
read at: 13958 value: 32
read at: 13959 value: 134
read at: 13960 value: 34
read at: 13961 value: 68
read at: 13962 value: 139
read at: 13963 value: 32
read at: 13964 value: 133
read at: 13965 value: 34
read at: 13966 value: 33
read at: 13967 value: 139
read at: 13968 value: 32
read at: 13969 value: 132
read at: 13970 value: 34
read at: 13971 value: 32
read at: 13972 value: 139
read at: 13973 value: 32
read at: 13974 value: 131
read at: 13975 value: 34
read at: 13976 value: 32
read at: 13977 value: 139
read at: 13978 value: 32
read at: 13979 value: 130
read at: 13980 value: 34
read at: 13981 value: 32
read at: 13982 value: 139
read at: 13983 value: 32
read at: 13984 value: 129
read at: 13985 value: 34
read at: 13986 value: 32
read at: 13987 value: 139
read at: 13988 value: 32
read at: 13989 value: 128
read at: 13990 value: 34
read at: 13991 value: 32
read at: 13992 value: 139
read at: 13993 value: 32
read at: 13994 value: 127
read at: 13995 value: 34
read at: 13996 value: 32
read at: 13997 value: 139
read at: 13998 value: 32
read at: 13999 value: 126
read at: 14000 value: 34
read at: 14001 value: 32
read at: 14002 value: 139
read at: 14003 value: 32
read at: 14004 value: 125
read at: 14005 value: 34
read at: 14006 value: 32
read at: 14007 value: 139
read at: 14008 value: 32
read at: 14009 value: 124
read at: 14010 value: 34
read at: 14011 value: 32
read at: 14012 value: 139
read at: 14013 value: 32
read at: 14014 value: 123
read at: 14015 value: 34
read at: 14016 value: 32
read at: 14017 value: 139
read at: 14018 value: 32
read at: 14019 value: 122
read at: 14020 value: 34
read at: 14021 value: 32
read at: 14022 value: 139
read at: 14023 value: 32
read at: 14024 value: 121
read at: 14025 value: 0
read at: 14026 value: 224
read at: 14027 value: 254
press [shift] + [9] and [enter]
to execute the assembly program.
Unfortunately it ends in an endless loop
and nothing is displayed.
To break press RESET button and then
[shift] + [9] and [enter] to show the
video buffer with the result: HELLORLD!
Type in CALL EXEC( 13920 )
to run the machine program again or
type in CALL RELMEM( 13920 )
to release the memory.